first commit

This commit is contained in:
2024-01-08 09:33:24 +07:00
commit ed1d4a2b08
2369 changed files with 875560 additions and 0 deletions

15
.editorconfig Normal file
View File

@@ -0,0 +1,15 @@
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
# Set default charset
[*]
charset = utf-8
# Tab indentation (no size specified)
indent_style = tab

34
.gitignore vendored Normal file
View File

@@ -0,0 +1,34 @@
.DS_Store
application/cache/*
!application/cache/index.html
application/logs/*
!application/logs/index.html
!application/*/.htaccess
composer.lock
tests/mocks/database/ci_test.sqlite
assets/img/upload
user_guide_src/build/*
user_guide_src/cilexer/build/*
user_guide_src/cilexer/dist/*
user_guide_src/cilexer/pycilexer.egg-info/*
/vendor/
# IDE Files
#-------------------------
/nbproject/
.idea/*
## Sublime Text cache files
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project
/tests/tests/
/tests/results/

9
.htaccess Normal file
View File

@@ -0,0 +1,9 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /starter_template_ci_adminlte/index.php/$1 [L]
</IfModule>

6
application/.htaccess Normal file
View File

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

11
application/cache/index.html vendored Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,135 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('database', 'session', 'encryption', 'form_validation');
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
|
| You can also supply an alternative property name to be assigned in
| the controller:
|
| $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('file', 'url', 'form', 'security', 'app');
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('first_model', 'second_model');
|
| You can also supply an alternative model name to be assigned
| in the controller:
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array();

View File

@@ -0,0 +1,534 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
| http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try to guess the protocol and
| path to your installation, but due to security concerns the hostname will
| be set to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://" . $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$config['index_page'] = '';
/*
|--------------------------------------------------------------------------
| 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!
*/
$config['uri_protocol'] = 'REQUEST_URI';
/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| https://codeigniter.com/userguide3/general/urls.html
|
| Note: This option is ignored for CLI requests.
*/
$config['url_suffix'] = '';
/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$config['charset'] = 'UTF-8';
/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the 'hooks' feature you must enable it by
| setting this variable to TRUE (boolean). See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;
/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries. For more information please see the user guide:
|
| https://codeigniter.com/userguide3/general/core_classes.html
| https://codeigniter.com/userguide3/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = FALSE;
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
/*
|--------------------------------------------------------------------------
| Allow $_GET array
|--------------------------------------------------------------------------
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['allow_get_array'] = TRUE;
/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
| 0 = Disables logging, Error logging TURNED OFF
| 1 = Error Messages (including PHP errors)
| 2 = Debug Messages
| 3 = Informational Messages
| 4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
| array(2) = Debug Messages, without Error Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;
/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ directory. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';
/*
|--------------------------------------------------------------------------
| Log File Extension
|--------------------------------------------------------------------------
|
| The default filename extension for log files. The default '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 'php'.
|
*/
$config['log_file_extension'] = '';
/*
|--------------------------------------------------------------------------
| Log File Permissions
|--------------------------------------------------------------------------
|
| 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.)
*/
$config['log_file_permissions'] = 0644;
/*
|--------------------------------------------------------------------------
| 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
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';
/*
|--------------------------------------------------------------------------
| Error Views Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/views/errors/ directory. Use a full server path with trailing slash.
|
*/
$config['error_views_path'] = '';
/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/cache/ directory. Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$config['cache_query_string'] = FALSE;
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class, you must set an encryption key.
| See the user guide for more info.
|
| https://codeigniter.com/userguide3/libraries/encryption.html
|
*/
$config['encryption_key'] = '';
/*
|--------------------------------------------------------------------------
| Session Variables
|--------------------------------------------------------------------------
|
| 'sess_driver'
|
| The storage driver to use: files, database, redis, memcached
|
| 'sess_cookie_name'
|
| The session cookie name, must contain only [0-9a-z_-] characters
|
| 'sess_samesite'
|
| Session cookie SameSite attribute: Lax (default), Strict or None
|
| 'sess_expiration'
|
| The number of SECONDS you want the session to last.
| Setting to 0 (zero) means expire when the browser is closed.
|
| 'sess_save_path'
|
| The location to save sessions to, 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!
|
| 'sess_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.
|
| 'sess_time_to_update'
|
| How many seconds between CI regenerating the session ID.
|
| 'sess_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.
|
| Other session cookie settings are shared with the rest of the application,
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
*/
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_samesite'] = 'Lax';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a cookie name prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path' = Typically will be a forward slash
| 'cookie_secure' = Cookie will only be set if a secure HTTPS connection exists.
| 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)
| 'cookie_samesite' = Cookie's samesite attribute (Lax, Strict or None)
|
| Note: These settings (with the exception of 'cookie_prefix' and
| 'cookie_httponly') will also affect sessions.
|
*/
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['cookie_samesite'] = 'Lax';
/*
|--------------------------------------------------------------------------
| Standardize newlines
|--------------------------------------------------------------------------
|
| Determines whether to standardize newline characters in input data,
| meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['standardize_newlines'] = FALSE;
/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
| WARNING: This feature is DEPRECATED and currently available only
| for backwards compatibility purposes!
|
*/
$config['global_xss_filtering'] = FALSE;
/*
|--------------------------------------------------------------------------
| Cross Site Request Forgery
|--------------------------------------------------------------------------
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
| checked on a submitted form. If you are accepting user data, it is strongly
| recommended CSRF protection be enabled.
|
| 'csrf_token_name' = The token name
| 'csrf_cookie_name' = The cookie name
| 'csrf_expire' = The number in seconds the token should expire.
| 'csrf_regenerate' = Regenerate token on every submission
| 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
*/
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads. When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| Only used if zlib.output_compression is turned off in your php.ini.
| Please do not use it together with httpd-level output compression.
|
| VERY IMPORTANT: If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts. For
| compression to work, nothing can be sent before the output buffer is called
| by the output class. Do not 'echo' any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are 'local' or any PHP supported timezone. This preference tells
| the system whether to use your server's local time as the master 'now'
| reference, or convert it to the configured one timezone. See the 'date
| helper' page of the user guide for information regarding date handling.
|
*/
$config['time_reference'] = 'local';
/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files. Options are TRUE or FALSE (boolean)
|
| Note: You need to have eval() enabled for this to work.
|
*/
$config['rewrite_short_tags'] = FALSE;
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy
| IP addresses from which CodeIgniter should trust headers such as
| 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: array('10.0.1.200', '192.168.5.0/24')
*/
$config['proxy_ips'] = '';

View File

@@ -0,0 +1,85 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Display Debug backtrace
|--------------------------------------------------------------------------
|
| If set to TRUE, a backtrace will be displayed along with php errors. If
| error_reporting is disabled, the backtrace will not display, regardless
| of this setting
|
*/
defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
/*
|--------------------------------------------------------------------------
| File and Directory Modes
|--------------------------------------------------------------------------
|
| These prefs are used when checking and setting modes when working
| with the file system. The defaults are fine on servers with proper
| security, but you may wish (or even need) to change the values in
| certain environments (Apache running a separate process for each
| user, PHP under CGI with Apache suEXEC, etc.). Octal values should
| always be used to set the mode correctly.
|
*/
defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);
defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
defined('DIR_READ_MODE') OR define('DIR_READ_MODE', 0755);
defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);
/*
|--------------------------------------------------------------------------
| File Stream Modes
|--------------------------------------------------------------------------
|
| These modes are used when working with fopen()/popen()
|
*/
defined('FOPEN_READ') OR define('FOPEN_READ', 'rb');
defined('FOPEN_READ_WRITE') OR define('FOPEN_READ_WRITE', 'r+b');
defined('FOPEN_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
defined('FOPEN_WRITE_CREATE') OR define('FOPEN_WRITE_CREATE', 'ab');
defined('FOPEN_READ_WRITE_CREATE') OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
defined('FOPEN_WRITE_CREATE_STRICT') OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
defined('FOPEN_READ_WRITE_CREATE_STRICT') OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
/*
|--------------------------------------------------------------------------
| 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') OR define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') OR define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') OR define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') OR define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') OR define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') OR define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code

View File

@@ -0,0 +1,96 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
| ['dsn'] The full DSN string describe a connection to the database.
| ['hostname'] The hostname of your database server.
| ['username'] The username used to connect to the database
| ['password'] The password used to connect to the database
| ['database'] The name of the database you want to connect to
| ['dbdriver'] The database driver. e.g.: mysqli.
| Currently supported:
| cubrid, ibase, mssql, mysql, mysqli, oci8,
| odbc, pdo, postgre, sqlite, sqlite3, sqlsrv
| ['dbprefix'] You can add an optional prefix, which will be added
| to the table name when using the Query Builder class
| ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
| ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
| ['cache_on'] TRUE/FALSE - Enables/disables query caching
| ['cachedir'] The path to the folder where cache files should be stored
| ['char_set'] The character set used in communicating with the database
| ['dbcollat'] The character collation used in communicating with the database
| NOTE: For MySQL and MySQLi databases, this setting is only used
| as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
| (and in table creation queries made with DB Forge).
| There is an incompatibility in PHP with mysql_real_escape_string() which
| can make your site vulnerable to SQL injection if you are using a
| multi-byte character set and are running versions lower than these.
| Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
| ['swap_pre'] A default table prefix that should be swapped with the dbprefix
| ['encrypt'] Whether or not to use an encrypted connection.
|
| 'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE
| 'mysqli' and 'pdo/mysql' drivers accept an array with the following options:
|
| 'ssl_key' - Path to the private key file
| 'ssl_cert' - Path to the public key certificate file
| 'ssl_ca' - Path to the certificate authority file
| 'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format
| 'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')
| 'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not
|
| ['compress'] Whether or not to use client compression (MySQL only)
| ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
| - good for ensuring strict SQL while developing
| ['ssl_options'] Used to set various SSL options that can be used when making SSL connections.
| ['failover'] array - A array with 0 or more data for connections if the main should fail.
| ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.
| NOTE: Disabling this will also effectively disable both
| $this->db->last_query() and profiling of DB queries.
| When you run a query, with this setting set to TRUE (default),
| CodeIgniter will store the SQL statement for debugging purposes.
| However, this may cause high memory usage, especially if you run
| a lot of SQL queries ... disable this to avoid that problem.
|
| The $active_group variable lets you choose which connection group to
| make active. By default there is only one group (the 'default' group).
|
| The $query_builder variables lets you determine whether or not to load
| the query builder class.
*/
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'starter_template_ci',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);

View File

@@ -0,0 +1,24 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$_doctypes = array(
'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">'
);

View File

@@ -0,0 +1,114 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Foreign Characters
| -------------------------------------------------------------------
| This file contains an array of foreign characters for transliteration
| conversion used by the Text helper
|
*/
$foreign_characters = array(
'/ä|æ|ǽ/' => 'ae',
'/ö|œ/' => 'oe',
'/ü/' => 'ue',
'/Ä/' => 'Ae',
'/Ü/' => 'Ue',
'/Ö/' => 'Oe',
'/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ|Α|Ά|Ả|Ạ|Ầ|Ẫ|Ẩ|Ậ|Ằ|Ắ|Ẵ|Ẳ|Ặ|А/' => 'A',
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª|α|ά|ả|ạ|ầ|ấ|ẫ|ẩ|ậ|ằ|ắ|ẵ|ẳ|ặ|а/' => 'a',
'/Б/' => 'B',
'/б/' => 'b',
'/Ç|Ć|Ĉ|Ċ|Č/' => 'C',
'/ç|ć|ĉ|ċ|č/' => 'c',
'/Д|Δ/' => 'D',
'/д|δ/' => 'd',
'/Ð|Ď|Đ/' => 'Dj',
'/ð|ď|đ/' => 'dj',
'/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě|Ε|Έ|Ẽ|Ẻ|Ẹ|Ề|Ế|Ễ|Ể|Ệ|Е|Э/' => 'E',
'/è|é|ê|ë|ē|ĕ|ė|ę|ě|έ|ε|ẽ|ẻ|ẹ|ề|ế|ễ|ể|ệ|е|э/' => 'e',
'/Ф/' => 'F',
'/ф/' => 'f',
'/Ĝ|Ğ|Ġ|Ģ|Γ|Г|Ґ/' => 'G',
'/ĝ|ğ|ġ|ģ|γ|г|ґ/' => 'g',
'/Ĥ|Ħ/' => 'H',
'/ĥ|ħ/' => 'h',
'/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ|Η|Ή|Ί|Ι|Ϊ|Ỉ|Ị|И|Ы/' => 'I',
'/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı|η|ή|ί|ι|ϊ|ỉ|ị|и|ы|ї/' => 'i',
'/Ĵ/' => 'J',
'/ĵ/' => 'j',
'/Θ/' => 'TH',
'/θ/' => 'th',
'/Ķ|Κ|К/' => 'K',
'/ķ|κ|к/' => 'k',
'/Ĺ|Ļ|Ľ|Ŀ|Ł|Λ|Л/' => 'L',
'/ĺ|ļ|ľ|ŀ|ł|λ|л/' => 'l',
'/М/' => 'M',
'/м/' => 'm',
'/Ñ|Ń|Ņ|Ň|Ν|Н/' => 'N',
'/ñ|ń|ņ|ň|ʼn|ν|н/' => 'n',
'/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ|Ο|Ό|Ω|Ώ|Ỏ|Ọ|Ồ|Ố|Ỗ|Ổ|Ộ|Ờ|Ớ|Ỡ|Ở|Ợ|О/' => 'O',
'/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º|ο|ό|ω|ώ|ỏ|ọ|ồ|ố|ỗ|ổ|ộ|ờ|ớ|ỡ|ở|ợ|о/' => 'o',
'/П/' => 'P',
'/п/' => 'p',
'/Ŕ|Ŗ|Ř|Ρ|Р/' => 'R',
'/ŕ|ŗ|ř|ρ|р/' => 'r',
'/Ś|Ŝ|Ş|Ș|Š|Σ|С/' => 'S',
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|Τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|τ|т/' => 't',
'/Þ|þ/' => 'th',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ƴ|Ɏ|Ỵ|Ẏ|Ӳ|Ӯ|Ў|Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
'/ẙ|ʏ|ƴ|ɏ|ỵ|ẏ|ӳ|ӯ|ў|ý|ÿ|ŷ|ỳ|ỹ|ỷ|ỵ|й/' => 'y',
'/В/' => 'V',
'/в/' => 'v',
'/Ŵ/' => 'W',
'/ŵ/' => 'w',
'/Φ/' => 'F',
'/φ/' => 'f',
'/Χ/' => 'CH',
'/χ/' => 'ch',
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
'/ź|ż|ž|ζ|з/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/' => 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f',
'/Ξ/' => 'KS',
'/ξ/' => 'ks',
'/Π/' => 'P',
'/π/' => 'p',
'/Β/' => 'V',
'/β/' => 'v',
'/Μ/' => 'M',
'/μ/' => 'm',
'/Ψ/' => 'PS',
'/ψ/' => 'ps',
'/Ё/' => 'Yo',
'/ё/' => 'yo',
'/Є/' => 'Ye',
'/є/' => 'ye',
'/Ї/' => 'Yi',
'/Ж/' => 'Zh',
'/ж/' => 'zh',
'/Х/' => 'Kh',
'/х/' => 'kh',
'/Ц/' => 'Ts',
'/ц/' => 'ts',
'/Ч/' => 'Ch',
'/ч/' => 'ch',
'/Ш/' => 'Sh',
'/ш/' => 'sh',
'/Щ/' => 'Shch',
'/щ/' => 'shch',
'/Ъ|ъ|Ь|ь/' => '',
'/Ю/' => 'Yu',
'/ю/' => 'yu',
'/Я/' => 'Ya',
'/я/' => 'ya'
);

View File

@@ -0,0 +1,13 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
| files. Please see the user guide for info:
|
| https://codeigniter.com/userguide3/general/hooks.html
|
*/

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,19 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Memcached settings
| -------------------------------------------------------------------------
| Your Memcached servers can be specified below.
|
| See: https://codeigniter.com/userguide3/libraries/caching.html#memcached
|
*/
$config = array(
'default' => array(
'hostname' => '127.0.0.1',
'port' => '11211',
'weight' => '1',
),
);

View File

