first commit

This commit is contained in:
ryanwong
2022-06-30 05:46:02 -04:00
commit a96eaec33b
859 changed files with 199842 additions and 0 deletions
Vendored
BIN
View File
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
vendor
Executable
+86
View File
@@ -0,0 +1,86 @@
<?php
/**
* This is my debugging toolset to save me time doing everything
*
*/
class D
{
/**
* Var dump
*
* @param [type] $data
* @return void
*/
public static function v ($data)
{
echo var_dump($data);
}
/**
* Vardump exit
*
* @param [type] $data
* @return void
*/
public static function ve ($data)
{
echo var_dump($data);
exit;
}
/**
* print r
*
* @param [type] $data
* @return void
*/
public static function p ($data)
{
echo '<pre>' . print_r($data, TRUE) . '</pre>';
}
/**
* Print r exit
*
* @param [type] $data
* @return void
*/
public static function pe ($data)
{
echo '<pre>' . print_r($data, TRUE) . '</pre>';
exit;
}
/**
* Error log
*
* @param [type] $data
* @return void
*/
public static function e ($data)
{
error_log($data);
}
/**
* Error log printr
*
* @param [type] $data
* @return void
*/
public static function ep ($data)
{
error_log('<pre>' . print_r($data, TRUE) . '</pre>');
}
/**
* Error log true/false
*
* @param [type] $data
* @return void
*/
public static function et ($data)
{
error_log(($data) ? 'true': 'false');
}
}
+26
View File
@@ -0,0 +1,26 @@
# Book Project
Please perform the following task one by one and commit to git per task. This must all be done today.
## Tasks
1. Create db name outlinegurus. The sql file in the root of application. start the project on php -S localhost:9020
2. Go to task_2.png . See the terms and condition and privacy policy link. They don't go anywhere. Change those href to https://termly.io/our-terms-of-use/ and https://termly.io/our-privacy-policy/
3. Go to task_3.png. Add a column to this ui called year. Add a filter dropdown on top called year and can filter by year. Enable sorting ASC and DESC by year as well.
4. Go to task_4.png an task_4b.png . Admin login is http://localhost:9020/admin/login admin@manaknight.com a123456. In review model add a database field called private_review as text. Add a column called Private Review in the table. Add PRivate Review filter in the search table above. If you look in task_4.png, add a new textarea to ask for Private review and save it.
5. Go to task_5.png . The status dropdown doesn't work properly and filter the statuses. the search title says "Tickets Searchzzz"
Change it to Tickets Search. There PHP error when I run this page
6. Go to task_6.png . When I click export icon, you see status is missing from the export report. Add it back
7. Go to task_7.png . The Count # for Member account is wrong
8. http://localhost:9020/admin/professor/0?order_by=id&direction=DESC page is crashing
9. http://localhost:9020/admin/class/0?order_by=id&direction=DESC page is crashing
10. http://localhost:9020/admin/school/0?order_by=id&direction=DESC page is not working properly
BIN
View File
Binary file not shown.
+135
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('session', 'form_validation', 'pagination');
/*
| -------------------------------------------------------------------
| 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('form', 'url');
/*
| -------------------------------------------------------------------
| 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();
+589
View File
@@ -0,0 +1,589 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/*
|--------------------------------------------------------------------------
| 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 guess the protocol and path
| 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'] = 'http://localhost:9020';
/*
|--------------------------------------------------------------------------
| 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'] = '';
//Social Login Credentials
// $config['google_client_id'] = '00754402286-23vqe2jq62c0vat4se0h56u5o1dhl8i7.apps.googleusercontent.com';
// $config['google_client_secret'] = 'Z6Ocw7xnk2R_4kM8Nv3Wxtfk';
// $config['google_redirect_uri'] = $config['base_url'].'/member/dashboard';
// $config['facebook_app_client_id'] = '783757552091168';
// $config['facebook_app_client_secret'] = 'a739477419f1ad1e1ed831fb9ce7356e';
// $config['facebook_oath_uri'] = $config['base_url'].'/member/dashboard';
// $config['facebook_app_redirect_uri'] = $config['base_url'].'/facebook';
/*
|--------------------------------------------------------------------------
| 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/user_guide/general/urls.html
*/
$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/user_guide/general/core_classes.html
| https://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'Manaknight_';
/*
|--------------------------------------------------------------------------
| 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/user_guide/libraries/encryption.html
|
*/
$config['encryption_key'] = '1n4uUX6d1Us3quFXKA7ZmqFIaQVC5MtgXlV9ho8F';
/*
|--------------------------------------------------------------------------
| 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_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_save_path'] = sys_get_temp_dir();
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'session';
$config['sess_expiration'] = 86400;
// $config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 900;
$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)
|
| 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;
/*
|--------------------------------------------------------------------------
| 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'] = TRUE;
$config['csrf_token_name'] = 'c_is_active';
$config['csrf_cookie_name'] = 'frsc';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array('v1/api.*+','member/login','member/forgot','member/reset/.*','member/register','admin/login','admin/forgot','admin/reset/.*','admin/register');
/*
|--------------------------------------------------------------------------
| 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'] = TRUE;
/*
|--------------------------------------------------------------------------
| 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'] = '';
$config['stripe_publish_key'] = 'pk_test_51IWQUwH8oljXErmdg6L4MhsuB6tDdmumlHFfyNaopty2U27pmRcqMX1c868zn838lGQtU1eYV6bKRSQtMFWf36VT00aNsvnTOE';
$config['stripe_secret_key'] = 'sk_test_51IWQUwH8oljXErmds28KftkL6o6jYIcPgYbBdfEmCPSuAlIh0fgoS4NADcCmsIZbdQ3p5nbAeCOcGkSmo38U9BIe00BdOenrqo';
$config['mailgun_key'] = '';
$config['mail_domain'] = '';
$config['twilio_phone_number'] = '';
$config['twilio_sid'] = '';
$config['twilio_token'] = '';
$config['jwt_key'] = '';
$config['jwt_expire_at'] = 3600;
$config['jwt_refresh_expire_at'] = 7200;
$config['platform_name'] = 'outlinegurus';
$config['from_email'] = 'charlie@outlinegurus.com';
$config['image_upload'] = 's3';
$config['file_upload'] = 's3';
$config['upload_byte_size_limit'] = 1000000000;
$config['email_smtp'] = [
'protocol' => 'smtp',
'smtp_name' => 'OutlineGurus',
'smtp_host' => 'smtp.sendgrid.net',
'smtp_port' => 587,
'smtp_user' => 'apikey',
'smtp_pass' => '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',
'crlf' => "\r\n",
'newline' => "\r\n",
'mailtype' => 'html',
'charset' => 'utf-8'
];
$config['stripe_currency'] = 'usd';
$config['prorate_stripe_subscription'] = '1';
$config['force_cancel'] = '';
$config['trial_stripe_subscription'] = '';
$config['auto_sync_stripe_subscription'] = '';
$config['stripe_endpoint_secret'] = 'whsec_l6Yct5zQh5jmAqNLCq6PUMzkgzO3mwcg';
$config['jwt_key'] = '544e68498c28710b10af9dc9c7c9530951438f23';
$config['jwt_expire_at'] = '3600';
$config['jwt_refresh_expire_at'] = '7200';
$config['google_client_id'] = '466040660536-l5pq116jdp6cs3b58a7k4t52f5lpa5se.apps.googleusercontent.com';
$config['google_client_secret'] = 'W_bYoRhly8pf0XJ1IUsk8wC_';
$config['google_redirect_uri'] = 'http://localhost:9000/google';
$config['application_name'] = '';
$config['facebook_client_id'] = '';
$config['facebook_client_secret'] = '';
$config['facebook_redirect_uri'] = '';
$config['facebook_oath_uri'] = 'https://www.facebook.com/v3.0/dialog/oauth';
$config['aws_version'] = 'latest';
$config['aws_region'] = 'us-west-001';
$config['aws_key'] = '001857ead6a1cd00000000001';
$config['aws_secret'] = 'K001wUKlT3XNApr3SIMiPf5zfe3/NP8';
$config['aws_bucket'] = '0845b73e5a9db66a71ec0d10';
$config['aws_endpoint'] = 'https://outlineguru.s3.us-west-001.backblazeb2.com/';
$config['default_time_zone'] = 'America/New_York';
+85
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 506C6174666F726D20506F7765726564206279204D616E616B6E6967687420496E632E2068747470733A2F2F6D616E616B6E696768746469676974616C2E636F6D 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
+97
View File
@@ -0,0 +1,97 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/*
| -------------------------------------------------------------------
| 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 certificats 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 ('mysqli' only)
|
| ['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' => 'root',
'database' => 'outlinegurus',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => true,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'port' => '3306',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
+24
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">'
);
+21
View File
@@ -0,0 +1,21 @@
<?php
if(! defined('ENVIRONMENT') )
{
$domain = strtolower($_SERVER['HTTP_HOST']);
switch($domain) {
case 'mysite.com' :
define('ENVIRONMENT', 'production');
break;
case 'stage.mysite.com' :
//our staging server
define('ENVIRONMENT', 'staging');
break;
default :
define('ENVIRONMENT', 'development');
break;
}
}
+103
View File
@@ -0,0 +1,103 @@
<?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',
'/Ķ|Κ|К/' => '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',
'/Ź|Ż|Ž|Ζ|З/' => 'Z',
'/ź|ż|ž|ζ|з/' => 'z',
'/Æ|Ǽ/' => 'AE',
'/ß/' => 'ss',
'/IJ/' => 'IJ',
'/ij/' => 'ij',
'/Œ/' => 'OE',
'/ƒ/' => 'f',
'/ξ/' => 'ks',
'/π/' => 'p',
'/β/' => 'v',
'/μ/' => 'm',
'/ψ/' => 'ps',
'/Ё/' => 'Yo',
'/ё/' => 'yo',
'/Є/' => 'Ye',
'/є/' => 'ye',
'/Ї/' => 'Yi',
'/Ж/' => 'Zh',
'/ж/' => 'zh',
'/Х/' => 'Kh',
'/х/' => 'kh',
'/Ц/' => 'Ts',
'/ц/' => 'ts',
'/Ч/' => 'Ch',
'/ч/' => 'ch',
'/Ш/' => 'Sh',
'/ш/' => 'sh',
'/Щ/' => 'Shch',
'/щ/' => 'shch',
'/Ъ|ъ|Ь|ь/' => '',
'/Ю/' => 'Yu',
'/ю/' => 'yu',
'/Я/' => 'Ya',
'/я/' => 'ya'
);
+13
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/user_guide/general/hooks.html
|
*/
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+84
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'] = TRUE;
/*
|--------------------------------------------------------------------------
| 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'] = 20200331104402;
/*
|--------------------------------------------------------------------------
| 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/';
+183
View File
@@ -0,0 +1,183 @@
<?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',
'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' => 'audio/x-acc',
'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',
'7zip' => array('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', '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'
);
+14
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/user_guide/general/profiling.html
|
*/
+318
View File
@@ -0,0 +1,318 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/*
| -------------------------------------------------------------------------
| 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/user_guide/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['v1/api/admin/inventory_gallery_image_list/delete'] = 'Admin/Admin_inventory_gallery_image_list_controller/delete';
$route['admin/inventory_gallery_image_list/view/(:num)'] = 'Admin/Admin_inventory_gallery_image_list_controller/view/$1';
$route['admin/inventory_gallery_image_list/edit/(:num)'] = 'Admin/Admin_inventory_gallery_image_list_controller/edit/$1';
$route['v1/api/admin/inventory_attribute/bulk_delete'] = 'Admin/Admin_inventory_attribute_controller/bulk_delete';
$route['v1/api/home/load_items_by_category_select'] = 'Guest/Home_controller/load_items_by_category_select';
$route['admin/inventory_gallery_image_list/(:num)'] = 'Admin/Admin_inventory_gallery_image_list_controller/index/$1';
$route['v1/api/admin/spreadsheet/api_bulk_delete'] = 'Admin/Admin_spreadsheet_api_controller/api_bulk_delete';
$route['v1/api/admin/inventory_attribute/delete'] = 'Admin/Admin_inventory_attribute_controller/delete';
$route['v1/api/admin/attribute_type/bulk_delete'] = 'Admin/Admin_attribute_type_controller/bulk_delete';
$route['admin/inventory_gallery_image_list/add'] = 'Admin/Admin_inventory_gallery_image_list_controller/add';
$route['admin/inventory_attribute/view/(:num)'] = 'Admin/Admin_inventory_attribute_controller/view/$1';
$route['admin/inventory_attribute/edit/(:num)'] = 'Admin/Admin_inventory_attribute_controller/edit/$1';
$route['v1/api/admin/transaction/bulk_delete'] = 'Admin/Admin_transaction_controller/bulk_delete';
$route['v1/api/admin/spreadsheet/edit/(:num)'] = 'Admin/Admin_spreadsheet_api_controller/edit/$1';
$route['v1/api/admin/spreadsheet/bulk_delete'] = 'Admin/Admin_spreadsheet_controller/bulk_delete';
$route['v1/api/member/user_card/set_default'] = 'Member/Member_user_card_controller/set_default';
$route['v1/api/admin/test_image/bulk_delete'] = 'Admin/Admin_test_image_controller/bulk_delete';
$route['v1/api/admin/marketing/bulk_delete'] = 'Admin/Admin_marketing_controller/bulk_delete';
$route['v1/api/admin/attribute_type/delete'] = 'Admin/Admin_attribute_type_controller/delete';
$route['admin/inventory_gallery_image_list'] = 'Admin/Admin_inventory_gallery_image_list_controller/index/0';
$route['v1/api/admin/settings/edit/(:num)'] = 'Admin/Admin_setting_controller/edit/$1';
$route['v1/api/update_spreadsheet/(:num)'] = 'Admin/Admin_spreadsheet_controller/spreadsheet_data/$1';
$route['v1/api/member/transaction/delete'] = 'Member/Member_transaction_controller/delete';
$route['v1/api/get_marketing_slug/(:any)'] = 'Admin/Marketing_controller/generate_marketing_slug/$1';
$route['member/post_review/(:num)/(:num)'] = 'Member/Member_inventory_controller/post_review/$1/$2';
$route['admin/inventory_attribute/(:num)'] = 'Admin/Admin_inventory_attribute_controller/index/$1';
$route['admin/attribute_type/view/(:num)'] = 'Admin/Admin_attribute_type_controller/view/$1';
$route['admin/attribute_type/edit/(:num)'] = 'Admin/Admin_attribute_type_controller/edit/$1';
$route['v1/api/admin/transaction/delete'] = 'Admin/Admin_transaction_controller/delete';
$route['v1/api/admin/spreadsheet/(:num)'] = 'Admin/Admin_spreadsheet_api_controller/index/$1';
$route['v1/api/admin/delete_order_notes'] = 'Admin/Admin_order_controller/delete_order_notes';
$route['v1/api/member/user_card/delete'] = 'Member/Member_user_card_controller/delete';
$route['v1/api/member/inventory/delete'] = 'Member/Member_inventory_controller/delete';
$route['v1/api/home/get_all_categories'] = 'Guest/Home_controller/get_all_categories';
$route['v1/api/admin/users/view/(:num)'] = 'Admin/Admin_credential_api_controller/view/$1';
$route['v1/api/admin/users/edit/(:num)'] = 'Admin/Admin_credential_api_controller/edit/$1';
$route['v1/api/admin/suggestion/delete'] = 'Admin/Admin_suggestion_controller/delete';
$route['member/transaction/view/(:num)'] = 'Member/Member_transaction_controller/view/$1';
$route['member/transaction/edit/(:num)'] = 'Member/Member_transaction_controller/edit/$1';
$route['admin/suggestion/delete/(:num)'] = 'Admin/Admin_suggestion_controller/delete/$1';
$route['v1/api/admin/professor/delete'] = 'Admin/Admin_professor_controller/delete';
$route['v1/api/admin/marketing/delete'] = 'Admin/Admin_marketing_controller/delete';
$route['v1/api/admin/inventory/delete'] = 'Admin/Admin_inventory_controller/delete';
$route['v1/api/admin/edit_order_notes'] = 'Admin/Admin_order_controller/edit_order_notes';
$route['admin/transaction/view/(:num)'] = 'Admin/Admin_transaction_controller/view/$1';
$route['admin/transaction/edit/(:num)'] = 'Admin/Admin_transaction_controller/edit/$1';
$route['admin/spreadsheet/edit/(:num)'] = 'Admin/Admin_spreadsheet_controller/edit/$1';
$route['admin/inventory_attribute/add'] = 'Admin/Admin_inventory_attribute_controller/add';
$route['v1/api/member/suggestion/add'] = 'Member/Member_inventory_controller/add_suggestion';
$route['v1/api/admin/textbook/delete'] = 'Admin/Admin_textbook_controller/delete';
$route['v1/api/admin/spreadsheet/add'] = 'Admin/Admin_spreadsheet_api_controller/add';
$route['v1/api/admin/sms/view/(:num)'] = 'Admin/Admin_sms_api_controller/view/$1';
$route['v1/api/admin/sms/edit/(:num)'] = 'Admin/Admin_sms_api_controller/edit/$1';
$route['v1/api/admin/category/delete'] = 'Admin/Admin_category_controller/delete';
$route['v1/api/admin/add_order_notes'] = 'Admin/Admin_order_controller/add_order_notes';
$route['member/purchases/view/(:num)'] = 'Member/Member_purchases_controller/view/$1';
$route['member/inventory/view/(:num)'] = 'Member/Member_inventory_controller/view/$1';
$route['admin/test_image/edit/(:num)'] = 'Admin/Admin_test_image_controller/edit/$1';
$route['admin/suggestion/view/(:num)'] = 'Admin/Admin_suggestion_controller/view/$1';
$route['admin/contact_us/view/(:num)'] = 'Admin/Admin_contact_us_controller/view/$1';
$route['v1/api/admin/content/delete'] = 'Admin/Admin_content_controller/delete';
$route['member/review/(:num)/(:num)'] = 'Member/Member_inventory_controller/review/$1/$2';
$route['member/dispute_order/(:num)'] = 'Member/Member_inventory_controller/dispute_order';
$route['admin/ticket/resolve/(:num)'] = 'Admin/Admin_ticket_controller/resolve/$1';
$route['admin/professor/edit/(:num)'] = 'Admin/Admin_professor_controller/edit/$1';
$route['admin/marketing/view/(:num)'] = 'Admin/Admin_marketing_controller/view/$1';
$route['admin/marketing/edit/(:num)'] = 'Admin/Admin_marketing_controller/edit/$1';
$route['admin/inventory/view/(:num)'] = 'Admin/Admin_inventory_controller/view/$1';
$route['admin/inventory/edit/(:num)'] = 'Admin/Admin_inventory_controller/edit/$1';
$route['admin/attribute_type/(:num)'] = 'Admin/Admin_attribute_type_controller/index/$1';
$route['v1/api/update_sheet/(:num)'] = 'Admin/Admin_spreadsheet_controller/update_sheet/$1';
$route['v1/api/admin/school/delete'] = 'Admin/Admin_school_controller/delete';
$route['member/dispute/view/(:num)'] = 'Member/Member_dispute_controller/view/$1';
$route['admin/textbook/edit/(:num)'] = 'Admin/Admin_textbook_controller/edit/$1';
$route['admin/review/reject/(:num)'] = 'Admin/Admin_review_controller/reject/$1';
$route['admin/payout/mark_all_paid'] = 'Admin/Admin_payout_controller/mark_all_paid';
$route['admin/category/edit/(:num)'] = 'Admin/Admin_category_controller/edit/$1';
$route['v1/api/member/cart/delete'] = 'Member/Member_cart_controller/delete';
$route['v1/api/file/import/(:any)'] = 'Guest/Image_controller/file_import/$1';
$route['v1/api/admin/users/(:num)'] = 'Admin/Admin_credential_api_controller/index/$1';
$route['v1/api/admin/image/delete'] = 'Admin/Admin_image_controller/delete';
$route['v1/api/admin/color/delete'] = 'Admin/Admin_color_controller/delete';
$route['v1/api/admin/class/delete'] = 'Admin/Admin_class_controller/delete';
$route['member/update_credentials'] = 'Member/Member_profile_controller/update_credentials';
$route['member/transaction/(:num)'] = 'Member/Member_transaction_controller/index/$1';
$route['admin/setting/edit/(:num)'] = 'Admin/Admin_setting_controller/edit/$1';
$route['admin/order/refund/(:num)'] = 'Admin/Admin_order_controller/refund/$1';
$route['admin/inventory_attribute'] = 'Admin/Admin_inventory_attribute_controller/index/0';
$route['admin/dispute/edit/(:num)'] = 'Admin/Admin_dispute_controller/edit/$1';
$route['admin/content/edit/(:num)'] = 'Admin/Admin_content_controller/edit/$1';
$route['v1/api/admin/spreadsheet'] = 'Admin/Admin_spreadsheet_api_controller/index/0';
$route['v1/api/admin/cart/delete'] = 'Admin/Admin_cart_controller/delete';
$route['admin/update_credentials'] = 'Admin/Admin_profile_controller/update_credentials';
$route['admin/transaction/(:num)'] = 'Admin/Admin_transaction_controller/index/$1';
$route['admin/spreadsheet/(:num)'] = 'Admin/Admin_spreadsheet_controller/index/$1';
$route['admin/school/edit/(:num)'] = 'Admin/Admin_school_controller/edit/$1';
$route['admin/refund/edit/(:num)'] = 'Admin/Admin_refund_controller/edit/$1';
$route['admin/payout/paid/(:num)'] = 'Admin/Admin_payout_controller/paid/$1';
$route['admin/emails/view/(:num)'] = 'Admin/Admin_email_controller/view/$1';
$route['admin/emails/edit/(:num)'] = 'Admin/Admin_email_controller/edit/$1';
$route['admin/attribute_type/add'] = 'Admin/Admin_attribute_type_controller/add';
$route['v1/api/admin/tax/delete'] = 'Admin/Admin_tax_controller/delete';
$route['member/user_card/(:num)'] = 'Member/Member_user_card_controller/index/$1';
$route['member/purchases/(:num)'] = 'Member/Member_purchases_controller/index/$1';
$route['member/inventory/(:num)'] = 'Member/Member_inventory_controller/index/$1';
$route['member/cart/view/(:num)'] = 'Member/Member_cart_controller/view/$1';
$route['member/cart/edit/(:num)'] = 'Member/Member_cart_controller/edit/$1';
$route['admin/users/view/(:num)'] = 'Admin/Admin_credential_controller/view/$1';
$route['admin/users/edit/(:num)'] = 'Admin/Admin_credential_controller/edit/$1';
$route['admin/test_image/(:num)'] = 'Admin/Admin_test_image_controller/index/$1';
$route['admin/suggestion/(:num)'] = 'Admin/Admin_suggestion_controller/index/$1';
$route['admin/order/view/(:num)'] = 'Admin/Admin_order_controller/view/$1';
$route['admin/image/view/(:num)'] = 'Admin/Admin_image_controller/view/$1';
$route['admin/contact_us/(:num)'] = 'Admin/Admin_contact_us_controller/index/$1';
$route['admin/color/view/(:num)'] = 'Admin/Admin_color_controller/view/$1';
$route['admin/color/edit/(:num)'] = 'Admin/Admin_color_controller/edit/$1';
$route['admin/class/edit/(:num)'] = 'Admin/Admin_class_controller/edit/$1';
$route['v1/api/member/purchase'] = 'Member/Member_inventory_controller/purchase';
$route['v1/api/admin/users/add'] = 'Admin/Admin_credential_api_controller/add';
$route['member/transaction/add'] = 'Member/Member_transaction_controller/add';
$route['admin/user_card/(:num)'] = 'Admin/Admin_user_card_controller/index/$1';
$route['admin/professor/(:num)'] = 'Admin/Admin_professor_controller/index/$1';
$route['admin/marketing/(:num)'] = 'Admin/Admin_marketing_controller/index/$1';
$route['admin/inventory/(:num)'] = 'Admin/Admin_inventory_controller/index/$1';
$route['admin/cart/view/(:num)'] = 'Admin/Admin_cart_controller/view/$1';
$route['admin/cart/edit/(:num)'] = 'Admin/Admin_cart_controller/edit/$1';
$route['member/dispute/(:num)'] = 'Member/Member_dispute_controller/index/$1';
$route['admin/transaction/add'] = 'Admin/Admin_transaction_controller/add';
$route['admin/textbook/(:num)'] = 'Admin/Admin_textbook_controller/index/$1';
$route['admin/tax/view/(:num)'] = 'Admin/Admin_tax_controller/view/$1';
$route['admin/tax/edit/(:num)'] = 'Admin/Admin_tax_controller/edit/$1';
$route['admin/spreadsheet/add'] = 'Admin/Admin_spreadsheet_controller/add';
$route['admin/sms/view/(:num)'] = 'Admin/Admin_sms_controller/view/$1';
$route['admin/sms/edit/(:num)'] = 'Admin/Admin_sms_controller/edit/$1';
$route['admin/category/(:num)'] = 'Admin/Admin_category_controller/index/$1';
$route['v1/api/stripe_events'] = 'Admin/Stripe_webhooks_api_controller/index';
$route['v1/api/image/get_all'] = 'Guest/Image_controller/get_all_images';
$route['v1/api/assets/(:num)'] = 'Guest/Image_controller/paginate/$1';
$route['v1/api/admin/sms/add'] = 'Admin/Admin_sms_api_controller/add';
$route['v1/api/add_inventory'] = 'Member/Member_inventory_controller/add_inventory';
$route['terms_and_conditions'] = 'Guest/Home_controller/terms_and_conditions';
$route['member/user_card/add'] = 'Member/Member_user_card_controller/add';
$route['member/ticket/(:num)'] = 'Member/Member_ticket_controller/index/$1';
$route['member/inventory/add'] = 'Member/Member_inventory_controller/add';
$route['admin/test_image/add'] = 'Admin/Admin_test_image_controller/add';
$route['admin/setting/(:num)'] = 'Admin/Admin_setting_controller/index/$1';
$route['admin/dispute/(:num)'] = 'Admin/Admin_dispute_controller/index/$1';
$route['admin/content/(:num)'] = 'Admin/Admin_content_controller/index/$1';
$route['admin/attribute_type'] = 'Admin/Admin_attribute_type_controller/index/0';
$route['v1/api/image/upload'] = 'Guest/Image_controller';
$route['v1/api/autocomplete'] = 'Guest/Home_controller/autocomplete';
$route['member/sales/(:num)'] = 'Member/Member_sales_controller/index/$1';
$route['member/reset/(:num)'] = 'Member/Member_reset_controller/index/$1';
$route['member/post_setting'] = 'Member/Member_inventory_controller/post_setting';
$route['member/post_dispute'] = 'Member/Member_inventory_controller/post_dispute';
$route['admin/ticket/(:num)'] = 'Admin/Admin_ticket_controller/index/$1';
$route['admin/school/(:num)'] = 'Admin/Admin_school_controller/index/$1';
$route['admin/review/(:num)'] = 'Admin/Admin_review_controller/index/$1';
$route['admin/refund/(:num)'] = 'Admin/Admin_refund_controller/index/$1';
$route['admin/professor/add'] = 'Admin/Admin_professor_controller/add';
$route['admin/payout/(:num)'] = 'Admin/Admin_payout_controller/index/$1';
$route['admin/marketing/add'] = 'Admin/Admin_marketing_controller/add';
$route['admin/inventory/add'] = 'Admin/Admin_inventory_controller/add';
$route['admin/emails/(:num)'] = 'Admin/Admin_email_controller/index/$1';
$route['v1/api/preview_csv'] = 'Guest/Image_controller/preview_csv';
$route['v1/api/file/upload'] = 'Guest/Image_controller/file_upload';
$route['v1/api/admin/users'] = 'Admin/Admin_credential_api_controller/index/0';
$route['member/transaction'] = 'Member/Member_transaction_controller/index/0';
$route['member/cart/(:num)'] = 'Member/Member_cart_controller/index/$1';
$route['admin/users/(:num)'] = 'Admin/Admin_credential_controller/index/$1';
$route['admin/textbook/add'] = 'Admin/Admin_textbook_controller/add';
$route['admin/order/(:num)'] = 'Admin/Admin_order_controller/index/$1';
$route['admin/image/(:num)'] = 'Admin/Admin_image_controller/index/$1';
$route['admin/color/(:num)'] = 'Admin/Admin_color_controller/index/$1';
$route['admin/class/(:num)'] = 'Admin/Admin_class_controller/index/$1';
$route['admin/category/add'] = 'Admin/Admin_category_controller/add';
$route['v1/api/professors'] = 'Guest/Api_controller/get_professors';
$route['v1/api/get_review'] = 'Guest/Home_controller/get_review';
$route['member/credential'] = 'Member/Member_profile_credential_controller';
$route['admin/transaction'] = 'Admin/Admin_transaction_controller/index/0';
$route['admin/spreadsheet'] = 'Admin/Admin_spreadsheet_controller/index/0';
$route['admin/dispute/add'] = 'Admin/Admin_dispute_controller/add';
$route['admin/content/add'] = 'Admin/Admin_content_controller/add';
$route['admin/cart/(:num)'] = 'Admin/Admin_cart_controller/index/$1';
$route['v1/api/textbooks'] = 'Guest/Api_controller/get_textbooks';
$route['v1/api/admin/sms'] = 'Admin/Admin_sms_api_controller';
$route['member/user_card'] = 'Member/Member_user_card_controller/index/0';
$route['member/purchases'] = 'Member/Member_purchases_controller/index/0';
$route['member/inventory'] = 'Member/Member_inventory_controller/index/0';
$route['member/dashboard'] = 'Member/Member_dashboard_controller';
$route['admin/test_image'] = 'Admin/Admin_test_image_controller/index/0';
$route['admin/tax/(:num)'] = 'Admin/Admin_tax_controller/index/$1';
$route['admin/suggestion'] = 'Admin/Admin_suggestion_controller/index/0';
$route['admin/school/add'] = 'Admin/Admin_school_controller/add';
$route['admin/refund/add'] = 'Admin/Admin_refund_controller/add';
$route['admin/emails/add'] = 'Admin/Admin_email_controller/add';
$route['admin/credential'] = 'Admin/Admin_profile_credential_controller';
$route['admin/contact_us'] = 'Admin/Admin_contact_us_controller/index/0';
$route['member/register'] = 'Member/Member_register_controller';
$route['member/cart/add'] = 'Member/Member_cart_controller/add';
$route['admin/users/add'] = 'Admin/Admin_credential_controller/add';
$route['admin/user_card'] = 'Admin/Admin_user_card_controller/index/0';
$route['admin/professor'] = 'Admin/Admin_professor_controller/index/0';
$route['admin/marketing'] = 'Admin/Admin_marketing_controller/index/0';
$route['admin/inventory'] = 'Admin/Admin_inventory_controller/index/0';
$route['admin/image/add'] = 'Admin/Admin_image_controller/add';
$route['admin/dashboard'] = 'Admin/Admin_dashboard_controller';
$route['admin/color/add'] = 'Admin/Admin_color_controller/add';
$route['admin/class/add'] = 'Admin/Admin_class_controller/add';
$route['v1/api/schools'] = 'Guest/Api_controller/get_schools';
$route['v1/api/courses'] = 'Guest/Api_controller/get_courses';
$route['v1/api/contact'] = 'Guest/Home_controller/contact';
$route['privacy_policy'] = 'Guest/Home_controller/privacy_policy';
$route['preview/(:num)'] = 'Guest/Home_controller/preview/$1';
$route['member/setting'] = 'Member/Member_inventory_controller/setting';
$route['member/profile'] = 'Member/Member_profile_controller';
$route['member/dispute'] = 'Member/Member_dispute_controller/index/0';
$route['admin/textbook'] = 'Admin/Admin_textbook_controller/index/0';
$route['admin/settings'] = 'Admin/Admin_setting_controller/index';
$route['admin/category'] = 'Admin/Admin_category_controller/index/0';
$route['admin/cart/add'] = 'Admin/Admin_cart_controller/add';
$route['v1/api/assets'] = 'Guest/Image_controller/paginate/0';
$route['member/ticket'] = 'Member/Member_ticket_controller/index/0';
$route['member/logout'] = 'Member/Member_login_controller/logout';
$route['member/forgot'] = 'Member/Member_forgot_controller';
$route['admin/tax/add'] = 'Admin/Admin_tax_controller/add';
$route['admin/sms/add'] = 'Admin/Admin_sms_controller/add';
$route['admin/setting'] = 'Admin/Admin_setting_controller/index/0';
$route['admin/profile'] = 'Admin/Admin_profile_controller';
$route['admin/dispute'] = 'Admin/Admin_dispute_controller/index/0';
$route['admin/content'] = 'Admin/Admin_content_controller/index/0';
$route['member/sales'] = 'Member/Member_sales_controller/index/0';
$route['member/login'] = 'Member/Member_login_controller';
$route['health_check'] = 'Health_check_controller/index';
$route['admin/ticket'] = 'Admin/Admin_ticket_controller/index/0';
$route['admin/school'] = 'Admin/Admin_school_controller/index/0';
$route['admin/review'] = 'Admin/Admin_review_controller/index/0';
$route['admin/refund'] = 'Admin/Admin_refund_controller/index/0';
$route['admin/payout'] = 'Admin/Admin_payout_controller/index/0';
$route['admin/logout'] = 'Admin/Admin_login_controller/logout';
$route['admin/emails'] = 'Admin/Admin_email_controller/index/0';
$route['member/cart'] = 'Member/Member_cart_controller/index/0';
$route['admin/users'] = 'Admin/Admin_credential_controller/index/0';
$route['admin/order'] = 'Admin/Admin_order_controller/index/0';
$route['admin/login'] = 'Admin/Admin_login_controller';
$route['admin/image'] = 'Admin/Admin_image_controller/index/0';
$route['admin/color'] = 'Admin/Admin_color_controller/index/0';
$route['admin/class'] = 'Admin/Admin_class_controller/index/0';
$route['buy/(:num)'] = 'Guest/Home_controller/buy/$1';
$route['admin/cart'] = 'Admin/Admin_cart_controller/index/0';
$route['member/me'] = 'Member/Member_me_controller/me';
$route['admin/tax'] = 'Admin/Admin_tax_controller/index/0';
$route['admin/sms'] = 'Admin/Admin_sms_controller';
$route['facebook'] = 'Member/Member_social_login_controller/facebook';
$route['admin/me'] = 'Admin/Admin_me_controller/me';
$route['a/(:any)'] = 'Admin/Marketing_controller/generate_custom_marketing_page/$1';
$route['migrate'] = 'Migrate';
$route['contact'] = 'Guest/Home_controller/contact';
$route['google'] = 'Member/Member_social_login_controller/google';
$route['(:num)'] = 'Guest/Home_controller/index/$1';
$route['about'] = 'Guest/Home_controller/about';
$route['sell'] = 'Guest/Home_controller/sell';
$route['buy'] = 'Guest/Home_controller/buy';
$route['404_override'] = 'Custom404';
$route['translate_uri_dashes'] = false;
$route['default_controller'] = 'Welcome/index';
+20
View File
@@ -0,0 +1,20 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/*
| -------------------------------------------------------------------
| MIME TYPES
| -------------------------------------------------------------------
| This file contains an array of mime types. It is used by the
| Upload class to help identify allowed file types.
|
*/
$config['setting'] = array(
'fixed_paper_amount' => '50',
'payout_percentage_seller' => '20',
'maintenance' => '0',
'version' => '1.0.0',
'copyright' => 'Copyright © 2021 Manaknightdigital Inc. All rights reserved.',
'license_key' => '',
);
+64
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/user_guide/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')
);
+214
View File
@@ -0,0 +1,214 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| USER AGENT TYPES
| -------------------------------------------------------------------
| This file contains f506C6174666F726D20506F7765726564206279204D616E616B6E6967687420496E632E2068747470733A2F2F6D616E616B6E696768746469676974616C2E636F6D our 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' => 'Spartan',
'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',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile'
);
// 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'
);
Binary file not shown.
+386
View File
@@ -0,0 +1,386 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once __DIR__ . '/../../middlewares/Token_middleware.php';
include_once __DIR__ . '/../../middlewares/Token_acl_middleware.php';
include_once __DIR__ . '/../../middlewares/Maintenance_middleware.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* API Portal Abstract Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*/
class Admin_api_controller extends CI_Controller
{
protected $_model_file = NULL;
public $_valid_roles = [2];
public $_user_id = 0;
public $_role_id = 0;
protected $_supported_formats = [
'json' => 'application/json',
'test' => 'application/json',
'array' => 'application/json',
'csv' => 'application/csv',
'html' => 'text/html',
'jsonp' => 'application/javascript',
'php' => 'text/plain',
'xml' => 'application/xml'
];
public $_format = 'json';
protected $_test_mode = FALSE;
public function __construct()
{
parent::__construct();
$this->config->load('setting');
$this->_setting = $this->config->item('setting');
$this->_run_middlewares();
$this->load->database();
if (!is_null($this->_model_file))
{
$this->load->model($this->_model_file);
}
}
protected function _middleware()
{
return [
'token',
'token_acl',
'maintenance'
];
}
/**
* Set Controller into test mode
*
* @return void
*/
public function set_test_mode ()
{
$this->_test_mode = TRUE;
$this->_format = 'test';
}
/**
* Render api output
*
* @param mixed $data
* @param number $code
* @return string
*/
public function render($data, $code)
{
http_response_code($code);
header('Content-Type: ' . $this->_supported_formats[$this->_format]);
switch ($this->_format)
{
case 'json':
return $this->output->set_content_type($this->_supported_formats[$this->_format])
->set_status_header($code)
->set_output(json_encode($data));
break;
case 'test':
return $data;
break;
default:
return '<pre>' . print_r($data, TRUE) . '</pre>';
break;
}
}
/**
* User token invalid
*
* @return string
*/
public function unauthorize_error_message()
{
return $this->output->set_content_type($this->_supported_formats[$this->_format])
->set_status_header(401)
->set_output(json_encode([
'code' => 401,
'success' => FALSE,
'message' => 'invalid credentials'
]));
}
/**
* User Role invalid
*
* @return string
*/
public function unauthorize_resource_error_message()
{
return $this->output->set_content_type($this->_supported_formats[$this->_format])
->set_status_header(406)
->set_output(json_encode([
'code' => 406,
'success' => FALSE,
'message' => 'cannot access resource'
]));
}
/**
* Success API Call
*
* @return string
*/
public function success($success)
{
$success['code'] = 200;
$success['success'] = TRUE;
return $this->output->set_content_type($this->_supported_formats[$this->_format])
->set_status_header(200)
->set_output(json_encode($success));
}
/**
* Invalid form input
*
* @return string
*/
protected function _render_validation_error ()
{
$data = [];
$data['code'] = 403;
$data['success'] = FALSE;
$data['error'] = $this->form_validation->error_array();
return $this->output->set_content_type($this->_supported_formats[$this->_format])
->set_status_header(403)
->set_output(json_encode($data));
}
/**
* Render Custom Error
*
* @return string
*/
protected function _render_custom_error ($errors)
{
$data = [];
$data['code'] = 403;
$data['success'] = FALSE;
$data['error'] = $errors;
return $this->output->set_content_type($this->_supported_formats[$this->_format])
->set_status_header(403)
->set_output(json_encode($data));
}
/**
* Debug Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dl($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : <pre>' . print_r($data, TRUE) . '</pre>');
}
}
/**
* Debug json Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dj($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : ' . json_encode($data));
}
}
/**
* Get Session
*
* @return mixed
*/
public function get_session()
{
if (!$this->_test_mode)
{
return $_SESSION;
}
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
return $session;
}
/**
* Set Session Field
*
* @param string $field
* @param mixed $value
* @return void
*/
public function set_session($field, $value)
{
if (!$this->_test_mode)
{
$_SESSION[$field] = $value;
}
else
{
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
$session[$field] = $value;
$this->config->set_item('session_test', $session);
}
}
/**
* Destroy Session
*
* @return void
*/
public function destroy_session()
{
if (!$this->_test_mode)
{
unset($_SESSION);
session_unset();
}
else
{
$this->config->set_item('session_test', []);
}
}
/**
* Function to send Emails given slug, payload and email
*
* @param string $slug
* @param mixed $payload
* @param string $email
* @return void
*/
protected function _send_email_notification($slug, $payload, $email)
{
$this->load->model('email_model');
$this->load->library('mail_service');
$this->mail_service->set_adapter('smtp');
$email_template = $this->email_model->get_template($slug, $payload);
if ($email_template)
{
$from = $this->config->item('from_email');
return $this->mail_service->send($from, $email, $email_template->subject, $email_template->html);
}
return FALSE;
}
/**
* Function to send Sms given slug, payload and phone #
*
* @param string $slug
* @param mixed $payload
* @param string $to
* @return void
*/
protected function _send_sms_notification($slug, $payload, $to)
{
$this->load->model('sms_model');
$this->load->library('sms_service');
$this->sms_service->set_adapter('sms');
$sms_template = $this->sms_model->get_template($slug, $payload);
if ($sms_template)
{
return $this->sms_service->send($to, $sms_template->content);
}
return FALSE;
}
/**
* Function to send Push notification
*
* @param string $slug
* @param mixed $payload
* @param string $to
* @return void
*/
protected function _send_push_notification($device_type, $device_id, $title, $message, $image)
{
$this->load->library('push_notification_service');
$this->push_notification_service->init();
return $this->push_notification_service->send($device_type, $device_id, $title, $message, $image);
}
protected function _run_middlewares ()
{
$middlewares = [
'token' => new Token_middleware($this, $this->config),
'token_acl' => new Token_acl_middleware($this, $this->config),
'maintenance' => new Maintenance_middleware($this, $this->config)
];
foreach ($this->_middleware() as $middleware_key)
{
if (isset($middlewares[$middleware_key]))
{
$result = $middlewares[$middleware_key]->run();
if (!$result)
{
return FALSE;
}
}
}
}
public function get_user_id ()
{
return $this->_user_id;
}
public function set_user_id ($user_id)
{
$this->_user_id = $user_id;
}
public function get_role_id ()
{
return $this->_role_id;
}
public function set_role_id ($role_id)
{
$this->_role_id = $role_id;
}
public function get_valid_role ()
{
return $this->_valid_roles;
}
public function get_setting()
{
return $this->_setting;
}
}
@@ -0,0 +1,267 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Attribute_type Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_attribute_type_controller extends Admin_controller
{
protected $_model_file = 'attribute_type_model';
public $_page_name = 'Attribute Type';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Attribute_type_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Attribute_type_admin_list_paginate_view_model(
$this->attribute_type_model,
$this->pagination,
'/admin/attribute_type/0');
$this->_data['view_model']->set_heading('Attribute Type');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_type(($this->input->get('type', TRUE) != NULL) ? $this->input->get('type', TRUE) : NULL);
$this->_data['view_model']->set_field(($this->input->get('field', TRUE) != NULL) ? $this->input->get('field', TRUE) : NULL);
$this->_data['view_model']->set_options(($this->input->get('options', TRUE) != NULL) ? $this->input->get('options', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'type' => $this->_data['view_model']->get_type(),
'field' => $this->_data['view_model']->get_field(),
'options' => $this->_data['view_model']->get_options(),
];
$this->_data['view_model']->set_total_rows($this->attribute_type_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/attribute_type/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->attribute_type_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Attribute_type', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Attribute_type_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->attribute_type_model->set_form_validation(
$this->form_validation, $this->attribute_type_model->get_all_validation_rule());
$this->_data['view_model'] = new Attribute_type_admin_add_view_model($this->attribute_type_model);
$this->_data['view_model']->set_heading('Attribute Type');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Attribute_typeAdd', $this->_data);
}
$type = $this->input->post('type', TRUE);
$field = $this->input->post('field', TRUE);
$options = $this->input->post('options', TRUE);
$result = $this->attribute_type_model->create([
'type' => $type,
'field' => $field,
'options' => $options,
]);
if ($result)
{
return $this->redirect('/admin/attribute_type/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Attribute_typeAdd', $this->_data);
}
public function edit($id)
{
$model = $this->attribute_type_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/attribute_type/0');
}
include_once __DIR__ . '/../../view_models/Attribute_type_admin_edit_view_model.php';
$this->form_validation = $this->attribute_type_model->set_form_validation(
$this->form_validation, $this->attribute_type_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Attribute_type_admin_edit_view_model($this->attribute_type_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Attribute Type');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Attribute_typeEdit', $this->_data);
}
$type = $this->input->post('type', TRUE);
$field = $this->input->post('field', TRUE);
$options = $this->input->post('options', TRUE);
$result = $this->attribute_type_model->edit([
'type' => $type,
'field' => $field,
'options' => $options,
], $id);
if ($result)
{
return $this->redirect('/admin/attribute_type/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Attribute_typeEdit', $this->_data);
}
public function view($id)
{
$model = $this->attribute_type_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/attribute_type/0');
}
include_once __DIR__ . '/../../view_models/Attribute_type_admin_view_view_model.php';
$this->_data['view_model'] = new Attribute_type_admin_view_view_model($this->attribute_type_model);
$this->_data['view_model']->set_heading('Attribute Type');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/Attribute_typeView', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->attribute_type_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->attribute_type_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
public function bulk_delete()
{
$bulk_items = $this->input->post('bulk_items');
foreach ($bulk_items as $key => $id) {
$this->attribute_type_model->real_delete($id);
}
echo 'success';
exit();
}
}
+228
View File
@@ -0,0 +1,228 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Cart Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_cart_controller extends Admin_controller
{
protected $_model_file = 'cart_model';
public $_page_name = 'Cart';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Cart_admin_list_paginate_view_model.php';
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$session = $this->get_session();
$where = [];
$this->_data['view_model'] = new Cart_admin_list_paginate_view_model(
$this->cart_model,
$this->pagination,
'/admin/cart/0');
$this->_data['view_model']->set_heading('Cart');
$this->_data['view_model']->set_total_rows($this->cart_model->count($where));
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/cart/0');
$this->_data['view_model']->set_list($this->cart_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Cart', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Cart_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->cart_model->set_form_validation(
$this->form_validation, $this->cart_model->get_all_validation_rule());
$this->_data['view_model'] = new Cart_admin_add_view_model($this->cart_model);
$this->_data['view_model']->set_heading('Cart');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/CartAdd', $this->_data);
}
$product_id = $this->input->post('product_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$session_id = $this->input->post('session_id', TRUE);
$subtotal = $this->input->post('subtotal', TRUE);
$quantity = $this->input->post('quantity', TRUE);
$total = $this->input->post('total', TRUE);
$result = $this->cart_model->create([
'product_id' => $product_id,
'user_id' => $user_id,
'session_id' => $session_id,
'subtotal' => $subtotal,
'quantity' => $quantity,
'total' => $total,
]);
if ($result)
{
return $this->redirect('/admin/cart/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/CartAdd', $this->_data);
}
public function edit($id)
{
$model = $this->cart_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/cart/0');
}
include_once __DIR__ . '/../../view_models/Cart_admin_edit_view_model.php';
$this->form_validation = $this->cart_model->set_form_validation(
$this->form_validation, $this->cart_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Cart_admin_edit_view_model($this->cart_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Cart');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/CartEdit', $this->_data);
}
$product_id = $this->input->post('product_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$session_id = $this->input->post('session_id', TRUE);
$subtotal = $this->input->post('subtotal', TRUE);
$quantity = $this->input->post('quantity', TRUE);
$total = $this->input->post('total', TRUE);
$result = $this->cart_model->edit([
'product_id' => $product_id,
'user_id' => $user_id,
'session_id' => $session_id,
'subtotal' => $subtotal,
'quantity' => $quantity,
'total' => $total,
], $id);
if ($result)
{
return $this->redirect('/admin/cart/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/CartEdit', $this->_data);
}
public function view($id)
{
$model = $this->cart_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/cart/0');
}
include_once __DIR__ . '/../../view_models/Cart_admin_view_view_model.php';
$this->_data['view_model'] = new Cart_admin_view_view_model($this->cart_model);
$this->_data['view_model']->set_heading('Cart');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/CartView', $this->_data);
}
public function delete($id)
{
$model = $this->cart_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/cart/0');
}
$result = $this->cart_model->delete($id);
if ($result)
{
return $this->redirect('/admin/cart/0', 'refresh');
}
$this->error('Error');
return redirect('/admin/cart/0');
}
}
+234
View File
@@ -0,0 +1,234 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Category Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_category_controller extends Admin_controller
{
protected $_model_file = 'category_model';
public $_page_name = 'Category';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Category_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Category_admin_list_paginate_view_model(
$this->category_model,
$this->pagination,
'/admin/category/0');
$this->_data['view_model']->set_heading('Category');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_name(($this->input->get('name', TRUE) != NULL) ? $this->input->get('name', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'name' => $this->_data['view_model']->get_name(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->category_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/category/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->category_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Category', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Category_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->category_model->set_form_validation(
$this->form_validation, $this->category_model->get_all_validation_rule());
$this->_data['view_model'] = new Category_admin_add_view_model($this->category_model);
$this->_data['view_model']->set_heading('Category');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/CategoryAdd', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->category_model->create([
'name' => $name,
'status' => $status,
]);
if ($result)
{
$this->success('Category added.');
return $this->redirect('/admin/category/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/CategoryAdd', $this->_data);
}
public function edit($id)
{
$model = $this->category_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/category/0');
}
include_once __DIR__ . '/../../view_models/Category_admin_edit_view_model.php';
$this->form_validation = $this->category_model->set_form_validation(
$this->form_validation, $this->category_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Category_admin_edit_view_model($this->category_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Category');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/CategoryEdit', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->category_model->edit([
'name' => $name,
'status' => $status,
], $id);
if ($result)
{
$this->success('Category updated.');
return $this->redirect('/admin/category/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/CategoryEdit', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->category_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->category_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
}
+234
View File
@@ -0,0 +1,234 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Class Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_class_controller extends Admin_controller
{
protected $_model_file = 'classes_model';
public $_page_name = 'Class';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Class_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Class_admin_list_paginate_view_model(
$this->classes_model,
$this->pagination,
'/admin/class/0');
$this->_data['view_model']->set_heading('Class');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_name(($this->input->get('name', TRUE) != NULL) ? $this->input->get('name', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'name' => $this->_data['view_model']->get_name(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->classes_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/class/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->classes_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Class', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Class_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->classes_model->set_form_validation(
$this->form_validation, $this->classes_model->get_all_validation_rule());
$this->_data['view_model'] = new Class_admin_add_view_model($this->classes_model);
$this->_data['view_model']->set_heading('Class');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/ClassAdd', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->classes_model->create([
'name' => $name,
'status' => $status,
]);
if ($result)
{
$this->success('Class added.');
return $this->redirect('/admin/class/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/ClassAdd', $this->_data);
}
public function edit($id)
{
$model = $this->classes_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/class/0');
}
include_once __DIR__ . '/../../view_models/Class_admin_edit_view_model.php';
$this->form_validation = $this->classes_model->set_form_validation(
$this->form_validation, $this->classes_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Class_admin_edit_view_model($this->classes_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Class');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/ClassEdit', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->classes_model->edit([
'name' => $name,
'status' => $status,
], $id);
if ($result)
{
$this->success('Class updated.');
return $this->redirect('/admin/class/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/ClassEdit', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->classes_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->classes_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
}
+212
View File
@@ -0,0 +1,212 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Color Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_color_controller extends Admin_controller
{
protected $_model_file = 'color_model';
public $_page_name = 'Color';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Color_admin_list_paginate_view_model.php';
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$session = $this->get_session();
$where = [];
$this->_data['view_model'] = new Color_admin_list_paginate_view_model(
$this->color_model,
$this->pagination,
'/admin/color/0');
$this->_data['view_model']->set_heading('Color');
$this->_data['view_model']->set_total_rows($this->color_model->count($where));
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/color/0');
$this->_data['view_model']->set_list($this->color_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Color', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Color_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->color_model->set_form_validation(
$this->form_validation, $this->color_model->get_all_validation_rule());
$this->_data['view_model'] = new Color_admin_add_view_model($this->color_model);
$this->_data['view_model']->set_heading('Color');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/ColorAdd', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->color_model->create([
'name' => $name,
'status' => $status,
]);
if ($result)
{
return $this->redirect('/admin/color/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/ColorAdd', $this->_data);
}
public function edit($id)
{
$model = $this->color_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/color/0');
}
include_once __DIR__ . '/../../view_models/Color_admin_edit_view_model.php';
$this->form_validation = $this->color_model->set_form_validation(
$this->form_validation, $this->color_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Color_admin_edit_view_model($this->color_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Color');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/ColorEdit', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->color_model->edit([
'name' => $name,
'status' => $status,
], $id);
if ($result)
{
return $this->redirect('/admin/color/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/ColorEdit', $this->_data);
}
public function view($id)
{
$model = $this->color_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/color/0');
}
include_once __DIR__ . '/../../view_models/Color_admin_view_view_model.php';
$this->_data['view_model'] = new Color_admin_view_view_model($this->color_model);
$this->_data['view_model']->set_heading('Color');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/ColorView', $this->_data);
}
public function delete($id)
{
$model = $this->color_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/color/0');
}
$result = $this->color_model->delete($id);
if ($result)
{
return $this->redirect('/admin/color/0', 'refresh');
}
$this->error('Error');
return redirect('/admin/color/0');
}
}
@@ -0,0 +1,132 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Contact_us Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_contact_us_controller extends Admin_controller
{
protected $_model_file = 'contact_us_model';
public $_page_name = 'Contact';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Contact_us_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Contact_us_admin_list_paginate_view_model(
$this->contact_us_model,
$this->pagination,
'/admin/contact_us/0');
$this->_data['view_model']->set_heading('Contact');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_name(($this->input->get('name', TRUE) != NULL) ? $this->input->get('name', TRUE) : NULL);
$this->_data['view_model']->set_email(($this->input->get('email', TRUE) != NULL) ? $this->input->get('email', TRUE) : NULL);
$this->_data['view_model']->set_message(($this->input->get('message', TRUE) != NULL) ? $this->input->get('message', TRUE) : NULL);
$this->_data['view_model']->set_created_at(($this->input->get('created_at', TRUE) != NULL) ? $this->input->get('created_at', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'name' => $this->_data['view_model']->get_name(),
'email' => $this->_data['view_model']->get_email(),
'message' => $this->_data['view_model']->get_message(),
'created_at' => $this->_data['view_model']->get_created_at(),
];
$this->_data['view_model']->set_total_rows($this->contact_us_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/contact_us/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->contact_us_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Contact_us', $this->_data);
}
public function view($id)
{
$model = $this->contact_us_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/contact_us/0');
}
include_once __DIR__ . '/../../view_models/Contact_us_admin_view_view_model.php';
$this->_data['view_model'] = new Contact_us_admin_view_view_model($this->contact_us_model);
$this->_data['view_model']->set_heading('Contact');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/Contact_usView', $this->_data);
}
}
+245
View File
@@ -0,0 +1,245 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Content Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_content_controller extends Admin_controller
{
protected $_model_file = 'content_model';
public $_page_name = 'Content';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Content_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Content_admin_list_paginate_view_model(
$this->content_model,
$this->pagination,
'/admin/content/0');
$this->_data['view_model']->set_heading('Content');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_content_name(($this->input->get('content_name', TRUE) != NULL) ? $this->input->get('content_name', TRUE) : NULL);
$this->_data['view_model']->set_content_type(($this->input->get('content_type', TRUE) != NULL) ? $this->input->get('content_type', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'content_name' => $this->_data['view_model']->get_content_name(),
'content_type' => $this->_data['view_model']->get_content_type(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->content_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/content/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->content_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Content', $this->_data);
}
public function add()
{
return $this->redirect('admin/content');
include_once __DIR__ . '/../../view_models/Content_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->content_model->set_form_validation(
$this->form_validation, $this->content_model->get_all_validation_rule());
$this->_data['view_model'] = new Content_admin_add_view_model($this->content_model);
$this->_data['view_model']->set_heading('Content');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/ContentAdd', $this->_data);
}
$content_name = $this->input->post('content_name', TRUE);
$content_type = $this->input->post('content_type', TRUE);
$content = $this->input->post('content', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->content_model->create([
'content_name' => $content_name,
'content_type' => $content_type,
'content' => $content,
'status' => $status,
]);
if ($result)
{
$this->success('Content added.');
return $this->redirect('/admin/content/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/ContentAdd', $this->_data);
}
public function edit($id)
{
$model = $this->content_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/content/0');
}
include_once __DIR__ . '/../../view_models/Content_admin_edit_view_model.php';
// $this->form_validation = $this->content_model->set_form_validation(
// $this->form_validation, $this->content_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Content_admin_edit_view_model($this->content_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Content');
if (!$this->input->post('content'))
{
return $this->render('Admin/ContentEdit', $this->_data);
}
// $content_name = $this->input->post('content_name', TRUE);
// $content_type = $this->input->post('content_type', TRUE);
$content = $this->input->post('content', TRUE);
// $status = $this->input->post('status', TRUE);
$result = $this->content_model->edit([
// 'content_name' => $content_name,
// 'content_type' => $content_type,
'content' => $content,
// 'status' => $status,
], $id);
if ($result)
{
$this->success('Content updated.');
return $this->redirect('/admin/content/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/ContentEdit', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->content_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->content_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
}
+150
View File
@@ -0,0 +1,150 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Admin Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_controller extends Manaknight_Controller
{
public $_page_name ='dashboard';
public $_valid_roles = [2];
public function __construct()
{
parent::__construct();
$this->_data['page_name'] = $this->_page_name;
$this->_data['setting'] = $this->_setting;
$this->_data['layout_clean_mode'] = FALSE;
$this->_run_middlewares();
$layout_mode = $this->input->get('layout_clean_mode', TRUE);
if (isset($layout_mode) && $layout_mode === '1')
{
$this->_data['layout_clean_mode'] = TRUE;
}
}
protected function _middleware()
{
return [
'auth', 'acl'
];
}
public function render($template, $data)
{
return (!$this->_test_mode) ? $this->_render($template, $data) : $this->_render_test($template, $data);
}
protected function _render_test($template, $data)
{
return [
'header' => $this->load->view('Layout/AdminHeader', $data, TRUE),
'body' => $this->load->view($template, $data, TRUE),
'footer' => $this->load->view('Layout/AdminFooter', $data, TRUE),
'data' => $data,
];
}
/**
* Function to return the images for media gallery
*/
public function get_all_images()
{
$this->load->model('image_model');
$images = $this->image_model->get_all();
return $images;
}
protected function _render($template, $data)
{
$data['images'] = $this->get_all_images();
$data['page_section'] = $template;
$this->load->view('Layout/AdminHeader', $data);
$this->load->view($template, $data);
$this->load->view('Layout/AdminFooter',$data);
}
/**
* User token invalid
*
* @return string
*/
public function unauthorize_error_message()
{
return $this->output->set_content_type('application/json')
->set_status_header(401)
->set_output(json_encode([
'code' => 401,
'success' => FALSE,
'message' => 'invalid credentials'
]));
}
/**
* User Role invalid
*
* @return string
*/
public function unauthorize_resource_error_message()
{
return $this->output->set_content_type('application/json')
->set_status_header(406)
->set_output(json_encode([
'code' => 406,
'success' => FALSE,
'message' => 'cannot access resource'
]));
}
/**
* Success API Call
*
* @return string
*/
public function success2($success)
{
$success['code'] = 200;
$success['success'] = TRUE;
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($success));
}
/**
* Invalid form input
*
* @return string
*/
protected function _render_validation_error ()
{
$data = [];
$data['code'] = 403;
$data['success'] = FALSE;
$data['error'] = $this->form_validation->error_array();
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode($data));
}
/**
* Render Custom Error
*
* @return string
*/
protected function _render_custom_error ($errors)
{
$data = [];
$data['code'] = 403;
$data['success'] = FALSE;
$data['error'] = $errors;
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode($data));
}
}
@@ -0,0 +1,170 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_api_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* User API Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_credential_api_controller extends Admin_api_controller
{
protected $_model_file = 'credential_model';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/User_admin_list_paginate_view_model.php';
$this->_data['view_model'] = new User_admin_list_paginate_view_model(
$this->credential_model,
$this->pagination,
'/admin/users/0');
$this->_data['view_model']->set_heading('{{{page_name}}}');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_email(($this->input->get('email', TRUE) != NULL) ? $this->input->get('email', TRUE) : NULL);
$this->_data['view_model']->set_first_name(($this->input->get('first_name', TRUE) != NULL) ? $this->input->get('first_name', TRUE) : NULL);
$this->_data['view_model']->set_last_name(($this->input->get('last_name', TRUE) != NULL) ? $this->input->get('last_name', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'email' => $this->_data['view_model']->get_email(),
'first_name' => $this->_data['view_model']->get_first_name(),
'last_name' => $this->_data['view_model']->get_last_name(),
];
$this->_data['view_model']->set_total_rows($this->credential_model->count_paginated($where));
$this->_data['view_model']->set_per_page(10);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->credential_model->get_user_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where));
return $this->success($this->_data['view_model']->to_json(), 200);
}
public function add()
{
$this->form_validation = $this->credential_model->set_form_validation(
$this->form_validation, $this->credential_model->get_all_validation_rule());
if ($this->form_validation->run() === FALSE)
{
return $this->_render_validation_error();
}
$email = $this->input->post('email', TRUE);
$first_name = $this->input->post('first_name', TRUE);
$last_name = $this->input->post('last_name', TRUE);
$phone = $this->input->post('phone', TRUE);
$image = $this->input->post('image', TRUE);
$image_id = $this->input->post('image_id', TRUE);
$result = $this->credential_model->create([
'email' => $email,
'first_name' => $first_name,
'last_name' => $last_name,
'phone' => $phone,
'image' => $image,
'image_id' => $image_id,
"password" => str_replace('$2y$', '$2b$', password_hash($password, PASSWORD_BCRYPT)),
]);
if ($result)
{
return $this->success([], 200);
}
return $this->_render_custom_error([
'error' => 'Error'
]);
}
public function edit($id)
{
$model = $this->credential_model->get($id);
if (!$model)
{
return $this->_render_custom_error([
'error' => 'Error'
]);
}
$this->form_validation = $this->credential_model->set_form_validation(
$this->form_validation, $this->credential_model->get_all_edit_validation_rule());
if ($this->form_validation->run() === FALSE)
{
return $this->_render_validation_error();
}
$email = $this->input->post('email', TRUE);
$first_name = $this->input->post('first_name', TRUE);
$last_name = $this->input->post('last_name', TRUE);
$phone = $this->input->post('phone', TRUE);
$role_id = $this->input->post('role_id', TRUE);
$status = $this->input->post('status', TRUE);
$image = $this->input->post('image', TRUE);
$image_id = $this->input->post('image_id', TRUE);
$result = $this->credential_model->edit([
'email' => $email,
'first_name' => $first_name,
'last_name' => $last_name,
'phone' => $phone,
'role_id' => $role_id,
'status' => $status,
'image' => $image,
'image_id' => $image_id,
"password" => str_replace('$2y$', '$2b$', password_hash($password, PASSWORD_BCRYPT)),
], $id);
if ($result)
{
return $this->success([], 200);
}
return $this->_render_custom_error([
'error' => 'Error'
]);
}
public function view($id)
{
$model = $this->credential_model->get($id);
if (!$model)
{
return $this->_render_custom_error([
'error' => 'Error'
]);
}
include_once __DIR__ . '/../../view_models/User_admin_view_view_model.php';
$this->_data['view_model'] = new User_admin_view_view_model($this->credential_model);
$this->_data['view_model']->set_model($model);
return $this->success(['data' => $this->_data['view_model']->to_json()], 200);
}
}
@@ -0,0 +1,280 @@
<?php defined('BASEPATH') || exit('No direct script access allowed');
include_once 'Admin_controller.php';
include_once __DIR__ . '/../../services/User_service.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* User Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_credential_controller extends Admin_controller
{
protected $_model_file = 'credential_model';
public $_page_name = 'Users';
public function __construct()
{
parent::__construct();
$this->load->model('admin_operation_model');
$this->load->model('credential_model');
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/User_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
if ($order_by == "id")
{
$order_by = 'b_id';
}
$this->_data['view_model'] = new User_admin_list_paginate_view_model(
$this->credential_model,
$this->pagination,
'/admin/users/0');
$this->_data['view_model']->set_heading('Users');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_email(($this->input->get('email', TRUE) != NULL) ? $this->input->get('email', TRUE) : NULL);
$this->_data['view_model']->set_first_name(($this->input->get('first_name', TRUE) != NULL) ? $this->input->get('first_name', TRUE) : NULL);
$this->_data['view_model']->set_last_name(($this->input->get('last_name', TRUE) != NULL) ? $this->input->get('last_name', TRUE) : NULL);
$where = [
'user_id' => $this->_data['view_model']->get_id(),
'email' => $this->_data['view_model']->get_email(),
'first_name' => $this->_data['view_model']->get_first_name(),
'last_name' => $this->_data['view_model']->get_last_name()
];
$this->_data['view_model']->set_total_rows($this->credential_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page(25);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/users/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->credential_model->get_user_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/User', $this->_data);
}
public function add()
{
$this->load->model('user_model');
include_once __DIR__ . '/../../view_models/User_admin_add_view_model.php';
$session = $this->get_session();
$custom_validation = [
['email', 'Email', 'trim|required|valid_email|is_unique[credential.email]'],
['password', 'Password', 'required']
];
$custom_validation = array_merge($custom_validation, $this->user_model->get_all_validation_rule());
$this->form_validation = $this->user_model->set_form_validation($this->form_validation, $custom_validation);
$this->_data['view_model'] = new User_admin_add_view_model($this->credential_model);
$this->_data['view_model']->set_heading('Users');
$this->_data['view_data']['roles'] = $this->credential_model->role_id_mapping();
$this->load->model('image_model');
$gallery_images = $this->image_model->get_all();
foreach ($gallery_images as $key => $image)
{
if ($image->type == 4)
{
$image->show_url = $image->url;
}
else
{
$image->show_url = $image->url;
}
$image->type = $this->image_model->type_mapping()[$image->type];
}
$this->_data['gallery_images'] = $gallery_images;
$service = new User_service($this->credential_model, $this->user_model);
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/UserAdd', $this->_data);
}
$email = $this->input->post('email', TRUE);
$first_name = $this->input->post('first_name', TRUE);
$last_name = $this->input->post('last_name', TRUE);
$phone = $this->input->post('phone', TRUE);
$image = $this->input->post('image', TRUE);
$image_id = $this->input->post('image_id', TRUE);
$password = $this->input->post('password');
$role_id = $this->input->post('role_id');
$created_user = $service->create($email, $password, $first_name, $last_name, $role_id, '');
if ($created_user)
{
$params = [
'image' => $image,
'phone' => $phone,
'image_id' => $image_id
];
$this->user_model->edit($params, $created_user->id);
return $this->redirect('/admin/users/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/UserAdd', $this->_data);
}
public function edit($id)
{
$this->load->model('user_model');
$model = $this->credential_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/users/0');
}
$user = $this->user_model->get($model->user_id);
include_once __DIR__ . '/../../view_models/User_credentials_admin_edit_view_model.php';
$custom_validation = [
['role_id', 'Role', 'required']
];
$custom_validation = array_merge($custom_validation, $this->user_model->get_all_validation_rule());
$this->form_validation = $this->user_model->set_form_validation($this->form_validation, $custom_validation);
$this->_data['view_model'] = new User_credentials_admin_edit_view_model($this->credential_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Users');
$this->_data['view_model']->set_first_name($user->first_name);
$this->_data['view_model']->set_last_name($user->last_name);
$this->_data['view_model']->set_phone($user->phone);
$this->_data['view_model']->set_image($user->image);
$this->_data['view_model']->set_image_id($user->image_id);
$this->_data['view_data']['roles'] = $this->credential_model->role_id_mapping();
$this->_data['view_data']['status'] = $this->credential_model->status_mapping();
$this->load->model('image_model');
$gallery_images = $this->image_model->get_all();
foreach ($gallery_images as $key => $image)
{
if ($image->type == 4)
{
$image->show_url = $image->url;
}
else
{
$image->show_url = $image->url;
}
$image->type = $this->image_model->type_mapping()[$image->type];
}
$this->_data['gallery_images'] = $gallery_images;
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/UserEdit', $this->_data);
}
$email = $this->input->post('email', TRUE);
$first_name = $this->input->post('first_name', TRUE);
$last_name = $this->input->post('last_name', TRUE);
$phone = $this->input->post('phone', TRUE);
$role_id = $this->input->post('role_id', TRUE);
$status = $this->input->post('status', TRUE);
$image = $this->input->post('image', TRUE);
$image_id = $this->input->post('image_id', TRUE);
$password = $this->input->post('password', TRUE);
$credential_params = [
'email' => $email,
'role_id' => $role_id,
'status' => $status
];
if (strlen($password) > 2)
{
$credential_params['password'] = str_replace('$2y$', '$2b$', password_hash($password, PASSWORD_BCRYPT));
}
$params = [
'first_name' => $first_name,
'last_name' => $last_name,
'phone' => $phone,
'image' => $image,
'image_id' => $image_id
];
$credential_obj = $this->credential_model->get_by_field('user_id', $model->user_id);
$credential_result = $this->credential_model->edit($credential_params, $credential_obj->id);
$result = $this->user_model->edit($params, $model->id);
if ($result && $credential_result)
{
$this->success('Saved');
return $this->redirect('/admin/users/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/UserEdit', $this->_data);
}
public function view($id)
{
$model = $this->credential_model->get($id);
$this->load->model('user_model');
$user = $this->user_model->get_by_field('id', $model->user_id);
$model->first_name = $user->first_name ? $user->first_name : 'N/A';
$model->last_name = $user->last_name ? $user->last_name : 'N/A';
$model->image = $user->image ? $user->image : '';
$model->image_id = $user->image_id ? $user->image_id : '0';
$model->phone = $user->phone ? $user->phone : 'N/A';
if (!$model)
{
$this->error('Error');
return redirect('/admin/users/0');
}
include_once __DIR__ . '/../../view_models/User_admin_view_view_model.php';
$this->_data['view_model'] = new User_admin_view_view_model($this->credential_model);
$this->_data['view_model']->set_heading('Users');
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_first_name($user->first_name);
$this->_data['view_model']->set_last_name($user->last_name);
$this->_data['view_model']->set_phone($user->phone);
$this->_data['view_model']->set_role_id($model->role_id);
$this->_data['view_model']->set_image($user->image);
$this->_data['view_model']->set_image_id($user->image_id);
$this->_data['view_model']->set_id($model->user_id);
return $this->render('Admin/UserView', $this->_data);
}
}
@@ -0,0 +1,30 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/**
* Admin Dashboard Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_dashboard_controller extends Admin_controller
{
public $_page_name = 'Dashboard';
public function __construct()
{
parent::__construct();
$this->load->model('Admin_operation_model');
}
public function index ()
{
$this->_data['member_accounts'] = $this->Admin_operation_model->getMemberAccountData();
$this->_data['member_uploads'] = $this->Admin_operation_model->getMemberUploadData();
$this->_data['top_school_account'] = $this->Admin_operation_model->getAccountsBySchool();
$this->_data['top_school_upload'] = $this->Admin_operation_model->getUploadsBySchool();
return $this->render('Admin/Dashboard', $this->_data);
}
}
+216
View File
@@ -0,0 +1,216 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Dispute Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_dispute_controller extends Admin_controller
{
protected $_model_file = 'dispute_model';
public $_page_name = 'Dispute';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Dispute_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Dispute_admin_list_paginate_view_model(
$this->dispute_model,
$this->pagination,
'/admin/dispute/0');
$this->_data['view_model']->set_heading('Dispute');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_order_id(($this->input->get('order_id', TRUE) != NULL) ? $this->input->get('order_id', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_reason(($this->input->get('reason', TRUE) != NULL) ? $this->input->get('reason', TRUE) : NULL);
$this->_data['view_model']->set_stripe_charge_id(($this->input->get('stripe_charge_id', TRUE) != NULL) ? $this->input->get('stripe_charge_id', TRUE) : NULL);
$this->_data['view_model']->set_stripe_dispute_id(($this->input->get('stripe_dispute_id', TRUE) != NULL) ? $this->input->get('stripe_dispute_id', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'order_id' => $this->_data['view_model']->get_order_id(),
'user_id' => $this->_data['view_model']->get_user_id(),
'reason' => $this->_data['view_model']->get_reason(),
'stripe_charge_id' => $this->_data['view_model']->get_stripe_charge_id(),
'stripe_dispute_id' => $this->_data['view_model']->get_stripe_dispute_id(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->dispute_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/dispute/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->dispute_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Dispute', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Dispute_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->dispute_model->set_form_validation(
$this->form_validation, $this->dispute_model->get_all_validation_rule());
$this->_data['view_model'] = new Dispute_admin_add_view_model($this->dispute_model);
$this->_data['view_model']->set_heading('Dispute');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/DisputeAdd', $this->_data);
}
$order_id = $this->input->post('order_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$reason = $this->input->post('reason', TRUE);
$explanation = $this->input->post('explanation', TRUE);
$stripe_charge_id = $this->input->post('stripe_charge_id', TRUE);
$stripe_dispute_id = $this->input->post('stripe_dispute_id', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->dispute_model->create([
'order_id' => $order_id,
'user_id' => $user_id,
'reason' => $reason,
'explanation' => $explanation,
'stripe_charge_id' => $stripe_charge_id,
'stripe_dispute_id' => $stripe_dispute_id,
'status' => $status,
]);
if ($result)
{
return $this->redirect('/admin/dispute/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/DisputeAdd', $this->_data);
}
public function edit($id)
{
$model = $this->dispute_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/dispute/0');
}
include_once __DIR__ . '/../../view_models/Dispute_admin_edit_view_model.php';
$this->form_validation = $this->dispute_model->set_form_validation(
$this->form_validation, $this->dispute_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Dispute_admin_edit_view_model($this->dispute_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Dispute');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/DisputeEdit', $this->_data);
}
$order_id = $this->input->post('order_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$reason = $this->input->post('reason', TRUE);
$explanation = $this->input->post('explanation', TRUE);
$stripe_charge_id = $this->input->post('stripe_charge_id', TRUE);
$stripe_dispute_id = $this->input->post('stripe_dispute_id', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->dispute_model->edit([
'order_id' => $order_id,
'user_id' => $user_id,
'reason' => $reason,
'explanation' => $explanation,
'stripe_charge_id' => $stripe_charge_id,
'stripe_dispute_id' => $stripe_dispute_id,
'status' => $status,
], $id);
if ($result)
{
return $this->redirect('/admin/dispute/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/DisputeEdit', $this->_data);
}
}
+222
View File
@@ -0,0 +1,222 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Email Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_email_controller extends Admin_controller
{
protected $_model_file = 'email_model';
public $_page_name = 'Emails';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Email_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Email_admin_list_paginate_view_model(
$this->email_model,
$this->pagination,
'/admin/emails/0');
$this->_data['view_model']->set_heading('Emails');
$this->_data['view_model']->set_slug(($this->input->get('slug', TRUE) != NULL) ? $this->input->get('slug', TRUE) : NULL);
$this->_data['view_model']->set_subject(($this->input->get('subject', TRUE) != NULL) ? $this->input->get('subject', TRUE) : NULL);
$this->_data['view_model']->set_tag(($this->input->get('tag', TRUE) != NULL) ? $this->input->get('tag', TRUE) : NULL);
$where = [
'slug' => $this->_data['view_model']->get_slug(),
'subject' => $this->_data['view_model']->get_subject(),
'tag' => $this->_data['view_model']->get_tag(),
];
$this->_data['view_model']->set_total_rows($this->email_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/emails/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->email_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Email', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Email_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->email_model->set_form_validation(
$this->form_validation, $this->email_model->get_all_validation_rule());
$this->_data['view_model'] = new Email_admin_add_view_model($this->email_model);
$this->_data['view_model']->set_heading('Emails');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/EmailAdd', $this->_data);
}
$slug = $this->input->post('slug', TRUE);
$subject = $this->input->post('subject', TRUE);
$email_header = $this->input->post('email_header', TRUE);
$email_footer = $this->input->post('email_footer', TRUE);
$subject = $this->input->post('subject', TRUE);
$tag = $this->input->post('tag', TRUE);
$html = $this->input->post('html', TRUE);
$result = $this->email_model->create([
'slug' => $slug,
'subject' => $subject,
'email_header' => $email_header,
'email_footer' => $email_footer,
'subject' => $subject,
'tag' => $tag,
'html' => $html,
]);
if ($result)
{
return $this->redirect('/admin/emails/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/EmailAdd', $this->_data);
}
public function edit($id)
{
$model = $this->email_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/emails/0');
}
include_once __DIR__ . '/../../view_models/Email_admin_edit_view_model.php';
$this->form_validation = $this->email_model->set_form_validation(
$this->form_validation, $this->email_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Email_admin_edit_view_model($this->email_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Emails');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/EmailEdit', $this->_data);
}
$subject = $this->input->post('subject', TRUE);
$email_header = $this->input->post('email_header', TRUE);
$html = $this->input->post('html', TRUE);
$email_footer = $this->input->post('email_footer', TRUE);
$tag = $this->input->post('tag', TRUE);
$result = $this->email_model->edit([
'subject' => $subject,
'email_header' => $email_header,
'html' => $html,
'email_footer' => $email_footer,
'tag' => $tag,
], $id);
if ($result)
{
return $this->redirect('/admin/emails/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/EmailEdit', $this->_data);
}
public function view($id)
{
$model = $this->email_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/emails/0');
}
include_once __DIR__ . '/../../view_models/Email_admin_view_view_model.php';
$this->_data['view_model'] = new Email_admin_view_view_model($this->email_model);
$this->_data['view_model']->set_heading('Emails');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/EmailView', $this->_data);
}
}
+197
View File
@@ -0,0 +1,197 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Image Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_image_controller extends Admin_controller
{
protected $_model_file = 'image_model';
public $_page_name = 'Images';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Image_admin_list_paginate_view_model.php';
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$session = $this->get_session();
$where = [];
$this->_data['view_model'] = new Image_admin_list_paginate_view_model(
$this->image_model,
$this->pagination,
'/admin/image/0');
$this->_data['view_model']->set_heading('Images');
$this->_data['view_model']->set_total_rows($this->image_model->count($where));
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/image/0');
$this->_data['view_model']->set_list($this->image_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Image', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Image_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->image_model->set_form_validation(
$this->form_validation, $this->image_model->get_all_validation_rule());
$this->_data['view_model'] = new Image_admin_add_view_model($this->image_model);
$this->_data['view_model']->set_heading('Images');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/ImageAdd', $this->_data);
}
$url = $this->input->post('url', TRUE);
$type = $this->input->post('type', TRUE);
$type_2 = $this->input->post('type_2', TRUE);
$result = $this->image_model->create([
'url' => $url,
'type' => $type,
'type_2' => $type_2,
]);
if ($result)
{
return $this->redirect('/admin/image/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/ImageAdd', $this->_data);
}
public function view($id)
{
$model = $this->image_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/image/0');
}
include_once __DIR__ . '/../../view_models/Image_admin_view_view_model.php';
$this->_data['view_model'] = new Image_admin_view_view_model($this->image_model);
$this->_data['view_model']->set_heading('Images');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/ImageView', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->image_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->image_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
}
@@ -0,0 +1,267 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Inventory_attribute Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_inventory_attribute_controller extends Admin_controller
{
protected $_model_file = 'inventory_attribute_model';
public $_page_name = 'Inventory Attribute';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Inventory_attribute_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Inventory_attribute_admin_list_paginate_view_model(
$this->inventory_attribute_model,
$this->pagination,
'/admin/inventory_attribute/0');
$this->_data['view_model']->set_heading('Inventory Attribute');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_inventory_id(($this->input->get('inventory_id', TRUE) != NULL) ? $this->input->get('inventory_id', TRUE) : NULL);
$this->_data['view_model']->set_attribute_id(($this->input->get('attribute_id', TRUE) != NULL) ? $this->input->get('attribute_id', TRUE) : NULL);
$this->_data['view_model']->set_value(($this->input->get('value', TRUE) != NULL) ? $this->input->get('value', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'inventory_id' => $this->_data['view_model']->get_inventory_id(),
'attribute_id' => $this->_data['view_model']->get_attribute_id(),
'value' => $this->_data['view_model']->get_value(),
];
$this->_data['view_model']->set_total_rows($this->inventory_attribute_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/inventory_attribute/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->inventory_attribute_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Inventory_attribute', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Inventory_attribute_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->inventory_attribute_model->set_form_validation(
$this->form_validation, $this->inventory_attribute_model->get_all_validation_rule());
$this->_data['view_model'] = new Inventory_attribute_admin_add_view_model($this->inventory_attribute_model);
$this->_data['view_model']->set_heading('Inventory Attribute');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Inventory_attributeAdd', $this->_data);
}
$inventory_id = $this->input->post('inventory_id', TRUE);
$attribute_id = $this->input->post('attribute_id', TRUE);
$value = $this->input->post('value', TRUE);
$result = $this->inventory_attribute_model->create([
'inventory_id' => $inventory_id,
'attribute_id' => $attribute_id,
'value' => $value,
]);
if ($result)
{
return $this->redirect('/admin/inventory_attribute/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Inventory_attributeAdd', $this->_data);
}
public function edit($id)
{
$model = $this->inventory_attribute_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/inventory_attribute/0');
}
include_once __DIR__ . '/../../view_models/Inventory_attribute_admin_edit_view_model.php';
$this->form_validation = $this->inventory_attribute_model->set_form_validation(
$this->form_validation, $this->inventory_attribute_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Inventory_attribute_admin_edit_view_model($this->inventory_attribute_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Inventory Attribute');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Inventory_attributeEdit', $this->_data);
}
$inventory_id = $this->input->post('inventory_id', TRUE);
$attribute_id = $this->input->post('attribute_id', TRUE);
$value = $this->input->post('value', TRUE);
$result = $this->inventory_attribute_model->edit([
'inventory_id' => $inventory_id,
'attribute_id' => $attribute_id,
'value' => $value,
], $id);
if ($result)
{
return $this->redirect('/admin/inventory_attribute/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Inventory_attributeEdit', $this->_data);
}
public function view($id)
{
$model = $this->inventory_attribute_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/inventory_attribute/0');
}
include_once __DIR__ . '/../../view_models/Inventory_attribute_admin_view_view_model.php';
$this->_data['view_model'] = new Inventory_attribute_admin_view_view_model($this->inventory_attribute_model);
$this->_data['view_model']->set_heading('Inventory Attribute');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/Inventory_attributeView', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->inventory_attribute_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->inventory_attribute_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
public function bulk_delete()
{
$bulk_items = $this->input->post('bulk_items');
foreach ($bulk_items as $key => $id) {
$this->inventory_attribute_model->real_delete($id);
}
echo 'success';
exit();
}
}
@@ -0,0 +1,474 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Inventory Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_inventory_controller extends Admin_controller
{
protected $_model_file = 'inventory_model';
public $_page_name = 'Inventory';
public function __construct()
{
parent::__construct();
$this->load->model('school_model');
$this->load->model('professor_model');
$this->load->model('textbook_model');
$this->load->model('classes_model');
$this->load->model('user_model');
$this->load->model('credential_model');
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Inventory_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$previews = $this->input->get('previews', TRUE) ?? "";
$this->_data['view_model'] = new Inventory_admin_list_paginate_view_model(
$this->inventory_model,
$this->pagination,
'/admin/inventory/0');
$this->_data['view_model']->set_heading('Inventory');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_title(($this->input->get('title', TRUE) != NULL) ? $this->input->get('title', TRUE) : NULL);
$this->_data['view_model']->set_school_id(($this->input->get('school_id', TRUE) != NULL) ? $this->input->get('school_id', TRUE) : NULL);
$this->_data['view_model']->set_professor_id(($this->input->get('professor_id', TRUE) != NULL) ? $this->input->get('professor_id', TRUE) : NULL);
$this->_data['view_model']->set_class_id(($this->input->get('class_id', TRUE) != NULL) ? $this->input->get('class_id', TRUE) : NULL);
$this->_data['view_model']->set_textbook_id(($this->input->get('textbook_id', TRUE) != NULL) ? $this->input->get('textbook_id', TRUE) : NULL);
$this->_data['view_model']->set_word_count(($this->input->get('word_count', TRUE) != NULL) ? $this->input->get('word_count', TRUE) : NULL);
$this->_data['view_model']->set_year(($this->input->get('year', TRUE) != NULL) ? $this->input->get('year', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$this->_data['email'] = ( $this->input->get('email', TRUE) != NULL ) ? $this->input->get('email', TRUE) : NULL;
$where = [
'inventory.id' => $this->_data['view_model']->get_id(),
'inventory.title' => $this->_data['view_model']->get_title(),
'inventory.school_id' => $this->_data['view_model']->get_school_id(),
'inventory.professor_id' => $this->_data['view_model']->get_professor_id(),
'inventory.class_id' => $this->_data['view_model']->get_class_id(),
'inventory.isbn' => ($_GET['isbn'] ?? ''),
'inventory.word_count' => $this->_data['view_model']->get_word_count(),
'inventory.year' => $this->_data['view_model']->get_year(),
'inventory.status' => $this->_data['view_model']->get_status(),
'credential.email' => $this->_data['email'],
];
if ($previews == 2)
{
$this->db->group_start();
$this->db->where(' feature_image = "" AND feature_image2 = "" AND feature_image3 = "" ');
$this->db->group_end();
}elseif ($previews == 1)
{
$this->db->group_start();
$this->db->where(' feature_image != "" OR feature_image2 != "" OR feature_image3 != "" ');
$this->db->group_end();
}
$this->_data['view_model']->set_total_rows($this->inventory_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/inventory/0');
$this->_data['view_model']->set_page($page);
if ($previews == 2)
{
$this->db->group_start();
$this->db->where(' feature_image = "" AND feature_image2 = "" AND feature_image3 = "" ');
$this->db->group_end();
}elseif ($previews == 1)
{
$this->db->group_start();
$this->db->where(' feature_image != "" OR feature_image2 != "" OR feature_image3 != "" ');
$this->db->group_end();
}
$this->_data['view_model']->set_list($this->inventory_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($this->input->get('school_id', TRUE))
{
$schools = $this->school_model->get_all(['status' => 1, 'id' => $this->input->get('school_id') ]);
}
if ($this->input->get('professor_id', TRUE))
{
$professors = $this->professor_model->get_all(['status' => 1, 'id' => $this->input->get('professor_id') ]);
}
if ($this->input->get('class_id', TRUE))
{
$classes = $this->classes_model->get_all(['status' => 1, 'id' => $this->input->get('class_id') ]);
}
if ($this->input->get('isbn', TRUE))
{
$is_bn = $this->input->get('isbn', TRUE);
$textbooks = $this->db->select('isbn')->from('inventory')->where('isbn', $is_bn)->get()->result_array();
}
if( $this->_data['view_model']->get_list())
{
foreach ( $this->_data['view_model']->get_list() as $key => &$value)
{
$school_data = $this->school_model->get($value->school_id);
$professor_data = $this->professor_model->get($value->professor_id);
$classes_data = $this->classes_model->get($value->class_id);
$user_data = $this->user_model->get($value->user_id);
$user_data2 = $this->credential_model->get_by_fields(['user_id' => $user_data->id]);
$value->school_id = isset($school_data->name) ? $school_data->name : '';
$value->professor_id = isset($professor_data->name) ? $professor_data->name : '';
$value->class_id = isset($classes_data->name) ? $classes_data->name : '';
$value->user_id = isset($user_data->first_name) ? $user_data->first_name . " " . $user_data->last_name : '';
$value->email = isset($user_data2->email) ? $user_data2->email : '';
}
}
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
$this->_data['previews'] = $previews;
if (!empty($schools))
{
$this->_data['schools'] = $schools;
}
if (!empty($professors))
{
$this->_data['professors'] = $professors;
}
if (isset($textbooks) && !empty($textbooks))
{
$this->_data['textbooks'] = $textbooks;
}
if (!empty($classes))
{
$this->_data['classes'] = $classes;
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Inventory', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Inventory_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->inventory_model->set_form_validation(
$this->form_validation, $this->inventory_model->get_all_validation_rule());
$this->_data['view_model'] = new Inventory_admin_add_view_model($this->inventory_model);
$this->_data['view_model']->set_heading('Inventory');
$this->load->model('image_model');
$gallery_images = $this->image_model->get_all();
foreach ($gallery_images as $key => $image) {
if($image->type == 4){
$image->show_url = $image->url;
}else
{
$image->show_url = $image->url;
}$image->type = $this->image_model->type_mapping()[$image->type];
}
$this->_data['gallery_images'] = $gallery_images;
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/InventoryAdd', $this->_data);
}
$title = $this->input->post('title', TRUE);
$school_id = $this->input->post('school_id', TRUE);
$professor_id = $this->input->post('professor_id', TRUE);
$class_id = $this->input->post('class_id', TRUE);
$textbook_id = $this->input->post('textbook_id', TRUE);
$word_count = $this->input->post('word_count', TRUE);
$year = $this->input->post('year', TRUE);
$isbn = $this->input->post('isbn', TRUE);
$paypal_email = $this->input->post('paypal_email', TRUE);
$file = $this->input->post('file', TRUE);
$file_id = $this->input->post('file_id', TRUE);
$feature_image = $this->input->post('feature_image', TRUE);
$feature_image_id = $this->input->post('feature_image_id', TRUE);
$note_type = $this->input->post('note_type', TRUE);
$description = $this->input->post('description', TRUE);
$inventory_note = $this->input->post('inventory_note', TRUE);
$pin_to_top = $this->input->post('pin_to_top', TRUE);
$approve = $this->input->post('approve', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->inventory_model->create([
'title' => $title,
'school_id' => $school_id,
'professor_id' => $professor_id,
'class_id' => $class_id,
'textbook_id' => $textbook_id,
'word_count' => $word_count,
'year' => $year,
'isbn' => $isbn,
'paypal_email' => $paypal_email,
'file' => $file,
'file_id' => $file_id,
'feature_image' => $feature_image,
'feature_image_id' => $feature_image_id,
'note_type' => $note_type,
'description' => $description,
'inventory_note' => $inventory_note,
'pin_to_top' => $pin_to_top,
'approve' => $approve,
'status' => $status,
]);
if ($result)
{
$this->success('Data has been added successfully.');
return $this->redirect('/admin/inventory/0?order_by=id&direction=DESC', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/InventoryAdd', $this->_data);
}
public function edit($id)
{
$model = $this->inventory_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/inventory/0');
}
include_once __DIR__ . '/../../view_models/Inventory_admin_edit_view_model.php';
$this->form_validation = $this->inventory_model->set_form_validation(
$this->form_validation, $this->inventory_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Inventory_admin_edit_view_model($this->inventory_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Inventory');
$this->load->model('image_model');
$gallery_images = $this->image_model->get_all();
foreach ($gallery_images as $key => $image) {
if($image->type == 4){
$image->show_url = $image->url;
}else
{
$image->show_url = $image->url;
}$image->type = $this->image_model->type_mapping()[$image->type];
}
$this->_data['gallery_images'] = $gallery_images;
$this->_data['schools'] = $this->school_model->get_all(['status' => 1 , 'id' => $model->school_id]);
$this->_data['professors'] = $this->professor_model->get_all(['status' => 1, 'id' => $model->professor_id]);
$this->_data['classes'] = $this->classes_model->get_all(['status' => 1, 'id' => $model->class_id]);
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/InventoryEdit', $this->_data);
}
$school_id = $this->input->post('school_id', TRUE);
$professor_id = $this->input->post('professor_id', TRUE);
$class_id = $this->input->post('class_id', TRUE);
$word_count = $this->input->post('word_count', TRUE);
$year = $this->input->post('year', TRUE);
$isbn = $this->input->post('isbn', TRUE);
$note_type = $this->input->post('note_type', TRUE);
$feature_image3 = $this->input->post('feature_image3', TRUE);
$feature_image2 = $this->input->post('feature_image2', TRUE);
$feature_image = $this->input->post('feature_image', TRUE);
$result = $this->inventory_model->edit([
'school_id' => $school_id,
'professor_id' => $professor_id,
'class_id' => $class_id,
'word_count' => $word_count,
'year' => $year,
'isbn' => $isbn,
'note_type' => $note_type,
'feature_image' => $feature_image,
'feature_image3' => $feature_image3,
'feature_image2' => $feature_image2,
], $id);
if ($result)
{
$this->success('Data has been updated successfully.');
return $this->redirect('/admin/inventory/0?order_by=id&direction=DESC', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/InventoryEdit', $this->_data);
}
// public function view($id)
// {
// $model = $this->inventory_model->get($id);
// if (!$model)
// {
// $this->error('Error');
// return redirect('/admin/inventory/0');
// }
// include_once __DIR__ . '/../../view_models/Inventory_admin_view_view_model.php';
// $this->_data['view_model'] = new Inventory_admin_view_view_model($this->inventory_model);
// $this->_data['view_model']->set_heading('Inventory');
// $this->_data['view_model']->set_model($model);
// return $this->render('Admin/InventoryView', $this->_data);
// }
public function view($id)
{
$model = $this->inventory_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/inventory/0');
}
include_once __DIR__ . '/../../view_models/Inventory_admin_view_view_model.php';
$this->_data['view_model'] = new Inventory_admin_view_view_model($this->inventory_model);
$this->_data['view_model']->set_heading('Inventory');
$this->_data['view_model']->set_model($model);
//get all school data
$this->_data['school_data'] = array_column($this->school_model->get_all(['status' => 1]),'name','id');
//get all professor data
$this->_data['professor_data'] = array_column($this->professor_model->get_all(['status' => 1]),'name','id');
//get all classes data
$this->_data['classes_data'] = array_column($this->classes_model->get_all(['status' => 1]),'name','id');
//get all textbook data
$this->_data['textbook_data'] = array_column($this->textbook_model->get_all(['status' => 1]),'isbn','id');
$this->_data['view_model']->set_school_id( $this->_data['school_data'][$this->_data['view_model']->get_school_id()]);
$this->_data['view_model']->set_professor_id( $this->_data['professor_data'][$this->_data['view_model']->get_professor_id()]);
$this->_data['view_model']->set_class_id( $this->_data['classes_data'][$this->_data['view_model']->get_class_id()]);
// $this->_data['view_model']->set_textbook_id( $this->_data['textbook_data'][$this->_data['view_model']->get_textbook_id()]);
// print_r($this->_data);
// exit;
return $this->render('Admin/InventoryView', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->inventory_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->inventory_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
}
@@ -0,0 +1,252 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Inventory_gallery_image_list Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_inventory_gallery_image_list_controller extends Admin_controller
{
protected $_model_file = 'inventory_gallery_image_list_model';
public $_page_name = 'Inventory_gallery_image_list';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Inventory_gallery_image_list_admin_list_paginate_view_model.php';
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$session = $this->get_session();
$where = [];
$this->_data['view_model'] = new Inventory_gallery_image_list_admin_list_paginate_view_model(
$this->inventory_gallery_image_list_model,
$this->pagination,
'/admin/inventory_gallery_image_list/0');
$this->_data['view_model']->set_heading('Inventory_gallery_image_list');
$this->_data['view_model']->set_total_rows($this->inventory_gallery_image_list_model->count($where));
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/inventory_gallery_image_list/0');
$this->_data['view_model']->set_list($this->inventory_gallery_image_list_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Inventory_gallery_image_list', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Inventory_gallery_image_list_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->inventory_gallery_image_list_model->set_form_validation(
$this->form_validation, $this->inventory_gallery_image_list_model->get_all_validation_rule());
$this->_data['view_model'] = new Inventory_gallery_image_list_admin_add_view_model($this->inventory_gallery_image_list_model);
$this->_data['view_model']->set_heading('Inventory_gallery_image_list');
$this->load->model('image_model');
$gallery_images = $this->image_model->get_all();
foreach ($gallery_images as $key => $image) {
if($image->type == 4){
$image->show_url = base_url().$image->url;
}else
{
$image->show_url = $image->url;
}$image->type = $this->image_model->type_mapping()[$image->type];
}
$this->_data['gallery_images'] = $gallery_images;
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Inventory_gallery_image_listAdd', $this->_data);
}
$inventory_id = $this->input->post('inventory_id', TRUE);
$gallery_image = $this->input->post('gallery_image', TRUE);
$gallery_image_id = $this->input->post('gallery_image_id', TRUE);
$gallery_image_id = $this->input->post('gallery_image_id', TRUE);
$gallery_image_id_id = $this->input->post('gallery_image_id_id', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->inventory_gallery_image_list_model->create([
'inventory_id' => $inventory_id,
'gallery_image' => $gallery_image,
'gallery_image_id' => $gallery_image_id,
'gallery_image_id' => $gallery_image_id,
'gallery_image_id_id' => $gallery_image_id_id,
'status' => $status,
]);
if ($result)
{
return $this->redirect('/admin/inventory_gallery_image_list/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Inventory_gallery_image_listAdd', $this->_data);
}
public function edit($id)
{
$model = $this->inventory_gallery_image_list_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/inventory_gallery_image_list/0');
}
include_once __DIR__ . '/../../view_models/Inventory_gallery_image_list_admin_edit_view_model.php';
$this->form_validation = $this->inventory_gallery_image_list_model->set_form_validation(
$this->form_validation, $this->inventory_gallery_image_list_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Inventory_gallery_image_list_admin_edit_view_model($this->inventory_gallery_image_list_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Inventory_gallery_image_list');
$this->load->model('image_model');
$gallery_images = $this->image_model->get_all();
foreach ($gallery_images as $key => $image) {
if($image->type == 4){
$image->show_url = base_url().$image->url;
}else
{
$image->show_url = $image->url;
}$image->type = $this->image_model->type_mapping()[$image->type];
}
$this->_data['gallery_images'] = $gallery_images;
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Inventory_gallery_image_listEdit', $this->_data);
}
$inventory_id = $this->input->post('inventory_id', TRUE);
$gallery_image = $this->input->post('gallery_image', TRUE);
$gallery_image_id = $this->input->post('gallery_image_id', TRUE);
$gallery_image_id = $this->input->post('gallery_image_id', TRUE);
$gallery_image_id_id = $this->input->post('gallery_image_id_id', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->inventory_gallery_image_list_model->edit([
'inventory_id' => $inventory_id,
'gallery_image' => $gallery_image,
'gallery_image_id' => $gallery_image_id,
'gallery_image_id' => $gallery_image_id,
'gallery_image_id_id' => $gallery_image_id_id,
'status' => $status,
], $id);
if ($result)
{
return $this->redirect('/admin/inventory_gallery_image_list/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Inventory_gallery_image_listEdit', $this->_data);
}
public function view($id)
{
$model = $this->inventory_gallery_image_list_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/inventory_gallery_image_list/0');
}
include_once __DIR__ . '/../../view_models/Inventory_gallery_image_list_admin_view_view_model.php';
$this->_data['view_model'] = new Inventory_gallery_image_list_admin_view_view_model($this->inventory_gallery_image_list_model);
$this->_data['view_model']->set_heading('Inventory_gallery_image_list');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/Inventory_gallery_image_listView', $this->_data);
}
public function delete($id)
{
$model = $this->inventory_gallery_image_list_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/inventory_gallery_image_list/0');
}
$result = $this->inventory_gallery_image_list_model->delete($id);
if ($result)
{
return $this->redirect('/admin/inventory_gallery_image_list/0', 'refresh');
}
$this->error('Error');
return redirect('/admin/inventory_gallery_image_list/0');
}
}
+140
View File
@@ -0,0 +1,140 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once __DIR__ . '/../../services/User_service.php';
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Login Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_login_controller extends Manaknight_Controller
{
protected $_redirect = '/admin/dashboard';
public $_valid_roles = [2];
public function __construct()
{
parent::__construct();
}
public function index ()
{
$this->load->model('credential_model');
$this->load->model('user_model');
$this->load->helper('cookie');
$service = new User_service($this->credential_model);
if($this->input->cookie('admin_remember_me_token', TRUE) !== null && $this->input->cookie('admin_remember_me_token', TRUE) !== '')
{
$this->_remember_me_login();
exit();
}
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->_data['portal'] = 'admin';
if ($this->form_validation->run() === FALSE)
{
echo $this->load->view('Admin/Login', $this->_data, TRUE);
exit;
}
$email = $this->input->post('email');
$password = $this->input->post('password');
$redirect = $service->get_redirect($this->input->cookie('redirect', TRUE), $this->_redirect);
$role = $this->_valid_roles[0];
$authenticated_user = $service->login_by_role($email, $password, $role);
if ($authenticated_user)
{
delete_cookie('redirect');
$user_id = $authenticated_user->user_id;
if(!empty($this->input->post("remember_me"))) {
$this->load->helper('string');
$remember_cookie = [
'user_id' => $user_id,
'name' => 'admin_remember_me_token',
'value' => random_string('alnum', 16),
'expire' => time()+$this->config->item('cookie_expire'),
'domain' => base_url()
];
$this->load->model('cookies_model');
$check_cookie = $this->cookies_model->get_by_field('user_id', $user_id);
if($check_cookie)
{
$cookie = $this->cookies_model->edit($remember_cookie, $check_cookie->id);
}
else
{
$cookie = $this->cookies_model->create($remember_cookie);
}
if($cookie)
{
setcookie($remember_cookie['name'], $remember_cookie['value'], $remember_cookie['expire'], $remember_cookie['domain']);
}
}
$this->set_session('credential_id', (int) $authenticated_user->id);
$this->set_session('user_id', (int) $user_id);
$this->set_session('email', (string) $authenticated_user->email);
$this->set_session('role', (string) $authenticated_user->role_id);
return $this->redirect($redirect);
}
$this->error('Wrong email or password.');
return $this->redirect('admin/login');
}
public function _remember_me_login()
{
$this->load->helper('string');
$this->load->model('user_model');
$this->load->model('credential_model');
$this->load->model('cookies_model');
$token_value = $this->input->cookie('admin_remember_me_token', TRUE);
$cookie = $this->cookies_model->get_by_fields(['value' => $token_value]);
$service = new User_service($this->credential_model, $this->user_model);
$redirect = $service->get_redirect($this->input->cookie('redirect', TRUE), $this->_redirect);
if($cookie)
{
$user_id = $cookie->user_id;
$credential = $this->credential_model->get_by_field('user_id', $user_id);
$role = $this->_valid_roles[0];
if($credential->role_id != $role)
{
setcookie('admin_remember_me_token', '', 1, base_url());
return $this->redirect('admin/login');
}
$random_string = random_string('alnum', 30);
$this->cookies_model->edit(['value' => $random_string, 'expire' => time()+$this->config->item('cookie_expire')], $cookie->id);
setcookie('admin_remember_me_token', $random_string, time()+$this->config->item('cookie_expire'), base_url());
$this->set_session('credential_id', (int) $credential->id);
$this->set_session('user_id', (int) $user_id);
$this->set_session('email', (string) $credential->email);
$this->set_session('role', (string) $credential->role_id);
return $this->redirect($redirect);
}
else
{
setcookie('admin_remember_me_token', '', 1, base_url());
return $this->redirect('admin/login');
}
$this->error('Wrong email or password.');
return $this->redirect('admin/login');
}
public function logout ()
{
$this->load->helper('cookie');
setcookie('admin_remember_me_token', '', 1, base_url());
$this->destroy_session();
return $this->redirect('admin/login');
}
}
@@ -0,0 +1,256 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Marketing Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_marketing_controller extends Admin_controller
{
protected $_model_file = 'marketing_model';
public $_page_name = 'Marketing';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Marketing_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Marketing_admin_list_paginate_view_model(
$this->marketing_model,
$this->pagination,
'/admin/marketing/0');
$this->_data['view_model']->set_heading('Marketing');
$this->_data['view_model']->set_publish_date(($this->input->get('publish_date', TRUE) != NULL) ? $this->input->get('publish_date', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_title(($this->input->get('title', TRUE) != NULL) ? $this->input->get('title', TRUE) : NULL);
$where = [
'publish_date' => $this->_data['view_model']->get_publish_date(),
'status' => $this->_data['view_model']->get_status(),
'user_id' => $this->_data['view_model']->get_user_id(),
'title' => $this->_data['view_model']->get_title(),
];
$this->_data['view_model']->set_total_rows($this->marketing_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/marketing/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->marketing_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Marketing', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Marketing_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->marketing_model->set_form_validation(
$this->form_validation, $this->marketing_model->get_all_validation_rule());
$this->_data['view_model'] = new Marketing_admin_add_view_model($this->marketing_model);
$this->_data['view_model']->set_heading('Marketing');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/MarketingAdd', $this->_data);
}
$title = $this->input->post('title', TRUE);
$seo_title = $this->input->post('seo_title', TRUE);
$seo_description = $this->input->post('seo_description', TRUE);
$content = $this->input->post('content', TRUE);
$slug = $this->input->post('slug', TRUE);
$password_protect = $this->input->post('password_protect', TRUE);
$header_template_path = $this->input->post('header_template_path', TRUE);
$content_template_path = $this->input->post('content_template_path', TRUE);
$footer_template_path = $this->input->post('footer_template_path', TRUE);
$status = $this->input->post('status', TRUE);
$publish_date = date('y-m-d');
$slug_path = $this->_data['view_model']->marketing_slug_url();
$result = $this->marketing_model->create([
'title' => $title,
'seo_title' => $seo_title,
'seo_description' => $seo_description,
'content' => $content,
'slug' => $slug_path.$slug,
'password_protect' => $password_protect,
'header_template_path' => $header_template_path,
'content_template_path' => $content_template_path,
'footer_template_path' => $footer_template_path,
'status' => $status,
'publish_date' => $publish_date,
'user_id' => $session['user_id']
]);
if ($result)
{
$this->success('Page added successfully');
return $this->redirect('/admin/marketing/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/MarketingAdd', $this->_data);
}
public function edit($id)
{
$model = $this->marketing_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/marketing/0');
}
include_once __DIR__ . '/../../view_models/Marketing_admin_edit_view_model.php';
$this->form_validation = $this->marketing_model->set_form_validation(
$this->form_validation, $this->marketing_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Marketing_admin_edit_view_model($this->marketing_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Marketing');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/MarketingEdit', $this->_data);
}
$title = $this->input->post('title', TRUE);
$seo_title = $this->input->post('seo_title', TRUE);
$seo_description = $this->input->post('seo_description', TRUE);
$content = $this->input->post('content', TRUE);
$slug = $this->input->post('slug', TRUE);
$password_protect = $this->input->post('password_protect', TRUE);
$header_template_path = $this->input->post('header_template_path', TRUE);
$content_template_path = $this->input->post('content_template_path', TRUE);
$footer_template_path = $this->input->post('footer_template_path', TRUE);
$status = $this->input->post('status', TRUE);
$publish_date = date('y-m-d');
$slug_path = $this->_data['view_model']->marketing_slug_url();
$result = $this->marketing_model->edit([
'title' => $title,
'seo_title' => $seo_title,
'seo_description' => $seo_description,
'content' => $content,
'slug' => $slug_path.$slug,
'password_protect' => $password_protect,
'header_template_path' => $header_template_path,
'content_template_path' => $content_template_path,
'footer_template_path' => $footer_template_path,
'status' => $status,
'publish_date' => $publish_date,
'user_id' => $session['user_id']
], $id);
if ($result)
{
$this->success('Page Edited successfully');
return $this->redirect('/admin/marketing/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/MarketingEdit', $this->_data);
}
public function view($id)
{
$model = $this->marketing_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/marketing/0');
}
return $this->redirect($model->slug);
}
public function delete($id)
{
$model = $this->marketing_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/marketing/0');
}
$result = $this->marketing_model->real_delete($id);
if ($result)
{
$this->success('Page Deleted successfully');
return $this->redirect('/admin/marketing/0', 'refresh');
}
$this->error('Error');
return redirect('/admin/marketing/0');
}
public function bulk_delete()
{
$bulk_items = $this->input->post('bulk_items');
foreach ($bulk_items as $key => $id) {
$this->marketing_model->real_delete($id);
}
echo 'success';
exit();
}
}
+60
View File
@@ -0,0 +1,60 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Credential Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_me_controller extends Admin_controller
{
protected $_model_file = 'credential_model';
public $_page_name = 'Change Password';
public function __construct()
{
parent::__construct();
}
public function me()
{
$session = $this->get_session();
$model = $this->credential_model->get($session['credential_id']);
$this->_data['email'] = $model->email;
$this->_data['password'] = '';
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('password', 'Password', '');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Mes', $this->_data);
}
$email = $this->input->post('email');
$password = $this->input->post('password');
$payload = [
'email' => $email,
];
if (strlen($password) > 1)
{
$payload['password'] = str_replace('$2y$', '$2b$', password_hash($password, PASSWORD_BCRYPT));
}
$result = $this->credential_model->edit($payload, $session['credential_id']);
if ($result)
{
$this->success('Saved');
return $this->redirect('/admin/me', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Mes', $this->_data);
}
}
+209
View File
@@ -0,0 +1,209 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Order Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_order_controller extends Admin_controller
{
protected $_model_file = 'order_model';
public $_page_name = 'Order';
public function __construct()
{
parent::__construct();
$this->load->model('school_model');
$this->load->model('professor_model');
$this->load->model('textbook_model');
$this->load->model('classes_model');
$this->load->model('user_model');
$this->load->model('payout_model');
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Order_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Order_admin_list_paginate_view_model(
$this->order_model,
$this->pagination,
'/admin/order/0');
$this->_data['view_model']->set_heading('Order');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_purchase_user_id(($this->input->get('purchase_user_id', TRUE) != NULL) ? $this->input->get('purchase_user_id', TRUE) : NULL);
$this->_data['view_model']->set_sale_user_id(($this->input->get('sale_user_id', TRUE) != NULL) ? $this->input->get('sale_user_id', TRUE) : NULL);
$this->_data['view_model']->set_inventory_id(($this->input->get('inventory_id', TRUE) != NULL) ? $this->input->get('inventory_id', TRUE) : NULL);
$this->_data['view_model']->set_order_date(($this->input->get('order_date', TRUE) != NULL) ? $this->input->get('order_date', TRUE) : NULL);
$this->_data['view_model']->set_order_time(($this->input->get('order_time', TRUE) != NULL) ? $this->input->get('order_time', TRUE) : NULL);
$this->_data['view_model']->set_subtotal(($this->input->get('subtotal', TRUE) != NULL) ? $this->input->get('subtotal', TRUE) : NULL);
$this->_data['view_model']->set_tax(($this->input->get('tax', TRUE) != NULL) ? $this->input->get('tax', TRUE) : NULL);
$this->_data['view_model']->set_discount(($this->input->get('discount', TRUE) != NULL) ? $this->input->get('discount', TRUE) : NULL);
$this->_data['view_model']->set_total(($this->input->get('total', TRUE) != NULL) ? $this->input->get('total', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'purchase_user_id' => $this->_data['view_model']->get_purchase_user_id(),
'sale_user_id' => $this->_data['view_model']->get_sale_user_id(),
'inventory_id' => $this->_data['view_model']->get_inventory_id(),
'order_date' => $this->_data['view_model']->get_order_date(),
'order_time' => $this->_data['view_model']->get_order_time(),
'subtotal' => $this->_data['view_model']->get_subtotal(),
'tax' => $this->_data['view_model']->get_tax(),
'discount' => $this->_data['view_model']->get_discount(),
'total' => $this->_data['view_model']->get_total(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->order_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/order/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->order_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
// load data
$schools = $this->school_model->get_all(['status' => 1]);
$professors = $this->professor_model->get_all(['status' => 1]);
$textbooks = $this->db->select('isbn')->from('inventory')->get()->result_array();
$classes = $this->classes_model->get_all(['status' => 1]);
$inventory_data = $this->db->select('i.*,p.name as professor,s.name as school')->from('inventory i')
->join('school s','s.id=i.school_id')
->join('professor p','p.id=i.professor_id')
->get()->result_array();
$user_id_array = $this->user_model->get_all();
$this->_data['users'] = $user_id_array;
if($user_id_array){
$user_id_array = array_column($user_id_array,'first_name','id');
}
if( $this->_data['view_model']->get_list()){
foreach ( $this->_data['view_model']->get_list() as $key => &$value) {
$value->school_id = '';
$value->professor_id = '';
$value->isbn = '';
$value->purchase_user_id = $user_id_array[$value->purchase_user_id] ?? '';
foreach ($inventory_data as $ke=> $v) {
# code...
if($v['id']==$value->inventory_id){
$value->school_id = $v['school'];
$value->professor_id = $v['professor'];
$value->isbn = $v['isbn'];
}
}
}
}
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Order', $this->_data);
}
public function view($id)
{
$model = $this->order_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/order/0');
}
include_once __DIR__ . '/../../view_models/Order_admin_view_view_model.php';
$this->_data['view_model'] = new Order_admin_view_view_model($this->order_model);
$this->_data['view_model']->set_heading('Order');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/OrderView', $this->_data);
}
public function refund($id){
$this->order_model->update('order', [ 'status' => 2 ],['id' => $id ]);
$this->payout_model->update('payout',[ 'status'=>3 ],['order_id' => $id ] );
$order_data = $this->db->select('*')->from('order')->where('id',$id)->get()->row_array();
//create setup intent
$stripe = new \Stripe\StripeClient(
$this->config->item('stripe_secret_key')
);
$refund = $stripe->refunds->create([
'charge' => $order_data['stripe_charge_id'],
]);
if ($refund)
{
$this->success('Order Refunded successfully.');
}
return redirect('admin/order/0','refresh');
}
}
+149
View File
@@ -0,0 +1,149 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Payout Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_payout_controller extends Admin_controller
{
protected $_model_file = 'payout_model';
public $_page_name = 'Payout';
public function __construct()
{
parent::__construct();
$this->load->model('user_model');
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Payout_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Payout_admin_list_paginate_view_model(
$this->payout_model,
$this->pagination,
'/admin/payout/0');
$this->_data['view_model']->set_heading('Payout');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_order_id(($this->input->get('order_id', TRUE) != NULL) ? $this->input->get('order_id', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_amount(($this->input->get('amount', TRUE) != NULL) ? $this->input->get('amount', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'order_id' => $this->_data['view_model']->get_order_id(),
'user_id' => $this->_data['view_model']->get_user_id(),
'amount' => $this->_data['view_model']->get_amount(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->payout_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/payout/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->payout_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
$user_data = $this->user_model->get_all();
$this->_data['users'] = $user_data;
$user_id_array = [];
$user_email_array = [];
if($user_data){
$user_id_array = array_column($user_data,'first_name','id');
$user_email_array = array_column($user_data,'paypal_email','id');
}
// print_r($user_id_array);exit;
if($this->_data['view_model']->get_list() ){
foreach ( $this->_data['view_model']->get_list() as $key => &$value) {
$value->paypal_email = $user_email_array[$value->user_id] ?? '';
$value->user_id = $user_id_array[$value->user_id] ?? '';
}
}
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Payout', $this->_data);
}
public function paid($id){
$this->payout_model->update('payout',['status'=>1],['id'=>$id]);
$this->success('User paid successfully');
return redirect('admin/payout/0','refresh');
}
public function mark_all_paid(){
if($_GET['id']){
foreach ($_GET['id'] as $key => $value) {
$this->payout_model->update('payout',['status'=>1],['id'=>$value]);
}
}
$this->success('Bulk paid successfully');
return redirect('admin/payout/0','refresh');
}
}
@@ -0,0 +1,234 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Professor Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_professor_controller extends Admin_controller
{
protected $_model_file = 'professor_model';
public $_page_name = 'Professor';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Professor_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Professor_admin_list_paginate_view_model(
$this->professor_model,
$this->pagination,
'/admin/professor/0');
$this->_data['view_model']->set_heading('Professor');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_name(($this->input->get('name', TRUE) != NULL) ? $this->input->get('name', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'name' => $this->_data['view_model']->get_name(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->professor_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/professor/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->professor_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Professor', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Professor_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->professor_model->set_form_validation(
$this->form_validation, $this->professor_model->get_all_validation_rule());
$this->_data['view_model'] = new Professor_admin_add_view_model($this->professor_model);
$this->_data['view_model']->set_heading('Professor');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/ProfessorAdd', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->professor_model->create([
'name' => $name,
'status' => $status,
]);
if ($result)
{
$this->success('Professor added.');
return $this->redirect('/admin/professor/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/ProfessorAdd', $this->_data);
}
public function edit($id)
{
$model = $this->professor_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/professor/0');
}
include_once __DIR__ . '/../../view_models/Professor_admin_edit_view_model.php';
$this->form_validation = $this->professor_model->set_form_validation(
$this->form_validation, $this->professor_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Professor_admin_edit_view_model($this->professor_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Professor');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/ProfessorEdit', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->professor_model->edit([
'name' => $name,
'status' => $status,
], $id);
if ($result)
{
$this->success('Professor updated.');
return $this->redirect('/admin/professor/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/ProfessorEdit', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->professor_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->professor_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
}
+90
View File
@@ -0,0 +1,90 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/**
* Admin Profile Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_profile_controller extends Admin_controller
{
protected $_model_file = 'user_model';
public $_page_name = 'Profile';
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->model('credential_model');
$session = $this->get_session();
$model = $this->user_model->get($session['user_id']);
$id = $session['user_id'];
if (!$model)
{
$this->error('Error');
return redirect('/admin/dashboard');
}
$credential = $this->credential_model->get($session['credential_id']);
$email_validation_rules = 'required|valid_email';
include_once __DIR__ . '/../../view_models/Admin_profile_view_model.php';
if ($this->input->post('email') != $credential->email)
{
$email_validation_rules .= '|is_unique[credential.email]';
}
$this->form_validation->set_rules('email', 'Email', $email_validation_rules);
$this->form_validation->set_rules('first_name', 'First Name', 'required');
$this->form_validation->set_rules('last_name', 'Last Name', 'required');
$this->_data['view_model'] = new Admin_profile_view_model($this->user_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_email($credential->email);
$this->_data['view_model']->set_heading('Admin');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Profile', $this->_data);
}
$first_name = $this->input->post('first_name');
$last_name = $this->input->post('last_name');
$email = $this->input->post('email');
$password = $this->input->post('password');
$payload = [
'first_name' => $first_name,
'last_name' => $last_name
];
$result = $this->user_model->edit_raw($payload, $id);
if ($result)
{
$credential_payload = [
'email' => $email
];
if (strlen($password) > 0)
{
$credential_payload['password'] = str_replace('$2y$', '$2b$', password_hash($password, PASSWORD_BCRYPT));
}
$result = $this->credential_model->edit_raw($credential_payload, $session['credential_id']);
$this->success('Saved');
return $this->redirect('/admin/profile', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Profile', $this->_data);
}
}
@@ -0,0 +1,79 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/**
* Admin Profile Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_profile_credential_controller extends Admin_controller
{
protected $_model_file = 'credential_model';
public $_page_name = 'Credentials';
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->model('user_model');
$session = $this->get_session();
$user_obj = $this->user_model->get($session['user_id']);
$session = $this->get_session();
$this->load->model($this->_model_file);
$model = $this->credential_model->get($user_obj->credential_id ?? 0);
$id = $user_obj->credential_id ?? 0;
if (!$model)
{
die();
}
include_once __DIR__ . '/../../view_models/Admin_profile_credential_view_model.php';
$email_validation_rules = 'required|valid_email';
if ($this->input->post('email') != $session['email'])
{
$email_validation_rules .= '|is_unique[credential.email]';
}
$this->form_validation->set_rules('email', 'Email', $email_validation_rules);
$this->_data['view_model'] = new Admin_profile_credential_view_model($model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Admin');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Credential', $this->_data);
}
$email = $this->input->post('email');
$password = $this->input->post('password');
$payload = [
'email' => $email,
];
if (strlen($password) > 0)
{
$payload['password'] = str_replace('$2y$', '$2b$', password_hash($password, PASSWORD_BCRYPT));
}
$result = $this->credential_model->edit_raw($payload, $id);
if ($result)
{
$this->success('Saved');
return $this->redirect('/admin/credential?layout_clean_mode=1', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Credential', $this->_data);
}
}
+226
View File
@@ -0,0 +1,226 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Refund Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_refund_controller extends Admin_controller
{
protected $_model_file = 'refund_model';
public $_page_name = 'Refund';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Refund_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Refund_admin_list_paginate_view_model(
$this->refund_model,
$this->pagination,
'/admin/refund/0');
$this->_data['view_model']->set_heading('Refund');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_order_id(($this->input->get('order_id', TRUE) != NULL) ? $this->input->get('order_id', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_amount(($this->input->get('amount', TRUE) != NULL) ? $this->input->get('amount', TRUE) : NULL);
$this->_data['view_model']->set_reason(($this->input->get('reason', TRUE) != NULL) ? $this->input->get('reason', TRUE) : NULL);
$this->_data['view_model']->set_stripe_charge_id(($this->input->get('stripe_charge_id', TRUE) != NULL) ? $this->input->get('stripe_charge_id', TRUE) : NULL);
$this->_data['view_model']->set_stripe_invoice_id(($this->input->get('stripe_invoice_id', TRUE) != NULL) ? $this->input->get('stripe_invoice_id', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'order_id' => $this->_data['view_model']->get_order_id(),
'user_id' => $this->_data['view_model']->get_user_id(),
'amount' => $this->_data['view_model']->get_amount(),
'reason' => $this->_data['view_model']->get_reason(),
'stripe_charge_id' => $this->_data['view_model']->get_stripe_charge_id(),
'stripe_invoice_id' => $this->_data['view_model']->get_stripe_invoice_id(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->refund_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/refund/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->refund_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Refund', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Refund_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->refund_model->set_form_validation(
$this->form_validation, $this->refund_model->get_all_validation_rule());
$this->_data['view_model'] = new Refund_admin_add_view_model($this->refund_model);
$this->_data['view_model']->set_heading('Refund');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/RefundAdd', $this->_data);
}
$order_id = $this->input->post('order_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$amount = $this->input->post('amount', TRUE);
$reason = $this->input->post('reason', TRUE);
$explanation = $this->input->post('explanation', TRUE);
$receipt_url = $this->input->post('receipt_url', TRUE);
$stripe_charge_id = $this->input->post('stripe_charge_id', TRUE);
$stripe_invoice_id = $this->input->post('stripe_invoice_id', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->refund_model->create([
'order_id' => $order_id,
'user_id' => $user_id,
'amount' => $amount,
'reason' => $reason,
'explanation' => $explanation,
'receipt_url' => $receipt_url,
'stripe_charge_id' => $stripe_charge_id,
'stripe_invoice_id' => $stripe_invoice_id,
'status' => $status,
]);
if ($result)
{
return $this->redirect('/admin/refund/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/RefundAdd', $this->_data);
}
public function edit($id)
{
$model = $this->refund_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/refund/0');
}
include_once __DIR__ . '/../../view_models/Refund_admin_edit_view_model.php';
$this->form_validation = $this->refund_model->set_form_validation(
$this->form_validation, $this->refund_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Refund_admin_edit_view_model($this->refund_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Refund');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/RefundEdit', $this->_data);
}
$order_id = $this->input->post('order_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$amount = $this->input->post('amount', TRUE);
$reason = $this->input->post('reason', TRUE);
$explanation = $this->input->post('explanation', TRUE);
$receipt_url = $this->input->post('receipt_url', TRUE);
$stripe_charge_id = $this->input->post('stripe_charge_id', TRUE);
$stripe_invoice_id = $this->input->post('stripe_invoice_id', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->refund_model->edit([
'order_id' => $order_id,
'user_id' => $user_id,
'amount' => $amount,
'reason' => $reason,
'explanation' => $explanation,
'receipt_url' => $receipt_url,
'stripe_charge_id' => $stripe_charge_id,
'stripe_invoice_id' => $stripe_invoice_id,
'status' => $status,
], $id);
if ($result)
{
return $this->redirect('/admin/refund/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/RefundEdit', $this->_data);
}
}
+134
View File
@@ -0,0 +1,134 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Review Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_review_controller extends Admin_controller
{
protected $_model_file = 'review_model';
public $_page_name = 'Review';
public function __construct()
{
parent::__construct();
$this->load->model('user_model');
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Review_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Review_admin_list_paginate_view_model(
$this->review_model,
$this->pagination,
'/admin/review/0');
$this->_data['view_model']->set_heading('Review');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_order_id(($this->input->get('order_id', TRUE) != NULL) ? $this->input->get('order_id', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_comment(($this->input->get('comment', TRUE) != NULL) ? $this->input->get('comment', TRUE) : NULL);
$this->_data['view_model']->set_rating(($this->input->get('rating', TRUE) != NULL) ? $this->input->get('rating', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'order_id' => $this->_data['view_model']->get_order_id(),
'user_id' => $this->_data['view_model']->get_user_id(),
'comment' => $this->_data['view_model']->get_comment(),
'rating' => $this->_data['view_model']->get_rating(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->review_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/review/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->review_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
$user_id_array = $this->user_model->get_all();
$this->_data['users'] = $user_id_array;
if($user_id_array){
$user_id_array = array_column($user_id_array,'first_name','id');
}
// print_r($user_id_array);exit;
if($this->_data['view_model']->get_list() ){
foreach ( $this->_data['view_model']->get_list() as $key => &$value) {
$value->user_id = $user_id_array[$value->user_id] ?? '';
}
}
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Review', $this->_data);
}
public function reject($id){
$this->review_model->update('review',['status'=>0],['id'=>$id]);
$this->success('Review Rejected successfully');
return redirect('admin/review/0','refresh');
}
}
+234
View File
@@ -0,0 +1,234 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* School Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_school_controller extends Admin_controller
{
protected $_model_file = 'school_model';
public $_page_name = 'School';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/School_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new School_admin_list_paginate_view_model(
$this->school_model,
$this->pagination,
'/admin/school/0');
$this->_data['view_model']->set_heading('School');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_name(($this->input->get('name', TRUE) != NULL) ? $this->input->get('name', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'name' => $this->_data['view_model']->get_name(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->school_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/school/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->school_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/School', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/School_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->school_model->set_form_validation(
$this->form_validation, $this->school_model->get_all_validation_rule());
$this->_data['view_model'] = new School_admin_add_view_model($this->school_model);
$this->_data['view_model']->set_heading('School');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/SchoolAdd', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->school_model->create([
'name' => $name,
'status' => $status,
]);
if ($result)
{
$this->success('School added.');
return $this->redirect('/admin/school/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/SchoolAdd', $this->_data);
}
public function edit($id)
{
$model = $this->school_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/school/0');
}
include_once __DIR__ . '/../../view_models/School_admin_edit_view_model.php';
$this->form_validation = $this->school_model->set_form_validation(
$this->form_validation, $this->school_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new School_admin_edit_view_model($this->school_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('School');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/SchoolEdit', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->school_model->edit([
'name' => $name,
'status' => $status,
], $id);
if ($result)
{
$this->success('School updated.');
return $this->redirect('/admin/school/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/SchoolEdit', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->school_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->school_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
}
+151
View File
@@ -0,0 +1,151 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Setting Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_setting_controller extends Admin_controller
{
protected $_model_file = 'setting_model';
public $_page_name = 'Setting';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Setting_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Setting_admin_list_paginate_view_model(
$this->setting_model,
$this->pagination,
'/admin/setting/0');
$this->_data['view_model']->set_heading('Setting');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_key(($this->input->get('key', TRUE) != NULL) ? $this->input->get('key', TRUE) : NULL);
$this->_data['view_model']->set_value(($this->input->get('value', TRUE) != NULL) ? $this->input->get('value', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'key' => $this->_data['view_model']->get_key(),
'value' => $this->_data['view_model']->get_value(),
];
$this->_data['view_model']->set_total_rows($this->setting_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/setting/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->setting_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Setting', $this->_data);
}
public function edit($id)
{
$model = $this->setting_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/setting/0');
}
include_once __DIR__ . '/../../view_models/Setting_admin_edit_view_model.php';
$this->form_validation = $this->setting_model->set_form_validation(
$this->form_validation, $this->setting_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Setting_admin_edit_view_model($this->setting_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Setting');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/SettingEdit', $this->_data);
}
$value = $this->input->post('value', TRUE);
$result = $this->setting_model->edit([
'value' => $value,
], $id);
if ($result)
{
return $this->redirect('/admin/setting/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/SettingEdit', $this->_data);
}
}
+130
View File
@@ -0,0 +1,130 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_api_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Sms API Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_sms_api_controller extends Admin_api_controller
{
protected $_model_file = 'sms_model';
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Sms_admin_list_view_model.php';
$this->_data['view_model'] = new Sms_admin_list_view_model($this->sms_model);
$this->_data['view_model']->set_list($this->sms_model->get_all());
$this->_data['view_model']->set_heading('Sms');
return $this->success($this->_data['view_model']->to_json(), 200);
}
public function add()
{
$this->form_validation = $this->sms_model->set_form_validation(
$this->form_validation, $this->sms_model->get_all_validation_rule());
if ($this->form_validation->run() === FALSE)
{
return $this->_render_validation_error();
}
$slug = $this->input->post('slug', TRUE);
$content = $this->input->post('content', TRUE);
$tag = $this->input->post('tag', TRUE);
$result = $this->sms_model->create([
'slug' => $slug,
'content' => $content,
'tag' => $tag,
]);
if ($result)
{
return $this->success([], 200);
}
return $this->_render_custom_error([
'error' => 'Error'
]);
}
public function edit($id)
{
$model = $this->sms_model->get($id);
if (!$model)
{
return $this->_render_custom_error([
'error' => 'Error'
]);
}
$this->form_validation = $this->sms_model->set_form_validation(
$this->form_validation, $this->sms_model->get_all_edit_validation_rule());
if ($this->form_validation->run() === FALSE)
{
return $this->_render_validation_error();
}
$content = $this->input->post('content', TRUE);
$tag = $this->input->post('tag', TRUE);
$slug = $this->input->post('slug', TRUE);
$result = $this->sms_model->edit([
'content' => $content,
'tag' => $tag,
'slug' => $slug,
], $id);
if ($result)
{
return $this->success([], 200);
}
return $this->_render_custom_error([
'error' => 'Error'
]);
}
public function view($id)
{
$model = $this->sms_model->get($id);
if (!$model)
{
return $this->_render_custom_error([
'error' => 'Error'
]);
}
include_once __DIR__ . '/../../view_models/Sms_admin_view_view_model.php';
$this->_data['view_model'] = new Sms_admin_view_view_model($this->sms_model);
$this->_data['view_model']->set_model($model);
return $this->success(['data' => $this->_data['view_model']->to_json()], 200);
}
}
+159
View File
@@ -0,0 +1,159 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Sms Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_sms_controller extends Admin_controller
{
protected $_model_file = 'sms_model';
public $_page_name = 'SMS';
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->library('pagination');
$session = $this->get_session();
include_once __DIR__ . '/../../view_models/Sms_admin_list_view_model.php';
$this->_data['view_model'] = new Sms_admin_list_view_model($this->sms_model);
$this->_data['view_model']->set_list($this->sms_model->get_all());
$this->_data['view_model']->set_heading('SMS');
return $this->render('Admin/Sms', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Sms_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->sms_model->set_form_validation(
$this->form_validation, $this->sms_model->get_all_validation_rule());
$this->_data['view_model'] = new Sms_admin_add_view_model($this->sms_model);
$this->_data['view_model']->set_heading('SMS');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/SmsAdd', $this->_data);
}
$slug = $this->input->post('slug', TRUE);
$content = $this->input->post('content', TRUE);
$tag = $this->input->post('tag', TRUE);
$result = $this->sms_model->create([
'slug' => $slug,
'content' => $content,
'tag' => $tag,
]);
if ($result)
{
return $this->redirect('/admin/sms', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/SmsAdd', $this->_data);
}
public function edit($id)
{
$model = $this->sms_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/sms');
}
include_once __DIR__ . '/../../view_models/Sms_admin_edit_view_model.php';
$this->form_validation = $this->sms_model->set_form_validation(
$this->form_validation, $this->sms_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Sms_admin_edit_view_model($this->sms_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('SMS');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/SmsEdit', $this->_data);
}
$content = $this->input->post('content', TRUE);
$tag = $this->input->post('tag', TRUE);
$slug = $this->input->post('slug', TRUE);
$result = $this->sms_model->edit([
'content' => $content,
'tag' => $tag,
'slug' => $slug,
], $id);
if ($result)
{
return $this->redirect('/admin/sms', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/SmsEdit', $this->_data);
}
public function view($id)
{
$model = $this->sms_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/sms');
}
include_once __DIR__ . '/../../view_models/Sms_admin_view_view_model.php';
$this->_data['view_model'] = new Sms_admin_view_view_model($this->sms_model);
$this->_data['view_model']->set_heading('SMS');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/SmsView', $this->_data);
}
}
@@ -0,0 +1,140 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_api_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Spreadsheet API Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_spreadsheet_api_controller extends Admin_api_controller
{
protected $_model_file = 'spreadsheet_model';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Spreadsheet_admin_list_paginate_view_model.php';
$this->_data['view_model'] = new Spreadsheet_admin_list_paginate_view_model(
$this->spreadsheet_model,
$this->pagination,
'/admin/spreadsheet/0');
$this->_data['view_model']->set_heading('{{{page_name}}}');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_name(($this->input->get('name', TRUE) != NULL) ? $this->input->get('name', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$this->_data['view_model']->set_created_at(($this->input->get('created_at', TRUE) != NULL) ? $this->input->get('created_at', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'name' => $this->_data['view_model']->get_name(),
'user_id' => $this->_data['view_model']->get_user_id(),
'status' => $this->_data['view_model']->get_status(),
'created_at' => $this->_data['view_model']->get_created_at(),
];
$this->_data['view_model']->set_total_rows($this->spreadsheet_model->count($where));
$this->_data['view_model']->set_per_page(10);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->spreadsheet_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where));
return $this->success($this->_data['view_model']->to_json(), 200);
}
public function add()
{
$this->form_validation = $this->spreadsheet_model->set_form_validation(
$this->form_validation, $this->spreadsheet_model->get_all_validation_rule());
if ($this->form_validation->run() === FALSE)
{
return $this->_render_validation_error();
}
$name = $this->input->post('name', TRUE);
$value = $this->input->post('value', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->spreadsheet_model->create([
'name' => $name,
'value' => $value,
'status' => $status,
]);
if ($result)
{
$this->success('Spreadsheet added.');
return $this->success([], 200);
}
return $this->_render_custom_error([
'error' => 'Error'
]);
}
public function edit($id)
{
$model = $this->spreadsheet_model->get($id);
if (!$model)
{
return $this->_render_custom_error([
'error' => 'Error'
]);
}
$this->form_validation = $this->spreadsheet_model->set_form_validation(
$this->form_validation, $this->spreadsheet_model->get_all_edit_validation_rule());
if ($this->form_validation->run() === FALSE)
{
return $this->_render_validation_error();
}
$name = $this->input->post('name', TRUE);
$value = $this->input->post('value', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->spreadsheet_model->edit([
'name' => $name,
'value' => $value,
'status' => $status,
], $id);
if ($result)
{
$this->success('Spreadsheet updated.');
return $this->success([], 200);
}
return $this->_render_custom_error([
'error' => 'Error'
]);
}
}
@@ -0,0 +1,433 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Spreadsheet Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_spreadsheet_controller extends Admin_controller
{
protected $_model_file = 'spreadsheet_model';
public $_page_name = 'Spreadsheet';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Spreadsheet_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Spreadsheet_admin_list_paginate_view_model(
$this->spreadsheet_model,
$this->pagination,
'/admin/spreadsheet/0');
$this->_data['view_model']->set_heading('Spreadsheet');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_name(($this->input->get('name', TRUE) != NULL) ? $this->input->get('name', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$this->_data['view_model']->set_created_at(($this->input->get('created_at', TRUE) != NULL) ? $this->input->get('created_at', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'name' => $this->_data['view_model']->get_name(),
'user_id' => $this->_data['view_model']->get_user_id(),
'status' => $this->_data['view_model']->get_status(),
'created_at' => $this->_data['view_model']->get_created_at(),
];
$this->_data['view_model']->set_total_rows($this->spreadsheet_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/spreadsheet/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->spreadsheet_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Spreadsheet', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Spreadsheet_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->spreadsheet_model->set_form_validation(
$this->form_validation, $this->spreadsheet_model->get_all_validation_rule());
$this->_data['view_model'] = new Spreadsheet_admin_add_view_model($this->spreadsheet_model);
$this->_data['view_model']->set_heading('Spreadsheet');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/SpreadsheetAdd', $this->_data);
}
$name = $this->input->post('name', TRUE);
$value = $this->input->post('value', TRUE);
$status = $this->input->post('status', TRUE);
$final_value = "";
$luckysheet_order = "";
$file_name = $_FILES['value']['name'];
if($file_name != "")
{
$original_name = "";
$original_name = explode('.' , $file_name);
if(is_array($original_name) && count($original_name) > 1)
{
$original_name = $original_name[0];
}
$value_file = fopen($_FILES['value']['tmp_name'], "r");
if($_FILES['value']['type'] == 'text/csv')
{
$default_delimeter = ";";
$headers = fgetcsv($value_file, 10000, $default_delimeter);
/**
* Condition for checking and setting up the delimeter for the csv
*/
if(is_array($headers) && count($headers) <= 1)
{
$headers = fgetcsv($value_file, 10000, ',');
if(is_array($headers) && count($headers)>1)
{
$default_delimeter = ",";
}
}
if(!empty($headers) && is_array($headers))
{
$temp_array[] = array();
for( $x = 0 ; $x < count($headers); $x++)
{
$header_array = array(
'r' => 0,
'c' => $x,
'v' => array(
'ct' => array(
'fa' => 'General',
't' => 'g'
),
'm' => $headers[$x],
'v' => $headers[$x]
)
);
$temp_array[$x] = $header_array;
}
$ro = 1 ; //count of rows
while (($data = fgetcsv($value_file, 1000,$default_delimeter)) !== FALSE)
{
if(!empty($data) && is_array($data))
{
foreach($data as $data_key => $values)
{
$body_data = array(
'r' => $ro,
'c' => $data_key,
'v' => array(
'ct' => array(
'fa' => 'General',
't' => 'g'
),
'm' => $values,
'v' => $values
)
);
$temp_array[] = $body_data;
}
}
$ro++;
}
$luckysheet_format =
array(
array(
'name' => $original_name, //Worksheet name
'color' => '', //Worksheet color
'index' => '0', //Worksheet index
'status' => 1, //Worksheet active status
'order' => 0, //The order of the worksheet
'hide' => 0,//Whether worksheet hide
'row' => 100, //the number of rows in a sheet
'column' => 36, //the number of columns in a sheet
'defaultRowHeight' => 19, //Customized default row height
'defaultColWidth' => 73, //Customized default column width
'celldata' => $temp_array,//Initial the cell data
'config' => array(
'merge' => new ArrayObject(), //merged cells
'rowlen' => new ArrayObject(), //Table row height
'columnlen' => new ArrayObject(), //Table column width
'rowhidden' => new ArrayObject(), //hidden rows
'colhidden' => new ArrayObject(), //hidden columns
'borderInfo'=> new ArrayObject(), //borders
'authority' => new ArrayObject(), //Worksheet protection
),
'scrollLeft' => 0, //Left and right scroll bar position
'scrollTop' => 315, //Up and down scroll bar position
'luckysheet_select_save' => [], //selected area
'calcChain' => [],//Formula chain
'isPivotTable' => false,//Whether is pivot table
'pivotTable' => new ArrayObject(),//Pivot table settings
'filter_select' => new ArrayObject(),//Filter range
'filter' => null,//Filter configuration
'luckysheet_alternateformat_save' => array(), //Alternate colors
'luckysheet_alternateformat_save_modelCustom' => [], //Customize alternate colors
'luckysheet_conditionformat_save' => new ArrayObject(),//condition format
'frozen' => new ArrayObject(), //freeze row and column configuration
'chart' => [], //Chart configuration
'zoomRatio' => 1, // zoom ratio
'image' => [], //image
'showGridLines' => 1, //Whether to show grid lines
)
);
$luckysheet_order = json_encode($luckysheet_format);
}
fclose($value_file);
}
}
else
{
$luckysheet_format =
array(
array(
'name' => $name, //Worksheet name
'color' => '', //Worksheet color
'index' => '0', //Worksheet index
'status' => 1, //Worksheet active status
'order' => 0, //The order of the worksheet
'hide' => 0,//Whether worksheet hide
'row' => 100, //the number of rows in a sheet
'column' => 36, //the number of columns in a sheet
'defaultRowHeight' => 19, //Customized default row height
'defaultColWidth' => 73, //Customized default column width
'celldata' => [],//Initial the cell data
'config' => array(
'merge' => new ArrayObject(), //merged cells
'rowlen' => new ArrayObject(), //Table row height
'columnlen' => new ArrayObject(), //Table column width
'rowhidden' => new ArrayObject(), //hidden rows
'colhidden' => new ArrayObject(), //hidden columns
'borderInfo'=> new ArrayObject(), //borders
'authority' => new ArrayObject(), //Worksheet protection
),
'scrollLeft' => 0, //Left and right scroll bar position
'scrollTop' => 315, //Up and down scroll bar position
'luckysheet_select_save' => [], //selected area
'calcChain' => [],//Formula chain
'isPivotTable' => false,//Whether is pivot table
'pivotTable' => new ArrayObject(),//Pivot table settings
'filter_select' => new ArrayObject(),//Filter range
'filter' => null,//Filter configuration
'luckysheet_alternateformat_save' => array(), //Alternate colors
'luckysheet_alternateformat_save_modelCustom' => [], //Customize alternate colors
'luckysheet_conditionformat_save' => new ArrayObject(),//condition format
'frozen' => new ArrayObject(), //freeze row and column configuration
'chart' => [], //Chart configuration
'zoomRatio' => 1, // zoom ratio
'image' => [], //image
'showGridLines' => 1, //Whether to show grid lines
)
);
$luckysheet_order = json_encode($luckysheet_format);
}
$result = $this->spreadsheet_model->create([
'name' => $name,
'value' => $luckysheet_order,
'status' => $status,
'user_id' => $session['user_id']
]);
if ($result)
{
$this->success('Spreadsheet added.');
return $this->redirect('/admin/spreadsheet/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/SpreadsheetAdd', $this->_data);
}
public function edit($id)
{
$model = $this->spreadsheet_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/spreadsheet/0');
}
include_once __DIR__ . '/../../view_models/Spreadsheet_admin_edit_view_model.php';
$this->form_validation = $this->spreadsheet_model->set_form_validation(
$this->form_validation, $this->spreadsheet_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Spreadsheet_admin_edit_view_model($this->spreadsheet_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Spreadsheet');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/SpreadsheetEdit', $this->_data);
}
$name = $this->input->post('name', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->spreadsheet_model->edit([
'name' => $name,
'status' => $status,
], $id);
if ($result)
{
$this->success('Spreadsheet updated.');
return $this->redirect('/admin/spreadsheet/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/SpreadsheetEdit', $this->_data);
}
public function bulk_delete()
{
$bulk_items = $this->input->post('bulk_items');
foreach ($bulk_items as $key => $id) {
$this->spreadsheet_model->real_delete($id);
}
echo 'success';
exit();
}
/**
* Function to return spreadsheet data only
*/
public function spreadsheet_data($id)
{
$model = $this->spreadsheet_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/spreadsheet/0');
}
include_once __DIR__ . '/../../view_models/Spreadsheet_admin_edit_view_model.php';
$this->form_validation = $this->spreadsheet_model->set_form_validation(
$this->form_validation, $this->spreadsheet_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Spreadsheet_admin_edit_view_model($this->spreadsheet_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Spreadsheet');
return $this->render('Admin/Spreadsheet_view_only', $this->_data);
}
/**
* function to update the sheet
*/
public function update_sheet($id)
{
$model = $this->spreadsheet_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
echo json_encode(['error'=> 'error']);
exit();
}
$data = file_get_contents("php://input",TRUE);
if($data)
{
$result = $this->spreadsheet_model->edit([
'value' => $data,
], $id);
if ($result)
{
$this->success('Spreadsheet Updated Successfully.');
echo json_encode(['success'=> 'updated']);
exit();
}
}
$this->error('Error');
echo json_encode(['error'=> 'error']);
exit();
}
}
@@ -0,0 +1,156 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Suggestion Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_suggestion_controller extends Admin_controller
{
protected $_model_file = 'suggestion_model';
public $_page_name = 'Suggestion';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Suggestion_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Suggestion_admin_list_paginate_view_model(
$this->suggestion_model,
$this->pagination,
'/admin/suggestion/0');
$this->_data['view_model']->set_heading('Suggestion');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_name(($this->input->get('name', TRUE) != NULL) ? $this->input->get('name', TRUE) : NULL);
$this->_data['view_model']->set_email(($this->input->get('email', TRUE) != NULL) ? $this->input->get('email', TRUE) : NULL);
$this->_data['view_model']->set_suggestion_type(($this->input->get('suggestion_type', TRUE) != NULL) ? $this->input->get('suggestion_type', TRUE) : NULL);
$this->_data['view_model']->set_additional_notes(($this->input->get('additional_notes', TRUE) != NULL) ? $this->input->get('additional_notes', TRUE) : NULL);
$this->_data['view_model']->set_created_at(($this->input->get('created_at', TRUE) != NULL) ? $this->input->get('created_at', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'name' => $this->_data['view_model']->get_name(),
'email' => $this->_data['view_model']->get_email(),
'suggestion_type' => $this->_data['view_model']->get_suggestion_type(),
'additional_notes' => $this->_data['view_model']->get_additional_notes(),
'created_at' => $this->_data['view_model']->get_created_at(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->suggestion_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/suggestion/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->suggestion_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Suggestion', $this->_data);
}
public function view($id)
{
$model = $this->suggestion_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/suggestion/0');
}
include_once __DIR__ . '/../../view_models/Suggestion_admin_view_view_model.php';
$this->_data['view_model'] = new Suggestion_admin_view_view_model($this->suggestion_model);
$this->_data['view_model']->set_heading('Suggestion');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/SuggestionView', $this->_data);
}
public function delete($id)
{
$model = $this->suggestion_model->get($id);
if (!$model)
{
// $this->error('Error');
// return redirect('/admin/suggestion/0');
}
$result = $this->suggestion_model->real_delete($id);
if ($result)
{
return $this->redirect('/admin/suggestion/0', 'refresh');
}
$this->error('Error');
return redirect('/admin/suggestion/0');
}
}
+234
View File
@@ -0,0 +1,234 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Tax Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_tax_controller extends Admin_controller
{
protected $_model_file = 'tax_model';
public $_page_name = 'Tax';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Tax_admin_list_paginate_view_model.php';
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$session = $this->get_session();
$where = [];
$this->_data['view_model'] = new Tax_admin_list_paginate_view_model(
$this->tax_model,
$this->pagination,
'/admin/tax/0');
$this->_data['view_model']->set_heading('Tax');
$this->_data['view_model']->set_total_rows($this->tax_model->count($where));
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/tax/0');
$this->_data['view_model']->set_list($this->tax_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Tax', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Tax_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->tax_model->set_form_validation(
$this->form_validation, $this->tax_model->get_all_validation_rule());
$this->_data['view_model'] = new Tax_admin_add_view_model($this->tax_model);
$this->_data['view_model']->set_heading('Tax');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/TaxAdd', $this->_data);
}
$tax = $this->input->post('tax', TRUE);
$result = $this->tax_model->create([
'tax' => $tax,
]);
if ($result)
{
return $this->redirect('/admin/tax/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/TaxAdd', $this->_data);
}
public function edit($id)
{
$model = $this->tax_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/tax/0');
}
include_once __DIR__ . '/../../view_models/Tax_admin_edit_view_model.php';
$this->form_validation = $this->tax_model->set_form_validation(
$this->form_validation, $this->tax_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Tax_admin_edit_view_model($this->tax_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Tax');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/TaxEdit', $this->_data);
}
$tax = $this->input->post('tax', TRUE);
$result = $this->tax_model->edit([
'tax' => $tax,
], $id);
if ($result)
{
return $this->redirect('/admin/tax/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/TaxEdit', $this->_data);
}
public function view($id)
{
$model = $this->tax_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/tax/0');
}
include_once __DIR__ . '/../../view_models/Tax_admin_view_view_model.php';
$this->_data['view_model'] = new Tax_admin_view_view_model($this->tax_model);
$this->_data['view_model']->set_heading('Tax');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/TaxView', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->tax_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->tax_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
}
@@ -0,0 +1,219 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Test_image Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_test_image_controller extends Admin_controller
{
protected $_model_file = 'test_image_model';
public $_page_name = 'Test image';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Test_image_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Test_image_admin_list_paginate_view_model(
$this->test_image_model,
$this->pagination,
'/admin/test_image/0');
$this->_data['view_model']->set_heading('Test image');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_created_at(($this->input->get('created_at', TRUE) != NULL) ? $this->input->get('created_at', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'created_at' => $this->_data['view_model']->get_created_at(),
];
$this->_data['view_model']->set_total_rows($this->test_image_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/test_image/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->test_image_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Test_image', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Test_image_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->test_image_model->set_form_validation(
$this->form_validation, $this->test_image_model->get_all_validation_rule());
$this->_data['view_model'] = new Test_image_admin_add_view_model($this->test_image_model);
$this->_data['view_model']->set_heading('Test image');
$this->load->model('image_model');
$gallery_images = $this->image_model->get_all();
foreach ($gallery_images as $key => $image) {
if($image->type == 4){
$image->show_url = base_url().$image->url;
}else
{
$image->show_url = $image->url;
}$image->type = $this->image_model->type_mapping()[$image->type];
}
$this->_data['gallery_images'] = $gallery_images;
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Test_imageAdd', $this->_data);
}
$image = $this->input->post('image', TRUE);
$image_id = $this->input->post('image_id', TRUE);
$result = $this->test_image_model->create([
'image' => $image,
'image_id' => $image_id,
]);
if ($result)
{
$this->success('image added.');
return $this->redirect('/admin/test_image/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Test_imageAdd', $this->_data);
}
public function edit($id)
{
$model = $this->test_image_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/test_image/0');
}
include_once __DIR__ . '/../../view_models/Test_image_admin_edit_view_model.php';
$this->form_validation = $this->test_image_model->set_form_validation(
$this->form_validation, $this->test_image_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Test_image_admin_edit_view_model($this->test_image_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Test image');
$this->load->model('image_model');
$gallery_images = $this->image_model->get_all();
foreach ($gallery_images as $key => $image) {
if($image->type == 4){
$image->show_url = base_url().$image->url;
}else
{
$image->show_url = $image->url;
}$image->type = $this->image_model->type_mapping()[$image->type];
}
$this->_data['gallery_images'] = $gallery_images;
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/Test_imageEdit', $this->_data);
}
$image = $this->input->post('image', TRUE);
$image_id = $this->input->post('image_id', TRUE);
$result = $this->test_image_model->edit([
'image' => $image,
'image_id' => $image_id,
], $id);
if ($result)
{
$this->success('image updated.');
return $this->redirect('/admin/test_image/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/Test_imageEdit', $this->_data);
}
public function bulk_delete()
{
$bulk_items = $this->input->post('bulk_items');
foreach ($bulk_items as $key => $id) {
$this->test_image_model->real_delete($id);
}
echo 'success';
exit();
}
}
+238
View File
@@ -0,0 +1,238 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Textbook Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_textbook_controller extends Admin_controller
{
protected $_model_file = 'textbook_model';
public $_page_name = 'Textbook';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Textbook_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Textbook_admin_list_paginate_view_model(
$this->textbook_model,
$this->pagination,
'/admin/textbook/0');
$this->_data['view_model']->set_heading('Textbook');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_name(($this->input->get('name', TRUE) != NULL) ? $this->input->get('name', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'name' => $this->_data['view_model']->get_name(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->textbook_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/textbook/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->textbook_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Textbook', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Textbook_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->textbook_model->set_form_validation(
$this->form_validation, $this->textbook_model->get_all_validation_rule());
$this->_data['view_model'] = new Textbook_admin_add_view_model($this->textbook_model);
$this->_data['view_model']->set_heading('Textbook');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/TextbookAdd', $this->_data);
}
$name = $this->input->post('name', TRUE);
$isbn = $this->input->post('isbn', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->textbook_model->create([
'name' => $name,
'isbn' => $isbn,
'status' => $status,
]);
if ($result)
{
$this->success('Textbook added.');
return $this->redirect('/admin/textbook/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/TextbookAdd', $this->_data);
}
public function edit($id)
{
$model = $this->textbook_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/textbook/0');
}
include_once __DIR__ . '/../../view_models/Textbook_admin_edit_view_model.php';
$this->form_validation = $this->textbook_model->set_form_validation(
$this->form_validation, $this->textbook_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Textbook_admin_edit_view_model($this->textbook_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Textbook');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/TextbookEdit', $this->_data);
}
$name = $this->input->post('name', TRUE);
$isbn = $this->input->post('isbn', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->textbook_model->edit([
'name' => $name,
'isbn' => $isbn,
'status' => $status,
], $id);
if ($result)
{
$this->success('Textbook updated.');
return $this->redirect('/admin/textbook/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/TextbookEdit', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->textbook_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->textbook_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
}
+128
View File
@@ -0,0 +1,128 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Ticket Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_ticket_controller extends Admin_controller
{
protected $_model_file = 'ticket_model';
public $_page_name = 'Ticket';
public function __construct()
{
parent::__construct();
$this->load->model('user_model');
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Ticket_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Ticket_admin_list_paginate_view_model(
$this->ticket_model,
$this->pagination,
'/admin/ticket/0');
$this->_data['view_model']->set_heading('Ticket');
$this->_data['view_model']->set_order_id(($this->input->get('order_id', TRUE) != NULL) ? $this->input->get('order_id', TRUE) : NULL);
$this->_data['view_model']->set_message(($this->input->get('message', TRUE) != NULL) ? $this->input->get('message', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'order_id' => $this->_data['view_model']->get_order_id(),
'message' => $this->_data['view_model']->get_message(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->ticket_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/ticket/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->ticket_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
$user_id_array = $this->user_model->get_all();
if($user_id_array){
$user_id_array = array_column($user_id_array,'first_name','id');
}
// print_r($user_id_array);exit;
if($this->_data['view_model']->get_list() ){
foreach ( $this->_data['view_model']->get_list() as $key => &$value) {
$value->user_id = $user_id_array[$value->user_id] ?? '';
}
}
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Ticket', $this->_data);
}
public function resolve($id){
$this->ticket_model->update('ticket',['status'=>1],['id'=>$id]);
$this->success('Resolved successfully');
return redirect('admin/ticket/0','refresh');
}
}
@@ -0,0 +1,309 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Transaction Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_transaction_controller extends Admin_controller
{
protected $_model_file = 'transaction_model';
public $_page_name = 'Transaction';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Transaction_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Transaction_admin_list_paginate_view_model(
$this->transaction_model,
$this->pagination,
'/admin/transaction/0');
$this->_data['view_model']->set_heading('Transaction');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_payment_method(($this->input->get('payment_method', TRUE) != NULL) ? $this->input->get('payment_method', TRUE) : NULL);
$this->_data['view_model']->set_order_id(($this->input->get('order_id', TRUE) != NULL) ? $this->input->get('order_id', TRUE) : NULL);
$this->_data['view_model']->set_transaction_date(($this->input->get('transaction_date', TRUE) != NULL) ? $this->input->get('transaction_date', TRUE) : NULL);
$this->_data['view_model']->set_transaction_time(($this->input->get('transaction_time', TRUE) != NULL) ? $this->input->get('transaction_time', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_tax(($this->input->get('tax', TRUE) != NULL) ? $this->input->get('tax', TRUE) : NULL);
$this->_data['view_model']->set_discount(($this->input->get('discount', TRUE) != NULL) ? $this->input->get('discount', TRUE) : NULL);
$this->_data['view_model']->set_subtotal(($this->input->get('subtotal', TRUE) != NULL) ? $this->input->get('subtotal', TRUE) : NULL);
$this->_data['view_model']->set_total(($this->input->get('total', TRUE) != NULL) ? $this->input->get('total', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'payment_method' => $this->_data['view_model']->get_payment_method(),
'order_id' => $this->_data['view_model']->get_order_id(),
'transaction_date' => $this->_data['view_model']->get_transaction_date(),
'transaction_time' => $this->_data['view_model']->get_transaction_time(),
'user_id' => $this->_data['view_model']->get_user_id(),
'tax' => $this->_data['view_model']->get_tax(),
'discount' => $this->_data['view_model']->get_discount(),
'subtotal' => $this->_data['view_model']->get_subtotal(),
'total' => $this->_data['view_model']->get_total(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->transaction_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/transaction/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->transaction_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/Transaction', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Transaction_admin_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->transaction_model->set_form_validation(
$this->form_validation, $this->transaction_model->get_all_validation_rule());
$this->_data['view_model'] = new Transaction_admin_add_view_model($this->transaction_model);
$this->_data['view_model']->set_heading('Transaction');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/TransactionAdd', $this->_data);
}
$payment_method = $this->input->post('payment_method', TRUE);
$order_id = $this->input->post('order_id', TRUE);
$transaction_date = $this->input->post('transaction_date', TRUE);
$transaction_time = $this->input->post('transaction_time', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$tax = $this->input->post('tax', TRUE);
$discount = $this->input->post('discount', TRUE);
$subtotal = $this->input->post('subtotal', TRUE);
$total = $this->input->post('total', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->transaction_model->create([
'payment_method' => $payment_method,
'order_id' => $order_id,
'transaction_date' => $transaction_date,
'transaction_time' => $transaction_time,
'user_id' => $user_id,
'tax' => $tax,
'discount' => $discount,
'subtotal' => $subtotal,
'total' => $total,
'status' => $status,
]);
if ($result)
{
return $this->redirect('/admin/transaction/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/TransactionAdd', $this->_data);
}
public function edit($id)
{
$model = $this->transaction_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/admin/transaction/0');
}
include_once __DIR__ . '/../../view_models/Transaction_admin_edit_view_model.php';
$this->form_validation = $this->transaction_model->set_form_validation(
$this->form_validation, $this->transaction_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Transaction_admin_edit_view_model($this->transaction_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Transaction');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Admin/TransactionEdit', $this->_data);
}
$payment_method = $this->input->post('payment_method', TRUE);
$order_id = $this->input->post('order_id', TRUE);
$transaction_date = $this->input->post('transaction_date', TRUE);
$transaction_time = $this->input->post('transaction_time', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$tax = $this->input->post('tax', TRUE);
$discount = $this->input->post('discount', TRUE);
$subtotal = $this->input->post('subtotal', TRUE);
$total = $this->input->post('total', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->transaction_model->edit([
'payment_method' => $payment_method,
'order_id' => $order_id,
'transaction_date' => $transaction_date,
'transaction_time' => $transaction_time,
'user_id' => $user_id,
'tax' => $tax,
'discount' => $discount,
'subtotal' => $subtotal,
'total' => $total,
'status' => $status,
], $id);
if ($result)
{
return $this->redirect('/admin/transaction/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Admin/TransactionEdit', $this->_data);
}
public function view($id)
{
$model = $this->transaction_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/admin/transaction/0');
}
include_once __DIR__ . '/../../view_models/Transaction_admin_view_view_model.php';
$this->_data['view_model'] = new Transaction_admin_view_view_model($this->transaction_model);
$this->_data['view_model']->set_heading('Transaction');
$this->_data['view_model']->set_model($model);
return $this->render('Admin/TransactionView', $this->_data);
}
public function delete()
{
$id = $this->input->post('id', TRUE);
if (!empty($id))
{
$model = $this->transaction_model->get($id);
if (!$model)
{
$output['error'] = TRUE;
$output['status'] = 404;
$output['msg'] = 'Error! Data not found.';
echo json_encode($output);
exit();
}
else
{
$result = $this->transaction_model->real_delete($id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 500;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! ID not found.';
echo json_encode($output);
exit();
}
}
public function bulk_delete()
{
$bulk_items = $this->input->post('bulk_items');
foreach ($bulk_items as $key => $id) {
$this->transaction_model->real_delete($id);
}
echo 'success';
exit();
}
}
@@ -0,0 +1,110 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Admin_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* User_card Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_user_card_controller extends Admin_controller
{
protected $_model_file = 'user_card_model';
public $_page_name = 'User Card';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/User_card_admin_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new User_card_admin_list_paginate_view_model(
$this->user_card_model,
$this->pagination,
'/admin/user_card/0');
$this->_data['view_model']->set_heading('User Card');
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_last4(($this->input->get('last4', TRUE) != NULL) ? $this->input->get('last4', TRUE) : NULL);
$this->_data['view_model']->set_is_default(($this->input->get('is_default', TRUE) != NULL) ? $this->input->get('is_default', TRUE) : NULL);
$where = [
'user_id' => $this->_data['view_model']->get_user_id(),
'last4' => $this->_data['view_model']->get_last4(),
'is_default' => $this->_data['view_model']->get_is_default(),
];
$this->_data['view_model']->set_total_rows($this->user_card_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/admin/user_card/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->user_card_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Admin/User_card', $this->_data);
}
}
+264
View File
@@ -0,0 +1,264 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Marketing Controller
*
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Marketing_controller extends Manaknight_Controller
{
public $_data = [
'error' => '',
'success' => ''
];
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('marketing_model');
}
/**
* Debug Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dl($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : <pre>' . print_r($data, TRUE) . '</pre>');
}
}
/**
* Debug json Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dj($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : ' . json_encode($data));
}
}
public function get_session()
{
if (!$this->_test_mode)
{
return $_SESSION;
}
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
return $session;
}
public function set_session($field, $value)
{
if (!$this->_test_mode)
{
$_SESSION[$field] = $value;
}
else
{
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
$session[$field] = $value;
$this->config->set_item('session_test', $session);
}
}
public function destroy_session()
{
if (!$this->_test_mode)
{
unset($_SESSION);
}
else
{
$this->config->set_item('session_test', []);
}
}
public function get_setting()
{
return $this->_setting;
}
/**
* Function to generate a slug
*/
public function generate_marketing_slug($str)
{
$delimiter = '-';
$slug = strtolower(trim(preg_replace('/[\s-]+/', $delimiter, preg_replace('/[^A-Za-z0-9-]+/', $delimiter, preg_replace('/[&]/', 'and', preg_replace('/[\']/', '', iconv('UTF-8', 'ASCII//TRANSLIT', $str))))), $delimiter));
$full_path = base_url() . 'a/';
$row = $this->marketing_model->get_by_field('slug', $full_path . $slug);
if (empty($row))
{
$output['slug'] = $slug;
echo json_encode($output);
exit;
}
else
{
$i = 1;
$check_me_again = TRUE;
while ($check_me_again)
{
$slug = $slug . '-' . $i;
$row = $this->marketing_model->get_by_field('slug', $full_path . $slug);
if (empty($row))
{
$check_me_again = FALSE;
}
$i++;
}
$output['slug'] = $slug;
echo json_encode($output);
exit;
}
}
/**
* Function to return the generated page
*/
public function generate_custom_marketing_page($slug)
{
$slug_url = base_url() . 'a/';
$slug = $slug_url.$slug;
$marketing_data = $this->marketing_model->get_by_field('slug',$slug);
$this->_data['header'] = '';
$this->_data['footer'] = '';
$this->_data['content_template'] = '';
$this->_data['content'] = '';
$this->_data['success'] = '';
$this->_data['error'] = '';
$this->_data['layout_clean_mode'] = TRUE;
$this->_data['reuse_query_string'] = TRUE;
$this->_data['base_url'] = base_url();
$this->_data['total_rows'] = 25;
$this->_data['per_page'] = 25;
$this->_data['num_links'] = '';
$this->_data['full_tag_open'] = '<ul class="pagination justify-content-end">';
$this->_data['full_tag_close'] = '</ul>';
$this->_data['attributes'] = ['class' => 'page-link'];
$this->_data['first_link'] = FALSE ;
$this->_data['last_link'] = FALSE;
$this->_data['first_tag_open'] = '<li class="page-item">';
$this->_data['first_tag_close'] = '</li>';
$this->_data['prev_link'] = '&laquo';
$this->_data['setting'] = $this->get_setting();
$this->_data['list'] = [];
if($marketing_data)
{
if($marketing_data->header_template_path != '')
{
$this->_data['header'] = $marketing_data->header_template_path ? $marketing_data->header_template_path : '';
}
if($marketing_data->footer_template_path != '')
{
$this->_data['footer'] = $marketing_data->footer_template_path ? $marketing_data->footer_template_path : '';
}
$this->_data['content'] = $marketing_data->content ? $marketing_data->content : '';
$this->_data['content_template'] = $marketing_data->content_template_path ? $marketing_data->content_template_path : '';
if($marketing_data->status == 0)
{
if ($marketing_data->password_protect == '')
{
return $this->generate_marketing_template($this->_data);
}
else
{
$valid_passwords = [
'guest' => $marketing_data->password_protect
];
$valid_users = array_keys($valid_passwords);
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
$validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]);
if (!$validated)
{
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
die ('Not authorized');
}
return $this->generate_marketing_template($this->_data);
}
}
else
{
$this->output->set_status_header('404');
$data['heading'] = '404 Page Not Found';
$data['message'] = 'The page you requested was not found';
$this->load->view('errors/html/error_404',$data);
exit();
}
}
$this->output->set_status_header('404');
$data['heading'] = '404 Page Not Found';
$data['message'] = 'The page you requested was not found';
$this->load->view('errors/html/error_404', $data);
exit();
}
/**
* Function to generate marketing template
*/
public function generate_marketing_template($marketing_data)
{
if($marketing_data['header'] != '')
{
$this->load->view($marketing_data['header'], $marketing_data);
}
if($marketing_data['content_template'] == '')
{
echo $marketing_data['content_template'];
}
else
{
$this->load->view('Guest/Template_page', $marketing_data);
}
if($marketing_data['footer'] != '')
{
$this->load->view($marketing_data['footer'], $marketing_data);
}
}
}
@@ -0,0 +1,580 @@
<?php if (!defined('BASEPATH'))
{
exit('No direct script access allowed');
}
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2019*/
/**
* Stripe Webhooks Api Controller
*
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
*
*/
use \Stripe\Stripe;
use \Stripe\Webhook;
class Stripe_webhooks_api_controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
$stripe_config = [
'stripe_api_version' => ($this->config->item('stripe_api_version') ?? ''),
'stripe_publish_key' => ($this->config->item('stripe_publish_key') ?? ''),
'stripe_secret_key' => ($this->config->item('stripe_secret_key') ?? '')
];
$this->load->library('payment_service', $stripe_config);
$this->load->database();
}
/**
* handle stripe events
* @see https://stripe.com/docs/api/events/types
*/
public function index()
{
$payload = @file_get_contents('php://input');
$event = null;
try
{
$event = $this->payment_service->get_stripe_event($payload);
}
catch (Exception $e)
{
http_response_code(400);
exit();
}
$args = $event->data->object;
switch ($event->type)
{
case 'payment_intent.succeeded':
// $this->handle_payment_intent_succeeded($args);
break;
case 'payment_method.attached':
// $this->handle_payment_method($args);
break;
case 'invoice.created':
// $this->handle_invoice_created($args);
break;
case 'invoice.finalized':
// $this->handle_invoice_finalized($args);
break;
case 'invoice.payment_failed':
// $this->handle_invoice_payment_failed($args);
break;
case 'invoice.payment_succeeded':
// $this->handle_invoice_payment_succeeded($args);
break;
case 'invoice.upcoming':
// $this->handle_invoice_upcoming($args);
break;
case 'charge.dispute.created':
$this->handle_dispute_created($args);
error_log(print_r($args), true);
break;
case 'charge.dispute.funds_reinstated':
$this->handle_dispute_funds_reinstated($args);
break;
case 'charge.dispute.funds_withdrawn':
$this->handle_dispute_funds_withdrawn($args);
break;
case 'charge.dispute.updated':
$this->handle_dispute_updated($args);
error_log(print_r($args, true));
break;
case 'charge.succeeded':
error_log(print_r($args, true));
// $this->handle_charge_succeeded($args);
break;
case 'charge.refunded':
$this->handle_charge_refunded($args);
break;
case 'charge.refund.updated':
$this->handle_refund_updated($args);
break;
case 'checkout.session.completed':
// $this->handle_checkout_session_completed($args);
break;
case 'customer.source.expiring':
http_response_code(200);
break;
case 'customer.subscription.updated':
http_response_code(200);
break;
case 'customer.subscription.deleted':
// $this->handle_subscription_deleted($args);
break;
case 'subscription_schedule.aborted':
// $this->handle_subscription_schedule_aborted($args);
break;
case 'subscription_schedule.canceled':
// $this->handle_subscription_schedule_canceled($args);
break;
case 'subscription_schedule.completed':
// $this->handle_subscription_schedule_completed($args);
break;
case 'subscription_schedule.expiring':
// $this->handle_subscription_schedule_expiring($args);
break;
default:
http_response_code(200);
exit();
}
}
/**
* Dispute:
* https://stripe.com/docs/api/disputes/object
*/
public function handle_dispute_created($args)
{
$this->load->model('dispute_model');
$this->load->model('order_model');
$this->load->model('order_notes_model');
if (isset($args['id']))
{
// get order_id and user_id
$order_data = $this->order_model->get_by_field('stripe_charge_id', $args['charge']);
// if (!empty($order_data))
// {
$payload = [
'order_id' => $order_data->id ?? 0,
'user_id' => $order_data->user_id ?? 0,
'amount' => $args['amount'] ?? "",
'reason' => $args['reason'] ?? "",
'explanation' => $args['explanation'] ?? "",
'stripe_charge_id' => $args['charge'] ?? "",
'stripe_dispute_id' => $args['id'] ?? "",
'status' => $args['status'] ?? ""
];
$result = $this->dispute_model->create($payload);
if ($result)
{
$order_notes_payload = [
'order_id' => $order_data->id ?? 0,
'description' => 'Dispute created.'
];
$this->order_notes_model->create($order_notes_payload);
echo json_encode(["success" => true, "message" => "dispute created succeeded captured"]);
http_response_code(200);
exit();
}
else
{
echo json_encode(["success" => false, "message" => "dispute created failed"]);
http_response_code(400);
exit();
}
}
// else
// {
// echo json_encode(["success" => false, "message" => "order data not found"]);
// http_response_code(400);
// exit();
// }
// }
echo json_encode(["success" => false, "message" => "invalid dispute received"]);
http_response_code(400);
exit();
}
/**
* Occurs when funds are reinstated to your account after a dispute is closed.
* This includes partially refunded payments.
*/
public function handle_dispute_funds_reinstated($args)
{
$this->load->model('dispute_model');
$this->load->model('order_model');
$this->load->model('order_notes_model');
if (isset($args['id']))
{
// get order_id and user_id
$order_data = $this->order_model->get_by_field('stripe_charge_id', $args['charge']);
if (!empty($order_data))
{
$dispute_data = $this->dispute_model->get_by_field('stripe_dispute_id', $args['id']);
$payload = [
'amount' => $args['amount'] ?? "",
'reason' => $args['reason'] ?? "",
'explanation' => $args['explanation'] ?? "",
'status' => $args['status']
];
$result = $this->dispute_model->edit($payload, $dispute_data->id);
if ($result)
{
$order_notes_payload = [
'order_id' => $order_data->id,
'description' => 'Dispute reinstated. Partial dispute. Amount ' . $args['amount'] / 100
];
$this->order_notes_model->create($order_notes_payload);
if (!empty($order_data))
{
$order_payload = ['status' => 6];
$this->order_model->edit($order_payload, $order_data->id);
}
echo json_encode(["success" => true, "message" => "dispute reinstate succeeded"]);
http_response_code(200);
exit();
}
else
{
echo json_encode(["success" => false, "message" => "dispute reinstate failed"]);
http_response_code(400);
exit();
}
}
else
{
echo json_encode(["success" => false, "message" => "order data not found"]);
http_response_code(400);
exit();
}
}
echo json_encode(["success" => false, "message" => "invalid dispute received"]);
http_response_code(400);
exit();
}
/**
* Occurs when funds are removed from your account due to a dispute.
*/
public function handle_dispute_funds_withdrawn($args)
{
$this->load->model('dispute_model');
$this->load->model('order_model');
$this->load->model('order_notes_model');
if (isset($args['id']))
{
// get order_id and user_id
$order_data = $this->order_model->get_by_field('stripe_charge_id', $args['charge']);
if (!empty($order_data))
{
$dispute_data = $this->dispute_model->get_by_field('stripe_dispute_id', $args['id']);
$payload = [
'amount' => $args['amount'] ?? "",
'reason' => $args['reason'] ?? "",
'explanation' => $args['explanation'] ?? "",
'status' => $args['status']
];
$result = $this->dispute_model->edit($payload, $dispute_data->id);
if ($result)
{
$order_notes_payload = [
'order_id' => $order_data->id,
'description' => 'Dispute funds_withdrawn'
];
$this->order_notes_model->create($order_notes_payload);
if (!empty($order_data))
{
$order_payload = ['status' => 6];
$this->order_model->edit($order_payload, $order_data->id);
}
echo json_encode(["success" => true, "message" => "dispute funds_withdrawn succeeded"]);
http_response_code(200);
exit();
}
else
{
echo json_encode(["success" => false, "message" => "dispute funds_withdrawn failed"]);
http_response_code(400);
exit();
}
}
else
{
echo json_encode(["success" => false, "message" => "order data not found"]);
http_response_code(400);
exit();
}
}
echo json_encode(["success" => false, "message" => "invalid dispute received"]);
http_response_code(400);
exit();
}
/**
* Occurs when the dispute is updated (usually with evidence).
*/
public function handle_dispute_updated($args)
{
$this->load->model('dispute_model');
$this->load->model('order_model');
$this->load->model('order_notes_model');
if (isset($args['id']))
{
// get order_id and user_id
$order_data = $this->order_model->get_by_field('stripe_charge_id', $args['charge']);
if (!empty($order_data))
{
$dispute_data = $this->dispute_model->get_by_field('stripe_dispute_id', $args['id']);
$payload = [
'amount' => $args['amount'] ?? "",
'reason' => $args['reason'] ?? "",
'explanation' => $args['explanation'] ?? "",
'status' => $args['status']
];
$result = $this->dispute_model->edit($payload, $dispute_data->id);
if ($result)
{
$order_notes_payload = [
'order_id' => $order_data->id,
'description' => 'Dispute dispute updated. Evidence: ' . $args['evidence'] ?? ""
];
$this->order_notes_model->create($order_notes_payload);
echo json_encode(["success" => true, "message" => "dispute update succeeded"]);
http_response_code(200);
exit();
}
else
{
echo json_encode(["success" => false, "message" => "dispute update failed"]);
http_response_code(400);
exit();
}
}
else
{
echo json_encode(["success" => false, "message" => "order data not found"]);
http_response_code(400);
exit();
}
}
echo json_encode(["success" => false, "message" => "invalid dispute received"]);
http_response_code(400);
exit();
}
/**
* Refund:
*
*/
public function handle_charge_refunded($args)
{
$this->load->model('order_model');
$this->load->model('order_notes_model');
$this->load->model('refund_model');
if (isset($args['id']))
{
// get order_id and user_id
$order_data = $this->order_model->get_by_field('stripe_charge_id', $args['id']);
$refund_params = [
'order_id' => $order_data->id ?? 0,
'user_id' => $order_data->user_id ?? 0,
'amount' => $args['amount_refunded'] ?? 0,
'reason' => $args['refunds']['data'][0]['reason'] ?? "null",
'explanation' => $args['refunds']['data'][0]['explanation'] ?? "",
'stripe_charge_id' => $args['id'],
'stripe_invoice_id' => $args['invoice'] ?? "",
'receipt_url' => $args['receipt_url'] ?? "",
'status' => $args['refunds']['data'][0]['status'] ?? ""
];
$result = $this->refund_model->create($refund_params);
if ($result)
{
$order_notes_payload = [
'order_id' => $order_data->id ?? 0,
'description' => 'Refund completed.'
];
$this->order_notes_model->create($order_notes_payload);
if (!empty($order_data))
{
$order_payload = ['status' => 5];
$this->order_model->edit($order_payload, $order_data->id);
}
echo json_encode(["success" => true, "message" => "refund captured"]);
http_response_code(200);
exit();
}
else
{
echo json_encode(["success" => true, "message" => "charge refund add failed on db"]);
http_response_code(400);
exit();
}
}
echo json_encode(["success" => true, "message" => "charge refunded captured"]);
http_response_code(400);
exit();
}
public function handle_refund_updated($args)
{
$this->load->model('order_model');
$this->load->model('order_notes_model');
$this->load->model('refund_model');
if (isset($args['id']))
{
// get order_id and user_id
$order_data = $this->order_model->get_by_field('stripe_charge_id', $args['id']);
$refund_data = $this->order_model->get_by_field('stripe_charge_id', $args['id']);
if ($refund_data)
{
$refund_params = [
'amount' => $args['amount_refunded'] ?? 0,
'reason' => $args['refunds']['data'][0]['reason'] ?? "null",
'explanation' => $args['refunds']['data'][0]['explanation'] ?? "",
'stripe_charge_id' => $args['id'],
'stripe_invoice_id' => $args['invoice'] ?? "",
'receipt_url' => $args['receipt_url'] ?? "",
'status' => $args['refunds']['data'][0]['status'] ?? ""
];
$result = $this->refund_model->edit($refund_params, $refund_data->id);
if ($result)
{
$order_notes_payload = [
'order_id' => $order_data->id ?? 0,
'description' => 'Refund updated.'
];
$this->order_notes_model->create($order_notes_payload);
if (!empty($order_data))
{
$order_payload = ['status' => 5];
$this->order_model->edit($order_payload, $order_data->id);
}
echo json_encode(["success" => true, "message" => "refund updated"]);
http_response_code(200);
exit();
}
else
{
echo json_encode(["success" => false, "message" => "refund update failed"]);
http_response_code(400);
exit();
}
}
else
{
echo json_encode(["success" => false, "message" => "refund update failed. data not found on db."]);
http_response_code(400);
exit();
}
}
echo json_encode(["success" => false, "message" => "refund update capture failed"]);
http_response_code(400);
exit();
}
/**
* handle stripe ach events
* @see https://stripe.com/docs/api/events/types
*/
public function stripe_events()
{
$endpoint_secret = $this->config->item('stripe_endpoint_secret');
$stripe_secret_key = $this->config->item('stripe_secret_key');
Stripe::setApiKey($stripe_secret_key);
$payload = @file_get_contents('php://input');
$sig_header = $_SERVER['HTTP_STRIPE_SIGNATURE'];
$event = null;
try {
$event = Webhook::constructEvent(
$payload, $sig_header, $endpoint_secret
);
}
catch (\UnexpectedValueException $e)
{
// Invalid payload
http_response_code(400);
exit();
}
catch (\Stripe\Exception\SignatureVerificationException $e)
{
// Invalid signature
http_response_code(400);
exit();
}
// Handle the event
switch ($event->type)
{
case 'invoice.paid':
$payment_intent = $event->data->object;
// write your stripe webhook code here
// contains a StripePaymentIntent
// $this->handle_invoice_paid_method($payment_intent);
break;
default:
echo 'Received unknown event type ' . $event->type;
}
http_response_code(200);
}
}
@@ -0,0 +1,33 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Cronjob_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Backup Code Cronjob Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Backup_code_cronjob_controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index ()
{
$date = date('Y-m-d');
$this->project_backup($date);
// $this->send_backup($date);
}
private function project_backup($date)
{
$this->load->library('zip');
$this->zip->read_dir(FCPATH, FALSE);
$this->zip->archive("project_backup_{$date}.zip");
}
}
@@ -0,0 +1,34 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Cronjob_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Backup Database Cronjob Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Backup_db_cronjob_controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index ()
{
$date = date('Y-m-d');
$this->database_backup($date);
// $this->send_backup($date);
}
private function database_backup($date)
{
$this->load->helper('file');
$this->load->dbutil();
@$backup = $this->dbutil->backup();
write_file("database_backup_{$date}.zip", $backup);
}
}
+103
View File
@@ -0,0 +1,103 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Cronjob Abstract Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Cronjob_controller extends CI_Controller
{
/**
* Debug Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dl($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : <pre>' . print_r($data, TRUE) . '</pre>');
}
}
/**
* Debug json Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dj($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : ' . json_encode($data));
}
}
/**
* Function to send Emails given slug, payload and email
*
* @param string $slug
* @param mixed $payload
* @param string $email
* @return void
*/
protected function _send_email_notification($slug, $payload, $email)
{
$this->load->model('email_model');
$this->load->library('mail_service');
$this->mail_service->set_adapter('smtp');
$email_template = $this->email_model->get_template($slug, $payload);
if ($email_template)
{
$from = $this->config->item('from_email');
return $this->mail_service->send($from, $email, $email_template->subject, $email_template->html);
}
return FALSE;
}
/**
* Function to send Sms given slug, payload and phone #
*
* @param string $slug
* @param mixed $payload
* @param string $to
* @return void
*/
protected function _send_sms_notification($slug, $payload, $to)
{
$this->load->model('sms_model');
$this->load->library('sms_service');
$this->sms_service->set_adapter('sms');
$sms_template = $this->sms_model->get_template($slug, $payload);
if ($sms_template)
{
return $this->sms_service->send($to, $sms_template->content);
}
return FALSE;
}
/**
* Function to send Push notification
*
* @param string $slug
* @param mixed $payload
* @param string $to
* @return void
*/
protected function _send_push_notification($device_type, $device_id, $title, $message, $image)
{
$this->load->library('push_notification_service');
$this->push_notification_service->init();
return $this->push_notification_service->send($device_type, $device_id, $title, $message, $image);
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Abstract Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Migration_cron_controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->library('migration');
if ($this->migration->current() === FALSE)
{
print_r($this->migration->error_string());
} else {
echo 'Complete';
exit;
}
}
}
+27
View File
@@ -0,0 +1,27 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Cronjob_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Token Cronjob Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Token_cronjob_controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index ()
{
$this->load->database();
$this->load->model('token_model');
$reset_token_status = $this->token_model->raw_query("UPDATE `token` SET status=0 WHERE `expire_at` < NOW();");
$remove_expired_tokens = $this->token_model->raw_query("DELETE FROM `token` WHERE status=0");
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+41
View File
@@ -0,0 +1,41 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Health Check Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Custom404 extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->database();
$this->load->library('redirect_custom_service');
$this->load->model('url_redirect_model');
$this->redirect_custom_service->set_url_redirect_model( $this->url_redirect_model );
if($this->redirect_custom_service->set_url_redirect_model($this->url_redirect_model))
{
$this->redirect_custom_service->check_redirect();
}
}
public function index()
{
$this->output->set_status_header('404');
$data["heading"] = "404 Page Not Found";
$data["message"] = "The page you requested was not found ";
$this->load->view('errors/html/error_404',$data);
}
}
?>
+139
View File
@@ -0,0 +1,139 @@
<?php defined('BASEPATH') || exit('No direct script access allowed');
// include_once 'Manaknight_controller.php';
/**
* Frontend Controller to Manage all Frontend pages
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Api_controller extends Manaknight_controller
{
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('school_model');
$this->load->model('professor_model');
$this->load->model('textbook_model');
$this->load->model('classes_model');
}
// select2 customer search
public function get_schools()
{
$custom_query = '';
if( $this->input->POST('term') )
{
$custom_query = ' `name` LIKE "%'. $this->input->POST('term',true) .'%" ';
$data_list = $this->school_model->get_all_custom_where($custom_query, ['status' => 1]);
$response_list = array();
foreach($data_list as $d_key => $_data)
{
array_push($response_list, array('text' => $_data->name, 'id' => $_data->id));
}
$output['results'] = $response_list;
echo json_encode($output);
exit();
}
}
// select2 customer search
public function get_professors()
{
$custom_query = '';
if( $this->input->get('term') )
{
$custom_query = ' `name` LIKE "%'. $this->input->get('term',true) .'%" ';
$data_list = $this->professor_model->get_all_custom_where($custom_query, ['status' => 1]);
$response_list = array();
foreach($data_list as $d_key => $_data)
{
array_push($response_list, array('text' => $_data->name, 'id' => $_data->id));
}
$output['results'] = $response_list;
echo json_encode($output);
exit();
}
}
// select2 customer search
public function get_courses()
{
$custom_query = '';
if( $this->input->get('term') )
{
$custom_query = ' `name` LIKE "%'. $this->input->get('term',true) .'%" ';
$data_list = $this->classes_model->get_all_custom_where($custom_query, ['status' => 1]);
$response_list = array();
foreach($data_list as $d_key => $_data)
{
array_push($response_list, array('text' => $_data->name, 'id' => $_data->id));
}
$output['results'] = $response_list;
echo json_encode($output);
exit();
}
}
// select2 customer search
public function get_textbooks()
{
if( $this->input->get('term') )
{
$custom_query = ' `isbn` LIKE "%'. $this->input->get('term',true) .'%" ';
$data_list = $this->db->select('distinct(isbn)')->from('inventory')->where($custom_query)->get()->result_array();
$response_list = array();
foreach($data_list as $d_key => $_data)
{
array_push($response_list, array('text' => $_data['isbn'], 'id' => $_data['isbn']));
}
$output['results'] = $response_list;
echo json_encode($output);
exit();
}
}
// select2 customer search
public function update_old_orders_if_refunded()
{
$this->load->model('order_model');
$this->load->model('payout_model');
$all_order = $this->order_model->get_all(['status' => 2]);
foreach($all_order as $_key => $_value)
{
$this->payout_model->update('payout',[ 'status'=> 3 ],['order_id' => $_value->id ] );
}
}
}
?>
+221
View File
@@ -0,0 +1,221 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
include_once __DIR__ . '/../../middlewares/Auth_middleware.php';
include_once __DIR__ . '/../../middlewares/Acl_middleware.php';
include_once __DIR__ . '/../../middlewares/Maintenance_middleware.php';
include_once __DIR__ . '/../../middlewares/Affilate_middleware.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Guest Abstract Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Guest_controller extends CI_Controller
{
public $_data = [
'error' => '',
'success' => ''
];
//testMode flag
protected $_test_mode = FALSE;
public function __construct()
{
parent::__construct();
$this->config->load('setting');
$this->_setting = $this->config->item('setting');
$this->_run_middlewares();
}
protected function _middleware()
{
return [
'affilate',
'maintenance'
];
}
/**
* Debug Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dl($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : <pre>' . print_r($data, TRUE) . '</pre>');
}
}
/**
* Debug json Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dj($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : ' . json_encode($data));
}
}
public function get_session()
{
if (!$this->_test_mode)
{
return $_SESSION;
}
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
return $session;
}
public function set_session($field, $value)
{
if (!$this->_test_mode)
{
$_SESSION[$field] = $value;
}
else
{
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
$session[$field] = $value;
$this->config->set_item('session_test', $session);
}
}
public function destroy_session()
{
if (!$this->_test_mode)
{
unset($_SESSION);
}
else
{
$this->config->set_item('session_test', []);
}
}
/**
* Function to send Emails given slug, payload and email
*
* @param string $slug
* @param mixed $payload
* @param string $email
* @return void
*/
protected function _send_email_notification($slug, $payload, $email)
{
$this->load->model('email_model');
$this->load->library('mail_service');
$this->mail_service->set_adapter('smtp');
$email_template = $this->email_model->get_template($slug, $payload);
if ($email_template)
{
$from = $this->config->item('from_email');
return $this->mail_service->send($from, $email, $email_template->subject, $email_template->html);
}
return FALSE;
}
/**
* Function to send Sms given slug, payload and phone #
*
* @param string $slug
* @param mixed $payload
* @param string $to
* @return void
*/
protected function _send_sms_notification($slug, $payload, $to)
{
$this->load->model('sms_model');
$this->load->library('sms_service');
$this->sms_service->set_adapter('sms');
$sms_template = $this->sms_model->get_template($slug, $payload);
if ($sms_template)
{
return $this->sms_service->send($to, $sms_template->content);
}
return FALSE;
}
/**
* Function to send Push notification
*
* @param string $slug
* @param mixed $payload
* @param string $to
* @return void
*/
protected function _send_push_notification($device_type, $device_id, $title, $message, $image)
{
$this->load->library('push_notification_service');
$this->push_notification_service->init();
return $this->push_notification_service->send($device_type, $device_id, $title, $message, $image);
}
protected function _run_middlewares ()
{
$middlewares = [
'affilate' => new Affilate_middleware($this, $this->config),
'auth' => new Auth_middleware($this, $this->config),
'acl' => new Acl_middleware($this, $this->config),
'maintenance' => new Maintenance_middleware($this, $this->config)
];
foreach ($this->_middleware() as $middleware_key)
{
if (isset($middlewares[$middleware_key]))
{
$result = $middlewares[$middleware_key]->run();
if (!$result)
{
return FALSE;
}
}
}
}
public function get_setting()
{
return $this->_setting;
}
/**
* Redirect to URL
*
* @param string $template
* @param array $data
*/
public function redirect($url, $option = [])
{
return ($option) ? redirect($url, $option) : redirect($url);
}
}
+591
View File
@@ -0,0 +1,591 @@
<?php defined('BASEPATH') || exit('No direct script access allowed');
// include_once 'Manaknight_controller.php';
/**
* Frontend Controller to Manage all Frontend pages
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Home_controller extends Manaknight_controller
{
public $_data = [
'error' => '',
'success' => ''
];
protected $_flash_error = [
'error' => '',
'success' => ''
];
public function __construct()
{
parent::__construct();
$this->load->database();
// load services
$this->load->library('helpers_service');
$this->load->library('stripe_helper_service');
// $this->load->library('stevesie_api_helper_service');
// $this->load->library('sale_detail_api_service');
$this->load->model('school_model');
$this->load->model('content_model');
$this->load->model('professor_model');
$this->load->model('textbook_model');
$this->load->model('classes_model');
$this->load->model('inventory_model');
// $this->load->library('helpers_service');
$this->_data['layout_clean_mode'] = FALSE;
/**
* social links
*/
$facebook_link = '#';
$twitter_link = '#';
$instagram_link = '#';
$this->_data['facebook_link'] = $facebook_link;
$this->_data['twitter_link'] = $twitter_link;
$this->_data['instagram_link'] = $instagram_link;
}
public function index($offset = 0)
{
$content = $this->content_model->get_all(['status'=>1]);
$this->_data['content'] = [];
if($content ){
$data = [];
foreach ($content as $key => $value) {
$data[$value->content_name]= $value;
}
$this->_data['content'] = $data;
}
$meta_data = $this->db->select('content,content_name')->from('content')->where('content_name','home_page_meta_title')
->or_where('content_name','home_page_meta_description')->get()->result_array();
if($meta_data){
$meta_data = array_column($meta_data,'content','content_name');
$this->_data['meta']['title']= $meta_data['home_page_meta_title'];
$this->_data['meta']['desc']= $meta_data['home_page_meta_description'];
}
$this->_data['active'] = 'home';
$this->_render('Guest/Home', $this->_data);
}
public function get_all_categories()
{
$data = $this->school_model->get_all(['status' => 1]);
if ($data)
{
echo json_encode($data);
exit();
}
echo json_encode(FALSE);
exit();
}
public function load_items_by_school_select()
{
$school_id = $this->input->get('school_id');
if ($school_id == 0)
{
$output = [
'error' => TRUE,
'status' => 0,
'msg' => 'all'
];
echo json_encode($output);
exit();
}
$items = $this->inventory_model->get_all(['school_id' => $school_id]);
$school_data = $this->school_model->get($school_id);
if (!empty($items))
{
$output = [
'success' => TRUE,
'status' => 200,
'data' => $items,
'school_name' => $school_data->name
];
echo json_encode($output);
exit();
}
else
{
$output = [
'error' => TRUE,
'status' => 0,
'msg' => 'No items found for: ' . $school_data->name . ' school.'
];
echo json_encode($output);
exit();
}
}
public function item_details($id)
{
$item_details = $this->inventory_model->get_item_details_fe($id);
if (!empty($item_details))
{
$this->_data['item_details'] = $item_details;
}
$school_id = $item_details->school_id;
$related_items = $this->inventory_model->get_all(['school_id' => $school_id]);
if (!empty($related_items))
{
$this->_data['related_items'] = $related_items;
}
// echo '<pre>';print_r($related_items);die();
$this->_data['active'] = 'item_details';
$this->_render('Guest/Item_details', $this->_data);
}
public function about()
{
$this->_data['active'] = 'about';
$this->_render('Guest/About', $this->_data);
}
public function contact()
{
if($this->input->post('submit_btn')){
if($this->input->post('email') && $this->input->post('message') ){
$email = htmlentities($this->input->post('email'));
// $name = htmlentities($this->input->post('name'));
$message = htmlentities($this->input->post('message'));
$regex = '/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/';
if (!preg_match($regex, $email)) {
$this->_data['status_'] = 'error';
$this->_data['status_msg'] = 'Invalid Email';
}else{
$data = array(
'name'=>'',
'email'=>$email,
'message'=>$message,
'created_at'=>date('Y-m-d')
);
$this->db->insert('contact_us',$data);
$this->load->model('email_model');
$this->load->library('mail_service');
$this->mail_service->set_adapter('smtp');
$from_email = $this->config->item('from_email');
$this->mail_service->send($from_email, $from_email, "Contact Us", $message, $email);
$this->_data['status_'] = 'success';
$this->_data['status_msg'] = 'Form submitted successfully.';
}
}else{
$this->_data['status_'] = 'error';
$this->_data['status_msg'] = 'Fill All required Fields';
}
}
$this->_data['meta'] = [
'title'=>'',
'desc'=>'',
];
$meta_data = $this->db->select('content,content_name')->from('content')->where('content_name','contact_page_meta_title')
->or_where('content_name','contact_page_meta_description')->get()->result_array();
if($meta_data){
$meta_data = array_column($meta_data,'content','content_name');
$this->_data['meta']['title']= $meta_data['contact_page_meta_title'];
$this->_data['meta']['desc']= $meta_data['contact_page_meta_description'];
}
$this->_data['active'] = 'contact';
$this->_render('Guest/Contact', $this->_data);
}
public function privacy_policy()
{
$this->_data['active'] = 'privacy_policy';
$this->_data['data'] = $this->db->select('*')->from('content')->where('content_name','privacy_policy')->get()->row_array();
$this->_render('Guest/Privacy_policy', $this->_data);
}
public function buy($offset = 0)
{
// if($this->session->userdata('user_id'))
// {
// //create setup intent used in js
// $stripe = new \Stripe\StripeClient(
// $this->config->item('stripe_secret_key')
// );
// $this->_data['clientSecret'] = $stripe->setupIntents->create([
// 'payment_method_types' => ['card'],
// ])->client_secret;
// }
$this->_data['stripe_client'] = $this->config->item('stripe_publish_key');
//get all school data
if ($this->input->get('school_id', TRUE))
{
$this->_data['school_data'] = $this->school_model->get_all(['status' => 1, 'id' => $this->input->get('school_id') ]);
}
if ($this->input->get('professor_id', TRUE))
{
$this->_data['professor_data'] = $this->professor_model->get_all(['status' => 1, 'id' => $this->input->get('professor_id') ]);
}
if ($this->input->get('class_id', TRUE))
{
$this->_data['classes_data'] = $this->classes_model->get_all(['status' => 1, 'id' => $this->input->get('class_id') ]);
}
if ($this->input->get('isbn', TRUE))
{
$this->_data['textbook_data'] = $this->db->select('distinct(isbn)')->from('inventory')->where('isbn', $this->input->get('isbn', TRUE))->get()->result_array();
}
$search_term = $this->input->get('search_term', TRUE);
$school_id = $this->input->get('school_id', TRUE);
$professor_id = $this->input->get('professor_id', TRUE);
$textbook_id = $this->input->get('textbook_id', TRUE);
$isbn = $this->input->get('isbn', TRUE);
$class_id = $this->input->get('class_id', TRUE);
$order_by = $this->input->get('order_by', TRUE);
$direction = $this->input->get('direction', TRUE);
// if($school_id || $professor_id || $textbook_id || $class_id || $search_term)
// {
// for pagination
$this->load->library('pagination');
$rows_data = $this->inventory_model->get_all_active_items_list_fe($search_term, $school_id, $professor_id, $textbook_id, $class_id,$isbn,$order_by,$direction);
$total_rows = 0;
if (!empty($rows_data))
{
$total_rows = count($rows_data);
}
$limit = 10;
// $offset = $offset * $limit ;
if ($offset != 0 OR $offset != "")
{
$offset = ($offset - 1) * $limit;
}
$this->pagination->initialize([
'reuse_query_string' => TRUE,
'base_url' => base_url().'/buy',
'total_rows' => $total_rows,
'per_page' => $limit,
'num_links' => 2,
'full_tag_open' => '<ul class="pagination pagination-lg justify-content-center">',
'full_tag_close' => '</ul>',
'attributes' => ['class' => 'page-link'],
'first_link' => FALSE,
'last_link' => FALSE,
'use_page_numbers' => TRUE,
'first_tag_open' => '<li class="page-item">',
'first_tag_close' => '</li>',
'prev_link' => '&laquo',
'prev_tag_open' => '<li class="page-item">',
'prev_tag_close' => '</li>',
'next_link' => '&raquo',
'next_tag_open' => '<li class="page-item">',
'next_tag_close' => '</li>',
'last_tag_open' => '<li class="page-item">',
'last_tag_close' => '</li>',
'cur_tag_open' => '<li class="page-item active"><a href="#" class="page-link">',
'cur_tag_close' => '<span class="sr-only">(current)</span></a></li>',
'num_tag_open' => '<li class="page-item">',
'num_tag_close' => '</li>'
]);
$items = $this->inventory_model->get_all_active_items_list_fe($search_term, $school_id, $professor_id, $textbook_id, $class_id,$isbn,$order_by,$direction, $offset, $limit);
if (!empty($items))
{
$this->_data['links'] = $this->pagination->create_links();
$this->_data['items'] = $items;
}
// }
//notes amount
$notes_amount = $this->db->select('value')->from('setting')->where('key','fixed_paper_amount')->get()->row_array();
if( $notes_amount){
$this->_data['notes_amount'] = $notes_amount['value'];
}else{
$this->_data['notes_amount'] = 50;
}
$this->_data['user_downloaded_files'] = [];
if($this->session->userdata('user_id'))
{
$this->_data['user_downloaded_files'] = $this->db->select('inventory_id')->from('order')->where('purchase_user_id',$this->session->userdata('user_id'))->get()->result_array();
if($this->_data['user_downloaded_files'] )
{
$this->_data['user_downloaded_files'] = array_column($this->_data['user_downloaded_files'],'inventory_id');
}
}
$this->_data['meta'] = [
'title' => '',
'desc' => '',
];
$meta_data = $this->db->select('content,content_name')->from('content')->where('content_name','buy_page_meta_title')->or_where('content_name','buy_page_meta_description')->get()->result_array();
if($meta_data)
{
$meta_data = array_column($meta_data,'content','content_name');
$this->_data['meta']['title'] = $meta_data['buy_page_meta_title'];
$this->_data['meta']['desc'] = $meta_data['buy_page_meta_description'];
}
$this->_data['active'] = 'buy';
$this->_render('Guest/Buy', $this->_data);
}
public function sell()
{
$content = $this->content_model->get_all(['status'=>1]);
$this->_data['content'] = [];
if($content )
{
$data = [];
foreach ($content as $key => $value) {
$data[$value->content_name]= $value;
}
$this->_data['content'] = $data;
}
// //get all school data
// $this->_data['school_data'] = $this->school_model->get_all(['status' => 1]);
// $this->_data['professor_data'] = $this->professor_model->get_all(['status' => 1]);
// $this->_data['classes_data'] = $this->classes_model->get_all(['status' => 1]);
// $this->_data['textbook_data'] = $this->textbook_model->get_all(['status' => 1]);
$data = $this->db->select('paypal_email')->from('user')->where('id',$this->session->userdata('user_id'))->get()->row_array();
if (isset($data['paypal_email']))
{
$this->_data['paypal_email'] = $data['paypal_email'];
}
$this->_data['meta'] = [
'title'=>'',
'desc'=>'',
];
$meta_data = $this->db->select('content,content_name')->from('content')->where('content_name','sell_page_meta_title')->or_where('content_name','sell_page_meta_description')->get()->result_array();
if($meta_data)
{
$meta_data = array_column($meta_data,'content','content_name');
$this->_data['meta']['title']= $meta_data['sell_page_meta_title'];
$this->_data['meta']['desc']= $meta_data['sell_page_meta_description'];
}
$this->_data['active'] = 'sell';
$this->_render('Guest/Sell', $this->_data);
}
public function checkout()
{
if(!$this->session->userdata('user_id')){
echo json_encode(['status'=>'error','message'=>'You Have to Login First']);
exit;
}
$user_id = $this->session->userdata('user_id');
// stripe_helper_service
$card_number = $this->input->post('card_number', TRUE);
$exp_month = $this->input->post('exp_month', TRUE);
$exp_year = $this->input->post('exp_year', TRUE);
$cvc = $this->input->post('cvc', TRUE);
$inv_id = $this->input->post('inv_id', TRUE);
$new_card_last4 = substr($card_number, 12);
// add card
$this->stripe_helper_service->set_config($this->config);
$response = $this->stripe_helper_service->create_stripe_token($card_number, $exp_month, $exp_year, $cvc);
if (isset($response['success']))
{
$stripe_token_id = $response['token']->id;
$this->stripe_helper_service->set_config($this->config);
$this->stripe_helper_service->set_user_model($this->user_model);
// pass token_id to assign card to user
$res_card_data = $this->stripe_helper_service->add_new_card($stripe_token_id, $user_id);
if (isset($res_card_data['success']))
{
$stripe_card_id = $res_card_data['card_data']->id;
$stripe_brand = $res_card_data['card_data']->brand;
$stripe_exp_month = $res_card_data['card_data']->exp_month;
$stripe_exp_year = $res_card_data['card_data']->exp_year;
$stripe_last4 = $res_card_data['card_data']->last4;
// store the card id with the associated user
$check_new_card = $this->user_card_model->create([
'is_default' => 0,
'user_id' => $user_id,
'stripe_card_id' => $stripe_card_id,
'brand' => $stripe_brand,
'exp_month' => $stripe_exp_month,
'exp_year' => $stripe_exp_year,
'last4' => $stripe_last4,
'cvc' => $cvc,
'status' => 1
]);
}
else
{
// when user do not have the user->stripe_id
echo json_encode(['status'=>'error','message'=>'Error']);
exit;
}
}
else
{
// when new card validation failed
echo json_encode(['status'=>'error','message'=>'Error You card is invalid']);
exit;
}
}
public function autocomplete()
{
$html = '';
if($this->input->post('keyword'))
{
$result = $this->db->query("
SELECT name FROM school WHERE name LIKE '%".htmlentities($this->input->post('keyword'))."%'
UNION ALL
SELECT name FROM classes WHERE name LIKE '%".htmlentities($this->input->post('keyword'))."%'
UNION ALL
SELECT name FROM professor WHERE name LIKE '%".htmlentities($this->input->post('keyword'))."%'
UNION ALL
SELECT name FROM textbook WHERE name LIKE '%".htmlentities($this->input->post('keyword'))."%'
UNION ALL
SELECT title as name FROM inventory WHERE title LIKE '%".htmlentities($this->input->post('keyword'))."%'
")->result_array();
if(!empty($result)) {
$html .='<ul id="country-list" style="z-index:1000;width:91%;max-height:200px;overflow-y:scroll;">';
foreach($result as $key =>$value) {
$html .= '<li onClick="selectCountry(`'.$value["name"].'`);">'.$value["name"].'</li>';
}
$html .= '</ul>';
}
}
echo json_encode(['html'=>$html]);
exit();
}
public function preview($id)
{
$this->_data['active'] = 'Preview';
$this->_data['data'] = $this->inventory_model->get_by_fields(['status'=>1,'id'=>$id]);
$this->_render('Guest/Preview', $this->_data);
}
public function terms_and_conditions()
{
// $terms = $this->terms_and_conditions_model->get(1);
// if (!empty($terms))
// {
// $this->_data['terms'] = $terms;
// }
$this->_data['data'] = $this->db->select('*')->from('content')->where('content_name','terms_conditon')->get()->row_array();
$this->_data['active'] = 'terms_and_conditions';
$this->_render('Guest/Terms_and_conditions', $this->_data);
}
protected function _render($template, $_data)
{
$this->_data['page_section'] = $template;
$this->load->view('Guest/Header', $this->_data);
$this->load->view($template, $this->_data);
$this->load->view('Guest/Footer', $this->_data);
}
public function dd()
{
$output = '';
echo "<pre>";
print_r($output);
die();
}
public function get_review(){
if( isset($_POST['id']) )
{
$data = $this->db->select('r.*,u.image,u.first_name')->from('review r')->join('user u','r.user_id=u.id')->where('inventory_id',$_POST['id'])->where('r.status',1)->order_by('r.created_at')->get()->result_array();
echo json_encode(['status'=>true,'data'=>$data]);
exit;
}
echo json_encode(['status'=>false]);
exit;
}
}
+473
View File
@@ -0,0 +1,473 @@
<?php
use Aws\S3\S3Client;
if (!defined('BASEPATH')) exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Image Abstract Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Image_controller extends CI_Controller
{
public $_data = [
'error' => '',
'success' => ''
];
//testMode flag
protected $_test_mode = FALSE;
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function index ()
{
$image_upload_type = $this->config->item('image_upload');
if ($image_upload_type == 's3')
{
return $this->s3_upload();
}
$this->load->model('image_model');
$data_uri = $this->input->post('image');
$base_url = $this->config->item('base_url');
$image_path = __DIR__ . '/../../../uploads/';
$data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data_uri));
$filename = md5(uniqid() . time()) . '.png';
file_put_contents($image_path . $filename, $data);
list($width, $height) = @getimagesize( $image_path .$filename );
$session = $this->get_session();
$user_id = isset($session['user_id']) ? $session['user_id'] : 0;
$image_id = $this->image_model->create([
'url' => '/uploads/' . $filename,
'type' => 0,
'user_id' => $user_id,
'width' => $width,
'caption' => '',
'height' => $height
]);
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode([
'id' => $image_id,
'image' => $base_url . '/uploads/' . $filename,
'width' => $width,
'height' => $height
]));
}
public function s3_upload ()
{
$s3 = new S3Client([
'version' => $this->config->item('aws_version'),
'region' => $this->config->item('aws_region'),
'endpoint' => $this->config->item('aws_endpoint'),
'use_path_style_endpoint' => true,
'credentials' => [
'key' => $this->config->item('aws_key'),
'secret' => $this->config->item('aws_secret'),
]
]);
$this->load->model('image_model');
$data_uri = $this->input->post('image');
$image_path = __DIR__ . '/../../../uploads/';
$data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data_uri));
$filename = md5(uniqid() . time()) . '.png';
file_put_contents($image_path . $filename, $data);
list($width, $height) = getimagesize( $image_path . $filename );
$session = $this->get_session();
$user_id = isset($session['user_id']) ? $session['user_id'] : 0;
try
{
$result = $s3->putObject([
'Bucket' => $this->config->item('aws_bucket'),
'Key' => $filename,
'Body' => fopen($image_path . $filename, 'r'),
'ACL' => 'public-read',
]);
$image_id = $this->image_model->create([
'url' => $result->get('ObjectURL'),
'type' => 0,
'user_id' => $user_id,
'width' => $width,
'caption' => '',
'height' => $height
]);
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode([
'id' => $image_id,
'image' => $result->get('ObjectURL'),
'width' => $width,
'height' => $height
]));
}
catch (Aws\S3\Exception\S3Exception $e)
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload to S3 Failed'
]));
}
}
public function file_upload ()
{
$file_upload_type = $this->config->item('file_upload');
$this->load->library('mime_service');
if ($file_upload_type == 's3')
{
return $this->s3_file_upload();
}
$this->load->model('image_model');
if (!(isset($_FILES) && count($_FILES) > 0 && isset($_FILES['file'])))
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload file missing'
]));
}
$file = $_FILES['file'];
$size = $file['size'];
$path = $file['tmp_name'];
$type = $file['type'];
$extension = $this->mime_service->get_extension($type);
if ($size > $this->config->item('upload_byte_size_limit'))
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload file size too big'
]));
}
$filename = md5(uniqid() . time()) . $extension;
$width = 0;
$height = 0;
$session = $this->get_session();
$user_id = isset($session['user_id']) ? $session['user_id'] : 0;
$image_path = __DIR__ . '/../../../uploads/';
if (!move_uploaded_file($path, $image_path . $filename))
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload file failed'
]));
}
$image_id = $this->image_model->create([
'url' => '/uploads/' . $filename,
'type' => 4,
'user_id' => $user_id,
'width' => $width,
'caption' => '',
'height' => $height
]);
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode([
'id' => $image_id,
'file' => '/uploads/' . $filename,
'width' => $width,
'height' => $height
]));
}
public function s3_file_upload ()
{
$this->load->model('image_model');
$this->load->library('mime_service');
$s3 = new S3Client([
'version' => $this->config->item('aws_version'),
'region' => $this->config->item('aws_region'),
'endpoint' => $this->config->item('aws_endpoint'),
'use_path_style_endpoint' => true,
'credentials' => [
'key' => $this->config->item('aws_key'),
'secret' => $this->config->item('aws_secret'),
]
]);
if (!(isset($_FILES) && count($_FILES) > 0 && isset($_FILES['file'])))
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload file failed'
]));
}
$file = $_FILES['file'];
$size = $file['size'];
$path = $file['tmp_name'];
$type = $file['type'];
$extension = $this->mime_service->get_extension($type);
if ($size > $this->config->item('upload_byte_size_limit'))
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload file size too big'
]));
}
$filename = md5(uniqid() . time()) . $extension;
$width = 0;
$height = 0;
$session = $this->get_session();
$user_id = isset($session['user_id']) ? $session['user_id'] : 0;
try
{
$result = $s3->putObject([
'Bucket' => $this->config->item('aws_bucket'),
'Key' => $filename,
'Body' => fopen($path, 'r'),
'ACL' => 'public-read',
]);
$image_id = $this->image_model->create([
'url' => $result->get('ObjectURL'),
'type' => 5,
'user_id' => $user_id,
'width' => $width,
'caption' => '',
'height' => $height
]);
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode([
'id' => $image_id,
'file' => $result->get('ObjectURL'),
'width' => $width,
'height' => $height
]));
}
catch (Aws\S3\Exception\S3Exception $e)
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload to S3 Failed'
]));
}
}
public function paginate($page)
{
$this->load->library('pagination');
$this->load->model('image_model');
include_once __DIR__ . '/../../view_models/Image_asset_paginate_view_model.php';
$where = [];
$this->_data['view_model'] = new Image_asset_paginate_view_model(
$this->image_model,
$this->pagination,
'/v1/api/assets/0');
$this->_data['view_model']->set_heading('Images');
$this->_data['view_model']->set_total_rows($this->image_model->count($where));
$this->_data['view_model']->set_per_page(10);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->image_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where));
return $this->success($this->_data['view_model']->to_json(), 200);
}
public function file_import ($model)
{
$model_name = $model . '_model';
$this->load->library('mime_service');
$this->load->library('csv_import_service');
$this->load->model($model_name);
$this->csv_import_service->set_model($this->$model_name, $model);
/* if ($this->csv_import_service->csv_file_exist($_FILES))
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload CSV File missing'
]));
}*/
$file = $_FILES['file'];
$size = $file['size'];
$path = $file['tmp_name'];
$type = $file['type'];
$extension = $this->mime_service->get_extension($type);
//$extension = ucfirst(str_replace('.', '', $this->mime_service->get_extension($type)));
$save_as = FCPATH . 'uploads/' . $file["name"];
if ($size > $this->config->item('upload_byte_size_limit'))
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload file size too big'
]));
}
$save_as = FCPATH . 'uploads/temp' . $extension;
if ($size > $this->config->item('upload_byte_size_limit'))
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload file size too big'
]));
}
if (move_uploaded_file($path, $save_as))
{
$data = $this->csv_import_service->_import_data( $save_as );
if($data)
{
unlink($save_as);
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode([
'status' => TRUE
]));
}
}
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Generating SQL worked but insert error to the database'
]));
}
public function preview_csv()
{
$this->load->library('mime_service');
$this->load->library('csv_import_service');
$file = $_FILES['file'];
$size = $file['size'];
$path = $file['tmp_name'];
$type = $file['type'];
$save_as = FCPATH . 'uploads/' . $file["name"];
if ($size > $this->config->item('upload_byte_size_limit'))
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload file size too big'
]));
}
if (move_uploaded_file($path, $save_as))
{
$data = $this->csv_import_service->_get_file_data( $save_as );
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode([
'message' => 'xyzFile loaded',
'data' => $data,
'preview' => TRUE
]));
}
}
/**
* Debug Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dl($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : <pre>' . print_r($data, TRUE) . '</pre>');
}
}
/**
* Debug json Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dj($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : ' . json_encode($data));
}
}
public function get_session()
{
if (!$this->_test_mode)
{
return $_SESSION;
}
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
return $session;
}
/**
* Success API Call
*
* @return string
*/
public function success($success)
{
$success['code'] = 200;
$success['success'] = TRUE;
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($success));
}
}
+264
View File
@@ -0,0 +1,264 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Marketing Controller
*
* @copyright 2021 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Marketing_controller extends Manaknight_Controller
{
public $_data = [
'error' => '',
'success' => ''
];
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('marketing_model');
}
/**
* Debug Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dl($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : <pre>' . print_r($data, TRUE) . '</pre>');
}
}
/**
* Debug json Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dj($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : ' . json_encode($data));
}
}
public function get_session()
{
if (!$this->_test_mode)
{
return $_SESSION;
}
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
return $session;
}
public function set_session($field, $value)
{
if (!$this->_test_mode)
{
$_SESSION[$field] = $value;
}
else
{
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
$session[$field] = $value;
$this->config->set_item('session_test', $session);
}
}
public function destroy_session()
{
if (!$this->_test_mode)
{
unset($_SESSION);
}
else
{
$this->config->set_item('session_test', []);
}
}
public function get_setting()
{
return $this->_setting;
}
/**
* Function to generate a slug
*/
public function generate_marketing_slug($str)
{
$delimiter = '-';
$slug = strtolower(trim(preg_replace('/[\s-]+/', $delimiter, preg_replace('/[^A-Za-z0-9-]+/', $delimiter, preg_replace('/[&]/', 'and', preg_replace('/[\']/', '', iconv('UTF-8', 'ASCII//TRANSLIT', $str))))), $delimiter));
$full_path = base_url() . 'a/';
$row = $this->marketing_model->get_by_field('slug', $full_path . $slug);
if (empty($row))
{
$output['slug'] = $slug;
echo json_encode($output);
exit;
}
else
{
$i = 1;
$check_me_again = TRUE;
while ($check_me_again)
{
$slug = $slug . '-' . $i;
$row = $this->marketing_model->get_by_field('slug', $full_path . $slug);
if (empty($row))
{
$check_me_again = FALSE;
}
$i++;
}
$output['slug'] = $slug;
echo json_encode($output);
exit;
}
}
/**
* Function to return the generated page
*/
public function generate_custom_marketing_page($slug)
{
$slug_url = base_url() . 'a/';
$slug = $slug_url.$slug;
$marketing_data = $this->marketing_model->get_by_field('slug',$slug);
$this->_data['header'] = '';
$this->_data['footer'] = '';
$this->_data['content_template'] = '';
$this->_data['content'] = '';
$this->_data['success'] = '';
$this->_data['error'] = '';
$this->_data['layout_clean_mode'] = TRUE;
$this->_data['reuse_query_string'] = TRUE;
$this->_data['base_url'] = base_url();
$this->_data['total_rows'] = 25;
$this->_data['per_page'] = 25;
$this->_data['num_links'] = '';
$this->_data['full_tag_open'] = '<ul class="pagination justify-content-end">';
$this->_data['full_tag_close'] = '</ul>';
$this->_data['attributes'] = ['class' => 'page-link'];
$this->_data['first_link'] = FALSE ;
$this->_data['last_link'] = FALSE;
$this->_data['first_tag_open'] = '<li class="page-item">';
$this->_data['first_tag_close'] = '</li>';
$this->_data['prev_link'] = '&laquo';
$this->_data['setting'] = $this->get_setting();
$this->_data['list'] = [];
if($marketing_data)
{
if($marketing_data->header_template_path != '')
{
$this->_data['header'] = $marketing_data->header_template_path ? $marketing_data->header_template_path : '';
}
if($marketing_data->footer_template_path != '')
{
$this->_data['footer'] = $marketing_data->footer_template_path ? $marketing_data->footer_template_path : '';
}
$this->_data['content'] = $marketing_data->content ? $marketing_data->content : '';
$this->_data['content_template'] = $marketing_data->content_template_path ? $marketing_data->content_template_path : '';
if($marketing_data->status == 0)
{
if ($marketing_data->password_protect == '')
{
return $this->generate_marketing_template($this->_data);
}
else
{
$valid_passwords = [
'guest' => $marketing_data->password_protect
];
$valid_users = array_keys($valid_passwords);
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
$validated = (in_array($user, $valid_users)) && ($pass == $valid_passwords[$user]);
if (!$validated)
{
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
die ('Not authorized');
}
return $this->generate_marketing_template($this->_data);
}
}
else
{
$this->output->set_status_header('404');
$data['heading'] = '404 Page Not Found';
$data['message'] = 'The page you requested was not found';
$this->load->view('errors/html/error_404',$data);
exit();
}
}
$this->output->set_status_header('404');
$data['heading'] = '404 Page Not Found';
$data['message'] = 'The page you requested was not found';
$this->load->view('errors/html/error_404', $data);
exit();
}
/**
* Function to generate marketing template
*/
public function generate_marketing_template($marketing_data)
{
if($marketing_data['header'] != '')
{
$this->load->view($marketing_data['header'], $marketing_data);
}
if($marketing_data['content_template'] == '')
{
echo $marketing_data['content_template'];
}
else
{
$this->load->view('Guest/Template_page', $marketing_data);
}
if($marketing_data['footer'] != '')
{
$this->load->view($marketing_data['footer'], $marketing_data);
}
}
}
+107
View File
@@ -0,0 +1,107 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Voice Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Spreadsheet_controller extends Manaknight_Controller
{
public $_data = [
'error' => '',
'success' => ''
];
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('spreadsheet_model');
}
/**
* Debug Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dl($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : <pre>' . print_r($data, TRUE) . '</pre>');
}
}
/**
* Debug json Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dj($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : ' . json_encode($data));
}
}
public function get_session()
{
if (!$this->_test_mode)
{
return $_SESSION;
}
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
return $session;
}
public function set_session($field, $value)
{
if (!$this->_test_mode)
{
$_SESSION[$field] = $value;
}
else
{
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
$session[$field] = $value;
$this->config->set_item('session_test', $session);
}
}
public function destroy_session()
{
if (!$this->_test_mode)
{
unset($_SESSION);
}
else
{
$this->config->set_item('session_test', []);
}
}
public function get_setting()
{
return $this->_setting;
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+45
View File
@@ -0,0 +1,45 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Health Check Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Health_check_controller extends CI_Controller
{
public function index ()
{
try
{
$this->load->database();
$error = get_instance()->db->error();
if (!empty($error) && $error['code'] > 0)
{
throw new Exception('Database Connection Failed');
}
return $this->output
->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode(array(
'status' => 200,
'date' => date('Y-m-j H:i:s', time())
)));
}
catch (\Exception $e)
{
return $this->output
->set_content_type('application/json')
->set_status_header(500)
->set_output(json_encode(array(
'status' => 500,
'date' => date('Y-m-j H:i:s', time())
)));
}
}
}
+228
View File
@@ -0,0 +1,228 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Cart Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_cart_controller extends Member_controller
{
protected $_model_file = 'cart_model';
public $_page_name = 'Cart';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Cart_member_list_paginate_view_model.php';
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$session = $this->get_session();
$where = [];
$this->_data['view_model'] = new Cart_member_list_paginate_view_model(
$this->cart_model,
$this->pagination,
'/member/cart/0');
$this->_data['view_model']->set_heading('Cart');
$this->_data['view_model']->set_total_rows($this->cart_model->count($where));
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/member/cart/0');
$this->_data['view_model']->set_list($this->cart_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Member/Cart', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Cart_member_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->cart_model->set_form_validation(
$this->form_validation, $this->cart_model->get_all_validation_rule());
$this->_data['view_model'] = new Cart_member_add_view_model($this->cart_model);
$this->_data['view_model']->set_heading('Cart');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Member/CartAdd', $this->_data);
}
$product_id = $this->input->post('product_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$session_id = $this->input->post('session_id', TRUE);
$subtotal = $this->input->post('subtotal', TRUE);
$quantity = $this->input->post('quantity', TRUE);
$total = $this->input->post('total', TRUE);
$result = $this->cart_model->create([
'product_id' => $product_id,
'user_id' => $user_id,
'session_id' => $session_id,
'subtotal' => $subtotal,
'quantity' => $quantity,
'total' => $total,
]);
if ($result)
{
return $this->redirect('/member/cart/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Member/CartAdd', $this->_data);
}
public function edit($id)
{
$model = $this->cart_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/member/cart/0');
}
include_once __DIR__ . '/../../view_models/Cart_member_edit_view_model.php';
$this->form_validation = $this->cart_model->set_form_validation(
$this->form_validation, $this->cart_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Cart_member_edit_view_model($this->cart_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Cart');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Member/CartEdit', $this->_data);
}
$product_id = $this->input->post('product_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$session_id = $this->input->post('session_id', TRUE);
$subtotal = $this->input->post('subtotal', TRUE);
$quantity = $this->input->post('quantity', TRUE);
$total = $this->input->post('total', TRUE);
$result = $this->cart_model->edit([
'product_id' => $product_id,
'user_id' => $user_id,
'session_id' => $session_id,
'subtotal' => $subtotal,
'quantity' => $quantity,
'total' => $total,
], $id);
if ($result)
{
return $this->redirect('/member/cart/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Member/CartEdit', $this->_data);
}
public function view($id)
{
$model = $this->cart_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/member/cart/0');
}
include_once __DIR__ . '/../../view_models/Cart_member_view_view_model.php';
$this->_data['view_model'] = new Cart_member_view_view_model($this->cart_model);
$this->_data['view_model']->set_heading('Cart');
$this->_data['view_model']->set_model($model);
return $this->render('Member/CartView', $this->_data);
}
public function delete($id)
{
$model = $this->cart_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/member/cart/0');
}
$result = $this->cart_model->delete($id);
if ($result)
{
return $this->redirect('/member/cart/0', 'refresh');
}
$this->error('Error');
return redirect('/member/cart/0');
}
}
+150
View File
@@ -0,0 +1,150 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Member Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_controller extends Manaknight_Controller
{
public $_page_name ='dashboard';
public $_valid_roles = [1];
public function __construct()
{
parent::__construct();
$this->_data['page_name'] = $this->_page_name;
$this->_data['setting'] = $this->_setting;
$this->_data['layout_clean_mode'] = FALSE;
$this->_run_middlewares();
$layout_mode = $this->input->get('layout_clean_mode', TRUE);
if (isset($layout_mode) && $layout_mode === '1')
{
$this->_data['layout_clean_mode'] = TRUE;
}
}
protected function _middleware()
{
return [
'affilate', 'auth', 'acl', 'maintenance'
];
}
public function render($template, $data)
{
return (!$this->_test_mode) ? $this->_render($template, $data) : $this->_render_test($template, $data);
}
protected function _render_test($template, $data)
{
return [
'header' => $this->load->view('Layout/MemberHeader', $data, TRUE),
'body' => $this->load->view($template, $data, TRUE),
'footer' => $this->load->view('Layout/MemberFooter', $data, TRUE),
'data' => $data,
];
}
/**
* Function to return the images for media gallery
*/
public function get_all_images()
{
$this->load->model('image_model');
$images = $this->image_model->get_all();
return $images;
}
protected function _render($template, $data)
{
$data['images'] = $this->get_all_images();
$data['page_section'] = $template;
$this->load->view('Layout/MemberHeader', $data);
$this->load->view($template, $data);
$this->load->view('Layout/MemberFooter',$data);
}
/**
* User token invalid
*
* @return string
*/
public function unauthorize_error_message()
{
return $this->output->set_content_type('application/json')
->set_status_header(401)
->set_output(json_encode([
'code' => 401,
'success' => FALSE,
'message' => 'invalid credentials'
]));
}
/**
* User Role invalid
*
* @return string
*/
public function unauthorize_resource_error_message()
{
return $this->output->set_content_type('application/json')
->set_status_header(406)
->set_output(json_encode([
'code' => 406,
'success' => FALSE,
'message' => 'cannot access resource'
]));
}
/**
* Success API Call
*
* @return string
*/
public function success2($success)
{
$success['code'] = 200;
$success['success'] = TRUE;
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($success));
}
/**
* Invalid form input
*
* @return string
*/
protected function _render_validation_error ()
{
$data = [];
$data['code'] = 403;
$data['success'] = FALSE;
$data['error'] = $this->form_validation->error_array();
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode($data));
}
/**
* Render Custom Error
*
* @return string
*/
protected function _render_custom_error ($errors)
{
$data = [];
$data['code'] = 403;
$data['success'] = FALSE;
$data['error'] = $errors;
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode($data));
}
}
@@ -0,0 +1,25 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Member_controller.php';
/**
* Member Dashboard Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_dashboard_controller extends Member_controller
{
public $_page_name = 'Dashboard';
public function __construct()
{
parent::__construct();
}
public function index ()
{
return $this->render('Member/Dashboard', $this->_data);
}
}
@@ -0,0 +1,136 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Dispute Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_dispute_controller extends Member_controller
{
protected $_model_file = 'dispute_model';
public $_page_name = 'Dispute';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Dispute_member_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Dispute_member_list_paginate_view_model(
$this->dispute_model,
$this->pagination,
'/member/dispute/0');
$this->_data['view_model']->set_heading('Dispute');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_order_id(($this->input->get('order_id', TRUE) != NULL) ? $this->input->get('order_id', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_reason(($this->input->get('reason', TRUE) != NULL) ? $this->input->get('reason', TRUE) : NULL);
$this->_data['view_model']->set_stripe_charge_id(($this->input->get('stripe_charge_id', TRUE) != NULL) ? $this->input->get('stripe_charge_id', TRUE) : NULL);
$this->_data['view_model']->set_stripe_dispute_id(($this->input->get('stripe_dispute_id', TRUE) != NULL) ? $this->input->get('stripe_dispute_id', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'order_id' => $this->_data['view_model']->get_order_id(),
'user_id' => $this->_data['view_model']->get_user_id(),
'reason' => $this->_data['view_model']->get_reason(),
'stripe_charge_id' => $this->_data['view_model']->get_stripe_charge_id(),
'stripe_dispute_id' => $this->_data['view_model']->get_stripe_dispute_id(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->dispute_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/member/dispute/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->dispute_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Member/Dispute', $this->_data);
}
public function view($id)
{
$model = $this->dispute_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/member/dispute/0');
}
include_once __DIR__ . '/../../view_models/Dispute_member_view_view_model.php';
$this->_data['view_model'] = new Dispute_member_view_view_model($this->dispute_model);
$this->_data['view_model']->set_heading('Dispute');
$this->_data['view_model']->set_model($model);
return $this->render('Member/DisputeView', $this->_data);
}
}
@@ -0,0 +1,53 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once __DIR__ . '/../../services/User_service.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Forgot Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_forgot_controller extends Manaknight_Controller
{
public function index ()
{
$this->load->model('user_model');
$this->load->model('credential_model');
$this->load->model('email_model');
$this->load->model('token_model');
$this->load->library('mail_service');
$service = new User_service($this->credential_model);
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
if ($this->form_validation->run() === FALSE)
{
echo $this->load->view('Member/Forgot', $this->_data, TRUE);
exit;
}
$email = $this->input->post('email');
$from_email = $this->config->item('from_email');
$base_url = $this->config->item('base_url');
$this->mail_service->set_adapter('smtp');
$service->set_email_model($this->email_model);
$service->set_token_model($this->token_model);
$service->set_email_service($this->mail_service);
$reset = $service->forgot_password($email, $from_email, $base_url . '/member/reset', 1);
if ($reset)
{
$this->success('Your Reset email was sent. Check your email.');
return $this->redirect('/member/login');
}
$this->_data['error'] = 'Email does not exist in our system.';
echo $this->load->view('Member/Forgot', $this->_data, TRUE);
exit;
}
}
File diff suppressed because it is too large Load Diff
+145
View File
@@ -0,0 +1,145 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once __DIR__ . '/../../services/User_service.php';
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Login Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_login_controller extends Manaknight_Controller
{
protected $_redirect = '/sell';
public $_valid_roles = [1];
public function __construct()
{
parent::__construct();
}
public function index ()
{
$this->load->model('credential_model');
$this->load->model('user_model');
$this->load->helper('cookie');
$service = new User_service($this->credential_model, $this->user_model);
if($this->input->cookie('member_remember_me_token', TRUE) !== null && $this->input->cookie('member_remember_me_token', TRUE) !== '')
{
$this->_remember_me_login();
exit();
}
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required');
$this->_data['portal'] = 'member';
if ($this->form_validation->run() === FALSE)
{
echo $this->load->view('Member/Login', $this->_data, TRUE);
exit;
}
$email = $this->input->post('email');
$password = $this->input->post('password');
$redirect = $service->get_redirect($this->input->cookie('redirect', TRUE), $this->_redirect);
$role = $this->_valid_roles[0];
$authenticated_user = $service->login_by_role($email, $password, $role);
if ($authenticated_user)
{
delete_cookie('redirect');
$user_id = $authenticated_user->user_id;
if(!empty($this->input->post("remember_me"))) {
$this->load->helper('string');
$remember_cookie = [
'user_id' => $user_id,
'name' => 'member_remember_me_token',
'value' => random_string('alnum', 16),
'expire' => time()+$this->config->item('cookie_expire'),
'domain' => base_url()
];
$this->load->model('cookies_model');
$check_cookie = $this->cookies_model->get_by_field('user_id', $user_id);
if($check_cookie)
{
$cookie = $this->cookies_model->edit($remember_cookie, $check_cookie->id);
}
else
{
$cookie = $this->cookies_model->create($remember_cookie);
}
if($cookie)
{
setcookie($remember_cookie['name'], $remember_cookie['value'], $remember_cookie['expire'], $remember_cookie['domain']);
}
}
$this->set_session('credential_id', (int) $authenticated_user->id);
$this->set_session('user_id', (int) $user_id);
$this->set_session('email', (string) $authenticated_user->email);
$this->set_session('role', (string) $authenticated_user->role_id);
if( isset($_POST['return_url']) && $_POST['return_url'] =='buy')
{
return $this->redirect('buy');
}
return $this->redirect($redirect);
}
$this->error('Wrong email or password.');
return $this->redirect('member/login');
}
public function _remember_me_login()
{
$this->load->helper('string');
$this->load->model('user_model');
$this->load->model('credential_model');
$this->load->model('cookies_model');
$token_value = $this->input->cookie('member_remember_me_token', TRUE);
$cookie = $this->cookies_model->get_by_fields(['value' => $token_value]);
$service = new User_service($this->credential_model, $this->user_model);
$redirect = $service->get_redirect($this->input->cookie('redirect', TRUE), $this->_redirect);
if($cookie)
{
$user_id = $cookie->user_id;
$credential = $this->credential_model->get_by_field('user_id', $user_id);
$role = $this->_valid_roles[0];
if($credential->role_id != $role)
{
setcookie('member_remember_me_token', '', 1, base_url());
return $this->redirect('admin/login');
}
$random_string = random_string('alnum', 30);
$this->cookies_model->edit(['value' => $random_string, 'expire' => time()+$this->config->item('cookie_expire')], $cookie->id);
setcookie('member_remember_me_token', $random_string, time()+$this->config->item('cookie_expire'), base_url());
$this->set_session('credential_id', (int) $credential->id);
$this->set_session('user_id', (int) $user_id);
$this->set_session('email', (string) $credential->email);
$this->set_session('role', (string) $credential->role_id);
return $this->redirect($redirect);
}
else
{
setcookie('member_remember_me_token', '', 1, base_url());
return $this->redirect('admin/login');
}
$this->error('Wrong email or password.');
return $this->redirect('member/login');
}
public function logout ()
{
$this->load->helper('cookie');
setcookie('member_remember_me_token', '', 1, base_url());
$this->destroy_session();
return $this->redirect('member/login');
}
}
+60
View File
@@ -0,0 +1,60 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Credential Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_me_controller extends Member_controller
{
protected $_model_file = 'credential_model';
public $_page_name = 'Change Password';
public function __construct()
{
parent::__construct();
}
public function me()
{
$session = $this->get_session();
$model = $this->credential_model->get($session['credential_id']);
$this->_data['email'] = $model->email;
$this->_data['password'] = '';
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('password', 'Password', '');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Member/Mes', $this->_data);
}
$email = $this->input->post('email');
$password = $this->input->post('password');
$payload = [
'email' => $email,
];
if (strlen($password) > 1)
{
$payload['password'] = str_replace('$2y$', '$2b$', password_hash($password, PASSWORD_BCRYPT));
}
$result = $this->credential_model->edit($payload, $session['credential_id']);
if ($result)
{
$this->success('Saved');
return $this->redirect('/member/me', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Member/Mes', $this->_data);
}
}
@@ -0,0 +1,121 @@
<?php defined('BASEPATH') || exit('No direct script access allowed');
include_once 'Member_controller.php';
/**
* Member Profile Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_profile_controller extends Member_controller
{
protected $_model_file = 'user_model';
public $_page_name = 'Profile';
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->model('credential_model');
$this->load->model('member_profile_model');
$this->load->model('school_model');
$session = $this->get_session();
$model = $this->user_model->get($session['user_id']);
$id = $session['user_id'];
// load data
$schools = $this->school_model->get_all();
if (!empty($schools))
{
$this->_data['schools'] = $schools;
}
if (!$model)
{
$this->error('Error');
return redirect('/member/dashboard');
}
$credential = $this->credential_model->get($session['credential_id']);
$email_validation_rules = 'required|valid_email';
include_once __DIR__ . '/../../view_models/Member_profile_view_model.php';
if ($this->input->post('email') != $credential->email)
{
$email_validation_rules .= '|is_unique[credential.email]';
}
$member_profile_data = $this->db->select('*')->from('member_profile')->where('user_id',$id)->get()->row_array();
$user_data = $this->db->select('*')->from('user')->where('id',$id)->get()->row_array();
$this->_data['phone'] = $user_data['phone'];
$this->_data['username'] = $member_profile_data['username'];
$this->_data['school_id'] = $member_profile_data['school_id'];
$this->form_validation->set_rules('email', 'Email', $email_validation_rules);
$this->form_validation->set_rules('first_name', 'First Name', 'required');
$this->form_validation->set_rules('last_name', 'Last Name', 'required');
$this->_data['view_model'] = new Member_profile_view_model($this->user_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_email($credential->email);
$this->_data['view_model']->set_heading('Member');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Member/Profile', $this->_data);
}
$first_name = $this->input->post('first_name');
$last_name = $this->input->post('last_name');
$email = $this->input->post('email');
$password = $this->input->post('password');
// $username = $this->input->post('username');
$school_id = $this->input->post('school_id');
$payload = [
'first_name' => $first_name,
'last_name' => $last_name
];
$payload_2 = [
// 'username' => $username,
'school_id' => $school_id
];
$result = $this->user_model->edit_raw($payload, $id);
if ($result)
{
$this->db->set($payload_2)->where('id',$member_profile_data['id'])->update('member_profile');
$this->db->set(['phone'=>$this->input->post('phone')])->where('id',$id)->update('user');
$credential_payload = [
'email' => $email
];
if (strlen($password) > 0)
{
$credential_payload['password'] = str_replace('$2y$', '$2b$', password_hash($password, PASSWORD_BCRYPT));
}
$result = $this->credential_model->edit_raw($credential_payload, $session['credential_id']);
$this->success('Saved');
return $this->redirect('/member/profile', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Member/Profile', $this->_data);
}
}
@@ -0,0 +1,79 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Member_controller.php';
/**
* Member Profile Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_profile_credential_controller extends Member_controller
{
protected $_model_file = 'credential_model';
public $_page_name = 'Credentials';
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->model('user_model');
$session = $this->get_session();
$user_obj = $this->user_model->get($session['user_id']);
$session = $this->get_session();
$this->load->model($this->_model_file);
$model = $this->credential_model->get($user_obj->credential_id ?? 0);
$id = $user_obj->credential_id ?? 0;
if (!$model)
{
die();
}
include_once __DIR__ . '/../../view_models/Member_profile_credential_view_model.php';
$email_validation_rules = 'required|valid_email';
if ($this->input->post('email') != $session['email'])
{
$email_validation_rules .= '|is_unique[credential.email]';
}
$this->form_validation->set_rules('email', 'Email', $email_validation_rules);
$this->_data['view_model'] = new Member_profile_credential_view_model($model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Member');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Member/Credential', $this->_data);
}
$email = $this->input->post('email');
$password = $this->input->post('password');
$payload = [
'email' => $email,
];
if (strlen($password) > 0)
{
$payload['password'] = str_replace('$2y$', '$2b$', password_hash($password, PASSWORD_BCRYPT));
}
$result = $this->credential_model->edit_raw($payload, $id);
if ($result)
{
$this->success('Saved');
return $this->redirect('/member/credential?layout_clean_mode=1', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Member/Credential', $this->_data);
}
}
@@ -0,0 +1,277 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Purchases Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_purchases_controller extends Member_controller
{
protected $_model_file = 'order_model';
public $_page_name = 'Purchases';
public function __construct()
{
parent::__construct();
$this->load->model('school_model');
$this->load->model('professor_model');
$this->load->model('classes_model');
$this->load->model('textbook_model');
$this->load->model('inventory_model');
$this->load->library('helpers_service');
$this->load->library('names_helper_service');
}
public function index($page)
{
// load data
$schools = $this->school_model->get_all(['status' => 1]);
$professors = $this->professor_model->get_all(['status' => 1]);
if (!empty($schools))
{
$this->_data['schools'] = $schools;
}
if (!empty($professors))
{
$this->_data['professors'] = $professors;
}
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Purchases_member_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Purchases_member_list_paginate_view_model(
$this->order_model,
$this->pagination,
'/member/purchases/0');
$this->_data['view_model']->set_heading('Purchases');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_purchase_user_id(($this->input->get('purchase_user_id', TRUE) != NULL) ? $this->input->get('purchase_user_id', TRUE) : NULL);
$this->_data['view_model']->set_sale_user_id(($this->input->get('sale_user_id', TRUE) != NULL) ? $this->input->get('sale_user_id', TRUE) : NULL);
$this->_data['view_model']->set_inventory_id(($this->input->get('inventory_id', TRUE) != NULL) ? $this->input->get('inventory_id', TRUE) : NULL);
$this->_data['view_model']->set_order_date(($this->input->get('order_date', TRUE) != NULL) ? $this->input->get('order_date', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = ['purchase_user_id' => $this->session->userdata('user_id')];
if (!empty($_GET['school_id']))
{
$inventory = $this->inventory_model->get_all(['school_id' => $_GET['school_id']]);
if ($inventory)
{
$where[] = "inventory_id in (" . implode(',',array_column($inventory,'id')) . " ) ";
}
else
{
$where[] = "inventory_id = 0";
}
}
if (!empty($_GET['professor_id']))
{
$inventory = $this->inventory_model->get_all(['professor_id' => $_GET['professor_id']]);
if ($inventory)
{
$where[] = "inventory_id in (" . implode(',',array_column($inventory,'id')) . " ) ";
}
else
{
$where[] = "inventory_id = 0";
}
}
if (!empty($_GET['year']))
{
$inventory = $this->inventory_model->get_all(['year' => $_GET['year']]);
if ($inventory)
{
$where[] = "inventory_id in (" . implode(',',array_column($inventory,'id')) . " ) ";
}
else
{
$where[] = "inventory_id = 0";
}
}
if ($this->_data['view_model']->get_id())
{
$where[] = "id = " . $this->_data['view_model']->get_id();
}
if ($this->_data['view_model']->get_inventory_id())
{
$where[] = "inventory_id = " . $this->_data['view_model']->get_inventory_id();
}
if ($this->_data['view_model']->get_order_date())
{
$where[] = "order_date = " . $this->_data['view_model']->get_order_date();
}
if ($this->_data['view_model']->get_status() || $this->_data['view_model']->get_status() == '0')
{
$where[] = "status = " . $this->_data['view_model']->get_status();
}
// $where = [
// 'id' => $this->_data['view_model']->get_id(),
// 'purchase_user_id' => $this->_data['view_model']->get_purchase_user_id(),
// 'sale_user_id' => $this->_data['view_model']->get_sale_user_id(),
// 'inventory_id' => $this->_data['view_model']->get_inventory_id(),
// 'order_date' => $this->_data['view_model']->get_order_date(),
// 'status' => $this->_data['view_model']->get_status(),
// ];
$this->_data['view_model']->set_total_rows($this->order_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/member/purchases/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->order_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if( $this->_data['view_model']->get_list())
{
$invetory_ids = array_column($this->_data['view_model']->get_list(),'inventory_id');
if($invetory_ids)
{
$inventory_data = $this->db->select('i.*,s.name as school,p.name as professor')->from('inventory i')->join('school s','s.id=i.school_id')->join('professor p','p.id=i.professor_id')->where_in('i.id',$invetory_ids,true)->get()->result_array();
$review_given = $this->db->select('*')->from('review')->where('user_id',$this->session->userdata('user_id'))->get()->result_array();
if($review_given)
{
$review_given = array_column($review_given,'inventory_id');
}
$dispute_given = $this->db->select('*')->from('ticket')->where('user_id',$this->session->userdata('user_id'))->get()->result_array();
if($dispute_given){
$dispute_given = array_column($dispute_given,'order_id');
}
foreach ($this->_data['view_model']->get_list() as $data)
{
$data->review_given = 0;
if(in_array($data->inventory_id,$review_given))
{
$data->review_given = 1;
}
$data->dispute_given = 0;
if(in_array($data->id,$dispute_given))
{
$data->dispute_given = 1;
}
foreach ($inventory_data as $key => $value)
{
if($data->inventory_id == $value['id'])
{
$data->school = $value['school'];
$data->year = $value['year'];
$data->file_src = base_url().$value['file'];
$data->professor = $value['professor'];
$data->word_count = $value['word_count'];
}
}
if (!isset($data->school))
{
$data->school = "";
$data->year = "";
$data->file_src = "";
$data->professor = "";
$data->word_count = "";
}
}
}
}
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Member/Purchases', $this->_data);
}
public function view($id)
{
$model = $this->order_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/member/purchases/0');
}
include_once __DIR__ . '/../../view_models/Purchases_member_view_view_model.php';
$this->_data['view_model'] = new Purchases_member_view_view_model($this->order_model);
$this->_data['view_model']->set_heading('Purchases');
$this->_data['view_model']->set_model($model);
return $this->render('Member/PurchasesView', $this->_data);
}
}
@@ -0,0 +1,106 @@
<?php defined('BASEPATH') || exit('No direct script access allowed');
include_once __DIR__ . '/../../services/User_service.php';
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Register Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_register_controller extends Manaknight_Controller
{
protected $_redirect = '/sell';
public $_valid_roles = [1];
public function __construct()
{
parent::__construct();
$this->_run_middlewares();
}
protected function _middleware()
{
return [
'affilate',
'maintenance'
];
}
public function index()
{
$this->load->model('user_model');
$this->load->model('refer_log_model');
$this->load->helper('cookie');
$this->load->model('credential_model');
$this->load->model('member_profile_model');
$service = new User_service($this->credential_model, $this->user_model, $this->member_profile_model);
$service->set_refer_log_model($this->refer_log_model);
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|is_unique[credential.email]');
$this->form_validation->set_rules('password', 'Password', 'trim|required');
$this->form_validation->set_rules('confirm_password', 'Confirm Password', 'trim|required|matches[password]');
$this->form_validation->set_rules('first_name', 'First Name', 'trim|required');
$this->form_validation->set_rules('last_name', 'Last Name', 'trim|required');
// $this->form_validation->set_rules('username', 'Username', 'trim|required|is_unique[member_profile.username]');
if ($this->form_validation->run() === FALSE)
{
echo $this->load->view('Member/Register', $this->_data, TRUE);
exit;
}
$email = $this->input->post('email');
$password = $this->input->post('password');
$first_name = $this->input->post('first_name');
$last_name = $this->input->post('last_name');
// $username = $this->input->post('username');
$username = $first_name;
// if($email == $username){
// $this->_data['error'] = 'Can not Use Email as Username';
// echo $this->load->view('Member/Register', $this->_data, TRUE);
// exit;
// }
$redirect = $service->get_redirect($this->input->cookie('redirect', TRUE), $this->_redirect);
$session = $this->get_session();
$refer = (isset($session['refer']) && strlen($session['refer']) > 0) ? $session['refer'] : '';
$this->db->trans_begin();
$created_user = $service->create($email, $password, $first_name, $last_name, $username, 1, $refer);
if (!$created_user)
{
$this->db->trans_rollback();
$this->_data['error'] = 'User creation failed. Please try again.';
echo $this->load->view('Member/Register', $this->_data, TRUE);
exit;
}
delete_cookie('redirect');
$credential = $this->credential_model->get_by_fields([
'email' => $email,
'type' => 'n'
]);
$this->db->trans_commit();
$this->set_session('credential_id', (int) $credential->id);
$this->set_session('user_id', (int) $created_user->id);
$this->set_session('email', (string) $created_user->email);
$this->set_session('role', (string) $created_user->role_id);
if(isset($_POST['return_url'] ) && $_POST['return_url'] =='buy'){
return $this->redirect('buy');
}
return $this->redirect($redirect);
}
}
+61
View File
@@ -0,0 +1,61 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once __DIR__ . '/../../services/User_service.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Reset Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_reset_controller extends Manaknight_Controller
{
public function index ($reset_token)
{
$this->load->model('user_model');
$this->load->model('token_model');
$this->load->model('credential_model');
$service = new User_service($this->credential_model);
$service->set_token_model($this->token_model);
$valid_user = $service->valid_reset_token($reset_token);
if (!$valid_user)
{
$this->error('Email does not exist in our system.');
return $this->redirect('/member/login');
}
$this->_data['reset_token'] = $reset_token;
$this->form_validation->set_rules('password', 'Password', 'trim|required');
$this->form_validation->set_rules('confirm_password', 'Confirm Password', 'trim|required|matches[password]');
if ($this->form_validation->run() === FALSE)
{
echo $this->load->view('Member/Reset', $this->_data, TRUE);
exit;
}
$password = $this->input->post('password');
$password_reseted = $service->reset_password($valid_user->id, $password);
if ($password_reseted)
{
$service->invalidate_token($reset_token, $valid_user->id);
$credential = $this->credential_model->get_by_field('user_id', $valid_user->id);
$this->credential_model->edit(['verify' => '1'], $credential->id);
$this->set_session('credential_id', (int) $credential->id);
$this->set_session('user_id', (int) $credential->user_id);
$this->set_session('email', (string) $credential->email);
$this->set_session('role', (string) $credential->role_id);
$this->success('Success! You can start using your account now.');
return $this->redirect('/member/dashboard');
}
$this->error('Invalid reset token to reset password.');
return $this->redirect('/member/login');
}
}
+137
View File
@@ -0,0 +1,137 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Sales Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_sales_controller extends Member_controller
{
protected $_model_file = 'payout_model';
public $_page_name = 'Sales';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Sales_member_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Sales_member_list_paginate_view_model(
$this->payout_model,
$this->pagination,
'/member/sales/0');
$this->_data['view_model']->set_heading('Sales');
$this->_data['view_model']->set_id(($this->input->get('id', TRUE) != NULL) ? $this->input->get('id', TRUE) : NULL);
$this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_order_id(($this->input->get('order_id', TRUE) != NULL) ? $this->input->get('order_id', TRUE) : NULL);
$this->_data['view_model']->set_amount(($this->input->get('amount', TRUE) != NULL) ? $this->input->get('amount', TRUE) : NULL);
$this->_data['view_model']->set_created_at(($this->input->get('created_at', TRUE) != NULL) ? $this->input->get('created_at', TRUE) : NULL);
$this->_data['view_model']->set_status(($this->input->get('status', TRUE) != NULL) ? $this->input->get('status', TRUE) : NULL);
$where = [
'id' => $this->_data['view_model']->get_id(),
'user_id' => $this->session->userdata('user_id'),
'order_id' => $this->_data['view_model']->get_order_id(),
'amount' => $this->_data['view_model']->get_amount(),
'created_at' => $this->_data['view_model']->get_created_at(),
'status' => $this->_data['view_model']->get_status(),
];
$this->_data['view_model']->set_total_rows($this->payout_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/member/sales/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->payout_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
$invetory_data = $this->db->select('i.*,p.name as professor,c.name as class,s.name as school')->from('inventory i ')
->join('school s','s.id=i.school_id')
->join('professor p','p.id=i.professor_id')
->join('classes c','c.id=i.class_id')
->get()->result_array();
foreach ( $this->_data['view_model']->get_list() as $key => &$value) {
$value->school = '';
$value->professor = '';
$value->class = '';
$value->isbn = '';
foreach ($invetory_data as $k => $v) {
if($value->inventory_id==$v['id']){
$value->school = $v['school'];
$value->professor = $v['professor'];
$value->class = $v['class'];
$value->isbn = $v['isbn'];
}
}
}
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Member/Sales', $this->_data);
}
}
+111
View File
@@ -0,0 +1,111 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Ticket Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_ticket_controller extends Member_controller
{
protected $_model_file = 'ticket_model';
public $_page_name = 'Ticket';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Ticket_member_list_paginate_view_model.php';
$session = $this->get_session();
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new Ticket_member_list_paginate_view_model(
$this->ticket_model,
$this->pagination,
'/member/ticket/0');
$this->_data['view_model']->set_heading('Ticket');
$this->_data['view_model']->set_order_id(($this->input->get('order_id', TRUE) != NULL) ? $this->input->get('order_id', TRUE) : NULL);
$this->_data['view_model']->set_message(($this->input->get('message', TRUE) != NULL) ? $this->input->get('message', TRUE) : NULL);
$this->_data['view_model']->set_receive_status(($this->input->get('receive_status', TRUE) != NULL) ? $this->input->get('receive_status', TRUE) : NULL);
$where = [
'order_id' => $this->_data['view_model']->get_order_id(),
'message' => $this->_data['view_model']->get_message(),
'receive_status' => $this->_data['view_model']->get_receive_status(),
'user_id' => $this->session->userdata('user_id'),
];
$this->_data['view_model']->set_total_rows($this->ticket_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/member/ticket/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->ticket_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Member/Ticket', $this->_data);
}
}
@@ -0,0 +1,248 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Transaction Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_transaction_controller extends Member_controller
{
protected $_model_file = 'transaction_model';
public $_page_name = 'Transaction';
public function __construct()
{
parent::__construct();
}
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/Transaction_member_list_paginate_view_model.php';
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$session = $this->get_session();
$where = [];
$this->_data['view_model'] = new Transaction_member_list_paginate_view_model(
$this->transaction_model,
$this->pagination,
'/member/transaction/0');
$this->_data['view_model']->set_heading('Transaction');
$this->_data['view_model']->set_total_rows($this->transaction_model->count($where));
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/member/transaction/0');
$this->_data['view_model']->set_list($this->transaction_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Member/Transaction', $this->_data);
}
public function add()
{
include_once __DIR__ . '/../../view_models/Transaction_member_add_view_model.php';
$session = $this->get_session();
$this->form_validation = $this->transaction_model->set_form_validation(
$this->form_validation, $this->transaction_model->get_all_validation_rule());
$this->_data['view_model'] = new Transaction_member_add_view_model($this->transaction_model);
$this->_data['view_model']->set_heading('Transaction');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Member/TransactionAdd', $this->_data);
}
$order_id = $this->input->post('order_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$transaction_date = $this->input->post('transaction_date', TRUE);
$transaction_time = $this->input->post('transaction_time', TRUE);
$subtotal = $this->input->post('subtotal', TRUE);
$tax = $this->input->post('tax', TRUE);
$discount = $this->input->post('discount', TRUE);
$total = $this->input->post('total', TRUE);
$stripe_charge_id = $this->input->post('stripe_charge_id', TRUE);
$payment_method = $this->input->post('payment_method', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->transaction_model->create([
'order_id' => $order_id,
'user_id' => $user_id,
'transaction_date' => $transaction_date,
'transaction_time' => $transaction_time,
'subtotal' => $subtotal,
'tax' => $tax,
'discount' => $discount,
'total' => $total,
'stripe_charge_id' => $stripe_charge_id,
'payment_method' => $payment_method,
'status' => $status,
]);
if ($result)
{
return $this->redirect('/member/transaction/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Member/TransactionAdd', $this->_data);
}
public function edit($id)
{
$model = $this->transaction_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/member/transaction/0');
}
include_once __DIR__ . '/../../view_models/Transaction_member_edit_view_model.php';
$this->form_validation = $this->transaction_model->set_form_validation(
$this->form_validation, $this->transaction_model->get_all_edit_validation_rule());
$this->_data['view_model'] = new Transaction_member_edit_view_model($this->transaction_model);
$this->_data['view_model']->set_model($model);
$this->_data['view_model']->set_heading('Transaction');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Member/TransactionEdit', $this->_data);
}
$order_id = $this->input->post('order_id', TRUE);
$user_id = $this->input->post('user_id', TRUE);
$transaction_date = $this->input->post('transaction_date', TRUE);
$transaction_time = $this->input->post('transaction_time', TRUE);
$subtotal = $this->input->post('subtotal', TRUE);
$tax = $this->input->post('tax', TRUE);
$discount = $this->input->post('discount', TRUE);
$total = $this->input->post('total', TRUE);
$stripe_charge_id = $this->input->post('stripe_charge_id', TRUE);
$payment_method = $this->input->post('payment_method', TRUE);
$status = $this->input->post('status', TRUE);
$result = $this->transaction_model->edit([
'order_id' => $order_id,
'user_id' => $user_id,
'transaction_date' => $transaction_date,
'transaction_time' => $transaction_time,
'subtotal' => $subtotal,
'tax' => $tax,
'discount' => $discount,
'total' => $total,
'stripe_charge_id' => $stripe_charge_id,
'payment_method' => $payment_method,
'status' => $status,
], $id);
if ($result)
{
return $this->redirect('/member/transaction/0', 'refresh');
}
$this->_data['error'] = 'Error';
return $this->render('Member/TransactionEdit', $this->_data);
}
public function view($id)
{
$model = $this->transaction_model->get($id);
if (!$model)
{
$this->error('Error');
return redirect('/member/transaction/0');
}
include_once __DIR__ . '/../../view_models/Transaction_member_view_view_model.php';
$this->_data['view_model'] = new Transaction_member_view_view_model($this->transaction_model);
$this->_data['view_model']->set_heading('Transaction');
$this->_data['view_model']->set_model($model);
return $this->render('Member/TransactionView', $this->_data);
}
public function delete($id)
{
$model = $this->transaction_model->get($id);
$session = $this->get_session();
if (!$model)
{
$this->error('Error');
return redirect('/member/transaction/0');
}
$result = $this->transaction_model->delete($id);
if ($result)
{
return $this->redirect('/member/transaction/0', 'refresh');
}
$this->error('Error');
return redirect('/member/transaction/0');
}
}
@@ -0,0 +1,415 @@
<?php defined('BASEPATH') || exit('No direct script access allowed');
include_once 'Member_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* User_card Controller
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_user_card_controller extends Member_controller
{
/**
* @var string
*/
protected $_model_file = 'user_card_model';
/**
* @var string
*/
public $_page_name = 'User Card';
public function __construct()
{
parent::__construct();
$this->load->model('credential_model');
$this->load->model('user_model');
$this->load->library('stripe_helper_service');
}
/**
* @param $page
* @return mixed
*/
public function index($page)
{
$this->load->library('pagination');
include_once __DIR__ . '/../../view_models/User_card_member_list_paginate_view_model.php';
$session = $this->get_session();
$user_id = $this->session->userdata('user_id');
$format = $this->input->get('format', TRUE) ?? 'view';
$order_by = $this->input->get('order_by', TRUE) ?? '';
$direction = $this->input->get('direction', TRUE) ?? 'ASC';
$per_page_sort = $this->input->get('per_page_sort', TRUE) ?? 25;
$this->_data['view_model'] = new User_card_member_list_paginate_view_model(
$this->user_card_model,
$this->pagination,
'/member/user_card/0');
$this->_data['view_model']->set_heading('User Card');
$this->_data['view_model']->set_is_default(($this->input->get('is_default', TRUE) != NULL) ? $this->input->get('is_default', TRUE) : NULL);
// $this->_data['view_model']->set_user_id(($this->input->get('user_id', TRUE) != NULL) ? $this->input->get('user_id', TRUE) : NULL);
$this->_data['view_model']->set_last4(($this->input->get('last4', TRUE) != NULL) ? $this->input->get('last4', TRUE) : NULL);
$where = [
'is_default' => $this->_data['view_model']->get_is_default(),
'user_id' => $user_id,
'last4' => $this->_data['view_model']->get_last4()
];
$this->_data['view_model']->set_total_rows($this->user_card_model->count($where));
$this->_data['view_model']->set_format_layout($this->_data['layout_clean_mode']);
$this->_data['view_model']->set_per_page($per_page_sort);
$this->_data['view_model']->set_order_by($order_by);
$this->_data['view_model']->set_sort($direction);
$this->_data['view_model']->set_sort_base_url('/member/user_card/0');
$this->_data['view_model']->set_page($page);
$this->_data['view_model']->set_list($this->user_card_model->get_paginated(
$this->_data['view_model']->get_page(),
$this->_data['view_model']->get_per_page(),
$where,
$order_by,
$direction));
if ($format == 'csv')
{
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
echo $this->_data['view_model']->to_csv();
exit();
}
if ($format != 'view')
{
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode($this->_data['view_model']->to_json()));
}
return $this->render('Member/User_card', $this->_data);
}
/**
* @return mixed
*/
public function add()
{
include_once __DIR__ . '/../../view_models/User_card_member_add_view_model.php';
$session = $this->get_session();
$user_id = $this->session->userdata('user_id');
$this->form_validation = $this->user_card_model->set_form_validation(
$this->form_validation, $this->user_card_model->get_all_validation_rule());
$this->_data['view_model'] = new User_card_member_add_view_model($this->user_card_model);
$this->_data['view_model']->set_heading('User Card');
if ($this->form_validation->run() === FALSE)
{
return $this->render('Member/User_cardAdd', $this->_data);
}
$user_all_card_data = $this->user_card_model->get_all(['user_id' => $user_id]);
// $user_card_data = $this->user_card_model->get_by_field('user_id', $user_id);
$is_default = $this->input->post('is_default', TRUE);
$card_name = $this->input->post('card_name', TRUE);
$card_number = $this->input->post('card_number', TRUE);
$exp_month = $this->input->post('exp_month', TRUE);
$exp_year = $this->input->post('exp_year', TRUE);
$cvc = $this->input->post('cvc', TRUE);
$new_card_last4 = substr($card_number, 12);
if (!empty($user_all_card_data))
{
if (!empty($card_number) && !empty($exp_month) && !empty($exp_year) && !empty($cvc))
{
// use for each
foreach ($user_all_card_data as $key1 => $res1)
{
if ($res1->last4 == $new_card_last4)
{
// throw error
$this->error('This card last4->(...' . $new_card_last4 . ') is already added. Try again with a new card.');
return redirect($_SERVER['HTTP_REFERER']);
}
}
// add card
$this->stripe_helper_service->set_config($this->config);
$response = $this->stripe_helper_service->create_stripe_token($card_number, $exp_month, $exp_year, $cvc);
if (isset($response['success']))
{
$stripe_token_id = $response['token']->id;
$this->stripe_helper_service->set_user_model($this->user_model);
// pass token_id to assign card to user
$res_card_data = $this->stripe_helper_service->add_new_card($stripe_token_id, $user_id);
if (isset($res_card_data['success']))
{
$stripe_card_id = $res_card_data['card_data']->id;
$stripe_brand = $res_card_data['card_data']->brand;
$stripe_exp_month = $res_card_data['card_data']->exp_month;
$stripe_exp_year = $res_card_data['card_data']->exp_year;
$stripe_last4 = $res_card_data['card_data']->last4;
// store the card id with the associated user
$check_new_card = $this->user_card_model->create([
'is_default' => 0,
'user_id' => $user_id,
'stripe_card_id' => $stripe_card_id,
'last4' => $stripe_last4,
'brand' => $stripe_brand,
'exp_month' => $stripe_exp_month,
'exp_year' => $stripe_exp_year
]);
if ($check_new_card)
{
$this->success('Card added successfully.');
return $this->redirect('/member/user_card/0', 'refresh');
}
else
{
$this->error('Card add failed. Try Again.');
return redirect($_SERVER['HTTP_REFERER']);
}
}
else
{
// when user do not have the user->stripe_id
$this->error($res_card_data['error_msg']);
return redirect($_SERVER['HTTP_REFERER']);
}
}
else
{
// when new card validation failed
$this->error($response['error_msg']);
return redirect($_SERVER['HTTP_REFERER']);
}
}
else
{
$this->error('Empty Field');
return redirect($_SERVER['HTTP_REFERER']);
}
}
else
{
// create stripe_customer_id and add the new card
$this->stripe_helper_service->set_config($this->config);
$response = $this->stripe_helper_service->create_stripe_token($card_number, $exp_month, $exp_year, $cvc);
if (isset($response['success']))
{
$stripe_token_id = $response['token']->id;
// var_dump($stripe_token_id);
// die();
// get user email from credential model
$customer_email = $this->credential_model->get_by_field('user_id', $user_id);
$this->stripe_helper_service->set_config($this->config);
$res_customer = $this->stripe_helper_service->create_stripe_customer_with_card($customer_email, $stripe_token_id);
if (isset($res_customer['success']))
{
$stripe_customer_id = $res_customer['card']->customer;
$stripe_card_id = $res_customer['card']->id;
$stripe_brand = $res_customer['card']->brand;
$stripe_exp_month = $res_customer['card']->exp_month;
$stripe_exp_year = $res_customer['card']->exp_year;
$stripe_last4 = $res_customer['card']->last4;
// update user->stripe_id
$update_stripe_id = $this->user_model->edit([
'stripe_id' => $stripe_customer_id
], $user_id);
// add card on user_card
if ($update_stripe_id)
{
// store the card id with the associated user
$check_new_card = $this->user_card_model->create([
'is_default' => 1,
'user_id' => $user_id,
'stripe_card_id' => $stripe_card_id,
'last4' => $stripe_last4,
'brand' => $stripe_brand,
'exp_month' => $stripe_exp_month,
'exp_year' => $stripe_exp_year
]);
if ($check_new_card)
{
$this->success('Card added successfully and set to default.');
return $this->redirect('/member/user_card/0', 'refresh');
}
else
{
$this->error('Card add failed. Try Again.');
return redirect($_SERVER['HTTP_REFERER']);
}
}
}
else
{
$this->error($res_customer['error_msg']);
return redirect($_SERVER['HTTP_REFERER']);
}
}
else
{
// when new card validation failed
$this->error($response['error_msg']);
return redirect($_SERVER['HTTP_REFERER']);
}
}
$this->_data['error'] = 'Error';
return $this->render('Member/User_cardAdd', $this->_data);
}
public function set_default()
{
$user_id = $this->session->userdata('user_id');
$user_card_id = $this->input->post('user_card_id');
if (!empty($user_card_id))
{
$user_card_data = $this->user_card_model->get($user_card_id);
if (!empty($user_card_data))
{
if ($user_card_data->is_default == 1)
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'This card is already set to default.';
echo json_encode($output);
exit();
}
}
$this->stripe_helper_service->set_config($this->config);
$this->stripe_helper_service->set_user_model($this->user_model);
$response = $this->stripe_helper_service->update_default_card($user_card_data->stripe_card_id, $user_id);
if (isset($response['success']))
{
// make other cards is_default to = 0
$all_card_data = $this->user_card_model->get_all(['user_id' => $user_id]);
if (!empty($all_card_data))
{
foreach ($all_card_data as $key1 => $res1)
{
$this->user_card_model->edit(['is_default' => 0], $res1->id);
}
}
// then only set is_default 1 to the default card
$result = $this->user_card_model->edit([
'is_default' => 1
], $user_card_id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'Card set to default.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = $response['error_msg'];
echo json_encode($output);
exit();
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! User card not found.';
echo json_encode($output);
exit();
}
}
public function delete()
{
$user_id = $this->session->userdata('user_id');
$user_card_id = $this->input->post('user_card_id');
if (!empty($user_card_id))
{
$user_card_data = $this->user_card_model->get($user_card_id);
$this->stripe_helper_service->set_config($this->config);
$this->stripe_helper_service->set_user_model($this->user_model);
$response = $this->stripe_helper_service->delete_card_from_customer($user_id, $user_card_data->stripe_card_id);
if (isset($response['success']))
{
$result = $this->user_card_model->real_delete($user_card_id);
if ($result)
{
$output['success'] = TRUE;
$output['status'] = 200;
$output['msg'] = 'User card deleted successfully.';
echo json_encode($output);
exit();
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! Please try again later.';
echo json_encode($output);
exit();
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = $response['error_msg'];
echo json_encode($output);
exit();
}
}
else
{
$output['error'] = TRUE;
$output['status'] = 0;
$output['msg'] = 'Error! User card not found.';
echo json_encode($output);
exit();
}
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
include_once dirname(__FILE__) . '/Guest/Home_controller.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
class Welcome extends Home_controller
{
public function __construct()
{
parent::__construct();
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+442
View File
@@ -0,0 +1,442 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once __DIR__ . '/../middlewares/Auth_middleware.php';
include_once __DIR__ . '/../middlewares/Acl_middleware.php';
include_once __DIR__ . '/../middlewares/Maintenance_middleware.php';
include_once __DIR__ . '/../middlewares/Affilate_middleware.php';
include_once __DIR__ . '/../middlewares/Subscription_middleware.php';
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Abstract Controller
*
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
Sentry\init(['dsn' => 'https://2c9f2b0e8d3e424a81d19c501c479d02@o1003846.ingest.sentry.io/5970395' ]);
class Manaknight_Controller extends CI_Controller
{
// If set, this language file will automatically be loaded.
protected $_language_file = NULL;
// If set, this model file will automatically be loaded.
protected $_model_file = NULL;
//testMode flag
protected $_test_mode = FALSE;
protected $_setting = FALSE;
/**
* View Model
* @var array
*/
public $_data = [
'error' => '',
'success' => ''
];
/**
* Flash Data
* @var array
*/
protected $_flash_error = [
'error' => '',
'success' => ''
];
public function __construct()
{
parent::__construct();
$this->load->database();
//--------------------------------------------------------------------
// Language & Model Files
//--------------------------------------------------------------------
if (!is_null($this->_language_file))
{
$this->lang->load($this->_language_file);
}
if (!is_null($this->_model_file))
{
$this->load->model($this->_model_file);
}
//Flashdata setup
if ($this->session->flashdata('error'))
{
$this->_flash_error['error'] = $this->session->flashdata('error');
$this->session->set_flashdata('error', '');
$this->_data['error'] = $this->_flash_error['error'];
}
if ($this->session->flashdata('success'))
{
$this->_flash_error['success'] = $this->session->flashdata('success');
$this->session->set_flashdata('success', '');
$this->_data['success'] = $this->_flash_error['success'];
}
$this->load->model('setting_model');
$this->_setting = $this->setting_model->get_config_settings();
date_default_timezone_set($this->config->item('default_time_zone'));
}
/**
* Set Controller into test mode
*
* @return void
*/
public function set_test_mode ()
{
$this->_test_mode = TRUE;
}
/**
* Render view
*
* @param string $template
* @param array $data
*/
public function render($template, $data)
{
return (!$this->_test_mode) ? $this->_render($template, $data) : $this->_render_test($template, $data);
}
/**
* Render Test Model
*
* @param string $template
* @param mixed $data
* @return mixed
*/
protected function _render_test($template, $data)
{
return [
'header' => $this->load->view('Layout/Header', $data, TRUE),
'body' => $this->load->view($template, $data, TRUE),
'footer' => $this->load->view('Layout/Footer', $data, TRUE),
'data' => $data,
];
}
/**
* Render Normal View
*
* @param string $template
* @param mixed $data
* @return void
*/
protected function _render($template, $data)
{
$this->load->view('Layout/Header', $data);
$this->load->view($template, $data);
$this->load->view('Layout/Footer');
}
/**
* Redirect to URL
*
* @param string $template
* @param array $data
*/
public function redirect($url, $option = [])
{
return ($option) ? redirect($url, $option) : redirect($url);
}
/**
* Set the Flashdata
*
* @param string $message
*/
public function success($message)
{
$this->session->set_flashdata('success', $message);
}
/**
* Set the Flashdata
*
* @param string $message
*/
public function error($message)
{
$this->session->set_flashdata('error', $message);
}
/**
* Debug Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dl($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : <pre>' . print_r($data, TRUE) . '</pre>');
}
}
/**
* Debug json Controller to error_log and turn off in production
*
* @param mixed $data
* @return void
*/
public function dj($key, $data)
{
if (ENVIRONMENT == 'development')
{
error_log($key . ' CONTROLLER : ' . json_encode($data));
}
}
public function get_session()
{
if (!$this->_test_mode)
{
return $_SESSION;
}
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
return $session;
}
public function set_session($field, $value)
{
if (!$this->_test_mode)
{
$_SESSION[$field] = $value;
}
else
{
$session = $this->config->item('session_test');
if (!$session)
{
$session = [];
}
$session[$field] = $value;
$this->config->set_item('session_test', $session);
}
}
public function destroy_session()
{
if (!$this->_test_mode)
{
unset($_SESSION);
session_unset();
}
else
{
$this->config->set_item('session_test', []);
}
}
/**
* Function to send Emails given slug, payload and email
*
* @param string $slug
* @param mixed $payload
* @param string $email
* @return void
*/
protected function _send_email_notification($slug, $payload, $email)
{
$this->load->model('email_model');
$this->load->library('mail_service');
$this->mail_service->set_adapter('smtp');
$email_template = $this->email_model->get_template($slug, $payload);
if ($email_template)
{
$from = $this->config->item('from_email');
return $this->mail_service->send($from, $email, $email_template->subject, $email_template->html);
}
return FALSE;
}
/**
* Function to send Sms given slug, payload and phone #
*
* @param string $slug
* @param mixed $payload
* @param string $to
* @return void
*/
protected function _send_sms_notification($slug, $payload, $to)
{
$this->load->model('sms_model');
$this->load->library('sms_service');
$this->sms_service->set_adapter('sms');
$sms_template = $this->sms_model->get_template($slug, $payload);
if ($sms_template)
{
return $this->sms_service->send($to, $sms_template->content);
}
return FALSE;
}
/**
* Function to send Push notification
*
* @param string $slug
* @param mixed $payload
* @param string $to
* @return void
*/
protected function _send_push_notification($device_type, $device_id, $title, $message, $image)
{
$this->load->library('push_notification_service');
$this->push_notification_service->init();
return $this->push_notification_service->send($device_type, $device_id, $title, $message, $image);
}
protected function _middleware()
{
return [];
}
protected function _run_middlewares ()
{
$middlewares = [
'affilate' => new Affilate_middleware($this, $this->config),
'auth' => new Auth_middleware($this, $this->config),
'acl' => new Acl_middleware($this, $this->config),
'maintenance' => new Maintenance_middleware($this, $this->config),
'subscription' => new Subscription_middleware($this, $this->config)
];
foreach ($this->_middleware() as $middleware_key)
{
if (isset($middlewares[$middleware_key]))
{
$result = $middlewares[$middleware_key]->run();
if (!$result)
{
return FALSE;
}
}
}
}
public function get_setting()
{
return $this->_setting;
}
public function image_upload_using_s3($file_name)
{
if( $this->config->item('image_upload') == 's3')
{
$s3 = new S3Client([
'version' => $this->config->item('aws_version'),
'region' => $this->config->item('aws_region'),
'endpoint' => $this->config->item('aws_endpoint'),
'use_path_style_endpoint' => true,
'credentials' => [
'key' => $this->config->item('aws_key'),
'secret' => $this->config->item('aws_secret'),
]
]);
$this->load->model('image_model');
$image_path = __DIR__ . '/../../' . $file_name;
// $data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data_uri));
// $filename = md5(uniqid() . time()) . '.png';
// file_put_contents($image_path . $filename, $data);
list($width, $height) = getimagesize( $image_path );
$session = $this->get_session();
$user_id = isset($session['user_id']) ? $session['user_id'] : 0;
$file_name = str_replace('/uploads/','',$file_name);
try
{
$result = $s3->putObject([
'Bucket' => $this->config->item('aws_bucket'),
'Key' => $file_name,
'Body' => fopen($image_path, 'r'),
'ACL' => 'public-read',
]);
$image_id = $this->image_model->create([
'url' => $result->get('ObjectURL'),
'type' => 0,
'user_id' => $user_id,
'width' => $width,
'caption' => '',
'height' => $height
]);
return $this->output->set_content_type('application/json')
->set_status_header(200)
->set_output(json_encode([
'id' => $image_id,
'image' => $result->get('ObjectURL'),
'width' => $width,
'height' => $height
]));
}
catch (Aws\S3\Exception\S3Exception $e)
{
return $this->output->set_content_type('application/json')
->set_status_header(403)
->set_output(json_encode([
'message' => 'Upload To S3 Failed'
]));
}
}
}
public function upload_image_with_s3($file_name)
{
$output = $this->image_upload_using_s3($file_name);
$out_image = '';
if( isset($output->final_output ) )
{
$result = json_decode( $output->final_output );
if(isset($result->image))
{
$out_image = $result->image;
}
return $out_image;
} else{
return $out_image;
}
}
}

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