Migrasi dari CI 4.4.6 -> 4.6.3

This commit is contained in:
mikael-zakaria 2025-08-15 09:45:16 +07:00
parent 0c12d880da
commit 84964a38fb
134 changed files with 12631 additions and 0 deletions

126
.gitignore vendored Normal file
View File

@ -0,0 +1,126 @@
#-------------------------
# Operating Specific Junk Files
#-------------------------
# OS X
.DS_Store
.AppleDouble
.LSOverride
# OS X Thumbnails
._*
# Windows image file caches
Thumbs.db
ehthumbs.db
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# Linux
*~
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
#-------------------------
# Environment Files
#-------------------------
# These should never be under version control,
# as it poses a security risk.
.env
.vagrant
Vagrantfile
#-------------------------
# Temporary Files
#-------------------------
writable/cache/*
!writable/cache/index.html
writable/logs/*
!writable/logs/index.html
writable/session/*
!writable/session/index.html
writable/uploads/*
!writable/uploads/index.html
writable/debugbar/*
!writable/debugbar/index.html
php_errors.log
#-------------------------
# User Guide Temp Files
#-------------------------
user_guide_src/build/*
user_guide_src/cilexer/build/*
user_guide_src/cilexer/dist/*
user_guide_src/cilexer/pycilexer.egg-info/*
#-------------------------
# Test Files
#-------------------------
tests/coverage*
# Don't save phpunit under version control.
phpunit
#-------------------------
# Composer
#-------------------------
vendor/
#-------------------------
# IDE / Development Files
#-------------------------
# Modules Testing
_modules/*
# phpenv local config
.php-version
# Jetbrains editors (PHPStorm, etc)
.idea/
*.iml
# NetBeans
/nbproject/
/build/
/nbbuild/
/dist/
/nbdist/
/nbactions.xml
/nb-configuration.xml
/.nb-gradle/
# Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project
.phpintel
/api/
# Visual Studio Code
.vscode/
/results/
/phpunit*.xml

22
LICENSE Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014-2019 British Columbia Institute of Technology
Copyright (c) 2019-present CodeIgniter Foundation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

68
README.md Normal file
View File

@ -0,0 +1,68 @@
# CodeIgniter 4 Application Starter
## What is CodeIgniter?
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
More information can be found at the [official site](https://codeigniter.com).
This repository holds a composer-installable app starter.
It has been built from the
[development repository](https://github.com/codeigniter4/CodeIgniter4).
More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums.
You can read the [user guide](https://codeigniter.com/user_guide/)
corresponding to the latest version of the framework.
## Installation & updates
`composer create-project codeigniter4/appstarter` then `composer update` whenever
there is a new release of the framework.
When updating, check the release notes to see if there are any changes you might need to apply
to your `app` folder. The affected files can be copied or merged from
`vendor/codeigniter4/framework/app`.
## Setup
Copy `env` to `.env` and tailor for your app, specifically the baseURL
and any database settings.
## Important Change with index.php
`index.php` is no longer in the root of the project! It has been moved inside the *public* folder,
for better security and separation of components.
This means that you should configure your web server to "point" to your project's *public* folder, and
not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the
framework are exposed.
**Please** read the user guide for a better explanation of how CI4 works!
## Repository Management
We use GitHub issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages.
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
FEATURE REQUESTS.
This repository is a "distribution" one, built by our release preparation script.
Problems with it can be raised on our forum, or as issues in the main repository.
## Server Requirements
PHP version 8.1 or higher is required, with the following extensions installed:
- [intl](http://php.net/manual/en/intl.requirements.php)
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
> [!WARNING]
> - The end of life date for PHP 7.4 was November 28, 2022.
> - The end of life date for PHP 8.0 was November 26, 2023.
> - If you are still using PHP 7.4 or 8.0, you should upgrade immediately.
> - The end of life date for PHP 8.1 will be December 31, 2025.
Additionally, make sure that the following extensions are enabled in your PHP:
- json (enabled by default - don't turn it off)
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library

6
app/.htaccess Normal file
View File

@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

15
app/Common.php Normal file
View File

@ -0,0 +1,15 @@
<?php
/**
* The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during
* the bootstrap process and is called during the framework's
* execution.
*
* This can be looked at as a `master helper` file that is
* loaded early on, and may also contain additional functions
* that you'd like to use throughout your entire application
*
* @see: https://codeigniter.com/user_guide/extending/common.html
*/

202
app/Config/App.php Normal file
View File

@ -0,0 +1,202 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class App extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Base Site URL
* --------------------------------------------------------------------------
*
* URL to your CodeIgniter root. Typically, this will be your base URL,
* WITH a trailing slash:
*
* E.g., http://example.com/
*/
public string $baseURL = 'http://localhost:8080/';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
* If you want to accept multiple Hostnames, set this.
*
* E.g.,
* When your site URL ($baseURL) is 'http://example.com/', and your site
* also accepts 'http://media.example.com/' and 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var list<string>
*/
public array $allowedHostnames = [];
/**
* --------------------------------------------------------------------------
* Index File
* --------------------------------------------------------------------------
*
* Typically, this will be your `index.php` file, unless you've renamed it to
* something else. If you have configured your web server to remove this file
* from your site URIs, set this variable to an empty string.
*/
public string $indexPage = 'index.php';
/**
* --------------------------------------------------------------------------
* URI PROTOCOL
* --------------------------------------------------------------------------
*
* This item determines which server global should be used to retrieve the
* URI string. The default setting of 'REQUEST_URI' works for most servers.
* If your links do not seem to work, try one of the other delicious flavors:
*
* 'REQUEST_URI': Uses $_SERVER['REQUEST_URI']
* 'QUERY_STRING': Uses $_SERVER['QUERY_STRING']
* 'PATH_INFO': Uses $_SERVER['PATH_INFO']
*
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
*/
public string $uriProtocol = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.
|
| By default, only these are allowed: `a-z 0-9~%.:_-`
|
| Set an empty string to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be used as: '/\A[<permittedURIChars>]+\z/iu'
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
public string $permittedURIChars = 'a-z 0-9~%.:_\-';
/**
* --------------------------------------------------------------------------
* Default Locale
* --------------------------------------------------------------------------
*
* The Locale roughly represents the language and location that your visitor
* is viewing the site from. It affects the language strings and other
* strings (like currency markers, numbers, etc), that your program
* should run under for this request.
*/
public string $defaultLocale = 'en';
/**
* --------------------------------------------------------------------------
* Negotiate Locale
* --------------------------------------------------------------------------
*
* If true, the current Request object will automatically determine the
* language to use based on the value of the Accept-Language header.
*
* If false, no automatic detection will be performed.
*/
public bool $negotiateLocale = false;
/**
* --------------------------------------------------------------------------
* Supported Locales
* --------------------------------------------------------------------------
*
* If $negotiateLocale is true, this array lists the locales supported
* by the application in descending order of priority. If no match is
* found, the first locale will be used.
*
* IncomingRequest::setLocale() also uses this list.
*
* @var list<string>
*/
public array $supportedLocales = ['en'];
/**
* --------------------------------------------------------------------------
* Application Timezone
* --------------------------------------------------------------------------
*
* The default timezone that will be used in your application to display
* dates with the date helper, and can be retrieved through app_timezone()
*
* @see https://www.php.net/manual/en/timezones.php for list of timezones
* supported by PHP.
*/
public string $appTimezone = 'UTC';
/**
* --------------------------------------------------------------------------
* Default Character Set
* --------------------------------------------------------------------------
*
* This determines which character set is used by default in various methods
* that require a character set to be provided.
*
* @see http://php.net/htmlspecialchars for a list of supported charsets.
*/
public string $charset = 'UTF-8';
/**
* --------------------------------------------------------------------------
* Force Global Secure Requests
* --------------------------------------------------------------------------
*
* If true, this will force every request made to this application to be
* made via a secure connection (HTTPS). If the incoming request is not
* secure, the user will be redirected to a secure version of the page
* and the HTTP Strict Transport Security (HSTS) header will be set.
*/
public bool $forceGlobalSecureRequests = false;
/**
* --------------------------------------------------------------------------
* Reverse Proxy IPs
* --------------------------------------------------------------------------
*
* If your server is behind a reverse proxy, you must whitelist the proxy
* IP addresses from which CodeIgniter should trust headers such as
* X-Forwarded-For or Client-IP in order to properly identify
* the visitor's IP address.
*
* You need to set a proxy IP address or IP address with subnets and
* the HTTP header for the client IP address.
*
* Here are some examples:
* [
* '10.0.1.200' => 'X-Forwarded-For',
* '192.168.5.0/24' => 'X-Real-IP',
* ]
*
* @var array<string, string>
*/
public array $proxyIPs = [];
/**
* --------------------------------------------------------------------------
* Content Security Policy
* --------------------------------------------------------------------------
*
* Enables the Response's Content Secure Policy to restrict the sources that
* can be used for images, scripts, CSS files, audio, video, etc. If enabled,
* the Response object will populate default values for the policy from the
* `ContentSecurityPolicy.php` file. Controllers can always add to those
* restrictions at run time.
*
* For a better understanding of CSP, see these documents:
*
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
* @see http://www.w3.org/TR/CSP/
*/
public bool $CSPEnabled = false;
}

92
app/Config/Autoload.php Normal file
View File

@ -0,0 +1,92 @@
<?php
namespace Config;
use CodeIgniter\Config\AutoloadConfig;
/**
* -------------------------------------------------------------------
* AUTOLOADER CONFIGURATION
* -------------------------------------------------------------------
*
* This file defines the namespaces and class maps so the Autoloader
* can find the files as needed.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Autoload extends AutoloadConfig
{
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The 'Config' (APPPATH . 'Config') and 'CodeIgniter' (SYSTEMPATH) are
* already mapped for you.
*
* You may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* @var array<string, list<string>|string>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH,
];
/**
* -------------------------------------------------------------------
* Class Map
* -------------------------------------------------------------------
* The class map provides a map of class names and their exact
* location on the drive. Classes loaded in this manner will have
* slightly faster performance because they will not have to be
* searched for within one or more directories as they would if they
* were being autoloaded through a namespace.
*
* Prototype:
* $classmap = [
* 'MyClass' => '/path/to/class/file.php'
* ];
*
* @var array<string, string>
*/
public $classmap = [];
/**
* -------------------------------------------------------------------
* Files
* -------------------------------------------------------------------
* The files array provides a list of paths to __non-class__ files
* that will be autoloaded. This can be useful for bootstrap operations
* or for loading functions.
*
* Prototype:
* $files = [
* '/path/to/my/file.php',
* ];
*
* @var list<string>
*/
public $files = [];
/**
* -------------------------------------------------------------------
* Helpers
* -------------------------------------------------------------------
* Prototype:
* $helpers = [
* 'form',
* ];
*
* @var list<string>
*/
public $helpers = [];
}

View File

@ -0,0 +1,34 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. This will control whether Kint is loaded, and a few other
| items. It can always be used within your own application too.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@ -0,0 +1,25 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| Don't show ANY in production environments. Instead, let the system catch
| it and display a generic error message.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL & ~E_DEPRECATED);
// If you want to suppress more types of errors.
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
ini_set('display_errors', '0');
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', false);

View File

@ -0,0 +1,38 @@
<?php
/*
* The environment testing is reserved for PHPUnit testing. It has special
* conditions built into the framework at various places to assist with that.
* You cant use it for your development.
*/
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);

View File

@ -0,0 +1,20 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class CURLRequest extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CURLRequest Share Options
* --------------------------------------------------------------------------
*
* Whether share options between requests or not.
*
* If true, all the options won't be reset between requests.
* It may cause an error request with unnecessary headers.
*/
public bool $shareOptions = false;
}

162
app/Config/Cache.php Normal file
View File

@ -0,0 +1,162 @@
<?php
namespace Config;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
use CodeIgniter\Cache\Handlers\PredisHandler;
use CodeIgniter\Cache\Handlers\RedisHandler;
use CodeIgniter\Cache\Handlers\WincacheHandler;
use CodeIgniter\Config\BaseConfig;
class Cache extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Primary Handler
* --------------------------------------------------------------------------
*
* The name of the preferred handler that should be used. If for some reason
* it is not available, the $backupHandler will be used in its place.
*/
public string $handler = 'file';
/**
* --------------------------------------------------------------------------
* Backup Handler
* --------------------------------------------------------------------------
*
* The name of the handler that will be used in case the first one is
* unreachable. Often, 'file' is used here since the filesystem is
* always available, though that's not always practical for the app.
*/
public string $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Key Prefix
* --------------------------------------------------------------------------
*
* This string is added to all cache item names to help avoid collisions
* if you run multiple applications with the same cache engine.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Default TTL
* --------------------------------------------------------------------------
*
* The default number of seconds to save items when none is specified.
*
* WARNING: This is not used by framework handlers where 60 seconds is
* hard-coded, but may be useful to projects and modules. This will replace
* the hard-coded value in a future release.
*/
public int $ttl = 60;
/**
* --------------------------------------------------------------------------
* Reserved Characters
* --------------------------------------------------------------------------
*
* A string of reserved characters that will not be allowed in keys or tags.
* Strings that violate this restriction will cause handlers to throw.
* Default: {}()/\@:
*
* NOTE: The default set is required for PSR-6 compliance.
*/
public string $reservedCharacters = '{}()/\@:';
/**
* --------------------------------------------------------------------------
* File settings
* --------------------------------------------------------------------------
*
* Your file storage preferences can be specified below, if you are using
* the File driver.
*
* @var array{storePath?: string, mode?: int}
*/
public array $file = [
'storePath' => WRITEPATH . 'cache/',
'mode' => 0640,
];
/**
* -------------------------------------------------------------------------
* Memcached settings
* -------------------------------------------------------------------------
*
* Your Memcached servers can be specified below, if you are using
* the Memcached drivers.
*
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
*
* @var array{host?: string, port?: int, weight?: int, raw?: bool}
*/
public array $memcached = [
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1,
'raw' => false,
];
/**
* -------------------------------------------------------------------------
* Redis settings
* -------------------------------------------------------------------------
*
* Your Redis server can be specified below, if you are using
* the Redis or Predis drivers.
*
* @var array{host?: string, password?: string|null, port?: int, timeout?: int, database?: int}
*/
public array $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
];
/**
* --------------------------------------------------------------------------
* Available Cache Handlers
* --------------------------------------------------------------------------
*
* This is an array of cache engine alias' and class names. Only engines
* that are listed here are allowed to be used.
*
* @var array<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'dummy' => DummyHandler::class,
'file' => FileHandler::class,
'memcached' => MemcachedHandler::class,
'predis' => PredisHandler::class,
'redis' => RedisHandler::class,
'wincache' => WincacheHandler::class,
];
/**
* --------------------------------------------------------------------------
* Web Page Caching: Cache Include Query String
* --------------------------------------------------------------------------
*
* Whether to take the URL query string into consideration when generating
* output cache files. Valid options are:
*
* false = Disabled
* true = Enabled, take all query parameters into account.
* Please be aware that this may result in numerous cache
* files generated for the same page over and over again.
* ['q'] = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|list<string>
*/
public $cacheQueryString = false;
}

79
app/Config/Constants.php Normal file
View File

@ -0,0 +1,79 @@
<?php
/*
| --------------------------------------------------------------------
| App Namespace
| --------------------------------------------------------------------
|
| This defines the default Namespace that is used throughout
| CodeIgniter to refer to the Application directory. Change
| this constant to change the namespace that all application
| classes should use.
|
| NOTE: changing this will require manually modifying the
| existing namespaces of App\* namespaced-classes.
*/
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
/*
| --------------------------------------------------------------------------
| Composer Path
| --------------------------------------------------------------------------
|
| The path that Composer's autoload file is expected to live. By default,
| the vendor folder is in the Root directory, but you can customize that here.
*/
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
/*
|--------------------------------------------------------------------------
| Timing Constants
|--------------------------------------------------------------------------
|
| Provide simple ways to work with the myriad of PHP functions that
| require information to be in seconds.
*/
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2_592_000);
defined('YEAR') || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);
/*
| --------------------------------------------------------------------------
| Exit Status Codes
| --------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code

View File

@ -0,0 +1,176 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Stores the default settings for the ContentSecurityPolicy, if you
* choose to use it. The values here will be read in and set as defaults
* for the site. If needed, they can be overridden on a page-by-page basis.
*
* Suggested reference for explanations:
*
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
*/
class ContentSecurityPolicy extends BaseConfig
{
// -------------------------------------------------------------------------
// Broadbrush CSP management
// -------------------------------------------------------------------------
/**
* Default CSP report context
*/
public bool $reportOnly = false;
/**
* Specifies a URL where a browser will send reports
* when a content security policy is violated.
*/
public ?string $reportURI = null;
/**
* Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten.
*/
public bool $upgradeInsecureRequests = false;
// -------------------------------------------------------------------------
// Sources allowed
// NOTE: once you set a policy to 'none', it cannot be further restricted
// -------------------------------------------------------------------------
/**
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $defaultSrc;
/**
* Lists allowed scripts' URLs.
*
* @var list<string>|string
*/
public $scriptSrc = 'self';
/**
* Lists allowed stylesheets' URLs.
*
* @var list<string>|string
*/
public $styleSrc = 'self';
/**
* Defines the origins from which images can be loaded.
*
* @var list<string>|string
*/
public $imageSrc = 'self';
/**
* Restricts the URLs that can appear in a page's `<base>` element.
*
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $baseURI;
/**
* Lists the URLs for workers and embedded frame contents
*
* @var list<string>|string
*/
public $childSrc = 'self';
/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var list<string>|string
*/
public $connectSrc = 'self';
/**
* Specifies the origins that can serve web fonts.
*
* @var list<string>|string
*/
public $fontSrc;
/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var list<string>|string
*/
public $formAction = 'self';
/**
* Specifies the sources that can embed the current page.
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var list<string>|string|null
*/
public $frameAncestors;
/**
* The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts.
*
* @var list<string>|string|null
*/
public $frameSrc;
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var list<string>|string|null
*/
public $mediaSrc;
/**
* Allows control over Flash and other plugins.
*
* @var list<string>|string
*/
public $objectSrc = 'self';
/**
* @var list<string>|string|null
*/
public $manifestSrc;
/**
* Limits the kinds of plugins a page may invoke.
*
* @var list<string>|string|null
*/
public $pluginTypes;
/**
* List of actions allowed.
*
* @var list<string>|string|null
*/
public $sandbox;
/**
* Nonce tag for style
*/
public string $styleNonceTag = '{csp-style-nonce}';
/**
* Nonce tag for script
*/
public string $scriptNonceTag = '{csp-script-nonce}';
/**
* Replace nonce tag automatically
*/
public bool $autoNonce = true;
}

107
app/Config/Cookie.php Normal file
View File

@ -0,0 +1,107 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use DateTimeInterface;
class Cookie extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Expires Timestamp
* --------------------------------------------------------------------------
*
* Default expires timestamp for cookies. Setting this to `0` will mean the
* cookie will not have the `Expires` attribute and will behave as a session
* cookie.
*
* @var DateTimeInterface|int|string
*/
public $expires = 0;
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*/
public string $path = '/';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*/
public string $domain = '';
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*/
public bool $secure = false;
/**
* --------------------------------------------------------------------------
* Cookie HTTPOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*/
public bool $httponly = true;
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set.
*
* @var ''|'Lax'|'None'|'Strict'
*/
public string $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie Raw
* --------------------------------------------------------------------------
*
* This flag allows setting a "raw" cookie, i.e., its name and value are
* not URL encoded using `rawurlencode()`.
*
* If this is set to `true`, cookie names should be compliant of RFC 2616's
* list of allowed characters.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
* @see https://tools.ietf.org/html/rfc2616#section-2.2
*/
public bool $raw = false;
}

105
app/Config/Cors.php Normal file
View File

@ -0,0 +1,105 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Cross-Origin Resource Sharing (CORS) Configuration
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
*/
class Cors extends BaseConfig
{
/**
* The default CORS configuration.
*
* @var array{
* allowedOrigins: list<string>,
* allowedOriginsPatterns: list<string>,
* supportsCredentials: bool,
* allowedHeaders: list<string>,
* exposedHeaders: list<string>,
* allowedMethods: list<string>,
* maxAge: int,
* }
*/
public array $default = [
/**
* Origins for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* E.g.:
* - ['http://localhost:8080']
* - ['https://www.example.com']
*/
'allowedOrigins' => [],
/**
* Origin regex patterns for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* NOTE: A pattern specified here is part of a regular expression. It will
* be actually `#\A<pattern>\z#`.
*
* E.g.:
* - ['https://\w+\.example\.com']
*/
'allowedOriginsPatterns' => [],
/**
* Weather to send the `Access-Control-Allow-Credentials` header.
*
* The Access-Control-Allow-Credentials response header tells browsers whether
* the server allows cross-origin HTTP requests to include credentials.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
*/
'supportsCredentials' => false,
/**
* Set headers to allow.
*
* The Access-Control-Allow-Headers response header is used in response to
* a preflight request which includes the Access-Control-Request-Headers to
* indicate which HTTP headers can be used during the actual request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
*/
'allowedHeaders' => [],
/**
* Set headers to expose.
*
* The Access-Control-Expose-Headers response header allows a server to
* indicate which response headers should be made available to scripts running
* in the browser, in response to a cross-origin request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
*/
'exposedHeaders' => [],
/**
* Set methods to allow.
*
* The Access-Control-Allow-Methods response header specifies one or more
* methods allowed when accessing a resource in response to a preflight
* request.
*
* E.g.:
* - ['GET', 'POST', 'PUT', 'DELETE']
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
*/
'allowedMethods' => [],
/**
* Set how many seconds the results of a preflight request can be cached.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
*/
'maxAge' => 7200,
];
}

203
app/Config/Database.php Normal file
View File