@@ -0,0 +1,84 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| Enable/Disable Migrations
|--------------------------------------------------------------------------
|
| Migrations are disabled by default for security reasons.
| You should enable migrations whenever you intend to do a schema migration
| and disable it back when you're done.
|
*/
$config['migration_enabled'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migration Type
|--------------------------------------------------------------------------
|
| Migration file names may be based on a sequential identifier or on
| a timestamp. Options are:
|
| 'sequential' = Sequential migration naming (001_add_blog.php)
| 'timestamp' = Timestamp migration naming (20121031104401_add_blog.php)
| Use timestamp format YYYYMMDDHHIISS.
|
| Note: If this configuration value is missing the Migration library
| defaults to 'sequential' for backward compatibility with CI2.
|
*/
$config['migration_type'] = 'timestamp';
/*
|--------------------------------------------------------------------------
| 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.
|
*/
$config['migration_table'] = 'migrations';
/*
|--------------------------------------------------------------------------
| Auto Migrate To Latest
|--------------------------------------------------------------------------
|
| If this is set to TRUE when you load the migrations class and have
| $config['migration_enabled'] set to TRUE the system will auto migrate
| to your latest migration (whatever $config['migration_version'] is
| set to). This way you do not have to call migrations anywhere else
| in your code to have the latest migration.
|
*/
$config['migration_auto_latest'] = FALSE;
/*
|--------------------------------------------------------------------------
| Migrations version
|--------------------------------------------------------------------------
|
| This is used to set migration version that the file system should be on.
| If you run $this->migration->current() this is the version that schema will
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 0;
/*
|--------------------------------------------------------------------------
| Migrations Path
|--------------------------------------------------------------------------
|
| Path to your migrations folder.
| Typically, it will be within your application path.
| Also, writing permission is required within the migrations path.
|
*/
$config['migration_path'] = APPPATH.'migrations/';

View File

@@ -0,0 +1,186 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
return array(
'hqx' => array('application/mac-binhex40', 'application/mac-binhex', 'application/x-binhex40', 'application/x-mac-binhex40'),
'cpt' => 'application/mac-compactpro',
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain'),
'bin' => array('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' => array('application/octet-stream', 'application/x-msdownload'),
'class' => 'application/octet-stream',
'psd' => array('application/x-photoshop', 'image/vnd.adobe.photoshop'),
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => array('application/pdf', 'application/force-download', 'application/x-download', 'binary/octet-stream'),
'ai' => array('application/pdf', 'application/postscript'),
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => array('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' => array('application/powerpoint', 'application/vnd.ms-powerpoint', 'application/vnd.ms-office', 'application/msword'),
'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/x-zip', 'application/zip'),
'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' => array('application/x-httpd-php', 'application/php', 'application/x-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' => array('application/x-javascript', 'text/plain'),
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => array('application/x-tar', 'application/x-gzip-compressed'),
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip'),
'rar' => array('application/x-rar', 'application/rar', 'application/x-rar-compressed'),
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),
'aif' => array('audio/x-aiff', 'audio/aiff'),
'aiff' => array('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' => array('audio/x-wav', 'audio/wave', 'audio/wav'),
'bmp' => array('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',
'jpeg' => array('image/jpeg', 'image/pjpeg'),
'jpg' => array('image/jpeg', 'image/pjpeg'),
'jpe' => array('image/jpeg', 'image/pjpeg'),
'jp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'j2k' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpf' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpg2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpx' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'jpm' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mj2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'mjp2' => array('image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'),
'png' => array('image/png', 'image/x-png'),
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'heic' => 'image/heic',
'heif' => 'image/heif',
'css' => array('text/css', 'text/plain'),
'html' => array('text/html', 'text/plain'),
'htm' => array('text/html', 'text/plain'),
'shtml' => array('text/html', 'text/plain'),
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => array('text/plain', 'text/x-log'),
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => array('application/xml', 'text/xml', 'text/plain'),
'xsl' => array('application/xml', 'text/xsl', 'text/xml'),
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => array('video/x-msvideo', 'video/msvideo', 'video/avi', 'application/x-troff-msvideo'),
'movie' => 'video/x-sgi-movie',
'doc' => array('application/msword', 'application/vnd.ms-office'),
'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword', 'application/x-zip'),
'dot' => array('application/msword', 'application/vnd.ms-office'),
'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'),
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'),
'word' => array('application/msword', 'application/octet-stream'),
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => array('application/json', 'text/json'),
'pem' => array('application/x-x509-user-cert', 'application/x-pem-file', 'application/octet-stream'),
'p10' => array('application/x-pkcs10', 'application/pkcs10'),
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7m' => array('application/pkcs7-mime', 'application/x-pkcs7-mime'),
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => array('application/x-x509-ca-cert', 'application/x-x509-user-cert', 'application/pkix-cert'),
'crl' => array('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' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
'3g2' => 'video/3gpp2',
'3gp' => array('video/3gp', 'video/3gpp'),
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => array('video/mp4', 'video/x-f4v'),
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => array('audio/x-aac', 'audio/aac'),
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => array('video/x-ms-wmv', 'video/x-ms-asf'),
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => array('audio/ogg', 'video/ogg', 'application/ogg'),
'kmz' => array('application/vnd.google-earth.kmz', 'application/zip', 'application/x-zip'),
'kml' => array('application/vnd.google-earth.kml+xml', 'application/xml', 'text/xml'),
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7z' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'7zip' => array('application/x-7z-compressed', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip'),
'cdr' => array('application/cdr', 'application/coreldraw', 'application/x-cdr', 'application/x-coreldraw', 'image/cdr', 'image/x-cdr', 'zz-application/zz-winassoc-cdr'),
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
'svg' => array('image/svg+xml', 'image/svg', 'application/xml', 'text/xml'),
'vcf' => 'text/x-vcard',
'srt' => array('text/srt', 'text/plain'),
'vtt' => array('text/vtt', 'text/plain'),
'ico' => array('image/x-icon', 'image/x-ico', 'image/vnd.microsoft.icon'),
'odc' => 'application/vnd.oasis.opendocument.chart',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'odf' => 'application/vnd.oasis.opendocument.formula',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'odi' => 'application/vnd.oasis.opendocument.image',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'odt' => 'application/vnd.oasis.opendocument.text',
'odm' => 'application/vnd.oasis.opendocument.text-master',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oth' => 'application/vnd.oasis.opendocument.text-web'
);

View File

@@ -0,0 +1,14 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Profiler Sections
| -------------------------------------------------------------------------
| This file lets you determine whether or not various sections of Profiler
| data are displayed when the Profiler is enabled.
| Please see the user guide for info:
|
| https://codeigniter.com/userguide3/general/profiling.html
|
*/

View File

@@ -0,0 +1,54 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
| example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
| https://codeigniter.com/userguide3/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
| $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
| $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
$route['default_controller'] = 'site/login';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

View File

@@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| SMILEYS
| -------------------------------------------------------------------
| This file contains an array of smileys for use with the emoticon helper.
| Individual images can be used to replace multiple smileys. For example:
| :-) and :) use the same image replacement.
|
| Please see user guide for more info:
| https://codeigniter.com/userguide3/helpers/smiley_helper.html
|
*/
$smileys = array(
// smiley image name width height alt
':-)' => array('grin.gif', '19', '19', 'grin'),
':lol:' => array('lol.gif', '19', '19', 'LOL'),
':cheese:' => array('cheese.gif', '19', '19', 'cheese'),
':)' => array('smile.gif', '19', '19', 'smile'),
';-)' => array('wink.gif', '19', '19', 'wink'),
';)' => array('wink.gif', '19', '19', 'wink'),
':smirk:' => array('smirk.gif', '19', '19', 'smirk'),
':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'),
':-S' => array('confused.gif', '19', '19', 'confused'),
':wow:' => array('surprise.gif', '19', '19', 'surprised'),
':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'),
':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'),
'%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'),
';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'),
':P' => array('raspberry.gif', '19', '19', 'raspberry'),
':blank:' => array('blank.gif', '19', '19', 'blank stare'),
':long:' => array('longface.gif', '19', '19', 'long face'),
':ohh:' => array('ohh.gif', '19', '19', 'ohh'),
':grrr:' => array('grrr.gif', '19', '19', 'grrr'),
':gulp:' => array('gulp.gif', '19', '19', 'gulp'),
'8-/' => array('ohoh.gif', '19', '19', 'oh oh'),
':down:' => array('downer.gif', '19', '19', 'downer'),
':red:' => array('embarrassed.gif', '19', '19', 'red face'),
':sick:' => array('sick.gif', '19', '19', 'sick'),
':shut:' => array('shuteye.gif', '19', '19', 'shut eye'),
':-/' => array('hmm.gif', '19', '19', 'hmmm'),
'>:(' => array('mad.gif', '19', '19', 'mad'),
':mad:' => array('mad.gif', '19', '19', 'mad'),
'>:-(' => array('angry.gif', '19', '19', 'angry'),
':angry:' => array('angry.gif', '19', '19', 'angry'),
':zip:' => array('zip.gif', '19', '19', 'zipper'),
':kiss:' => array('kiss.gif', '19', '19', 'kiss'),
':ahhh:' => array('shock.gif', '19', '19', 'shock'),
':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'),
':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'),
':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'),
':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'),
':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'),
':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'),
':vampire:' => array('vampire.gif', '19', '19', 'vampire'),
':snake:' => array('snake.gif', '19', '19', 'snake'),
':exclaim:' => array('exclaim.gif', '19', '19', 'exclaim'),
':question:' => array('question.gif', '19', '19', 'question')
);

View File

@@ -0,0 +1,222 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| 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.
*/
$platforms = array(
'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'
);
// The order of this array should NOT be changed. Many browsers return
// multiple browser types so we want to identify the sub-type first.
$browsers = array(
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => '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'
);
$mobiles = array(
// 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',
'nexus' => 'Nexus',
'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',
'meizu' => 'Meizu',
'huawei' => 'Huawei',
'xiaomi' => 'Xiaomi',
'oppo' => 'Oppo',
'vivo' => 'Vivo',
'infinix' => 'Infinix',
// 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'
);
// There are hundreds of bots but these are the most common.
$robots = array(
'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',
'UptimeRobot' => 'UptimeRobot'
);

View File

@@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class CompanyProfile extends CI_Controller
{
var $js_page = 'profile/company_profile';
public function __construct()
{
parent::__construct();
$this->load->model('companyProfile_model');
$this->load->library('form_validation');
$this->load->helper('url');
}
public function index()
{
$data['title'] = 'Company Profile';
$data['breadcrumbs'][] = ['label' => 'Company', 'active' => 'active'];
$data['main_content'] = 'company_profile/index';
$data['data'] = $this->companyProfile_model->company_profile();
$data['js_page'] = $this->js_page;
$this->load->view('layouts/main_layout', $data);
}
public function load_setting()
{
$data['data'] = $this->companyProfile_model->company_profile();
$this->load->view('company_profile/_form', $data);
}
public function update()
{
$success = false;
$message = '';
if ($this->input->post()) {
$post = $this->input->post();
$model = $this->companyProfile_model;
$this->db->trans_begin();
$company = $model->save();
if ($company['success'] == true) {
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
} else {
$this->db->trans_commit();
$success = true;
$message = "Data Berhasil Ditambahkan!";
$this->session->set_flashdata('success', $message);
}
} else {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
}
}
redirect(site_url('companyProfile'));
}
}

View File

@@ -0,0 +1,205 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class GroupMenu extends CI_Controller
{
var $js_page = 'menu/group_menu';
public function __construct()
{
parent::__construct();
$this->load->model('authItemChild_model');
$this->load->model('menu_model');
$this->load->library('form_validation');
$this->load->helper('url');
}
public function index($error = NULL)
{
$data['error'] = $error;
$data['title'] = 'Group Menu';
$data['breadcrumbs'][] = ['label' => 'Group Menu', 'active' => 'active'];
$data['main_content'] = 'group-menu/index';
$data['data'] = $this->authItemChild_model->dataMenu();
$this->load->view('layouts/main_layout', $data);
}
public function create($error = NULL)
{
$success = false;
$message = '';
$menu = '';
$arr_menu = '';
if ($this->input->post()) {
$post = $this->input->post();
$this->db->trans_begin();
$model_menu = $this->menu_model;
$model_groupmenu = $this->authItemChild_model;
$model_menu = $model_menu->save();
$model_groupmenu = $model_groupmenu->save($model_menu);
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
redirect(site_url('groupMenu/index'));
} else {
$this->db->trans_commit();
$success = true;
$message = "Data Berhasil Ditambahkan!";
$this->session->set_flashdata('success', $message);
redirect(site_url('groupMenu/index'));
}
}
$data['error'] = $error;
$data['title'] = 'Create Group Menu';
$data['main_content'] = 'group-menu/_form';
$data['js_page'] = $this->js_page;
$data['breadcrumbs'][] = ['label' => 'Group Menu', 'url' => 'index'];
$data['breadcrumbs'][] = ['label' => 'Create', 'active' => 'active'];
$data['isNewRecord'] = true;
$data['data'] = $menu;
$data['arr_menu'] = $arr_menu;
$data['data_menu'] = $this->menu_model->getParent();
$data['cruda'] = $this->menu_model->cruda();
$this->load->view('layouts/main_layout', $data);
}
public function getChecked()
{
$post = $this->input->post();
$idArr = array();
if (isset($post['key']) && isset($post['ket'])) {
$key_post = explode('[', $_POST['key']);
$slug_post = $key_post[0];
$act_post = substr($key_post[1], 0, 1);
$this->db->where('slug', $slug_post);
$menu = $this->db->get('menu')->row();
if (isset($menu)) {
$idArr[] = $menu->slug . "[" . $act_post . "]";
// Jika di CHECKED Kecuali R ==> Maka R juga iKut
if (($act_post == 'C' || $act_post == 'U' || $act_post == 'D' || $act_post == 'A') && $_POST['ket'] == 1) {
$idArr[] = $menu->slug . "[R]";
} // Jika di UN-CHECK R ==> Maka yang lain Ikut Un-check
elseif ($act_post == 'R' && $_POST['ket'] == 0) {
foreach ($this->menu_model->cruda() as $ind => $val) {
$idArr[] = $menu->slug . "[" . $ind . "]";
}
}
// Get Child menu ==> Jika parent checked, maka child-nya semua ikut checked
foreach ($this->menu_model->cruda() as $ind => $val) {
$this->db->where('parent_id', $menu->id);
$menu_child = $this->db->get('menu')->result();
foreach ($menu_child as $child) {
if ($_POST['ket'] == 0 && $act_post == 'R') { // Jika yang di UNCHECK adalah Parent (R)
$idArr[] = $child->slug . "[" . $ind . "]";
}
$this->db->where('parent_id', $child->id);
$menu_child_2 = $this->db->get('menu')->result();
foreach ($menu_child_2 as $child2) {
if ($_POST['ket'] == 0 && $act_post == 'R') { // Jika yang di UNCHECK adalah Parent (R)
$idArr[] = $child2->slug . "[" . $ind . "]";
}
}
}
}
// Ket = 1 adalah checked
if ($_POST['ket'] == 1) {
// Jika childnya checked, maka parent atas2-nya juga di checked
$this->db->where('id', $menu->parent_id);
$parent_child = $this->db->get('menu')->row();
if (isset($parent_child)) {
$idArr[] = $parent_child->slug . "[R]";
$this->db->where('id', $parent_child->parent_id);
$parent = $this->db->get('menu')->row();
if (isset($parent)) {
$idArr[] = $parent->slug . "[R]";
}
}
}
}
echo json_encode($idArr);
}
}
public function update($id = null)
{
$id = decrypt_url($id);
$success = false;
$message = '';
$arr_group = [];
$data = [];
if ($this->input->post()) {
$post = $this->input->post();
$this->db->trans_begin();
$menu = $this->db->query("select * from menu where id = '" . $post['id'] . "'")->row();
if (isset($menu)) {
$delete_auth = $this->authItemChild_model->delete_auth($menu->slug);
if ($delete_auth['success']) {
$success = true;
if (isset($post['MenuRoleForm']['menus'])) {
foreach ($post['MenuRoleForm']['menus'] as $ind => $item) {
$this->authItemChild_model->save($menu->slug);
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
redirect(site_url('groupMenu/index'));
} else {
$this->db->trans_commit();
$success = true;
$message = "Data Berhasil Ditambahkan!";
$this->session->set_flashdata('success', $message);
redirect(site_url('groupMenu/index'));
}
}
} else {
$this->db->trans_rollback();
$this->session->set_flashdata('failed', 'Group Menu Tidak Memiliki Role!');
}
} else {
$this->db->trans_rollback();
$success = false;
$this->session->set_flashdata('failed', $delete_auth['message']);
}
} else {
$this->session->set_flashdata('failed', 'Menu Tidak Ditemukan!');
}
} else {
$this->db->from('menu');
$this->db->where('id', $id);
$menu = $this->db->get()->row();
if (isset($menu)) {
$_menu = $this->db->query("select * from auth_item_child where parent = CONCAT('GROUPMENU-','" . $menu->slug . "') and SUBSTRING(child,1,10)<>'GROUPMENU-'")->result_array();
foreach ($_menu as $ind => $item) {
$arr_menu[$item['child']] = $item['child'];
}
}
}
$data['title'] = 'Update Group Menu';
$data['main_content'] = 'group-menu/_form';
$data['js_page'] = $this->js_page;
$data['breadcrumbs'][] = ['label' => 'Group Menu', 'url' => 'index'];
$data['breadcrumbs'][] = ['label' => 'Update', 'active' => 'active'];
$data['isNewRecord'] = false;
$data['data'] = $menu;
$data['arr_menu'] = $arr_menu;
$data['data_menu'] = $this->menu_model->getParent();
$data['cruda'] = $this->menu_model->cruda();
$this->load->view('layouts/main_layout', $data);
}
}

