forked from mahdahar/crm-summit
first commit
This commit is contained in:
commit
fd7948d4fb
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/*
|
||||||
|
!app/
|
||||||
|
!public/
|
||||||
|
!.gitignore
|
||||||
6
app/.htaccess
Normal file
6
app/.htaccess
Normal 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
15
app/Common.php
Normal 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 frameworks
|
||||||
|
* 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://codeigniter4.github.io/CodeIgniter4/
|
||||||
|
*/
|
||||||
469
app/Config/App.php
Normal file
469
app/Config/App.php
Normal file
@ -0,0 +1,469 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Session\Handlers\FileHandler;
|
||||||
|
|
||||||
|
class App extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Base Site URL
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* URL to your CodeIgniter root. Typically this will be your base URL,
|
||||||
|
* WITH a trailing slash:
|
||||||
|
*
|
||||||
|
* http://example.com/
|
||||||
|
*
|
||||||
|
* If this is not set then CodeIgniter will try guess the protocol, domain
|
||||||
|
* and path to your installation. However, you should always configure this
|
||||||
|
* explicitly and never rely on auto-guessing, especially in production
|
||||||
|
* environments.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
//public $baseURL = 'http://localhost:8080/';
|
||||||
|
public $baseURL = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Index File
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Typically this will be your index.php file, unless you've renamed it to
|
||||||
|
* something else. If you are using mod_rewrite to remove the page set this
|
||||||
|
* variable so that it is blank.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
//public $indexPage = 'index.php';
|
||||||
|
public $indexPage = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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!
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $uriProtocol = 'REQUEST_URI';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
public $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()
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $appTimezone = 'Asia/Jakarta';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $charset = 'UTF-8';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* URI PROTOCOL
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* 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 header will be set.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $forceGlobalSecureRequests = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 string
|
||||||
|
*/
|
||||||
|
public $sessionDriver = FileHandler::class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Cookie Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The session cookie name, must contain only [0-9a-z_-] characters
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $sessionCookieName = '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.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
//public $sessionExpiration = 7200;
|
||||||
|
public $sessionExpiration = 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!
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $sessionSavePath = 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.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $sessionMatchIP = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Session Time to Update
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* How many seconds between CI regenerating the session ID.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $sessionTimeToUpdate = 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.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $sessionRegenerateDestroy = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Prefix
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Set a cookie name prefix if you need to avoid collisions.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$prefix property instead.
|
||||||
|
*/
|
||||||
|
public $cookiePrefix = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Domain
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Set to `.your-domain.com` for site-wide cookies.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$domain property instead.
|
||||||
|
*/
|
||||||
|
public $cookieDomain = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Typically will be a forward slash.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$path property instead.
|
||||||
|
*/
|
||||||
|
public $cookiePath = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Secure
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be set if a secure HTTPS connection exists.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$secure property instead.
|
||||||
|
*/
|
||||||
|
public $cookieSecure = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie HttpOnly
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be accessible via HTTP(S) (no JavaScript).
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$httponly property instead.
|
||||||
|
*/
|
||||||
|
public $cookieHTTPOnly = 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`, `$cookieSecure` must also be set.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*
|
||||||
|
* @deprecated use Config\Cookie::$samesite property instead.
|
||||||
|
*/
|
||||||
|
public $cookieSameSite = 'Lax';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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
|
||||||
|
* HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
|
||||||
|
* the visitor's IP address.
|
||||||
|
*
|
||||||
|
* You can use both an array or a comma-separated list of proxy addresses,
|
||||||
|
* as well as specifying whole subnets. Here are a few examples:
|
||||||
|
*
|
||||||
|
* Comma-separated: '10.0.1.200,192.168.5.0/24'
|
||||||
|
* Array: ['10.0.1.200', '192.168.5.0/24']
|
||||||
|
*
|
||||||
|
* @var string|string[]
|
||||||
|
*/
|
||||||
|
public $proxyIPs = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Token Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The token name.
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $tokenName property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $CSRFTokenName = 'csrf_test_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Header Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The header name.
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $headerName property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $CSRFHeaderName = 'X-CSRF-TOKEN';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Cookie Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The cookie name.
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $cookieName property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $CSRFCookieName = 'csrf_cookie_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Expire
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The number in seconds the token should expire.
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $expire property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $CSRFExpire = 7200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Regenerate
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Regenerate token on every submission?
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $regenerate property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $CSRFRegenerate = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Redirect
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Redirect to previous page with error on failure?
|
||||||
|
*
|
||||||
|
* @deprecated Use `Config\Security` $redirect property instead of using this property.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $CSRFRedirect = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF SameSite
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Setting for CSRF SameSite cookie token. Allowed values are:
|
||||||
|
* - None
|
||||||
|
* - Lax
|
||||||
|
* - Strict
|
||||||
|
* - ''
|
||||||
|
*
|
||||||
|
* Defaults to `Lax` as recommended in this link:
|
||||||
|
*
|
||||||
|
* @see https://portswigger.net/web-security/csrf/samesite-cookies
|
||||||
|
*
|
||||||
|
* @deprecated `Config\Cookie` $samesite property is used.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $CSRFSameSite = 'Lax';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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/
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $CSPEnabled = false;
|
||||||
|
}
|
||||||
87
app/Config/Autoload.php
Normal file
87
app/Config/Autoload.php
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?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.
|
||||||
|
*/
|
||||||
|
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 '/app' and '/system' directories 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.
|
||||||
|
*
|
||||||
|
* Prototype:
|
||||||
|
*```
|
||||||
|
* $psr4 = [
|
||||||
|
* 'CodeIgniter' => SYSTEMPATH,
|
||||||
|
* 'App' => APPPATH
|
||||||
|
* ];
|
||||||
|
*```
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public $psr4 = [
|
||||||
|
APP_NAMESPACE => APPPATH, // For custom app namespace
|
||||||
|
'Config' => APPPATH . 'Config',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* -------------------------------------------------------------------
|
||||||
|
* 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 array<int, string>
|
||||||
|
*/
|
||||||
|
public $files = [];
|
||||||
|
}
|
||||||
32
app/Config/Boot/development.php
Normal file
32
app/Config/Boot/development.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?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.
|
||||||
|
*/
|
||||||
|
error_reporting(-1);
|
||||||
|
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);
|
||||||
21
app/Config/Boot/production.php
Normal file
21
app/Config/Boot/production.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ERROR DISPLAY
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Don't show ANY in production environments. Instead, let the system catch
|
||||||
|
| it and display a generic error message.
|
||||||
|
*/
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| 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);
|
||||||
32
app/Config/Boot/testing.php
Normal file
32
app/Config/Boot/testing.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?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.
|
||||||
|
*/
|
||||||
|
error_reporting(-1);
|
||||||
|
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);
|
||||||
22
app/Config/CURLRequest.php
Normal file
22
app/Config/CURLRequest.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?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.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $shareOptions = true;
|
||||||
|
}
|
||||||
181
app/Config/Cache.php
Normal file
181
app/Config/Cache.php
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $backupHandler = 'dummy';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cache Directory Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The path to where cache files should be stored, if using a file-based
|
||||||
|
* system.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @deprecated Use the driver-specific variant under $file
|
||||||
|
*/
|
||||||
|
public $storePath = WRITEPATH . 'cache/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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.
|
||||||
|
* array('q') = Enabled, but only take into account the specified list
|
||||||
|
* of query parameters.
|
||||||
|
*
|
||||||
|
* @var bool|string[]
|
||||||
|
*/
|
||||||
|
public $cacheQueryString = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $reservedCharacters = '{}()/\@:';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* File settings
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Your file storage preferences can be specified below, if you are using
|
||||||
|
* the File driver.
|
||||||
|
*
|
||||||
|
* @var array<string, int|string|null>
|
||||||
|
*/
|
||||||
|
public $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<string, boolean|int|string>
|
||||||
|
*/
|
||||||
|
public $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<string, int|string|null>
|
||||||
|
*/
|
||||||
|
public $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, string>
|
||||||
|
*/
|
||||||
|
public $validHandlers = [
|
||||||
|
'dummy' => DummyHandler::class,
|
||||||
|
'file' => FileHandler::class,
|
||||||
|
'memcached' => MemcachedHandler::class,
|
||||||
|
'predis' => PredisHandler::class,
|
||||||
|
'redis' => RedisHandler::class,
|
||||||
|
'wincache' => WincacheHandler::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
94
app/Config/Constants.php
Normal file
94
app/Config/Constants.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?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
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
|
||||||
|
*/
|
||||||
|
define('EVENT_PRIORITY_LOW', 200);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
|
||||||
|
*/
|
||||||
|
define('EVENT_PRIORITY_NORMAL', 100);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
|
||||||
|
*/
|
||||||
|
define('EVENT_PRIORITY_HIGH', 10);
|
||||||
188
app/Config/ContentSecurityPolicy.php
Normal file
188
app/Config/ContentSecurityPolicy.php
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
<?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
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $reportOnly = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies a URL where a browser will send reports
|
||||||
|
* when a content security policy is violated.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
public $reportURI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $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 string|string[]|null
|
||||||
|
*/
|
||||||
|
public $defaultSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists allowed scripts' URLs.
|
||||||
|
*
|
||||||
|
* @var string|string[]
|
||||||
|
*/
|
||||||
|
public $scriptSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists allowed stylesheets' URLs.
|
||||||
|
*
|
||||||
|
* @var string|string[]
|
||||||
|
*/
|
||||||
|
public $styleSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the origins from which images can be loaded.
|
||||||
|
*
|
||||||
|
* @var 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 string|string[]|null
|
||||||
|
*/
|
||||||
|
public $baseURI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists the URLs for workers and embedded frame contents
|
||||||
|
*
|
||||||
|
* @var string|string[]
|
||||||
|
*/
|
||||||
|
public $childSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limits the origins that you can connect to (via XHR,
|
||||||
|
* WebSockets, and EventSource).
|
||||||
|
*
|
||||||
|
* @var string|string[]
|
||||||
|
*/
|
||||||
|
public $connectSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the origins that can serve web fonts.
|
||||||
|
*
|
||||||
|
* @var string|string[]
|
||||||
|
*/
|
||||||
|
public $fontSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists valid endpoints for submission from `<form>` tags.
|
||||||
|
*
|
||||||
|
* @var 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 string|string[]|null
|
||||||
|
*/
|
||||||
|
public $frameAncestors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The frame-src directive restricts the URLs which may
|
||||||
|
* be loaded into nested browsing contexts.
|
||||||
|
*
|
||||||
|
* @var array|string|null
|
||||||
|
*/
|
||||||
|
public $frameSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restricts the origins allowed to deliver video and audio.
|
||||||
|
*
|
||||||
|
* @var string|string[]|null
|
||||||
|
*/
|
||||||
|
public $mediaSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows control over Flash and other plugins.
|
||||||
|
*
|
||||||
|
* @var string|string[]
|
||||||
|
*/
|
||||||
|
public $objectSrc = 'self';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string|string[]|null
|
||||||
|
*/
|
||||||
|
public $manifestSrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limits the kinds of plugins a page may invoke.
|
||||||
|
*
|
||||||
|
* @var string|string[]|null
|
||||||
|
*/
|
||||||
|
public $pluginTypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of actions allowed.
|
||||||
|
*
|
||||||
|
* @var string|string[]|null
|
||||||
|
*/
|
||||||
|
public $sandbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nonce tag for style
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $styleNonceTag = '{csp-style-nonce}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nonce tag for script
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $scriptNonceTag = '{csp-script-nonce}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace nonce tag automatically
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $autoNonce = true;
|
||||||
|
}
|
||||||
120
app/Config/Cookie.php
Normal file
120
app/Config/Cookie.php
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $prefix = 'ci4_';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $path = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Domain
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Set to `.your-domain.com` for site-wide cookies.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $domain = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie Secure
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be set if a secure HTTPS connection exists.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $secure = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Cookie HTTPOnly
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie will only be accessible via HTTP(S) (no JavaScript).
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
//public $httponly = true;
|
||||||
|
public $httponly = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 string
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @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 $raw = false;
|
||||||
|
}
|
||||||
19
app/Config/CustomValidation.php
Normal file
19
app/Config/CustomValidation.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
class CustomValidation{
|
||||||
|
|
||||||
|
public function validateLogin(string $str, string $fields, array $data){
|
||||||
|
$email = $data['email'];
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT userid, password FROM users WHERE email_1='$email'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$user = $query->getRow();
|
||||||
|
|
||||||
|
if(!$user) return false;
|
||||||
|
|
||||||
|
return password_verify($data['password'], $user->password );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
93
app/Config/Database.php
Normal file
93
app/Config/Database.php
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Database\Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database Configuration
|
||||||
|
*/
|
||||||
|
class Database extends Config
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The directory that holds the Migrations
|
||||||
|
* and Seeds directories.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lets you choose which connection group to
|
||||||
|
* use if no other is specified.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $defaultGroup = 'default';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default database connection.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $default = [
|
||||||
|
'DSN' => '',
|
||||||
|
'hostname' => 'localhost',
|
||||||
|
'username' => 'root',
|
||||||
|
'password' => '',
|
||||||
|
'database' => 'crm',
|
||||||
|
'DBDriver' => 'MySQLi',
|
||||||
|
'DBPrefix' => '',
|
||||||
|
'pConnect' => false,
|
||||||
|
//'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||||
|
'DBDebug' => true,
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'DBCollat' => 'utf8_general_ci',
|
||||||
|
'swapPre' => '',
|
||||||
|
'encrypt' => false,
|
||||||
|
'compress' => false,
|
||||||
|
'strictOn' => false,
|
||||||
|
'failover' => [],
|
||||||
|
'port' => 3306,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This database connection is used when
|
||||||
|
* running PHPUnit database tests.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $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' => (ENVIRONMENT !== 'production'),
|
||||||
|
'DBDebug' => true,
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'DBCollat' => 'utf8_general_ci',
|
||||||
|
'swapPre' => '',
|
||||||
|
'encrypt' => false,
|
||||||
|
'compress' => false,
|
||||||
|
'strictOn' => false,
|
||||||
|
'failover' => [],
|
||||||
|
'port' => 3306,
|
||||||
|
'foreignKeys' => true,
|
||||||
|
];
|
||||||
|
|
||||||
|
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';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
app/Config/DocTypes.php
Normal file
33
app/Config/DocTypes.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
class DocTypes
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* List of valid document types.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public $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">',
|
||||||
|
];
|
||||||
|
}
|
||||||
148
app/Config/Email.php
Normal file
148
app/Config/Email.php
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Email extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $fromEmail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $fromName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $recipients;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "user agent"
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $userAgent = 'CodeIgniter';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mail sending protocol: mail, sendmail, smtp
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $protocol = 'smtp';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server path to Sendmail.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
//public $mailPath = '/usr/sbin/sendmail';
|
||||||
|
|
||||||
|
public $SMTPHost = 'mail.services.summit.co.id';
|
||||||
|
public $SMTPUser = 'noreply@services.summit.co.id';
|
||||||
|
public $SMTPPass = 'Summit2020';
|
||||||
|
public $SMTPPort = 587;
|
||||||
|
//public $SMTPCrypto = 'ssl';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Timeout (in seconds)
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $SMTPTimeout = 30;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable persistent SMTP connections
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $SMTPKeepAlive = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMTP Encryption. Either tls or ssl
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable word-wrap
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $wordWrap = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Character count to wrap at
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $wrapChars = 76;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type of mail, either 'text' or 'html'
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $mailType = 'html';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Character set (utf-8, iso-8859-1, etc.)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $charset = 'UTF-8';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to validate the email address
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $validate = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $priority = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $CRLF = "\r\n";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $newline = "\r\n";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable BCC Batch Mode.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $BCCBatchMode = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of emails in each BCC batch
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $BCCBatchSize = 200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable notify message from server
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
//public $DSN = true;
|
||||||
|
public $DSN = false;
|
||||||
|
}
|
||||||
67
app/Config/Encryption.php
Normal file
67
app/Config/Encryption.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $key = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Encryption Driver to Use
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* One of the supported encryption drivers.
|
||||||
|
*
|
||||||
|
* Available drivers:
|
||||||
|
* - OpenSSL
|
||||||
|
* - Sodium
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $blockSize = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Encryption digest
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $digest = 'SHA512';
|
||||||
|
}
|
||||||
48
app/Config/Events.php
Normal file
48
app/Config/Events.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Events\Events;
|
||||||
|
use CodeIgniter\Exceptions\FrameworkException;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* 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 () {
|
||||||
|
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');
|
||||||
|
Services::toolbar()->respond();
|
||||||
|
}
|
||||||
|
});
|
||||||
60
app/Config/Exceptions.php
Normal file
60
app/Config/Exceptions.php
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup how the exception handler works.
|
||||||
|
*/
|
||||||
|
class Exceptions extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* LOG EXCEPTIONS?
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* If true, then exceptions will be logged
|
||||||
|
* through Services::Log.
|
||||||
|
*
|
||||||
|
* Default: true
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $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 array
|
||||||
|
*/
|
||||||
|
public $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'
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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 array
|
||||||
|
*/
|
||||||
|
public $sensitiveDataInTrace = [];
|
||||||
|
}
|
||||||
32
app/Config/Feature.php
Normal file
32
app/Config/Feature.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable backward compatibility breaking features.
|
||||||
|
*/
|
||||||
|
class Feature extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Enable multiple filters for a route or not.
|
||||||
|
*
|
||||||
|
* If you enable this:
|
||||||
|
* - CodeIgniter\CodeIgniter::handleRequest() uses:
|
||||||
|
* - CodeIgniter\Filters\Filters::enableFilters(), instead of enableFilter()
|
||||||
|
* - CodeIgniter\CodeIgniter::tryToRouteIt() uses:
|
||||||
|
* - CodeIgniter\Router\Router::getFilters(), instead of getFilter()
|
||||||
|
* - CodeIgniter\Router\Router::handle() uses:
|
||||||
|
* - property $filtersInfo, instead of $filterInfo
|
||||||
|
* - CodeIgniter\Router\RouteCollection::getFiltersForRoute(), instead of getFilterForRoute()
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $multipleFilters = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use improved new auto routing instead of the default legacy version.
|
||||||
|
*/
|
||||||
|
public bool $autoRoutesImproved = false;
|
||||||
|
}
|
||||||
78
app/Config/Filters.php
Normal file
78
app/Config/Filters.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Filters\CSRF;
|
||||||
|
use CodeIgniter\Filters\DebugToolbar;
|
||||||
|
use CodeIgniter\Filters\Honeypot;
|
||||||
|
use CodeIgniter\Filters\InvalidChars;
|
||||||
|
use CodeIgniter\Filters\SecureHeaders;
|
||||||
|
|
||||||
|
class Filters extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Configures aliases for Filter classes to
|
||||||
|
* make reading things nicer and simpler.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $aliases = [
|
||||||
|
'csrf' => CSRF::class,
|
||||||
|
'toolbar' => DebugToolbar::class,
|
||||||
|
'honeypot' => Honeypot::class,
|
||||||
|
'invalidchars' => InvalidChars::class,
|
||||||
|
'secureheaders' => SecureHeaders::class,
|
||||||
|
'auth' => \App\Filters\Auth::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of filter aliases that are always
|
||||||
|
* applied before and after every request.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $globals = [
|
||||||
|
'before' => [
|
||||||
|
'auth' => [ 'except' => [
|
||||||
|
'auth/*'
|
||||||
|
]]
|
||||||
|
// 'honeypot',
|
||||||
|
// 'csrf',
|
||||||
|
// 'invalidchars',
|
||||||
|
],
|
||||||
|
'after' => [
|
||||||
|
'toolbar',
|
||||||
|
// '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
|
||||||
|
*/
|
||||||
|
public $methods = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of filter aliases that should run on any
|
||||||
|
* before or after URI patterns.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $filters = [
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
9
app/Config/ForeignCharacters.php
Normal file
9
app/Config/ForeignCharacters.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
|
||||||
|
|
||||||
|
class ForeignCharacters extends BaseForeignCharacters
|
||||||
|
{
|
||||||
|
}
|
||||||
77
app/Config/Format.php
Normal file
77
app/Config/Format.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Format\FormatterInterface;
|
||||||
|
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 string[]
|
||||||
|
*/
|
||||||
|
public $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 $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 $formatterOptions = [
|
||||||
|
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
|
||||||
|
'application/xml' => 0,
|
||||||
|
'text/xml' => 0,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Factory method to return the appropriate formatter for the given mime type.
|
||||||
|
*
|
||||||
|
* @return FormatterInterface
|
||||||
|
*
|
||||||
|
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
|
||||||
|
*/
|
||||||
|
public function getFormatter(string $mime)
|
||||||
|
{
|
||||||
|
return Services::format()->getFormatter($mime);
|
||||||
|
}
|
||||||
|
}
|
||||||
40
app/Config/Generators.php
Normal file
40
app/Config/Generators.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?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, string>
|
||||||
|
*/
|
||||||
|
public $views = [
|
||||||
|
'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',
|
||||||
|
];
|
||||||
|
}
|
||||||
43
app/Config/Honeypot.php
Normal file
43
app/Config/Honeypot.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
class Honeypot extends BaseConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Makes Honeypot visible or not to human
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $hidden = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot Label Content
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $label = 'Fill This Field';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot Field Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $name = 'honeypot';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot HTML Template
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $template = '<label>{label}</label><input type="text" name="{name}" value=""/>';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Honeypot container
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $container = '<div style="display:none">{template}</div>';
|
||||||
|
}
|
||||||
35
app/Config/Images.php
Normal file
35
app/Config/Images.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $defaultHandler = 'gd';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path to the image library.
|
||||||
|
* Required for ImageMagick, GraphicsMagick, or NetPBM.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $libraryPath = '/usr/local/bin/convert';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The available handler classes.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public $handlers = [
|
||||||
|
'gd' => GDHandler::class,
|
||||||
|
'imagick' => ImageMagickHandler::class,
|
||||||
|
];
|
||||||
|
}
|
||||||
51
app/Config/Kint.php
Normal file
51
app/Config/Kint.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use Kint\Renderer\Renderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 extends BaseConfig
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $plugins;
|
||||||
|
public $maxDepth = 6;
|
||||||
|
public $displayCalledFrom = true;
|
||||||
|
public $expanded = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| RichRenderer Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
public $richTheme = 'aante-light.css';
|
||||||
|
public $richFolder = false;
|
||||||
|
public $richSort = Renderer::SORT_FULL;
|
||||||
|
public $richObjectPlugins;
|
||||||
|
public $richTabPlugins;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| CLI Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
public $cliColors = true;
|
||||||
|
public $cliForceUTF8 = false;
|
||||||
|
public $cliDetectWidth = true;
|
||||||
|
public $cliMinWidth = 40;
|
||||||
|
}
|
||||||
154
app/Config/Logger.php
Normal file
154
app/Config/Logger.php
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Log\Handlers\FileHandler;
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
|
||||||
|
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 array|int
|
||||||
|
*/
|
||||||
|
public $threshold = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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 server, 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
|
||||||
|
*/
|
||||||
|
public $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,
|
||||||
|
// ],
|
||||||
|
];
|
||||||
|
}
|
||||||
55
app/Config/Migrations.php
Normal file
55
app/Config/Migrations.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?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.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $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
|
||||||
|
* level the system is at. It then compares the migration level in this
|
||||||
|
* table to the $config['migration_version'] if they are not the same it
|
||||||
|
* will migrate up. This must be set.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $table = 'migrations';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Timestamp Format
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This is the format that will be used when creating new migrations
|
||||||
|
* using the CLI command:
|
||||||
|
* > php spark migrate:create
|
||||||
|
*
|
||||||
|
* Typical formats:
|
||||||
|
* - YmdHis_
|
||||||
|
* - Y-m-d-His_
|
||||||
|
* - Y_m_d_His_
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $timestampFormat = 'Y-m-d-His_';
|
||||||
|
}
|
||||||
532
app/Config/Mimes.php
Normal file
532
app/Config/Mimes.php
Normal file
@ -0,0 +1,532 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mimes
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
public static $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/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',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
53
app/Config/Modules.php
Normal file
53
app/Config/Modules.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Modules\Modules as BaseModules;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 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 string[]
|
||||||
|
*/
|
||||||
|
public $aliases = [
|
||||||
|
'events',
|
||||||
|
'filters',
|
||||||
|
'registrars',
|
||||||
|
'routes',
|
||||||
|
'services',
|
||||||
|
];
|
||||||
|
}
|
||||||
39
app/Config/Pager.php
Normal file
39
app/Config/Pager.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?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 $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.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $perPage = 20;
|
||||||
|
}
|
||||||
85
app/Config/Paths.php
Normal file
85
app/Config/Paths.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $systemDirectory = __DIR__ . '/../../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
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $writableDirectory = __DIR__ . '/../../writable';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
* TESTS DIRECTORY NAME
|
||||||
|
* ---------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* This variable must contain the name of your "tests" directory.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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()`.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $viewDirectory = __DIR__ . '/../Views';
|
||||||
|
}
|
||||||
28
app/Config/Publisher.php
Normal file
28
app/Config/Publisher.php
Normal 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',
|
||||||
|
];
|
||||||
|
}
|
||||||
240
app/Config/Routes.php
Normal file
240
app/Config/Routes.php
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
// Create a new instance of our RouteCollection class.
|
||||||
|
$routes = Services::routes();
|
||||||
|
|
||||||
|
// Load the system's routing file first, so that the app and ENVIRONMENT
|
||||||
|
// can override as needed.
|
||||||
|
if (is_file(SYSTEMPATH . 'Config/Routes.php')) {
|
||||||
|
require SYSTEMPATH . 'Config/Routes.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Router Setup
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
$routes->setDefaultNamespace('App\Controllers');
|
||||||
|
$routes->setDefaultController('Dashboard');
|
||||||
|
$routes->setDefaultMethod('index');
|
||||||
|
$routes->setTranslateURIDashes(false);
|
||||||
|
$routes->set404Override();
|
||||||
|
// The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
|
||||||
|
// where controller filters or CSRF protection are bypassed.
|
||||||
|
// If you don't want to define all routes, please use the Auto Routing (Improved).
|
||||||
|
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
|
||||||
|
// $routes->setAutoRoute(false);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Route Definitions
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// We get a performance increase by specifying the default
|
||||||
|
// route since we don't have to scan directories.
|
||||||
|
|
||||||
|
$routes->match(['get','post'], '/auth/login', 'Auth::login');
|
||||||
|
$routes->match(['get','post'], '/auth/setPass', 'Auth::setPass');
|
||||||
|
$routes->get( '/auth/logout', 'Auth::logout');
|
||||||
|
|
||||||
|
//$routes->get('/', 'Home::index',['filter'=>'auth']);
|
||||||
|
$routes->get('/', 'Dashboard::index/0' );
|
||||||
|
$routes->get('/Dashboard', 'Dashboard::index/0');
|
||||||
|
$routes->get('/Dashboard/user/(:num)', 'Dashboard::index/$1');
|
||||||
|
//zones
|
||||||
|
$routes->get('/zones', 'Zones::index');
|
||||||
|
$routes->match(['get','post'],'/zones/edit/(:num)', 'Zones::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/zones/create', 'Zones::edit/0');
|
||||||
|
//areas
|
||||||
|
$routes->get('/areas','Areas::index');
|
||||||
|
$routes->match(['get','post'],'/areas/edit/(:num)', 'Areas::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/areas/create', 'Areas::edit/0');
|
||||||
|
$routes->match(['get','post'],'/areazone/edit/(:num)', 'Areas::areazone_edit/$1');
|
||||||
|
$routes->match(['get','post'],'/areazone/newrow', 'Areas::areazone_newrow');
|
||||||
|
// accounts
|
||||||
|
$routes->match(['get','post'],'/accounts', 'Accounts::index');
|
||||||
|
$routes->get('/accounts/view/(:num)', 'Accounts::view/$1');
|
||||||
|
$routes->match(['get','post'],'/accounts/edit/(:num)', 'Accounts::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/accounts/create', 'Accounts::edit/0');
|
||||||
|
$routes->get('/accounts/toggle/(:num)', 'Accounts::toggle/$1');
|
||||||
|
$routes->get('/accounts/getcity/(:num)', 'Accounts::getcity/$1');
|
||||||
|
// sites
|
||||||
|
$routes->match(['get', 'post'],'/sites', 'Sites::index');
|
||||||
|
$routes->get('/sites/view/(:num)', 'Sites::view/$1');
|
||||||
|
$routes->match(['get', 'post'], '/sites/edit/(:any)', 'Sites::edit/$1');
|
||||||
|
$routes->match(['get', 'post'], '/sites/create', 'Sites::edit/0');
|
||||||
|
$routes->get('/sites/toggle/(:num)', 'Sites::toggle/$1');
|
||||||
|
$routes->get('/sites/log/delete/(:num)', 'Sites::siteslog_delete/$1');
|
||||||
|
$routes->match(['get', 'post'],'/sites/log/edit/(:num)', 'Sites::siteslog_edit/$1');
|
||||||
|
// offices
|
||||||
|
$routes->get('/offices', 'Offices::index');
|
||||||
|
$routes->get('/offices/view/(:num)', 'Offices::view/$1');
|
||||||
|
$routes->match(['get', 'post'], '/offices/edit/(:any)', 'Offices::edit/$1');
|
||||||
|
$routes->match(['get', 'post'], '/offices/create', 'Offices::edit/0');
|
||||||
|
// sitecontact
|
||||||
|
$routes->match(['get', 'post'],'/sitecontact/edit/(:num)', 'Sites::sitecontact_edit/$1');
|
||||||
|
$routes->get('/sitecontact/getEmail_1/(:num)', 'Sites::sitecontact_getEmail_1/$1');
|
||||||
|
$routes->get('/sitecontact/newrow', 'Sites::sitecontact_newrow');
|
||||||
|
// vendors
|
||||||
|
$routes->get('/vendors', 'Vendors::index');
|
||||||
|
$routes->get('/vendors/toggle/(:num)', 'Vendors::toggle/$1');
|
||||||
|
$routes->match(['get', 'post'], '/vendors/edit/(:any)', 'Vendors::edit/$1');
|
||||||
|
$routes->match(['get', 'post'], '/vendors/create', 'Vendors::create');
|
||||||
|
// producttype
|
||||||
|
$routes->get('/producttype', 'ProductType::index');
|
||||||
|
$routes->match(['get','post'],'/producttype/edit/(:num)', 'ProductType::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/producttype/create', 'ProductType::create');
|
||||||
|
// productservice
|
||||||
|
$routes->get('/productservice', 'ProductService::index');
|
||||||
|
$routes->match(['get','post'],'/productservice/edit/(:num)', 'ProductService::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/productservice/create', 'ProductService::create');
|
||||||
|
// productalias
|
||||||
|
$routes->match(['get','post'],'/productalias', 'ProductAlias::index');
|
||||||
|
$routes->match(['get','post'],'/productalias/edit/(:num)', 'ProductAlias::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/productalias/create', 'ProductAlias::create');
|
||||||
|
// productcatalog
|
||||||
|
$routes->match(['get','post'],'/productcatalog', 'ProductCatalog::index');
|
||||||
|
$routes->match(['get','post'],'/productcatalog/edit/(:num)', 'ProductCatalog::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/productcatalog/create', 'ProductCatalog::create');
|
||||||
|
|
||||||
|
//unitgroup
|
||||||
|
$routes->match(['get','post'], '/unitgroup/', 'UnitGroup::index');
|
||||||
|
$routes->match(['get','post'], '/unitgroup/edit/(:num)', 'UnitGroup::edit/$1');
|
||||||
|
$routes->match(['get','post'], '/unitgroup/create', 'UnitGroup::edit/0');
|
||||||
|
|
||||||
|
// products
|
||||||
|
$routes->match(['get','post'],'/products', 'Products::index');
|
||||||
|
$routes->get('/products/view/(:num)', 'Products::view/$1');
|
||||||
|
$routes->match(['get','post'],'/products/edit/(:num)', 'Products::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/products/create', 'Products::edit/0');
|
||||||
|
$routes->match(['get','post'],'/products/log/edit/(:num)', 'Products::productslog_edit/$1');
|
||||||
|
$routes->match(['get','post'],'/products/movesite/(:num)', 'Products::movesite/$1');
|
||||||
|
$routes->match(['get','post'],'/products/changeowner/(:num)', 'Products::changeowner/$1');
|
||||||
|
$routes->match(['get','post'],'/products/upgrade/(:num)', 'Products::upgrade/$1');
|
||||||
|
$routes->post('/products/log/delete', 'Products::productslog_delete');
|
||||||
|
// users
|
||||||
|
$routes->get('/users', 'Users::index');
|
||||||
|
$routes->get('/users/view/(:num)', 'Users::view/$1');
|
||||||
|
$routes->match(['get','post'],'/users/create', 'Users::edit/0');
|
||||||
|
$routes->match(['get','post'],'/users/edit/(:num)', 'Users::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/users/edit_password/(:num)', 'Users::edit_password/$1');
|
||||||
|
$routes->get('/users/toggle/(:num)', 'Users::toggle/$1');
|
||||||
|
$routes->match(['get','post'],'/users/role/edit/(:num)', 'Users::edit_role/$1');
|
||||||
|
$routes->match(['get','post'],'/users/log/edit/(:num)', 'Users::users_log_edit/$1');
|
||||||
|
$routes->get('/users/log/delete/(:num)', 'Users::users_log_delete/$1');
|
||||||
|
// userpos
|
||||||
|
$routes->get('/userposition', 'UserPosition::index');
|
||||||
|
$routes->match(['get','post'],'/userposition/create', 'UserPosition::create');
|
||||||
|
$routes->match(['get','post'],'/userposition/edit/(:num)', 'UserPosition::edit/$1');
|
||||||
|
// userdept
|
||||||
|
$routes->get('/userdepartment', 'UserDepartment::index');
|
||||||
|
$routes->match(['get','post'],'/userdepartment/create', 'UserDepartment::create');
|
||||||
|
$routes->match(['get','post'],'/userdepartment/edit/(:num)', 'UserDepartment::edit/$1');
|
||||||
|
// activity type
|
||||||
|
$routes->get('/acttype', 'ActType::index');
|
||||||
|
$routes->match(['get','post'],'/acttype/create', 'ActType::create');
|
||||||
|
$routes->match(['get','post'],'/acttype/edit/(:num)', 'ActType::edit/$1');
|
||||||
|
// activity text
|
||||||
|
$routes->get('/acttext', 'ActText::index');
|
||||||
|
$routes->get('/acttext/toggle/(:num)', 'ActText::toggle/$1');
|
||||||
|
$routes->match(['get','post'],'/acttext/create', 'ActText::create');
|
||||||
|
$routes->match(['get','post'],'/acttext/edit/(:num)', 'ActText::edit/$1');
|
||||||
|
// activities
|
||||||
|
$routes->match(['get','post'],'/activities/', 'Activities::index');
|
||||||
|
$routes->get('/activities/index/getproduct/(:num)', 'Activities::index_getproduct/$1');
|
||||||
|
$routes->get('/activities/detail/(:num)', 'Activities::detail/$1');
|
||||||
|
$routes->get('/activities/suspend/(:num)', 'Activities::suspend/$1');
|
||||||
|
$routes->get('/activities/disable/(:num)', 'Activities::disable/$1');
|
||||||
|
// $routes->get('/activities/delete/(:num)', 'Activities::delete/$1');
|
||||||
|
$routes->match(['get','post'],'/activities/save', 'Activities::save');
|
||||||
|
$routes->post('/activities/upload', 'Activities::upload');
|
||||||
|
$routes->get('/activities/getproduct/(:num)', 'Activities::getproduct/$1/$2/$3');
|
||||||
|
$routes->get('/activities/getvendor/(:num)', 'Activities::getvendor/$1');
|
||||||
|
$routes->get('/activities/getconsumable/(:num)', 'Activities::getconsumable/$1');
|
||||||
|
$routes->get('/activities/getcontact/(:num)', 'Activities::getcontact/$1');
|
||||||
|
$routes->get('/activities/newtextarea', 'Activities::newtextarea');
|
||||||
|
$routes->get('/activities/activitiesproduct/(:num)', 'Activities::activitiesproduct/$1');
|
||||||
|
$routes->get('/activities/dummy', 'Activities::dummy');
|
||||||
|
$routes->match(['get','post'],'/activities/create', 'Activities::edit/0');
|
||||||
|
$routes->match(['get','post'],'/activities/savesend', 'Activities::savesend');
|
||||||
|
$routes->match(['get','post'],'/activities/edit/(:num)', 'Activities::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/activities/editsend', 'Activities::editsend');
|
||||||
|
$routes->match(['get','post'],'/activities/count', 'Activities::count');
|
||||||
|
$routes->match(['get','post'],'/activities/export', 'Activities::export');
|
||||||
|
$routes->match(['get','post'],'/activities/compose/(:num)', 'Activities::email_compose/$1');
|
||||||
|
$routes->get('/testemail','Activites::email_test');
|
||||||
|
|
||||||
|
// contacts
|
||||||
|
$routes->get('/contacts', 'Contacts::index');
|
||||||
|
$routes->get('/contacts/view/(:num)', 'Contacts::view/$1');
|
||||||
|
$routes->match(['get','post'],'/contacts/edit/(:num)', 'Contacts::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/contacts/create', 'Contacts::edit/0');
|
||||||
|
|
||||||
|
// emails
|
||||||
|
$routes->get('/emails', 'Emails::index');
|
||||||
|
$routes->get('/emails/toggle/(:num)', 'Emails::toggle/$1');
|
||||||
|
$routes->match(['get','post'],'/emails/edit/(:num)', 'Emails::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/emails/create', 'Emails::edit/0');
|
||||||
|
|
||||||
|
// BUGS
|
||||||
|
$routes->get('/bugs', 'Bugs::index');
|
||||||
|
$routes->match(['get','post'],'/bugs/count', 'Bugs::count');
|
||||||
|
$routes->get('/bugs/toggle_close/(:num)', 'Bugs::toggle_close/$1');
|
||||||
|
$routes->get('/bugs/toggle_pending/(:num)', 'Bugs::toggle_pending/$1');
|
||||||
|
$routes->get('/bugs/toggle_reopen/(:num)', 'Bugs::toggle_reopen/$1');
|
||||||
|
$routes->get('/bugs/toggle_suspend/(:num)', 'Bugs::toggle_suspend/$1');
|
||||||
|
$routes->match(['get', 'post'], '/bugs/create', 'Bugs::create');
|
||||||
|
$routes->match(['get','post'], '/bugs/view/(:num)', 'Bugs::view/$1');
|
||||||
|
$routes->match(['get', 'post'], '/bugs/edit/(:any)', 'Bugs::edit/$1');
|
||||||
|
// $routes->get('/bugs/delete/(:num)', 'Bugs::delete/$1');
|
||||||
|
|
||||||
|
// GuideBooks
|
||||||
|
$routes->get('/guidebook', 'Guidebook::index');
|
||||||
|
$routes->match(['get', 'post'], '/guidebook/create', 'Guidebook::create');
|
||||||
|
$routes->get('/guidebook/view/(:num)', 'Guidebook::view/$1');
|
||||||
|
$routes->match(['get', 'post'], '/guidebook/edit/(:any)', 'Guidebook::edit/$1');
|
||||||
|
$routes->get('/guidebook/delete/(:num)', 'Guidebook::delete/$1');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Groups
|
||||||
|
$routes->get('/mailgroups', 'Mailgroups::index');
|
||||||
|
$routes->match(['get', 'post'], '/mailgroups/create', 'Mailgroups::edit/0');
|
||||||
|
$routes->match(['get', 'post'], '/mailgroups/edit/(:any)', 'Mailgroups::edit/$1');
|
||||||
|
|
||||||
|
//BUGS Comment
|
||||||
|
$routes->match(['get', 'post'], '/bugcomment/edit/(:any)', 'BugComment::edit/$1');
|
||||||
|
$routes->get('/bugcomment/delete/(:num)/(:num)', 'BugComment::delete/$1/$2');
|
||||||
|
|
||||||
|
//invcounters
|
||||||
|
$routes->get('/invcounters', 'InvCounters::index');
|
||||||
|
$routes->match(['get', 'post'], '/invcounters/create', 'InvCounters::edit/0');
|
||||||
|
$routes->match(['get', 'post'], '/invcounters/edit/(:any)', 'InvCounters::edit/$1');
|
||||||
|
|
||||||
|
//invtransactions
|
||||||
|
$routes->match(['get','post'],'/invtrans', 'Activities::invtrans_index');
|
||||||
|
$routes->match(['get','post'],'/invtrans/view/itd/(:any)', 'InvTrans::view_itd/$1');
|
||||||
|
$routes->match(['get','post'],'/invtrans/view/act/(:any)', 'InvTrans::view_act/$1');
|
||||||
|
$routes->match(['get','post'],'/invtrans/create', 'InvTrans::edit/0');
|
||||||
|
$routes->match(['get','post'],'/invtrans/edit/(:any)', 'InvTrans::edit/$1');
|
||||||
|
$routes->match(['get','post'],'/invtrans/user/(:any)', 'InvTrans::index_user/$1');
|
||||||
|
$routes->match(['get','post'],'/invtrans/reportusage/', 'InvTrans::reportusage/$1');
|
||||||
|
/*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
* Additional Routing
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* There will often be times that you need additional routing and you
|
||||||
|
* need it to be able to override any defaults in this file. Environment
|
||||||
|
* based routes is one such time. require() additional route files here
|
||||||
|
* to make that happen.
|
||||||
|
*
|
||||||
|
* You will have access to the $routes object within that file without
|
||||||
|
* needing to reload it.
|
||||||
|
*/
|
||||||
|
if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
|
||||||
|
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
|
||||||
|
}
|
||||||
117
app/Config/Security.php
Normal file
117
app/Config/Security.php
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?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 $csrfProtection = 'cookie';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Token Randomization
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Randomize the CSRF Token for added security.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $tokenRandomize = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Token Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Token name for Cross Site Request Forgery protection.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $tokenName = 'csrf_test_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Header Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Header name for Cross Site Request Forgery protection.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $headerName = 'X-CSRF-TOKEN';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Cookie Name
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Cookie name for Cross Site Request Forgery protection.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $cookieName = 'csrf_cookie_name';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Expires
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Expiration time for Cross Site Request Forgery protection cookie.
|
||||||
|
*
|
||||||
|
* Defaults to two hours (in seconds).
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $expires = 7200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Regenerate
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Regenerate CSRF Token on every submission.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $regenerate = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF Redirect
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Redirect to previous page with error on failure.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $redirect = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* CSRF SameSite
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Setting for CSRF SameSite cookie token.
|
||||||
|
*
|
||||||
|
* Allowed values are: None - Lax - Strict - ''.
|
||||||
|
*
|
||||||
|
* Defaults to `Lax` as recommended in this link:
|
||||||
|
*
|
||||||
|
* @see https://portswigger.net/web-security/csrf/samesite-cookies
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @deprecated `Config\Cookie` $samesite property is used.
|
||||||
|
*/
|
||||||
|
public $samesite = 'Lax';
|
||||||
|
}
|
||||||
32
app/Config/Services.php
Normal file
32
app/Config/Services.php
Normal 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();
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
}
|
||||||
99
app/Config/Toolbar.php
Normal file
99
app/Config/Toolbar.php
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
<?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 string[]
|
||||||
|
*/
|
||||||
|
public $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 colleted. Usefull to
|
||||||
|
* avoid high memory usage when there are lots of data passed to the view.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $maxHistory = 20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* Toolbar Views Path
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* The full path to the the views that are used by the toolbar.
|
||||||
|
* This MUST have a trailing slash.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $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.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $maxQueries = 100;
|
||||||
|
}
|
||||||
252
app/Config/UserAgents.php
Normal file
252
app/Config/UserAgents.php
Normal 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 $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 $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 $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 $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',
|
||||||
|
];
|
||||||
|
}
|
||||||
59
app/Config/Validation.php
Normal file
59
app/Config/Validation.php
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\BaseConfig;
|
||||||
|
use CodeIgniter\Validation\CreditCardRules;
|
||||||
|
use CodeIgniter\Validation\FileRules;
|
||||||
|
use CodeIgniter\Validation\FormatRules;
|
||||||
|
use CodeIgniter\Validation\Rules;
|
||||||
|
|
||||||
|
//use Validation\CustomValidation;
|
||||||
|
|
||||||
|
class Validation extends BaseConfig
|
||||||
|
{
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// Setup
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the classes that contain the
|
||||||
|
* rules that are available.
|
||||||
|
*
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
public $ruleSets = [
|
||||||
|
Rules::class,
|
||||||
|
FormatRules::class,
|
||||||
|
FileRules::class,
|
||||||
|
CreditCardRules::class,
|
||||||
|
CustomValidation::class
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the views that are used to display the
|
||||||
|
* errors.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
public $templates = [
|
||||||
|
'list' => 'CodeIgniter\Validation\Views\list',
|
||||||
|
'single' => 'CodeIgniter\Validation\Views\single',
|
||||||
|
];
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// Rules
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
public function validateLogin(string $str, string $fields, array $data){
|
||||||
|
$email = $data['email'];
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT userid, password FROM users WHERE email_1='$email'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$user = $query->getRow();
|
||||||
|
|
||||||
|
if(!$user) return false;
|
||||||
|
|
||||||
|
return password_verify($data['password'], $user->password );
|
||||||
|
}
|
||||||
|
}
|
||||||
56
app/Config/View.php
Normal file
56
app/Config/View.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Config;
|
||||||
|
|
||||||
|
use CodeIgniter\Config\View as BaseView;
|
||||||
|
use CodeIgniter\View\ViewDecoratorInterface;
|
||||||
|
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
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 class-string<ViewDecoratorInterface>[]
|
||||||
|
*/
|
||||||
|
public array $decorators = [];
|
||||||
|
}
|
||||||
176
app/Controllers/Accounts.php
Normal file
176
app/Controllers/Accounts.php
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\AccountsModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class Accounts extends Controller {
|
||||||
|
|
||||||
|
protected $helper = ['form'];
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "select * from areas";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['areas'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
$accountname = strtolower($this->request->getVar('accountname'));
|
||||||
|
$data['accountname'] = $accountname;
|
||||||
|
|
||||||
|
$areaid = $this->request->getVar('areaid');
|
||||||
|
$data['areaid'] = $areaid;
|
||||||
|
|
||||||
|
$filterquery = '';
|
||||||
|
if($accountname != '') { $filterquery .= " and lower(a.accountname) like '%$accountname%' "; }
|
||||||
|
if($areaid != '') { $filterquery .= " and az.areaid='$areaid' "; }
|
||||||
|
|
||||||
|
$sql = "SELECT a.accountid, a.zoneid, a.accountname, a.initial, a1.`accountname` AS parentname, a.createdate, a.enddate, ar.`areaname`, ar.areaid
|
||||||
|
FROM accounts a
|
||||||
|
LEFT JOIN accounts a1 ON a1.`accountid`=a.`parentaccount`
|
||||||
|
LEFT JOIN areazone az ON az.`zoneid`=a.`zoneid`
|
||||||
|
LEFT JOIN areas ar ON ar.`areaid`=az.`areaid`
|
||||||
|
WHERE a.accountname is not null $filterquery
|
||||||
|
ORDER BY
|
||||||
|
CASE WHEN a.`parentaccount`=0 THEN a.`accountid`
|
||||||
|
ELSE a.`parentaccount` END,
|
||||||
|
COALESCE(a.`parentaccount`, '0'),
|
||||||
|
a.`accountname`";
|
||||||
|
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['accounts'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('accounts_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($accountid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT a.*, a1.accountname AS parentname, z.zonename, z2.zonename AS province
|
||||||
|
FROM accounts a
|
||||||
|
LEFT JOIN accounts a1 ON a1.accountid = a.parentaccount
|
||||||
|
LEFT JOIN zones z ON z.zoneid = a.zoneid
|
||||||
|
LEFT JOIN zones z2 ON z2.zoneid = z.parentzoneid
|
||||||
|
WHERE a.accountid='$accountid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['accounts'] = $results;
|
||||||
|
return view('accounts_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($accountid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
if($accountid != 0) {
|
||||||
|
$sql = "SELECT a.*, a1.`accountname` AS parentname
|
||||||
|
FROM accounts a
|
||||||
|
LEFT JOIN accounts a1 ON a1.`accountid`=a.`parentaccount`
|
||||||
|
WHERE a.accountid='$accountid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['accounts'] = $results;
|
||||||
|
|
||||||
|
// query province / parentzone
|
||||||
|
$zoneid = $results[0]['zoneid'];
|
||||||
|
|
||||||
|
if($zoneid != '' || $zoneid != 0) {
|
||||||
|
$sql = "select parentzoneid from zones where zoneid='$zoneid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
if(isset($results[0])) { $data['parentzoneid'] = $results[0]['parentzoneid']; }
|
||||||
|
else { $data['parentzoneid'] = ''; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($zoneid)) {
|
||||||
|
$sql = "SELECT * from zones where zoneclass in ('KOTA','KAB')";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['zones'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT * from zones where parentzoneid is null";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['parentzones'] = $results;
|
||||||
|
|
||||||
|
$sql = "SELECT accountid, accountname FROM accounts WHERE parentaccount='0' and accountid<>'$accountid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['parentaccounts'] = $results;
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'accountid' => 'required',
|
||||||
|
'accountname' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'accountid' => $this->request->getVar('accountid'),
|
||||||
|
'accountname' => $this->request->getVar('accountname'),
|
||||||
|
'parentaccount' => $this->request->getVar('parentaccount'),
|
||||||
|
'accountnpwp' => $this->request->getVar('accountnpwp'),
|
||||||
|
'initial' => $this->request->getVar('initial'),
|
||||||
|
'street_1' => $this->request->getVar('street_1'),
|
||||||
|
'street_2' => $this->request->getVar('street_2'),
|
||||||
|
'street_3' => $this->request->getVar('street_3'),
|
||||||
|
'zoneid' => $this->request->getVar('zoneid'),
|
||||||
|
'zip' => $this->request->getVar('zip'),
|
||||||
|
'country' => $this->request->getVar('country'),
|
||||||
|
'email_1' => $this->request->getVar('email_1'),
|
||||||
|
'email_2' => $this->request->getVar('email_2'),
|
||||||
|
'phone' => $this->request->getVar('phone'),
|
||||||
|
'fax' => $this->request->getVar('fax')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
if($accountid != 0 ) {
|
||||||
|
$accountsModel = new AccountsModel();
|
||||||
|
$accountsModel->update($accountid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$accountsModel = new AccountsModel();
|
||||||
|
$accountsModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$accountsModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('accounts_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['accountid']= $accountid;
|
||||||
|
return view('accounts_editor', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getcity($provinceid=null){
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * from zones where parentzoneid='$provinceid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$datas = "<option value=''>-</option>";
|
||||||
|
foreach ($results as $data) {
|
||||||
|
$qzoneid = $data['zoneid'];
|
||||||
|
$qzonename = $data['zonename'];
|
||||||
|
$datas .= "<option value='$qzoneid'>$qzonename</option>";
|
||||||
|
}
|
||||||
|
//return view('activities_getproduct', $datas);
|
||||||
|
return $datas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($accountid = 0) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "update accounts set enddate=
|
||||||
|
case when enddate is not null then null
|
||||||
|
else NOW()
|
||||||
|
end
|
||||||
|
where accountid='$accountid'";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
91
app/Controllers/ActText.php
Normal file
91
app/Controllers/ActText.php
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ActTextModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class ActText extends Controller {
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM acttext order by enddate, createdate";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['acttext'] = $results;
|
||||||
|
return view('acttext_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($acttextid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "select * from acttext where acttextid='$acttextid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['acttext'] = $results;
|
||||||
|
$sql = "select * from acttype";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['acttype'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'acttextid' => 'required',
|
||||||
|
'acttextcode' => 'required',
|
||||||
|
'fulltext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'acttextid' => $this->request->getVar('acttextid'),
|
||||||
|
'acttextcode' => $this->request->getVar('acttextcode'),
|
||||||
|
'fulltext' => $this->request->getVar('fulltext')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$actTextModel = new ActTextModel();
|
||||||
|
$actTextModel->update($acttextid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('acttext_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('acttext_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
$sql = "select * from acttype";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['acttype'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'acttextcode' => 'required',
|
||||||
|
'fulltext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'acttextcode' => $this->request->getVar('acttextcode'),
|
||||||
|
'fulltext' => $this->request->getVar('fulltext')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$actTextModel = new ActTextModel();
|
||||||
|
$actTextModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$actTextModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('acttext_create',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('acttext_create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($acttextid = 0) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "update acttext set enddate=
|
||||||
|
case when enddate is not null then null
|
||||||
|
else NOW()
|
||||||
|
end
|
||||||
|
where acttextid='$acttextid'";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
}
|
||||||
72
app/Controllers/ActType.php
Normal file
72
app/Controllers/ActType.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ActTypeModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class ActType extends Controller {
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM acttype";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['acttype'] = $results;
|
||||||
|
return view('acttype_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($acttypeid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "select * from acttype where acttypeid='$acttypeid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['acttype'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'acttypeid' => 'required',
|
||||||
|
'acttypecode' => 'required',
|
||||||
|
'fulltext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'acttypeid' => $this->request->getVar('acttypeid'),
|
||||||
|
'acttypecode' => $this->request->getVar('acttypecode'),
|
||||||
|
'fulltext' => $this->request->getVar('fulltext')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$actTypeModel = new ActTypeModel();
|
||||||
|
$actTypeModel->update($acttypeid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('acttype_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('acttype_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'acttypecode' => 'required',
|
||||||
|
'fulltext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'acttypecode' => $this->request->getVar('acttypecode'),
|
||||||
|
'fulltext' => $this->request->getVar('fulltext')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$actTypeModel = new ActTypeModel();
|
||||||
|
$actTypeModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$actTypeModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('acttype_create',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('acttype_create', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
1042
app/Controllers/Activities.php
Normal file
1042
app/Controllers/Activities.php
Normal file
File diff suppressed because it is too large
Load Diff
125
app/Controllers/Areas.php
Normal file
125
app/Controllers/Areas.php
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\AreasModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class Areas extends BaseController {
|
||||||
|
|
||||||
|
protected $data = array();
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->data['zoneclass'] = array('PROP'=>'Province', 'KAB'=> 'Kabupaten', 'KOTA' => 'Kota');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM areas";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['areas'] = $results;
|
||||||
|
return view('areas_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($areaid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
if($areaid!= 0) {
|
||||||
|
$sql = "SELECT * from areas where areaid='$areaid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['areas'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'areatype' => 'required',
|
||||||
|
'areaname' => 'required',
|
||||||
|
'description' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'areatype' => $this->request->getVar('areatype'),
|
||||||
|
'areaname' => $this->request->getVar('areaname'),
|
||||||
|
'description' => $this->request->getVar('description')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
if($areaid!= 0 ) {
|
||||||
|
$areasModel = new AreasModel();
|
||||||
|
$areasModel->update($areaid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$areasModel = new AreasModel();
|
||||||
|
//$areasModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$areasModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('areas_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('areas_editor', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function areazone_edit($areaid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM areas WHERE areaid='$areaid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['areas'] = $results;
|
||||||
|
$sql = "SELECT az.areazoneid, az.zoneid, z.zonename FROM areazone az
|
||||||
|
left join zones z on z.zoneid=az.zoneid
|
||||||
|
WHERE az.areaid='$areaid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['areazone'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'areaid' => 'required',
|
||||||
|
'zoneid' => 'required'
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$areaid = $this->request->getVar('areaid');
|
||||||
|
$zoneid = $this->request->getVar('zoneid');
|
||||||
|
$areazoneid_delete = $this->request->getVar('areazoneid_delete');
|
||||||
|
if($areazoneid_delete!='') {
|
||||||
|
$areazoneid_delete = explode(' ',$areazoneid_delete);
|
||||||
|
foreach( $areazoneid_delete as $areazoneid ) {
|
||||||
|
if($areazoneid != 0) {
|
||||||
|
//$sql = "update sitecontact set enddate=now() where sitecontactid='$sitecontactid'";
|
||||||
|
$sql = "delete from areazone where areazoneid='$areazoneid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach($zoneid as $i => $qzoneid) {
|
||||||
|
if($qzoneid <> '') {
|
||||||
|
// insert query
|
||||||
|
$sql = "insert into areazone(areaid, zoneid)
|
||||||
|
VALUES ('$areaid', '$qzoneid')
|
||||||
|
on duplicate key update areaid='$areaid'";
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('areazone_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('areazone_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function areazone_newrow() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT zoneid, zonename FROM zones where zoneclass in ('KOTA','KAB')";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['zones'] = $results;
|
||||||
|
return view('areazone_newrow', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
98
app/Controllers/Auth.php
Normal file
98
app/Controllers/Auth.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controllers;
|
||||||
|
use CodeIgniter\Cookie\Cookie;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
|
helper('cookie');
|
||||||
|
class Auth extends BaseController {
|
||||||
|
|
||||||
|
public function login() {
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$data['email'] = $this->request->getVar('email');
|
||||||
|
$data['password'] = $this->request->getVar('password');
|
||||||
|
$data['rememberme'] = $this->request->getVar('rememberme');
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT firstname, lastname, userid, initial, userposid, level FROM users WHERE email_1='".$data['email']."'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$row = $query->getRow();
|
||||||
|
if(isset($row)) {
|
||||||
|
$userid = $row->userid;
|
||||||
|
$initial = $row->initial;
|
||||||
|
$level = $row->level;
|
||||||
|
$firstname = $row->firstname;
|
||||||
|
$userposid = $row->userposid;
|
||||||
|
$sessiondata = [
|
||||||
|
'email' => $data['email'],
|
||||||
|
'userid' => $userid,
|
||||||
|
'userposid' => $userposid,
|
||||||
|
'initial' => $initial,
|
||||||
|
'level' => $level,
|
||||||
|
'firstname' => $firstname,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'email' => 'required|valid_email',
|
||||||
|
'password' => 'required|validateLogin[email, password]'
|
||||||
|
];
|
||||||
|
$errors = [
|
||||||
|
'password' => [
|
||||||
|
'validateLogin' => 'Wrong password'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
if($this->validate($rules,$errors)){
|
||||||
|
session()->set( $sessiondata );
|
||||||
|
if( isset($data['rememberme']) ) {
|
||||||
|
$time = 30*24*60*60;// 30days
|
||||||
|
set_cookie ("email", $data['email'], $time);
|
||||||
|
set_cookie ("password", $data['password'], $time);
|
||||||
|
set_cookie ("rememberme", $data['rememberme'], $time);
|
||||||
|
//echo "cookie set";
|
||||||
|
} else {
|
||||||
|
delete_cookie ("email");
|
||||||
|
delete_cookie ("password");
|
||||||
|
delete_cookie ("rememberme");
|
||||||
|
}
|
||||||
|
return redirect()->to('/');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('auth_login',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['email'] = get_cookie('email');
|
||||||
|
$data['password'] = get_cookie('password');
|
||||||
|
$data['rememberme'] = get_cookie('rememberme');
|
||||||
|
return view('auth_login',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logout() {
|
||||||
|
session()->destroy();
|
||||||
|
return redirect()->to('/auth/login');;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPass() {
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$data['email'] = $this->request->getVar('email');
|
||||||
|
$data['password'] = $this->request->getVar('password');
|
||||||
|
$data['passwordconf'] = $this->request->getVar('passwordconf');
|
||||||
|
$rules = [
|
||||||
|
'email' => 'required|valid_email',
|
||||||
|
'password' => 'required',
|
||||||
|
'passwordconf' => 'required|matches[password]'
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$email = $data['email'];
|
||||||
|
$password = password_hash($data['password'],PASSWORD_DEFAULT);
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "update users set password='$password' where email_1='$email'";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
} else {
|
||||||
|
return view('auth_setPass',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('auth_setPass');
|
||||||
|
}
|
||||||
|
}
|
||||||
52
app/Controllers/BaseController.php
Normal file
52
app/Controllers/BaseController.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?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 = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
53
app/Controllers/BugComment.php
Normal file
53
app/Controllers/BugComment.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
// Ambil 3 Tabel BUGS, BUGS_COMMENT, USERS
|
||||||
|
use App\Models\BugsModel;
|
||||||
|
use App\Models\UsersModel;
|
||||||
|
use App\Models\BugCommentModel;
|
||||||
|
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class BugComment extends Controller {
|
||||||
|
|
||||||
|
public function delete($bugcommentid = null, $bugid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "DELETE FROM bugcomment where bugcommentid='$bugcommentid'";
|
||||||
|
if($db->query($sql)) {
|
||||||
|
return redirect()->to('/bugs/view/'.$bugid);
|
||||||
|
} else {
|
||||||
|
return view('form_fail');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($bugcommentid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM bugcomment where bugcommentid='$bugcommentid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['bugcomment'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'bugcommenttext' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'bugid' => $this->request->getVar('bugid'),
|
||||||
|
'bugcommenttext' => $this->request->getVar('bugcommenttext'),
|
||||||
|
'userid' => $this->request->getVar('userid'),
|
||||||
|
];
|
||||||
|
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$bugCommentModel = new BugCommentModel();
|
||||||
|
$bugCommentModel->set('logdate', 'NOW()', FALSE);
|
||||||
|
$bugCommentModel->update($bugcommentid, $data['new_value']);
|
||||||
|
return redirect()->to('/bugs/view/'.$this->request->getVar('bugid'));
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('bugcomment_edit', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('bugcomment_edit', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
319
app/Controllers/Bugs.php
Normal file
319
app/Controllers/Bugs.php
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
// Ambil 3 Tabel BUGS, BUGS_COMMENT, USERS
|
||||||
|
use App\Models\BugsModel;
|
||||||
|
use App\Models\UsersModel;
|
||||||
|
use App\Models\BugCommentModel;
|
||||||
|
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class Bugs extends Controller {
|
||||||
|
|
||||||
|
protected array $data;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->data['bugpriorities'] = array('0'=>'Low', '1'=> 'Medium', '2' => 'High');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Melihat dan membuat Thread Bugs
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT b.bugid, b.bugtitle, b.bugstatus, b.reportdate, b.bugpriority,
|
||||||
|
u.firstname AS creator_firstname, u.lastname AS creator_lastname,
|
||||||
|
(SELECT MAX(logdate) FROM bugcomment WHERE bugid=b.bugid) as buglastcommentdate,
|
||||||
|
(select count(*) from bugcomment where bugid=b.bugid ) as bugcommentcount
|
||||||
|
FROM bugs b
|
||||||
|
LEFT JOIN users u ON b.userid_creator = u.userid
|
||||||
|
ORDER BY CASE
|
||||||
|
WHEN b.bugstatus='O' THEN 1
|
||||||
|
WHEN b.bugstatus='P' THEN 2
|
||||||
|
WHEN b.bugstatus='S' THEN 3
|
||||||
|
WHEN b.bugstatus='A' THEN 4
|
||||||
|
WHEN b.bugstatus='C' THEN 5
|
||||||
|
ELSE 6 END,
|
||||||
|
b.bugpriority DESC, b.reportdate ASC, b.closedate DESC";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['bugs'] = $results;
|
||||||
|
$data['bugpriorities'] = $this->data['bugpriorities'];
|
||||||
|
return view('bugs_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($bugid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM bugs WHERE bugid='$bugid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['bugs'] = $results;
|
||||||
|
$data['bugpriorities'] = $this->data['bugpriorities'];
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'bugtitle' => 'required',
|
||||||
|
'bugdetail' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'bugtitle' => $this->request->getVar('bugtitle'),
|
||||||
|
'bugdetail' => $this->request->getVar('bugdetail'),
|
||||||
|
'bugstatus' => $this->request->getVar('bugstatus'),
|
||||||
|
'bugpriority' => $this->request->getVar('bugpriority'),
|
||||||
|
];
|
||||||
|
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$bugsModel = new BugsModel();
|
||||||
|
$bugsModel->update($bugid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('bugs_edit', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('bugs_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fungsi Membuat Thread Bugs Baru pada Jendela Baru
|
||||||
|
public function create() {
|
||||||
|
$data['bugpriorities'] = $this->data['bugpriorities'];
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'bugtitle' => 'required',
|
||||||
|
'bugdetail' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'bugtitle' => $this->request->getVar('bugtitle'),
|
||||||
|
'bugdetail' => $this->request->getVar('bugdetail'),
|
||||||
|
'bugstatus' => $this->request->getVar('bugstatus'),
|
||||||
|
'bugpriority' => $this->request->getVar('bugpriority'),
|
||||||
|
'userid_creator' => $this->request->getVar('userid_creator'),
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$bugsModel = new BugsModel();
|
||||||
|
$bugsModel->set('reportdate', 'NOW()', FALSE);
|
||||||
|
$bugsModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('bugs_create', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('bugs_create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fungsi Untuk melihat Thread Bugs dan Melihat/Memberi Komentar pada suatu Threads
|
||||||
|
public function view($bugid = null) {
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
//Connect Data base
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
// Get BUGS
|
||||||
|
$sql = "SELECT b.*, u.firstname, u.lastname, u.userid
|
||||||
|
FROM bugs b
|
||||||
|
JOIN users u
|
||||||
|
ON b.userid_creator = u.userid
|
||||||
|
WHERE bugid=$bugid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['bugs'] = $results;
|
||||||
|
|
||||||
|
// Get Comments BUGS
|
||||||
|
$sql = "SELECT bc.*, u.firstname, u.lastname, u.userid
|
||||||
|
FROM bugcomment bc
|
||||||
|
JOIN users u
|
||||||
|
ON bc.userid = u.userid
|
||||||
|
WHERE bc.bugid=$bugid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['bugcomment'] = $results;
|
||||||
|
|
||||||
|
// Button send Comment
|
||||||
|
if( isset($_POST['send_comment']) ) {
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'bugcommenttext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'bugcommenttext' => $this->request->getVar('bugcommenttext'),
|
||||||
|
'bugid' => $this->request->getVar('bugid'),
|
||||||
|
'userid' => $this->request->getVar('userid'),
|
||||||
|
];
|
||||||
|
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$bugCommentModel = new BugCommentModel();
|
||||||
|
$bugCommentModel->set('logdate', 'NOW()', FALSE);
|
||||||
|
$bugCommentModel->insert($data['new_value']);
|
||||||
|
return redirect()->to('/bugs/view/'.$bugid);
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('bugs_view',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Button send Comment and mark as done
|
||||||
|
} else if ( isset($_POST['send_comment_and_done']) ) {
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'bugcommenttext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'bugcommenttext' => $this->request->getVar('bugcommenttext'),
|
||||||
|
'bugid' => $this->request->getVar('bugid'),
|
||||||
|
'userid' => $this->request->getVar('userid'),
|
||||||
|
];
|
||||||
|
|
||||||
|
if($this->validate($rules)){
|
||||||
|
|
||||||
|
// Bugs Comment Insert
|
||||||
|
$bugCommentModel = new BugCommentModel();
|
||||||
|
$bugCommentModel->set('logdate', 'NOW()', FALSE);
|
||||||
|
$bugCommentModel->insert($data['new_value']);
|
||||||
|
|
||||||
|
// Bugs Update
|
||||||
|
$bugsModel = new BugsModel();
|
||||||
|
$bugsModel->set('bugstatus', 'C');
|
||||||
|
$bugsModel->set('userid_closer', $_SESSION['userid']);
|
||||||
|
$bugsModel->set('closedate', 'NOW()', FALSE);
|
||||||
|
$bugsModel->where('bugid', $bugid);
|
||||||
|
$bugsModel->update();
|
||||||
|
|
||||||
|
echo "<script>window.close();</script>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('bugs_view',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('bugs_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fungsi Untuk Delete Pada BUGS
|
||||||
|
// public function delete($bugid = 0) {
|
||||||
|
|
||||||
|
// $db = \Config\Database::connect();
|
||||||
|
// $sql = "DELETE FROM bugs
|
||||||
|
// WHERE bugid = '$bugid'";
|
||||||
|
// if($db->query($sql)) {
|
||||||
|
// return view('form_success');
|
||||||
|
// // return redirect()->to('/bugs');
|
||||||
|
// } else {
|
||||||
|
// return view('form_fail');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Fungsi Untuk Mark As Done Pada BUGS
|
||||||
|
public function toggle_close($bugid = 0) {
|
||||||
|
|
||||||
|
$userid = $_SESSION['userid'];
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "UPDATE bugs SET
|
||||||
|
bugstatus = 'C',
|
||||||
|
userid_closer = '$userid',
|
||||||
|
closedate = NOW()
|
||||||
|
WHERE bugid = '$bugid'";
|
||||||
|
if($db->query($sql)) {
|
||||||
|
return view('form_success');
|
||||||
|
// return redirect()->to('/bugs');
|
||||||
|
} else {
|
||||||
|
return view('form_fail');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle_pending($bugid = 0) {
|
||||||
|
|
||||||
|
$userid = $_SESSION['userid'];
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "UPDATE bugs SET
|
||||||
|
bugstatus = 'P'
|
||||||
|
WHERE bugid = '$bugid'";
|
||||||
|
if($db->query($sql)) {
|
||||||
|
return view('form_success');
|
||||||
|
// return redirect()->to('/bugs');
|
||||||
|
} else {
|
||||||
|
return view('form_fail');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle_reopen($bugid = 0) {
|
||||||
|
|
||||||
|
$userid = $_SESSION['userid'];
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "UPDATE bugs SET
|
||||||
|
bugstatus = 'O',
|
||||||
|
userid_closer = NULL,
|
||||||
|
closedate = NULL
|
||||||
|
WHERE bugid = '$bugid'";
|
||||||
|
if($db->query($sql)) {
|
||||||
|
return view('form_success');
|
||||||
|
// return redirect()->to('/bugs');
|
||||||
|
} else {
|
||||||
|
return view('form_fail');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle_suspend($bugid = 0) {
|
||||||
|
|
||||||
|
$userid = $_SESSION['userid'];
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "UPDATE bugs SET
|
||||||
|
bugstatus = 'S'
|
||||||
|
WHERE bugid = '$bugid'";
|
||||||
|
if($db->query($sql)) {
|
||||||
|
return view('form_success');
|
||||||
|
// return redirect()->to('/bugs');
|
||||||
|
} else {
|
||||||
|
return view('form_fail');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle_archive($bugid = 0) {
|
||||||
|
|
||||||
|
$userid = $_SESSION['userid'];
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "UPDATE bugs SET
|
||||||
|
bugstatus = 'A',
|
||||||
|
userid_closer = NULL,
|
||||||
|
closedate = NULL
|
||||||
|
WHERE bugid = '$bugid'";
|
||||||
|
if($db->query($sql)) {
|
||||||
|
return view('form_success');
|
||||||
|
// return redirect()->to('/bugs');
|
||||||
|
} else {
|
||||||
|
return view('form_fail');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function count(){
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$startdate = $this->request->getPost('startdate');
|
||||||
|
$enddate = $this->request->getPost('enddate');
|
||||||
|
$sql = "select u.`userid`, u.firstname, u.lastname,
|
||||||
|
(select count(bugid) from bugs where userid_creator=u.userid and reportdate between '$startdate 00:00' and '$enddate 23:59') as bugopen,
|
||||||
|
(SELECT COUNT(bugid) FROM bugs WHERE userid_creator=u.userid and bugstatus='C' AND reportdate between '$startdate 00:00' and '$enddate 23:59') as bugclose,
|
||||||
|
(SELECT COUNT(bugid) FROM bugs WHERE userid_closer=u.userid AND reportdate between '$startdate 00:00' and '$enddate 23:59') as bugcloser,
|
||||||
|
( SELECT COUNT(bugcommentid) FROM bugcomment bc
|
||||||
|
left join bugs b on bc.bugid=b.bugid and b.reportdate between '$startdate 00:00' and '$enddate 23:59'
|
||||||
|
WHERE bc.userid=u.userid )
|
||||||
|
as bugcomment
|
||||||
|
from users u";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['count'] = $results;
|
||||||
|
}
|
||||||
|
return view('bugs_count', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
79
app/Controllers/Contacts.php
Normal file
79
app/Controllers/Contacts.php
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ContactsModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class Contacts extends Controller {
|
||||||
|
|
||||||
|
protected $helper = ['form'];
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "select c.contactid, c.firstname, c.lastname, c.title, c.initial, c.createdate, c.email_1 from contacts c";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['contacts'] = $results;
|
||||||
|
return view('contacts_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($contactid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM contacts where contactid='$contactid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['contacts'] = $results;
|
||||||
|
return view('contacts_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($contactid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if($contactid != 0) {
|
||||||
|
$sql = "select * from contacts where contactid='$contactid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['contacts'] = $results;
|
||||||
|
}
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'contactid' => 'required',
|
||||||
|
'firstname' => 'required',
|
||||||
|
'email_1' => 'required',
|
||||||
|
'initial' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'firstname' => $this->request->getVar('firstname'),
|
||||||
|
'lastname' => $this->request->getVar('lastname'),
|
||||||
|
'title' => $this->request->getVar('title'),
|
||||||
|
'initial' => $this->request->getVar('initial'),
|
||||||
|
'birthdate' => ($this->request->getVar('birthdate') == '') ? NULL : $this->request->getVar('birthdate'),
|
||||||
|
'email_1' => $this->request->getVar('email_1'),
|
||||||
|
'email_2' => $this->request->getVar('email_2'),
|
||||||
|
'phone' => $this->request->getVar('phone'),
|
||||||
|
'mobile_1' => $this->request->getVar('mobile_1'),
|
||||||
|
'mobile_2' => $this->request->getVar('mobile_2')
|
||||||
|
];
|
||||||
|
|
||||||
|
if($this->validate($rules)){
|
||||||
|
if($contactid != 0) {
|
||||||
|
$contactsModel = new contactsModel();
|
||||||
|
$contactsModel->set('enddate', NULL);
|
||||||
|
$contactsModel->update($contactid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$contactsModel = new ContactsModel();
|
||||||
|
$contactsModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$contactsModel->set('enddate', NULL);
|
||||||
|
$contactsModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('contacts_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('contacts_editor', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
512
app/Controllers/Dashboard.php
Normal file
512
app/Controllers/Dashboard.php
Normal file
@ -0,0 +1,512 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
class Dashboard extends BaseController {
|
||||||
|
|
||||||
|
protected array $data;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->data['stats'] = array('O'=>'Open', 'A'=>'Accepted', 'P'=>'Pending', 'C'=> 'Close', 'S' => 'Suspend');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index ($userid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
if(!isset($userid) || $userid == 0) {
|
||||||
|
$userid = $_SESSION['userid'];
|
||||||
|
}
|
||||||
|
$data['userid'] = $userid;
|
||||||
|
|
||||||
|
$year = date('Y');
|
||||||
|
$month = date('n');
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM users";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['users'] = $results;
|
||||||
|
$data['stats'] = $this->data['stats'];
|
||||||
|
|
||||||
|
// act status counter - open, accept, pending all time - suspend and close this year
|
||||||
|
$sql = "SELECT
|
||||||
|
-- status counter
|
||||||
|
SUM(CASE WHEN a.activitystatus='O' AND a.userid_owner='$userid' THEN 1 ELSE 0 END) AS act_open,
|
||||||
|
SUM(CASE WHEN a.activitystatus='A' AND a.userid_owner='$userid' THEN 1 ELSE 0 END) AS act_accept,
|
||||||
|
SUM(CASE WHEN a.activitystatus='P' AND a.userid_owner='$userid' THEN 1 ELSE 0 END) AS act_pending,
|
||||||
|
SUM(CASE WHEN a.activitystatus='S' AND a.userid_owner='$userid' THEN 1 ELSE 0 END) AS act_suspend,
|
||||||
|
SUM(CASE WHEN a.activitystatus='C' AND a.userid_owner='$userid' AND YEAR(a.closedate)='$year' THEN 1 ELSE 0 END) AS act_close,
|
||||||
|
-- year type counter user
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='IR' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS ir_y,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='MN' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS mn_y,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='CR' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS cr_y,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='PR' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS pr_y,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='SP' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS sp_y,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='TR' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS tr_y,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='RF' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS rf_y,
|
||||||
|
-- year type counter all
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='IR' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS ir_ya,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='MN' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS mn_ya,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='CR' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS cr_ya,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='PR' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS pr_ya,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='SP' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS sp_ya,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='TR' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS tr_ya,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='RF' AND YEAR(a.`closedate`)='$year' THEN 1 ELSE 0 END) AS rf_ya,
|
||||||
|
-- month type counter user
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='IR' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS ir_m,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='MN' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS mn_m,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='CR' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS cr_m,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='PR' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS pr_m,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='SP' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS sp_m,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='TR' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS tr_m,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='RF' AND a.userid_owner='$userid' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS rf_m,
|
||||||
|
-- month type counter all
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='IR' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS ir_ma,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='MN' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS mn_ma,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='CR' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS cr_ma,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='PR' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS pr_ma,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='SP' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS sp_ma,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='TR' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS tr_ma,
|
||||||
|
SUM(CASE WHEN aty.`acttypecode`='RF' AND YEAR(a.`closedate`)='$year' AND MONTH(a.`closedate`)='$month' THEN 1 ELSE 0 END) AS rf_ma
|
||||||
|
FROM activities a
|
||||||
|
LEFT JOIN acttype aty ON aty.`acttypeid`=a.`acttypeid`";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['act_counter'] = $results;
|
||||||
|
|
||||||
|
$sql = "SELECT COUNT(userid) as nuser FROM users
|
||||||
|
WHERE enddate IS NULL
|
||||||
|
AND userposid = ( SELECT userposid FROM users WHERE userid='$userid' ) ";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['nuser'] = $results;
|
||||||
|
|
||||||
|
$sql = "select level from users where userid='$userid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$level = $results[0]['level'];
|
||||||
|
|
||||||
|
// Tanggal Kurun Waktu 1 Bulan
|
||||||
|
$lastday = cal_days_in_month(CAL_GREGORIAN,$month,$year);
|
||||||
|
$opendate = $year.'-'.($month).'-01';
|
||||||
|
$closedate = $year.'-'.$month.'-'.$lastday;
|
||||||
|
|
||||||
|
// Cari User Position
|
||||||
|
$sql = "SELECT userposid FROM users WHERE userid = '$userid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['user_position'] = $results[0]['userposid'];
|
||||||
|
$user_position = $data['user_position'];
|
||||||
|
|
||||||
|
// Tampilan Untuk Recent Activity semua User
|
||||||
|
$sql = "SELECT s.sitename, pc.productname, v.vendorname, u.firstname as username, u.userposid, uc.firstname as creator_name, at.fulltext, a.*
|
||||||
|
FROM `activities` a
|
||||||
|
left join sites s on s.siteid=a.siteid
|
||||||
|
left join products p on a.productid=p.productid
|
||||||
|
left join productcatalog pc on pc.catalogid=p.catalogid
|
||||||
|
left join vendors v on v.vendorid=a.vendorid
|
||||||
|
left join productalias pa on pa.productaliasid=pc.productaliasid
|
||||||
|
left join users u on u.userid=a.userid_owner
|
||||||
|
left JOIN (select userid, firstname from users) as uc on uc.userid=a.userid_creator
|
||||||
|
left join acttype at on at.acttypeid=a.acttypeid
|
||||||
|
where
|
||||||
|
(( a.closedate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
OR ( a.reportdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
OR ( a.activitystatus='O')
|
||||||
|
OR (a.activitystatus = 'P'))
|
||||||
|
AND (a.activitystatus <> 'S')
|
||||||
|
order by field(a.activitystatus,'O','C','R'), a.closedate desc, a.reportdate desc";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$result = $query->getResultArray();
|
||||||
|
$data['tampildata'] = $result;
|
||||||
|
|
||||||
|
// Menu Table TSS/TSM dan TSO
|
||||||
|
if(in_array($level,[1,2])) {
|
||||||
|
$firstdate = date("Y-m-01");
|
||||||
|
$lastdate = cal_days_in_month(CAL_GREGORIAN,date('m'),date('Y'));
|
||||||
|
$lastdate = date('Y-m-'.$lastdate);
|
||||||
|
|
||||||
|
$sql_pos = '';
|
||||||
|
if($user_position == '1') { $sql_pos = 'AND u.userposid in (1,2,3,4,5)'; }
|
||||||
|
elseif($user_position == '2') { $sql_pos = 'AND u.userposid in (2,4)'; }
|
||||||
|
elseif($user_position == '3') { $sql_pos = 'AND u.userposid in (3,5)'; }
|
||||||
|
|
||||||
|
$sql = "SELECT u.firstname, u.lastname, u.userdeptid, u.reportto, u.userid,
|
||||||
|
SUM(CASE WHEN aty.acttypecode='CR' THEN 1 ELSE 0 END) AS CR,
|
||||||
|
SUM(CASE WHEN aty.acttypecode='IR' THEN 1 ELSE 0 END) AS IR,
|
||||||
|
SUM(CASE WHEN aty.acttypecode='MN' THEN 1 ELSE 0 END) AS MN,
|
||||||
|
SUM(CASE WHEN aty.acttypecode='SP' THEN 1 ELSE 0 END) AS SP,
|
||||||
|
SUM(CASE WHEN aty.acttypecode='PR' THEN 1 ELSE 0 END) AS PR,
|
||||||
|
SUM(CASE WHEN aty.acttypecode='RF' THEN 1 ELSE 0 END) AS RF,
|
||||||
|
SUM(CASE WHEN aty.acttypecode='TR' THEN 1 ELSE 0 END) AS TR,
|
||||||
|
COUNT(a.actid) AS total
|
||||||
|
FROM users u
|
||||||
|
LEFT JOIN activities a ON u.userid = a.userid_owner AND a.closedate BETWEEN '$firstdate 00:00:00' AND '$lastdate 23:59:59'
|
||||||
|
LEFT JOIN acttype aty ON aty.acttypeid = a.acttypeid
|
||||||
|
WHERE u.userdeptid = 1 and ( u.enddate is null OR u.enddate < a.opendate )
|
||||||
|
$sql_pos
|
||||||
|
GROUP BY u.userid, u.firstname, u.lastname
|
||||||
|
ORDER BY u.userid ASC, total DESC, u.firstname";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['count'] = $results;
|
||||||
|
|
||||||
|
// MENU TSM & TSS
|
||||||
|
// Menu Table TOP 3 PART REPLACED
|
||||||
|
$sql = "SELECT pr.catalognumber, pr.productname, SUM( CAST(inv.qty as decimal(10,2))) as total_qty
|
||||||
|
FROM productcatalog pr
|
||||||
|
LEFT JOIN unitgroup ug ON ug.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN invtrans inv ON inv.unitgroupid=ug.unitgroupid
|
||||||
|
WHERE inv.purpose IN ('PR', 'PB', 'PU', 'PF') AND pr.productaliasid<>0
|
||||||
|
GROUP BY pr.catalognumber
|
||||||
|
ORDER BY total_qty DESC
|
||||||
|
LIMIT 3";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['most_part_replaced'] = $results;
|
||||||
|
|
||||||
|
// Menu Table SPARE PARTS REPLACEMENT THIS MONTH
|
||||||
|
// Menu TSO BARAT
|
||||||
|
$sql = "SELECT vn.vendorid, vn.vendorname, SUM( CAST(inv.qty as decimal(10,0))) as total_qty
|
||||||
|
FROM productcatalog pr
|
||||||
|
LEFT JOIN vendors vn ON vn.vendorid=pr.vendorid
|
||||||
|
LEFT JOIN unitgroup ug ON ug.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN invtrans inv ON inv.unitgroupid=ug.unitgroupid
|
||||||
|
LEFT JOIN activities act ON act.actid=inv.actid
|
||||||
|
LEFT JOIN sites st ON st.siteid=act.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE inv.purpose IN ('PR', 'PB', 'PU', 'PF') AND pr.productaliasid <> 0
|
||||||
|
AND ars.areaid IN (8)
|
||||||
|
AND (inv.itxdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
GROUP BY vn.vendorid
|
||||||
|
ORDER BY total_qty DESC;";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['replacement_barat'] = $results;
|
||||||
|
$vendorid_filtersql=''; // Untuk Filter Vendorid
|
||||||
|
foreach($data['replacement_barat'] as $row) { // Perulangan untuk menyimpan data vendor id ke string vendorid_filtersql
|
||||||
|
if($row['vendorid']==null){continue;}
|
||||||
|
$vendorid_filtersql .= $row['vendorid'];
|
||||||
|
$vendorid_filtersql .= ',';
|
||||||
|
}
|
||||||
|
$vendorid_filtersql = substr_replace($vendorid_filtersql, "", -1); // Untuk menghilangkan tanda koma pada bagian akhir
|
||||||
|
$vendorid_filtersql == "" ? "" : $vendorid_filtersql = sprintf("%s%s%s", "AND vn.vendorid IN (", $vendorid_filtersql, ")");
|
||||||
|
$sql = "SELECT vn.vendorid, COUNT(pr.siteid) as banyak_vendor
|
||||||
|
FROM vendors vn
|
||||||
|
LEFT JOIN productcatalog prct ON vn.vendorid=prct.vendorid
|
||||||
|
LEFT JOIN products pr ON prct.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN sites st ON pr.siteid=st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE ars.areaid IN (8) $vendorid_filtersql
|
||||||
|
GROUP BY vn.vendorid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['replacement_vendor_barat'] = $results;
|
||||||
|
// Menu TSO TENGAH
|
||||||
|
$sql = "SELECT vn.vendorid, vn.vendorname, SUM( CAST(inv.qty as decimal(10,0))) as total_qty
|
||||||
|
FROM productcatalog pr
|
||||||
|
LEFT JOIN vendors vn ON vn.vendorid=pr.vendorid
|
||||||
|
LEFT JOIN unitgroup ug ON ug.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN invtrans inv ON inv.unitgroupid=ug.unitgroupid
|
||||||
|
LEFT JOIN activities act ON act.actid=inv.actid
|
||||||
|
LEFT JOIN sites st ON st.siteid=act.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE inv.purpose IN ('PR', 'PB', 'PU', 'PF') AND pr.productaliasid <> 0
|
||||||
|
AND ars.areaid IN (9)
|
||||||
|
AND (inv.itxdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
GROUP BY vn.vendorid
|
||||||
|
ORDER BY total_qty DESC;";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['replacement_tengah'] = $results;
|
||||||
|
$vendorid_filtersql=''; // Untuk Filter Vendorid
|
||||||
|
foreach($data['replacement_tengah'] as $row) { // Perulangan untuk menyimpan data vendor id ke string vendorid_filtersql
|
||||||
|
if($row['vendorid']==null){continue;}
|
||||||
|
$vendorid_filtersql .= $row['vendorid'];
|
||||||
|
$vendorid_filtersql .= ',';
|
||||||
|
}
|
||||||
|
$vendorid_filtersql = substr_replace($vendorid_filtersql, "", -1); // Untuk menghilangkan tanda koma pada bagian akhir
|
||||||
|
$vendorid_filtersql == "" ? "" : $vendorid_filtersql = sprintf("%s%s%s", "AND vn.vendorid IN (", $vendorid_filtersql, ")");
|
||||||
|
$sql = "SELECT vn.vendorid, COUNT(pr.siteid) as banyak_vendor
|
||||||
|
FROM vendors vn
|
||||||
|
LEFT JOIN productcatalog prct ON vn.vendorid=prct.vendorid
|
||||||
|
LEFT JOIN products pr ON prct.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN sites st ON pr.siteid=st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE ars.areaid IN (9) $vendorid_filtersql
|
||||||
|
GROUP BY vn.vendorid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['replacement_vendor_tengah'] = $results;
|
||||||
|
// Menu TSO TIMUR
|
||||||
|
$sql = "SELECT vn.vendorid, vn.vendorname, SUM( CAST(inv.qty as decimal(10,0))) as total_qty
|
||||||
|
FROM productcatalog pr
|
||||||
|
LEFT JOIN vendors vn ON vn.vendorid=pr.vendorid
|
||||||
|
LEFT JOIN unitgroup ug ON ug.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN invtrans inv ON inv.unitgroupid=ug.unitgroupid
|
||||||
|
LEFT JOIN activities act ON act.actid=inv.actid
|
||||||
|
LEFT JOIN sites st ON st.siteid=act.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE inv.purpose IN ('PR', 'PB', 'PU', 'PF') AND pr.productaliasid <> 0
|
||||||
|
AND ars.areaid IN (10)
|
||||||
|
AND (inv.itxdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
GROUP BY vn.vendorid
|
||||||
|
ORDER BY total_qty DESC;";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['replacement_timur'] = $results;
|
||||||
|
$vendorid_filtersql=''; // Untuk Filter Vendorid
|
||||||
|
foreach($data['replacement_timur'] as $row) { // Perulangan untuk menyimpan data vendor id ke string vendorid_filtersql
|
||||||
|
if($row['vendorid']==null){continue;}
|
||||||
|
$vendorid_filtersql .= $row['vendorid'];
|
||||||
|
$vendorid_filtersql .= ',';
|
||||||
|
}
|
||||||
|
$vendorid_filtersql = substr_replace($vendorid_filtersql, "", -1); // Untuk menghilangkan tanda koma pada bagian akhir
|
||||||
|
$vendorid_filtersql == "" ? "" : $vendorid_filtersql = sprintf("%s%s%s", "AND vn.vendorid IN (", $vendorid_filtersql, ")");
|
||||||
|
$sql = "SELECT vn.vendorid, COUNT(pr.siteid) as banyak_vendor
|
||||||
|
FROM vendors vn
|
||||||
|
LEFT JOIN productcatalog prct ON vn.vendorid=prct.vendorid
|
||||||
|
LEFT JOIN products pr ON prct.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN sites st ON pr.siteid=st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE ars.areaid IN (10) $vendorid_filtersql
|
||||||
|
GROUP BY vn.vendorid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['replacement_vendor_timur'] = $results;
|
||||||
|
|
||||||
|
// ACTIVITIES BY PRINCIPLE - THIS MONTH
|
||||||
|
// TSO BARAT
|
||||||
|
$sql = "SELECT vn.vendorid, vn.vendorname, COUNT(vn.vendorid) as banyak_act
|
||||||
|
FROM activities act
|
||||||
|
LEFT JOIN sites st ON st.siteid=act.siteid
|
||||||
|
LEFT JOIN products pr ON pr.productid=act.productid
|
||||||
|
LEFT JOIN productcatalog prct ON prct.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN vendors vn ON vn.vendorid=prct.vendorid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE act.productid IS NOT NULL
|
||||||
|
AND ars.areaid IN (8)
|
||||||
|
AND (act.reportdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
AND ( act.opendate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
GROUP BY vn.vendorid
|
||||||
|
ORDER BY banyak_act DESC
|
||||||
|
LIMIT 5";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['act_principle_barat'] = $results;
|
||||||
|
$vendorid_filtersql=''; // Untuk Filter Vendorid
|
||||||
|
foreach($data['act_principle_barat'] as $row) { // Perulangan untuk menyimpan data vendor id ke string vendorid_filtersql
|
||||||
|
if($row['vendorid']==null){continue;}
|
||||||
|
$vendorid_filtersql .= $row['vendorid'];
|
||||||
|
$vendorid_filtersql .= ',';
|
||||||
|
}
|
||||||
|
$vendorid_filtersql = substr_replace($vendorid_filtersql, "", -1); // Untuk menghilangkan tanda koma pada bagian akhir
|
||||||
|
$vendorid_filtersql == "" ? "" : $vendorid_filtersql = sprintf("%s%s%s", "AND vn.vendorid IN (", $vendorid_filtersql, ")");
|
||||||
|
$sql = "SELECT vn.vendorid, COUNT(pr.siteid) as banyak_vendor
|
||||||
|
FROM vendors vn
|
||||||
|
LEFT JOIN productcatalog prct ON vn.vendorid=prct.vendorid
|
||||||
|
LEFT JOIN products pr ON prct.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN sites st ON pr.siteid=st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE ars.areaid IN (8) $vendorid_filtersql
|
||||||
|
GROUP BY vn.vendorid
|
||||||
|
LIMIT 5";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['act_vendor_barat'] = $results;
|
||||||
|
// TSO TENGAH
|
||||||
|
$sql = "SELECT vn.vendorid, vn.vendorname, COUNT(vn.vendorid) as banyak_act
|
||||||
|
FROM activities act
|
||||||
|
LEFT JOIN sites st ON st.siteid=act.siteid
|
||||||
|
LEFT JOIN products pr ON pr.productid=act.productid
|
||||||
|
LEFT JOIN productcatalog prct ON prct.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN vendors vn ON vn.vendorid=prct.vendorid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE act.productid IS NOT NULL
|
||||||
|
AND ars.areaid IN (9)
|
||||||
|
AND (act.reportdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
AND ( act.opendate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
GROUP BY vn.vendorid
|
||||||
|
ORDER BY banyak_act DESC
|
||||||
|
LIMIT 5";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['act_principle_tengah'] = $results;
|
||||||
|
$vendorid_filtersql=''; // Untuk Filter Vendorid
|
||||||
|
foreach($data['act_principle_tengah'] as $row) { // Perulangan untuk menyimpan data vendor id ke string vendorid_filtersql
|
||||||
|
if($row['vendorid']==null){continue;}
|
||||||
|
$vendorid_filtersql .= $row['vendorid'];
|
||||||
|
$vendorid_filtersql .= ',';
|
||||||
|
}
|
||||||
|
$vendorid_filtersql = substr_replace($vendorid_filtersql, "", -1); // Untuk menghilangkan tanda koma pada bagian akhir
|
||||||
|
$vendorid_filtersql == "" ? "" : $vendorid_filtersql = sprintf("%s%s%s", "AND vn.vendorid IN (", $vendorid_filtersql, ")");
|
||||||
|
$sql = "SELECT vn.vendorid, COUNT(pr.siteid) as banyak_vendor
|
||||||
|
FROM vendors vn
|
||||||
|
LEFT JOIN productcatalog prct ON vn.vendorid=prct.vendorid
|
||||||
|
LEFT JOIN products pr ON prct.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN sites st ON pr.siteid=st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE ars.areaid IN (9) $vendorid_filtersql
|
||||||
|
GROUP BY vn.vendorid
|
||||||
|
LIMIT 5";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['act_vendor_tengah'] = $results;
|
||||||
|
// TSO TIMUR
|
||||||
|
$sql = "SELECT vn.vendorid, vn.vendorname, COUNT(vn.vendorid) as banyak_act
|
||||||
|
FROM activities act
|
||||||
|
LEFT JOIN sites st ON st.siteid=act.siteid
|
||||||
|
LEFT JOIN products pr ON pr.productid=act.productid
|
||||||
|
LEFT JOIN productcatalog prct ON prct.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN vendors vn ON vn.vendorid=prct.vendorid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE act.productid IS NOT NULL
|
||||||
|
AND ars.areaid IN (10)
|
||||||
|
AND (act.reportdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
AND ( act.opendate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
GROUP BY vn.vendorid
|
||||||
|
ORDER BY banyak_act DESC
|
||||||
|
LIMIT 5";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['act_principle_timur'] = $results;
|
||||||
|
$vendorid_filtersql=''; // Untuk Filter Vendorid
|
||||||
|
foreach($data['act_principle_timur'] as $row) { // Perulangan untuk menyimpan data vendor id ke string vendorid_filtersql
|
||||||
|
if($row['vendorid']==null){continue;}
|
||||||
|
$vendorid_filtersql .= $row['vendorid'];
|
||||||
|
$vendorid_filtersql .= ',';
|
||||||
|
}
|
||||||
|
$vendorid_filtersql = substr_replace($vendorid_filtersql, "", -1); // Untuk menghilangkan tanda koma pada bagian akhir
|
||||||
|
$vendorid_filtersql == "" ? "" : $vendorid_filtersql = sprintf("%s%s%s", "AND vn.vendorid IN (", $vendorid_filtersql, ")");
|
||||||
|
$sql = "SELECT vn.vendorid, COUNT(pr.siteid) as banyak_vendor
|
||||||
|
FROM vendors vn
|
||||||
|
LEFT JOIN productcatalog prct ON vn.vendorid=prct.vendorid
|
||||||
|
LEFT JOIN products pr ON prct.catalogid=pr.catalogid
|
||||||
|
LEFT JOIN sites st ON pr.siteid=st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE ars.areaid IN (10) $vendorid_filtersql
|
||||||
|
GROUP BY vn.vendorid
|
||||||
|
LIMIT 5";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['act_vendor_timur'] = $results;
|
||||||
|
|
||||||
|
// TOP 3 SITES WITH INCIDENTS - THIS MONTH
|
||||||
|
// Menu Table TOP 3 SITES WITH INCIDENTS TSS IT
|
||||||
|
$sql = "SELECT act.siteid ,st.sitename, acty.fulltext, COUNT(act.siteid) AS total, ars.description
|
||||||
|
FROM activities act
|
||||||
|
LEFT JOIN users us on us.userid = act.userid_owner
|
||||||
|
LEFT JOIN acttype acty ON act.acttypeid = acty.acttypeid
|
||||||
|
LEFT JOIN sites st ON act.siteid = st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE act.acttypeid = 1 AND ars.areaid IN (8,9,10) AND us.userid IN (5,9,12,15,36)
|
||||||
|
AND (act.reportdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
AND ( act.opendate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
GROUP BY st.sitename
|
||||||
|
ORDER BY total DESC
|
||||||
|
LIMIT 3";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['incidents_site_tsoit'] = $results;
|
||||||
|
// Menu Table TOP 3 SITES WITH INCIDENTS TSS IVD BARAT
|
||||||
|
$sql = "SELECT act.siteid ,st.sitename, acty.fulltext, COUNT(act.siteid) AS total, ars.description
|
||||||
|
FROM activities act
|
||||||
|
LEFT JOIN users us on us.userid = act.userid_owner
|
||||||
|
LEFT JOIN acttype acty ON act.acttypeid = acty.acttypeid
|
||||||
|
LEFT JOIN sites st ON act.siteid = st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE act.acttypeid = 1 AND ars.areaid=8 AND us.userid IN (3,6,13,16,19,44,45)
|
||||||
|
AND (act.reportdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
AND ( act.opendate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
GROUP BY st.sitename
|
||||||
|
ORDER BY total DESC
|
||||||
|
LIMIT 3";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['incidents_site_tsobarat'] = $results;
|
||||||
|
// Menu Table TOP 3 SITES WITH INCIDENTS TSS IVD TENGAH
|
||||||
|
$sql = "SELECT act.siteid ,st.sitename, acty.fulltext, COUNT(act.siteid) AS total, ars.description
|
||||||
|
FROM activities act
|
||||||
|
LEFT JOIN users us on us.userid = act.userid_owner
|
||||||
|
LEFT JOIN acttype acty ON act.acttypeid = acty.acttypeid
|
||||||
|
LEFT JOIN sites st ON act.siteid = st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
AND (act.reportdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
AND ( act.opendate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
WHERE act.acttypeid = 1 AND ars.areaid=9 AND us.userid IN (10,11,18,20)
|
||||||
|
GROUP BY st.sitename
|
||||||
|
ORDER BY total DESC
|
||||||
|
LIMIT 3";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['incidents_site_tsotengah'] = $results;
|
||||||
|
// Menu Table TOP 3 SITES WITH INCIDENTS TSS IVD TIMUR
|
||||||
|
$sql = "SELECT act.siteid ,st.sitename, acty.fulltext, COUNT(act.siteid) AS total, ars.description
|
||||||
|
FROM activities act
|
||||||
|
LEFT JOIN users us on us.userid = act.userid_owner
|
||||||
|
LEFT JOIN acttype acty ON act.acttypeid = acty.acttypeid
|
||||||
|
LEFT JOIN sites st ON act.siteid = st.siteid
|
||||||
|
LEFT JOIN accounts acc ON st.accountid = acc.accountid
|
||||||
|
LEFT JOIN zones zs ON acc.zoneid = zs.zoneid
|
||||||
|
LEFT JOIN areazone ae ON zs.zoneid = ae.zoneid
|
||||||
|
LEFT JOIN areas ars ON ae.areaid = ars.areaid
|
||||||
|
WHERE act.acttypeid = 1 AND ars.areaid=10 AND us.userid IN (2,14,17,21,46,47)
|
||||||
|
AND (act.reportdate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
AND ( act.opendate between '$opendate 00:00:00' and '$closedate 23:59:59')
|
||||||
|
GROUP BY st.sitename
|
||||||
|
ORDER BY total DESC
|
||||||
|
LIMIT 3";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['incidents_site_tsotimur'] = $results;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('dashboard',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
64
app/Controllers/Emails.php
Normal file
64
app/Controllers/Emails.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class Emails extends Controller {
|
||||||
|
|
||||||
|
protected $helper = ['form'];
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "select emailid, email, enddate from emails";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['emails'] = $results;
|
||||||
|
return view('emails_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($emailid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if($emailid != 0) {
|
||||||
|
$sql = "select * from emails where emailid='$emailid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['emails'] = $results;
|
||||||
|
}
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'emailid' => 'required',
|
||||||
|
'email' => 'required'
|
||||||
|
];
|
||||||
|
$emailid = $this->request->getVar('emailid');
|
||||||
|
$email = $this->request->getVar('email');
|
||||||
|
if($this->validate($rules)){
|
||||||
|
if($emailid == 0) {
|
||||||
|
$sql = "insert into emails(email, enddate) values ('$email', null)";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
} else {
|
||||||
|
$sql = "update emails set email='$email' where emailid='$emailid'";
|
||||||
|
if($db->query($sql)) { return view('form_success', $data); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('emails_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('emails_editor', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($emailid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "update emails set enddate=
|
||||||
|
case when enddate is not null then null
|
||||||
|
else NOW()
|
||||||
|
end
|
||||||
|
where emailid='$emailid'";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
}
|
||||||
117
app/Controllers/Guidebook.php
Normal file
117
app/Controllers/Guidebook.php
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
use App\Models\GuidebookModel;
|
||||||
|
|
||||||
|
class Guidebook extends Controller {
|
||||||
|
|
||||||
|
protected array $data;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
// $this->data['bugpriorities'] = array('0'=>'Low', '1'=> 'Medium', '2' => 'High');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Melihat dan membuat Thread Bugs
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM guidebooks";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['guidebooks'] = $results;
|
||||||
|
|
||||||
|
return view('guidebook_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fungsi Membuat Thread Bugs Baru pada Jendela Baru
|
||||||
|
public function create() {
|
||||||
|
|
||||||
|
// $data['bugpriorities'] = $this->data['bugpriorities'];
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'guidetitle' => 'required',
|
||||||
|
'guidedetail' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'guidetitle' => $this->request->getVar('guidetitle'),
|
||||||
|
'guidedetail' => $this->request->getVar('guidedetail'),
|
||||||
|
// 'guidecategory' => $this->request->getVar('bugstatus'),
|
||||||
|
'userid_creator' => $this->request->getVar('userid_creator')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$guideModel = new GuidebookModel();
|
||||||
|
$guideModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$guideModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('guidebook_create', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('guidebook_create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($guideid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM guidebooks WHERE guideid='$guideid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['guidebooks'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'guidetitle' => 'required',
|
||||||
|
'guidedetail' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'guidetitle' => $this->request->getVar('guidetitle'),
|
||||||
|
'guidedetail' => $this->request->getVar('guidedetail'),
|
||||||
|
// 'guidecategory' => $this->request->getVar('bugstatus'),
|
||||||
|
];
|
||||||
|
|
||||||
|
if ( $this->validate($rules) ) {
|
||||||
|
$guideModel = new GuidebookModel();
|
||||||
|
$guideModel->update($guideid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('guidebook_edit', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('guidebook_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($guideid = null) {
|
||||||
|
|
||||||
|
//Connect Database
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT g.*, CONCAT(u.firstname, ' ', u.lastname) AS fullname FROM guidebooks g
|
||||||
|
LEFT JOIN users u ON u.userid=g.userid_creator
|
||||||
|
WHERE g.guideid=$guideid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['guidebook'] = $results;
|
||||||
|
|
||||||
|
// var_dump($data);die();
|
||||||
|
|
||||||
|
return view('guidebook_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($guideid = 0) {
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "DELETE FROM guidebooks
|
||||||
|
WHERE guideid = '$guideid'";
|
||||||
|
if($db->query($sql)) {
|
||||||
|
return view('form_success');
|
||||||
|
// return redirect()->to('/bugs');
|
||||||
|
} else {
|
||||||
|
return view('form_fail');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
57
app/Controllers/InvCounters.php
Normal file
57
app/Controllers/InvCounters.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\InvCountersModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class InvCounters extends BaseController {
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM invcounters";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['invcounters'] = $results;
|
||||||
|
return view('invcounters_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($counterid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data['counterid']= $counterid;
|
||||||
|
if($counterid != 0) {
|
||||||
|
$sql = "SELECT counternumber, countername FROM invcounters where counterid='$counterid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['invcounters'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'counternumber' => 'required',
|
||||||
|
'countername' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'counternumber' => $this->request->getVar('counternumber'),
|
||||||
|
'countername' => $this->request->getVar('countername')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
if($counterid != 0 ) {
|
||||||
|
$invcountersModel = new InvcountersModel();
|
||||||
|
$invcountersModel->update($counterid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$invcountersModel = new InvcountersModel();
|
||||||
|
$invcountersModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$invcountersModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('invcounters_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('invcounters_editor', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
286
app/Controllers/InvTrans.php
Normal file
286
app/Controllers/InvTrans.php
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\InvTransModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class InvTrans extends BaseController {
|
||||||
|
protected array $data;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->data['itx_apprtypes'] = array('W'=>'Warranty', 'U'=> 'User');
|
||||||
|
$this->data['itx_conditions'] = array('N'=>'New', 'U'=> 'Used', 'R'=>'Refurbished');
|
||||||
|
$this->data['itx_purposes'] = array(
|
||||||
|
'TB' => 'Retrieve - broken', 'TR' => 'Retrieve - repair', 'TU' => 'Retrieve - usage', 'TF' => 'Retrieve - FSCA',
|
||||||
|
'PR' => 'Replace - Repair', 'PB' => 'Replace - broken', 'PU' => 'Replace - usage', 'PF' => 'Replace - FSCA', 'B' => 'Borrow', 'R' => 'Return'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view_itd($itdid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql ="SELECT itd.itdid, itd.subject, c.`catalognumber`, c.productname, itx.qty, u.unit, itx.lotnumber,
|
||||||
|
#origin
|
||||||
|
CASE
|
||||||
|
WHEN origtype='C' THEN (SELECT CONCAT('Counter ',counternumber,' | ',countername) FROM invcounters WHERE counterid=itx.origid)
|
||||||
|
WHEN origtype='V' THEN (SELECT CONCAT('Vendor ',vendorname) FROM vendors WHERE vendorid=itx.origid)
|
||||||
|
WHEN origtype='P' THEN (
|
||||||
|
SELECT CONCAT(s.sitename, ' - ', c.productname, ' (', p.productnumber, ')' )
|
||||||
|
FROM products p
|
||||||
|
LEFT JOIN sites s ON p.siteid=s.siteid
|
||||||
|
LEFT JOIN productcatalog c ON c.catalogid=p.catalogid
|
||||||
|
WHERE p.productid=itx.origid
|
||||||
|
)
|
||||||
|
END AS origin,
|
||||||
|
#dest
|
||||||
|
CASE
|
||||||
|
WHEN desttype='C' THEN (SELECT CONCAT('Counter ',counternumber,' | ',countername) FROM invcounters WHERE counterid=itx.destid)
|
||||||
|
WHEN desttype='V' THEN (SELECT CONCAT('Vendor ',vendorname) FROM vendors WHERE vendorid=itx.destid)
|
||||||
|
WHEN desttype='P' THEN (
|
||||||
|
SELECT CONCAT(s.sitename, ' - ', c.productname, ' (', p.productnumber, ')' )
|
||||||
|
FROM products p
|
||||||
|
LEFT JOIN sites s ON p.siteid=s.siteid
|
||||||
|
LEFT JOIN productcatalog c ON c.catalogid=p.catalogid
|
||||||
|
WHERE p.productid=itx.destid
|
||||||
|
)
|
||||||
|
END AS dest
|
||||||
|
FROM invtrans itx
|
||||||
|
LEFT JOIN unitgroup u ON itx.`unitgroupid`=u.`unitgroupid`
|
||||||
|
LEFT JOIN productcatalog c ON c.`catalogid`=u.`catalogid`
|
||||||
|
LEFT JOIN invtransdata itd ON itd.itdid=itx.itdid
|
||||||
|
WHERE itd.itdid='$itdid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['invtrans'] = $results;
|
||||||
|
$data['itdid'] = $itdid;
|
||||||
|
$data['subject'] = $results[0]['subject'];
|
||||||
|
return view('invtrans_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view_act($actid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql ="SELECT a.actid, a.subject, c.`catalognumber`, c.productname, itx.qty, u.unit, itx.lotnumber,
|
||||||
|
#origin
|
||||||
|
CASE
|
||||||
|
WHEN origtype='C' THEN (SELECT CONCAT('Counter ',counternumber,' | ',countername) FROM invcounters WHERE counterid=itx.origid)
|
||||||
|
WHEN origtype='V' THEN (SELECT CONCAT('Vendor ',vendorname) FROM vendors WHERE vendorid=itx.origid)
|
||||||
|
WHEN origtype='P' THEN (
|
||||||
|
SELECT CONCAT(s.sitename, ' - ', c.productname, ' (', p.productnumber, ')' )
|
||||||
|
FROM products p
|
||||||
|
LEFT JOIN sites s ON p.siteid=s.siteid
|
||||||
|
LEFT JOIN productcatalog c ON c.catalogid=p.catalogid
|
||||||
|
WHERE p.productid=itx.origid
|
||||||
|
)
|
||||||
|
END AS origin,
|
||||||
|
#dest
|
||||||
|
CASE
|
||||||
|
WHEN desttype='C' THEN (SELECT CONCAT('Counter ',counternumber,' | ',countername) FROM invcounters WHERE counterid=itx.destid)
|
||||||
|
WHEN desttype='V' THEN (SELECT CONCAT('Vendor ',vendorname) FROM vendors WHERE vendorid=itx.destid)
|
||||||
|
WHEN desttype='P' THEN (
|
||||||
|
SELECT CONCAT(s.sitename, ' - ', c.productname, ' (', p.productnumber, ')' )
|
||||||
|
FROM products p
|
||||||
|
LEFT JOIN sites s ON p.siteid=s.siteid
|
||||||
|
LEFT JOIN productcatalog c ON c.catalogid=p.catalogid
|
||||||
|
WHERE p.productid=itx.destid
|
||||||
|
)
|
||||||
|
END AS dest
|
||||||
|
FROM invtrans itx
|
||||||
|
LEFT JOIN activities a ON itx.`actid`=a.actid
|
||||||
|
LEFT JOIN unitgroup u ON itx.`unitgroupid`=u.`unitgroupid`
|
||||||
|
LEFT JOIN productcatalog c ON c.`catalogid`=u.`catalogid`
|
||||||
|
WHERE a.actid='$actid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['invtrans'] = $results;
|
||||||
|
$data['actid'] = $actid;
|
||||||
|
$data['subject'] = $results[0]['subject'];
|
||||||
|
return view('invtrans_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($itdid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data['itdid'] = $itdid;
|
||||||
|
if($itdid != 0) {
|
||||||
|
$sql = "select * from invtrans where itdid='$itdid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['invtrans'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from invtransdata where itdid='$itdid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['itd'] = $results;
|
||||||
|
}
|
||||||
|
// invtrans
|
||||||
|
$data['purposes'] = $this->data['itx_purposes'];
|
||||||
|
$data['conditions'] = $this->data['itx_conditions'];
|
||||||
|
|
||||||
|
$sql = "SELECT u.*, c.`productname`, c.catalognumber FROM unitgroup u
|
||||||
|
LEFT JOIN productcatalog c ON u.`catalogid`=c.`catalogid`";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['unitgroup'] = $results;
|
||||||
|
|
||||||
|
$sql = "SELECT p.productid, s.sitename, pc.productname, p.productnumber FROM products p
|
||||||
|
LEFT JOIN productcatalog pc ON p.`catalogid`=pc.`catalogid`
|
||||||
|
LEFT JOIN sites s ON s.`siteid`=p.`siteid`";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['products'] = $results;
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM invcounters";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['invcounters'] = $results;
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM vendors";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['vendors'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$subject = $this->request->getVar('subject');
|
||||||
|
if($itdid == 0) {
|
||||||
|
$userid = $_SESSION['userid'];
|
||||||
|
$sql = "insert into invtransdata(subject, itddate, userid) VALUES (". $db->escape($subject). ", NOW(), '$userid')";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$itdid = $db->insertID();
|
||||||
|
} else {
|
||||||
|
$sql = "update invtransdata set subject=".$db->escape($subject)." where itdid='$itdid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
}
|
||||||
|
$itxid_delete = $this->request->getVar('itxid_delete');
|
||||||
|
if($itxid_delete!='') {
|
||||||
|
$itxid_del =explode(' ',$itxid_delete);
|
||||||
|
foreach($itxid_del as $itxid) {
|
||||||
|
$sql = "delete from invtrans where itxid='$itxid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$dests = $this->request->getVar('dests');
|
||||||
|
$origins = $this->request->getVar('origins');
|
||||||
|
if(isset($dests)) {
|
||||||
|
foreach($dests as $qdata) {
|
||||||
|
$qdata = explode("|",$qdata);
|
||||||
|
$desttype[] = $qdata[0];
|
||||||
|
$destid[] = $qdata[1];
|
||||||
|
}
|
||||||
|
foreach($origins as $qdata) {
|
||||||
|
$qdata = explode("|",$qdata);
|
||||||
|
$origtype[] = $qdata[0];
|
||||||
|
$origid[] = $qdata[1];
|
||||||
|
}
|
||||||
|
$unitgroupid = $this->request->getVar('unitgroupid');
|
||||||
|
$lotnumber = $this->request->getVar('lotnumber');
|
||||||
|
$qty = $this->request->getVar('qty');
|
||||||
|
$conditions = $this->request->getVar('conditions');
|
||||||
|
$itxdate = $this->request->getVar('itxdate');
|
||||||
|
$purpose = $this->request->getVar('purpose');
|
||||||
|
$sql = "INSERT INTO invtrans ( itdid, desttype, destid, origtype, origid, unitgroupid, lotnumber, qty, conditions, purpose, itxdate ) VALUES ";
|
||||||
|
foreach($origid as $qid => $qorigid) {
|
||||||
|
$sql .= "( '$itdid', '".$desttype[$qid]."', '".$destid[$qid]."', '".$origtype[$qid]."', '".$qorigid."', '".
|
||||||
|
$unitgroupid[$qid]."', '".$lotnumber[$qid]."', '".$qty[$qid]."', '".$conditions[$qid]."', '".$purpose[$qid]."', '".$itxdate[$qid]."' ),";
|
||||||
|
}
|
||||||
|
$sql = rtrim($sql, ',');
|
||||||
|
//echo "$sql";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
}
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
return view('invtrans_editor', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index_user($userid=null) {
|
||||||
|
$data = array();
|
||||||
|
$data['date1'] = date('Y-m-01');
|
||||||
|
$data['date2'] = date('Y-m-t');
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$date1 = $this->request->getVar('date1');
|
||||||
|
$date2 = $this->request->getVar('date2');
|
||||||
|
$data['date1'] = $date1;
|
||||||
|
$data['date2'] = $date2;
|
||||||
|
$sql = "SELECT itdid, `subject` FROM invtransdata WHERE userid='$userid' and itddate between '$date1' and '$date2'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['invtrans_itd'] = $results;
|
||||||
|
$sql = "select distinct i.actid, a.`subject` from invtrans i
|
||||||
|
left join activities a on a.`actid`=i.`actid`
|
||||||
|
where a.userid_owner='$userid' and a.opendate between '$date1' and '$date2'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['invtrans_act'] = $results;
|
||||||
|
}
|
||||||
|
return view('invtrans_indexuser', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function approve($itxid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT itx.*, u.firstname, u.lastname,
|
||||||
|
CASE
|
||||||
|
WHEN itx.desttype='P' THEN CONCAT(s.sitename, ' - ', pc.`productname`, '(',p.`productnumber`,')')
|
||||||
|
WHEN itx.desttype='V' THEN CONCAT(v.initial,' - ',v.vendorname)
|
||||||
|
END AS dest
|
||||||
|
FROM invtransactions itx
|
||||||
|
LEFT JOIN users u ON itx.`userid`=u.`userid`
|
||||||
|
LEFT JOIN products p ON itx.desttype='P' AND itx.`destid`=p.`productid`
|
||||||
|
LEFT JOIN productcatalog pc ON pc.`catalogid`=p.`catalogid`
|
||||||
|
LEFT JOIN sites s ON s.`siteid`=p.`siteid`
|
||||||
|
LEFT JOIN vendors v ON itx.desttype='V' AND itx.destid=v.vendorid
|
||||||
|
WHERE itx.itxid='$itxid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$results[0]['purpose'] = $this->data['purposes'][$results[0]['purpose']];
|
||||||
|
$data['itx'] = $results;
|
||||||
|
$sql ="SELECT itd.*,
|
||||||
|
CASE
|
||||||
|
WHEN itd.origintype='P' THEN CONCAT(s.sitename, ' - ', pc.`productname`, '(',p.`productnumber`,')')
|
||||||
|
WHEN itd.origintype='V' THEN CONCAT(v.initial,' - ',v.vendorname)
|
||||||
|
WHEN itd.origintype='C' THEN CONCAT('Counter ', c.counternumber,' - ',c.countername)
|
||||||
|
END AS origin, px.catalognumber, px.productname
|
||||||
|
FROM invtransdetail itd
|
||||||
|
LEFT JOIN productcatalog px ON itd.catalogid=px.catalogid
|
||||||
|
LEFT JOIN products p ON itd.origintype='P' AND itd.originid=p.`productid`
|
||||||
|
LEFT JOIN productcatalog pc ON pc.`catalogid`=p.`catalogid`
|
||||||
|
LEFT JOIN sites s ON s.`siteid`=p.`siteid`
|
||||||
|
LEFT JOIN vendors v ON itd.origintype='V' AND itd.originid=v.vendorid
|
||||||
|
LEFT JOIN invcounters c ON itd.origintype='C' AND itd.originid=c.counterid
|
||||||
|
WHERE itd.itxid=$itxid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['itd'] = $results;
|
||||||
|
$data['conditions'] = $this->data['conditions'];
|
||||||
|
return view('invtransactions_approve', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reportusage($userid=null) {
|
||||||
|
$data = array();
|
||||||
|
$data['date1'] = date('Y-m-01');
|
||||||
|
$data['date2'] = date('Y-m-t');
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$date1 = $this->request->getVar('date1');
|
||||||
|
$date2 = $this->request->getVar('date2');
|
||||||
|
$data['date1'] = $date1;
|
||||||
|
$data['date2'] = $date2;
|
||||||
|
$sql = "SELECT v.`vendorname`, ar.`areaname`, s.`sitename`, p.productnumber, pc.`catalognumber`, pc.`productname`, itx.`qty`, ug.`baseunit`, itx.`itxdate`
|
||||||
|
FROM invtrans itx
|
||||||
|
LEFT JOIN unitgroup ug ON ug.`unitgroupid`=itx.`unitgroupid`
|
||||||
|
LEFT JOIN productcatalog pc ON pc.`catalogid`=ug.`catalogid`
|
||||||
|
LEFT JOIN vendors v ON v.`vendorid`=pc.`vendorid`
|
||||||
|
LEFT JOIN products p ON p.`productid`=itx.`destid`
|
||||||
|
LEFT JOIN sites s ON p.`siteid`=s.`siteid`
|
||||||
|
LEFT JOIN accounts a ON a.`accountid`=s.`accountid`
|
||||||
|
LEFT JOIN areazone az ON az.zoneid=a.`zoneid`
|
||||||
|
LEFT JOIN areas ar ON ar.`areaid`=az.`areaid`
|
||||||
|
WHERE itx.itxdate BETWEEN '$date1 00:00' AND '$date2 23:59'
|
||||||
|
AND itx.desttype='P'
|
||||||
|
ORDER BY itx.actid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['usage'] = $results;
|
||||||
|
}
|
||||||
|
return view('invtrans_reportusage', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
74
app/Controllers/Mailgroups.php
Normal file
74
app/Controllers/Mailgroups.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\MailgroupsModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class Mailgroups extends BaseController {
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM mailgroups";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['mailgroups'] = $results;
|
||||||
|
return view('mailgroups_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($mailgroupid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data['emails'] = array();
|
||||||
|
if($mailgroupid != 0) {
|
||||||
|
$sql = "select * from mailgroups where mailgroupid='$mailgroupid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['mailgroups'] = $results;
|
||||||
|
}
|
||||||
|
$sql = "SELECT email_1 FROM users WHERE `enddate` IS NULL UNION SELECT email_2 FROM users WHERE `enddate` IS NULL";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
foreach($results as $email) { array_push( $data['emails'], $email['email_1']); }
|
||||||
|
$sql = "SELECT email_1 FROM contacts WHERE enddate IS NULL UNION SELECT email_2 FROM contacts WHERE enddate IS NULL;";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
foreach($results as $email) { array_push( $data['emails'], $email['email_1']); }
|
||||||
|
$data['emails'] = array_unique($data['emails']);
|
||||||
|
$data['emails'] = array_filter($data['emails']);
|
||||||
|
//print_r($data['emails']);
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'mailgroupname' => 'required',
|
||||||
|
'mailgrouptext' => 'required',
|
||||||
|
];
|
||||||
|
$mailgrouptext = $this->request->getVar('mailgrouptext');
|
||||||
|
$mailgrouptext = implode(",",$mailgrouptext);
|
||||||
|
$data['new_value'] = [
|
||||||
|
'mailgroupname' => $this->request->getVar('mailgroupname'),
|
||||||
|
'mailgrouptext' => $mailgrouptext,
|
||||||
|
];
|
||||||
|
if($mailgroupid != 0) {
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$mailgroupsModel = new MailgroupsModel();
|
||||||
|
$mailgroupsModel->update($mailgroupid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
//return view('mailgroups_edit',$data);
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('mailgroups_edit',$data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$mailgroupsModel= new MailgroupsModel();
|
||||||
|
$mailgroupsModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$mailgroupsModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
//return view('mailgroups_edit',$data);
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('mailgroups_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('mailgroups_edit', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
63
app/Controllers/Offices.php
Normal file
63
app/Controllers/Offices.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\OfficesModel;
|
||||||
|
|
||||||
|
class Offices extends BaseController {
|
||||||
|
|
||||||
|
// CONTACTS dan SITES
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM offices";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['offices'] = $results;
|
||||||
|
return view('offices_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($offid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM offices where offid='$offid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['offices'] = $results;
|
||||||
|
return view('offices_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($offid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if($offid != 0) {
|
||||||
|
$sql = "SELECT offname, offphone, offaddress from offices WHERE offid='$offid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['offices'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'offid' => 'required',
|
||||||
|
'offname' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'offname' => $this->request->getVar('offname'),
|
||||||
|
'offaddress' => $this->request->getVar('offaddress'),
|
||||||
|
'offphone' => $this->request->getVar('offphone')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$model = new OfficesModel();
|
||||||
|
if($offid != 0) {
|
||||||
|
$model->update($offid, $data['new_value']);
|
||||||
|
} else {
|
||||||
|
$model->set('createdate', 'NOW()', FALSE);
|
||||||
|
$model->insert($data['new_value']);
|
||||||
|
}
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
return view('offices_editor', $data);
|
||||||
|
}
|
||||||
|
return view('offices_editor', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
70
app/Controllers/ProductAlias.php
Normal file
70
app/Controllers/ProductAlias.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ProductAliasModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class ProductAlias extends Controller {
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$productaliastext = $this->request->getVar('productaliastext');
|
||||||
|
$sql = "SELECT * FROM productalias where lower(productaliastext) like '%$productaliastext%'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productalias'] = $results;
|
||||||
|
}
|
||||||
|
return view('productalias_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'productaliastext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'productaliastext' => $this->request->getVar('productaliastext')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productAliasModel = new ProductAliasModel();
|
||||||
|
$productAliasModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$productAliasModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('productalias_create',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('productalias_create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($productaliasid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM productalias WHERE productaliasid='$productaliasid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productalias'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'productaliastext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'productaliastext' => $this->request->getVar('productaliastext')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productAliasModel = new ProductAliasModel();
|
||||||
|
$productAliasModel->update($productaliasid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('productalias_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('productalias_edit', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
135
app/Controllers/ProductCatalog.php
Normal file
135
app/Controllers/ProductCatalog.php
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ProductCatalogModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class ProductCatalog extends Controller {
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
$sql = "SELECT producttypeid, texts FROM producttype";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['producttype'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$productname = $_POST['productname'];
|
||||||
|
$catalognumber = $_POST['catalognumber'];
|
||||||
|
$producttypeid = $_POST['producttypeid'];
|
||||||
|
if( $productname != '' || $catalognumber != '' || $producttypeid != '' ) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT p.*, v.`vendorname`, pt.`texts` FROM productcatalog p
|
||||||
|
LEFT JOIN vendors v ON v.`vendorid`=p.`vendorid`
|
||||||
|
LEFT JOIN producttype pt ON pt.`producttypeid`=p.producttypeid
|
||||||
|
where p.enddate is null ";
|
||||||
|
if($productname != '') { $sql .= "AND p.productname like '%$productname%' "; }
|
||||||
|
if($catalognumber != '') { $sql .= "AND p.catalognumber like '%$catalognumber%' "; }
|
||||||
|
if($producttypeid != '') { $sql .= "AND p.producttypeid='$producttypeid' "; }
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productname'] = $productname;
|
||||||
|
$data['catalognumber'] = $catalognumber;
|
||||||
|
$data['productcatalog'] = $results;
|
||||||
|
return view('productcatalog_index',$data);
|
||||||
|
} else {
|
||||||
|
return view('productcatalog_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return view('productcatalog_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($catalogid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM productcatalog WHERE catalogid='$catalogid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productcatalog'] = $results;
|
||||||
|
$sql = "SELECT * FROM producttype";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['producttype'] = $results;
|
||||||
|
$sql = "SELECT * FROM vendors";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['vendors'] = $results;
|
||||||
|
$sql = "SELECT * FROM productalias";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productalias'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'catalogid' => 'required',
|
||||||
|
'catalognumber' => 'required',
|
||||||
|
'productname' => 'required',
|
||||||
|
'producttypeid' => 'required',
|
||||||
|
'vendorid' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'catalogid' => $this->request->getVar('catalogid'),
|
||||||
|
'catalognumber' => $this->request->getVar('catalognumber'),
|
||||||
|
'productname' => $this->request->getVar('productname'),
|
||||||
|
'nie' => $this->request->getVar('nie'),
|
||||||
|
'producttypeid' => $this->request->getVar('producttypeid'),
|
||||||
|
'vendorid' => $this->request->getVar('vendorid'),
|
||||||
|
'manufacturer' => $this->request->getVar('manufacturer'),
|
||||||
|
'productaliasid' => $this->request->getVar('productaliasid')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productCatalogModel = new ProductCatalogModel();
|
||||||
|
$productCatalogModel->update($catalogid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('productcatalog_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('productcatalog_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM producttype";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['producttype'] = $results;
|
||||||
|
$sql = "SELECT * FROM vendors";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['vendors'] = $results;
|
||||||
|
$sql = "SELECT * FROM productalias";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productalias'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'catalognumber' => 'required',
|
||||||
|
'productname' => 'required',
|
||||||
|
'producttypeid' => 'required',
|
||||||
|
'vendorid' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'catalognumber' => $this->request->getVar('catalognumber'),
|
||||||
|
'productname' => $this->request->getVar('productname'),
|
||||||
|
'nie' => $this->request->getVar('nie'),
|
||||||
|
'producttypeid' => $this->request->getVar('producttypeid'),
|
||||||
|
'vendorid' => $this->request->getVar('vendorid'),
|
||||||
|
'manufacturer' => $this->request->getVar('manufacturer'),
|
||||||
|
'productaliasid' => $this->request->getVar('productaliasid')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productCatalogModel = new ProductCatalogModel();
|
||||||
|
$productCatalogModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$productCatalogModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('productcatalog_create',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('productcatalog_create', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
66
app/Controllers/ProductService.php
Normal file
66
app/Controllers/ProductService.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ProductServiceModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class ProductService extends Controller {
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM productservice";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productservice'] = $results;
|
||||||
|
return view('productservice_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'productservicetext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'productservicetext' => $this->request->getVar('productservicetext')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productServiceModel = new ProductServiceModel();
|
||||||
|
$productServiceModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$productServiceModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('productservice_create',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('productservice_create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($productserviceid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM productservice WHERE productserviceid='$productserviceid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productservice'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'productservicetext' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'productservicetext' => $this->request->getVar('productservicetext')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productServiceModel = new ProductServiceModel();
|
||||||
|
$productServiceModel->update($productserviceid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('productservice_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('productservice_edit', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
66
app/Controllers/ProductType.php
Normal file
66
app/Controllers/ProductType.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ProductTypeModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class ProductType extends Controller {
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM producttype";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['producttype'] = $results;
|
||||||
|
return view('producttype_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'texts' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'texts' => $this->request->getVar('texts')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productTypeModel = new ProductTypeModel();
|
||||||
|
$productTypeModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$productTypeModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('producttype_create',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('producttype_create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($producttypeid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM producttype WHERE producttypeid='$producttypeid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['producttype'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'texts' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'texts' => $this->request->getVar('texts')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productTypeModel = new ProductTypeModel();
|
||||||
|
$productTypeModel->update($producttypeid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('producttype_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('producttype_edit', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
402
app/Controllers/Products.php
Normal file
402
app/Controllers/Products.php
Normal file
@ -0,0 +1,402 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ProductsModel;
|
||||||
|
use App\Models\ProductsLogModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class Products extends BaseController {
|
||||||
|
|
||||||
|
protected array $data;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->data['productowners'] = array('S'=>'Summit', 'C'=> 'Customer', 'O' => 'Other');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "select * from productalias";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productalias'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from areas";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['areas'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from producttype";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['producttype'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
$productaliasid = $this->request->getVar('productaliasid');
|
||||||
|
$areaid = $this->request->getVar('areaid');
|
||||||
|
$producttypeid = $this->request->getVar('producttypeid');
|
||||||
|
$sitename = $this->request->getVar('sitename');
|
||||||
|
|
||||||
|
$data['productaliasid'] = $productaliasid;
|
||||||
|
$data['areaid'] = $areaid;
|
||||||
|
$data['producttypeid'] = $producttypeid;
|
||||||
|
$data['sitename'] = $sitename;
|
||||||
|
|
||||||
|
$areaquery = '';
|
||||||
|
if($areaid != '') { $areaquery = " s.siteid in (select siteid from v_siteaccount where areaid='$areaid') "; }
|
||||||
|
|
||||||
|
$producttypequery = '';
|
||||||
|
if($producttypeid != '') { $producttypequery = " pt.producttypeid='$producttypeid' "; }
|
||||||
|
|
||||||
|
$sitenamequery = '';
|
||||||
|
if($sitename!= '') {
|
||||||
|
$sitename = strtolower($sitename);
|
||||||
|
$sitenamequery= " lower(s.sitename) like '%$sitename%' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$where = 0;
|
||||||
|
|
||||||
|
$sql = "SELECT p.productid, pc.productname, p.productnumber, p.createdate, s.sitename, pt.producttypeid, pt.texts
|
||||||
|
FROM products p
|
||||||
|
left join productcatalog pc on pc.catalogid=p.catalogid
|
||||||
|
left join producttype pt on pt.producttypeid=pc.producttypeid
|
||||||
|
left join sites s on s.siteid=p.siteid";
|
||||||
|
|
||||||
|
if($productaliasid != 0) {
|
||||||
|
if($where == 0) { $sql .=" where "; $where++; }
|
||||||
|
else { $sql .=" and "; }
|
||||||
|
$sql.= "pc.productaliasid='$productaliasid'";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($areaquery != '') {
|
||||||
|
if($where == 0) { $sql .=" where "; $where++; }
|
||||||
|
else { $sql .=" and "; }
|
||||||
|
$sql.= "$areaquery";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($producttypequery != '') {
|
||||||
|
if($where == 0) { $sql .=" where "; $where++; }
|
||||||
|
else { $sql .=" and "; }
|
||||||
|
$sql.= "$producttypequery";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($sitenamequery != '') {
|
||||||
|
if($where == 0) { $sql .=" where "; $where++; }
|
||||||
|
else { $sql .=" and "; }
|
||||||
|
$sql.= "$sitenamequery";
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['sql']=$sql;
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['products'] = $results;
|
||||||
|
}
|
||||||
|
return view('products_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($productid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "SELECT p.*, pc.productname, ps.productservicetext, s.sitename, pc.catalognumber
|
||||||
|
FROM products p
|
||||||
|
left join productcatalog pc on pc.catalogid=p.catalogid
|
||||||
|
left join sites s on s.siteid=p.siteid
|
||||||
|
left join productservice ps on p.productserviceid=ps.productserviceid
|
||||||
|
where p.productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['products'] = $results;
|
||||||
|
|
||||||
|
$sql = "SELECT pl.*, pc.productname, ps.productservicetext, pc.catalognumber, s.sitename
|
||||||
|
FROM products_log pl
|
||||||
|
LEFT JOIN productcatalog pc ON pc.catalogid=pl.catalogid
|
||||||
|
left join sites s on s.siteid=pl.siteid
|
||||||
|
left join productservice ps on ps.productserviceid=pl.productserviceid
|
||||||
|
where pl.productid='$productid' order by pl.logdate desc";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['products_log'] = $results;
|
||||||
|
|
||||||
|
|
||||||
|
return view('products_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($productid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
if($productid != 0) {
|
||||||
|
$sql = "select * from products where productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['products'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "select * from productcatalog where productaliasid <> ''";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productcatalog'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from sites";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sites'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from productservice";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productservice'] = $results;
|
||||||
|
|
||||||
|
$data['productowners'] = $this->data['productowners'];
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'productid' => 'required',
|
||||||
|
'productnumber' => 'required|is_unique[products.productnumber,productid,'.$productid.']',
|
||||||
|
'catalogid' => 'required',
|
||||||
|
'siteid' => 'required',
|
||||||
|
'productowner' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'productid' => $this->request->getVar('productid'),
|
||||||
|
'siteid' => $this->request->getVar('siteid'),
|
||||||
|
'productnumber' => $this->request->getVar('productnumber'),
|
||||||
|
'catalogid' => $this->request->getVar('catalogid'),
|
||||||
|
'locationstartdate' => ($this->request->getVar('locationstartdate') == '') ? NULL : $this->request->getVar('locationstartdate'),
|
||||||
|
'installationdate' => ($this->request->getVar('installationdate') == '') ? NULL : $this->request->getVar('installationdate'),
|
||||||
|
'warrantystartdate' => ($this->request->getVar('warrantystartdate') == '') ? NULL : $this->request->getVar('warrantystartdate'),
|
||||||
|
'warrantyenddate' => ($this->request->getVar('warrantyenddate') == '') ? NULL : $this->request->getVar('warrantyenddate'),
|
||||||
|
'productowner' => $this->request->getVar('productowner'),
|
||||||
|
'productserviceid' => $this->request->getVar('productserviceid'),
|
||||||
|
'statuspart' => $this->request->getVar('statuspart'),
|
||||||
|
'remotetool' => $this->request->getVar('remotetool'),
|
||||||
|
'remoteid' => $this->request->getVar('remoteid'),
|
||||||
|
'remotepwd' => $this->request->getVar('remotepwd'),
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach($data['new_value'] as $qkey => $qvalue) {
|
||||||
|
if(empty( $qvalue ) ) { $data['new_value'][$qkey] = null; }
|
||||||
|
else { $data['new_value'][$qkey] = $db->escapeString($qvalue); }
|
||||||
|
}
|
||||||
|
if($productid != 0) {
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productsModel = new ProductsModel();
|
||||||
|
$productsModel->update($productid, $data['new_value']);
|
||||||
|
return view('form_success',$data);
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('products_edit',$data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productsModel = new ProductsModel();
|
||||||
|
$productsModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$productsModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('products_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('products_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function movesite($productid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "select p.*, pc.productname from products p
|
||||||
|
left join productcatalog pc on pc.catalogid=p.catalogid
|
||||||
|
where p.productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['products'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from sites";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sites'] = $results;
|
||||||
|
|
||||||
|
$data['productowners'] = $this->data['productowners'];
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'productid' => 'required',
|
||||||
|
'siteid' => 'required',
|
||||||
|
'oldlocationenddate' => 'required',
|
||||||
|
'newlocationstartdate' => 'required',
|
||||||
|
'productowner' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'productid' => $this->request->getVar('productid'),
|
||||||
|
'siteid' => $this->request->getVar('siteid'),
|
||||||
|
'oldlocationenddate' => $this->request->getVar('oldlocationenddate'),
|
||||||
|
'newlocationstartdate' => $this->request->getVar('newlocationstartdate'),
|
||||||
|
'productowner' => $this->request->getVar('productowner')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productid = $data['new_value']['productid'];
|
||||||
|
$siteid = $data['new_value']['siteid'];
|
||||||
|
$oldlocationenddate = $data['new_value']['oldlocationenddate'];
|
||||||
|
$newlocationstartdate = $data['new_value']['newlocationstartdate'];
|
||||||
|
$productowner = $data['new_value']['productowner'];
|
||||||
|
// products_log
|
||||||
|
$sql = "INSERT INTO products_log
|
||||||
|
(productid, siteid, catalogid, locationstartdate, locationenddate, installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, logdate )
|
||||||
|
SELECT productid, siteid,catalogid, locationstartdate, '$oldlocationenddate', installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, NOW()
|
||||||
|
FROM products WHERE productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
// products
|
||||||
|
$sql = "update products set siteid='$siteid', locationstartdate='$newlocationstartdate', productowner='$productowner' where productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('products_movesite', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('products_movesite', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changeowner($productid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "select p.*, pc.productname from products p
|
||||||
|
left join productcatalog pc on pc.catalogid=p.catalogid
|
||||||
|
where p.productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['products'] = $results;
|
||||||
|
|
||||||
|
$data['productowners'] = $this->data['productowners'];
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'productid' => 'required',
|
||||||
|
'productowner' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'productid' => $this->request->getVar('productid'),
|
||||||
|
'productowner' => $this->request->getVar('productowner')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productid = $data['new_value']['productid'];
|
||||||
|
$productowner = $data['new_value']['productowner'];
|
||||||
|
// products_log
|
||||||
|
$sql = "INSERT INTO products_log
|
||||||
|
(productid, siteid, catalogid, locationstartdate, locationenddate, installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, logdate )
|
||||||
|
SELECT productid, siteid,catalogid, locationstartdate, null, installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, NOW()
|
||||||
|
FROM products WHERE productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
// products
|
||||||
|
$sql = "update products set productowner='$productowner' where productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('products_changeowner', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('products_changeowner', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function upgrade($productid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "select p.*, pc.productname from products p
|
||||||
|
left join productcatalog pc on pc.catalogid=p.catalogid
|
||||||
|
where p.productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['products'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from productcatalog where productaliasid <> ''";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productcatalog'] = $results;
|
||||||
|
|
||||||
|
//$data['productowners'] = $this->data['productowners'];
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'productid' => 'required',
|
||||||
|
'catalogid' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'productid' => $this->request->getVar('productid'),
|
||||||
|
'catalogid' => $this->request->getVar('catalogid')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$productid = $data['new_value']['productid'];
|
||||||
|
$catalogid = $data['new_value']['catalogid'];
|
||||||
|
// products_log
|
||||||
|
$sql = "INSERT INTO products_log
|
||||||
|
(productid, siteid, catalogid, locationstartdate, locationenddate, installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, logdate )
|
||||||
|
SELECT productid, siteid,catalogid, locationstartdate, null, installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, NOW()
|
||||||
|
FROM products WHERE productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
// products
|
||||||
|
$sql = "update products set catalogid='$catalogid' where productid='$productid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('products_upgrade', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('products_upgrade', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function productslog_edit($productlogid=null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "select * from productcatalog where productaliasid <> ''";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productcatalog'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from products_log where productlogid='$productlogid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['products_log'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from sites";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sites'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$data['new_value'] = [
|
||||||
|
'catalogid' => $this->request->getVar('catalogid'),
|
||||||
|
'siteid' => $this->request->getVar('siteid'),
|
||||||
|
|
||||||
|
'locationstartdate' => ($this->request->getVar('locationstartdate') == '') ? NULL : $this->request->getVar('locationstartdate'),
|
||||||
|
'locationenddate' => ($this->request->getVar('locationenddate') == '') ? NULL : $this->request->getVar('locationenddate'),
|
||||||
|
'installationdate' => ($this->request->getVar('installationdate') == '') ? NULL : $this->request->getVar('installationdate'),
|
||||||
|
'warrantystartdate' => ($this->request->getVar('warrantystartdate') == '') ? NULL : $this->request->getVar('warrantystartdate'),
|
||||||
|
'warrantyenddate' => ($this->request->getVar('warrantyenddate') == '') ? NULL : $this->request->getVar('warrantyenddate'),
|
||||||
|
|
||||||
|
'productowner' => $this->request->getVar('productowner'),
|
||||||
|
'productserviceid' => $this->request->getVar('productserviceid'),
|
||||||
|
'statuspart' => $this->request->getVar('statuspart')
|
||||||
|
];
|
||||||
|
|
||||||
|
// var_dump($data['new_value']);die();
|
||||||
|
|
||||||
|
$productsLogModel = new ProductsLogModel();
|
||||||
|
$productsLogModel->update($productlogid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
return view('productslog_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function productslog_delete() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$productlogid = $this->request->getVar('logid');
|
||||||
|
$sql = "delete from products_log where productlogid='$productlogid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
//echo "$sql";
|
||||||
|
}
|
||||||
|
}
|
||||||
337
app/Controllers/Sites.php
Normal file
337
app/Controllers/Sites.php
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\SitesModel;
|
||||||
|
use App\Models\SitesLogModel;
|
||||||
|
|
||||||
|
class Sites extends BaseController {
|
||||||
|
|
||||||
|
// CONTACTS dan SITES
|
||||||
|
public function index() {
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sitename = strtolower($this->request->getVar('sitename'));
|
||||||
|
|
||||||
|
$data['sitename'] = $sitename;
|
||||||
|
$sql = "SELECT distinct * FROM sites st
|
||||||
|
LEFT JOIN accounts ac ON ac.accountid=st.accountid where st.enddate is null";
|
||||||
|
if($sitename != '') { $sql .= " and lower(st.sitename) like '%$sitename%' "; }
|
||||||
|
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sites'] = $results;
|
||||||
|
return view('sites_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('sites_index');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($siteid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT s.`siteid`, s.`sitename`, a.`accountname`,
|
||||||
|
concat(u.`firstname`,' ',u.lastname) as marketing, s.createdate
|
||||||
|
FROM sites s
|
||||||
|
LEFT JOIN accounts a ON a.`accountid`=s.`accountid`
|
||||||
|
LEFT JOIN users u ON u.`userid`=s.`userid`
|
||||||
|
WHERE s.siteid='$siteid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sites'] = $results;
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT sitelogid, user, userstartdate, userenddate from sites_log where siteid='$siteid' ORDER BY sitelogid DESC;";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sites_log'] = $results;
|
||||||
|
|
||||||
|
return view('sites_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($siteid = null) {
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
if($siteid != 0) {
|
||||||
|
$sql = "SELECT siteid, sitename, s.userid, accountid, CONCAT(u.`firstname`,' ',u.`lastname`) AS username, userstartdate FROM sites s
|
||||||
|
LEFT JOIN users u ON u.userid=s.`userid`
|
||||||
|
WHERE siteid='$siteid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sites'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
//$sql = "SELECT accountid, accountname FROM accounts WHERE parentaccount='0'";
|
||||||
|
$sql = "SELECT accountid, accountname FROM accounts";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['accounts'] = $results;
|
||||||
|
|
||||||
|
$sql = "SELECT userid, firstname, lastname FROM users WHERE userdeptid='2'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['users'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'siteid' => 'required',
|
||||||
|
'sitename' => 'required',
|
||||||
|
'accountid' => 'required',
|
||||||
|
'userid' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'siteid' => $this->request->getVar('siteid'),
|
||||||
|
'sitename' => $this->request->getVar('sitename'),
|
||||||
|
'accountid' => $this->request->getVar('accountid'),
|
||||||
|
'userid' => $this->request->getVar('userid'),
|
||||||
|
'userstartdate' => $this->request->getVar('startdate'),
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
|
||||||
|
// User yang sudah ada
|
||||||
|
if($siteid != 0) {
|
||||||
|
|
||||||
|
// Get Log_Users
|
||||||
|
$sql = "SELECT sitelogid, siteid FROM sites_log WHERE siteid=$siteid ORDER BY sitelogid DESC LIMIT 1";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
|
if($results != null){
|
||||||
|
|
||||||
|
// Update Site
|
||||||
|
$sitesModel = new SitesModel();
|
||||||
|
$sitesModel->update($siteid, $data['new_value']);
|
||||||
|
|
||||||
|
// Update Site Logs Sebelumnya
|
||||||
|
$sitelogid = $results[0]['sitelogid'];
|
||||||
|
$userstartdate = $this->request->getVar('startdate');
|
||||||
|
$data['log_sites'] = [
|
||||||
|
'userenddate' => $userstartdate
|
||||||
|
];
|
||||||
|
$sitesLogModel= new SitesLogModel();
|
||||||
|
$sitesLogModel->update($sitelogid, $data['log_sites']);
|
||||||
|
|
||||||
|
// Insert Data Baru Site Log
|
||||||
|
$userid = $this->request->getVar('userid');
|
||||||
|
// Get Full Name Form User
|
||||||
|
$sql = "SELECT CONCAT(firstname, ' ', lastname) as fullname FROM users WHERE userid = $userid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$username = $results[0]['fullname'];
|
||||||
|
// Insert Data For Sites Log
|
||||||
|
$data['log_sites'] = [
|
||||||
|
'siteid' => $siteid,
|
||||||
|
'user' => $username,
|
||||||
|
'userstartdate' => $userstartdate
|
||||||
|
];
|
||||||
|
$sitesLogModel = new SitesLogModel();
|
||||||
|
$sitesLogModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$sitesLogModel->insert($data['log_sites']);
|
||||||
|
|
||||||
|
// Kondisi Awal Ketika Sites Sudah Ada Namun Sites_Log Belum Ada
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$userstartdate = $this->request->getVar('startdate');
|
||||||
|
|
||||||
|
// Insert Data Baru Site Log
|
||||||
|
$userid = $this->request->getVar('userid');
|
||||||
|
|
||||||
|
// Get Full Name Form User
|
||||||
|
$sql = "SELECT CONCAT(firstname, ' ', lastname) as fullname FROM users WHERE userid = $userid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$username = $results[0]['fullname'];
|
||||||
|
|
||||||
|
$data['new_log_sites'] = [
|
||||||
|
'siteid' => $siteid,
|
||||||
|
'user' => $username,
|
||||||
|
'userstartdate' => $userstartdate
|
||||||
|
];
|
||||||
|
|
||||||
|
$sitesLogModel = new SitesLogModel();
|
||||||
|
$sitesLogModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$sitesLogModel->insert($data['new_log_sites']);
|
||||||
|
|
||||||
|
// Update Site
|
||||||
|
$sitesModel = new SitesModel();
|
||||||
|
$sitesModel->update($siteid, $data['new_value']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('form_success');
|
||||||
|
|
||||||
|
// User Baru/Fresh
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Input ke sites
|
||||||
|
$sitesModel = new SitesModel();
|
||||||
|
$sitesModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$sitesModel->insert($data['new_value']);
|
||||||
|
|
||||||
|
// Get Last ID
|
||||||
|
$site_id = $sitesModel->getInsertID();
|
||||||
|
// Get Last Data Form Sites
|
||||||
|
$sql = "SELECT * FROM sites WHERE siteid=$site_id";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$site_id = $results[0]['siteid'];
|
||||||
|
$userid = $results[0]['userid'];
|
||||||
|
$userstartdate = $results[0]['userstartdate'];
|
||||||
|
|
||||||
|
// Get Full Name Form User
|
||||||
|
$sql = "SELECT CONCAT(firstname, ' ', lastname) as fullname FROM users WHERE userid = $userid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$username = $results[0]['fullname'];
|
||||||
|
|
||||||
|
// Insert Data For Sites Log
|
||||||
|
$data['log_sites'] = [
|
||||||
|
'siteid' => $site_id,
|
||||||
|
'user' => $username,
|
||||||
|
'userstartdate' => $userstartdate
|
||||||
|
];
|
||||||
|
$sitesLogModel = new SitesLogModel();
|
||||||
|
$sitesLogModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$sitesLogModel->insert($data['log_sites']);
|
||||||
|
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('sites_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['siteid']= $siteid;
|
||||||
|
return view('sites_editor', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($siteid = 0) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "update sites set enddate=
|
||||||
|
case when enddate is not null then null
|
||||||
|
else NOW()
|
||||||
|
end
|
||||||
|
where siteid='$siteid'";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public function siteslog_edit($sitelogid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT sitelogid, user, userstartdate, userenddate FROM sites_log
|
||||||
|
WHERE sitelogid='$sitelogid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sites_log'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'user' => 'required',
|
||||||
|
'userstartdate' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
$data['new_value'] = [
|
||||||
|
'sitelogid' => $this->request->getVar('sitelogid'),
|
||||||
|
'user' => $this->request->getVar('user'),
|
||||||
|
'userstartdate' => ($this->request->getVar('userstartdate') == '') ? NULL : $this->request->getVar('userstartdate'),
|
||||||
|
'userenddate' => ($this->request->getVar('userenddate') == '') ? NULL : $this->request->getVar('userenddate')
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$sitesLogModel = new SitesLogModel();
|
||||||
|
$sitesLogModel->update($sitelogid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('siteslog_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('siteslog_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sitecontact_edit($siteid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT siteid, sitename FROM sites WHERE siteid='$siteid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sites'] = $results;
|
||||||
|
$sql = "SELECT * FROM sitecontact WHERE siteid='$siteid' and enddate is null";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['sitecontact'] = $results;
|
||||||
|
$sql = "SELECT contactid, firstname, lastname, email_1 FROM contacts";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['contacts'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'siteid' => 'required',
|
||||||
|
'contactid' => 'required'
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$siteid = $this->request->getVar('siteid');
|
||||||
|
$contactid = $this->request->getVar('contactid');
|
||||||
|
$contactemail = $this->request->getVar('contactemail');
|
||||||
|
$jobtitle = $this->request->getVar('jobtitle');
|
||||||
|
$department = $this->request->getVar('department');
|
||||||
|
$sitecontactid_delete = $this->request->getVar('sitecontactid_delete');
|
||||||
|
if($sitecontactid_delete !='') {
|
||||||
|
$sitecontactid_del = explode(' ',$sitecontactid_delete);
|
||||||
|
foreach($sitecontactid_del as $sitecontactid) {
|
||||||
|
// delete query -> enddate is now
|
||||||
|
if($sitecontactid != 0) {
|
||||||
|
$sql = "update sitecontact set enddate=now() where sitecontactid='$sitecontactid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach($contactid as $i => $qcontactid) {
|
||||||
|
if($qcontactid <> '') {
|
||||||
|
$qcontactemail = is_null($contactemail) ? '' : $contactemail[$i];
|
||||||
|
$qjobtitle= is_null($jobtitle) ? '' : $jobtitle[$i];
|
||||||
|
$qdepartment = is_null($department) ? '' : $department[$i];
|
||||||
|
// insert query
|
||||||
|
$sql = "insert into sitecontact(siteid, contactid, contactemail, jobtitle, department, startdate)
|
||||||
|
VALUES ('$siteid', '$qcontactid', '$qcontactemail', '$qjobtitle', '$qdepartment', NOW())
|
||||||
|
on duplicate key update contactemail='$qcontactemail', jobtitle='$qjobtitle', department='$qdepartment', enddate=null ";
|
||||||
|
$db->query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('sitecontact_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('sitecontact_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sitecontact_getEmail_1($contactid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT email_1 FROM contacts where contactid='$contactid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
return $results[0]['email_1'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sitecontact_newrow($contactid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT contactid, firstname, lastname, email_1 FROM contacts";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['contacts'] = $results;
|
||||||
|
return view('sitecontact_newrow', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function siteslog_delete($sitelogid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "delete from sites_log where sitelogid='$sitelogid'";
|
||||||
|
if($db->query($sql)) { return redirect()->to('/sites');}//return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
}
|
||||||
67
app/Controllers/UnitGroup.php
Normal file
67
app/Controllers/UnitGroup.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\UnitGroupModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class UnitGroup extends BaseController {
|
||||||
|
public function index() {
|
||||||
|
$data = array();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$productname= strtolower($this->request->getVar('productname'));
|
||||||
|
$sql = "SELECT u.*, c.`productname`, c.`catalognumber` FROM unitgroup u".
|
||||||
|
" LEFT JOIN productcatalog c ON c.`catalogid`=u.`catalogid` ".
|
||||||
|
" where lower(c.productname) like '%$productname%' ";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['unitgroup'] = $results;
|
||||||
|
}
|
||||||
|
return view('unitgroup_index',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($unitgroupid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM unitgroup WHERE unitgroupid='$unitgroupid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['unitgroup'] = $results;
|
||||||
|
$sql = "SELECT * FROM productcatalog";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['productcatalog'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'catalogid' => 'required',
|
||||||
|
'unitgroupcode' => 'required',
|
||||||
|
'unit' => 'required',
|
||||||
|
'quantity' => 'required',
|
||||||
|
'baseunit' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'catalogid' => $this->request->getVar('catalogid'),
|
||||||
|
'unitgroupcode' => $this->request->getVar('unitgroupcode'),
|
||||||
|
'unit' => $this->request->getVar('unit'),
|
||||||
|
'quantity' => $this->request->getVar('quantity'),
|
||||||
|
'baseunit' => $this->request->getVar('baseunit')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
if($unitgroupid!=0) {
|
||||||
|
$model = new UnitGroupModel();
|
||||||
|
$model->update($unitgroupid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$model = new UnitGroupModel();
|
||||||
|
$model->set('createdate', 'NOW()', FALSE);
|
||||||
|
$model->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('unitgroup_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('unitgroup_editor', $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
81
app/Controllers/UserDepartment.php
Normal file
81
app/Controllers/UserDepartment.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\UserDepartmentModel;
|
||||||
|
|
||||||
|
class UserDepartment extends BaseController {
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "select * from userdepartment";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['userdepartment'] = $results;
|
||||||
|
return view('userdepartment_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'shorttext' => 'required',
|
||||||
|
'texts' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'shorttext' => $this->request->getVar('shorttext'),
|
||||||
|
'texts' => $this->request->getVar('texts')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$userdepartmentModel = new UserDepartmentModel();
|
||||||
|
$userdepartmentModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$userdepartmentModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('userdepartment_create',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('userdepartment_create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($userdeptid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM userdepartment WHERE userdeptid='$userdeptid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['userdepartment'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'userdeptid' => 'required',
|
||||||
|
'shorttext' => 'required',
|
||||||
|
'texts' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'userdeptid' => $this->request->getVar('userdeptid'),
|
||||||
|
'shorttext' => $this->request->getVar('shorttext'),
|
||||||
|
'texts' => $this->request->getVar('texts')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$userdepartmentModel = new UserDepartmentModel();
|
||||||
|
$userdepartmentModel->update($userdeptid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('userdepartment_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('userdepartment_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($userdeptid = 0) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "update userdepartment set enddate=
|
||||||
|
case when enddate is not null then null
|
||||||
|
else NOW()
|
||||||
|
end
|
||||||
|
where userdeptid='$userdeptid'";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
80
app/Controllers/UserPosition.php
Normal file
80
app/Controllers/UserPosition.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\UserPositionModel;
|
||||||
|
|
||||||
|
class UserPosition extends BaseController {
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "select * from userposition";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['userposition'] = $results;
|
||||||
|
return view('userposition_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'shorttext' => 'required',
|
||||||
|
'texts' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'shorttext' => $this->request->getVar('shorttext'),
|
||||||
|
'texts' => $this->request->getVar('texts')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$userpositionModel = new UserPositionModel();
|
||||||
|
$userpositionModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$userpositionModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('userposition_create',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('userposition_create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($userposid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM userposition WHERE userposid='$userposid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['usertype'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'userposid' => 'required',
|
||||||
|
'shorttext' => 'required',
|
||||||
|
'texts' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'userposid' => $this->request->getVar('userposid'),
|
||||||
|
'shorttext' => $this->request->getVar('shorttext'),
|
||||||
|
'texts' => $this->request->getVar('texts')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$userpositionModel = new UserPositionModel();
|
||||||
|
$userpositionModel->update($userposid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('userposition_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('userposition_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($userid = 0) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "update userposition set enddate=
|
||||||
|
case when enddate is not null then null
|
||||||
|
else NOW()
|
||||||
|
end
|
||||||
|
where userposid='$userposid'";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
}
|
||||||
444
app/Controllers/Users.php
Normal file
444
app/Controllers/Users.php
Normal file
@ -0,0 +1,444 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\UsersModel;
|
||||||
|
use App\Models\UsersLogModel;
|
||||||
|
|
||||||
|
class Users extends BaseController {
|
||||||
|
protected array $data;
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->data['levels'] = array('0'=>'None', '1'=>'Super User', '2'=> 'Technical Support Manager', '3' => 'TSO IVD', '4'=>'Product Spesialis');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "select u.*, up.texts as userposition, ud.texts as userdepartment from users u
|
||||||
|
left join userposition up on u.userposid=up.userposid
|
||||||
|
left join userdepartment ud on u.userdeptid=ud.userdeptid
|
||||||
|
order by enddate";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['users'] = $results;
|
||||||
|
return view('users_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($userid = null) {
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "select u.*, up.texts as userposition, ud.texts as userdepartment,
|
||||||
|
CONCAT(ur.firstname,' ',ur.lastname) AS userreportto, o.offname
|
||||||
|
from users u
|
||||||
|
left join userposition up on u.userposid=up.userposid
|
||||||
|
left join userdepartment ud on u.userdeptid=ud.userdeptid
|
||||||
|
left join users ur on ur.userid=u.reportto
|
||||||
|
left join offices o on o.offid=u.offid
|
||||||
|
where u.userid='$userid'
|
||||||
|
order by enddate";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['users'] = $results;
|
||||||
|
|
||||||
|
$sql = "select * from users_log where userid='$userid' ORDER BY createdate DESC;";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['users_log'] = $results;
|
||||||
|
|
||||||
|
return view('users_view', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($userid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
if($userid != 0) {
|
||||||
|
$sql = "SELECT *, up.texts as userposition, ud.texts as userdepartment
|
||||||
|
FROM users u
|
||||||
|
left join userposition up on up.userposid=u.userposid
|
||||||
|
left join userdepartment ud on ud.userdeptid=u.userdeptid
|
||||||
|
WHERE userid='$userid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['users'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM userposition";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['userposition'] = $results;
|
||||||
|
$sql = "SELECT * FROM userdepartment";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['userdepartment'] = $results;
|
||||||
|
|
||||||
|
//$sql = "SELECT userid, firstname, lastname FROM users WHERE userposid IN (1,2,3)";
|
||||||
|
$sql = "SELECT userid, firstname, lastname FROM users"; // Sementara
|
||||||
|
$query = $db->query($sql);
|
||||||
|
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['userreportto'] = $results;
|
||||||
|
$sql = "SELECT * FROM offices";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['offices'] = $results;
|
||||||
|
|
||||||
|
$data['levels'] = $this->data['levels'];
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
// Mencegah Tanggal Agar Tidak 0000-00-00
|
||||||
|
$enddate = $this->request->getVar('enddate');
|
||||||
|
if($this->request->getVar('enddate') === ''){$enddate=null;}
|
||||||
|
|
||||||
|
// Untuk User Baru
|
||||||
|
if ($this->request->getVar('userid') == 0) {
|
||||||
|
$rules = [
|
||||||
|
'userid' => 'required',
|
||||||
|
'usernumber' => 'required',
|
||||||
|
'firstname' => 'required',
|
||||||
|
'initial' => 'required',
|
||||||
|
'email_1' => 'required',
|
||||||
|
'phone' => 'required',
|
||||||
|
'userposid' => 'required',
|
||||||
|
'userdeptid' => 'required',
|
||||||
|
'startdate' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'userid' => $this->request->getVar('userid'),
|
||||||
|
'usernumber' => $this->request->getVar('usernumber'),
|
||||||
|
'firstname' => $this->request->getVar('firstname'),
|
||||||
|
'lastname' => $this->request->getVar('lastname'),
|
||||||
|
'initial' => $this->request->getVar('initial'),
|
||||||
|
'birthdate' => ($this->request->getVar('birthdate') == '') ? NULL : $this->request->getVar('birthdate'),
|
||||||
|
'email_1' => $this->request->getVar('email_1'),
|
||||||
|
'email_2' => $this->request->getVar('email_2'),
|
||||||
|
'phone' => $this->request->getVar('phone'),
|
||||||
|
'level' => $this->request->getVar('level'),
|
||||||
|
'userposid' => $this->request->getVar('userposid'),
|
||||||
|
'userdeptid' => $this->request->getVar('userdeptid'),
|
||||||
|
'reportto' => $this->request->getVar('reportto'),
|
||||||
|
'offid' => $this->request->getVar('offid'),
|
||||||
|
'startdate' => $this->request->getVar('startdate'),
|
||||||
|
'enddate' => $enddate
|
||||||
|
];
|
||||||
|
|
||||||
|
// Untuk User Yang Sudah Ada
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'userid' => 'required',
|
||||||
|
'usernumber' => 'required',
|
||||||
|
'firstname' => 'required',
|
||||||
|
'initial' => 'required',
|
||||||
|
'email_1' => 'required',
|
||||||
|
'phone' => 'required',
|
||||||
|
'startdate' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
$data['new_value'] = [
|
||||||
|
'userid' => $this->request->getVar('userid'),
|
||||||
|
'usernumber' => $this->request->getVar('usernumber'),
|
||||||
|
'firstname' => $this->request->getVar('firstname'),
|
||||||
|
'lastname' => $this->request->getVar('lastname'),
|
||||||
|
'initial' => $this->request->getVar('initial'),
|
||||||
|
'birthdate' => ($this->request->getVar('birthdate') == '') ? NULL : $this->request->getVar('birthdate'),
|
||||||
|
'email_1' => $this->request->getVar('email_1'),
|
||||||
|
'email_2' => $this->request->getVar('email_2'),
|
||||||
|
'phone' => $this->request->getVar('phone'),
|
||||||
|
'level' => $this->request->getVar('level'),
|
||||||
|
'startdate' => $this->request->getVar('startdate'),
|
||||||
|
'enddate' => $enddate
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->validate($rules)) {
|
||||||
|
|
||||||
|
// Untuk Mengupdate User yg Sudah Ada
|
||||||
|
if($userid != 0) {
|
||||||
|
$usersModel= new UsersModel();
|
||||||
|
$usersModel->update($userid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
|
||||||
|
// Untuk User Baru/Fresh
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Input Tabel Users
|
||||||
|
$usersModel= new UsersModel();
|
||||||
|
$usersModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$usersModel->insert($data['new_value']);
|
||||||
|
|
||||||
|
// Input Tabel User Logs
|
||||||
|
// get data
|
||||||
|
$userdeptid = $data['new_value']['userdeptid'];
|
||||||
|
$sql = "SELECT texts FROM userdepartment WHERE userdeptid = $userdeptid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$userdepartmenttext = $results[0]['texts'];
|
||||||
|
// get data
|
||||||
|
$userposid = $data['new_value']['userposid'];
|
||||||
|
$sql = "SELECT texts FROM userposition WHERE userposid = $userposid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$userpostext = $results[0]['texts'];
|
||||||
|
// get data
|
||||||
|
$userreportid = $data['new_value']['reportto'];
|
||||||
|
$sql = "SELECT CONCAT(firstname, ' ', lastname) as fullname FROM users WHERE userid='$userreportid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$userreporttext = $results[0]["fullname"];
|
||||||
|
// get data
|
||||||
|
$useroffid = $data['new_value']['offid'];
|
||||||
|
$sql = "SELECT offname FROM offices WHERE offid = $useroffid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$userofftext = $results[0]['offname'];
|
||||||
|
// set data
|
||||||
|
$data['new_log_value'] = [
|
||||||
|
'userid' => $usersModel->getInsertID(),
|
||||||
|
'userdepartment' => $userdepartmenttext,
|
||||||
|
'userposition' => $userpostext,
|
||||||
|
'reportto' => $userreporttext,
|
||||||
|
'office' => $userofftext,
|
||||||
|
'startdate' => $data['new_value']['startdate'],
|
||||||
|
'enddate' => $data['new_value']['enddate']
|
||||||
|
];
|
||||||
|
$UsersLogModel = new UsersLogModel();
|
||||||
|
$UsersLogModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$UsersLogModel->insert($data['new_log_value']);
|
||||||
|
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('users_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('users_editor', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit_password($userid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM users WHERE userid='$userid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['users'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'userid' => 'required',
|
||||||
|
'password' => 'required',
|
||||||
|
'password_confirm' => 'required|matches[password]'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'password' => password_hash($this->request->getVar('password'), PASSWORD_DEFAULT)
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$usersModel= new UsersModel();
|
||||||
|
$usersModel->update($userid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('users_edit_password',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('users_edit_password', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($userid = 0) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "update users set enddate=
|
||||||
|
case when enddate is not null then null
|
||||||
|
else NOW()
|
||||||
|
end
|
||||||
|
where userid='$userid'";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update Jabatan
|
||||||
|
public function edit_role($userid){
|
||||||
|
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$startwork = date('Y-m-d');
|
||||||
|
$data['startwork'] = $startwork;
|
||||||
|
|
||||||
|
if($userid != 0) {
|
||||||
|
$sql = "SELECT *, up.texts as userposition, ud.texts as userdepartment
|
||||||
|
FROM users u
|
||||||
|
left join userposition up on up.userposid=u.userposid
|
||||||
|
left join userdepartment ud on ud.userdeptid=u.userdeptid
|
||||||
|
WHERE userid='$userid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['users'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM userposition";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['userposition'] = $results;
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM userdepartment";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['userdepartment'] = $results;
|
||||||
|
|
||||||
|
//$sql = "SELECT userid, firstname, lastname FROM users WHERE userposid IN (1,2,3)";
|
||||||
|
$sql = "SELECT userid, firstname, lastname FROM users"; // Sementara
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['userreportto'] = $results;
|
||||||
|
|
||||||
|
$sql = "SELECT offid, offname FROM offices";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['offices'] = $results;
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'userid' => 'required',
|
||||||
|
'userposid' => 'required',
|
||||||
|
'userdeptid' => 'required',
|
||||||
|
'reportto' => 'required',
|
||||||
|
'offid' => 'required',
|
||||||
|
'startdate' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
$userid = $this->request->getVar('userid');
|
||||||
|
$userposid = $this->request->getVar('userposid');
|
||||||
|
$userdeptid = $this->request->getVar('userdeptid');
|
||||||
|
$reportto = $this->request->getVar('reportto');
|
||||||
|
$offid = $this->request->getVar('offid');
|
||||||
|
$startdate = $this->request->getVar('startdate');
|
||||||
|
|
||||||
|
$data['new_value'] = [
|
||||||
|
'userid' => $this->request->getVar('userid'),
|
||||||
|
'userposid' => $this->request->getVar('userposid'),
|
||||||
|
'userdeptid' => $this->request->getVar('userdeptid'),
|
||||||
|
'reportto' => $this->request->getVar('reportto'),
|
||||||
|
'offid' => $this->request->getVar('offid'),
|
||||||
|
];
|
||||||
|
|
||||||
|
if($this->validate($rules)){
|
||||||
|
|
||||||
|
// Update Users
|
||||||
|
$usersModel= new UsersModel();
|
||||||
|
$usersModel->update($userid, $data['new_value']);
|
||||||
|
|
||||||
|
|
||||||
|
// Update Log_Users
|
||||||
|
$sql = "SELECT userlogid FROM users_log where userid=$userid order by userlogid desc limit 1";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
|
||||||
|
if($results != null){
|
||||||
|
$userlogid = $results[0]['userlogid'];
|
||||||
|
$data['users_log'] = [
|
||||||
|
'enddate' => $startdate
|
||||||
|
];
|
||||||
|
|
||||||
|
$usersLogModel= new UsersLogModel();
|
||||||
|
$usersLogModel->update($userlogid, $data['users_log']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert Log_Users
|
||||||
|
$sql = "SELECT texts FROM userdepartment WHERE userdeptid = $userdeptid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$userdepttext = $results[0]['texts'];
|
||||||
|
|
||||||
|
$sql = "SELECT texts FROM userposition WHERE userposid = $userposid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$userposidtext = $results[0]['texts'];
|
||||||
|
|
||||||
|
$sql = "SELECT CONCAT(firstname, ' ', lastname) as fullname FROM users WHERE userid = $reportto";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
if($results != null) {$usernametext = $results[0]['fullname'];} else {$usernametext=null;}
|
||||||
|
|
||||||
|
$sql = "SELECT offname as texts FROM offices WHERE offid = $offid";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$offname = $results[0]['texts'];
|
||||||
|
|
||||||
|
$data['users_log'] = [
|
||||||
|
'userid' => $userid,
|
||||||
|
'userposition' => $userposidtext,
|
||||||
|
'userdepartment' => $userdepttext,
|
||||||
|
'reportto' => $usernametext,
|
||||||
|
'office' => $offname,
|
||||||
|
'startdate' => $this->request->getVar('startdate'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$usersLogModel= new UsersLogModel();
|
||||||
|
$usersLogModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$usersLogModel->insert($data['users_log']);
|
||||||
|
|
||||||
|
|
||||||
|
return view('form_success');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('users_position_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('usersrole_editor',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit History Jabatan
|
||||||
|
public function users_log_edit($userlogid = 0) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM users_log WHERE userlogid='$userlogid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['users_log'] = $results;
|
||||||
|
$userid = $results[0]['userid'];
|
||||||
|
|
||||||
|
$sql = "SELECT CONCAT(firstname, ' ', lastname) as fullname FROM users WHERE userid='$userid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['fullname'] = $results[0]['fullname'];
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
|
||||||
|
$enddate = $this->request->getVar('enddate');
|
||||||
|
if($enddate === ''){$enddate=null;}
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'startdate' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'startdate' => $this->request->getVar('startdate'),
|
||||||
|
'enddate' => $enddate,
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$usersLogModel = new UsersLogModel();
|
||||||
|
$usersLogModel->update($userlogid, $data['new_value']);
|
||||||
|
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('userslog_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('userslog_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hapus History Jabatan
|
||||||
|
public function users_log_delete($userlogid = 0) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "DELETE FROM users_log WHERE userlogid='$userlogid'";
|
||||||
|
if($db->query($sql)) {
|
||||||
|
//return view('form_success');
|
||||||
|
return redirect()->to('/users');}
|
||||||
|
else {
|
||||||
|
//return view('form_fail');
|
||||||
|
return redirect()->to('/users');}
|
||||||
|
}
|
||||||
|
}
|
||||||
95
app/Controllers/Vendors.php
Normal file
95
app/Controllers/Vendors.php
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\VendorsModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class Vendors extends Controller {
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM vendors";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['vendors'] = $results;
|
||||||
|
return view('vendors_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($vendorid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM vendors WHERE vendorid='$vendorid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['vendors'] = $results;
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'vendorid' => 'required',
|
||||||
|
'vendorname' => 'required',
|
||||||
|
'initial' => 'required',
|
||||||
|
'principal' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'vendorid' => $this->request->getVar('vendorid'),
|
||||||
|
'vendorname' => $this->request->getVar('vendorname'),
|
||||||
|
'initial' => $this->request->getVar('initial'),
|
||||||
|
'principal' => $this->request->getVar('principal'),
|
||||||
|
'email_1' => $this->request->getVar('email_1'),
|
||||||
|
'email_2' => $this->request->getVar('email_2'),
|
||||||
|
'phone' => $this->request->getVar('phone'),
|
||||||
|
'website' => $this->request->getVar('website')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$vendorsModel = new VendorsModel();
|
||||||
|
$vendorsModel->update($vendorid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('vendors_edit',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('vendors_edit', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'vendorname' => 'required',
|
||||||
|
'initial' => 'required',
|
||||||
|
'principal' => 'required',
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'vendorname' => $this->request->getVar('vendorname'),
|
||||||
|
'initial' => $this->request->getVar('initial'),
|
||||||
|
'principal' => $this->request->getVar('principal'),
|
||||||
|
'email_1' => $this->request->getVar('email_1'),
|
||||||
|
'email_2' => $this->request->getVar('email_2'),
|
||||||
|
'phone' => $this->request->getVar('phone'),
|
||||||
|
'website' => $this->request->getVar('website')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
$vendorsModel = new VendorsModel();
|
||||||
|
$vendorsModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$vendorsModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('vendors_create',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('vendors_create', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toggle($vendorid = 0) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "update vendors set enddate=
|
||||||
|
case when enddate is not null then null
|
||||||
|
else NOW()
|
||||||
|
end
|
||||||
|
where vendorid='$vendorid'";
|
||||||
|
if($db->query($sql)) { return view('form_success'); }
|
||||||
|
else { return view('form_fail'); }
|
||||||
|
}
|
||||||
|
}
|
||||||
72
app/Controllers/Zones.php
Normal file
72
app/Controllers/Zones.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ZonesModel;
|
||||||
|
use CodeIgniter\Controller;
|
||||||
|
|
||||||
|
class Zones extends BaseController {
|
||||||
|
|
||||||
|
protected $data = array();
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->data['zoneclass'] = array('PROP'=>'Province', 'KAB'=> 'Kabupaten', 'KOTA' => 'Kota');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index() {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$sql = "SELECT * FROM zones";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['zones'] = $results;
|
||||||
|
return view('zones_index', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($zoneid = null) {
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = array();
|
||||||
|
$data['zoneclasses'] = $this->data['zoneclass'];
|
||||||
|
|
||||||
|
$sql = "SELECT * from zones where zoneclass='PROP'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['parentzones'] = $results;
|
||||||
|
|
||||||
|
if($zoneid!= 0) {
|
||||||
|
$sql = "SELECT * from zones where zoneid='$zoneid'";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['zones'] = $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->getMethod() === 'post') {
|
||||||
|
$rules = [
|
||||||
|
'zonecode' => 'required',
|
||||||
|
'zoneclass' => 'required',
|
||||||
|
'zonename' => 'required'
|
||||||
|
];
|
||||||
|
$data['new_value'] = [
|
||||||
|
'zonecode' => $this->request->getVar('zonecode'),
|
||||||
|
'zoneclass' => $this->request->getVar('zoneclass'),
|
||||||
|
'zonename' => $this->request->getVar('zonename')
|
||||||
|
];
|
||||||
|
if($this->validate($rules)){
|
||||||
|
if($zoneid!= 0 ) {
|
||||||
|
$zonesModel = new ZonesModel();
|
||||||
|
$zonesModel->update($zoneid, $data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
} else {
|
||||||
|
$zonesModel = new ZonesModel();
|
||||||
|
$zonesModel->set('createdate', 'NOW()', FALSE);
|
||||||
|
$zonesModel->insert($data['new_value']);
|
||||||
|
return view('form_success');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$data['validation'] = $this->validator;
|
||||||
|
return view('zones_editor',$data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('zones_editor', $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
0
app/Database/Migrations/.gitkeep
Normal file
0
app/Database/Migrations/.gitkeep
Normal file
0
app/Database/Seeds/.gitkeep
Normal file
0
app/Database/Seeds/.gitkeep
Normal file
0
app/Filters/.gitkeep
Normal file
0
app/Filters/.gitkeep
Normal file
19
app/Filters/Auth.php
Normal file
19
app/Filters/Auth.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Filters;
|
||||||
|
|
||||||
|
use CodeIgniter\HTTP\RequestInterface;
|
||||||
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
|
use CodeIgniter\Filters\FilterInterface;
|
||||||
|
|
||||||
|
class Auth implements FilterInterface {
|
||||||
|
|
||||||
|
public function before(RequestInterface $request, $arguments = null) {
|
||||||
|
if (!session()->get('userid')) {
|
||||||
|
return redirect()->to('/auth/login');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
0
app/Helpers/.gitkeep
Normal file
0
app/Helpers/.gitkeep
Normal file
0
app/Language/.gitkeep
Normal file
0
app/Language/.gitkeep
Normal file
4
app/Language/en/Validation.php
Normal file
4
app/Language/en/Validation.php
Normal 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
0
app/Libraries/.gitkeep
Normal file
0
app/Models/.gitkeep
Normal file
0
app/Models/.gitkeep
Normal file
12
app/Models/AccountsModel.php
Normal file
12
app/Models/AccountsModel.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class AccountsModel extends Model {
|
||||||
|
protected $table = 'accounts';
|
||||||
|
protected $primaryKey = 'accountid';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'parentaccount', 'accountname', 'accountnpwp', 'initial', 'street_1', 'street_2', 'street_3',
|
||||||
|
'zoneid', 'zip', 'country', 'email_1', 'email_2', 'phone', 'fax', 'createdate'
|
||||||
|
];
|
||||||
|
}
|
||||||
9
app/Models/ActTextModel.php
Normal file
9
app/Models/ActTextModel.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ActTextModel extends Model {
|
||||||
|
protected $table = 'acttext';
|
||||||
|
protected $primaryKey = 'acttextid';
|
||||||
|
protected $allowedFields = [ 'acttextcode', 'fulltext', 'createdate' ];
|
||||||
|
}
|
||||||
9
app/Models/ActTypeModel.php
Normal file
9
app/Models/ActTypeModel.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ActTypeModel extends Model {
|
||||||
|
protected $table = 'acttype';
|
||||||
|
protected $primaryKey = 'acttypeid';
|
||||||
|
protected $allowedFields = [ 'acttypecode', 'fulltext', 'createdate' ];
|
||||||
|
}
|
||||||
9
app/Models/ActdetailModel.php
Normal file
9
app/Models/ActdetailModel.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ActdetailModel extends Model {
|
||||||
|
protected $table = 'actdetail';
|
||||||
|
protected $primaryKey = 'actdetailid';
|
||||||
|
protected $allowedFields = [ 'actid', 'detail', 'solution', 'suggestion', 'createdate'];
|
||||||
|
}
|
||||||
14
app/Models/ActivitiesModel.php
Normal file
14
app/Models/ActivitiesModel.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ActivitiesModel extends Model {
|
||||||
|
protected $table = 'activities';
|
||||||
|
protected $primaryKey = 'actid';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'ref_actid', 'acttypeid', 'subject', 'actby', 'productid', 'siteid', 'vendorid',
|
||||||
|
'contactid', 'media', 'action', 'swversion',
|
||||||
|
'userid_creator', 'userid_owner', 'reportfrom', 'reportdate',
|
||||||
|
'opendate', 'closedate', 'activitystatus', 'attachment'
|
||||||
|
];
|
||||||
|
}
|
||||||
9
app/Models/AreasModel.php
Normal file
9
app/Models/AreasModel.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ZonesModel extends Model {
|
||||||
|
protected $table = 'areas';
|
||||||
|
protected $primaryKey = 'areaid';
|
||||||
|
protected $allowedFields = [ 'areatype', 'areaname', 'description' ];
|
||||||
|
}
|
||||||
11
app/Models/BugCommentModel.php
Normal file
11
app/Models/BugCommentModel.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class BugCommentModel extends Model {
|
||||||
|
protected $table = 'bugcomment';
|
||||||
|
protected $primaryKey = 'bugcommentid';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'bugcommenttext', 'userid', 'bugid', 'logdate',
|
||||||
|
];
|
||||||
|
}
|
||||||
11
app/Models/BugsModel.php
Normal file
11
app/Models/BugsModel.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class BugsModel extends Model {
|
||||||
|
protected $table = 'bugs';
|
||||||
|
protected $primaryKey = 'bugid';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'bugtitle', 'bugstatus', 'bugdetail', 'bugpriority', 'userid_creator', 'userid_closer', 'reportdate', 'closedate',
|
||||||
|
];
|
||||||
|
}
|
||||||
11
app/Models/ContactsModel.php
Normal file
11
app/Models/ContactsModel.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ContactsModel extends Model {
|
||||||
|
protected $table = 'contacts';
|
||||||
|
protected $primaryKey = 'contactid';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'firstname', 'lastname', 'title', 'initial', 'birthdate', 'email_1', 'email_2', 'phone', 'mobile_1', 'mobile_2', 'createdate', 'enddate'
|
||||||
|
];
|
||||||
|
}
|
||||||
11
app/Models/GuidebookModel.php
Normal file
11
app/Models/GuidebookModel.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class GuidebookModel extends Model {
|
||||||
|
protected $table = 'guidebooks';
|
||||||
|
protected $primaryKey = 'guideid';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'guidetitle', 'guidedetail', 'guidecategory', 'userid_creator', 'createdate'
|
||||||
|
];
|
||||||
|
}
|
||||||
9
app/Models/InvCountersModel.php
Normal file
9
app/Models/InvCountersModel.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class InvcountersModel extends Model {
|
||||||
|
protected $table = 'invcounters';
|
||||||
|
protected $primaryKey = 'counterid';
|
||||||
|
protected $allowedFields = [ 'counternumber', 'countername', 'createdate' ];
|
||||||
|
}
|
||||||
13
app/Models/InvTransModel.php
Normal file
13
app/Models/InvTransModel.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class InvtransModel extends Model {
|
||||||
|
protected $table = 'invtrans';
|
||||||
|
protected $primaryKey = 'itxid';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'catalogid', 'unitgroupid', 'qty', 'lotnumber', 'origtype', 'origid',
|
||||||
|
'desttype', 'destid', 'purpose', 'conditions', 'actid',
|
||||||
|
'itxdatetime', 'apprtype', 'apprid', 'apprdate', 'createdate'
|
||||||
|
];
|
||||||
|
}
|
||||||
9
app/Models/MailgroupsModel.php
Normal file
9
app/Models/MailgroupsModel.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class MailgroupsModel extends Model {
|
||||||
|
protected $table = 'mailgroups';
|
||||||
|
protected $primaryKey = 'mailgroupid';
|
||||||
|
protected $allowedFields = [ 'mailgroupname', 'mailgrouptext', 'createdate', 'enddate' ];
|
||||||
|
}
|
||||||
10
app/Models/OfficesModel.php
Normal file
10
app/Models/OfficesModel.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class OfficesModel extends Model {
|
||||||
|
protected $table = 'offices';
|
||||||
|
protected $primaryKey = 'offid';
|
||||||
|
protected $allowedFields = [ 'offname', 'offaddress', 'offphone', 'createdate' ];
|
||||||
|
}
|
||||||
9
app/Models/ProductAliasModel.php
Normal file
9
app/Models/ProductAliasModel.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ProductAliasModel extends Model {
|
||||||
|
protected $table = 'productalias';
|
||||||
|
protected $primaryKey = 'productaliasid';
|
||||||
|
protected $allowedFields = [ 'productaliastext', 'createdate' ];
|
||||||
|
}
|
||||||
10
app/Models/ProductCatalogModel.php
Normal file
10
app/Models/ProductCatalogModel.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ProductCatalogModel extends Model {
|
||||||
|
protected $table = 'productcatalog';
|
||||||
|
protected $primaryKey = 'catalogid';
|
||||||
|
protected $allowedFields = [ 'catalognumber', 'productname', 'vendorid', 'nie', 'producttypeid', 'manufacturer',
|
||||||
|
'productaliasid', 'createdate', 'enddate' ];
|
||||||
|
}
|
||||||
9
app/Models/ProductServiceModel.php
Normal file
9
app/Models/ProductServiceModel.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ProductServiceModel extends Model {
|
||||||
|
protected $table = 'productservice';
|
||||||
|
protected $primaryKey = 'productserviceid';
|
||||||
|
protected $allowedFields = [ 'productservicetext' ];
|
||||||
|
}
|
||||||
9
app/Models/ProductTypeModel.php
Normal file
9
app/Models/ProductTypeModel.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ProductTypeModel extends Model {
|
||||||
|
protected $table = 'producttype';
|
||||||
|
protected $primaryKey = 'producttypeid';
|
||||||
|
protected $allowedFields = [ 'texts', 'createdate', 'enddate' ];
|
||||||
|
}
|
||||||
10
app/Models/ProductsLogModel.php
Normal file
10
app/Models/ProductsLogModel.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ProductsLogModel extends Model {
|
||||||
|
protected $table = 'products_log';
|
||||||
|
protected $primaryKey = 'productlogid';
|
||||||
|
protected $allowedFields = [ 'productid', 'catalogid', 'siteid', 'locationstartdate', 'locationenddate',
|
||||||
|
'installationdate', 'warrantystartdate', 'warrantyenddate', 'productowner', 'productserviceid', 'logdate' ];
|
||||||
|
}
|
||||||
12
app/Models/ProductsModel.php
Normal file
12
app/Models/ProductsModel.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class ProductsModel extends Model {
|
||||||
|
protected $table = 'products';
|
||||||
|
protected $primaryKey = 'productid';
|
||||||
|
protected $allowedFields = [ 'siteid', 'productnumber', 'productname', 'catalogid',
|
||||||
|
'installationdate', 'locationstartdate', 'locationenddate', 'warrantystartdate', 'warrantyenddate',
|
||||||
|
'productowner', 'productserviceid', 'statuspart',
|
||||||
|
'remotetool', 'remoteid', 'remotepwd', 'createdate', 'enddate' ];
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user