@ -0,0 +1,203 @@
<?php
namespace Config;
use CodeIgniter\Database\Config;
/**
* Database Configuration
*/
class Database extends Config
{
/**
* The directory that holds the Migrations and Seeds directories.
*/
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/**
* Lets you choose which connection group to use if no other is specified.
*/
public string $defaultGroup = 'default';
/**
* The default database connection.
*
* @var array<string, mixed>
*/
public array $default = [
'DSN' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8mb4',
'DBCollat' => 'utf8mb4_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'numberNative' => false,
'foundRows' => false,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
// /**
// * Sample database connection for SQLite3.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'database' => 'database.db',
// 'DBDriver' => 'SQLite3',
// 'DBPrefix' => '',
// 'DBDebug' => true,
// 'swapPre' => '',
// 'failover' => [],
// 'foreignKeys' => true,
// 'busyTimeout' => 1000,
// 'synchronous' => null,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for Postgre.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'public',
// 'DBDriver' => 'Postgre',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'failover' => [],
// 'port' => 5432,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for SQLSRV.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'dbo',
// 'DBDriver' => 'SQLSRV',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'encrypt' => false,
// 'failover' => [],
// 'port' => 1433,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for OCI8.
// *
// * You may need the following environment variables:
// * NLS_LANG = 'AMERICAN_AMERICA.UTF8'
// * NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => 'localhost:1521/XEPDB1',
// 'username' => 'root',
// 'password' => 'root',
// 'DBDriver' => 'OCI8',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'AL32UTF8',
// 'swapPre' => '',
// 'failover' => [],
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
/**
* This database connection is used when running PHPUnit database tests.
*
* @var array<string, mixed>
*/
public array $tests = [
'DSN' => '',
'hostname' => '127.0.0.1',
'username' => '',
'password' => '',
'database' => ':memory:',
'DBDriver' => 'SQLite3',
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => '',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
public function __construct()
{
parent::__construct();
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
if (ENVIRONMENT === 'testing') {
$this->defaultGroup = 'tests';
}
}
}

43
app/Config/DocTypes.php Normal file
View File

@ -0,0 +1,43 @@
<?php
namespace Config;
class DocTypes
{
/**
* List of valid document types.
*
* @var array<string, string>
*/
public array $list = [
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
];
/**
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
* for HTML5 compatibility.
*
* Set to:
* `true` - to be HTML5 compatible
* `false` - to be XHTML compatible
*/
public bool $html5 = true;
}

121
app/Config/Email.php Normal file
View File

@ -0,0 +1,121 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Email extends BaseConfig
{
public string $fromEmail = '';
public string $fromName = '';
public string $recipients = '';
/**
* The "user agent"
*/
public string $userAgent = 'CodeIgniter';
/**
* The mail sending protocol: mail, sendmail, smtp
*/
public string $protocol = 'mail';
/**
* The server path to Sendmail.
*/
public string $mailPath = '/usr/sbin/sendmail';
/**
* SMTP Server Hostname
*/
public string $SMTPHost = '';
/**
* SMTP Username
*/
public string $SMTPUser = '';
/**
* SMTP Password
*/
public string $SMTPPass = '';
/**
* SMTP Port
*/
public int $SMTPPort = 25;
/**
* SMTP Timeout (in seconds)
*/
public int $SMTPTimeout = 5;
/**
* Enable persistent SMTP connections
*/
public bool $SMTPKeepAlive = false;
/**
* SMTP Encryption.
*
* @var string '', 'tls' or 'ssl'. 'tls' will issue a STARTTLS command
* to the server. 'ssl' means implicit SSL. Connection on port
* 465 should set this to ''.
*/
public string $SMTPCrypto = 'tls';
/**
* Enable word-wrap
*/
public bool $wordWrap = true;
/**
* Character count to wrap at
*/
public int $wrapChars = 76;
/**
* Type of mail, either 'text' or 'html'
*/
public string $mailType = 'text';
/**
* Character set (utf-8, iso-8859-1, etc.)
*/
public string $charset = 'UTF-8';
/**
* Whether to validate the email address
*/
public bool $validate = false;
/**
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
*/
public int $priority = 3;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $CRLF = "\r\n";
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $newline = "\r\n";
/**
* Enable BCC Batch Mode.
*/
public bool $BCCBatchMode = false;
/**
* Number of emails in each BCC batch
*/
public int $BCCBatchSize = 200;
/**
* Enable notify message from server
*/
public bool $DSN = false;
}

92
app/Config/Encryption.php Normal file
View File

@ -0,0 +1,92 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Encryption configuration.
*
* These are the settings used for encryption, if you don't pass a parameter
* array to the encrypter for creation/initialization.
*/
class Encryption extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Encryption Key Starter
* --------------------------------------------------------------------------
*
* If you use the Encryption class you must set an encryption key (seed).
* You need to ensure it is long enough for the cipher and mode you plan to use.
* See the user guide for more info.
*/
public string $key = '';
/**
* --------------------------------------------------------------------------
* Encryption Driver to Use
* --------------------------------------------------------------------------
*
* One of the supported encryption drivers.
*
* Available drivers:
* - OpenSSL
* - Sodium
*/
public string $driver = 'OpenSSL';
/**
* --------------------------------------------------------------------------
* SodiumHandler's Padding Length in Bytes
* --------------------------------------------------------------------------
*
* This is the number of bytes that will be padded to the plaintext message
* before it is encrypted. This value should be greater than zero.
*
* See the user guide for more information on padding.
*/
public int $blockSize = 16;
/**
* --------------------------------------------------------------------------
* Encryption digest
* --------------------------------------------------------------------------
*
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
*/
public string $digest = 'SHA512';
/**
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
* This setting is only used by OpenSSLHandler.
*
* Set to false for CI3 Encryption compatibility.
*/
public bool $rawData = true;
/**
* Encryption key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'encryption' for CI3 Encryption compatibility.
*/
public string $encryptKeyInfo = '';
/**
* Authentication key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'authentication' for CI3 Encryption compatibility.
*/
public string $authKeyInfo = '';
/**
* Cipher to use.
* This setting is only used by OpenSSLHandler.
*
* Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
* by CI3 Encryption default configuration.
*/
public string $cipher = 'AES-256-CTR';
}

55
app/Config/Events.php Normal file
View File

@ -0,0 +1,55 @@
<?php
namespace Config;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
use CodeIgniter\HotReloader\HotReloader;
/*
* --------------------------------------------------------------------
* Application Events
* --------------------------------------------------------------------
* Events allow you to tap into the execution of the program without
* modifying or extending core files. This file provides a central
* location to define your events, though they can always be added
* at run-time, also, if needed.
*
* You create code that can execute by subscribing to events with
* the 'on()' method. This accepts any form of callable, including
* Closures, that will be executed when the event is triggered.
*
* Example:
* Events::on('create', [$myInstance, 'myMethod']);
*/
Events::on('pre_system', static function (): void {
if (ENVIRONMENT !== 'testing') {
if (ini_get('zlib.output_compression')) {
throw FrameworkException::forEnabledZlibOutputCompression();
}
while (ob_get_level() > 0) {
ob_end_flush();
}
ob_start(static fn ($buffer) => $buffer);
}
/*
* --------------------------------------------------------------------
* Debug Toolbar Listeners.
* --------------------------------------------------------------------
* If you delete, they will no longer be collected.
*/
if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
service('toolbar')->respond();
// Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') {
service('routes')->get('__hot-reload', static function (): void {
(new HotReloader())->run();
});
}
}
});

106
app/Config/Exceptions.php Normal file
View File

@ -0,0 +1,106 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\ExceptionHandler;
use CodeIgniter\Debug\ExceptionHandlerInterface;
use Psr\Log\LogLevel;
use Throwable;
/**
* Setup how the exception handler works.
*/
class Exceptions extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* LOG EXCEPTIONS?
* --------------------------------------------------------------------------
* If true, then exceptions will be logged
* through Services::Log.
*
* Default: true
*/
public bool $log = true;
/**
* --------------------------------------------------------------------------
* DO NOT LOG STATUS CODES
* --------------------------------------------------------------------------
* Any status codes here will NOT be logged if logging is turned on.
* By default, only 404 (Page Not Found) exceptions are ignored.
*
* @var list<int>
*/
public array $ignoreCodes = [404];
/**
* --------------------------------------------------------------------------
* Error Views Path
* --------------------------------------------------------------------------
* This is the path to the directory that contains the 'cli' and 'html'
* directories that hold the views used to generate errors.
*
* Default: APPPATH.'Views/errors'
*/
public string $errorViewPath = APPPATH . 'Views/errors';
/**
* --------------------------------------------------------------------------
* HIDE FROM DEBUG TRACE
* --------------------------------------------------------------------------
* Any data that you would like to hide from the debug trace.
* In order to specify 2 levels, use "/" to separate.
* ex. ['server', 'setup/password', 'secret_token']
*
* @var list<string>
*/
public array $sensitiveDataInTrace = [];
/**
* --------------------------------------------------------------------------
* WHETHER TO THROW AN EXCEPTION ON DEPRECATED ERRORS
* --------------------------------------------------------------------------
* If set to `true`, DEPRECATED errors are only logged and no exceptions are
* thrown. This option also works for user deprecations.
*/
public bool $logDeprecations = true;
/**
* --------------------------------------------------------------------------
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
* --------------------------------------------------------------------------
* If `$logDeprecations` is set to `true`, this sets the log level
* to which the deprecation will be logged. This should be one of the log
* levels recognized by PSR-3.
*
* The related `Config\Logger::$threshold` should be adjusted, if needed,
* to capture logging the deprecations.
*/
public string $deprecationLogLevel = LogLevel::WARNING;
/*
* DEFINE THE HANDLERS USED
* --------------------------------------------------------------------------
* Given the HTTP status code, returns exception handler that
* should be used to deal with this error. By default, it will run CodeIgniter's
* default handler and display the error information in the expected format
* for CLI, HTTP, or AJAX requests, as determined by is_cli() and the expected
* response format.
*
* Custom handlers can be returned if you want to handle one or more specific
* error codes yourself like:
*
* if (in_array($statusCode, [400, 404, 500])) {
* return new \App\Libraries\MyExceptionHandler();
* }
* if ($exception instanceOf PageNotFoundException) {
* return new \App\Libraries\MyExceptionHandler();
* }
*/
public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
{
return new ExceptionHandler($this);
}
}

37
app/Config/Feature.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Enable/disable backward compatibility breaking features.
*/
class Feature extends BaseConfig
{
/**
* Use improved new auto routing instead of the legacy version.
*/
public bool $autoRoutesImproved = true;
/**
* Use filter execution order in 4.4 or before.
*/
public bool $oldFilterOrder = false;
/**
* The behavior of `limit(0)` in Query Builder.
*
* If true, `limit(0)` returns all records. (the behavior of 4.4.x or before in version 4.x.)
* If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.)
*/
public bool $limitZeroAsAll = true;
/**
* Use strict location negotiation.
*
* By default, the locale is selected based on a loose comparison of the language code (ISO 639-1)
* Enabling strict comparison will also consider the region code (ISO 3166-1 alpha-2).
*/
public bool $strictLocaleNegotiation = false;
}

110
app/Config/Filters.php Normal file
View File

@ -0,0 +1,110 @@
<?php
namespace Config;
use CodeIgniter\Config\Filters as BaseFilters;
use CodeIgniter\Filters\Cors;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\ForceHTTPS;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\PageCache;
use CodeIgniter\Filters\PerformanceMetrics;
use CodeIgniter\Filters\SecureHeaders;
class Filters extends BaseFilters
{
/**
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, class-string|list<class-string>>
*
* [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
*/
public array $aliases = [
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
'cors' => Cors::class,
'forcehttps' => ForceHTTPS::class,
'pagecache' => PageCache::class,
'performance' => PerformanceMetrics::class,
];
/**
* List of special required filters.
*
* The filters listed here are special. They are applied before and after
* other kinds of filters, and always applied even if a route does not exist.
*
* Filters set by default provide framework functionality. If removed,
* those functions will no longer work.
*
* @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
*
* @var array{before: list<string>, after: list<string>}
*/
public array $required = [
'before' => [
'forcehttps', // Force Global Secure Requests
'pagecache', // Web Page Caching
],
'after' => [
'pagecache', // Web Page Caching
'performance', // Performance Metrics
'toolbar', // Debug Toolbar
],
];
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array{
* before: array<string, array{except: list<string>|string}>|list<string>,
* after: array<string, array{except: list<string>|string}>|list<string>
* }
*/
public array $globals = [
'before' => [
// 'honeypot',
// 'csrf',
// 'invalidchars',
],
'after' => [
// 'honeypot',
// 'secureheaders',
],
];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'POST' => ['foo', 'bar']
*
* If you use this, you should disable auto-routing because auto-routing
* permits any HTTP method to access a controller. Accessing the controller
* with a method you don't expect could bypass the filter.
*
* @var array<string, list<string>>
*/
public array $methods = [];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*
* @var array<string, array<string, list<string>>>
*/
public array $filters = [];
}

View File

@ -0,0 +1,12 @@
<?php
namespace Config;
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
/**
* @immutable
*/
class ForeignCharacters extends BaseForeignCharacters
{
}

64
app/Config/Format.php Normal file
View File

@ -0,0 +1,64 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Format\JSONFormatter;
use CodeIgniter\Format\XMLFormatter;
class Format extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Available Response Formats
* --------------------------------------------------------------------------
*
* When you perform content negotiation with the request, these are the
* available formats that your application supports. This is currently
* only used with the API\ResponseTrait. A valid Formatter must exist
* for the specified format.
*
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var list<string>
*/
public array $supportedResponseFormats = [
'application/json',
'application/xml', // machine-readable XML
'text/xml', // human-readable XML
];
/**
* --------------------------------------------------------------------------
* Formatters
* --------------------------------------------------------------------------
*
* Lists the class to use to format responses with of a particular type.
* For each mime type, list the class that should be used. Formatters
* can be retrieved through the getFormatter() method.
*
* @var array<string, string>
*/
public array $formatters = [
'application/json' => JSONFormatter::class,
'application/xml' => XMLFormatter::class,
'text/xml' => XMLFormatter::class,
];
/**
* --------------------------------------------------------------------------
* Formatters Options
* --------------------------------------------------------------------------
*
* Additional Options to adjust default formatters behaviour.
* For each mime type, list the additional options that should be used.
*
* @var array<string, int>
*/
public array $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0,
'text/xml' => 0,
];
}

44
app/Config/Generators.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Generators extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Generator Commands' Views
* --------------------------------------------------------------------------
*
* This array defines the mapping of generator commands to the view files
* they are using. If you need to customize them for your own, copy these
* view files in your own folder and indicate the location here.
*
* You will notice that the views have special placeholders enclosed in
* curly braces `{...}`. These placeholders are used internally by the
* generator commands in processing replacements, thus you are warned
* not to delete them or modify the names. If you will do so, you may
* end up disrupting the scaffolding process and throw errors.
*
* YOU HAVE BEEN WARNED!
*
* @var array<string, array<string, string>|string>
*/
public array $views = [
'make:cell' => [
'class' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
'view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php',
],
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
}

42
app/Config/Honeypot.php Normal file
View File

@ -0,0 +1,42 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Honeypot extends BaseConfig
{
/**
* Makes Honeypot visible or not to human
*/
public bool $hidden = true;
/**
* Honeypot Label Content
*/
public string $label = 'Fill This Field';
/**
* Honeypot Field Name
*/
public string $name = 'honeypot';
/**
* Honeypot HTML Template
*/
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
/**
* Honeypot container
*
* If you enabled CSP, you can remove `style="display:none"`.
*/
public string $container = '<div style="display:none">{template}</div>';
/**
* The id attribute for Honeypot container tag
*
* Used when CSP is enabled.
*/
public string $containerId = 'hpc';
}

31
app/Config/Images.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Images\Handlers\GDHandler;
use CodeIgniter\Images\Handlers\ImageMagickHandler;
class Images extends BaseConfig
{
/**
* Default handler used if no other handler is specified.
*/
public string $defaultHandler = 'gd';
/**
* The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM.
*/
public string $libraryPath = '/usr/local/bin/convert';
/**
* The available handler classes.
*
* @var array<string, string>
*/
public array $handlers = [
'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class,
];
}

63
app/Config/Kint.php Normal file
View File

@ -0,0 +1,63 @@
<?php
namespace Config;
use Kint\Parser\ConstructablePluginInterface;
use Kint\Renderer\Rich\TabPluginInterface;
use Kint\Renderer\Rich\ValuePluginInterface;
/**
* --------------------------------------------------------------------------
* Kint
* --------------------------------------------------------------------------
*
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
* that you can set to customize how Kint works for you.
*
* @see https://kint-php.github.io/kint/ for details on these settings.
*/
class Kint
{
/*
|--------------------------------------------------------------------------
| Global Settings
|--------------------------------------------------------------------------
*/
/**
* @var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>|null
*/
public $plugins;
public int $maxDepth = 6;
public bool $displayCalledFrom = true;
public bool $expanded = false;
/*
|--------------------------------------------------------------------------
| RichRenderer Settings
|--------------------------------------------------------------------------
*/
public string $richTheme = 'aante-light.css';
public bool $richFolder = false;
/**
* @var array<string, class-string<ValuePluginInterface>>|null
*/
public $richObjectPlugins;
/**
* @var array<string, class-string<TabPluginInterface>>|null
*/
public $richTabPlugins;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public bool $cliColors = true;
public bool $cliForceUTF8 = false;
public bool $cliDetectWidth = true;
public int $cliMinWidth = 40;
}

151
app/Config/Logger.php Normal file
View File

@ -0,0 +1,151 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Log\Handlers\FileHandler;
use CodeIgniter\Log\Handlers\HandlerInterface;
class Logger extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Error Logging Threshold
* --------------------------------------------------------------------------
*
* You can enable error logging by setting a threshold over zero. The
* threshold determines what gets logged. Any values below or equal to the
* threshold will be logged.
*
* Threshold options are:
*
* - 0 = Disables logging, Error logging TURNED OFF
* - 1 = Emergency Messages - System is unusable
* - 2 = Alert Messages - Action Must Be Taken Immediately
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
* - 5 = Warnings - Exceptional occurrences that are not errors.
* - 6 = Notices - Normal but significant events.
* - 7 = Info - Interesting events, like user logging in, etc.
* - 8 = Debug - Detailed debug information.
* - 9 = All Messages
*
* You can also pass an array with threshold levels to show individual error types
*
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
*
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
* your log files will fill up very fast.
*
* @var int|list<int>
*/
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
/**
* --------------------------------------------------------------------------
* Date Format for Logs
* --------------------------------------------------------------------------
*
* Each item that is logged has an associated date. You can use PHP date
* codes to set your own date formatting
*/
public string $dateFormat = 'Y-m-d H:i:s';
/**
* --------------------------------------------------------------------------
* Log Handlers
* --------------------------------------------------------------------------
*
* The logging system supports multiple actions to be taken when something
* is logged. This is done by allowing for multiple Handlers, special classes
* designed to write the log to their chosen destinations, whether that is
* a file on the getServer, a cloud-based service, or even taking actions such
* as emailing the dev team.
*
* Each handler is defined by the class name used for that handler, and it
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
*
* The value of each key is an array of configuration items that are sent
* to the constructor of each handler. The only required configuration item
* is the 'handles' element, which must be an array of integer log levels.
* This is most easily handled by using the constants defined in the
* `Psr\Log\LogLevel` class.
*
* Handlers are executed in the order defined in this array, starting with
* the handler on top and continuing down.
*
* @var array<class-string<HandlerInterface>, array<string, int|list<string>|string>>
*/
public array $handlers = [
/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
FileHandler::class => [
// The log levels that this handler will handle.
'handles' => [
'critical',
'alert',
'emergency',
'debug',
'error',
'info',
'notice',
'warning',
],
/*
* The default filename extension for log files.
* An extension of 'php' allows for protecting the log files via basic
* scripting, when they are to be stored under a publicly accessible directory.
*
* NOTE: Leaving it blank will default to 'log'.
*/
'fileExtension' => '',
/*
* The file system permissions to be applied on newly created log files.
*
* IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
* integer notation (i.e. 0700, 0644, etc.)
*/
'filePermissions' => 0644,
/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],
/*
* The ChromeLoggerHandler requires the use of the Chrome web browser
* and the ChromeLogger extension. Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
// /*
// * The log levels that this handler will handle.
// */
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
// 'error', 'info', 'notice', 'warning'],
// ],
/*
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
* Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
// /* The log levels this handler can handle. */
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
//
// /*
// * The message type where the error should go. Can be 0 or 4, or use the
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
// */
// 'messageType' => 0,
// ],
];
}

50
app/Config/Migrations.php Normal file
View File

@ -0,0 +1,50 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Migrations extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Enable/Disable Migrations
* --------------------------------------------------------------------------
*
* Migrations are enabled by default.
*
* You should enable migrations whenever you intend to do a schema migration
* and disable it back when you're done.
*/
public bool $enabled = true;
/**
* --------------------------------------------------------------------------
* Migrations Table
* --------------------------------------------------------------------------
*
* This is the name of the table that will store the current migrations state.
* When migrations runs it will store in a database table which migration
* files have already been run.
*/
public string $table = 'migrations';
/**
* --------------------------------------------------------------------------
* Timestamp Format
* --------------------------------------------------------------------------
*
* This is the format that will be used when creating new migrations
* using the CLI command:
* > php spark make:migration
*
* NOTE: if you set an unsupported format, migration runner will not find
* your migration files.
*
* Supported formats:
* - YmdHis_
* - Y-m-d-His_
* - Y_m_d_His_
*/
public string $timestampFormat = 'Y-m-d-His_';
}

534
app/Config/Mimes.php Normal file
View File

@ -0,0 +1,534 @@
<?php
namespace Config;
/**
* This file contains an array of mime types. It is used by the
* Upload class to help identify allowed file types.
*
* When more than one variation for an extension exist (like jpg, jpeg, etc)
* the most common one should be first in the array to aid the guess*
* methods. The same applies when more than one mime-type exists for a
* single extension.
*
* When working with mime types, please make sure you have the ´fileinfo´
* extension enabled to reliably detect the media types.
*/
class Mimes
{
/**
* Map of extensions to mime types.
*
* @var array<string, list<string>|string>
*/
public static array $mimes = [
'hqx' => [
'application/mac-binhex40',
'application/mac-binhex',
'application/x-binhex40',
'application/x-mac-binhex40',
],
'cpt' => 'application/mac-compactpro',
'csv' => [
'text/csv',
'text/x-comma-separated-values',
'text/comma-separated-values',
'application/vnd.ms-excel',
'application/x-csv',
'text/x-csv',
'application/csv',
'application/excel',
'application/vnd.msexcel',
'text/plain',
],
'bin' => [
'application/macbinary',
'application/mac-binary',
'application/octet-stream',
'application/x-binary',
'application/x-macbinary',
],
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => [
'application/octet-stream',
'application/vnd.microsoft.portable-executable',
'application/x-dosexec',
'application/x-msdownload',
],
'class' => 'application/octet-stream',
'psd' => [
'application/x-photoshop',
'image/vnd.adobe.photoshop',
],
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => [
'application/pdf',
'application/force-download',
'application/x-download',
],
'ai' => [
'application/pdf',
'application/postscript',
],
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => [
'application/vnd.ms-excel',
'application/msexcel',
'application/x-msexcel',
'application/x-ms-excel',
'application/x-excel',
'application/x-dos_ms_excel',
'application/xls',
'application/x-xls',
'application/excel',
'application/download',
'application/vnd.ms-office',
'application/msword',
],
'ppt' => [
'application/vnd.ms-powerpoint',
'application/powerpoint',
'application/vnd.ms-office',
'application/msword',
],
'pptx' => [
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
],
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => [
'application/x-php',
'application/x-httpd-php',
'application/php',
'text/php',
'text/x-php',
'application/x-httpd-php-source',
],
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => [
'application/x-javascript',
'text/plain',
],
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => [
'application/x-tar',
'application/x-gzip-compressed',
],
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => [
'application/x-zip',
'application/zip',
'application/x-zip-compressed',
'application/s-compressed',
'multipart/x-zip',
],
'rar' => [
'application/vnd.rar',
'application/x-rar',
'application/rar',
'application/x-rar-compressed',
],
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => [
'audio/mpeg',
'audio/mpg',
'audio/mpeg3',
'audio/mp3',
],
'aif' => [
'audio/x-aiff',
'audio/aiff',
],
'aiff' => [
'audio/x-aiff',
'audio/aiff',
],
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => [
'audio/x-wav',
'audio/wave',
'audio/wav',
],
'bmp' => [
'image/bmp',
'image/x-bmp',
'image/x-bitmap',
'image/x-xbitmap',
'image/x-win-bitmap',
'image/x-windows-bmp',
'image/ms-bmp',
'image/x-ms-bmp',
'application/bmp',
'application/x-bmp',
'application/x-win-bitmap',
],
'gif' => 'image/gif',
'jpg' => [
'image/jpeg',
'image/pjpeg',
],
'jpeg' => [
'image/jpeg',
'image/pjpeg',
],
'jpe' => [
'image/jpeg',
'image/pjpeg',
],
'jp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'j2k' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpf' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpg2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpx' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpm' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mj2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mjp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'png' => [
'image/png',
'image/x-png',
],
'webp' => 'image/webp',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'css' => [
'text/css',
'text/plain',
],
'html' => [
'text/html',
'text/plain',
],
'htm' => [
'text/html',
'text/plain',
],
'shtml' => [
'text/html',
'text/plain',
],
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => [
'text/plain',
'text/x-log',
],
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => [
'application/xml',
'text/xml',
'text/plain',
],
'xsl' => [
'application/xml',
'text/xsl',
'text/xml',
],
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => [
'video/x-msvideo',
'video/msvideo',
'video/avi',
'application/x-troff-msvideo',
],
'movie' => 'video/x-sgi-movie',
'doc' => [
'application/msword',
'application/vnd.ms-office',
],
'docx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
'application/x-zip',
],
'dot' => [
'application/msword',
'application/vnd.ms-office',
],
'dotx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
],
'xlsx' => [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/zip',
'application/vnd.ms-excel',
'application/msword',
'application/x-zip',
],
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'word' => [
'application/msword',
'application/octet-stream',
],
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => [
'application/json',
'text/json',
],
'pem' => [
'application/x-x509-user-cert',
'application/x-pem-file',
'application/octet-stream',
],
'p10' => [
'application/x-pkcs10',
'application/pkcs10',
],
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7m' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => [
'application/x-x509-ca-cert',
'application/x-x509-user-cert',
'application/pkix-cert',
],
'crl' => [
'application/pkix-crl',
'application/pkcs-crl',
],
'der' => 'application/x-x509-ca-cert',
'kdb' => 'application/octet-stream',
'pgp' => 'application/pgp',
'gpg' => 'application/gpg-keys',
'sst' => 'application/octet-stream',
'csr' => 'application/octet-stream',
'rsa' => 'application/x-pkcs7',
'cer' => [
'application/pkix-cert',
'application/x-x509-ca-cert',
],
'3g2' => 'video/3gpp2',
'3gp' => [
'video/3gp',
'video/3gpp',
],
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => [
'video/mp4',
'video/x-f4v',
],
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => [
'video/x-ms-wmv',
'video/x-ms-asf',
],
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => [
'audio/ogg',
'video/ogg',
'application/ogg',
],
'kmz' => [
'application/vnd.google-earth.kmz',
'application/zip',
'application/x-zip',
],
'kml' => [
'application/vnd.google-earth.kml+xml',
'application/xml',
'text/xml',
],
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => [
'application/x-compressed',
'application/x-zip-compressed',
'application/zip',
'multipart/x-zip',
],
'cdr' => [
'application/cdr',
'application/coreldraw',
'application/x-cdr',
'application/x-coreldraw',
'image/cdr',
'image/x-cdr',
'zz-application/zz-winassoc-cdr',
],
'wma' => [
'audio/x-ms-wma',
'video/x-ms-asf',
],
'jar' => [
'application/java-archive',
'application/x-java-application',
'application/x-jar',
'application/x-compressed',
],
'svg' => [
'image/svg+xml',
'image/svg',
'application/xml',
'text/xml',
],
'vcf' => 'text/x-vcard',
'srt' => [
'text/srt',
'text/plain',
],
'vtt' => [
'text/vtt',
'text/plain',
],
'ico' => [
'image/x-icon',
'image/x-ico',
'image/vnd.microsoft.icon',
],
'stl' => [
'application/sla',
'application/vnd.ms-pki.stl',
'application/x-navistyle',
'model/stl',
'application/octet-stream',
],
];
/**
* Attempts to determine the best mime type for the given file extension.
*
* @return string|null The mime type found, or none if unable to determine.
*/
public static function guessTypeFromExtension(string $extension)
{
$extension = trim(strtolower($extension), '. ');
if (! array_key_exists($extension, static::$mimes)) {
return null;
}
return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
}
/**
* Attempts to determine the best file extension for a given mime type.
*
* @param string|null $proposedExtension - default extension (in case there is more than one with the same mime type)
*
* @return string|null The extension determined, or null if unable to match.
*/
public static function guessExtensionFromType(string $type, ?string $proposedExtension = null)
{
$type = trim(strtolower($type), '. ');
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
if (
$proposedExtension !== ''
&& array_key_exists($proposedExtension, static::$mimes)
&& in_array($type, (array) static::$mimes[$proposedExtension], true)
) {
// The detected mime type matches with the proposed extension.
return $proposedExtension;
}
// Reverse check the mime type list if no extension was proposed.
// This search is order sensitive!
foreach (static::$mimes as $ext => $types) {
if (in_array($type, (array) $types, true)) {
return $ext;
}
}
return null;
}
}