View File

@@ -0,0 +1,137 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Menu extends CI_Controller
{
var $js_page = 'menu/menu';
public function __construct()
{
parent::__construct();
$this->load->model('menu_model');
$this->load->library('form_validation');
$this->load->helper('url');
}
public function index($error = NULL)
{
$data['error'] = $error;
$data['title'] = 'Menu';
$data['breadcrumbs'][] = ['label' => 'Menu', 'active' => 'active'];
$data['main_content'] = 'menu/index';
$data['data'] = $this->menu_model->getAllIndex();
$this->load->view('layouts/main_layout', $data);
}
public function create($error = NULL)
{
$success = false;
$message = '';
if ($this->input->post()) {
$model = $this->menu_model;
$this->db->trans_begin();
$model->save();
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
redirect(site_url('menu/index'));
} else {
$this->db->trans_commit();
$success = true;
$message = "Data Berhasil Ditambahkan!";
$this->session->set_flashdata('success', $message);
redirect(site_url('menu/index'));
}
}
$data['error'] = $error;
$data['title'] = 'Create Menu';
$data['main_content'] = 'menu/_form';
$data['js_page'] = $this->js_page;
$data['breadcrumbs'][] = ['label' => 'Menu', 'url' => 'index'];
$data['breadcrumbs'][] = ['label' => 'Create', 'active' => 'active'];
$data['parent'] = $this->menu_model->getParent();
$data['isNewRecord'] = true;
$this->load->view('layouts/main_layout', $data);
}
public function update($id = null)
{
$id = decrypt_url($id);
$success = false;
$message = '';
if ($this->input->post()) {
$model = $this->menu_model;
$this->db->trans_begin();
$model->save();
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Diupdate!";
$this->session->set_flashdata('failed', $message);
redirect(site_url('menu/index'));
} else {
$this->db->trans_commit();
$success = true;
$message = "Data Berhasil Diupdate!";
$this->session->set_flashdata('success', $message);
redirect(site_url('menu/index'));
}
}
$model = $this->menu_model->getById($id);
$data['title'] = 'Update Menu';
$data['main_content'] = 'menu/_form';
$data['js_page'] = $this->js_page;
$data['breadcrumbs'][] = ['label' => 'Menu', 'url' => 'index'];
$data['breadcrumbs'][] = ['label' => 'Update', 'active' => 'active'];
$data['parent'] = $this->menu_model->getParent();
$data['isNewRecord'] = false;
$data['data'] = $model;
$data['parent'] = $this->menu_model->find_parent($model->parent_id, $model->level);
$this->load->view('layouts/main_layout', $data);
}
public function delete($id)
{
$id = decrypt_url($id);
$model = $this->menu_model;
if ($model->delete($id)) {
$this->session->set_flashdata('success', 'Data Berhasil Dihapus!');
redirect(site_url('menu/index'));
}
}
function getParent()
{
$return = '';
if (isset($_POST['key'])) {
$this->db->select('id, name, type, level');
$this->db->from('menu');
$this->db->where('type', $_POST['key']);
$this->db->where('level', 1);
$return = $this->db->get()->result();
}
echo json_encode($return);
}
function getChild()
{
$return = '';
if (isset($_POST['key'])) {
$this->db->select('id, name, type, level');
$this->db->from('menu');
$this->db->where('parent_id', $_POST['key']);
$this->db->where('level', 2);
$return = $this->db->get()->result();
}
echo json_encode($return);
}
}

View File

@@ -0,0 +1,171 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Profile extends CI_Controller
{
var $js_page = 'profile/profile';
public function __construct()
{
parent::__construct();
$this->load->model('profile_model');
$this->load->model('user_model');
$this->load->model('typeuser_model');
$this->load->library('form_validation');
$this->load->helper('url');
}
public function index($error = NULL)
{
$data['error'] = $error;
$data['title'] = 'Profile';
$data['breadcrumbs'][] = ['label' => 'Profile', 'active' => 'active'];
$data['main_content'] = 'profile/index';
$data['data'] = $this->profile_model->getAllData();
$this->load->view('layouts/main_layout', $data);
}
public function create($error = NULL)
{
$success = false;
$message = '';
if ($this->input->post()) {
$post = $this->input->post();
$model = $this->profile_model;
$this->db->trans_begin();
$profile = $model->save();
if ($profile['success'] = true) {
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
} else {
$this->db->trans_commit();
$success = true;
$message = "Data Berhasil Ditambahkan!";
$this->session->set_flashdata('success', $message);
redirect(site_url('profile/view/' . encrypt_url($profile['user_id'])));
}
} else {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
}
redirect(site_url('profile/index'));
}
$data['error'] = $error;
$data['title'] = 'Create Profile';
$data['main_content'] = 'profile/_form';
$data['js_page'] = $this->js_page;
$data['breadcrumbs'][] = ['label' => 'Profile', 'url' => 'index'];
$data['breadcrumbs'][] = ['label' => 'Create', 'active' => 'active'];
$data['isNewRecord'] = true;
$data['typeuser'] = $this->typeuser_model->getType();
$this->load->view('layouts/main_layout', $data);
}
public function view($id = NULL)
{
$id = decrypt_url($id);
$data['title'] = 'Profile';
$data['breadcrumbs'][] = ['label' => 'View', 'active' => 'active'];
$data['main_content'] = 'profile/view';
$data['js_page'] = $this->js_page;
$data['data'] = $this->profile_model->getById($id);
$this->load->view('layouts/main_layout', $data);
}
public function update($id = NULL)
{
$id = decrypt_url($id);
if ($this->input->post()) {
$post = $this->input->post();
$model = $this->profile_model;
$this->db->trans_begin();
$profile = $model->save();
if ($profile['success'] = true) {
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
redirect(site_url('profile/index'));
} else {
$this->db->trans_commit();
$success = true;
$message = "Data Berhasil Ditambahkan!";
$this->session->set_flashdata('success', $message);
redirect(site_url('profile/view/' . encrypt_url($profile['user_id'])));
}
} else {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
redirect(site_url('profile/index'));
}
}
$data['title'] = 'Profile';
$data['breadcrumbs'][] = ['label' => 'View', 'active' => 'active'];
$data['main_content'] = 'profile/_form';
$data['isNewRecord'] = false;
$data['data'] = $this->profile_model->getById($id);
$data['typeuser'] = $this->typeuser_model->getType();
$this->load->view('layouts/main_layout', $data);
}
public function blocked($id)
{
$id = decrypt_url($id);
$this->db->trans_begin();
$model = $this->user_model;
$model->blocked($id);
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Blocked Gagal!";
$this->session->set_flashdata('failed', $message);
} else {
$this->db->trans_commit();
$success = true;
$message = "Blocked Success!";
$this->session->set_flashdata('success', $message);
}
redirect(site_url('profile/index'));
}
function load_modal()
{
$id = decrypt_url($_POST['key']);
$data['js_page'] = $this->js_page;
$data['user_id'] = $id;
$this->load->view('profile/_modal_reset_password', $data);
}
public function reset_password()
{
$this->db->trans_begin();
$this->user_model->reset($_POST['user_id'], $_POST['password']);
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Reset Gagal!";
} else {
$this->db->trans_commit();
$success = true;
$message = "Reset Success!";
}
$return = ['success' => $success, 'message' => $message];
echo json_encode($return);
}
}

View File

@@ -0,0 +1,118 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Role extends CI_Controller
{
var $js_page = 'menu/group_menu';
public function __construct()
{
parent::__construct();
$this->load->model('authItemChild_model');
$this->load->model('authAssignment_model');
$this->load->model('menu_model');
$this->load->model('user_model');
$this->load->library('form_validation');
$this->load->helper('url');
}
public function index()
{
$data['title'] = 'Role Access';
$data['breadcrumbs'][] = ['label' => 'Role Access', 'active' => 'active'];
$data['main_content'] = 'role/index';
$data['user'] = $this->user_model->getAllUser();
$data['model'] = $this->authAssignment_model->dataRole();
$this->load->view('layouts/main_layout', $data);
}
public function update($id = null)
{
$id = decrypt_url($id);
$success = false;
$message = '';
$arr_group = [];
$arr_menu = [];
if ($this->input->post()) {
$post = $this->input->post();
$this->db->trans_begin();
$delete_auth = $this->authAssignment_model->delete_auth($post['user_id']);
if ($delete_auth['success'] == true) {
$success = true;
if (isset($post['MenuRoleForm']['groupmenus'])) {
foreach ($post['MenuRoleForm']['groupmenus'] as $group) {
$assign_groupmenu = $this->authAssignment_model->save($post['user_id'], 'GROUPMENU-' . $group);
if ($assign_groupmenu['success'] == true) {
$success = true;
} else {
$success = false;
$message = $assign_groupmenu['message'];
}
}
}
if (isset($post['MenuRoleForm']['menus'])) {
foreach ($post['MenuRoleForm']['menus'] as $ind => $menu) {
$assign_menu = $this->authAssignment_model->save($post['user_id'], $menu);
if ($assign_menu['success'] == true) {
$success = true;
} else {
$success = false;
$message = $assign_menu['message'];
}
}
}
} else {
$success = false;
$message = $delete_auth['message'];
}
if ($success) {
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Role Access User Gagal!";
$this->session->set_flashdata('failed', $message);
} else {
$this->db->trans_commit();
$success = true;
$message = "Role Access User Berhasil!";
$this->session->set_flashdata('success', $message);
}
} else {
$this->session->set_flashdata('failed', $message);
}
redirect(site_url('role/index'));
} else {
$_group = $this->db->query("select * from auth_assignment where user_id = '" . $id . "' and SUBSTRING(item_name,1,10)='GROUPMENU-'")->result_array();
foreach ($_group as $ind => $item) {
$arr_group[str_replace('GROUPMENU-','',$item['item_name'])] = $item['item_name'];
}
$_menu = $this->db->query("select * from auth_assignment where user_id = '" . $id . "' and SUBSTRING(item_name,1,10)<>'GROUPMENU-'")->result_array();
foreach ($_menu as $ind => $item) {
$arr_menu[$item['item_name']] = $item['item_name'];
}
}
$data['title'] = 'Role Access';
$data['main_content'] = 'role/_form';
$data['js_page'] = $this->js_page;
$data['breadcrumbs'][] = ['label' => 'Role', 'url' => 'index'];
$data['breadcrumbs'][] = ['label' => 'Create', 'active' => 'active'];
$data['isNewRecord'] = false;
$data['user_id'] = $id;
$data['arr_menu'] = $arr_menu;
$data['arr_group'] = $arr_group;
$data['model'] = $this->user_model->getById($id);
$data['data_menu'] = $this->menu_model->getParent();
$data['group_menu'] = $this->menu_model->getGroupMenu();
$data['cruda'] = $this->menu_model->cruda();
$this->load->view('layouts/main_layout', $data);
}
}

View File

@@ -0,0 +1,112 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Site extends CI_Controller
{
var $js_page = 'site/site';
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('user_model');
$this->load->model('authAssignment_model');
}
public function login($error = NULL)
{
if ($this->session->userdata('is_login') == true) {
redirect('site/dashboard');
}
if ($this->input->post()) {
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[50]');
$this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[5]|max_length[22]');
$is_check = $this->check_account();
if ($this->form_validation->run() && $is_check === true) {
$this->user_model->last_login($this->session->userdata('id'), $this->session->userdata('__ci_last_regenerate'));
redirect('site/dashboard');
}
}
$data['error'] = $error;
$data['title'] = 'Login';
$data['js_page'] = $this->js_page;
$data['breadcrumbs'][] = '';
$this->load->view('site/login', $data);
}
public function dashboard($error = NULL)
{
$data['error'] = $error;
$data['title'] = 'Dashboard';
$data['breadcrumbs'][] = ['label' => 'Dashboard', 'active' => 'active'];
$data['main_content'] = 'site/dashboard';
$this->load->view('layouts/main_layout', $data);
}
public function check_account()
{
$username = $this->input->post('username');
$password = $this->input->post('password');
$query = $this->user_model->check_account($username, $password, false);
if ($query === 1) {
$this->session->set_flashdata('alert', '<div class="info-box bg-gradient-danger">
<span class="info-box-icon"><i class="fas fa-exclamation-circle"></i></span>
<div class="info-box-content">
<span class="info-box-text">FAILED</span>
<span class="progress-description">Username is not Registered</span>
</div>
</div>');
} elseif ($query === 2) {
$this->session->set_flashdata('alert', '<div class="info-box bg-gradient-danger">
<span class="info-box-icon"><i class="fas fa-exclamation-circle"></i></span>
<div class="info-box-content">
<span class="info-box-text">FAILED</span>
<span class="progress-description">Your Account is not Active!, Please Contact Admin</span>
</div>
</div>');
} elseif ($query === 3) {
$this->session->set_flashdata('alert', '<div class="info-box bg-gradient-danger">
<span class="info-box-icon"><i class="fas fa-exclamation-circle"></i></span>
<div class="info-box-content">
<span class="info-box-text">FAILED</span>
<span class="progress-description">Your Password is Wrong!</span>
</div>
</div>');
} else {
$auth = $this->authAssignment_model->access($query->user_id);
$userdata = array(
'is_login' => true,
'is_developer' => ($query->typeuser_id == 1) ? true : false,
'id' => $query->user_id,
'typeuser_id' => $query->typeuser_id,
'name' => $query->name,
'foto' => $query->foto,
'typeuser' => $query->typeuser,
'username' => $query->username,
'switch' => false,
'you_can' => $auth,
'user_initial' => ''
);
$this->session->set_userdata($userdata);
return true;
}
}
public function logout()
{
$id = $this->session->userdata('id');
$user_data = $this->session->userdata();
foreach ($user_data as $key => $value) {
if ($key != '__ci_last_regenerate' && $key != '__ci_vars')
$this->session->unset_userdata($key);
}
redirect('site/login');
}
}

View File

@@ -0,0 +1,110 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Typeuser extends CI_Controller
{
var $js_page = 'typeuser/typeuser';
public function __construct()
{
parent::__construct();
$this->load->model('typeuser_model');
$this->load->library('form_validation');
$this->load->helper('url');
}
public function index()
{
$data['title'] = 'Typeuser';
$data['breadcrumbs'][] = ['label' => 'Typeuser', 'active' => 'active'];
$data['main_content'] = 'typeuser/index';
$data['data'] = $this->typeuser_model->getAll();
$this->load->view('layouts/main_layout', $data);
}
public function create()
{
$success = false;
$message = '';
if ($this->input->post()) {
//print_r($_POST);die();
if ($this->input->post()) {
$model = $this->typeuser_model;
$this->db->trans_begin();
$model->add();
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Disimpan!";
$this->session->set_flashdata('failed', $message);
redirect(site_url('typeuser/index'));
} else {
$this->db->trans_commit();
$success = true;
$message = "Data Berhasil Ditambahkan!";
$this->session->set_flashdata('success', $message);
redirect(site_url('typeuser/index'));
}
}
}
$data['title'] = 'Create Typeuser';
$data['main_content'] = 'typeuser/_form';
$data['breadcrumbs'][] = ['label' => 'Typeuser', 'url' => 'index'];
$data['breadcrumbs'][] = ['label' => 'Create', 'active' => 'active'];
$data['isNewRecord'] = true;
$this->load->view('layouts/main_layout', $data);
}
public function update($id = null)
{
$id = decrypt_url($id);
$success = false;
$message = '';
if ($this->input->post()) {
$model = $this->typeuser_model;
$this->db->trans_begin();
$model->add();
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
$success = false;
$message = "Data Gagal Diupdate!";
$this->session->set_flashdata('failed', $message);
redirect(site_url('typeuser/index'));
} else {
$this->db->trans_commit();
$success = true;
$message = "Data Berhasil Diupdate!";
$this->session->set_flashdata('success', $message);
redirect(site_url('typeuser/index'));
}
}
$model = $this->typeuser_model->getById($id);
$data['title'] = 'Update Type User';
$data['main_content'] = 'typeuser/_form';
$data['js_page'] = $this->js_page;
$data['breadcrumbs'][] = ['label' => 'typeuser', 'url' => 'index'];
$data['breadcrumbs'][] = ['label' => 'Update', 'active' => 'active'];
$data['isNewRecord'] = false;
$data['data'] = $model;
$this->load->view('layouts/main_layout', $data);
}
public function delete($id)
{
$id = decrypt_url($id);
$model = $this->typeuser_model;
if ($model->delete($id)) {
$this->session->set_flashdata('success', 'Data Berhasil Dihapus!');
redirect(site_url('typeuser/index'));
}
}
}

View File

@@ -0,0 +1,137 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User extends CI_Controller
{
var $js_page = 'user/user';
public function __construct()
{
parent::__construct();
$this->load->model('user_model');
$this->load->model('authAssignment_model');
$this->load->library('form_validation');
$this->load->helper('url');
}
public function index()
{
$data['title'] = 'List User';
$data['breadcrumbs'][] = ['label' => 'List User', 'active' => 'active'];
$data['main_content'] = 'user/index';
$data['js_page'] = $this->js_page;
$data['model'] = $this->user_model->getAllUser();
$this->load->view('layouts/main_layout', $data);
}
public function switch_user($id = NULL)
{
$id = $this->input->post('id');
$initialId = $this->session->userdata('id');
if ($id == $initialId) {
$this->session->set_flashdata('failed', "Can't swicth, same user !");
$array_respon = [
'status' => FALSE,
];
echo json_encode($array_respon);
// redirect('user/index');
} else {
$user = $this->user_model->getById($id);
$user_initial = $this->user_model->getById($initialId);
if (!empty($user)) {
if ($user->status == 1) {
$query = $this->user_model->check_account($user->username, $user->password_hash, true);
if (!empty($query)) {
$user_initial = [
'id' => $user_initial->user_id,
'username' => $user_initial->username,
'password' => $user_initial->password_hash,
'name' => $user_initial->name,
'typeuser_id' => $user_initial->typeuser_id,
];
$auth = $this->authAssignment_model->access($query->user_id);
$userdata = array(
'is_login' => true,
'is_developer' => ($query->typeuser_id == 1) ? true : false,
'id' => $query->user_id,
'typeuser_id' => $query->typeuser_id,
'name' => $query->name,
'typeuser' => $query->typeuser,
'username' => $query->username,
'switch' => true,
'you_can' => $auth,
'user_initial' => $user_initial
);
$this->session->set_userdata($userdata);
$this->user_model->last_login($this->session->userdata('id'), $this->session->userdata('__ci_last_regenerate'));
$array_respon = [
'status' => TRUE,
];
echo json_encode($array_respon);
// redirect('site/dashboard');
}
} else {
$this->session->set_flashdata('failed', 'Switch Failed, user "' . $user->name . '" is already blocked');
$array_respon = [
'status' => FALSE,
];
echo json_encode($array_respon);
// redirect('user/index');
}
} else {
$this->session->set_flashdata('failed', "User not found!");
$array_respon = [
'status' => FALSE,
];
echo json_encode($array_respon);
// redirect('user/index');
}
}
}
public function switch_user_back($id = NULL)
{
$id = $this->input->post('id');
$initialId = $this->session->userdata('id');
$user = $this->user_model->getById($id);
if (!empty($user)) {
$query = $this->user_model->check_account($user->username, $user->password_hash, true);
if (!empty($query)) {
$auth = $this->authAssignment_model->access($query->user_id);
$userdata = array(
'is_login' => true,
'is_developer' => ($query->typeuser_id == 1) ? true : false,
'id' => $query->user_id,
'typeuser_id' => $query->typeuser_id,
'name' => $query->name,
'typeuser' => $query->typeuser,
'username' => $query->username,
'switch' => false,
'you_can' => $auth,
'user_initial' => ''
);
$this->session->set_userdata($userdata);
$this->user_model->last_login($this->session->userdata('id'), $this->session->userdata('__ci_last_regenerate'));
$array_respon = [
'status' => TRUE,
];
echo json_encode($array_respon);
// redirect('site/dashboard');
}
} else {
$this->session->set_flashdata('failed', "User not found!");
$array_respon = [
'status' => FALSE,
];
echo json_encode($array_respon);
// redirect('user/index');
}
}
}

View File