82
app/Config/Modules.php Normal file
View File

@ -0,0 +1,82 @@
<?php
namespace Config;
use CodeIgniter\Modules\Modules as BaseModules;
/**
* Modules Configuration.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Modules extends BaseModules
{
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all elements listed in
* $aliases below. If false, no auto-discovery will happen at all,
* giving a slight performance boost.
*
* @var bool
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery Within Composer Packages?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all namespaces loaded
* by Composer, as well as the namespaces configured locally.
*
* @var bool
*/
public $discoverInComposer = true;
/**
* The Composer package list for Auto-Discovery
* This setting is optional.
*
* E.g.:
* [
* 'only' => [
* // List up all packages to auto-discover
* 'codeigniter4/shield',
* ],
* ]
* or
* [
* 'exclude' => [
* // List up packages to exclude.
* 'pestphp/pest',
* ],
* ]
*
* @var array{only?: list<string>, exclude?: list<string>}
*/
public $composerPackages = [];
/**
* --------------------------------------------------------------------------
* Auto-Discovery Rules
* --------------------------------------------------------------------------
*
* Aliases list of all discovery classes that will be active and used during
* the current application request.
*
* If it is not listed, only the base application elements will be used.
*
* @var list<string>
*/
public $aliases = [
'events',
'filters',
'registrars',
'routes',
'services',
];
}

30
app/Config/Optimize.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace Config;
/**
* Optimization Configuration.
*
* NOTE: This class does not extend BaseConfig for performance reasons.
* So you cannot replace the property values with Environment Variables.
*/
class Optimize
{
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/factories.html#config-caching
*/
public bool $configCacheEnabled = false;
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/autoloader.html#file-locator-caching
*/
public bool $locatorCacheEnabled = false;
}

37
app/Config/Pager.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Pager extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Templates
* --------------------------------------------------------------------------
*
* Pagination links are rendered out using views to configure their
* appearance. This array contains aliases and the view names to
* use when rendering the links.
*
* Within each view, the Pager object will be available as $pager,
* and the desired group as $pagerGroup;
*
* @var array<string, string>
*/
public array $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head',
];
/**
* --------------------------------------------------------------------------
* Items Per Page
* --------------------------------------------------------------------------
*
* The default number of results shown in a single page.
*/
public int $perPage = 20;
}

75
app/Config/Paths.php Normal file
View File

@ -0,0 +1,75 @@
<?php
namespace Config;
/**
* Paths
*
* Holds the paths that are used by the system to
* locate the main directories, app, system, etc.
*
* Modifying these allows you to restructure your application,
* share a system folder between multiple applications, and more.
*
* All paths are relative to the project's root folder.
*/
class Paths
{
/**
* ---------------------------------------------------------------
* SYSTEM FOLDER NAME
* ---------------------------------------------------------------
*
* This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file.
*/
public string $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*/
public string $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* WRITABLE DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "writable" directory.
* The writable directory allows you to group all directories that
* need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or
* system directories.
*/
public string $writableDirectory = __DIR__ . '/../../writable';
/**
* ---------------------------------------------------------------
* TESTS DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "tests" directory.
*/
public string $testsDirectory = __DIR__ . '/../../tests';
/**
* ---------------------------------------------------------------
* VIEW DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the view files used by your application. By
* default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`.
*/
public string $viewDirectory = __DIR__ . '/../Views';
}

28
app/Config/Publisher.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace Config;
use CodeIgniter\Config\Publisher as BasePublisher;
/**
* Publisher Configuration
*
* Defines basic security restrictions for the Publisher class
* to prevent abuse by injecting malicious files into a project.
*/
class Publisher extends BasePublisher
{
/**
* A list of allowed destinations with a (pseudo-)regex
* of allowed files for each destination.
* Attempts to publish to directories not in this list will
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
];
}

57
app/Config/Routes.php Normal file
View File

@ -0,0 +1,57 @@
<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
// API untuk Menagani Request dari CRM
$routes->get ('/api_service/count_patres/(:any)', 'ApiServiceController::getPatresCount/$1');
// Api Untuk Menangani Request dari CLQMS Client
$routes->get ('/api_controller', 'ApiController::index');
$routes->post ('/api_controller/create', 'ApiController::create');
// Default
$routes->get ('/', 'Home::dashboard');
// $routes->get('/control', 'Controls::index');
$routes->get ('/flagdef', 'Flags::index');
$routes->get ('/flagdef/(:num)', 'Flags::view/$1');
$routes->match(['get','post'],'/flagdef/create/(:num)', 'Flags::edit/$1/0');
$routes->match(['get','post'],'/flagdef/edit/(:num)' , 'Flags::edit/$1');
$routes->match(['get','post'],'/flagdef/delete/(:num)', 'Flags::delete/$1');
$routes->get ('/equipmentlist', 'Equipment::index');
$routes->match(['get','post'],'/equipmentlist/create/(:num)', 'Equipment::edit/$1/0');
$routes->get ('/equipment/detail/(:any)', 'Equipment::detailInstrumentTest/$1');
$routes->get ('/broadcastcommand', 'Commands::indexBroadcast');
$routes->get ('/spesificcommand', 'Commands::indexSpesific');
$routes->get('/reports/rangedata', 'Reports::rangeData');
$routes->get('/reports/spesificdata', 'Reports::spesificData');
// $routes->get('/tests', 'Tests::index');
// $routes->match(['get','post'], '/tests/create', 'Tests::edit/0');
// $routes->match(['get','post'], '/tests/edit/(:num)', 'Tests::edit/$1');
// $routes->get('/prodinst', 'ProdInst::index');
// $routes->get('/prodinst/detail/(:num)', 'ProdInst::detail/$1');
// $routes->get('/prodinst/getProductList', 'ProdInst::getProductList');
// $routes->match(['get','post'], '/prodinst/create', 'ProdInst::edit/0');
// $routes->match(['get','post'], '/prodinst/edit/(:num)', 'ProdInst::edit/$1');
// $routes->get('/prodinsttest/edit/(:num)', 'ProdInst::prodinsttest_edit/$1');
// $routes->post('/prodinsttest/update', 'ProdInst::prodinsttest_update');
// $routes->get('/insts', 'Insts::index');
// $routes->match(['get','post'],'/insts/create', 'Insts::edit/0');
// $routes->match(['get','post'],'/insts/edit/(:num)', 'Insts::edit/$1');
// $routes->get('/techs', 'Techs::index');
// $routes->get('/techs/(:num)', 'Techs::techinst_index/$1');
// $routes->match(['get','post'],'/techs/create/(:num)', 'Techs::edit/$1/0');
// $routes->match(['get','post'],'/techs/edit/(:num)', 'Techs::edit/$1/$2');

140
app/Config/Routing.php Normal file
View File

@ -0,0 +1,140 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Config;
use CodeIgniter\Config\Routing as BaseRouting;
/**
* Routing configuration
*/
class Routing extends BaseRouting
{
/**
* For Defined Routes.
* An array of files that contain route definitions.
* Route files are read in order, with the first match
* found taking precedence.
*
* Default: APPPATH . 'Config/Routes.php'
*
* @var list<string>
*/
public array $routeFiles = [
APPPATH . 'Config/Routes.php',
];
/**
* For Defined Routes and Auto Routing.
* The default namespace to use for Controllers when no other
* namespace has been specified.
*
* Default: 'App\Controllers'
*/
public string $defaultNamespace = 'App\Controllers';
/**
* For Auto Routing.
* The default controller to use when no other controller has been
* specified.
*
* Default: 'Home'
*/
public string $defaultController = 'Home';
/**
* For Defined Routes and Auto Routing.
* The default method to call on the controller when no other
* method has been set in the route.
*
* Default: 'index'
*/
public string $defaultMethod = 'index';
/**
* For Auto Routing.
* Whether to translate dashes in URIs for controller/method to underscores.
* Primarily useful when using the auto-routing.
*
* Default: false
*/
public bool $translateURIDashes = false;
/**
* Sets the class/method that should be called if routing doesn't
* find a match. It can be the controller/method name like: Users::index
*
* This setting is passed to the Router class and handled there.
*
* If you want to use a closure, you will have to set it in the
* routes file by calling:
*
* $routes->set404Override(function() {
* // Do something here
* });
*
* Example:
* public $override404 = 'App\Errors::show404';
*/
public ?string $override404 = null;
/**
* If TRUE, the system will attempt to match the URI against
* Controllers by matching each segment against folders/files
* in APPPATH/Controllers, when a match wasn't found against
* defined routes.
*
* If FALSE, will stop searching and do NO automatic routing.
*/
public bool $autoRoute = false;
/**
* For Defined Routes.
* If TRUE, will enable the use of the 'prioritize' option
* when defining routes.
*
* Default: false
*/
public bool $prioritize = false;
/**
* For Defined Routes.
* If TRUE, matched multiple URI segments will be passed as one parameter.
*
* Default: false
*/
public bool $multipleSegmentsOneParam = false;
/**
* For Auto Routing (Improved).
* Map of URI segments and namespaces.
*
* The key is the first URI segment. The value is the controller namespace.
* E.g.,
* [
* 'blog' => 'Acme\Blog\Controllers',
* ]
*
* @var array<string, string>
*/
public array $moduleRoutes = [];
/**
* For Auto Routing (Improved).
* Whether to translate dashes in URIs for controller/method to CamelCase.
* E.g., blog-controller -> BlogController
*
* If you enable this, $translateURIDashes is ignored.
*
* Default: false
*/
public bool $translateUriToCamelCase = true;
}

86
app/Config/Security.php Normal file
View File

@ -0,0 +1,86 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Security extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CSRF Protection Method
* --------------------------------------------------------------------------
*
* Protection Method for Cross Site Request Forgery protection.
*
* @var string 'cookie' or 'session'
*/
public string $csrfProtection = 'cookie';
/**
* --------------------------------------------------------------------------
* CSRF Token Randomization
* --------------------------------------------------------------------------
*
* Randomize the CSRF Token for added security.
*/
public bool $tokenRandomize = false;
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection.
*/
public string $tokenName = 'csrf_test_name';
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Header name for Cross Site Request Forgery protection.
*/
public string $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection.
*/
public string $cookieName = 'csrf_cookie_name';
/**
* --------------------------------------------------------------------------
* CSRF Expires
* --------------------------------------------------------------------------
*
* Expiration time for Cross Site Request Forgery protection cookie.
*
* Defaults to two hours (in seconds).
*/
public int $expires = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate CSRF Token on every submission.
*/
public bool $regenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure.
*
* @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
*/
public bool $redirect = (ENVIRONMENT === 'production');
}

32
app/Config/Services.php Normal file
View File

@ -0,0 +1,32 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseService;
/**
* Services Configuration file.
*
* Services are simply other classes/libraries that the system uses
* to do its job. This is used by CodeIgniter to allow the core of the
* framework to be swapped out easily without affecting the usage within
* the rest of your application.
*
* This file holds any application-specific services, or service overrides
* that you might need. An example has been included with the general
* method format you should use for your service methods. For more examples,
* see the core Services file at system/Config/Services.php.
*/
class Services extends BaseService
{
/*
* public static function example($getShared = true)
* {
* if ($getShared) {
* return static::getSharedInstance('example');
* }
*
* return new \CodeIgniter\Example();
* }
*/
}

127
app/Config/Session.php Normal file
View File

@ -0,0 +1,127 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\FileHandler;
class Session extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @var class-string<BaseHandler>
*/
public string $driver = FileHandler::class;
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*/
public string $cookieName = 'ci_session';
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
public int $expiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is driver dependent.
*
* For the 'files' driver, it's a path to a writable directory.
* WARNING: Only absolute paths are supported!
*
* For the 'database' driver, it's a table name.
* Please read up the manual for the format with other session drivers.
*
* IMPORTANT: You are REQUIRED to set a valid save path!
*/
public string $savePath = WRITEPATH . 'session';
/**
* --------------------------------------------------------------------------
* Session Match IP
* --------------------------------------------------------------------------
*
* Whether to match the user's IP address when reading the session data.
*
* WARNING: If you're using the database driver, don't forget to update
* your session table's PRIMARY KEY when changing this setting.
*/
public bool $matchIP = false;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*/
public int $timeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session Regenerate Destroy
* --------------------------------------------------------------------------
*
* Whether to destroy session data associated with the old session ID
* when auto-regenerating the session ID. When set to FALSE, the data
* will be later deleted by the garbage collector.
*/
public bool $regenerateDestroy = false;
/**
* --------------------------------------------------------------------------
* Session Database Group
* --------------------------------------------------------------------------
*
* DB Group for the database session.
*/
public ?string $DBGroup = null;
/**
* --------------------------------------------------------------------------
* Lock Retry Interval (microseconds)
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Time (microseconds) to wait if lock cannot be acquired.
* The default is 100,000 microseconds (= 0.1 seconds).
*/
public int $lockRetryInterval = 100_000;
/**
* --------------------------------------------------------------------------
* Lock Max Retries
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Maximum number of lock acquisition attempts.
* The default is 300 times. That is lock timeout is about 30 (0.1 * 300)
* seconds.
*/
public int $lockMaxRetries = 300;
}

122
app/Config/Toolbar.php Normal file
View File

@ -0,0 +1,122 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\Toolbar\Collectors\Database;
use CodeIgniter\Debug\Toolbar\Collectors\Events;
use CodeIgniter\Debug\Toolbar\Collectors\Files;
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
use CodeIgniter\Debug\Toolbar\Collectors\Views;
/**
* --------------------------------------------------------------------------
* Debug Toolbar
* --------------------------------------------------------------------------
*
* The Debug Toolbar provides a way to see information about the performance
* and state of your application during that page display. By default it will
* NOT be displayed under production environments, and will only display if
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
*/
class Toolbar extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Toolbar Collectors
* --------------------------------------------------------------------------
*
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var list<class-string>
*/
public array $collectors = [
Timers::class,
Database::class,
Logs::class,
Views::class,
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
Files::class,
Routes::class,
Events::class,
];
/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be collected. Useful to
* avoid high memory usage when there are lots of data passed to the view.
*/
public bool $collectVarData = true;
/**
* --------------------------------------------------------------------------
* Max History
* --------------------------------------------------------------------------
*
* `$maxHistory` sets a limit on the number of past requests that are stored,
* helping to conserve file space used to store them. You can set it to
* 0 (zero) to not have any history stored, or -1 for unlimited history.
*/
public int $maxHistory = 20;
/**
* --------------------------------------------------------------------------
* Toolbar Views Path
* --------------------------------------------------------------------------
*
* The full path to the the views that are used by the toolbar.
* This MUST have a trailing slash.
*/
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
/**
* --------------------------------------------------------------------------
* Max Queries
* --------------------------------------------------------------------------
*
* If the Database Collector is enabled, it will log every query that the
* the system generates so they can be displayed on the toolbar's timeline
* and in the query log. This can lead to memory issues in some instances
* with hundreds of queries.
*
* `$maxQueries` defines the maximum amount of queries that will be stored.
*/
public int $maxQueries = 100;
/**
* --------------------------------------------------------------------------
* Watched Directories
* --------------------------------------------------------------------------
*
* Contains an array of directories that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
* We restrict the values to keep performance as high as possible.
*
* NOTE: The ROOTPATH will be prepended to all values.
*
* @var list<string>
*/
public array $watchedDirectories = [
'app',
];
/**
* --------------------------------------------------------------------------
* Watched File Extensions
* --------------------------------------------------------------------------
*
* Contains an array of file extensions that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
*
* @var list<string>
*/
public array $watchedExtensions = [
'php', 'css', 'js', 'html', 'svg', 'json', 'env',
];
}

252
app/Config/UserAgents.php Normal file
View File

@ -0,0 +1,252 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* -------------------------------------------------------------------
* User Agents
* -------------------------------------------------------------------
*
* This file contains four arrays of user agent data. It is used by the
* User Agent Class to help identify browser, platform, robot, and
* mobile device data. The array keys are used to identify the device
* and the array values are used to set the actual name of the item.
*/
class UserAgents extends BaseConfig
{
/**
* -------------------------------------------------------------------
* OS Platforms
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $platforms = [
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS',
];
/**
* -------------------------------------------------------------------
* Browsers
* -------------------------------------------------------------------
*
* The order of this array should NOT be changed. Many browsers return
* multiple browser types so we want to identify the subtype first.
*
* @var array<string, string>
*/
public array $browsers = [
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Edg' => 'Edge',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser',
'Vivaldi' => 'Vivaldi',
];
/**
* -------------------------------------------------------------------
* Mobiles
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $mobiles = [
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile',
];
/**
* -------------------------------------------------------------------
* Robots
* -------------------------------------------------------------------
*
* There are hundred of bots but these are the most common.
*
* @var array<string, string>
*/
public array $robots = [
'googlebot' => 'Googlebot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot',
];
}

44
app/Config/Validation.php Normal file
View File

@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\StrictRules\Rules;
class Validation extends BaseConfig
{
// --------------------------------------------------------------------
// Setup
// --------------------------------------------------------------------
/**
* Stores the classes that contain the
* rules that are available.
*
* @var list<string>
*/
public array $ruleSets = [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
];
/**
* Specifies the views that are used to display the
* errors.
*
* @var array<string, string>
*/
public array $templates = [
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
];
// --------------------------------------------------------------------
// Rules
// --------------------------------------------------------------------
}

62
app/Config/View.php Normal file
View File

@ -0,0 +1,62 @@
<?php
namespace Config;
use CodeIgniter\Config\View as BaseView;
use CodeIgniter\View\ViewDecoratorInterface;
/**
* @phpstan-type parser_callable (callable(mixed): mixed)
* @phpstan-type parser_callable_string (callable(mixed): mixed)&string
*/
class View extends BaseView
{
/**
* When false, the view method will clear the data between each
* call. This keeps your data safe and ensures there is no accidental
* leaking between calls, so you would need to explicitly pass the data
* to each view. You might prefer to have the data stick around between
* calls so that it is available to all views. If that is the case,
* set $saveData to true.
*
* @var bool
*/
public $saveData = true;
/**
* Parser Filters map a filter name with any PHP callable. When the
* Parser prepares a variable for display, it will chain it
* through the filters in the order defined, inserting any parameters.
* To prevent potential abuse, all filters MUST be defined here
* in order for them to be available for use within the Parser.
*
* Examples:
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array<string, string>
* @phpstan-var array<string, parser_callable_string>
*/
public $filters = [];
/**
* Parser Plugins provide a way to extend the functionality provided
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array<string, callable|list<string>|string>
* @phpstan-var array<string, list<parser_callable_string>|parser_callable_string|parser_callable>
*/
public $plugins = [];
/**
* View Decorators are class methods that will be run in sequence to
* have a chance to alter the generated output just prior to caching
* the results.
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var list<class-string<ViewDecoratorInterface>>
*/
public array $decorators = [];
}

View File