@@ -0,0 +1,25 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/userguide3/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,18 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
if (!function_exists('get_hash')) {
function get_hash($PlainPassword)
{
$option = ['cost' => 5];
return password_hash($PlainPassword, PASSWORD_DEFAULT, $option);
}
}
if (!function_exists('hash_verified')) {
function hash_verified($PlainPassword, $HashPassword)
{
return password_verify($PlainPassword, $HashPassword) ? true : false;
}
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,4 @@
[security]
encryption_key=1111111111111111 ;16 digits
iv=0899044682231054 ;16 digits
encryption_mechanism=aes-256-cbc

View File

@@ -0,0 +1,36 @@
<?php if (!defined("BASEPATH")) exit("No direct script access allowed");
function encrypt_url($string) {
$output = false;
/*
* read security.ini file & get encryption_key | iv | encryption_mechanism value for generating encryption code
*/
$security = parse_ini_file("security.ini");
$secret_key = $security["encryption_key"];
$secret_iv = $security["iv"];
$encrypt_method = $security["encryption_mechanism"];
// hash
$key = hash("sha256", $secret_key);
// iv encrypt method AES-256-CBC expects 16 bytes else you will get a warning
$iv = substr(hash("sha256", $secret_iv), 0, 16);
//do the encryption given text/string/number
$result = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);
$output = base64_encode($result);
return $output;
}
function decrypt_url($string) {
$output = false;
/*
* read security.ini file & get encryption_key | iv | encryption_mechanism value for generating encryption code
*/
$security = parse_ini_file("security.ini");
$secret_key = $security["encryption_key"];
$secret_iv = $security["iv"];
$encrypt_method = $security["encryption_mechanism"];
// hash
$key = hash("sha256", $secret_key);
// iv encrypt method AES-256-CBC expects 16 bytes else you will get a warning
$iv = substr(hash("sha256", $secret_iv), 0, 16);
//do the decryption given text/string/number
$output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
return $output;
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/index.html Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<?php
class Helper
{
function upload_image($file, $path)
{
$config['upload_path'] = './assets/img/upload';
$config['allowed_types'] = 'jpg|png|jpeg|gif';
$config['max_size'] = '2048'; //2MB max
$config['max_width'] = '4480'; // pixel
$config['max_height'] = '4480'; // pixel
$config['file_name'] = $path . '-' . $file['name'];
return $config;
}
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,134 @@
<?php defined('BASEPATH') OR exit ('No direct script access allowed!');
class AuthAssignment_model extends CI_Model
{
private $_table = "auth_assignment";
public $item_name, $user_id, $created_at;
public function delete_auth($user_id)
{
$success = true;
$message = 'Berhasil Hapus Role Lama!';
$delete = $this->db->delete('auth_assignment', array('user_id' => $user_id));
if (!$delete) {
$success = false;
$message = 'Gagal Hapus Role Lama!';
}
return ['success' => $success, 'message' => $message];
}
public function save($user_id, $menu)
{
$success = true;
$message = 'Auth Assignment Berhasil Disimpan!';
$date = new DateTime();
$this->item_name = $menu;
$this->user_id = $user_id;
$this->created_at = $date->getTimestamp();
$save = $this->db->insert($this->_table, $this);
if (!$save) {
$success = false;
$message = 'Auth Assignment Gagal Disimpan!';
}
return ['success' => $success, 'message' => $message];
}
public function dataRole()
{
$data = [];
$sql = $this->db->query("select a.user_id, a.name, b.username, c.value as typeuser, f.name as name_menu, f.slug, e.item_name, f.id, a.typeuser_id
from profile a
left join user b on b.id = a.user_id
left join typeuser c on c.id = a.typeuser_id
left join auth_assignment e on e.user_id = a.user_id
left join menu f on concat('GROUPMENU-',f.slug)= e.item_name or SUBSTRING_INDEX(e.item_name, '[', 1) = f.slug");
$menus = $sql->result_array();
if (count($menus) > 0) {
foreach ($menus as $ind => $item) {
$menuact = $this->menuAct($item['user_id'], $item['slug']);
$data[$item['user_id']]['user_id'] = $item['user_id'];
$data[$item['user_id']]['name'] = $item['name'];
$data[$item['user_id']]['typeuser'] = $item['typeuser'];
$data[$item['user_id']]['typeuser_id'] = $item['typeuser_id'];
$data[$item['user_id']]['username'] = $item['username'];
$data[$item['user_id']]['details'] = $menuact;
}
}
return $data;
}
public function menuAct($user_id, $slug)
{
$sql_group_menus = $this->db->query("select slug, name from menu where level = 1 and type = 3");
$groupMenus = $sql_group_menus->result_array();
$ind_group = [];
foreach ($groupMenus as $menu) {
$ind_group[$menu['slug']] = $menu['name'];
}
$menu = ['group' => [], 'menu' => []];
$sql_group = $this->db->query("select item_name from auth_assignment where user_id ='" . $user_id . "' and SUBSTRING(item_name,1,10)= 'GROUPMENU-'");
$_group = $sql_group->result_array();
$groupmenus = [];
$groupmenus_role = [];
foreach ($_group as $item) {
if (isset($ind_group[str_replace('GROUPMENU-', '', $item['item_name'])])) {
$nm = $ind_group[str_replace('GROUPMENU-', '', $item['item_name'])];
if (isset($nm)) {
$groupmenus[] = $nm;
$groupmenus_role[$item['item_name']] = $item['item_name'];
}
}
}
$sql_menu = $this->db->query("select item_name from auth_assignment where user_id ='" . $user_id . "' and SUBSTRING(item_name,1,10)<>'GROUPMENU-'");
$_menu = $sql_menu->result_array();
$menus = [];
$menus_role = [];
foreach ($_menu as $role) {
$key = explode('[', $role['item_name']);
$slug = $key[0];
if (isset($key[1])) {
$act = substr($key[1], 0, 1);
$this->db->where('slug', $slug);
$mn = $this->db->get('menu')->row();
if (isset($mn)) {
$menus[$mn->name][] = $act;
$menus_role[$role['item_name']] = $role['item_name'];
}
}
}
return ['group' => $groupmenus, 'menu' => $menus, 'menu_role' => $menus_role, 'group_role' => $groupmenus_role];
}
public function access($user_id)
{
$access = $this->menuAct($user_id, '');
$arr_access = '';
$menus = $access['menu_role'];
$groups = $access['group_role'];
$group = [];
if (!empty($groups)) {
foreach ($groups as $item) {
$sql_group = $this->db->query("select child from auth_item_child where parent ='" . $item . "'");
$_group = $sql_group->result_array();
if (!empty($_group)) {
foreach ($_group as $gr) {
$group[$gr['child']] = $gr['child'];
}
}
}
}
$arr_access = array_merge($group, $menus);
return $arr_access;
}
}

View File

@@ -0,0 +1,101 @@
<?php defined('BASEPATH') OR exit ('No direct script access allowed!');
class AuthItemChild_model extends CI_Model
{
private $_table = "auth_item_child";
private $_table_menu = "menu";
public $parent, $child;
public function getAll()
{
$sql = $this->db->query("select a.id, a.name, a.slug, b.parent, b.child from menu a
inner join auth_item_child b on b.parent = concat('GROUPMENU-', a.slug)
where a.type = 3");
$menus = $sql->result_array();
return $menus;
}
public function save($slug)
{
$post = $this->input->post();
$role_menu = $post['MenuRoleForm']['menus'];
if (isset($post)) {
$this->db->where('slug', $slug);
$menu = $this->db->get('menu')->row();
if (isset($menu)) {
$this->db->where('name', 'GROUPMENU-' . $slug);
$auth_item = $this->db->get('auth_item')->row();
if (isset($auth_item)) {
foreach ($role_menu as $ind => $val) {
$this->parent = $auth_item->name;
$this->child = $val;
$this->db->insert($this->_table, $this);
}
}
}
}
}
public function dataMenu()
{
$data = [];
$sql = $this->db->query("select a.id, a.name, a.slug, b.name as name_auth from menu a
inner join auth_item b on b.name = concat('GROUPMENU-',a.slug)");
$menus = $sql->result_array();
if (count($menus) > 0) {
foreach ($menus as $ind => $item) {
$menuact = $this->menuAct($item['name_auth'], $item['slug']);
$data[$item['id']]['id'] = $item['id'];
$data[$item['id']]['name'] = $item['name'];
$data[$item['id']]['details'] = $menuact;
}
}
return $data;
}
public function menuAct($name, $slug)
{
$sql_group_menus = $this->db->query("select name from menu where level = 1 and type = 3");
$groupMenus = $sql_group_menus->result_array();
$menu = ['group' => [], 'menu' => []];
$sql_group = $this->db->query("select child from auth_item_child where parent ='" . $name . "' and SUBSTRING(child,1,10)= 'GROUPMENU-'");
$_group = $sql_group->result_array();
foreach ($_group as $role) {
$nm = isset($groupMenus[str_replace('GROUPMENU-', '', $role['child'])]) ? $groupMenus[str_replace('GROUPMENU-', '', $role['child'])] : '';
if (!empty($nm)) {
$menu['group'][] = $nm;
}
}
$sql_menu = $this->db->query("select child from auth_item_child where parent ='" . $name . "' and SUBSTRING(child,1,10)<>'GROUPMENU-'");
$_menu = $sql_menu->result_array();
foreach ($_menu as $role) {
$key = explode('[', $role['child']);
$slug = $key[0];
if (isset($key[1])) {
$act = substr($key[1], 0, 1);
$this->db->where('slug', $slug);
$mn = $this->db->get('menu')->row();
if (isset($mn)) {
$menu['menu'][$mn->name][] = $act;
}
}
}
return $menu;
}
public function delete_auth($parent)
{
$success = true;
$message = 'Berhasil Hapus Role Lama!';
$delete = $this->db->delete('auth_item_child', array('parent' => 'GROUPMENU-' . $parent));
if (!$delete) {
$success = false;
$message = 'Gagal Hapus Role Lama!';
}
return ['success' => $success, 'message' => $message];
}
}

View File

@@ -0,0 +1,18 @@
<?php defined('BASEPATH') OR exit ('No direct script access allowed!');
class Authitem_model extends CI_Model
{
private $_table = "auth_item";
public $name, $type, $created_at, $updated_at;
public function create_role($slug)
{
$date = new DateTime();
$this->name = $slug;
$this->type = 1;
$this->created_at = $date->getTimestamp();
$this->updated_at = $date->getTimestamp();
$this->db->insert($this->_table, $this);
}
}

View File

@@ -0,0 +1,61 @@
<?php defined('BASEPATH') OR exit ('No direct script access allowed!');
class CompanyProfile_model extends CI_Model
{
private $_table = "company_profile";
public $name, $alias, $description, $company, $address, $website, $year, $logo, $version, $id;
public function __construct()
{
parent::__construct();
$this->load->library('upload');
$this->load->library('helper');
}
public function company_profile()
{
$data = $this->db->query("select * from company_profile")->row();
return $data;
}
public function save()
{
$success = true;
$message = 'Update Company Profile Berhasil!';
$post = $this->input->post();
$data = $this->company_profile();
if (!empty($_FILES['logo']['name'])) {
if ($data->logo != $_FILES['logo']['name']) {
$helper_upload = $this->helper->upload_image($_FILES['logo'], 'company_profile');
$this->upload->initialize($helper_upload);
if ($this->upload->do_upload('logo')) {
$foto = $this->upload->data();
$this->logo = $foto['file_name'];
}
} else {
$this->logo = $data->logo;
}
} else {
$this->logo = $data->logo;
}
$this->name = $post['name'];
$this->alias = $post['alias'];
$this->description = $post['description'];
$this->company = $post['company'];
$this->address = $post['address'];
$this->website = $post['website'];
$this->year = $post['year'];
$this->version = $post['version'];
$this->id = $post['id'];
$save = $this->db->update($this->_table, $this, array('id' => $post['id']));
if (!$save) {
$success = false;
$message = 'Update Company Profile Gagal!';
}
return ['success' => $success, 'message' => $message];
}
}

View File

@@ -0,0 +1,169 @@
<?php defined('BASEPATH') OR exit ('No direct script access allowed!');
class Menu_model extends CI_Model
{
private $_table = "menu";
public $id, $name, $slug, $level, $link, $icon, $parent_id, $urutan, $type;
public function __construct()
{
parent::__construct();
$this->load->model(array('authitem_model'));
}
public function getAll()
{
$this->db->order_by('id', 'asc');
return $this->db->get($this->_table)->result();
}
public function save()
{
$post = $this->input->post();
if ($post['isNewRecord'] == 'true') {
$this->name = isset($post['name']) ? $post['name'] : '';
$this->icon = isset($post['icon']) ? $post['icon'] : '';
$this->urutan = isset($post['urutan']) ? $post['urutan'] : '';
$this->type = isset($post['position']) ? $post['position'] : '';
$this->parent_id = null;
$this->level = 1;
$this->link = isset($post['link']) ? $post['link'] : '';
if (isset($post['level_1'])) {
if (!empty($post['level_1'])) {
$this->parent_id = $post['level_1'];
$this->level = 2;
if (!empty($post['level_2'])) {
$this->parent_id = $post['level_2'];
$this->level = 3;
}
}
}
$this->slug = $this->generate_url_slug($post['name'], 'menu');
if (isset($post['link'])) {
if (empty($post['link'])) {
$this->link = '#';
}
}
$data = $this->db->insert($this->_table, $this);
if ($data == true) {
if ($post['position'] == 3) {
$auth = $this->authitem_model->create_role('GROUPMENU-' . $this->slug);
} else {
foreach ($this->cruda() as $ind => $val) {
$auth = $this->authitem_model->create_role($this->slug . '[' . $ind . ']');
}
}
}
} else {
$this->id = $post['id'];
$this->name = $post['name'];
$this->icon = $post['icon'];
$this->urutan = $post['urutan'];
$this->type = $post['position'];
$this->parent_id = null;
$this->level = 1;
$this->link = $post['link'];
if (!empty($post['level_1'])) {
$this->parent_id = $post['level_1'];
$this->level = 2;
if (!empty($post['level_2'])) {
$this->parent_id = $post['level_2'];
$this->level = 3;
}
}
$this->slug = $post['name'];
if (empty($post['link'])) {
$this->link = '#';
}
$this->db->update($this->_table, $this, array('id' => $post['id']));
}
return $this->slug;
}
public function delete($id)
{
return $this->db->delete($this->_table, array('id' => $id));
}
public function getAllIndex()
{
$this->db->select('a.id, a.name, a.type, a.level, a.urutan, a.link, a.icon, a.parent_id, b.name as parent');
$this->db->from('menu a');
$this->db->join('menu b', 'a.parent_id = b.id', 'left');
$this->db->order_by('a.id', 'asc');
$query = $this->db->get()->result();
return $query;
}
public function getParent()
{
$this->db->select('id, name, slug');
$this->db->from('menu');
$this->db->where('level', 1);
$this->db->where_not_in('type', 3);
$this->db->order_by('name', 'asc');
$query = $this->db->get()->result();
return $query;
}
public function getByID($id)
{
return $this->db->get_where($this->_table, ["id" => $id])->row();
}
function generate_url_slug($string, $table, $field = 'slug', $key = NULL, $value = NULL)
{
$t =& get_instance();
$slug = url_title($string);
$slug = strtolower($slug);
$i = 0;
$params = array();
$params[$field] = $slug;
if ($key) $params["$key !="] = $value;
while ($t->db->where($params)->get($table)->num_rows()) {
if (!preg_match('/-{1}[0-9]+$/', $slug))
$slug .= '-' . ++$i;
else
$slug = preg_replace('/[0-9]+$/', ++$i, $slug);
$params [$field] = $slug;
}
return $slug;
}
function find_parent($parent, $level)
{
$arr_parent = [
1 => '',
2 => ''
];
if ($level == 2) {
$arr_parent = [
1 => $parent,
2 => '',
];
} else if ($level == 3) {
$parent_2 = $this->db->get_where($this->_table, ["id" => $parent])->row();
$arr_parent = [
1 => $parent_2->parent_id,
2 => $parent,
];
}
return $arr_parent;
}
function cruda()
{
return ['C' => 'CREATE', 'R' => 'READ', 'U' => 'UPDATE', 'D' => 'DELETE', 'A' => 'APPROVAL'];
}
public function getGroupMenu()
{
$data = $this->db->query("select * from menu where level = 1 and type = 3")->result_array();
return $data;
}
}

View File

@@ -0,0 +1,104 @@
<?php defined('BASEPATH') OR exit ('No direct script access allowed!');
class Profile_model extends CI_Model
{
private $_table = "profile";
public $user_id, $name, $email, $phone, $typeuser_id, $foto;
public function __construct()
{
parent::__construct();
$this->load->model(array('user_model'));
$this->load->library(array('upload'));
$this->load->library(array('helper'));
}
public function save()
{
$success = true;
$message = 'Create Profile Berhasil!';
$post = $this->input->post();
if ($post['isNewRecord'] == 'true') {
$user = $this->user_model->save($post['User'], $post['isNewRecord'], $post['user_id'], $post['email']);
} else {
$user['success'] = true;
}
if ($user['success'] == true) {
$this->name = $post['name'];
$this->email = $post['email'];
$this->phone = $post['phone'];
$this->typeuser_id = $post['typeuser_id'];
if ($post['isNewRecord'] == 'true') {
if (!empty($_FILES['foto']['name'])) {
$helper_upload = $this->helper->upload_image($_FILES['foto'], 'profile');
$this->upload->initialize($helper_upload);
if ($this->upload->do_upload('foto')) {
$foto = $this->upload->data();
$this->foto = $foto['file_name'];
}
}
$this->user_id = $user['user_id'];
$save = $this->db->insert($this->_table, $this);
if (!$save) {
$success = false;
$message = 'Create Profile Gagal!';
}
} else {
$data = $this->getById($post['user_id']);
if (!empty($_FILES['foto']['name'])) {
if ($data->foto != $_FILES['foto']['name']) {
$helper_upload = $this->helper->upload_image($_FILES['foto'], 'profile');
$this->upload->initialize($helper_upload);
if ($this->upload->do_upload('foto')) {
$foto = $this->upload->data();
$this->foto = $foto['file_name'];
}
} else {
$this->foto = $data->foto;
}
} else {
$this->foto = $data->foto;
}
$this->user_id = $post['user_id'];
$save = $this->db->update($this->_table, $this, array('user_id' => $post['user_id']));
if (!$save) {
$success = false;
$message = 'Update Profile Gagal!';
}
}
} else {
$success = false;
$message = $user['message'];
}
return ['success' => $success, 'message' => $message, 'user_id' => $this->user_id];
}
public function getAllData()
{
$sql = $this->db->query("
select a.user_id, a.name, a.email, a.phone, b.username, b.status, c.value as typeuser, a.typeuser_id from profile a
inner join user b on b.id = a.user_id
inner join typeuser c on c.id = a.typeuser_id");
$data = $sql->result_array();
return $data;
}
public function getById($id)
{
$sql = $this->db->query("
select a.user_id, a.name, a.email, a.phone, b.username, b.status, c.value as typeuser,
b.status, a.typeuser_id, b.password_hash as password, a.foto from profile a
inner join user b on b.id = a.user_id
inner join typeuser c on c.id = a.typeuser_id where a.user_id = '" . $id . "'");
$data = $sql->row();
return $data;
}
}

View File

@@ -0,0 +1,62 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed!');
class Typeuser_model extends CI_Model
{
private $_table = "typeuser";
public $id, $code, $value, $description;
public function __construct()
{
parent::__construct();
$this->load->model(array('authitem_model'));
}
public function getAll()
{
$this->db->order_by('id', 'asc');
return $this->db->get($this->_table)->result();
}
public function getById($id)
{
$data = $this->db->query("select * from typeuser where id ='" . $id . "'")->row();
return $data;
}
public function add()
{
$post = $this->input->post();
if ($post['isNewRecord'] == 'true') {
$this->code = isset($post['code']) ? $post['code'] : '';
$this->value = isset($post['value']) ? $post['value'] : '';
$this->description = isset($post['description']) ? $post['description'] : '';
$data = $this->db->insert($this->_table, $this);
} else {
$this->id = $post['id'];
$this->code = $post['code'];
$this->value = $post['value'];
$this->description = $post['description'];
// print_r($this);die();
$this->db->update($this->_table, $this, array('id' => $post['id']));
}
}
public function delete($id)
{
return $this->db->delete($this->_table, array('id' => $id));
}
public function getType()
{
$this->db->select('id, code, value, description');
$this->db->from('typeuser');
$this->db->order_by('value', 'asc');
$query = $this->db->get()->result();
return $query;
}
}

View File

@@ -0,0 +1,107 @@
<?php defined('BASEPATH') OR exit ('No direct script access allowed!');
class User_model extends CI_Model
{
private $_table = "user";
public $id, $username, $email, $password_hash, $auth_key, $confirmed_at, $unconfirmed_email, $blocked_at, $created_at, $updated_at, $flags, $last_login_at, $status;
public function save($post, $isNewRecord, $user_id, $email)
{
$success = false;
$message = 'Gagal Create User!';
$date = new DateTime();
$this->username = $post['username'];
$this->email = $email;
$this->created_at = $date->getTimestamp();
$this->status = 1;
if ($isNewRecord == 'true') {
$this->updated_at = $date->getTimestamp();
$this->password_hash = password_hash($post['password'], PASSWORD_DEFAULT);
$this->db->insert($this->_table, $this);
$user_id = $this->db->insert_id();
$success = true;
$message = 'Berhasil Create User!';
} else {
$this->id = $user_id;
$this->updated_at = $date->getTimestamp();
$this->db->update($this->_table, $this, array('id' => $user_id));
$success = true;
$message = 'Berhasil Update User!';
}
return ['success' => $success, 'message' => $message, 'user_id' => $user_id];
}
public function blocked($id)
{
$date = new DateTime();
$update_status = array(
'status' => 0,
'blocked_at' => $date->getTimestamp()
);
$this->db->where('id', $id);
$this->db->update($this->_table, $update_status);
}
public function reset($id, $password)
{
$date = new DateTime();
$reset_password = array(
'password_hash' => password_hash($password, PASSWORD_DEFAULT),
'updated_at' => $date->getTimestamp()
);
$this->db->where('id', $id);
$this->db->update($this->_table, $reset_password);
}
public function getAllUser()
{
$data = $this->db->query("select a.id as user_id, a.username, b.name, c.value as typeuser, b.typeuser_id, b.email from user a
inner join profile b on b.user_id = a.id
left join typeuser c on c.id = b.typeuser_id")->result_array();
return $data;
}
public function getById($id)
{
$data = $this->db->query("select a.id as user_id, a.username, b.name, c.value as typeuser, b.typeuser_id, a.status, a.password_hash
from user a
inner join profile b on b.user_id = a.id
left join typeuser c on c.id = b.typeuser_id
where a.id = '" . $id . "' ")->row();
return $data;
}
public function check_account($username, $password, $switch)
{
$user = $this->db->query("select a.id as user_id, a.username, b.name, c.value as typeuser, b.typeuser_id, a.status, a.password_hash, b.foto from user a
inner join profile b on b.user_id = a.id
left join typeuser c on c.id = b.typeuser_id
where a.username = '" . $username . "' ")->row();
if (!$switch) {
if (!$user) {
return 1;
}
if ($user->status == 0) {
return 2;
}
if (!hash_verified($password, $user->password_hash)) {
return 3;
}
}
return $user;
}
public function last_login($id, $time)
{
$update_status = array(
'last_login_at' => $time,
);
$this->db->where('id', $id);
$this->db->update($this->_table, $update_status);
}
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

11
application/third_party/index.html vendored Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,86 @@
<form class="form-horizontal" method="POST" action="<?= 'companyProfile/update' ?>" enctype="multipart/form-data">
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="name" name="name"
value="<?= $data->name ?>"
placeholder="Name">
</div>
</div>
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Alias</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="alias" name="alias"
value="<?= $data->alias ?>"
placeholder="Alias">
<input type="hidden" class="form-control" id="id" name="id"
value="<?= $data->id ?>"
placeholder="ID">
</div>
</div>
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Version</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="version" name="version"
value="<?= $data->version ?>"
placeholder="Version">
</div>
</div>
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Year</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="year" name="year"
value="<?= $data->year ?>"
placeholder="Year">
</div>
</div>
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Description</label>
<div class="col-sm-6">
<textarea type="text" class="form-control" id="description" name="description"
placeholder="Description"><?= $data->description ?></textarea>
</div>
</div>
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Company</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="company" name="company"
value="<?= $data->company ?>"
placeholder="Name">
</div>
</div>
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Address</label>
<div class="col-sm-8">
<textarea type="text" class="form-control" id="address" name="address" placeholder="Address"><?= $data->address ?></textarea>
</div>
</div>
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Website</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="website" name="website"
value="<?= $data->website ?>"
placeholder="Website">
</div>
</div>
<div class="form-group row">
<label for="input_logo" class="col-sm-2 col-form-label">Logo</label>
<div class="col-sm-8">
<input type="file" class="form-control" id="logo" name="logo" value="" placeholder="Logo">
</div>
</div>
<div class="card-footer">
<button type="submit"
class="btn btn-info float-right">Update Company</button>
</div>
</form>

View File

@@ -0,0 +1,63 @@
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<div class="card card-primary card-outline">
<div class="card-body box-profile">
<div class="text-center">
<img class="profile-user-img img-fluid img-circle"
src="<?= (!empty($data->logo)) ? base_url('assets/img/upload/' . $data->logo) : base_url('assets/img/system/no_img.jpg') ?>"
alt="User profile picture">
</div>
<h3 class="profile-username text-center"><?= $data->name ?></h3>
<p class="text-muted text-center"><?= $data->alias ?></p>
<ul class="list-group list-group-unbordered mb-3">
<li class="list-group-item">
<b>Year</b> <a class="float-right"><?= $data->year ?></a>
</li>
<li class="list-group-item">
<b>Version</b> <a class="float-right"><?= $data->version ?></a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-9">
<div class="card">
<div class="card-header p-2">
<ul class="nav nav-pills">
<li class="nav-item"><a class="nav-link active" href="#detail"
data-toggle="tab">Detail</a></li>
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['company-profile[U]']))) : ?>
<li class="nav-item"><a class="nav-link" href="#setting" data-toggle="tab">Setting</a>
</li>
<?php endif; ?>
</ul>
</div>
<div class="card-body">
<div class="tab-content">
<div class="active tab-pane" id="detail">
<strong><i class="fas fa-building"></i> Company</strong>
<p class="text-muted"><?= $data->company ?></p>
<hr>
<strong><i class="fas fa-map-marker-alt mr-1"></i> Address</strong>
<p class="text-muted"><?= $data->address ?></p>
<hr>
<strong><i class="far fa-file-alt mr-1"></i> Description</strong>
<p class="text-muted"><?= $data->description ?></p>
<hr>
<strong><i class="fas fa-globe"></i> Website</strong>
<p class="text-muted"><?= $data->website ?></p>
</div>
<div class="tab-pane" id="setting">
<div id="div-setting"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>

View File

@@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nERROR: ",
$heading,
"\n\n",
$message,
"\n\n";

View File

@@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nDatabase error: ",
$heading,
"\n\n",
$message,
"\n\n";

View File

@@ -0,0 +1,21 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
An uncaught Exception was encountered
Type: <?php echo get_class($exception), "\n"; ?>
Message: <?php echo $message, "\n"; ?>
Filename: <?php echo $exception->getFile(), "\n"; ?>
Line Number: <?php echo $exception->getLine(); ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
Backtrace:
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
File: <?php echo $error['file'], "\n"; ?>
Line: <?php echo $error['line'], "\n"; ?>
Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>

View File

@@ -0,0 +1,8 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
echo "\nERROR: ",
$heading,
"\n\n",
$message,
"\n\n";

View File

@@ -0,0 +1,21 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
A PHP Error was encountered
Severity: <?php echo $severity, "\n"; ?>
Message: <?php echo $message, "\n"; ?>
Filename: <?php echo $filepath, "\n"; ?>
Line Number: <?php echo $line; ?>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
Backtrace:
<?php foreach (debug_backtrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
File: <?php echo $error['file'], "\n"; ?>
Line: <?php echo $error['line'], "\n"; ?>
Function: <?php echo $error['function'], "\n\n"; ?>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>404 Page Not Found</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

View File

@@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Database Error</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

View File

@@ -0,0 +1,32 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>An uncaught Exception was encountered</h4>
<p>Type: <?php echo get_class($exception); ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $exception->getFile(); ?></p>
<p>Line Number: <?php echo $exception->getLine(); ?></p>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
<p>Backtrace:</p>
<?php foreach ($exception->getTrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
<p style="margin-left:10px">
File: <?php echo $error['file']; ?><br />
Line: <?php echo $error['line']; ?><br />
Function: <?php echo $error['function']; ?>
</p>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
</div>

View File

@@ -0,0 +1,64 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
p {
margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
<div id="container">
<h1><?php echo $heading; ?></h1>
<?php echo $message; ?>
</div>
</body>
</html>

View File

@@ -0,0 +1,33 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
<p>Backtrace:</p>
<?php foreach (debug_backtrace() as $error): ?>
<?php if (isset($error['file']) && strpos($error['file'], realpath(BASEPATH)) !== 0): ?>
<p style="margin-left:10px">
File: <?php echo $error['file'] ?><br />
Line: <?php echo $error['line'] ?><br />
Function: <?php echo $error['function'] ?>
</p>
<?php endif ?>
<?php endforeach ?>
<?php endif ?>
</div>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,107 @@
<?php
$link = 'groupMenu/create';
if (!$isNewRecord) {
$link = 'groupMenu/update';
}
?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Create Menu</h3>
</div>
<form class="form-horizontal" method="POST" action="<?php echo base_url($link); ?>">
<div class="card-body">
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Nama</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="name" name="name"
value="<?= (!$isNewRecord) ? $data->name : '' ?>" placeholder="Group Menu">
<input type="hidden" class="form-control" id="isNewRecord" name="isNewRecord"
value="<?= (!$isNewRecord) ? 'false' : 'true' ?>" placeholder="Group Menu">
<input type="hidden" class="form-control" id="typpositione" name="position"
value="3" placeholder="position">
<input type="hidden" class="form-control" id="id" name="id"
value="<?= (!$isNewRecord) ? $data->id : '' ?>" placeholder="ID">
</div>
</div>
</div>
<div class="row" style="padding: 12px">
<div class="col-md-12">
<div class="card card-outline card-info">
<div class="card-header">
<h3 class="card-title">
List Menu
</h3>
</div>
<div class="card-body p-0">
<div class="row" style="padding: 20px">
<div style="overflow:auto;max-height:57vh; width: 100%">
<table class="table table-hover">
<?php foreach ($data_menu as $menu): ?>
<?php
$sql = $this->db->query("select * from menu where parent_id = '" . $menu->id . "' ");
$level_2 = $sql->result_array();
?>
<tr style="background-color:<?= (count($level_2) > 0) ? '#ff9999' : '' ?> ">
<td><?= $menu->name ?></td>
<?php foreach ($cruda as $ind => $val): ?>
<td width="75px">
<input class="checkbox-three" type="checkbox"
name="MenuRoleForm[menus][]"
value="<?= $menu->slug . '[' . $ind . ']' ?>" <?= isset($arr_menu[$menu->slug. '[' . $ind . ']']) ? 'checked' : '' ?>
id="menu-<?= $menu->slug ?>[<?= $ind ?>]"> <?= $ind ?>
</td>
<?php endforeach; ?>
</tr>
<?php foreach ($level_2 as $menu2): ?>
<?php
$sql = $this->db->query("select * from menu where parent_id = '" . $menu2['id'] . "' ");
$level_3 = $sql->result_array();
?>
<tr style="background-color:<?= (count($level_3) > 0) ? '#91e4e4' : '' ?> ">
<td>&nbsp;&nbsp;<?= $menu2['name'] ?></td>
<?php foreach ($cruda as $ind => $val): ?>
<td width="75px">
<input class="checkbox-three" type="checkbox"
name="MenuRoleForm[menus][]"
value="<?= $menu2['slug'] . '[' . $ind . ']' ?>" <?= isset($arr_menu[$menu2['slug'] . '[' . $ind . ']']) ? 'checked' : '' ?>
id="menu-<?= $menu2['slug'] ?>[<?= $ind ?>]"> <?= $ind ?>
</td>
<?php endforeach; ?>
</tr>
<?php foreach ($level_3 as $menu3): ?>
<tr>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?= $menu3['name'] ?></td>
<?php foreach ($cruda as $ind => $val): ?>
<td width="75px">
<input class="checkbox-three" type="checkbox"
name="MenuRoleForm[menus][]"
value="<?= $menu3['slug'] . '[' . $ind . ']' ?>" <?= isset($arr_menu[$menu3['slug'] . '[' . $ind . ']']) ? 'checked' : '' ?>
id="menu-<?= $menu3['slug'] ?>[<?= $ind ?>]"> <?= $ind ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer">
<button type="submit"
class="btn btn-info float-right"><?= ($isNewRecord) ? 'Create Group Menu' : 'Update Group Menu' ?></button>
</div>
</form>
</div>
</div>
</div>

View File

@@ -0,0 +1,81 @@
<?php
$cruda = ['C' => 'CREATE', 'R' => 'READ', 'U' => 'UPDATE', 'D' => 'DELETE', 'A' => 'APPROVAL'];
?>
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
<h3 class="card-title">List Group Menu</h3>
</div>
<div class="col-md-6">
</div>
</div>
</div>
<div class="card-header">
<a href="<?= base_url('groupMenu/create') ?>" class="btn btn-success btn-sm float-right">Create Group Menu</a>
</div>
<div class="card-body">
<?php if ($this->session->flashdata('success')): ?>
<div class="alert alert-success" role="alert">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php endif; ?>
<?php if ($this->session->flashdata('failed')): ?>
<div class="alert alert-danger" role="alert">
<?php echo $this->session->flashdata('failed'); ?>
</div>
<?php endif; ?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>Child Menu</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $item): ?>
<tr>
<td><?= $item['name'] ?></td>
<td>
<?php foreach ($item['details']['group'] as $group => $val): ?>
<span class="badge badge-primary"><?= $group ?></span>
<?php endforeach; ?>
<?php foreach ($item['details']['menu'] as $menu => $val): ?>
<?php $lact = ""; ?>
<?php foreach ($cruda as $act => $keterangan) : ?>
<?php if (in_array($act, $val)) {
$label = '';
if ($act == 'C') {
$label = 'success';
} elseif ($act == 'R') {
$label = 'info';
} elseif ($act == 'U') {
$label = 'warning';
} elseif ($act == 'D') {
$label = 'danger';
} elseif ($act == 'A') {
$label = 'primary';
}
$lact .= '<span class="badge badge-' . $label . '">' . $act . '</span>&nbsp;&nbsp;';
} ?>
<?php endforeach; ?>
<span class="badge badge-secondary"><?= $menu .'&nbsp;&nbsp;' . $lact ?></span>
<?php endforeach; ?>
</td>
<td>
<a href="<?= base_url('groupMenu/update/' . encrypt_url($item['id'])) ?>"
class="btn btn-info btn-xs"><i class="fas fa-edit"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,110 @@
<?php
$app = $this->db->query("select * from company_profile")->row();
?>
<footer class="main-footer">
<strong>Copyright &copy; <?= !empty($app->year) ? $app->year : '' ?> <a
href="<?= !empty($app->website) ? $app->website : '#' ?>"><?= isset($app) ? $app->company : '' ?></a>.</strong>
<div class="float-right d-none d-sm-inline-block">
<?= !empty($app->version) ? '<b>Version </b>' . $app->version : '' ?>
</div>
</footer>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<!-- jQuery -->
<script src="<?= base_url(); ?>assets/template/plugins/jquery/jquery.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="<?= base_url(); ?>assets/template/plugins/jquery-ui/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
$.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="<?= base_url(); ?>assets/template/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- ChartJS -->
<script src="<?= base_url(); ?>assets/template/plugins/chart.js/Chart.min.js"></script>
<!-- Sparkline -->
<!--<script src="<?= base_url(); ?>assets/template/plugins/sparklines/sparkline.js"></script>-->
<!-- JQVMap -->
<!--<script src="<?= base_url(); ?>assets/template/plugins/jqvmap/jquery.vmap.min.js"></script>-->
<!--<script src="<?= base_url(); ?>assets/template/plugins/jqvmap/maps/jquery.vmap.usa.js"></script>-->
<!-- jQuery Knob Chart -->
<script src="<?= base_url(); ?>assets/template/plugins/jquery-knob/jquery.knob.min.js"></script>
<!-- daterangepicker -->
<script src="<?= base_url(); ?>assets/template/plugins/moment/moment.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/daterangepicker/daterangepicker.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="<?= base_url(); ?>assets/template/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<!-- Summernote -->
<script src="<?= base_url(); ?>assets/template/plugins/summernote/summernote-bs4.min.js"></script>
<!-- overlayScrollbars -->
<script src="<?= base_url(); ?>assets/template/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="<?= base_url(); ?>assets/template/dist/js/adminlte.js"></script>
<!--Internal Sweet-Alert js-->
<script src="<?php echo base_url('assets/template/'); ?>plugins/sweet-alert/dist/js/sweetalert2.min.js"></script>
<!-- AdminLTE for demo purposes -->
<!--<script src="--><? //= base_url(); ?><!--assets/template/dist/js/demo.js"></script>-->
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<!--<script src="<?= base_url(); ?>assets/template/dist/js/pages/dashboard.js"></script>-->
<!-- DataTables & Plugins -->
<script src="<?= base_url(); ?>assets/template/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/jszip/jszip.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/pdfmake/pdfmake.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/pdfmake/vfs_fonts.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
<!-- Select2 -->
<script src="<?= base_url(); ?>assets/template/plugins/select2/js/select2.full.min.js"></script>
<!-- Bootstrap4 Duallistbox -->
<script src="<?= base_url(); ?>assets/template/plugins/bootstrap4-duallistbox/jquery.bootstrap-duallistbox.min.js"></script>
<script src="<?= base_url(); ?>assets/js_system/index.js">
</script>
<?php if (isset($js_page)) { ?>
<script src="<?= base_url('assets/js_system/') . $js_page ?>.js"></script>
<?php } ?>
<script>
var getUrl = window.location;
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
$(function () {
$("#example1").DataTable({
"responsive": true, "lengthChange": false, "autoWidth": false
}).buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)');
$('#example2').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
$('.select2').select2()
});
</script>
</body>
</html>

View File

@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= $title ?></title>
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome -->
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/fontawesome-free/css/all.min.css"/>
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Tempusdominus Bootstrap 4 -->
<link rel="stylesheet"
href="<?= base_url(); ?>assets/template/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css"/>
<!-- Select2 -->
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/icheck-bootstrap/icheck-bootstrap.min.css"/>
<!-- JQVMap -->
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/jqvmap/jqvmap.min.css"/>
<!-- Theme style -->
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/dist/css/adminlte.min.css"/>
<!-- overlayScrollbars -->
<link rel="stylesheet"
href="<?= base_url(); ?>assets/template/plugins/overlayScrollbars/css/OverlayScrollbars.min.css"/>
<!-- Daterange picker -->
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/daterangepicker/daterangepicker.css"/>
<!-- summernote -->
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/summernote/summernote-bs4.min.css"/>
<!-- DataTables -->
<link rel="stylesheet"
href="<?= base_url(); ?>assets/template/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css"/>
<link rel="stylesheet"
href="<?= base_url(); ?>assets/template/plugins/datatables-responsive/css/responsive.bootstrap4.min.css"/>
<link rel="stylesheet"
href="<?= base_url(); ?>assets/template/plugins/datatables-buttons/css/buttons.bootstrap4.min.css"/>
<!-- Bootstrap4 Duallistbox -->
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/bootstrap4-duallistbox/bootstrap-duallistbox.min.css">
<!--- Internal Sweet-Alert css-->
<link href="<?php echo base_url('assets/template/'); ?>plugins/sweet-alert/dist/css/sweetalert2.css"
rel="stylesheet">
</head>
<body class="layout-footer-fixed layout-navbar-fixed">
<div class="wrapper">

View File

@@ -0,0 +1,37 @@
<?php $this->load->view("layouts/main_header"); ?>
<?php $this->load->view("layouts/main_nav"); ?>
<?php $this->load->view("layouts/main_left"); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1><?= $title ?></h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="<?= base_url(); ?>">Home</a></li>
<?php foreach ($breadcrumbs as $item) : ?>
<li class="breadcrumb-item <?= isset($item['active']) ? $item['active'] : '' ?>">
<?= (isset($item['url']) ? '<a href="' . $item['url'] . '">' : '') ?>
<?= $item['label'] ?>
<?= (isset($item['url']) ? '</a>' : '') ?>
</li>
<?php endforeach; ?>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<section class="content">
<div class="container-fluid">
<?php $this->load->view($main_content); ?>
</div><!-- /.container-fluid -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php $this->load->view("layouts/main_footer"); ?>

View File

@@ -0,0 +1,103 @@
<?php
$sql = $this->db->query("select * from menu where type = 1 and level = 1");
$menu_left_level_1 = $sql->result_array();
$app = $this->db->query("select * from company_profile")->row();
?>
<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<!-- Brand Logo -->
<a href="<?= base_url() ?>" class="brand-link">
<?php if (!empty($app->logo)): ?>
<img src="<?= base_url('assets/img/upload/' . $app->logo); ?>" alt="AdminLTE Logo"
class="brand-image img-circle elevation-3" style="opacity: .8">
<?php endif; ?>
<span class="brand-text font-weight-light"><?= isset($app) ? $app->name : '' ?></span>
</a>
<!-- Sidebar -->
<div class="sidebar">
<!-- Sidebar user panel (optional) -->
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image">
<img src="<?= (!empty($this->session->userdata('foto'))) ? base_url('assets/img/upload/'. $this->session->userdata('foto')) : base_url('assets/img/system/no_person.jpg') ?>" class="img-circle elevation-2"
alt="User Image">
</div>
<div class="info">
<a href="<?= base_url() ?>" class="d-block"><?= $this->session->userdata('name') ?></a>
</div>
</div>
<!-- Sidebar Menu -->
<nav class="mt-2">
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
<li class="nav-header">MENU UTAMA</li>
<?php if ($menu_left_level_1 > 0): ?>
<?php foreach ($menu_left_level_1 as $level_1): ?>
<?php
$sql = $this->db->query("select * from menu where type = 1 and level = 2 and parent_id = '" . $level_1['id'] . "' ");
$menu_left_level_2 = $sql->result_array();
?>
<li class="nav-item">
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')[$level_1['slug'] . '[R]']))) : ?>
<a href="<?= base_url($level_1['link']) ?>" class="nav-link">
<?php if (!empty($level_1['icon'])) : ?>
<i class="nav-icon <?= $level_1['icon'] ?> nav-icon"></i>
<?php endif; ?>
<p>
<?= $level_1['name'] ?>
<?php if (!empty($menu_left_level_2)): ?>
<i class="fas fa-angle-left right"></i>
<?php endif; ?>
</p>
</a>
<?php endif; ?>
<?php if (!empty($menu_left_level_2)): ?>
<ul class="nav nav-treeview">
<?php foreach ($menu_left_level_2 as $level_2):
$sql = $this->db->query("select * from menu where type = 1 and level = 3 and parent_id = '" . $level_2['id'] . "' ");
$menu_left_level_3 = $sql->result_array();
?>
<li class="nav-item">
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')[$level_2['slug'] . '[R]']))) : ?>
<a href="<?= $level_2['link'] ?>" class="nav-link">
<i class="far fa-circle nav-icon"></i>
<p><?= $level_2['name'] ?></p>
<?php if (!empty($menu_left_level_3)): ?>
<i class="right fas fa-angle-left"></i>
<?php endif; ?>
</a>
<?php endif; ?>
<?php if (!empty($menu_left_level_3)): ?>
<ul class="nav nav-treeview">
<?php foreach ($menu_left_level_3 as $level_3): ?>
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')[$level_3['slug'] . '[R]']))) : ?>
<li class="nav-item">
<a href="<?= $level_3['link'] ?>" class="nav-link">
<i class="far fa-dot-circle nav-icon"></i>
<p><?= $level_3['name'] ?></p>
</a>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</nav>
<!-- /.sidebar-menu -->
</div>
<!-- /.sidebar -->
</aside>

View File

@@ -0,0 +1,89 @@
<?php
$sql = $this->db->query("select * from menu where type = 2 and level = 1");
$menu_top_level_1 = $sql->result_array();
?>
<!-- Navbar -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
<!-- Left navbar links -->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<?php if ($this->session->userdata('switch')): ?>
<li class="nav-item d-none d-sm-inline-block">
<a href="javascript:void(0)" data-id="<?= $this->session->userdata('user_initial')['id'] ?>"
class="nav-link btn-block btn-outline-danger btn-switch-admin"><i class="fas fa-random"></i>
<?= $this->session->userdata('user_initial')['name'] ?></a>
</li>
<?php endif; ?>
<!-- Menu TOP -->
<?php if ($menu_top_level_1 > 0) : ?>
<?php foreach ($menu_top_level_1 as $level_1) : ?>
<li class="nav-item dropdown">
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')[$level_1['slug'] . '[R]']))) : ?>
<a class="nav-link" data-toggle="dropdown" href="#">
<?php if (!empty($level_1['icon'])) : ?>
<i class="<?= $level_1['icon'] ?>"></i>
<?php endif; ?>
<?= $level_1['name'] ?>
</a>
<?php endif; ?>
<?php
$sql = $this->db->query("select * from menu where type = 2 and level = 2 and parent_id = '" . $level_1['id'] . "' ");
$menu_top_level_2 = $sql->result_array();
?>
<?php if ($menu_top_level_2 > 0) : ?>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
<span class="dropdown-item dropdown-header"><?= $level_1['name'] ?></span>
<?php foreach ($menu_top_level_2 as $level_2) : ?>
<div class="dropdown-divider"></div>
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')[$level_2['slug'] . '[R]']))) : ?>
<a href="<?= base_url() . $level_2['link'] ?>" class="dropdown-item">
<?php if (!empty($level_2['icon'])) : ?>
<i class="<?= $level_2['icon'] ?>"></i>
<?php endif; ?>
<?= $level_2['name'] ?>
</a>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</li>
<?php endforeach; ?>
<?php endif; ?>
<li class="nav-item dropdown">
<a class="nav-link" data-toggle="dropdown" href="#">
<i class="fas fa-user"></i> <?= $this->session->userdata('name') ?>
</a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
<div class="user-panel-admin mt-3 pb-3 mb-3 d-flex " style="justify-content: center">
<div class="image">
<img src="<?= (!empty($this->session->userdata('foto'))) ? base_url('assets/img/upload/'. $this->session->userdata('foto')) : base_url('assets/img/system/no_person.jpg') ?>"
class="img-circle elevation-2" alt="User Image" style="width: 100px">
</div>
</div>
<p style="text-align: center; padding-bottom: 10px"><?= $this->session->userdata('name') ?></p>
<div class="dropdown-divider"></div>
<div class="row">
<div class="col-md-6">
<a href="<?php echo base_url('profile/view/' . encrypt_url($this->session->userdata('id'))) ?>"
class="dropdown-item dropdown-footer"> Profile</a>
</div>
<div class="col-md-6">
<a href="<?php echo base_url('site/logout') ?>" class="dropdown-item dropdown-footer"> Log
Out</a>
</div>
</div>
</div>
</li>
</ul>
</nav>
<!-- /.navbar -->

View File

@@ -0,0 +1,117 @@
<?php
$link = 'menu/create';
if (!$isNewRecord) {
$link = 'menu/update';
}
?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Create Menu</h3>
</div>
<form class="form-horizontal" method="POST" action="<?php echo base_url($link); ?>"
enctype="multipart/form-data">
<div class="card-body">
<input type="hidden" class="form-control" id="id" name="id"
value="<?= (!$isNewRecord) ? $data->id : '' ?>" placeholder="ID">
<input type="hidden" class="form-control" id="isNewRecord" name="isNewRecord"
value="<?= (!$isNewRecord) ? 'false' : 'true' ?>" placeholder="isNewRecord">
<input type="hidden" class="form-control" id="level" name="level"
value="<?= (!$isNewRecord) ? $data->level : '' ?>" placeholder="Level">
<input type="hidden" class="form-control" id="parent_1" name="parent_1"
value="<?= (!$isNewRecord) ? $parent[1] : '' ?>" placeholder="Parent 1">
<input type="hidden" class="form-control" id="parent_2" name="parent_2"
value="<?= (!$isNewRecord) ? $parent[2] : '' ?>" placeholder="Parent 2">
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Nama</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="name" name="name"
value="<?= (!$isNewRecord) ? $data->name : '' ?>" placeholder="Nama Menu">
</div>
</div>
<div class="form-group row">
<label for="input_link" class="col-sm-2 col-form-label">Link</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="link" name="link"
value="<?= (!$isNewRecord) ? $data->link : '' ?>"
placeholder="Link / Function Controller">
</div>
</div>
<div class="form-group row">
<label for="input_icon" class="col-sm-2 col-form-label">Icon</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="icon" name="icon"
value="<?= (!$isNewRecord) ? $data->icon : '' ?>" placeholder="Icon">
</div>
<div class="col-sm-3">
<a href="https://fontawesome.com/v5/search" class="btn btn-default btn-sm" target="_blank">
<i class="fab fa-font-awesome"></i>
</a>
</div>
</div>
<div class="form-group row">
<label for="input_position" class="col-sm-2 col-form-label">Position</label>
<div class="col-sm-3">
<div class="form-group">
<select class="form-control select2" id="position" name="position" style="width: 100%;">
<?php if ($isNewRecord) : ?>
<option value="">-- Select Positon --</option>
<option value="1">Left</option>
<option value="2">Top</option>
<?php else: ?>
<option value="1"
selected=<?= ($data->type == 1) ? '"' . 'selected' . '"' : '' ?>>Left
</option>
<option value="2"
selected=<?= ($data->type == 2) ? '"' . 'selected' . '"' : '' ?>>Top
</option>
<?php endif; ?>
</select>
</div>
</div>
</div>
<div class="form-group row">
<label for="input_urutan" class="col-sm-2 col-form-label">Urutan</label>
<div class="col-sm-1">
<input type="text" class="form-control" id="urutan" name="urutan"
value="<?= (!$isNewRecord) ? $data->urutan : '' ?>" placeholder="Urutan">
</div>
</div>
<div class="form-group row">
<label for="input_parent" class="col-sm-2 col-form-label">Parent</label>
<div class="col-sm-3">
<div class="form-group">
<select class="form-control select2" id="level_1" name="level_1" style="width: 100%;">
<option value="">-- Select Level 1 --</option>
</select>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<select class="form-control select2" id="level_2" name="level_2" style="width: 100%;">
<option value="">-- Select Level 2 --</option>
</select>
</div>
</div>
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-info float-right"><?= ($isNewRecord) ? 'Create Menu' : 'Update Menu' ?></button>
</div>
</form>
</div>
</div>
</div>

View File

@@ -0,0 +1,62 @@
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
<h3 class="card-title">List Menu</h3>
</div>
<div class="col-md-6">
</div>
</div>
</div>
<div class="card-header">
<a href="<?= base_url('menu/create') ?>" class="btn btn-success btn-sm float-right">Create Menu</a>
</div>
<div class="card-body">
<?php if ($this->session->flashdata('success')): ?>
<div class="alert alert-success" role="alert">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php endif; ?>
<?php if ($this->session->flashdata('failed')): ?>
<div class="alert alert-danger" role="alert">
<?php echo $this->session->flashdata('failed'); ?>
</div>
<?php endif; ?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Level</th>
<th>Urutan</th>
<th>Link</th>
<th>Icon</th>
<th>Parent</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $item): ?>
<tr>
<td><?= $item->name ?></td>
<td><?= ($item->type == 1) ? 'Left' : 'Top' ?></td>
<td><?= $item->level ?></td>
<td><?= $item->urutan ?></td>
<td><?= $item->link ?></td>
<td><?= $item->icon ?></td>
<td><?= $item->parent ?></td>
<td>
<a href="<?= base_url('menu/update/' . encrypt_url($item->id)) ?>"
class="btn btn-info btn-xs"><i class="fas fa-edit"></i></a>
<a href="<?= base_url('menu/delete/' . encrypt_url($item->id)) ?>"
class="btn btn-danger btn-xs"><i class="fas fa-trash-alt"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,143 @@
<?php
$link = 'profile/create';
if (!$isNewRecord) {
$link = 'profile/update';
}
$key = 'secret-key-in-config';
?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Create Menu</h3>
</div>
<form class="form-horizontal" method="POST" action="<?php echo base_url($link); ?>"
enctype="multipart/form-data">
<div class="row" style="padding: 12px">
<div class="col-md-12">
<div class="card card-outline card-info">
<div class="card-header">
<h3 class="card-title">
Akun User
</h3>
</div>
<div class="card-body p-0">
<div class="row" style="padding: 20px">
<div style="width: 100%">
<div class="form-group row">
<label for="input_username" class="col-sm-2 col-form-label">Username</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="username"
name="User[username]"
value="<?= (!$isNewRecord) ? $data->username : '' ?>"
placeholder="Username" <?= (!$isNewRecord) ? 'readOnly' : '' ?> >
</div>
</div>
<?php if ($isNewRecord): ?>
<div class="form-group row">
<label for="input_password"
class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-6">
<input type="password" class="form-control" id="password"
name="User[password]"
value="<?= (!$isNewRecord) ? $data->password : '' ?>"
placeholder="Password">
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<hr/>
<div class="card-body">
<!-- HIDDEN FORM -->
<div class="form-group row">
<div class="col-sm-8">
<input type="hidden" class="form-control" id="isNewRecord" name="isNewRecord"
value="<?= (!$isNewRecord) ? 'false' : 'true' ?>"
placeholder="isNewRecord">
<input type="hidden" class="form-control" id="user_id" name="user_id"
value="<?= (!$isNewRecord) ? $data->user_id : '' ?>"
placeholder="User ID">
</div>
</div>
<!-- HIDDEN FORM -->
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="name" name="name"
value="<?= (!$isNewRecord) ? $data->name : '' ?>"
placeholder="Name">
</div>
</div>
<div class="form-group row">
<label for="input_email" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-7">
<input type="email" class="form-control" id="email" name="email"
value="<?= (!$isNewRecord) ? $data->email : '' ?>"
placeholder="Email">
</div>
</div>
<div class="form-group row">
<label for="input_phone" class="col-sm-2 col-form-label">Phone</label>
<div class="col-sm-6">
<input type="number" class="form-control" id="phone" name="phone"
value="<?= (!$isNewRecord) ? $data->phone : '' ?>"
placeholder="Phone">
</div>
</div>
<div class="form-group row">
<label for="input_parent" class="col-sm-2 col-form-label">Typeuser</label>
<div class="col-sm-4">
<div class="form-group">
<select class="form-control select2" id="typeuser_id" name="typeuser_id"
style="width: 100%;">
<?php if ($isNewRecord) : ?>
<option value="">-- Select Typeuser --</option>
<?php endif; ?>
<?php foreach ($typeuser as $item): ?>
<option value="<?= $item->id ?>" <?= (!$isNewRecord) ? $item->id == $data->typeuser_id ? "Selected" : "" : '' ?>><?= $item->value ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<div class="form-group row">
<label for="input_foto" class="col-sm-2 col-form-label">Foto</label>
<div class="col-sm-7">
<input type="file" class="form-control" id="foto" name="foto" placeholder="Foto">
</div>
</div>
</div>
<div class="card-footer">
<button type="submit"
class="btn btn-info float-right"><?= ($isNewRecord) ? 'Create Profile' : 'Update Profile' ?></button>
</div>
</form>
</div>
</div>
</div>

View File

@@ -0,0 +1,48 @@
<div class="modal fade" id="modal-reset">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Reset Password</h4>
</div>
<div class="modal-body">
<form id="form-reset" autocomplete="off">
<div class="form-group row">
<label for="password" class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-6">
<input type="password" class="form-control" id="password" name="password"
placeholder="New Password">
<input type="hidden" class="form-control" id="user_id" name="user_id"
value="<?= $user_id ?>"
placeholder="User ID">
</div>
</div>
</form>
</div>
<div class="modal-footer justify-content-between">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="btn-reset-password">Reset</button>
</div>
</div>
</div>
</div>
<script>
$("body").off("click", "#btn-reset-password").on("click", "#btn-reset-password", function (e) {
var data = $('#form-reset').serializeArray();
$.ajax({
type: 'POST',
url: baseUrl + '/profile/reset_password',
data: data,
cache: false,
dataType: 'json',
success: function (data) {
location.reload();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
}
});
});
</script>

View File

@@ -0,0 +1,84 @@
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
<h3 class="card-title">List Profile</h3>
</div>
<div class="col-md-6">
</div>
</div>
</div>
<div class="card-header">
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['profile[C]']))) : ?>
<a href="<?= base_url('profile/create') ?>" class="btn btn-success btn-sm float-right">Create Profile</a>
<?php endif; ?>
</div>
<div class="card-body">
<?php if ($this->session->flashdata('success')): ?>
<div class="alert alert-success" role="alert">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php endif; ?>
<?php if ($this->session->flashdata('failed')): ?>
<div class="alert alert-danger" role="alert">
<?php echo $this->session->flashdata('failed'); ?>
</div>
<?php endif; ?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>Username</th>
<th>Email</th>
<th>Typeuser</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php if (!empty($data)): ?>
<?php foreach ($data as $item) : ?>
<tr>
<td><?= $item['name'] ?></td>
<td><?= $item['username'] ?></td>
<td><?= $item['email'] ?></td>
<td><?= $item['typeuser'] ?></td>
<td>
<?php if ($item['status'] == 1): ?>
<span class="right badge badge-success">Active</span>
<?php else: ?>
<span class="right badge badge-danger">Blocked</span>
<?php endif; ?>
</td>
<td>
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['profile[R]']))) : ?>
<a href="<?= base_url('profile/view/' . encrypt_url($item['user_id'])) ?>"
class="btn btn-warning btn-xs"><i class="fas fa-eye"></i></a>
<?php endif; ?>
<?php if ($item['status'] == 1) : ?>
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['profile[U]']))) : ?>
<a href="<?= base_url('profile/update/' . encrypt_url($item['user_id'])) ?>"
class="btn btn-info btn-xs"><i class="fas fa-edit"></i></a>
<?php endif; ?>
<?php if ($item['typeuser_id'] != 1) : ?>
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['profile[D]']))) : ?>
<a href="<?= base_url('profile/blocked/' . encrypt_url($item['user_id'])) ?>"
class="btn btn-danger btn-xs"><i class="fas fa-ban"> Block</i></a>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr>
<td colspan="6" style="text-align: center; font-style: italic">Data is empty!</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,57 @@
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<div class="card card-primary card-outline">
<div class="card-body box-profile">
<div class="text-center">
<img class="profile-user-img img-fluid img-circle"
src="<?= (!empty($data->foto)) ? base_url('assets/img/upload/' . $data->foto) : base_url('assets/img/system/no_img.jpg') ?>"
alt="User profile picture">
</div>
<h3 class="profile-username text-center"><?= $data->name ?></h3>
<p class="text-muted text-center"><?= $data->typeuser ?></p>
</div>
</div>
</div>
<div class="col-md-9">
<div class="card">
<div class="card-header p-2">
<ul class="nav nav-pills">
<li class="nav-item"><a class="nav-link active" href="#detail"
data-toggle="tab">Detail</a></li>
</ul>
</div>
<div class="card-body">
<div class="tab-content">
<div class="active tab-pane" id="detail">
<strong><i class="fas fa-user-check"></i> Username</strong>
<p class="text-muted"><?= $data->username ?></p>
<hr>
<strong><i class="fas fa-envelope"></i> Email</strong>
<p class="text-muted"><?= $data->email ?></p>
<hr>
<strong><i class="fas fa-phone-square"></i> Phone</strong>
<p class="text-muted"><?= $data->phone ?></p>
<hr>
<strong><i class="fas fa-toggle-on"></i> Status</strong>
<p class="text-muted">
<?php if ($data->status == 1): ?>
<span class="right badge badge-success">Active</span>
<?php else: ?>
<span class="right badge badge-danger">Blocked</span>
<?php endif; ?>
</p>
<hr>
</div>
<div class="tab-pane" id="setting">
<div id="div-setting"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>

View File

@@ -0,0 +1,148 @@
<?php
$link = 'role/create';
if (!$isNewRecord) {
$link = 'role/update';
}
?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Create Menu</h3>
</div>
<form class="form-horizontal" method="POST" action="<?php echo base_url($link); ?>">
<div class="card-body">
<div class="col-md-6">
<table class="table">
<tr>
<th width="200px">Nama</th>
<th width="2px">:</th>
<td><?= $model->name ?></td>
</tr>
<tr>
<th width="200px">Username</th>
<th width="2px">:</th>
<td><?= $model->username ?></td>
</tr>
<tr>
<th width="200px">Typeuser</th>
<th width="2px">:</th>
<td><?= $model->typeuser ?></td>
</tr>
</table>
</div>
<div class="form-group row">
<div class="col-sm-4">
<input type="hidden" class="form-control" id="isNewRecord" name="isNewRecord"
value="<?= (!$isNewRecord) ? 'false' : 'true' ?>" placeholder="Group Menu">
<input type="hidden" class="form-control" id="user_id" name="user_id"
value="<?= $user_id ?>" placeholder="User ID">
</div>
</div>
</div>
<div class="row" style="padding: 12px">
<div class="col-md-4">
<div class="card card-outline card-info">
<div class="card-header">
<h3 class="card-title">
Group Menu
</h3>
</div>
<div class="card-body p-0">
<div class="row" style="padding: 20px">
<table class="table">
<?php foreach ($group_menu as $item): ?>
<tr>
<td width="100px">
<input class="checkbox-three" type="checkbox"
name="MenuRoleForm[groupmenus][]"
value="<?= $item['slug'] ?>" <?= isset($arr_group[$item['slug']]) ? 'checked' : '' ?>
id="gmenu-<?= $item['slug'] ?>"> &nbsp;
&nbsp; <?= $item['name'] ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card card-outline card-info">
<div class="card-header">
<h3 class="card-title">
List Menu
</h3>
</div>
<div class="card-body p-0">
<div class="row" style="padding: 20px">
<div style="overflow:auto;max-height:57vh; width: 100%">
<table class="table table-hover">
<?php foreach ($data_menu as $menu): ?>
<?php
$sql = $this->db->query("select * from menu where parent_id = '" . $menu->id . "' ");
$level_2 = $sql->result_array();
?>
<tr style="background-color:<?= (count($level_2) > 0) ? '#ff9999' : '' ?> ">
<td><?= $menu->name ?></td>
<?php foreach ($cruda as $ind => $val): ?>
<td width="75px">
<input class="checkbox-three" type="checkbox"
name="MenuRoleForm[menus][]"
value="<?= $menu->slug . '[' . $ind . ']' ?>" <?= isset($arr_menu[$menu->slug. '[' . $ind . ']']) ? 'checked' : '' ?>
id="menu-<?= $menu->slug ?>[<?= $ind ?>]"> <?= $ind ?>
</td>
<?php endforeach; ?>
</tr>
<?php foreach ($level_2 as $menu2): ?>
<?php
$sql = $this->db->query("select * from menu where parent_id = '" . $menu2['id'] . "' ");
$level_3 = $sql->result_array();
?>
<tr style="background-color:<?= (count($level_3) > 0) ? '#91e4e4' : '' ?> ">
<td>&nbsp;&nbsp;<?= $menu2['name'] ?></td>
<?php foreach ($cruda as $ind => $val): ?>
<td width="75px">
<input class="checkbox-three" type="checkbox"
name="MenuRoleForm[menus][]"
value="<?= $menu2['slug'] . '[' . $ind . ']' ?>" <?= isset($arr_menu[$menu2['slug'] . '[' . $ind . ']']) ? 'checked' : '' ?>
id="menu-<?= $menu2['slug'] ?>[<?= $ind ?>]"> <?= $ind ?>
</td>
<?php endforeach; ?>
</tr>
<?php foreach ($level_3 as $menu3): ?>
<tr>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?= $menu3['name'] ?></td>
<?php foreach ($cruda as $ind => $val): ?>
<td width="75px">
<input class="checkbox-three" type="checkbox"
name="MenuRoleForm[menus][]"
value="<?= $menu3['slug'] . '[' . $ind . ']' ?>" <?= isset($arr_menu[$menu3['slug'] . '[' . $ind . ']']) ? 'checked' : '' ?>
id="menu-<?= $menu3['slug'] ?>[<?= $ind ?>]"> <?= $ind ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card-footer">
<button type="submit"
class="btn btn-info float-right"><?= ($isNewRecord) ? 'Create Group Menu' : 'Update Role' ?></button>
</div>
</form>
</div>
</div>
</div>