@ -0,0 +1,310 @@
<?php
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
use App\Controllers\SecurityController;
class ApiController extends BaseController {
use ResponseTrait;
public function index() {
return "Tampilan TMS30i";
}
public function create () {
// ------------------------------------------------------------------------------------------
// Get Login Access untuk API
// ------------------------------------------------------------------------------------------
$username = $this->request->getServer('PHP_AUTH_USER');
$password = $this->request->getServer('PHP_AUTH_PW');
// ------------------------------------------------------------------------------------------
// Buat Objek untuk Auth Controller
// ------------------------------------------------------------------------------------------
$securityController = new SecurityController();
$auth = $securityController->auth_check($username, $password);
// $auth = True;
/////////////////////////////////////////////////////////////////////////////////////////////
// 1 - Untuk Autentikasi dan Lain"
/////////////////////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------------------------------------------------
// Kredensial tidak valid, kembalikan pesan kesalahan dan Berhenti
// ------------------------------------------------------------------------------------------
if ( $auth == False) {
return $this->respond(["message" => "Maaf Akses Anda Ditolak"], 401);
}
// ------------------------------------------------------------------------------------------
// Terima data JSON dan Masukkan ke Variabel
// ------------------------------------------------------------------------------------------
$instrument_data_with_checksum = $this->request->getJSON();
$encrypted_instrument_data = $instrument_data_with_checksum->instrument_data;
$checksum_data = $instrument_data_with_checksum->checksum;
// ------------------------------------------------------------------------------------------
// Dekripsi Data JSON, Jika Tidak cocok kembalikan pesan kesalahan dan Berhenti
// ------------------------------------------------------------------------------------------
$decrypted_data = $securityController->decryptData($encrypted_instrument_data);
if ($decrypted_data == False) {
return $this->respond(["message" => "Enkripsi Tidak Cocok "], 400);
}
// ------------------------------------------------------------------------------------------
// Checksum Cek, Jika Tidak cocok kembalikan pesan kesalahan dan Berhenti
// ------------------------------------------------------------------------------------------
if ( $securityController->checksum_check($decrypted_data, $checksum_data) == False) {
return $this->respond(["message" => "Checksum Tidak Cocok "], 400);
}
/////////////////////////////////////////////////////////////////////////////////////////////
// 2 - Olah Data Untuk Disimpan ke Database
/////////////////////////////////////////////////////////////////////////////////////////////
// ------------------------------------------------------------------------------------------
// Decode Untuk Merubah Format Data Menjadi Array Asosiatif
// ------------------------------------------------------------------------------------------
$db = \Config\Database::connect();
$decrypted_data = json_decode($decrypted_data, true);
$total_simpan_non = count($decrypted_data['result_data']);
$total_simpan_non = strval($total_simpan_non);
// Digunakna untuk memfilter data
$decrypted_data = $this->filterData($decrypted_data);
$sn_number = $decrypted_data['sn_number'];
$total_simpan_filter = count($decrypted_data['result_data']);
$total_simpan_filter = strval($total_simpan_filter);
// Mulai transaksi
$db->transStart();
// Menyiapkan array untuk menyimpan data batch
$patresTechValues = [];
$patresFlagValues = [];
$flagdefCache = [];
// Proses setiap item dalam data yang diterima
foreach ($decrypted_data['result_data'] as $key => $value) {
$SAMP_ID = $value['SAMP_ID'];
$ITEM_NAME = $value['ITEM_NAME'];
$ASP_CNT = $value['ASP_CNT'];
// $CONC_DATA = isset($value['CONC_DATA']) ? $value['CONC_DATA'] : null;
// $OD_DATA = isset($value['OD_DATA']) ? $value['OD_DATA'] : null;
// Jika tidak ada nilai, set sebagai NULL
$CONC_DATA = isset($value['CONC_DATA']) ? "'".$value['CONC_DATA']."'" : 'NULL';
$OD_DATA = isset($value['OD_DATA']) ? "'".$value['OD_DATA']."'" : 'NULL';
$RST_DATE = $value['RST_DATE'];
$FLAG = $value['Flag'];
$REACTION_NO = $value['ReactionNo'];
$DIL_ORD = $value['DIL_ORD'];
// Input ke Tabel PATRES - Input Satu Persatu
$sql = "INSERT INTO patres (EquipmentID, SampleID, TestTechCode, Aspcnt, Result, ResultDateTime, createdate)
VALUES ('$sn_number', '$SAMP_ID', '$ITEM_NAME', $ASP_CNT, $CONC_DATA, '$RST_DATE', NOW())";
$db->query($sql);
$patres_lastid = $db->insertID();
// Untuk Inputan ke Tabel PATRESTECH - Batch Input
$patresTechValues[] = " ($patres_lastid, 'OD_DATA', $OD_DATA, '$RST_DATE'),
($patres_lastid, 'REACTION_NO', '$REACTION_NO', '$RST_DATE'),
($patres_lastid, 'DIL_ORD', '$DIL_ORD', '$RST_DATE')";
// Cek apakah FLAG sudah ada di cache
if ($FLAG !== null) {
if (!isset($flagdefCache[$FLAG])) {
// Cek tabel flagdef untuk FLAG
$sql = "SELECT FlagDefID as flagdef_id FROM flagdef WHERE flag='$FLAG'";
$query = $db->query($sql);
$row = $query->getRow();
if ($row !== null) {
$FlagDefID = (int) $row->flagdef_id;
} else {
// Insert Data ke Tabel Flagdef
$sql = "INSERT INTO flagdef (Instrumentid, Flag, flagtext, FlagDesc, onscreen, onresult, createdate)
VALUES (1, '$FLAG', '$FLAG', '', 1, 1, NOW())";
$db->query($sql);
// Ambil FlagDefID baru
$sql = "SELECT FlagDefID as flagdef_id FROM flagdef WHERE flag='$FLAG'";
$query = $db->query($sql);
$row = $query->getRow();
$FlagDefID = (int) $row->flagdef_id;
}
// Simpan FlagDefID di cache
$flagdefCache[$FLAG] = $FlagDefID;
} else {
$FlagDefID = $flagdefCache[$FLAG];
}
// Siapkan query untuk INSERT INTO patresflag
$patresFlagValues[] = "($patres_lastid, $FlagDefID, '$RST_DATE')";
}
}
// Menyisipkan data ke tabel patresflag dalam satu batch
if (!empty($patresFlagValues)) {
$sql = "INSERT INTO patresflag (resultid, flagid, createdate)
VALUES " . implode(", ", $patresFlagValues);
$db->query($sql);
}
// Menyisipkan data ke tabel patrestech dalam satu batch
if (!empty($patresTechValues)) {
$sql = "INSERT INTO patrestech (resultid, DBField, DBValue, createdate)
VALUES " . implode(", ", $patresTechValues);
$db->query($sql);
}
$db->transComplete();
// Cek status transaksi
if ($db->transStatus() === FALSE) {
$db->transRollback();
// return $this->respond(['message' => 'Server tidak menyimpan data anda, dikarenakan terjadi kesalahan saat memproses data.'], 500);
return $this->respond(['message' => $db->error()], 500);
} else {
$db->transCommit();
return $this->respond(['message' => "Menyimpan ". $total_simpan_filter . " dari " . $total_simpan_non ." data, Data berhasil diproses."], 201);
}
}
// Digunakan Untuk Memfilter Data Valid dan Tidak Valid
// Misal ada 2 Data :
// dengan Sampid dan semuanya sama namun beda flag maka cukup pilih/simpan data yang punya flag
public function filterData($decrypted_data) {
$filtered_data = array();
$filtered_data['sn_number'] = $decrypted_data['sn_number'];
$filtered_data['result_data'] = [];
$i = 0;
$status = false;
$length_array = count($decrypted_data['result_data']);
foreach ($decrypted_data['result_data'] as $key => $value) {
$SAMP_ID = $value['SAMP_ID'];
$ITEM_NAME = $value['ITEM_NAME'];
$ASP_CNT = $value['ASP_CNT'];
$CONC_DATA = $value['CONC_DATA'];
$OD_DATA = $value['OD_DATA'];
$RST_DATE = $value['RST_DATE'];
$FLAG = $value['Flag'];
$REACTION_NO = $value['ReactionNo'];
$DIL_ORD = $value['DIL_ORD'];
// Kondisi saat array bernilai 1
if ($i != 0) {
// Kondisi jika ada data array yang sama antara array 0 dan 1, 1 dan 2, dan seterusnya
if ( $SAMP_ID == $decrypted_data['result_data'][($i-1)]['SAMP_ID'] AND
$ITEM_NAME == $decrypted_data['result_data'][($i-1)]['ITEM_NAME'] AND
$ASP_CNT == $decrypted_data['result_data'][($i-1)]['ASP_CNT'] AND
$CONC_DATA == $decrypted_data['result_data'][($i-1)]['CONC_DATA'] AND
$OD_DATA == $decrypted_data['result_data'][($i-1)]['OD_DATA'] AND
$RST_DATE == $decrypted_data['result_data'][($i-1)]['RST_DATE'] AND
$REACTION_NO == $decrypted_data['result_data'][($i-1)]['ReactionNo']
) {
// Record Sebelumnya
$prev = [
"SAMP_ID" => $decrypted_data['result_data'][($i-1)]['SAMP_ID'],
"ITEM_NAME" => $decrypted_data['result_data'][($i-1)]['ITEM_NAME'],
"ASP_CNT" => $decrypted_data['result_data'][($i-1)]['ASP_CNT'],
"CONC_DATA" => $decrypted_data['result_data'][($i-1)]['CONC_DATA'],
"OD_DATA" => $decrypted_data['result_data'][($i-1)]['OD_DATA'],
"RST_DATE" => $decrypted_data['result_data'][($i-1)]['RST_DATE'],
"Flag" => $decrypted_data['result_data'][($i-1)]['Flag'],
"ReactionNo" => $decrypted_data['result_data'][($i-1)]['ReactionNo'],
"DIL_ORD" => $decrypted_data['result_data'][($i-1)]['DIL_ORD'],
];
// Record Saat ini
$current = [
"SAMP_ID" => $decrypted_data['result_data'][($i)]['SAMP_ID'],
"ITEM_NAME" => $decrypted_data['result_data'][($i)]['ITEM_NAME'],
"ASP_CNT" => $decrypted_data['result_data'][($i)]['ASP_CNT'],
"CONC_DATA" => $decrypted_data['result_data'][($i)]['CONC_DATA'],
"OD_DATA" => $decrypted_data['result_data'][($i)]['OD_DATA'],
"RST_DATE" => $decrypted_data['result_data'][($i)]['RST_DATE'],
"Flag" => $decrypted_data['result_data'][($i)]['Flag'],
"ReactionNo" => $decrypted_data['result_data'][($i)]['ReactionNo'],
"DIL_ORD" => $decrypted_data['result_data'][($i)]['DIL_ORD'],
];
// Simpan yang memiliki nilai flag ke temp data
if ($current['Flag'] == null) {
array_push($filtered_data['result_data'], $prev);
} else if ($prev['Flag'] == null) {
array_push($filtered_data['result_data'], $current);
}
// Status untuk melewati/skip index array saat ini
$status = true;
// Kondisi saat record tidak sama
} else {
// Jika sudah menyimpan record ganda diatas maka jangan jalankan ini
if ($status == false) {
$current = [
"SAMP_ID" => $decrypted_data['result_data'][($i-1)]['SAMP_ID'],
"ITEM_NAME" => $decrypted_data['result_data'][($i-1)]['ITEM_NAME'],
"ASP_CNT" => $decrypted_data['result_data'][($i-1)]['ASP_CNT'],
"CONC_DATA" => $decrypted_data['result_data'][($i-1)]['CONC_DATA'],
"OD_DATA" => $decrypted_data['result_data'][($i-1)]['OD_DATA'],
"RST_DATE" => $decrypted_data['result_data'][($i-1)]['RST_DATE'],
"Flag" => $decrypted_data['result_data'][($i-1)]['Flag'],
"ReactionNo" => $decrypted_data['result_data'][($i-1)]['ReactionNo'],
"DIL_ORD" => $decrypted_data['result_data'][($i-1)]['DIL_ORD'],
];
array_push($filtered_data['result_data'], $current);
// Ubah status
} else {
$status = false;
}
// Digunakan untuk menyimpan record terakhir
if ($i == ($length_array-1)) {
$current = [
"SAMP_ID" => $decrypted_data['result_data'][($i)]['SAMP_ID'],
"ITEM_NAME" => $decrypted_data['result_data'][($i)]['ITEM_NAME'],
"ASP_CNT" => $decrypted_data['result_data'][($i)]['ASP_CNT'],
"CONC_DATA" => $decrypted_data['result_data'][($i)]['CONC_DATA'],
"OD_DATA" => $decrypted_data['result_data'][($i)]['OD_DATA'],
"RST_DATE" => $decrypted_data['result_data'][($i)]['RST_DATE'],
"Flag" => $decrypted_data['result_data'][($i)]['Flag'],
"ReactionNo" => $decrypted_data['result_data'][($i)]['ReactionNo'],
"DIL_ORD" => $decrypted_data['result_data'][($i)]['DIL_ORD'],
];
array_push($filtered_data['result_data'], $current);
}
}
}
$i++;
}
return $filtered_data;
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace App\Controllers;
class ApiServiceController extends BaseController {
// // getProductList from CLQMS prodinstid
// public function getProductList() {
// $db = \Config\Database::connect();
// $sql = "SELECT pit.`prodinstid`, pit.productid, MIN(pr.resultdate) as firstdate, MAX(pr.resultdate) as lastdate FROM prodinst pit
// LEFT JOIN patres pr ON pr.prodinstid=pit.`prodinstid`";
// $query = $db->query($sql);
// $data = $query->getResultArray();
// if(count($data)==0) { $data = array('status' => 'error', 'message' => 'No data found'); }
// else {
// header('Content-Type: application/json');
// echo json_encode($data);
// }
// }
// Get Data untuk data Test
public function getPatresCount(...$segments) {
$resultsData = array();
$db = \Config\Database::connect();
// Mulai Transaksi
$db->transStart();
foreach ($segments as $value) {
if ($value == '6011310722' OR $value == '6015090124'
OR $value == '6011320722' OR $value == '6005840519'
OR $value == '6006100619' OR $value == '6015560324') {
$sql = "
SELECT
COUNT(DISTINCT p.ResultID) AS total_tests
FROM
patres p
JOIN
patrestech pt ON p.ResultID = pt.ResultID
WHERE
pt.DBField = 'REACTION_NO'
AND EquipmentID = ?
AND pt.DBValue != '0'
AND p.ResultDateTime >= DATE_SUB(NOW(), INTERVAL 6 MONTH);
";
$query = $db->query($sql, [$value]);
$data = $query->getResultArray();
$result = $data[0]['total_tests'] ?? null;
if ($result !== null) {
$resultsData[$value] = $result;
}
} else {
continue;
}
}
// Commit Transaksi
$db->transComplete();
// Set the header to JSON and return the data
header('Content-Type: application/json');
if (count($resultsData) == 0) {
echo json_encode(['status' => 'error', 'message' => 'No data found']);
} else {
return $this->response->setJSON($resultsData);
}
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
/**
* Class BaseController
*
* BaseController provides a convenient place for loading components
* and performing functions that are needed by all your controllers.
* Extend this class in any new controllers:
* class Home extends BaseController
*
* For security be sure to declare any new methods as protected or private.
*/
abstract class BaseController extends Controller
{
/**
* Instance of the main Request object.
*
* @var CLIRequest|IncomingRequest
*/
protected $request;
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var array
*/
protected $helpers = [];
/**
* Be sure to declare properties for any property fetch you initialized.
* The creation of dynamic property is deprecated in PHP 8.2.
*/
// protected $session;
/**
* @return void
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
// Do Not Edit This Line
parent::initController($request, $response, $logger);
// Preload any models, libraries, etc, here.
// E.g.: $this->session = \Config\Services::session();
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
/**
* Class BaseController
*
* BaseController provides a convenient place for loading components
* and performing functions that are needed by all your controllers.
* Extend this class in any new controllers:
* class Home extends BaseController
*
* For security be sure to declare any new methods as protected or private.
*/
abstract class BaseController extends Controller
{
/**
* Instance of the main Request object.
*
* @var CLIRequest|IncomingRequest
*/
protected $request;
/**
* An array of helpers to be loaded automatically upon
* class instantiation. These helpers will be available
* to all other controllers that extend BaseController.
*
* @var list<string>
*/
protected $helpers = [];
/**
* Be sure to declare properties for any property fetch you initialized.
* The creation of dynamic property is deprecated in PHP 8.2.
*/
// protected $session;
/**
* @return void
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
// Do Not Edit This Line
parent::initController($request, $response, $logger);
// Preload any models, libraries, etc, here.
// E.g.: $this->session = service('session');
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace App\Controllers;
class Commands extends BaseController {
public function indexBroadcast() {
// $db = \Config\Database::connect();
// $sql = "SELECT * FROM flagdef";
// $query = $db->query($sql);
// $results = $query->getResultArray();
// $data['flagdef'] = $results;
return view('broadcast_command_index.php');
}
public function indexSpesific() {
// $db = \Config\Database::connect();
// $sql = "SELECT * FROM flagdef";
// $query = $db->query($sql);
// $results = $query->getResultArray();
// $data['flagdef'] = $results;
return view('spesific_command_index.php');
}
// public function view($FlagDefID) {
// $FlagDefID = (int) $FlagDefID;
// $db = \Config\Database::connect();
// $sql = "SELECT * FROM flagdef WHERE FlagDefID=$FlagDefID";
// $query = $db->query($sql);
// $results = $query->getResultArray();
// $data['flagdef'] = $results;
// return view('flags_view.php', $data);
// }
// public function edit($FlagDefID) {
// $data = array();
// $data['instsAlias'] = $this->getProductAlias();
// $db = \Config\Database::connect();
// if ($FlagDefID != 0) {
// $sql = "SELECT * FROM flagdef where FlagDefID='$FlagDefID'";
// $query = $db->query($sql);
// $results = $query->getResultArray();
// $data['flagdef'] = $results;
// }
// if ($this->request->getMethod() === 'post') {
// $rules = [ 'flagtext' => 'required'];
// $flagdefid = $this->request->getPost('flagdefid');
// $instrumentid = $this->request->getPost('instrumentid');
// $flag = $this->request->getPost('flag');
// $flagtext = $this->request->getPost('flagtext');
// $flagdesc = $this->request->getPost('flagdesc');
// $onscreen = $this->request->getPost('onscreen');
// $onresult = $this->request->getPost('onresult');
// if ($this->validate($rules)){
// if ($flagdefid == 0 ) {
// $sql = "INSERT INTO `flagdef` ( `InstrumentID`, `Flag`, `FlagText`, `FlagDesc`, `OnScreen`, `OnResult`, `CreateDate` )
// VALUES ( $instrumentid, '$flag', '$flagtext', '$flagdesc', $onscreen, $onresult ,NOW())";
// $query = $db->query($sql);
// return redirect()->to('/flagdef');
// } else {
// $sql = "UPDATE `flagdef` SET InstrumentID = $instrumentid,
// Flag='$flag',
// flagtext='$flagtext',
// flagdesc='$flagdesc',
// onscreen=$onscreen,
// onresult=$onresult
// WHERE FlagDefID=$flagdefid";
// $query = $db->query($sql);
// return redirect()->to('/flagdef');
// }
// } else {
// $data['validation'] = $this->validator;
// return view('flags_editor', $data);
// }
// } else {
// return view('flags_editor', $data);
// }
// return view('flags_editor', $data);
// }
// public function delete($FlagDefID) {
// if ($this->request->getMethod() === 'post') {
// $db = \Config\Database::connect();
// $sql = "DELETE FROM flagdef WHERE FlagDefID=$FlagDefID";
// $query = $db->query($sql);
// return redirect()->to('/flagdef');
// } else { // Redirect jika metode bukan POST
// return redirect()->to('/flagdef');
// }
// }
}

View File

@ -0,0 +1,92 @@
<?php
namespace App\Controllers;
class Equipment extends BaseController {
public function index() {
$db = \Config\Database::connect();
return view('equipment_index.php');
}
public function edit($instid) {
// $data = array();
// if ($instid != 0) {
// $db = \Config\Database::connect();
// $sql = "SELECT * FROM dict_insts where instid='$instid'";
// $query = $db->query($sql);
// $results = $query->getResultArray();
// $data['insts'] = $results;
// }
// if ($this->request->getMethod() === 'post') {
// // $rules = [ 'instname' => 'required' ];
// // $instname = $this->request->getPost('instname');
// if($this->validate($rules)){
// if($instid == 0 ) {
// $db = \Config\Database::connect();
// $sql = "insert into dict_insts(instname, createdate) values ('$instname', NOW())";
// $query = $db->query($sql);
// return redirect()->to('/insts');
// } else {
// $db = \Config\Database::connect();
// $sql = "update dict_insts set instname='$instname' where instid='$instid'";
// $query = $db->query($sql);
// return redirect()->to('/insts');
// }
// } else {
// $data['validation'] = $this->validator;
// return view('insts_editor',$data);
// }
// } else {
// return view('equipment_editor');
// }
return view('equipment_editor');
}
public function detailInstrumentTest($EquipmentID) {
$data['EquipmentID'] = $EquipmentID;
$db = \Config\Database::connect();
$sql = "SELECT COUNT(*) as testcount
FROM patres
WHERE EquipmentID='$EquipmentID'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['testcount'] = $results[0]['testcount'];
$sql = "SELECT DATEDIFF(
MAX(ResultDateTime),
MIN(ResultDateTime)) as days,
MIN(ResultDateTime) as firstdate,
MAX(ResultDateTime) as lastdate
FROM patres
WHERE EquipmentID='$EquipmentID';";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['days'] = $results[0]['days'];
$data['firstdate'] = $results[0]['firstdate'];
$data['lastdate'] = $results[0]['lastdate'];
$sql = "SELECT YEAR(ResultDateTime) AS year, MONTH(ResultDateTime) AS month, COUNT(*) AS count
FROM patres
WHERE EquipmentID = '$EquipmentID'
GROUP BY YEAR(ResultDateTime), MONTH(ResultDateTime)
ORDER BY YEAR(ResultDateTime), MONTH(ResultDateTime);";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['counts'] = $results;
$sql = "SELECT SampleID,TestTechCode,Result,ResultDateTime,CreateDate FROM patres
WHERE EquipmentID='$EquipmentID'
ORDER BY ResultID DESC
LIMIT 3000";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['testData'] = $results;
return view('equipment_detail_test', $data);
}
}

112
app/Controllers/Flags.php Normal file
View File

@ -0,0 +1,112 @@
<?php
namespace App\Controllers;
class Flags extends BaseController {
private function getProductAlias() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://services-summit.my.id/api/getProductAlias',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response, true);
return $data;
}
public function index() {
$db = \Config\Database::connect();
$sql = "SELECT * FROM flagdef";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['flagdef'] = $results;
return view('flags_index.php', $data);
}
public function view($FlagDefID) {
$FlagDefID = (int) $FlagDefID;
$db = \Config\Database::connect();
$sql = "SELECT * FROM flagdef WHERE FlagDefID=$FlagDefID";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['flagdef'] = $results;
return view('flags_view.php', $data);
}
public function edit($FlagDefID) {
$data = array();
$data['instsAlias'] = $this->getProductAlias();
$db = \Config\Database::connect();
if ($FlagDefID != 0) {
$sql = "SELECT * FROM flagdef where FlagDefID='$FlagDefID'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['flagdef'] = $results;
}
if ($this->request->getMethod() === 'post') {
$rules = [ 'flagtext' => 'required'];
$flagdefid = $this->request->getPost('flagdefid');
$instrumentid = $this->request->getPost('instrumentid');
$flag = $this->request->getPost('flag');
$flagtext = $this->request->getPost('flagtext');
$flagdesc = $this->request->getPost('flagdesc');
$onscreen = $this->request->getPost('onscreen');
$onresult = $this->request->getPost('onresult');
if ($this->validate($rules)){
if ($flagdefid == 0 ) {
$sql = "INSERT INTO `flagdef` ( `InstrumentID`, `Flag`, `FlagText`, `FlagDesc`, `OnScreen`, `OnResult`, `CreateDate` )
VALUES ( $instrumentid, '$flag', '$flagtext', '$flagdesc', $onscreen, $onresult ,NOW())";
$query = $db->query($sql);
return redirect()->to('/flagdef');
} else {
$sql = "UPDATE `flagdef` SET InstrumentID = $instrumentid,
Flag='$flag',
flagtext='$flagtext',
flagdesc='$flagdesc',
onscreen=$onscreen,
onresult=$onresult
WHERE FlagDefID=$flagdefid";
$query = $db->query($sql);
return redirect()->to('/flagdef');
}
} else {
$data['validation'] = $this->validator;
return view('flags_editor', $data);
}
} else {
return view('flags_editor', $data);
}
return view('flags_editor', $data);
}
public function delete($FlagDefID) {
if ($this->request->getMethod() === 'post') {
$db = \Config\Database::connect();
$sql = "DELETE FROM flagdef WHERE FlagDefID=$FlagDefID";
$query = $db->query($sql);
return redirect()->to('/flagdef');
} else { // Redirect jika metode bukan POST
return redirect()->to('/flagdef');
}
}
}

109
app/Controllers/Home.php Normal file
View File

@ -0,0 +1,109 @@
<?php
namespace App\Controllers;
class Home extends BaseController {
private function getProductList() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://services-summit.my.id/api/getProductSites',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response, true);
return $data;
}
public function dashboard() {
$db = \Config\Database::connect();
$productList = $this->getProductList(); //Get From API CRM
// Mengelompokkan Berdasarkan Jenis Product. cth(TMS30i, TMS50, dll)
foreach($productList as $item) {
// Mengelompokkan Data Khusus TMS30i/Medisys
if ( in_array($item["productaliasid"], [20, 60]) ) {
$productList30i[] = [
"productaliasid" => $item["productaliasid"],
"productnumber" => $item["productnumber"],
"sitename" => $item["sitename"]
];
// Mengelompokkan Data Khusus 1024i
} else if ($item["productaliasid"] == 18) {
$productList1024i[] = [
"productaliasid" => $item["productaliasid"],
"productnumber" => $item["productnumber"],
"sitename" => $item["sitename"]
];
// Mengelompokkan Data Khusus 24i
} else if ($item["productaliasid"] == 19) {
$productList24i[] = [
"productaliasid" => $item["productaliasid"],
"productnumber" => $item["productnumber"],
"sitename" => $item["sitename"]
];
// Mengelompokkan Data Khusus 50i
} else if ($item["productaliasid"] == 21) {
$productList50i[] = [
"productaliasid" => $item["productaliasid"],
"productnumber" => $item["productnumber"],
"sitename" => $item["sitename"]
];
} else {
$productList30i = null;
$productList1024i = null;
$productList24i = null;
$productList50i = null;
}
}
$sql = "SELECT EquipmentID, COUNT(*) AS patresCount, MAX(ResultDateTime) AS lastResultDate
FROM patres
GROUP BY EquipmentID
ORDER By patresCount DESC";
$query = $db->query($sql);
$results = $query->getResultArray();
// Menyamakan Data CRM dan CLQMS Berdasarkan SN Number
foreach ($results as $itemDB) {
foreach ($productList30i as $itemCRM) {
if ($itemDB['EquipmentID'] == $itemCRM['productnumber']) {
// echo "<br>Product Alias ID CRM: " . $itemCRM["productaliasid"] . "<br>";
// echo "Product Number: " . $itemCRM["productnumber"] . "<br>";
// echo "Site Name: " . $itemCRM["sitename"] . "<br><br>";
// echo "Product Alias ID DB: " . $itemDB["EquipmentID"] . "<br>";
// echo "Product Number: " . $itemDB["patresCount"] . "<br>";
// echo "Site Name: " . $itemDB["lastResultDate"] . "<br><br>";
// echo "----------------------------<br><br>";
$tms30i[] = [
"productaliasid" => $itemCRM["productaliasid"],
"EquipmentID" => $itemDB["EquipmentID"],
"sitename" => $itemCRM["sitename"],
"patresCount" => $itemDB["patresCount"],
"lastResultDate" => $itemDB["lastResultDate"]
];
}
}
}
$data['tms30i'] = $tms30i;
return view('home_dashboard.php', $data);
}
}

48
app/Controllers/Insts.php Normal file
View File

@ -0,0 +1,48 @@
<?php
namespace App\Controllers;
class Insts extends BaseController {
public function index() {
$db = \Config\Database::connect();
$sql = "SELECT * FROM dict_insts";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['insts'] = $results;
return view('insts_index.php', $data);
}
public function edit($instid) {
$data = array();
if ($instid != 0) {
$db = \Config\Database::connect();
$sql = "SELECT * FROM dict_insts where instid='$instid'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['insts'] = $results;
}
if ($this->request->getMethod() === 'post') {
$rules = [ 'instname' => 'required' ];
$instname = $this->request->getPost('instname');
if($this->validate($rules)){
if($instid == 0 ) {
$db = \Config\Database::connect();
$sql = "insert into dict_insts(instname, createdate) values ('$instname', NOW())";
$query = $db->query($sql);
return redirect()->to('/insts');
} else {
$db = \Config\Database::connect();
$sql = "update dict_insts set instname='$instname' where instid='$instid'";
$query = $db->query($sql);
return redirect()->to('/insts');
}
} else {
$data['validation'] = $this->validator;
return view('insts_editor',$data);
}
} else {
return view('insts_editor', $data);
}
}
}

View File

@ -0,0 +1,186 @@
<?php
namespace App\Controllers;
class ProdInst extends BaseController {
private function getProductList() {
$curl = curl_init();
curl_setopt_array($curl, array(
//CURLOPT_URL => 'http://summitcrm.local/api/getProductList',
CURLOPT_URL => 'https://services-summit.my.id/api/getProductList',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response, true);
return $data;
}
public function index() {
$db = \Config\Database::connect();
$sql = "SELECT * FROM prodinst";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['prodinsts'] = $results;
return view('prodinst_index.php', $data);
}
public function detail($prodinstid) {
$db = \Config\Database::connect();
$sql = "SELECT * FROM prodinst where prodinstid='$prodinstid'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['prodinst'] = $results;
$sql = "SELECT COUNT(*) as testcount FROM patres WHERE prodinstid='$prodinstid'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['testcount'] = $results[0]['testcount'];
$sql = "SELECT DATEDIFF(MAX(resultdate), MIN(resultdate)) as days, min(resultdate) as firstdate, max(resultdate) as lastdate FROM patres WHERE prodinstid='$prodinstid';";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['days'] = $results[0]['days'];
$data['firstdate'] = $results[0]['firstdate'];
$data['lastdate'] = $results[0]['lastdate'];
$sql = "SELECT MONTH(resultdate) AS month, COUNT(*) AS count
FROM patres
GROUP BY MONTH(resultdate) limit 8";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['counts'] = $results;
return view('prodinst_detail.php', $data);
}
public function edit($prodinstid) {
$data = array();
$db = \Config\Database::connect();
if ($prodinstid != 0) {
$sql = "SELECT * FROM prodinst where prodinstid='$prodinstid'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['prodinsts'] = $results;
}
$sql = "SELECT * FROM dict_insts";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['insts'] = $results;
if ($this->request->getMethod() === 'post') {
$rules = [ 'prodinstcode' => 'required' ];
$productid = $this->request->getPost('productid');
$instid = $this->request->getPost('instid');
$prodinstname = $this->request->getPost('prodinstname');
$prodinstcode = $this->request->getPost('prodinstcode');
$prodinstkey= $this->request->getPost('prodinstkey');
if($this->validate($rules)){
if($prodinstid == 0 ) {
$sql = "insert into prodinst(productid, instid, prodinstname, prodinstcode, prodinstkey, createdate) values ('$productid', '$instid', '$prodinstname', '$prodinstcode', '$prodinstkey', NOW())";
$query = $db->query($sql);
return redirect()->to('/prodinst');
} else {
$sql = "update prodinst set productid='$productid', instid='$instid', prodinstname='$prodinstname', prodinstcode='$prodinstcode', prodinstkey='$prodinstkey' where prodinstid='$prodinstid'";
$query = $db->query($sql);
return redirect()->to('/prodinst');
}
} else {
$data['validation'] = $this->validator;
$data['products'] = $this->getProductList();
return view('prodinst_editor',$data);
}
} else {
$data['products'] = $this->getProductList();
return view('prodinst_editor', $data);
}
}
public function prodinsttest_edit($prodinstid) {
$data = array();
$data['prodinstid'] = $prodinstid;
$db = \Config\Database::connect();
$sql = "SELECT * FROM prodinst where prodinstid='$prodinstid'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['prodinsts'] = $results;
$sql = "SELECT * FROM prodinst_test where prodinstid='$prodinstid'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['prodinsttests'] = $results;
$sql = "SELECT * FROM dict_tests";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['tests'] = $results;
return view('prodinst_test_editor', $data);
}
public function prodinsttest_update() {
$db = \Config\Database::connect();
$prodinstid = $this->request->getPost('prodinstid');
$testids = $this->request->getPost('testid');
$prodinsttestcodes = $this->request->getPost('prodinsttestcode');
$deleteid = $this->request->getPost('deleteid');
// from form
$test = array();
foreach($testids as $key => $testid) {
if($testid != '') { $test[$testid] = $prodinsttestcodes[$key]; }
}
$sql = "SELECT * FROM prodinst_test where prodinstid='$prodinstid'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data = $results;
$qtest = array();
foreach($data as $qdata) {
$qtest[$qdata['testid']] = $qdata['prodinsttestcode'];
}
echo "<pre>";
print_r($test);
print_r($qtest);
echo "</pre>";
$sqlinsert = "";
foreach($test as $qtestid => $qtestcode) {
if( !isset($qtest[$qtestid]) ) { //if none insert
$sqlinsert .= "('$prodinstid', '$qtestid', '$qtestcode'),";
} else if( $qtest[$qtestid]!= $qtestcode ) {
$sqlupdate = "update prodinst_test set prodinsttestcode='$qtestcode' where prodinstid='$prodinstid' and testid='$qtestid'";
echo "<br/> $sqlupdate";
$db->query($sqlupdate);
}
}
$sqlinsert = rtrim($sqlinsert,',');
if($sqlinsert != '') {
$sqlinsert = "INSERT INTO prodinst_test(prodinstid, testid, prodinsttestcode) values $sqlinsert ";
echo "<br/> $sqlinsert";
$db->query($sqlinsert);
}
$sqldelete = "";
foreach($qtest as $qtestid => $qtestcode) {
if( !isset($test[$qtestid]) ) { //if none delete
$sqldelete.= "'$qtestid',";
}
}
if($sqldelete != '') {
$sqldelete = rtrim($sqldelete,',');
$sqldelete = "delete from prodinst_test where prodinstid='$prodinstid' and testid in ($sqldelete)";
echo "<br/> $sqldelete";
$db->query($sqldelete);
}
}
}

235
app/Controllers/Reports.php Normal file
View File

@ -0,0 +1,235 @@
<?php
namespace App\Controllers;
use DateTime;
class Reports extends BaseController {
private function getProductList() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://services-summit.my.id/api/getProductSites',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response, true);
return $data;
}
public function rangeData () {
$startdate = $this->request->getGet('startdate');
$enddate = $this->request->getGet('enddate');
if ($startdate && $enddate) {
$db = \Config\Database::connect();
// $sql = "SELECT
// MIN(YEAR(ResultDateTime)) AS FirstYear,
// MAX(YEAR(ResultDateTime)) AS LastYear
// FROM patres";
// $query = $db->query($sql);
// $results = $query->getResultArray();
$yearRange = range(date('Y', strtotime($startdate)), date('Y', strtotime($enddate)));
$query = $db->query("
SELECT EquipmentID, YEAR(ResultDateTime) AS Tahun, COUNT(*) AS patresCount
FROM patres
WHERE ResultDateTime BETWEEN '$startdate 00:00:01' AND '$enddate 23:59:59'
GROUP BY YEAR(ResultDateTime), EquipmentID
ORDER BY EquipmentID, tahun
");
$rows = $query->getResultArray();
$equipments = [
['EquipmentID' => '6006100619', 'sitename' => 'RS Permata Cibubur'],
['EquipmentID' => '6005840519', 'sitename' => 'RS dr. Oen Kandang Sapi Solo'],
['EquipmentID' => '6008850621', 'sitename' => 'RS Universitas Sebelas Maret'],
['EquipmentID' => '6010610522', 'sitename' => 'RSUD Muntilan'],
['EquipmentID' => '6011310722', 'sitename' => 'National Hospital Surabaya'],
['EquipmentID' => '6011320722', 'sitename' => 'RS Mardi Rahayu Kudus'],
['EquipmentID' => '6002771117', 'sitename' => 'UPTD Laboratorium Kesehatan Kota Magelang'],
['EquipmentID' => '6014341023', 'sitename' => 'RSUD Sukoharjo'],
['EquipmentID' => '6015090124', 'sitename' => 'Persada Hospital'],
['EquipmentID' => '6015560324', 'sitename' => 'ScanMe Labs Jakarta Kelapa Gading'],
['EquipmentID' => '6007621020', 'sitename' => 'UPT Labkesmas Kabupaten Magelang'],
['EquipmentID' => '6016560724', 'sitename' => 'RS Kasih Ibu Surakarta'],
['EquipmentID' => '6016850924', 'sitename' => 'Laboratorium Klinik Budi Sehat']
];
// Mapping EquipmentID => sitename
$siteNames = [];
foreach ($equipments as $eq) {
$siteNames[(int)$eq['EquipmentID']] = $eq['sitename'];
}
// Buat struktur pivot
$pivot = [];
foreach ($rows as $row) {
$eid = (int) $row['EquipmentID'];
$tahun = (int) $row['Tahun'];
$count = (int) $row['patresCount'];
if (!isset($pivot[$eid])) {
foreach ($yearRange as $y) {
$pivot[$eid][$y] = 0;
}
}
$pivot[$eid][$tahun] = $count;
}
// Buat struktur Growth/Presentase
$growth = [];
foreach ($pivot as $eid => $data) {
foreach ($yearRange as $i => $currYear) {
if ($i === 0) continue;
$prevYear = $yearRange[$i - 1];
$prev = $data[$prevYear] ?? 0;
$curr = $data[$currYear] ?? 0;
$key = "$prevYear-$currYear";
if (!isset($growth[$eid])) {
$growth[$eid] = [];
}
if ($prev == 0) {
$growth[$eid][$key] = '-';
} else {
$percent = (($curr - $prev) / $prev) * 100;
$growth[$eid][$key] = round($percent, 1) . '%';
}
}
}
return view('report_all_range', [
'yearRange' => $yearRange,
'pivot' => $pivot,
'growth' => $growth,
'siteNames' => $siteNames
]);
} else {
return view('report_all_range');
}
}
public function spesificData() {
$first_month = (int)$this->request->getGet('first_month');
$last_month = (int)$this->request->getGet('last_month');
if ($first_month && $last_month) {
$db = \Config\Database::connect();
$sql = "SELECT
MIN(YEAR(ResultDateTime)) AS FirstYear,
MAX(YEAR(ResultDateTime)) AS LastYear
FROM patres";
$query = $db->query($sql);
$results = $query->getResultArray();
$yearRange = range($results[0]['FirstYear'], $results[0]['LastYear']);
$query = $db->query("
SELECT EquipmentID, YEAR(ResultDateTime) AS Tahun, COUNT(*) AS patresCount
FROM patres
WHERE MONTH(ResultDateTime) BETWEEN $first_month AND $last_month
GROUP BY EquipmentID, YEAR(ResultDateTime)
ORDER BY EquipmentID, Tahun
");
$rows = $query->getResultArray();
$equipments = [
['EquipmentID' => '6006100619', 'sitename' => 'RS Permata Cibubur'],
['EquipmentID' => '6005840519', 'sitename' => 'RS dr. Oen Kandang Sapi Solo'],
['EquipmentID' => '6008850621', 'sitename' => 'RS Universitas Sebelas Maret'],
['EquipmentID' => '6010610522', 'sitename' => 'RSUD Muntilan'],
['EquipmentID' => '6011310722', 'sitename' => 'National Hospital Surabaya'],
['EquipmentID' => '6011320722', 'sitename' => 'RS Mardi Rahayu Kudus'],
['EquipmentID' => '6002771117', 'sitename' => 'UPTD Laboratorium Kesehatan Kota Magelang'],
['EquipmentID' => '6014341023', 'sitename' => 'RSUD Sukoharjo'],
['EquipmentID' => '6015090124', 'sitename' => 'Persada Hospital'],
['EquipmentID' => '6015560324', 'sitename' => 'ScanMe Labs Jakarta Kelapa Gading'],
['EquipmentID' => '6007621020', 'sitename' => 'UPT Labkesmas Kabupaten Magelang'],
['EquipmentID' => '6016560724', 'sitename' => 'RS Kasih Ibu Surakarta'],
['EquipmentID' => '6016850924', 'sitename' => 'Laboratorium Klinik Budi Sehat']
];
// Mapping EquipmentID => sitename
$siteNames = [];
foreach ($equipments as $eq) {
$siteNames[(int)$eq['EquipmentID']] = $eq['sitename'];
}
// Buat struktur pivot
$pivot = [];
foreach ($rows as $row) {
$eid = (int) $row['EquipmentID'];
$tahun = (int) $row['Tahun'];
$count = (int) $row['patresCount'];
if (!isset($pivot[$eid])) {
foreach ($yearRange as $y) {
$pivot[$eid][$y] = 0;
}
}
$pivot[$eid][$tahun] = $count;
}
// Buat struktur Growth/Presentase
$growth = [];
foreach ($pivot as $eid => $data) {
foreach ($yearRange as $i => $currYear) {
if ($i === 0) continue;
$prevYear = $yearRange[$i - 1];
$prev = $data[$prevYear] ?? 0;
$curr = $data[$currYear] ?? 0;
$key = "$prevYear-$currYear";
if (!isset($growth[$eid])) {
$growth[$eid] = [];
}
if ($prev == 0) {
$growth[$eid][$key] = '-';
} else {
$percent = (($curr - $prev) / $prev) * 100;
$growth[$eid][$key] = round($percent, 1) . '%';
}
}
}
// $first_month = 7;
$name_first_month = DateTime::createFromFormat('!m', $first_month)->format('F');
$name_last_month = DateTime::createFromFormat('!m', $last_month)->format('F');
return view('report_spesific_range', [
'yearRange' => $yearRange,
'pivot' => $pivot,
'growth' => $growth,
'siteNames' => $siteNames,
'name_first_month' => $name_first_month,
'name_last_month' => $name_last_month
]);
} else {
return view('report_spesific_range');
}
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Controllers;
class SecurityController extends BaseController {
// Auth Berikut Digunakan Bisa Menggunakan API
public function auth_check($username, $password) {
$auth_access = [
"username" => "?u=49250ad57372089f82a77ed99&id=d33314635a?u=49250ad57372089f82a77",
"password" => "MpSwZvr-CYOX4-EPsMmAsQQ&ved=0ahUKEwj636mKvt2HAxWDyzgGHbAkIEYQ4dUDCBA"
];
if ($username === $auth_access['username'] && $password === $auth_access['password']) {
return True;
} else {
return False;
}
}
public function checksum_check($instrument_data, $json_checksum) {
// Hitung nilai checksum dari json_data
$computed_checksum = hash('sha256', $instrument_data);
// Verifikasi checksum
if ($computed_checksum === $json_checksum) {
// Sukses
return True;
} else {
// Gagal
return False;
}
}
public function decryptData($json_data, $key=null) {
// Menerima data terenkripsi dari permintaan POST
$encryptedData = $json_data;
// Kunci yang sama yang digunakan untuk enkripsi di sisi Python
$key = 'summit4ska1sakti';
// Mendekripsi data
$decryptedData = openssl_decrypt($encryptedData, 'aes-128-cbc', $key, 0, '');
if ($decryptedData === False) {
return False;
}
return $decryptedData;
}
}

71
app/Controllers/Techs.php Normal file
View File

@ -0,0 +1,71 @@
<?php
namespace App\Controllers;
class Techs extends BaseController {
public function index() {
$db = \Config\Database::connect();
$sql = "SELECT * FROM dict_techs";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['techs'] = $results;
return view('techs_index.php', $data);
}
public function techinst_index($instid) {
$db = \Config\Database::connect();
$sql = "SELECT * FROM dict_techs where instid=$instid";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['techs'] = $results;
$sql = "SELECT * FROM dict_insts where instid=$instid";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['insts'] = $results;
$data['instid'] = $instid;
return view('techinst_index.php', $data);
}
public function edit($instid, $techid) {
$data = array();
$db = \Config\Database::connect();
$sql = "SELECT * FROM dict_techs";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['insts'] = $results;
$data['instid'] = $instid;
if ($flagid != 0) {
$sql = "SELECT * FROM dict_techs where techid='$techid'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['techs'] = $results;
}
if ($this->request->getMethod() === 'post') {
$rules = [ 'techtext' => 'required', 'techinst' => 'required' ];
$instname = $this->request->getPost('instname');
$techinst = $this->request->getPost('techinst');
$techtext = $this->request->getPost('techtext');
$techdesc = $this->request->getPost('techdesc');
$onscreen = $this->request->getPost('onscreen');
$onresult = $this->request->getPost('onresult');
if($this->validate($rules)){
if($instid == 0 ) {
$sql = "INSERT INTO `dict_techs` ( `instid`, `techinst`, `techtext`, `techdesc`, `onscreen`, `onresult`, `createdate` )
VALUES ( '$instid', '$flaginst', '$flagtext', '$flagdesc', '$onscreen', '$onresult' ,NOW())";
$query = $db->query($sql);
return redirect()->to('/techs/insts/$instid');
} else {
$sql = "update dict_techs set instid='$instid', techinst='$techinst', techtext='$techtext', techdesc='$techdesc', onscreen='$onscreen', onresult='$onresult' where techid='$techid'";
$query = $db->query($sql);
return redirect()->to('/techs/insts/$instid');
}
} else {
$data['validation'] = $this->validator;
return view('techs_editor',$data);
}
} else {
return view('techs_editor', $data);
}
}
}

60
app/Controllers/Tests.php Normal file
View File

@ -0,0 +1,60 @@
<?php
namespace App\Controllers;
class Tests extends BaseController {
public function index() {
$db = \Config\Database::connect();
$sql = "SELECT * FROM dict_tests";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['tests'] = $results;
return view('tests_index.php', $data);
}
public function edit($testid) {
$data = array();
if ($testid != 0) {
$db = \Config\Database::connect();
$sql = "SELECT * FROM dict_tests where testid='$testid'";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['tests'] = $results;
}
if ($this->request->getMethod() === 'post') {
$rules = [
'testcode' => 'required',
'testname' => 'required'
];
$testid = $this->request->getPost('testid');
$testcode = $this->request->getPost('testcode');
$testname = $this->request->getPost('testname');
$unit = $this->request->getPost('unit');
$method = $this->request->getPost('method');
$data['new_value'] = [
'testcode' => $testcode,
'testname' => $testname,
'unit' => $unit,
'method' => $method
];
if($this->validate($rules)){
if($testid == 0 ) {
$db = \Config\Database::connect();
$sql = "insert into dict_tests(testcode,testname,unit,method) values ('$testcode', '$testname', '$unit', '$method')";
$query = $db->query($sql);
return redirect()->to('/tests');
} else {
$db = \Config\Database::connect();
$sql = "update dict_tests set testcode='$testcode', testname='$testname', unit='$unit', method='$method' where testid='$testid'";
$query = $db->query($sql);
return redirect()->to('/tests');
}
} else {
$data['validation'] = $this->validator;
return view('tests_editor',$data);
}
}
return view('tests_editor', $data);
}
}

View File

View File

0
app/Filters/.gitkeep Normal file
View File

0
app/Helpers/.gitkeep Normal file
View File

0
app/Language/.gitkeep Normal file
View File

View File

@ -0,0 +1,4 @@
<?php
// override core en language system validation or define your own en language validation message
return [];

0
app/Libraries/.gitkeep Normal file
View File

0
app/Models/.gitkeep Normal file
View File

0
app/ThirdParty/.gitkeep vendored Normal file
View File

View File

@ -0,0 +1,92 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<main id="main" class="main">
<!-- <div class="pagetitle">
<h1>Broadcast Command Dasboard</h1>
</div> -->
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<!-- Button trigger modal -->
<!-- <button type="button" class="btn btn-primary openViewFlagsDef" data-FlagDefID='1' data-bs-toggle="modal" data-bs-target="#exampleModal">
Launch demo modal
</button> -->
<div class="card">
<div class="card-header py-0 mb-3">
<div class="d-flex justify-content-between">
<div class=""><h5 class="card-title my-0">Broadcast Instrument Page</h5></div>
<div class=""><h5 class="card-title my-0"><i class="bi bi-broadcast"></i></h5></div>
</div>
</div>
<div class="card-body">
<button type="button" class="btn btn-primary mb-4 btn-sm"><i class="bi bi-database-add"></i>&nbsp; New Query</button>
<div class="table-responsive">
<table id="myTable" class="table">
<thead>
<tr>
<th class="align-middle" width="7%">No.</th>
<th class="align-middle">Name</th>
<th class="align-middle">Instument</th>
<th class="align-middle" width="15%">Status</th>
<th class="align-middle" width="17%">Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td class="align-middle">Get Data Test</td>
<td class="align-middle">TMS30i</td>
<td class="align-middle"><i class="bi bi-circle-fill text-success"></i>&nbsp; active</td>
<td class="align-middle">
<button type="button" class="btn btn-success btn-sm"><i class="bi bi-eye"></i></button>
<button type="button" class="btn btn-warning btn-sm"><i class="bi bi-pencil-square"></i></button>
<button type="button" class="btn btn-danger btn-sm"><i class="bi bi-trash"></i></button>
</td>
</tr>
<tr>
<td>2</td>
<td class="align-middle">Send Message Every Hour</td>
<td class="align-middle">TMS30i</td>
<td class="align-middle"><i class="bi bi-circle-fill text-danger"></i>&nbsp; inactive</td>
<td class="align-middle">
<button type="button" class="btn btn-success btn-sm"><i class="bi bi-eye"></i></button>
<button type="button" class="btn btn-warning btn-sm"><i class="bi bi-pencil-square"></i></button>
<button type="button" class="btn btn-danger btn-sm"><i class="bi bi-trash"></i></button>
</td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
// let table = new DataTable('#myTable');
new DataTable('#myTable');
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,273 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('css') ?>
<style>
.pagination {
--bs-pagination-color: #fff;
--bs-pagination-bg: #4083ff;
--bs-pagination-hover-color: #fff;
--bs-pagination-hover-bg: #73b4ff;
--bs-pagination-focus-color: #fff;
--bs-pagination-focus-bg: #4083ff;
--bs-pagination-active-color: #fff;
--bs-pagination-active-bg: #73b4ffd0;
--bs-pagination-disabled-color: #ecf0f1;
--bs-pagination-disabled-bg: #73b4ff;
}
</style>
<?= $this->endSection() ?>
<?= $this->section('content') ?>
<?php
$dateObject = new DateTime($firstdate);
$formatedFirstDate = $dateObject->format('D, d M Y - H:i:s.v');
$dateObject = new DateTime($lastdate);
$formatedLastDate = $dateObject->format('D, d M Y - H:i:s.v');
// $startDate = new DateTime($firstdate);
// $endDate = new DateTime($lastdate);
// $interval = $startDate->diff($endDate);
// $months = $interval->y * 12 + $interval->m;
// // Jika ada bagian bulan yang tidak lengkap, tambahkan satu bulan
// if ($interval->d > 0) {
// $months++;
// }
// $testpermonth = $testcount / $months;
// $testpermonth = number_format($testpermonth, 2, ',', '');
$testpermonth = number_format($testcount / ($days / 30), 2, ',', '');
$testperday = number_format($testcount / $days, 2, ',', '');
?>
<main id="main" class="main">
<div class="card shadow-none">
<div class="card-header">
<?php if ($EquipmentID == '6011310722') : ?>
<div class="fw-bold">National Hospital Surabaya<span class="float-end p-0">TMS 30i &nbsp;<i class="bi bi-pc-display-horizontal"></i></span></div>
<?php elseif ($EquipmentID == '6015090124') : ?>
<div class="fw-bold">Persada Hospital</div>
<?php elseif ($EquipmentID == '6011320722') : ?>
<div class="fw-bold">RS Mardi Rahayu Kudus</div>
<?php elseif ($EquipmentID == '6005840519') : ?>
<div class="fw-bold">RS dr. Oen Kandang Sapi Solo</div>
<?php elseif ($EquipmentID == '6006100619') : ?>
<div class="fw-bold">RS Permata Cibubur</div>
<?php elseif ($EquipmentID == '6015560324') : ?>
<div class="fw-bold">ScanMe Labs Jakarta Kelapa Gading</div>
<?php endif; ?>
</div>
<div class="card-body p-4">
<div class='row m-0'>
<div class="col-12 col-sm-6 col-md-4 col-xl-3">
<div class="card shadow-none info-card sales-card border border-primary">
<div class="card-body">
<h5 class="card-title pb-0 pt-4">Test Count</h5>
<div class="d-flex align-items-center p-0 m-0">
<div class="">
<h4><?=$testcount;?></h4>
<span>Total Test</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-sm-6 col-md-4 col-xl-3">
<div class="card shadow-none info-card sales-card border border-primary">
<div class="card-body">
<h5 class="card-title pb-0 pt-4">Day Count</h5>
<div class="d-flex align-items-center p-0 m-0">
<div class="">
<h4><?=$days;?></h4>
<span>Days</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-sm-6 col-md-4 col-xl-3">
<div class="card shadow-none info-card sales-card border border-primary">
<div class="card-body">
<h5 class="card-title pb-0 pt-4">Monthly (avg)</h5>
<div class="d-flex align-items-center p-0 m-0">
<div class="">
<h4><?=$testpermonth;?></h4>
<span>Test per month</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-sm-6 col-md-4 col-xl-3">
<div class="card shadow-none info-card sales-card border border-primary">
<div class="card-body">
<h5 class="card-title pb-0 pt-4">Daily (avg)</h5>
<div class="d-flex align-items-center p-0 m-0">
<div class="">
<h4><?=$testperday;?></h4>
<span>Test per day</span>
</div>
</div>
</div>
</div>
</div>
<!-- <div class="col-12 col-sm-6 col-md-4 col-xl-3">
<div class="card shadow-none info-card sales-card border border-primary">
<div class="card-body">
<h5 class="card-title">Test Count (avg)</h5>
<div class="d-flex align-items-center">
<div class="ps-3">
<h3><?php echo $testpermonth;?></h3>
<span>Test per month</span>
</div>
</div>
</div>
</div>
</div> -->
</div>
<div class="row mt-0 p-3">
<div class="col-12 p-0">
<h4><i class="bi bi-clipboard-data"></i> Detail Chart</h4>
</div>
<div class="col-12 border border-primary">
<div class="col-12 mb-3">
<div class="row text-center p-2 mt-1">
<div class="col-12 col-md-6">
Tanggal Awal : <span class="fw-bold"><?=$formatedFirstDate;?></span>
</div>
<div class="col-12 col-md-6">
Tanggal Akhir : <span class="fw-bold"><?=$formatedLastDate;?></span>
</div>
</div>
</div>
<canvas id="myChart"></canvas>
</div>
</div>
<div class="row mt-0 p-3">
<div class="col-12 p-0">
<h4><i class="bi bi-file-earmark-spreadsheet"></i> Detail Test</h4>
</div>
<div class="col p-0 mt-1">
<!-- <div class="tab-pane fade show active" id="open-tab-pane" role="tabpanel" tabindex="0"> -->
<div class="table-responsive">
<table id="testCountTable" class="table table-striped table-hover">
<thead>
<th scope="col">#</th>
<th scope="col">Sample ID</th>
<th scope="col">Test Code</th>
<th scope="col">Result</th>
<th scope="col">Result Date</th>
<th scope="col">Create Date</th>
</thead>
<tbody>
<?php
$i=1;
foreach($testData as $value) {
$sampleid = $value['SampleID'];
$testtechcode = $value['TestTechCode'];
$result = $value['Result'];
$resultdatetime = $value['ResultDateTime'];
$createdate = $value['CreateDate'];
echo "<tr>";
echo "<td>$i</td>";
echo "<td>$sampleid</td>";
echo "<td>$testtechcode</td>";
echo "<td>$result</td>";
echo "<td>$resultdatetime</td>";
echo "<td>$createdate</td>";
echo "</tr>";
$i++;
} ?>
</tbody>
</table>
</div>
<!-- </div> -->
</div>
</div>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<?php
// chart data
function monthNumberToName($monthNumber) {
return date('F', mktime(0, 0, 0, $monthNumber, 1));
}
$months = '';
$countpm = '';
foreach($counts as $data) {
$qmonth = $data['month'];
$qyear = $data['year'];
$monthname = monthNumberToName($qmonth);
$months .= "'$monthname $qyear',";
$qcount = $data['count'];
$countpm .= "$qcount,";
}
$months = rtrim($months,',');
$countpm = rtrim($countpm,',');
?>
<script>
const ctx = document.getElementById('myChart');
new Chart(ctx, {
type: 'bar',
data: {
labels: [ <?=$months;?> ],
datasets: [{
label: '# of Tests',
data: [ <?=$countpm;?> ],
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
$(function () {
$('#testCountTable').DataTable({
"order" : [],
"pageLength" : 10,
"info": true,
"lengthMenu": [ [10, 50, 100, 500, 1000], [10, 50, 100, 500, 1000] ], // Pilihan jumlah baris yang ditampilkan
});
});
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,152 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<?php
// $flagdefid = 0;
// $instrumentid = '0';
// $flag = '';
// $flagtext = '';
// $flagdesc = '';
// $onscreen = '';
// $onresult = '';
// if(isset($flagdef )) { $data = $flagdef[0]; }
// if(isset($new_value)) { $data = $new_value; }
// if(isset($data)) {
// if(isset($data['FlagDefID'])) { $flagdefid = $data['FlagDefID']; }
// $instrumentid = $data['InstrumentID'];
// $flag = $data['Flag'];
// $flagtext = $data['FlagText'];
// $flagdesc = $data['FlagDesc'];
// $onscreen = $data['OnScreen'];
// $onresult = $data['OnResult'];
// }
?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Flag Editor</h1>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card">
<div class="card-body">
<!-- <h5 class="card-title">Flag Editor</h5> -->
<form method='POST'>
<input type='hidden' name='flagdefid' value='' />
<div class="row mb-3 mt-4">
<label class="col-sm-2 col-form-label">Flag Instrument</label>
<div class="col-sm-10">
<select class="form-control" id="instrumentid" name='instrumentid'>
<option value='0' selected>-</option>
<?php
// foreach($instsAlias as $data) {
// $qinstid = $data['productaliasid'];
// $qinstname = $data['productaliastext'];
// if($instrumentid == $qinstid) { echo "<option value='$qinstid' selected>$qinstname</option>"; }
// else { echo "<option value='$qinstid'>$qinstname</option>"; }
// }
?>
</select>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">Equipmnet ID</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="flag" name='flag' value='' required />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">Sites</label>
<div class="col-sm-10">
<input type="text" class="form-control" name='flagtext' value='' required />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">Flag Desc.</label>
<div class="col-sm-10">
<input type="text" class="form-control" name='flagdesc' value='' />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">On Screen</label>
<div class="col-sm-3 ">
<input type="text" class="form-control" name='onscreen' value=''/>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">On Result</label>
<div class="col-sm-3 ">
<input type="text" class="form-control" name='onresult' value=''/>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">
Password
<button type="button" class="btn btn-info" id="randomPasswordGenerator"
style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem;">
Random Password
</button>
</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="password" name='password' value='' required />
</div>
</div>
<div class="">
<button type="submit" class="btn btn-primary">Submit</button>
<button type="reset" class="btn btn-secondary">Reset</button>
</div>
</form>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
document.body.classList.add('toggle-sidebar');
$(document).ready(function() {
$('#randomPasswordGenerator').on('click',function(){
let pass = '';
let str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
'abcdefghijklmnopqrstuvwxyz0123456789@#-+_()*!&^%$';
for (let i = 1; i <= 30; i++) {
let char = Math.floor(Math.random()
* str.length + 1);
pass += str.charAt(char)
}
$("#password").val(pass);
});
});
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,89 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Instruments List</h1>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card" style="height:700px;">
<div class="card-body">
<div class='card-title d-flex'>
<h6><b>Berisi Data Tiap Alat/Instrumen</b></h6>
<a href='<?=base_url();?>equipmentlist/create/0' class='btn btn-sm btn-info ms-auto'> <i class="bi bi-plus-square"> </i> New Instrument</a>
</div>
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope='col'>Equipment ID</th>
<th scope="col">Department ID</th>
<th scope="col">Instrument Name</th>
<th scope="col">Status/Enable</th>
<th scope="col">Equipment Role</th>
<th scope="col">Create Date</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div id="modal" class="modal" tabindex="-1" role="dialog" >
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
</div>
</div>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
// $('.openInsttestEdit').on('click',function(){
// const instid = $(this).data('instid');
// $('.modal-content').load('insttest/edit/'+instid,function(){
// $('#modal').modal('show');
// });
// });
// $('#insttest_form').submit(function(event) {
// event.preventDefault();
// $('#insttest').modal('hide');
// var formData = $(this).serialize();
// $.ajax({
// type: 'POST',
// url: '<?=base_url()."insttest/update";?>',
// dataType: "json",
// data: formData,
// success: function(response) { console.log(response); },
// error: function(xhr, status, error) {
// if(xhr.status != '200') {
// var alert = '<div class="alert alert-danger alert-dismissible fade show" role="alert">' +
// '<strong>Error!</strong> An error occurred. Please try again later.<br>' +
// '<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>' +
// '</div>';
// $('main').prepend(alert);
// }
// }
// });
// });
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,7 @@
<?php
use CodeIgniter\CLI\CLI;
CLI::error('ERROR: ' . $code);
CLI::write($message);
CLI::newLine();

View File

@ -0,0 +1,74 @@
<?php
use CodeIgniter\CLI\CLI;
// The main Exception
CLI::write('[' . get_class($exception) . ']', 'light_gray', 'red');
CLI::write($message);
CLI::write('at ' . CLI::color(clean_path($exception->getFile()) . ':' . $exception->getLine(), 'green'));
CLI::newLine();
$last = $exception;
while ($prevException = $last->getPrevious()) {
$last = $prevException;
CLI::write(' Caused by:');
CLI::write(' [' . get_class($prevException) . ']', 'red');
CLI::write(' ' . $prevException->getMessage());
CLI::write(' at ' . CLI::color(clean_path($prevException->getFile()) . ':' . $prevException->getLine(), 'green'));
CLI::newLine();
}
// The backtrace
if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
$backtraces = $last->getTrace();
if ($backtraces) {
CLI::write('Backtrace:', 'green');
}
foreach ($backtraces as $i => $error) {
$padFile = ' '; // 4 spaces
$padClass = ' '; // 7 spaces
$c = str_pad($i + 1, 3, ' ', STR_PAD_LEFT);
if (isset($error['file'])) {
$filepath = clean_path($error['file']) . ':' . $error['line'];
CLI::write($c . $padFile . CLI::color($filepath, 'yellow'));
} else {
CLI::write($c . $padFile . CLI::color('[internal function]', 'yellow'));
}
$function = '';
if (isset($error['class'])) {
$type = ($error['type'] === '->') ? '()' . $error['type'] : $error['type'];
$function .= $padClass . $error['class'] . $type . $error['function'];
} elseif (! isset($error['class']) && isset($error['function'])) {
$function .= $padClass . $error['function'];
}
$args = implode(', ', array_map(static function ($value) {
switch (true) {
case is_object($value):
return 'Object(' . get_class($value) . ')';
case is_array($value):
return count($value) ? '[...]' : '[]';
case $value === null:
return 'null'; // return the lowercased version
default:
return var_export($value, true);
}
}, array_values($error['args'] ?? [])));
$function .= '(' . $args . ')';
CLI::write($function);
CLI::newLine();
}
}

View File

@ -0,0 +1,5 @@
<?php
// On the CLI, we still want errors in productions
// so just use the exception template.
include __DIR__ . '/error_exception.php';

View File

@ -0,0 +1,197 @@
:root {
--main-bg-color: #fff;
--main-text-color: #555;
--dark-text-color: #222;
--light-text-color: #c7c7c7;
--brand-primary-color: #E06E3F;
--light-bg-color: #ededee;
--dark-bg-color: #404040;
}
body {
height: 100%;
background: var(--main-bg-color);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
color: var(--main-text-color);
font-weight: 300;
margin: 0;
padding: 0;
}
h1 {
font-weight: lighter;
letter-spacing: 0.8;
font-size: 3rem;
color: var(--dark-text-color);
margin: 0;
}
h1.headline {
margin-top: 20%;
font-size: 5rem;
}
.text-center {
text-align: center;
}
p.lead {
font-size: 1.6rem;
}
.container {
max-width: 75rem;
margin: 0 auto;
padding: 1rem;
}
.header {
background: var(--light-bg-color);
color: var(--dark-text-color);
}
.header .container {
padding: 1rem 1.75rem 1.75rem 1.75rem;
}
.header h1 {
font-size: 2.5rem;
font-weight: 500;
}
.header p {
font-size: 1.2rem;
margin: 0;
line-height: 2.5;
}
.header a {
color: var(--brand-primary-color);
margin-left: 2rem;
display: none;
text-decoration: none;
}
.header:hover a {
display: inline;
}
.footer {
background: var(--dark-bg-color);
color: var(--light-text-color);
}
.footer .container {
border-top: 1px solid #e7e7e7;
margin-top: 1rem;
text-align: center;
}
.source {
background: #343434;
color: var(--light-text-color);
padding: 0.5em 1em;
border-radius: 5px;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-size: 0.85rem;
margin: 0;
overflow-x: scroll;
}
.source span.line {
line-height: 1.4;
}
.source span.line .number {
color: #666;
}
.source .line .highlight {
display: block;
background: var(--dark-text-color);
color: var(--light-text-color);
}
.source span.highlight .number {
color: #fff;
}
.tabs {
list-style: none;
list-style-position: inside;
margin: 0;
padding: 0;
margin-bottom: -1px;
}
.tabs li {
display: inline;
}
.tabs a:link,
.tabs a:visited {
padding: 0rem 1rem;
line-height: 2.7;
text-decoration: none;
color: var(--dark-text-color);
background: var(--light-bg-color);
border: 1px solid rgba(0,0,0,0.15);
border-bottom: 0;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: inline-block;
}
.tabs a:hover {
background: var(--light-bg-color);
border-color: rgba(0,0,0,0.15);
}
.tabs a.active {
background: var(--main-bg-color);
color: var(--main-text-color);
}
.tab-content {
background: var(--main-bg-color);
border: 1px solid rgba(0,0,0,0.15);
}
.content {
padding: 1rem;
}
.hide {
display: none;
}
.alert {
margin-top: 2rem;
display: block;
text-align: center;
line-height: 3.0;
background: #d9edf7;
border: 1px solid #bcdff1;
border-radius: 5px;
color: #31708f;
}
ul, ol {
line-height: 1.8;
}
table {
width: 100%;
overflow: hidden;
}
th {
text-align: left;
border-bottom: 1px solid #e7e7e7;
padding-bottom: 0.5rem;
}
td {
padding: 0.2rem 0.5rem 0.2rem 0;
}
tr:hover td {
background: #f1f1f1;
}
td pre {
white-space: pre-wrap;
}
.trace a {
color: inherit;
}
.trace table {
width: auto;
}
.trace tr td:first-child {
min-width: 5em;
font-weight: bold;
}
.trace td {
background: var(--light-bg-color);
padding: 0 1rem;
}
.trace td pre {
margin: 0;
}
.args {
display: none;
}

View File

@ -0,0 +1,116 @@
var tabLinks = new Array();
var contentDivs = new Array();
function init()
{
// Grab the tab links and content divs from the page
var tabListItems = document.getElementById('tabs').childNodes;
console.log(tabListItems);
for (var i = 0; i < tabListItems.length; i ++)
{
if (tabListItems[i].nodeName == "LI")
{
var tabLink = getFirstChildWithTagName(tabListItems[i], 'A');
var id = getHash(tabLink.getAttribute('href'));
tabLinks[id] = tabLink;
contentDivs[id] = document.getElementById(id);
}
}
// Assign onclick events to the tab links, and
// highlight the first tab
var i = 0;
for (var id in tabLinks)
{
tabLinks[id].onclick = showTab;
tabLinks[id].onfocus = function () {
this.blur()
};
if (i == 0)
{
tabLinks[id].className = 'active';
}
i ++;
}
// Hide all content divs except the first
var i = 0;
for (var id in contentDivs)
{
if (i != 0)
{
console.log(contentDivs[id]);
contentDivs[id].className = 'content hide';
}
i ++;
}
}
function showTab()
{
var selectedId = getHash(this.getAttribute('href'));
// Highlight the selected tab, and dim all others.
// Also show the selected content div, and hide all others.
for (var id in contentDivs)
{
if (id == selectedId)
{
tabLinks[id].className = 'active';
contentDivs[id].className = 'content';
}
else
{
tabLinks[id].className = '';
contentDivs[id].className = 'content hide';
}
}
// Stop the browser following the link
return false;
}
function getFirstChildWithTagName(element, tagName)
{
for (var i = 0; i < element.childNodes.length; i ++)
{
if (element.childNodes[i].nodeName == tagName)
{
return element.childNodes[i];
}
}
}
function getHash(url)
{
var hashPos = url.lastIndexOf('#');
return url.substring(hashPos + 1);
}
function toggle(elem)
{
elem = document.getElementById(elem);
if (elem.style && elem.style['display'])
{
// Only works with the "style" attr
var disp = elem.style['display'];
}
else if (elem.currentStyle)
{
// For MSIE, naturally
var disp = elem.currentStyle['display'];
}
else if (window.getComputedStyle)
{
// For most other browsers
var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display');
}
// Toggle the state of the "display" style
elem.style.display = disp == 'block' ? 'none' : 'block';
return false;
}

View File

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?= lang('Errors.pageNotFound') ?></title>
<style>
div.logo {
height: 200px;
width: 155px;
display: inline-block;
opacity: 0.08;
position: absolute;
top: 2rem;
left: 50%;
margin-left: -73px;
}
body {
height: 100%;
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #777;
font-weight: 300;
}
h1 {
font-weight: lighter;
letter-spacing: normal;
font-size: 3rem;
margin-top: 0;
margin-bottom: 0;
color: #222;
}
.wrap {
max-width: 1024px;
margin: 5rem auto;
padding: 2rem;
background: #fff;
text-align: center;
border: 1px solid #efefef;
border-radius: 0.5rem;
position: relative;
}
pre {
white-space: normal;
margin-top: 1.5rem;
}
code {
background: #fafafa;
border: 1px solid #efefef;
padding: 0.5rem 1rem;
border-radius: 5px;
display: block;
}
p {
margin-top: 1.5rem;
}
.footer {
margin-top: 2rem;
border-top: 1px solid #efefef;
padding: 1em 2em 0 2em;
font-size: 85%;
color: #999;
}
a:active,
a:link,
a:visited {
color: #dd4814;
}
</style>
</head>
<body>
<div class="wrap">
<h1>404</h1>
<p>
<?php if (ENVIRONMENT !== 'production') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
<?= lang('Errors.sorryCannotFind') ?>
<?php endif; ?>
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,418 @@
<?php
use Config\Services;
use CodeIgniter\CodeIgniter;
$errorId = uniqid('error', true);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title><?= esc($title) ?></title>
<style>
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
</style>
<script>
<?= file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.js') ?>
</script>
</head>
<body onload="init()">
<!-- Header -->
<div class="header">
<div class="container">
<h1><?= esc($title), esc($exception->getCode() ? ' #' . $exception->getCode() : '') ?></h1>
<p>
<?= nl2br(esc($exception->getMessage())) ?>
<a href="https://www.duckduckgo.com/?q=<?= urlencode($title . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $exception->getMessage())) ?>"
rel="noreferrer" target="_blank">search &rarr;</a>
</p>
</div>
</div>
<!-- Source -->
<div class="container">
<p><b><?= esc(clean_path($file)) ?></b> at line <b><?= esc($line) ?></b></p>
<?php if (is_file($file)) : ?>
<div class="source">
<?= static::highlightFile($file, $line, 15); ?>
</div>
<?php endif; ?>
</div>
<div class="container">
<?php
$last = $exception;
while ($prevException = $last->getPrevious()) {
$last = $prevException;
?>
<pre>
Caused by:
<?= esc(get_class($prevException)), esc($prevException->getCode() ? ' #' . $prevException->getCode() : '') ?>
<?= nl2br(esc($prevException->getMessage())) ?>
<a href="https://www.duckduckgo.com/?q=<?= urlencode(get_class($prevException) . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $prevException->getMessage())) ?>"
rel="noreferrer" target="_blank">search &rarr;</a>
<?= esc(clean_path($prevException->getFile()) . ':' . $prevException->getLine()) ?>
</pre>
<?php
}
?>
</div>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) : ?>
<div class="container">
<ul class="tabs" id="tabs">
<li><a href="#backtrace">Backtrace</a></li>
<li><a href="#server">Server</a></li>
<li><a href="#request">Request</a></li>
<li><a href="#response">Response</a></li>
<li><a href="#files">Files</a></li>
<li><a href="#memory">Memory</a></li>
</ul>
<div class="tab-content">
<!-- Backtrace -->
<div class="content" id="backtrace">
<ol class="trace">
<?php foreach ($trace as $index => $row) : ?>
<li>
<p>
<!-- Trace info -->
<?php if (isset($row['file']) && is_file($row['file'])) : ?>
<?php
if (isset($row['function']) && in_array($row['function'], ['include', 'include_once', 'require', 'require_once'], true)) {
echo esc($row['function'] . ' ' . clean_path($row['file']));
} else {
echo esc(clean_path($row['file']) . ' : ' . $row['line']);
}
?>
<?php else: ?>
{PHP internal code}
<?php endif; ?>
<!-- Class/Method -->
<?php if (isset($row['class'])) : ?>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp;<?= esc($row['class'] . $row['type'] . $row['function']) ?>
<?php if (! empty($row['args'])) : ?>
<?php $argsId = $errorId . 'args' . $index ?>
( <a href="#" onclick="return toggle('<?= esc($argsId, 'attr') ?>');">arguments</a> )
<div class="args" id="<?= esc($argsId, 'attr') ?>">
<table cellspacing="0">
<?php
$params = null;
// Reflection by name is not available for closure function
if (substr($row['function'], -1) !== '}') {
$mirror = isset($row['class']) ? new ReflectionMethod($row['class'], $row['function']) : new ReflectionFunction($row['function']);
$params = $mirror->getParameters();
}
foreach ($row['args'] as $key => $value) : ?>
<tr>
<td><code><?= esc(isset($params[$key]) ? '$' . $params[$key]->name : "#{$key}") ?></code></td>
<td><pre><?= esc(print_r($value, true)) ?></pre></td>
</tr>
<?php endforeach ?>
</table>
</div>
<?php else : ?>
()
<?php endif; ?>
<?php endif; ?>
<?php if (! isset($row['class']) && isset($row['function'])) : ?>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp; <?= esc($row['function']) ?>()
<?php endif; ?>
</p>
<!-- Source? -->
<?php if (isset($row['file']) && is_file($row['file']) && isset($row['class'])) : ?>
<div class="source">
<?= static::highlightFile($row['file'], $row['line']) ?>
</div>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ol>
</div>
<!-- Server -->
<div class="content" id="server">
<?php foreach (['_SERVER', '_SESSION'] as $var) : ?>
<?php
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
continue;
} ?>
<h3>$<?= esc($var) ?></h3>
<table>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
<tr>
<td><?= esc($key) ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= esc($value) ?>
<?php else: ?>
<pre><?= esc(print_r($value, true)) ?></pre>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach ?>
<!-- Constants -->
<?php $constants = get_defined_constants(true); ?>
<?php if (! empty($constants['user'])) : ?>
<h3>Constants</h3>
<table>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($constants['user'] as $key => $value) : ?>
<tr>
<td><?= esc($key) ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= esc($value) ?>
<?php else: ?>
<pre><?= esc(print_r($value, true)) ?></pre>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Request -->
<div class="content" id="request">
<?php $request = Services::request(); ?>
<table>
<tbody>
<tr>
<td style="width: 10em">Path</td>
<td><?= esc($request->getUri()) ?></td>
</tr>
<tr>
<td>HTTP Method</td>
<td><?= esc(strtoupper($request->getMethod())) ?></td>
</tr>
<tr>
<td>IP Address</td>
<td><?= esc($request->getIPAddress()) ?></td>
</tr>
<tr>
<td style="width: 10em">Is AJAX Request?</td>
<td><?= $request->isAJAX() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>Is CLI Request?</td>
<td><?= $request->isCLI() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>Is Secure Request?</td>
<td><?= $request->isSecure() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>User Agent</td>
<td><?= esc($request->getUserAgent()->getAgentString()) ?></td>
</tr>
</tbody>
</table>
<?php $empty = true; ?>
<?php foreach (['_GET', '_POST', '_COOKIE'] as $var) : ?>
<?php
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
continue;
} ?>
<?php $empty = false; ?>
<h3>$<?= esc($var) ?></h3>
<table style="width: 100%">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
<tr>
<td><?= esc($key) ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= esc($value) ?>
<?php else: ?>
<pre><?= esc(print_r($value, true)) ?></pre>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach ?>
<?php if ($empty) : ?>
<div class="alert">
No $_GET, $_POST, or $_COOKIE Information to show.
</div>
<?php endif; ?>
<?php $headers = $request->headers(); ?>
<?php if (! empty($headers)) : ?>
<h3>Headers</h3>
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($headers as $header) : ?>
<tr>
<td><?= esc($header->getName(), 'html') ?></td>
<td><?= esc($header->getValueLine(), 'html') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Response -->
<?php
$response = Services::response();
$response->setStatusCode(http_response_code());
?>
<div class="content" id="response">
<table>
<tr>
<td style="width: 15em">Response Status</td>
<td><?= esc($response->getStatusCode() . ' - ' . $response->getReasonPhrase()) ?></td>
</tr>
</table>
<?php $headers = $response->headers(); ?>
<?php if (! empty($headers)) : ?>
<?php natsort($headers) ?>
<h3>Headers</h3>
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach (array_keys($headers) as $name) : ?>
<tr>
<td><?= esc($name, 'html') ?></td>
<td><?= esc($response->getHeaderLine($name), 'html') ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Files -->
<div class="content" id="files">
<?php $files = get_included_files(); ?>
<ol>
<?php foreach ($files as $file) :?>
<li><?= esc(clean_path($file)) ?></li>
<?php endforeach ?>
</ol>
</div>
<!-- Memory -->
<div class="content" id="memory">
<table>
<tbody>
<tr>
<td>Memory Usage</td>
<td><?= esc(static::describeMemory(memory_get_usage(true))) ?></td>
</tr>
<tr>
<td style="width: 12em">Peak Memory Usage:</td>
<td><?= esc(static::describeMemory(memory_get_peak_usage(true))) ?></td>
</tr>
<tr>
<td>Memory Limit:</td>
<td><?= esc(ini_get('memory_limit')) ?></td>
</tr>
</tbody>
</table>
</div>
</div> <!-- /tab-content -->
</div> <!-- /container -->
<?php endif; ?>
<div class="footer">
<div class="container">
<p>
Displayed at <?= esc(date('H:i:sa')) ?> &mdash;
PHP: <?= esc(PHP_VERSION) ?> &mdash;
CodeIgniter: <?= esc(CodeIgniter::CI_VERSION) ?> --
Environment: <?= ENVIRONMENT ?>
</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,25 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title><?= lang('Errors.whoops') ?></title>
<style>
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
</style>
</head>
<body>
<div class="container text-center">
<h1 class="headline"><?= lang('Errors.whoops') ?></h1>
<p class="lead"><?= lang('Errors.weHitASnag') ?></p>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<?php
$instname = $insts[0]['instname'];
?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Flags List For Instrument <?=$instname;?></h1>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card" style="height:700px;">
<div class="card-body">
<div class='card-title d-flex'>
<h5><b>Flag List</b></h5>
<a href='<?=base_url();?>flags/create/<?=$instid;?>' class='btn btn-sm btn-info ms-auto'> <i class='bi bi-plus-circle'></i> New Flag</a>
</div>
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope='col'>ID</th> <th scope='col'>Flag Text</th> <th scope="col">Flag Desc.</th> <th></th>
</tr>
</thead>
<tbody>
<?php
foreach($flags as $data) {
$flagid = $data['flagid'];
$flagtext = $data['flagtext'];
$flagdesc= $data['flagdesc'];
?>
<tr>
<td><?=$flagid;?></td> <td><?=$flagtext;?></td> <td><?=$flagdesc;?></td>
<td>
<a href='<?=base_url()."flags/edit/".$flagid;?>' class='btn btn-sm btn-warning'>edit</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<?= $this->endSection() ?>

114
app/Views/flags_editor.php Normal file
View File

@ -0,0 +1,114 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<?php
$flagdefid = 0;
$instrumentid = '0';
$flag = '';
$flagtext = '';
$flagdesc = '';
$onscreen = '';
$onresult = '';
if(isset($flagdef )) { $data = $flagdef[0]; }
if(isset($new_value)) { $data = $new_value; }
if(isset($data)) {
if(isset($data['FlagDefID'])) { $flagdefid = $data['FlagDefID']; }
$instrumentid = $data['InstrumentID'];
$flag = $data['Flag'];
$flagtext = $data['FlagText'];
$flagdesc = $data['FlagDesc'];
$onscreen = $data['OnScreen'];
$onresult = $data['OnResult'];
}
?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Flag Editor</h1>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card">
<div class="card-body">
<!-- <h5 class="card-title">Flag Editor</h5> -->
<form method='POST'>
<input type='hidden' name='flagdefid' value='<?=$flagdefid ?>' />
<div class="row mb-3 mt-4">
<label class="col-sm-2 col-form-label">Flag Instrument</label>
<div class="col-sm-10">
<select class="form-control" id="instrumentid" name='instrumentid'>
<option value='0' selected>-</option>
<?php
foreach($instsAlias as $data) {
$qinstid = $data['productaliasid'];
$qinstname = $data['productaliastext'];
if($instrumentid == $qinstid) { echo "<option value='$qinstid' selected>$qinstname</option>"; }
else { echo "<option value='$qinstid'>$qinstname</option>"; }
}
?>
</select>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">Flag</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="flag" name='flag' value='<?=$flag ?>' required />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">Flag Text</label>
<div class="col-sm-10">
<input type="text" class="form-control" name='flagtext' value='<?=$flagtext ?>' required />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">Flag Desc.</label>
<div class="col-sm-10">
<input type="text" class="form-control" name='flagdesc' value='<?=$flagdesc ?>' />
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">On Screen</label>
<div class="col-sm-3 ">
<input type="text" class="form-control" name='onscreen' value='<?=$onscreen ?>'/>
</div>
</div>
<div class="row mb-3">
<label class="col-sm-2 col-form-label">On Result</label>
<div class="col-sm-3 ">
<input type="text" class="form-control" name='onresult' value='<?=$onresult ?>'/>
</div>
</div>
<div class="">
<button type="submit" class="btn btn-primary">Submit</button>
<button type="reset" class="btn btn-secondary">Reset</button>
</div>
</form>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
document.body.classList.add('toggle-sidebar');
</script>
<?= $this->endSection() ?>

91
app/Views/flags_index.php Normal file
View File

@ -0,0 +1,91 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Flags List</h1>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<!-- Button trigger modal -->
<!-- <button type="button" class="btn btn-primary openViewFlagsDef" data-FlagDefID='1' data-bs-toggle="modal" data-bs-target="#exampleModal">
Launch demo modal
</button> -->
<div class="card" style="height:700px;">
<div class="card-body">
<div class='card-title d-flex'>
<h6><b>Berisi Flag dari Tiap Alat/Instrumen</b></h6>
<a href='<?=base_url();?>flagdef/create/0' class='btn btn-sm btn-info ms-auto'> <i class='bi bi-file-earmark-plus'></i> New Flag</a>
</div>
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope='col'>ID</th> <th scope='col'>Instrumen</th> <th scope='col'>Flag</th> <th scope='col'>Flag Text</th> <th scope="col">Flag Desc.</th> <th scope='col'>Create Date</th><th scope='col'> Action </th>
</tr>
</thead>
<tbody>
<?php foreach ($flagdef as $data) { ?>
<tr>
<td><?= $data["FlagDefID"] ?></td>
<td><?= $data["InstrumentID"] ?></td>
<td><?= $data["Flag"] ?></td>
<td><?= $data["FlagText"] ?></td>
<td><?= $data["FlagDesc"] ?></td>
<td><?= $data["CreateDate"] ?></td>
<td class=''>
<button type="button" class="btn btn-sm btn-primary openViewFlagsDef" data-flagdefid='<?= $data["FlagDefID"]; ?>' data-bs-toggle="modal">
<i class="bi bi-eye"></i>
</button>
<a href='<?=base_url();?>flagdef/edit/<?= $data["FlagDefID"] ?>' class='btn btn-sm btn-warning ms-auto'> <i class='bi bi-pencil-square'></i> </a>
<form action="<?= base_url(); ?>flagdef/delete/<?= $data['FlagDefID'] ?>" method="post" style="display:inline;">
<button type="submit" class="btn btn-sm btn-danger ms-auto" onclick="return confirm('Are you sure you want to delete this item?');">
<i class="bi bi-trash"></i>
</button>
</form>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div id="modal" class="modal" tabindex="-1" role="dialog" >
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
</div>
</div>
</div>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
$(document).ready(function(){
$('.openViewFlagsDef').on('click',function(){
const FlagDefID = $(this).data('flagdefid');
$('.modal-content').load('<?=base_url();?>flagdef/'+FlagDefID, function(){
$('#modal').modal('show');
});
});
});
</script>
<?= $this->endSection() ?>

55
app/Views/flags_view.php Normal file
View File

@ -0,0 +1,55 @@
<!-- Modal -->
<?php
$FlagDefID = $flagdef[0]['FlagDefID'];
$Instrumentid = $flagdef[0]['InstrumentID'];
$Flag = $flagdef[0]['Flag'];
$FlagText = $flagdef[0]['FlagText'];
$FlagDesc = $flagdef[0]['FlagDesc'];
$OnScreen = $flagdef[0]['OnScreen'];
$OnResult = $flagdef[0]['OnResult'];
$CreateDate = $flagdef[0]['CreateDate'];
?>
<div class="modal-header">
<h1 class="modal-title fs-5">Flags</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table">
<tbody>
<tr>
<th scope="row">ID</th>
<td> <?=$FlagDefID ?> </td>
</tr>
<tr>
<th scope="row">Instrument</th>
<td> <?=$Instrumentid ?> </td>
</tr>
<tr>
<th scope="row">Flag</th>
<td> <?=$Flag ?> </td>
</tr>
<tr>
<th scope="row">Flag Text</th>
<td> <?=$FlagText ?> </td>
</tr>
<tr>
<th scope="row">Flag Desc</th>
<td> <?=$FlagDesc ?> </td>
</tr>
<tr>
<th scope="row">On Screen</th>
<td> <?=$OnScreen ?> </td>
</tr>
<tr>
<th scope="row">On Result</th>
<td> <?=$OnResult ?> </td>
</tr>
<tr>
<th scope="row">Create Date</th>
<td> <?=$CreateDate ?> </td>
</tr>
</tbody>
</table>
</div>

View File

@ -0,0 +1,372 @@
<?= $this->extend('layouts/main.php') ?>
<?php
// $totalTMS30iTest = 0;
// if (isset($tms30iCountTest)) {
// foreach($tms30i as $value) {
// $totalTMS30iTest += (int) $value['patresCount'];
// }
// }
?>
<?= $this->section('css') ?>
<style>
* {
font-family: 'Montserrat', sans-serif;
font-weight: 400;
font-size: 14px;
}
.order-card {
color: #fff;
}
.bg-c-blue {
background: linear-gradient(45deg,#4083ff,#73b4ff);
}
.bg-blue {
background: #4083ff;
}
.bg-c-green {
background: linear-gradient(45deg,#2ed8b6,#59e0c5);
}
.bg-c-yellow {
background: linear-gradient(45deg,#da8b15be,#e4a827);
}
.bg-c-pink {
background: linear-gradient(45deg,#FF5370,#ff869a);
}
.bg-c-purple {
background: linear-gradient(45deg,#ff40dfbb,#df40ff);
}
.card {
border-radius: 15px;
-webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
box-shadow: 0 1px 2.94px 0.06px rgba(4,26,55,0.16);
border: none;
margin-bottom: 30px;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.card .card-block {
padding: 25px;
}
.order-card i {
font-size: 26px;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
/* color: var(--bs-nav-pills-link-active-color); */
background-color: #ffffff;
}
.bcgrnd-ul {
border-radius: 10px;
background: #ffffffe0;
box-shadow: 10px 10px 20px rgba(196, 193, 193, 0.2);
}
.nav-link {
color: #000;
}
.nav-link:hover {
color: #ffffff;
}
.nav-item-30:hover {
color: #ffffff;
background: linear-gradient(45deg,#4099ff,#358df1);
border-radius: 10px;
}
.nav-item-30 .active {
color: #ffffff;
background: linear-gradient(45deg,#4099ff,#358df1);
border-radius: 10px;
}
.nav-item-1024:hover {
color: #ffffff;
background: linear-gradient(45deg,#2ed8b6,#59e0c5);
border-radius: 10px;
}
.nav-item-1024 .active {
color: #ffffff;
background: linear-gradient(45deg,#2ed8b6,#59e0c5);
border-radius: 10px;
}
.nav-item-24:hover {
color: #ffffff;
background: linear-gradient(45deg,#ffb54d,#f7b150);
border-radius: 10px;
}
.nav-item-24 .active {
color: #ffffff;
background: linear-gradient(45deg,#ffb54d,#f7b150);
border-radius: 10px;
}
.nav-item-50:hover {
color: #ffffff;
background: linear-gradient(45deg,#ff40dfbb,#df40ff);
border-radius: 10px;
}
.nav-item-50 .active {
color: #ffffff;
background: linear-gradient(45deg,#ff40dfbb,#df40ff);
border-radius: 10px;
}
.list:hover {
background-color: #e0e7ee;
}
</style>
<?= $this->endSection() ?>
<?= $this->section('content') ?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Dashboard</h1>
</div>
<div class="row">
<div class="col-sm-6 col-md-4 col-xl-3">
<div class="card bg-c-blue order-card">
<div class="card-block">
<h5 class="m-0 fs-6">TMS 30i <span class="m-0 float-end"><i class="bi bi-pc-display-horizontal"></i></span></h5>
<hr>
<!-- <p class="mb-0">Total Test<span class="float-end">-</span></p> -->
<!-- <h4 class="text-end"><i class="bi bi-airplane float-start"></i><span>486</span></h4> -->
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-xl-3">
<div class="card bg-c-green order-card">
<div class="card-block">
<h5 class="m-0 fs-6">TMS 1024i <span class="m-0 float-end"><i class="bi bi-pc-display"></i></span></h5>
<hr>
<!-- <p class="mb-0">Total Test<span class="float-end">-</span></p> -->
<!-- <h4 class="text-end"><i class="bi bi-airplane float-start"></i><span>486</span></h4> -->
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-xl-3">
<div class="card bg-c-yellow order-card">
<div class="card-block">
<h5 class="m-0 fs-6">TMS 24i Premium <span class="m-0 float-end"><i class="bi bi-robot"></i></span></h5>
<hr>
<!-- <p class="mb-0">Total Test<span class="float-end">-</span></p> -->
<!-- <h4 class="text-end"><i class="bi bi-airplane float-start"></i><span>486</span></h4> -->
</div>
</div>
</div>
<div class="col-sm-6 col-md-4 col-xl-3">
<div class="card bg-c-purple order-card">
<div class="card-block">
<h5 class="m-0 fs-6">TMS 50i Superior <span class="m-0 float-end"><i class="bi bi-tv"></i></span></h5>
<hr>
<!-- <p class="mb-0">Total Test<span class="float-end">-</span></p> -->
<!-- <h4 class="text-end"><i class="bi bi-airplane float-start"></i><span>486</span></h4> -->
</div>
</div>
</div>
</div>
<div class="row mt-0">
<div class="col">
<ul class="nav nav-pills mb-3 justify-content-around p-2 bcgrnd-ul" id="pills-tab" role="tablist">
<li class="nav-item nav-item-30 p-sm-1" role="presentation">
<button class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" data-bs-target="#pills-home" type="button" role="tab" aria-controls="pills-home" aria-selected="true">TMS 30i</button>
</li>
<li class="nav-item nav-item-1024 p-sm-1" role="presentation">
<button class="nav-link" id="pills-profile-tab" data-bs-toggle="pill" data-bs-target="#pills-profile" type="button" role="tab" aria-controls="pills-profile" aria-selected="false">TMS 1024i</button>
</li>
<li class="nav-item nav-item-24 p-sm-1" role="presentation">
<button class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" data-bs-target="#pills-contact" type="button" role="tab" aria-controls="pills-contact" aria-selected="false">TMS 24i Premium</button>
</li>
<li class="nav-item nav-item-50 p-sm-1" role="presentation">
<button class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" data-bs-target="#pills-contact" type="button" role="tab" aria-controls="pills-contact" aria-selected="false">TMS 50i Superior</button>
</li>
</ul>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab" tabindex="0">
<div class='row'>
<div class="col-12">
<div class="card">
<div class="card-header fw-bold bg-blue"></div>
<div class="card-body py-2">
<ol class="list-group list-group-numbered my-2">
<?php foreach ($tms30i as $value) : ?>
<li class="list list-group-item d-flex justify-content-between align-items-start">
<a href="<?php base_url();?>equipment/detail/<?=$value['EquipmentID'];?>" class="text-decoration-none w-100 d-flex justify-content-between align-items-start">
<div class="ms-2 me-auto">
<div class="fw-bold"><?=$value['sitename'];?></div>
<blockquote class="blockquote mb-2 fs-6">
<p></p>
<footer class="blockquote-footer">
<cite title="Source Title">last update</cite>
<em class='fw-bold'>
<?php
$dateObject = new DateTime($value['lastResultDate']);
$formattedDate = $dateObject->format('D, d M Y - H:i:s.v');
echo($formattedDate);
?>
</em>
</footer>
</blockquote>
</div>
<span class="badge bg-blue rounded-pill">
<?php echo($value['patresCount']); ?>
</span>
</a>
</li>
<?php endforeach; ?>
</ol>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab" tabindex="0">
</div>
<div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab" tabindex="0"></div>
<div class="tab-pane fade" id="pills-disabled" role="tabpanel" aria-labelledby="pills-disabled-tab" tabindex="0"></div>
</div>
</div>
</div>
<!-- Recent Result -->
<!-- <div class="card">
<div class="card-body">
<h5 class="card-title">Recent Update</h5>
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope="col">Instrument</th> <th scope="col">Sample ID#</th> <th scope="col">Result Date</th>
</tr>
</thead>
<tbody> -->
<?php
// foreach ($results as $data) {
// $sampleid = $data['SampleID'];
// $resultdate = $data['ResultDateTime'];
// $instrument = $data['EquipmentID'];
// if ($instrument == ''){
// $instrument = "";
// } else {
// $instrument = $instrument;
// }
// // echo "<tr> <td><a href='".base_url()."prodinst/detail/$prodinstid'>$prodinstname</a></td> <td>$sampleid</td> <td>$resultdate</td> </tr>";
// echo "<tr> <td>S/N : $instrument</td><td>$sampleid</td> <td>$resultdate</td> </tr>";
// }
?>
<!-- </tbody>
</table>
</div>
</div> -->
<!-- <div class="card-group">
<div class="card my-2">
<div class="card-header fw-bold">
TMS-30i
</div>
<div class="card-body">
<div class="row">
<div class="col col-12 col-xl-6 my-1">
<h5 class="mb-1">National Hospital</h5>
<blockquote class="blockquote mb-2 fs-6">
<p><span class="badge text-bg-success">Primary</span></p>
<footer class="blockquote-footer"><cite title="Source Title">last update</cite> 12 Aug 2003, 16:13:23 WIB</footer>
</blockquote>
</div>
<div class="col col-12 col-xl-6 my-1">
<blockquote class="blockquote mb-2 fs-6">
<p>Persada Hospital</p>
<footer class="blockquote-footer"><cite title="Source Title">last update</cite> 12 Aug 2003, 16:13:23 WIB</footer>
</blockquote>
</div>
</div>
</div>
</div>
<div class="p-1"></div>
<div class="card my-2">
<div class="card-header fw-bold">
TMS-24i Premium
</div>
<div class="card-body text-center">
....
<blockquote class="blockquote mb-3">
<p>National Hospital</p>
<footer class="blockquote-footer"><cite title="Source Title">last update</cite> 12 Aug 2003, 16:13:23 WIB</footer>
</blockquote>
<blockquote class="blockquote mb-3">
<p>Persada Hospital</p>
<footer class="blockquote-footer"><cite title="Source Title">last update</cite> 12 Aug 2003, 16:13:23 WIB</footer>
</blockquote>
</div>
</div>
</div> -->
<!-- <div class="card-group">
<div class="card my-2">
<div class="card-header fw-bold">
TMS-1024i
</div>
<div class="card-body">
<blockquote class="blockquote mb-3">
<p>National Hospital</p>
<footer class="blockquote-footer"><cite title="Source Title">last update</cite> 12 Aug 2003, 16:13:23 WIB</footer>
</blockquote>
<blockquote class="blockquote mb-3">
<p>Persada Hospital</p>
<footer class="blockquote-footer"><cite title="Source Title">last update</cite> 12 Aug 2003, 16:13:23 WIB</footer>
</blockquote>
</div>
</div>
<div class="p-1"></div>
<div class="card my-2">
<div class="card-header fw-bold">
TMS-50i Superior
</div>
<div class="card-body">
<blockquote class="blockquote mb-3">
<p>National Hospital</p>
<footer class="blockquote-footer"><cite title="Source Title">last update</cite> 12 Aug 2003, 16:13:23 WIB</footer>
</blockquote>
<blockquote class="blockquote mb-3">
<p>Persada Hospital</p>
<footer class="blockquote-footer"><cite title="Source Title">last update</cite> 12 Aug 2003, 16:13:23 WIB</footer>
</blockquote>
</div>
</div>
</div> -->
</main>
<?= $this->endSection() ?>

View File

@ -0,0 +1,56 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<?php
$instid = 0;
$instname = '';
if(isset($insts)) { $data = $insts[0]; }
if(isset($new_value)) { $data = $new_value; }
if(isset($data)) {
if(isset($data['instid'])) { $instid = $data['instid']; }
$instname = $data['instname'];
}
?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Inst Editor</h1>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card">
<div class="card-body">
<h5 class="card-title">Inst Editor</h5>
<form method='POST'>
<input type='hidden' name='instid' value='<?=$instid;?>' />
<div class="row mb-3">
<label for="instname" class="col-sm-2 col-form-label">Instname</label>
<div class="col-sm-10">
<input type='text' class='form-control' name='instname' value='<?=$instname;?>' />
</div>
</div>
<div class="text-end">
<button type="submit" class="btn btn-primary">Submit</button>
<button type="reset" class="btn btn-secondary">Reset</button>
</div>
</form>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
document.body.classList.add('toggle-sidebar');
</script>
<?= $this->endSection() ?>

102
app/Views/insts_index.php Normal file
View File

@ -0,0 +1,102 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Instruments List</h1>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card" style="height:700px;">
<div class="card-body">
<div class='card-title d-flex'>
<h5><b>Instrument List</b></h5>
<a href='<?=base_url();?>insts/create' class='btn btn-sm btn-info ms-auto'> <i class='bi bi-plus-circle'></i> New Instrument</a>
</div>
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope='col'>ID</th> <th scope="col">Instrument Name</th> <th></th>
</tr>
</thead>
<tbody>
<?php
foreach($insts as $data) {
$instid = $data['instid'];
$instname= $data['instname'];
?>
<tr>
<td><?=$instid;?></td> <td><?=$instname;?></td>
<td>
<a href='<?=base_url()."insts/edit/".$instid;?>' class='btn btn-sm btn-warning'>edit</a>
<a href='<?=base_url()."flags/".$instid;?>' class='btn btn-sm btn-info'>Flag</a>
<a href='<?=base_url()."techs/".$instid;?>' class='btn btn-sm btn-info'>Tech.</a>
<!--
<button type="button" class="btn btn-sm btn-info openInstflag" data-bs-toggle="modal" data-bs-target="#instflag" data-instid="<?=$instid;?>">Flag</button>
<button type="button" class="btn btn-sm btn-info openInstTec" data-bs-toggle="modal" data-bs-target="#insttec" data-instid="<?=$instid;?>">Tec</button>
-->
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<form id='insttest_form'>
<div class="modal fade" id="insttest" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
</form>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
$('.openInsttestEdit').on('click',function(){
const instid = $(this).data('instid');
$('.modal-content').load('insttest/edit/'+instid,function(){
$('#modal').modal('show');
});
});
$('#insttest_form').submit(function(event) {
event.preventDefault();
$('#insttest').modal('hide');
var formData = $(this).serialize();
$.ajax({
type: 'POST',
url: '<?=base_url()."insttest/update";?>',
dataType: "json",
data: formData,
success: function(response) { console.log(response); },
error: function(xhr, status, error) {
if(xhr.status != '200') {
var alert = '<div class="alert alert-danger alert-dismissible fade show" role="alert">' +
'<strong>Error!</strong> An error occurred. Please try again later.<br>' +
'<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>' +
'</div>';
$('main').prepend(alert);
}
}
});
});
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,40 @@
<aside id="sidebar" class="sidebar">
<ul class="sidebar-nav" id="sidebar-nav">
<li class="nav-item"> <a href='<?=base_url();?>' class='nav-link'><i class="bi bi-speedometer"></i> Dashboard</a> </li>
<li class="nav-item">
<a class="nav-link collapsed" data-bs-target="#components-nav" data-bs-toggle="collapse" href="#">
<i class="bi bi-menu-button-wide"></i><span>Master Data</span><i class="bi bi-chevron-down ms-auto"></i>
</a>
<ul id="components-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">
<li> <a href="<?=base_url();?>equipmentlist" class='nav-link'> <i class="bi bi-circle"></i> <span>Dict. Equipments</span> </a> </li>
<li> <a href="<?=base_url();?>flagdef" class='nav-link'> <i class="bi bi-circle"></i> <span>Dict. Flags Def</span> </a> </li>
<!-- <li> <a href="<?=base_url();?>techs" class='nav-link'> <i class="bi bi-circle"></i> <span>Dict. Tech.</span> </a> </li>
<li> <a href="<?=base_url();?>tests" class='nav-link'> <i class="bi bi-circle"></i> <span>Dict. Tests</span> </a> </li>
<li> <a href="<?=base_url();?>prodinst" class='nav-link'> <i class="bi bi-circle"></i> <span>Product - Instruments</span> </a> </li> -->
</ul>
</li>
<li class="nav-item">
<a class="nav-link collapsed" data-bs-target="#components-nav-command" data-bs-toggle="collapse" href="#">
<i class="bi bi-terminal"></i><span>Command Center</span><i class="bi bi-chevron-down ms-auto"></i>
</a>
<ul id="components-nav-command" class="nav-content collapse " data-bs-parent="#sidebar-nav">
<li> <a href="<?=base_url();?>broadcastcommand" class='nav-link'> <i class="bi bi-circle"></i> <span>Broadcast Instrument</span> </a> </li>
<li> <a href="<?=base_url();?>spesificcommand" class='nav-link'> <i class="bi bi-circle"></i> <span>Specific Instrument</span> </a> </li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link collapsed" data-bs-target="#components-nav-reports" data-bs-toggle="collapse" href="#">
<i class="bi bi-journal-text"></i><span>Reports</span><i class="bi bi-chevron-down ms-auto"></i>
</a>
<ul id="components-nav-reports" class="nav-content collapse " data-bs-parent="#sidebar-nav">
<li> <a href="<?=base_url();?>reports/rangedata" class='nav-link'> <i class="bi bi-circle"></i> <span>All Range Data</span> </a> </li>
<li> <a href="<?=base_url();?>reports/spesificdata" class='nav-link'> <i class="bi bi-circle"></i> <span>Month Range Data</span> </a> </li>
</ul>
</li>
<!-- <li class="nav-item"> <a href="<?=base_url();?>command" class='nav-link'><i class="bi bi-terminal"></i> Command</a> </li> -->
</ul>
</aside>

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="<?=base_url();?>/assets/favicon.png">
<title>Summit CRM</title>
<link href="<?=base_url();?>/assets/style.css" rel="stylesheet">
<link href="<?=base_url();?>/assets/select2/select2.min.css" rel="stylesheet">
<link href="<?=base_url();?>/assets/select2/select2-bootstrap-5-theme.min.css" rel="stylesheet">
<style>
.select2-results__option { font-size: 0.75rem !important; margin: 5px !important; padding: 5px !important; }
li.select2-selection__choice { background-color : #000 !important; padding:5px !improtant; }
.select2 {width:100%!important;}
</style>
<script src="<?=base_url();?>/assets/jquery/jquery.min.js"></script>
<script src="<?=base_url();?>/assets/select2/select2.min.js"></script>
<?= $this->renderSection('head'); ?>
</head>
<body class="skin-megna-dark fixed-layout">
<div class="preloader">
<div class="loader">
<div class="loader__figure"></div>
<p class="loader__label">Summit-CRM</p>
</div>
</div>
<div id="main-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card mt-2">
<div class="card-body">
<?= $this->renderSection('content'); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="<?=base_url();?>/assets/bootstrap.bundle.min.js"></script>
<script src="<?=base_url();?>/assets/perfect-scrollbar.jquery.min.js"></script>
<script src="<?=base_url();?>/assets/app.js"></script>
<?= $this->renderSection('script'); ?>
<script>
$('.select2').select2();
</script>
</body>
</html>

102
app/Views/layouts/main.php Normal file
View File

@ -0,0 +1,102 @@
<!DOCTYPE html>
<!-- Tinydata template made from niceAdmin template by bootstrapmade -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>tiny</title>
<meta content="" name="description">
<meta content="" name="keywords">
<link href="<?=base_url();?>assets/img/favicon.png" rel="icon">
<link href="<?=base_url();?>assets/img/apple-touch-icon.png" rel="apple-touch-icon">
<link href="https://fonts.gstatic.com" rel="preconnect">
<!-- <link href="<?=base_url();?>/assets/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
<link href="<?=base_url();?>/assets/datatables/responsive.dataTables.min.css" rel="stylesheet"> -->
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- DataTables Bootstrap 5 CSS -->
<link href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;700&display=swap" rel="stylesheet">
<!-- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet"> -->
<!-- <link href="<?=base_url();?>assets/bootstrap.css" rel="stylesheet"> -->
<link href="<?=base_url();?>assets/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<link href="<?=base_url();?>assets/select2/select2.min.css" rel="stylesheet">
<link href="<?=base_url();?>assets/select2/select2-bs5.min.css" rel="stylesheet">
<link href="<?=base_url();?>assets/style.css" rel="stylesheet">
<?= $this->renderSection('css'); ?>
</head>
<body class=''>
<header id="header" class="header fixed-top d-flex align-items-center">
<div class="d-flex align-items-center justify-content-between">
<i class="bi bi-list toggle-sidebar-btn m-0 p-0"></i>
<!-- <a href="<?=base_url();?>" class="logo d-flex"><span class="d-none d-lg-block">tiny_clqms</span></a> -->
</div>
<!-- <nav class="header-nav ms-auto">
<a href="<?=base_url();?>" class="logo d-flex"><span class="d-none d-lg-block">tiny</span></a>
</nav> -->
<!-- <nav class="header-nav ms-auto">
<ul class="d-flex align-items-center">
<li class="nav-item dropdown pe-3">
<a class="nav-link nav-profile d-flex align-items-center pe-0" href="#" data-bs-toggle="dropdown">
<img src="<?=base_url();?>assets/img/profile-img.png" alt="Profile" class="rounded-circle">
<span class="d-none d-md-block dropdown-toggle ps-2">Hamtaro</span>
</a>
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-arrow profile">
<li>
<a class="dropdown-item d-flex align-items-center" href="#">
<i class="bi bi-person"></i>
<span>My Profile</span>
</a>
</li>
<hr class="dropdown-divider">
<li>
<a class="dropdown-item d-flex align-items-center" href="#">
<i class="bi bi-box-arrow-right"></i>
<span>Log Out</span>
</a>
</li>
</ul>
</li>
</ul>
</nav> -->
</header>
<?= $this->include('layouts/_sidebar'); ?>
<?= $this->renderSection('content'); ?>
<!-- <footer id="footer" class="footer fixed-bottom text-end me-3">Copyright <strong><span>tiny</span></strong>&copy; 2024. Designed by 4SKA1.</footer> -->
<a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>
<!-- jQuery (required by DataTables) -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<!-- <script src="<?=base_url();?>assets/jquery/jquery.min.js"></script> -->
<script src="<?=base_url();?>assets/bootstrap.bundle.js"></script>
<!-- DataTables JS -->
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<!-- DataTables Bootstrap 5 integration -->
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
<!-- <script src="<?=base_url();?>/assets/datatables/jquery.dataTables.min.js"></script> -->
<!-- <script src="<?=base_url();?>/assets/datatables/dataTables.bootstrap4.min.js"></script> -->
<script src="<?=base_url();?>assets/select2/select2.min.js"></script>
<script src="<?=base_url();?>assets/chart.js"></script>
<script src="<?=base_url();?>assets/main.js"></script>
<?= $this->renderSection('script'); ?>
</body>
</html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" type="image/png" sizes="16x16" href="<?=base_url();?>/assets/favicon.png">
<title>Summit CRM</title>
<link href="<?=base_url();?>/assets/style.css" rel="stylesheet">
<link href="<?=base_url();?>/assets/font-awesome-640/css/all.min.css" rel="stylesheet">
<?= $this->renderSection('head'); ?>
</head>
<body class="skin-megna-dark fixed-layout">
<div class="preloader">
<div class="loader">
<div class="loader__figure"></div>
<p class="loader__label">Summit-CRM</p>
</div>
</div>
<div>
<?= $this->renderSection('content'); ?>
</div>
<script src="<?=base_url();?>/assets/jquery/jquery.min.js"></script>
<script src="<?=base_url();?>/assets/bootstrap.bundle.min.js"></script>
<script src="<?=base_url();?>/assets/app.js"></script>
<?= $this->renderSection('script'); ?>
<script>
$(document).ready(function() {
$('.select2').select2({
dropdownAutoWidth : true,
width: '100%',
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,112 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<?php
$prodinstname = $prodinst[0]['prodinstname'];
$testpermonth = number_format($testcount / ( $days/30 ));
?>
<main id="main" class="main">
<div class="pagetitle">
<h1><?=$prodinstname;?></h1>
</div>
<div class='row'>
<div class="col-xxl-3 col-md-4">
<div class="card info-card sales-card">
<div class="card-body">
<h5 class="card-title">Test Count</h5>
<div class="d-flex align-items-center">
<div class="ps-3">
<h3><?=$testcount;?></h3>
<span>Total test</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-xxl-3 col-md-4">
<div class="card info-card sales-card">
<div class="card-body">
<h5 class="card-title">Test Count (avg)</h5>
<div class="d-flex align-items-center">
<div class="ps-3">
<h3><?=$testpermonth;?></h3>
<span>Test per month</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-xxl-3 col-md-4">
<div class="card info-card sales-card">
<div class="card-body">
<h5 class="card-title">Total Days</h5>
<div class="d-flex align-items-center">
<div class="ps-3">
<h3><?=$days;?></h3>
<span>Days</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class='card-title d-flex'>
<h5><b>Detail</b></h5>
</div>
First data : <?=$firstdate;?><br/>
Last data : <?=$lastdate;?><br/>
<div> <canvas id="myChart"></canvas> </div>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<?php
// chart data
function monthNumberToName($monthNumber) {
return date('F', mktime(0, 0, 0, $monthNumber, 1));
}
$months = '';
$countpm = '';
foreach($counts as $data) {
$qmonth = $data['month'];
$monthname = monthNumberToName($qmonth);
$months .= "'$monthname',";
$qcount = $data['count'];
$countpm .= "$qcount,";
}
$months = rtrim($months,',');
$countpm = rtrim($countpm,',');
?>
<script>
const ctx = document.getElementById('myChart');
new Chart(ctx, {
type: 'bar',
data: {
labels: [ <?=$months;?> ],
datasets: [{
label: '# of Tests',
data: [ <?=$countpm;?> ],
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,111 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<?php
$prodinstid = 0;
$prodinstname = '';
$prodinstcode = '';
$productid = '';
$prodinstkey = '';
$instid = '';
if(isset($prodinsts)) { $data = $prodinsts[0]; }
if(isset($new_value)) { $data = $new_value; }
if(isset($data)) {
if(isset($data['prodinstid'])) { $prodinstid = $data['prodinstid']; }
$prodinstname = $data['prodinstname'];
$prodinstcode = $data['prodinstcode'];
$prodinstkey = $data['prodinstkey'];
$productid = $data['productid'];
$instid = $data['instid'];
}
?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Inst Editor</h1>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card">
<div class="card-body">
<h5 class="card-title">Inst Editor</h5>
<form method='POST'>
<input type='hidden' name='prodinstid' value='<?=$prodinstid;?>' />
<div class="row mb-1">
<label for="productid" class="col-sm-2 col-form-label">Product</label>
<div class="col-sm-10">
<select class='form-control select2 pt-1 productid' name='productid'>
<option value=''></option>
<?php
foreach($products as $data) {
$qproductid = $data['productid'];
$qsitename = $data['sitename'];
$qproductname = $data['productname'];
$qproductnumber = $data['productnumber'];
if($qproductid == $productid) { echo "<option value='$qproductid' selected>$qsitename - $qproductname SN# $qproductnumber</option>"; }
else { echo "<option value='$qproductid'>$qsitename - $qproductname SN# $qproductnumber</option>"; }
}
?>
</select>
</div>
</div>
<div class="row mb-1">
<label for="instid" class="col-sm-2 col-form-label">Instrument</label>
<div class="col-sm-10">
<select class='form-control select2' name='instid'>
<option value=''></option>
<?php
foreach($insts as $data) {
$qinstid = $data['instid'];
$qinstname = $data['instname'];
if($qinstid == $instid) { echo "<option value='$qinstid' selected>$qinstname</option>"; }
else { echo "<option value='$qinstid'>$qinstname</option>"; }
}
?>
</select>
</div>
</div>
<input type='hidden' class='prodinstname' name='prodinstname' value='<?=$prodinstname;?>' />
<div class="row mb-1">
<label for="testcode" class="col-sm-2 col-form-label">ProdInst Code</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-sm" name='prodinstcode' value='<?=$prodinstcode;?>' required />
</div>
</div>
<div class="row mb-1">
<label for="testcode" class="col-sm-2 col-form-label">ProdInst Key</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-sm" name='prodinstkey' value='<?=$prodinstkey;?>' required />
</div>
</div>
<div class="text-end">
<button type="submit" class="btn btn-primary">Submit</button>
<button type="reset" class="btn btn-secondary">Reset</button>
</div>
</form>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
document.body.classList.add('toggle-sidebar');
$('.select2').select2();
$('.productid').on('change', function(){
var selectedOption = $(this).find('option:selected');
var selectedText = selectedOption.text();
$('.prodinstname').val(selectedText);
})
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,98 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<main id="main" class="main">
<div class="pagetitle">
<h1>Product - Instruments List</h1>
</div>
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card" style="height:700px;">
<div class="card-body">
<div class='card-title d-flex'>
<h5><b>Instrument List</b></h5>
<a href='<?=base_url();?>prodinst/create' class='btn btn-sm btn-info ms-auto'> <i class='bi bi-plus-circle'></i> New Instrument</a>
</div>
<table class="table table-sm table-hover">
<thead>
<tr>
<th scope='col'>ID</th> <th scope="col">Instrument Name</th> <th scope="col">Instrument Code</th> <th></th>
</tr>
</thead>
<tbody>
<?php
foreach($prodinsts as $data) {
$prodinstid = $data['prodinstid'];
$prodinstname= $data['prodinstname'];
$prodinstcode= $data['prodinstcode'];
?>
<tr>
<td><?=$prodinstid;?></td> <td><?=$prodinstname;?></td> <td><?=$prodinstcode;?></td>
<td>
<a href='<?=base_url()."prodinst/edit/".$prodinstid;?>' class='btn btn-sm btn-warning'>edit</a>
<button type="button" class="btn btn-sm btn-info openProdinsttestEdit" data-bs-toggle="modal" data-bs-target="#prodinsttest" data-prodinstid="<?=$prodinstid;?>">tests</button>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<form id='prodinsttest_form'>
<div class="modal fade" id="prodinsttest" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
</form>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
$('.openProdinsttestEdit').on('click',function(){
const prodinstid = $(this).data('prodinstid');
$('.modal-content').load('prodinsttest/edit/'+prodinstid,function(){
$('#modal').modal('show');
});
});
$('#prodinsttest_form').submit(function(event) {
event.preventDefault();
$('#prodinsttest').modal('hide');
var formData = $(this).serialize();
$.ajax({
type: 'POST',
url: '<?=base_url()."prodinsttest/update";?>',
dataType: "json",
data: formData,
success: function(response) { console.log(response); },
error: function(xhr, status, error) {
if(xhr.status != '200') {
var alert = '<div class="alert alert-danger alert-dismissible fade show" role="alert">' +
'<strong>Error!</strong> An error occurred. Please try again later.<br>' +
'<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>' +
'</div>';
$('main').prepend(alert);
}
}
});
});
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,88 @@
<?php
$prodinstname = $prodinsts[0]['prodinstname'];
$qi = 0;
?>
<input type='hidden' name='instid' value='<?=$prodinstid;?>' />
<input type='hidden' id='prodinsttestid_del' name='prodinsttestid_del' value='' />
<div class="modal-header">
<small><?=$prodinstname;?></small>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<button type="button" class="btn btn-success mb-3" onclick='row_add()'> <i class='bi bi-plus-circle'></i>Add Row </button>
<table class='table table-bordered table-hover table-sm'>
<thead>
<tr> <td class='text-center'>Testcode</td> <td class='text-center'>Inst-Testcode</td> </tr>
</thead>
<tbody id='insttest_body'>
<?php
$cnt = count($prodinsttests);
if($cnt < 5){ $cnt = 5; }
for($i=$qi; $i < $cnt+1; $i++) {
$testid = '';
$insttestcode = '';
if( isset($prodinsttests[$i]['testid']) ) {
$testid = $prodinsttests[$i]['testid'];
$insttestcode = $prodinsttests[$i]['insttestcode'];
}
?>
<tr>
<td>
<select class='form-control' name='testid[]'>
<option value=''>-</option>
<?php
foreach($tests as $test) {
$qtestid = $test['testid'];
$qtestcode = $test['testcode'];
$qtestname = $test['testname'];
if($testid==$qtestid) { echo "<option value='$qtestid' selected>$qtestcode - $qtestname</option>"; }
else { echo "<option value='$qtestid'>$qtestcode - $qtestname</option>"; }
}
?>
</select>
</td>
<td><input class='form-control' type='text' name='prodinsttestcode[]' value='<?=$prodinsttestcode;?>' /></td>
<?php
if($i==0) {echo "<td></td>";}
else {echo "<td><button type='button' class='btn btn-danger' onclick='row_del(this)'>X</button></td>";}
?>
</tr>
<?php
$qi++;
}
?>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
<script>
// del row
function row_del(e) {
if(confirm('Are you sure?')) {
const table = document.getElementById('insttest_body');
if(table.rows.length >2) { e.parentNode.parentNode.remove(); }
}
}
// add row
function row_add() {
const table = document.getElementById('insttest_body');
const lastRow = table.rows[table.rows.length - 1];
const newRow = lastRow.cloneNode(true);
// Clear select and input elements in the cloned row
newRow.querySelectorAll('select, input').forEach(element => {
if (element.tagName === 'SELECT') {
element.selectedIndex = 0;
} else {
element.value = ''; // Clear input value
}
});
table.appendChild(newRow);
}
</script>

View File

@ -0,0 +1,128 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<main id="main" class="main">
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span
aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card">
<div class="card-header py-0 mb-3">
<div class="d-flex justify-content-between">
<div class="">
<h5 class="card-title my-0">All Range Data</h5>
</div>
<div class="">
<h5 class="card-title my-0"><i class="bi bi-pc-display-horizontal"></i></h5>
</div>
</div>
</div>
<div class='p-4 pt-2'>
<form method="get" class="row g-3 mb-1">
<div class="col-md-3">
<label for="startdate" class="form-label">Start Date :</label>
<input type="date" class="form-control" id="startdate" name="startdate"
value="<?= esc($_GET['startdate'] ?? date('Y-m-d')) ?>">
</div>
<div class="col-md-3">
<label for="enddate" class="form-label">End Date :</label>
<input type="date" class="form-control" id="enddate" name="enddate"
value="<?= esc($_GET['enddate'] ?? date('Y-m-d')) ?>">
</div>
<div class="col-md-3">
<label for="option" class="form-label">Instrument :</label>
<select class="form-select" id="option" name="option">
<!-- <option value="" disabled <?= empty($_GET['enddate']) ? 'selected' : '' ?>>-</option> -->
<option value="1" <?= @$_GET['enddate'] == '1' ? 'selected' : '' ?>>TMS 30i</option>
<option value="2" <?= @$_GET['enddate'] == '2' ? 'selected' : '' ?> disabled>TMS 1024i</option>
<option value="2" <?= @$_GET['enddate'] == '2' ? 'selected' : '' ?> disabled>TMS 24i Premium
</option>
<option value="2" <?= @$_GET['enddate'] == '2' ? 'selected' : '' ?> disabled>TMS 50i Superior
</option>
</select>
</div>
<div class="col-md-3 align-self-end">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
<div class="card-body p-2">
<?php if (!empty($pivot)): ?>
<div class="table-responsive">
<h4>Data counter TMS30i Periode : <?= date('j M Y', strtotime($_GET['startdate']))?> -
<?= date('j M Y', strtotime($_GET['enddate']))?></h4>
<table class="table table-bordered table-striped table-sm text-center align-middle">
<thead class="table-dark align-middle">
<tr>
<th>SN#</th>
<th>SITE</th>
<?php foreach ($yearRange as $year): ?>
<th><?= esc($year) ?></th>
<?php endforeach; ?>
<?php for ($i = 1; $i < count($yearRange); $i++): ?>
<th><?= $yearRange[$i - 1] ?> v <?= $yearRange[$i] ?></th>
<?php endfor; ?>
</tr>
</thead>
<tbody>
<?php foreach ($pivot as $eid => $data): ?>
<tr>
<td><code><?= esc($eid) ?></code></td>
<td class="text-start"><strong><?= esc($siteNames[$eid] ?? 'Unknown') ?></strong></td>
<?php foreach ($yearRange as $year): ?>
<td><?= esc($data[$year]) ?></td>
<?php endforeach; ?>
<?php for ($i = 1; $i < count($yearRange); $i++): ?>
<?php
$key = $yearRange[$i - 1] . '-' . $yearRange[$i];
$percent = $growth[$eid][$key] ?? '-';
if ($percent === '-') {
$colorClass = 'text-secondary';
$symbol = '';
} elseif (strpos($percent, '-') !== false) {
$colorClass = 'text-danger fw-bold';
$symbol = '<i class="bi bi-chevron-down"></i> ';
} else {
$colorClass = 'text-success fw-bold';
$symbol = '<i class="bi bi-chevron-up"></i> ';
}
?>
<td class="<?= $colorClass ?>"><?= $symbol . esc($percent) ?></td>
<?php endfor; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,142 @@
<?php
$currentMonth = date('m');
?>
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<main id="main" class="main">
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span
aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<div class="card">
<div class="card-header py-0 mb-3">
<div class="d-flex justify-content-between">
<div class="">
<h5 class="card-title my-0">Spesific Range Data</h5>
</div>
<div class="">
<h5 class="card-title my-0"><i class="bi bi-pc-display-horizontal"></i></h5>
</div>
</div>
</div>
<div class='p-4 pt-2'>
<form method="get" class="row g-3 mb-1">
<div class="col-md-3">
<label for="first_month" class="form-label">Start Month :</label>
<select name="first_month" class="form-select">
<?php for ($m = 1; $m <= 12; $m++): ?>
<option value="<?= str_pad($m, 2, '0', STR_PAD_LEFT) ?>"
<?= @$_GET['first_month'] == str_pad($m, 2, '0', STR_PAD_LEFT) ? 'selected' : '' ?>>
<?= date('F', mktime(0, 0, 0, $m, 1)) ?>
</option>
<?php endfor ?>
</select>
</div>
<div class="col-md-3">
<label for="last_month" class="form-label">Last Month :</label>
<select name="last_month" class="form-select">
<?php for ($m = 1; $m <= 12; $m++):
$val = str_pad($m, 2, '0', STR_PAD_LEFT);
$selected = (@$_GET['last_month'] ?? $currentMonth) == $val ? 'selected' : '';
?>
<option value="<?= $val ?>" <?= $selected ?>><?= date('F', mktime(0, 0, 0, $m, 1)) ?></option>
<?php endfor; ?>
</select>
</div>
<div class="col-md-3">
<label for="option" class="form-label">Instrument :</label>
<select class="form-select" id="option" name="option">
<!-- <option value="" disabled <?= empty($_GET['enddate']) ? 'selected' : '' ?>>-</option> -->
<option value="1" <?= @$_GET['enddate'] == '1' ? 'selected' : '' ?>>TMS 30i</option>
<option value="2" <?= @$_GET['enddate'] == '2' ? 'selected' : '' ?> disabled>TMS 1024i</option>
<option value="2" <?= @$_GET['enddate'] == '2' ? 'selected' : '' ?> disabled>TMS 24i Premium
</option>
<option value="2" <?= @$_GET['enddate'] == '2' ? 'selected' : '' ?> disabled>TMS 50i Superior
</option>
</select>
</div>
<div class="col-md-3 align-self-end">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
</div>
<div class="card-body p-2">
<?php if (!empty($pivot)): ?>
<div class="table-responsive">
<h4>Data counter semua tahun hanya untuk bulan <?=$name_first_month?> - <?=$name_last_month?></h4>
<table class="table table-bordered table-striped table-sm text-center align-middle">
<thead class="table-dark align-middle">
<tr>
<th>SN#</th>
<th>SITE</th>
<?php foreach ($yearRange as $year): ?>
<th><?= esc($year) ?></th>
<?php endforeach; ?>
<?php for ($i = 1; $i < count($yearRange); $i++): ?>
<th><?= $yearRange[$i - 1] ?> v <?= $yearRange[$i] ?></th>
<?php endfor; ?>
</tr>
</thead>
<tbody>
<?php foreach ($pivot as $eid => $data): ?>
<tr>
<td><code><?= esc($eid) ?></code></td>
<td class="text-start"><strong><?= esc($siteNames[$eid] ?? 'Unknown') ?></strong></td>
<?php foreach ($yearRange as $year): ?>
<td><?= esc($data[$year]) ?></td>
<?php endforeach; ?>
<?php for ($i = 1; $i < count($yearRange); $i++): ?>
<?php
$key = $yearRange[$i - 1] . '-' . $yearRange[$i];
$percent = $growth[$eid][$key] ?? '-';
if ($percent === '-') {
$colorClass = 'text-secondary';
$symbol = '';
} elseif (strpos($percent, '-') !== false) {
$colorClass = 'text-danger fw-bold';
$symbol = '<i class="bi bi-chevron-down"></i> ';
} else {
$colorClass = 'text-success fw-bold';
$symbol = '<i class="bi bi-chevron-up"></i> ';
}
?>
<td class="<?= $colorClass ?>"><?= $symbol . esc($percent) ?></td>
<?php endfor; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
</script>
<?= $this->endSection() ?>

View File

@ -0,0 +1,41 @@
<?= $this->extend('layouts/main.php') ?>
<?= $this->section('content') ?>
<main id="main" class="main">
<!-- <div class="pagetitle">
<h1>Broadcast Command Dasboard</h1>
</div> -->
<?php
if(isset($validation)) {
?>
<div class='alert alert-danger alert-dismissible'>
<?= $validation->listErrors(); ?>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"> <span aria-hidden="true"></span> </button>
</div>
<?php
}
?>
<!-- Button trigger modal -->
<!-- <button type="button" class="btn btn-primary openViewFlagsDef" data-FlagDefID='1' data-bs-toggle="modal" data-bs-target="#exampleModal">
Launch demo modal
</button> -->
<div class="card">
<div class="card-body p-0">
<h5 class="card-title text-center"><i class="bi bi-wrench-adjustable"></i> &nbsp; Under Maintenance</h5>
</div>
</div>
</main>
<?= $this->endSection() ?>
<?= $this->section('script') ?>
<script>
</script>
<?= $this->endSection() ?>

Some files were not shown because too many files have changed in this diff Show More