View File

@@ -0,0 +1,89 @@
<?php
$cruda = ['C' => 'CREATE', 'R' => 'READ', 'U' => 'UPDATE', 'D' => 'DELETE', 'A' => 'APPROVAL'];
?>
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
<h3 class="card-title">Role Access User</h3>
</div>
<div class="col-md-6">
</div>
</div>
</div>
<div class="card-body">
<?php if ($this->session->flashdata('success')): ?>
<div class="alert alert-success" role="alert">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php endif; ?>
<?php if ($this->session->flashdata('failed')): ?>
<div class="alert alert-danger" role="alert">
<?php echo $this->session->flashdata('failed'); ?>
</div>
<?php endif; ?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Username</th>
<th>Name</th>
<th>Menu Access</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($model as $item): ?>
<tr>
<td>
<a href="<?= base_url('profile/view/' . encrypt_url($item['user_id'])) ?>"><?= $item['username'] ?></a>
</td>
<td>
<?= $item['name'] ?> <br>
<i class="text-muted" style="font-size:11px"><?= $item['typeuser'] ?></i>
</td>
<td>
<?php foreach ($item['details']['group'] as $group => $val): ?>
<span class="badge badge-primary"><?= $val ?></span>
<?php endforeach; ?>
<?php foreach ($item['details']['menu'] as $menu => $val): ?>
<?php $lact = ""; ?>
<?php foreach ($cruda as $act => $keterangan) : ?>
<?php if (in_array($act, $val)) {
$label = '';
if ($act == 'C') {
$label = 'success';
} elseif ($act == 'R') {
$label = 'info';
} elseif ($act == 'U') {
$label = 'warning';
} elseif ($act == 'D') {
$label = 'danger';
} elseif ($act == 'A') {
$label = 'primary';
}
$lact .= '<span class="badge badge-' . $label . '">' . $act . '</span>&nbsp;&nbsp;';
} ?>
<?php endforeach; ?>
<span class="badge badge-secondary"><?= $menu . '&nbsp;&nbsp;' . $lact ?></span>
<?php endforeach; ?>
</td>
<td>
<?php if ($item['typeuser_id'] != 1): ?>
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['role[R]']))) : ?>
<a href="<?= base_url('role/update/' . encrypt_url($item['user_id'])) ?>"
class="btn btn-info btn-xs"><i class="fas fa-edit"></i></a>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1 @@
INI DASHBOARD

View File

@@ -0,0 +1,78 @@
<?php
$app = $this->db->query("select * from company_profile")->row();
$link = 'site/login';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= isset($app) ? $app->name : '' ?> | Log in</title>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/fontawesome-free/css/all.min.css"/>
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/plugins/icheck-bootstrap/icheck-bootstrap.min.css"/>
<link rel="stylesheet" href="<?= base_url(); ?>assets/template/dist/css/adminlte.min.css"/>
</head>
<body class="hold-transition login-page">
<div class="login-box">
<div class="login-logo">
<p><b><?= isset($app) ? $app->name : '' ?></b></p>
</div>
<div class="card">
<div class="card-body login-card-body">
<p class="login-box-msg">Sign in to start your session</p>
<form class="form-horizontal" method="POST" action="<?php echo base_url($link); ?>"
enctype="multipart/form-data">
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Username" id="username" name="username">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-envelope"></span>
</div>
</div>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" placeholder="Password" id="password" name="password">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<div class="icheck-primary">
<input type="checkbox" id="remember">
<label for="remember">
Remember Me
</label>
</div>
</div>
<div class="col-4">
<button type="submit" class="btn btn-primary btn-block">Sign In</button>
</div>
</div>
</form>
<p class="mb-1">
<a href="forgot-password.html">I forgot my password</a>
</p>
</div>
</div>
<div id="myalert">
<?php echo $this->session->flashdata('alert', true)?>
</div>
</div>
<script src="<?= base_url(); ?>assets/template/plugins/jquery/jquery.min.js"></script>
<script src="<?= base_url(); ?>assets/template/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="<?= base_url(); ?>assets/template/dist/js/adminlte.min.js"></script>
<script>
$('#myalert').delay('slow').slideDown('slow').delay(2000).slideUp(600);
</script>
</body>
</html>

View File

@@ -0,0 +1,63 @@
<?php
$link = 'typeuser/create';
if (!$isNewRecord) {
$link = 'typeuser/update';
}
?>
<div class="row">
<div class="col-md-12">
<div class="card card-info">
<div class="card-header">
<h3 class="card-title">Create Typeuser</h3>
</div>
<form class="form-horizontal" method="POST" action="<?php echo base_url($link); ?>" enctype="multipart/form-data">
<div class="card-body">
<!-- HIDDEN FORM -->
<div class="form-group row">
<div class="col-sm-8">
<input type="hidden" class="form-control" id="isNewRecord" name="isNewRecord" value="<?= (!$isNewRecord) ? 'false' : 'true' ?>" placeholder="isNewRecord">
<input type="hidden" class="form-control" id="id" name="id" value="<?= (!$isNewRecord) ? $data->id : '' ?>" placeholder="id">
</div>
</div>
<!-- HIDDEN FORM -->
<div class="form-group row">
<label for="input_name" class="col-sm-2 col-form-label">Code</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="code" name="code" value="<?= (!$isNewRecord) ? $data->code : '' ?>" placeholder="Code">
</div>
</div>
<div class="form-group row">
<label for="input_email" class="col-sm-2 col-form-label">Value</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="value" name="value" value="<?= (!$isNewRecord) ? $data->value : '' ?>" placeholder="Value">
</div>
</div>
<div class="form-group row">
<label for="input_phone" class="col-sm-2 col-form-label">Description</label>
<div class="col-sm-6">
<input type="text" class="form-control" id="description" name="description" value="<?= (!$isNewRecord) ? $data->description : '' ?>" placeholder="Description">
</div>
</div>
</div>
<div class="card-footer">
<button type="submit" class="btn btn-info float-right"><?= ($isNewRecord) ? 'Create Profile' : 'Update Type User' ?></button>
</div>
</form>
</div>
</div>
</div>

View File

@@ -0,0 +1,67 @@
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
<h3 class="card-title">List Typeuser</h3>
</div>
<div class="col-md-6">
</div>
</div>
</div>
<div class="card-header">
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['typeuser[C]']))) : ?>
<a href="<?= base_url('typeuser/create') ?>" class="btn btn-success btn-sm float-right">Create Typeuser</a>
<?php endif; ?>
</div>
<div class="card-body">
<?php if ($this->session->flashdata('success')) : ?>
<div class="alert alert-success" role="alert">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php endif; ?>
<?php if ($this->session->flashdata('failed')) : ?>
<div class="alert alert-danger" role="alert">
<?php echo $this->session->flashdata('failed'); ?>
</div>
<?php endif; ?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Code</th>
<th>Value</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php if (!empty($data)) :
?>
<?php foreach ($data as $item) : ?>
<tr>
<td><?= $item->code ?></td>
<td><?= $item->value ?></td>
<td><?= $item->description ?></td>
<td>
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['typeuser[U]']))) : ?>
<a href="<?= base_url('typeuser/update/' . encrypt_url($item->id)) ?>" class="btn btn-info btn-xs"><i class="fas fa-edit"></i></a>
<?php endif; ?>
<?php if (($this->session->userdata('is_developer')) || (isset($this->session->userdata('you_can')['typeuser[D]']))) : ?>
<a href="<?= base_url('typeuser/delete/' . encrypt_url($item->id)) ?>" class="btn btn-danger btn-xs"><i class="fas fa-trash"></i></a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<tr>
<td colspan="6" style="text-align: center; font-style: italic">Data is empty!</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,53 @@
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
<h3 class="card-title">List User</h3>
</div>
<div class="col-md-6">
</div>
</div>
</div>
<div class="card-body">
<?php if ($this->session->flashdata('success')): ?>
<div class="alert alert-success" role="alert">
<?php echo $this->session->flashdata('success'); ?>
</div>
<?php endif; ?>
<?php if ($this->session->flashdata('failed')): ?>
<div class="alert alert-danger" role="alert">
<?php echo $this->session->flashdata('failed'); ?>
</div>
<?php endif; ?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Username</th>
<th>Name</th>
<th>Email</th>
<th>Typeuser</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($model as $item): ?>
<tr>
<td>
<a href="<?= base_url('profile/view/' . encrypt_url($item['user_id'])) ?>"><?= $item['username'] ?></a>
</td>
<td><?= $item['name'] ?></td>
<td><?= $item['email'] ?></td>
<td><?= $item['typeuser'] ?></td>
<td>
<a href="javascript:void(0)" data-id=<?= $item['user_id'] ?>
class="btn btn-primary btn-switch-user"><i class="fas fa-random"></i> Switch</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>

View File

@@ -0,0 +1,100 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
<style type="text/css">
::selection { background-color: #E13300; color: white; }
::-moz-selection { background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
text-decoration: none;
}
a:hover {
color: #97310e;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 19px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 12px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#body {
margin: 0 15px 0 15px;
min-height: 96px;
}
p {
margin: 0 0 10px;
padding:0;
}
p.footer {
text-align: right;
font-size: 11px;
border-top: 1px solid #D0D0D0;
line-height: 32px;
padding: 0 10px 0 10px;
margin: 20px 0 0 0;
}
#container {
margin: 10px;
border: 1px solid #D0D0D0;
box-shadow: 0 0 8px #D0D0D0;
}
</style>
</head>
<body>
<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
<p>If you would like to edit this page you'll find it located at:</p>
<code>application/views/welcome_message.php</code>
<p>The corresponding controller for this page is found at:</p>
<code>application/controllers/Welcome.php</code>
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="userguide3/">User Guide</a>.</p>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds. <?php echo (ENVIRONMENT === 'development') ? 'CodeIgniter Version <strong>' . CI_VERSION . '</strong>' : '' ?></p>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

42
assets/js_system/index.js Normal file
View File

@@ -0,0 +1,42 @@
var getUrl = window.location;
var baseUrl =
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
var controller = baseUrl;
$(document).ready(function () {
//alert("Please index js");
});
$(".btn-switch-admin").click(function (e) {
id = $(this).data('id');
console.log(id);
Swal.fire({
title: "Apakah anda yakin?",
text: "Anda Akan Pindah Acces User",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Ya,switch user",
cancelButtonText: "Batal",
}).then((result) => {
if (result.value) {
$.ajax({
url: controller + "/user/switch_user_back",
dataType: "JSON",
type: "POST",
data: {
id: id,
},
success: function (data) {
if (data.status) {
console.log("success");
window.location.href = baseUrl + "/site/dashboard";
} else {
console.log("filed");
window.location.href = baseUrl + "/user";
}
},
error: function (jqXHR, textStatus, errorThrown) {},
}); //end ajax
}
});
});

View File

@@ -0,0 +1,29 @@
var getUrl = window.location;
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
var controller = baseUrl + '/groupMenu';
$(document).ready(function () {
$("body").off("click", "input[class=checkbox-three]").on("click", "input[class=checkbox-three]", function (e) {
var key = $(this).val();
var ket = 0;
if ($(this).is(":checked")) {
var ket = 1;
}
$.ajax({
url: baseUrl + '/groupMenu/getChecked',
type: "POST",
data: {"key": key, "ket": ket},
cache: false,
dataType: 'json',
success: function (data) {
data.forEach(function (idm) {
if (ket == 1) {
$("[id='menu-" + idm + "']").prop("checked", true);
} else {
$("[id='menu-" + idm + "']").prop("checked", false);
}
});
}
});
});
});

View File

@@ -0,0 +1,89 @@
var getUrl = window.location;
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
var controller = baseUrl + '/menu';
$(document).ready(function () {
var isNewRecord = $("#isNewRecord").val();
if (isNewRecord == 'false') {
var key = $("#position").val();
var level = $("#level").val();
if (level == 2) {
change_position(key, $("#parent_1").val());
} else if (level == 3) {
change_position(key, $("#parent_1").val());
change_parent($("#parent_1").val(), $("#parent_2").val());
}
}
});
$(".level_1").select2({
placeholder: "Select Level 1",
allowClear: true
});
$(".level_2").select2({
placeholder: "Select Level 2",
allowClear: true
});
$(".js-example-placeholder-single").select2({
placeholder: "Select a state",
allowClear: true
});
$("#position").change(function () {
var key = $("#position").val();
change_position(key, '', '');
});
function change_position(key, parent) {
$.ajax({
url: baseUrl + '/menu/getParent',
data: {'key': key},
type: 'POST',
cache: false,
dataType: 'json',
success: function (data) {
var html = '';
var i;
if ($("#isNewRecord").val() == 'true') {
html += '<option value="">-- Select Level 1 --</option>';
}
for (i = 0; i < data.length; i++) {
html += '<option value=' + data[i].id + '>' + data[i].name + '</option>';
}
$('#level_1').html(html);
$('#level_1').val(parent);
}
});
}
function change_parent(key, parent_2) {
console.log("aa" + key);
$.ajax({
url: baseUrl + '/menu/getChild',
data: {'key': key},
type: 'POST',
cache: false,
dataType: 'json',
success: function (data) {
var html = '';
var i;
if ($("#isNewRecord").val() == 'true') {
html += '<option value="">-- Select Level 2 --</option>';
}
for (i = 0; i < data.length; i++) {
html += '<option value=' + data[i].id + '>' + data[i].name + '</option>';
}
$('#level_2').html(html);
$('#level_2').val(parent_2);
}
});
}
$("#level_1").change(function () {
var key = $("#level_1").val();
change_parent(key);
});

View File

@@ -0,0 +1,21 @@
var getUrl = window.location;
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
var controller = baseUrl + '/company_profile';
$(document).ready(function () {
load_setting();
});
function load_setting(key) {
$.ajax({
url: baseUrl + '/companyProfile/load_setting',
type: "POST",
data: {},
async: false,
cache: false,
success: function (data) {
console.log(data);
$("#div-setting").html(data);
}
});
}

View File

@@ -0,0 +1,27 @@
var getUrl = window.location;
var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
var controller = baseUrl + '/profile';
$("body").off("click", "#btn-reset").on("click", "#btn-reset", function (e) {
var key = $(this).attr("data-key");
load_modal(key);
});
function load_modal(key) {
$.ajax({
type: 'POST',
url: baseUrl + '/profile/load_modal',
data: {
key: key
},
success: function (data) {
$("#div-reset").html(data);
$('#modal-reset').modal('show');
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
},
complete: function () {
}
});
}

View File

@@ -0,0 +1,43 @@
var getUrl = window.location;
var baseUrl =
getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split("/")[1];
var controller = baseUrl + "/user";
$(document).ready(function () {
//alert("Please enter a valid");
});
$(".btn-switch-user").click(function (e) {
id = $(this).data("id");
Swal.fire({
title: "Apakah anda yakin?",
text: "Anda Akan Pindah Acces User",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
confirmButtonText: "Ya,switch user",
cancelButtonText: "Batal",
}).then((result) => {
if (result.value) {
$.ajax({
url: controller + "/switch_user",
dataType: "JSON",
type: "POST",
data: {
id: id,
},
success: function (data) {
if (data.status) {
console.log("success");
window.location.href = baseUrl + "/site/dashboard";
} else {
console.log("filed");
window.location.href = baseUrl + "/user";
}
},
error: function (jqXHR, textStatus, errorThrown) {},
}); //end ajax
}
});
});

53012
assets/template/dist/css/adminlte.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

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