initial commit
This commit is contained in:
115
.gitignore
vendored
Normal file
115
.gitignore
vendored
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
vendor/
|
||||||
|
logs/
|
||||||
|
nbproject/
|
||||||
|
tmp/
|
||||||
|
webroot/mpdf60/
|
||||||
|
webroot/common_script_file_backup.js
|
||||||
|
webroot/contact_photo/
|
||||||
|
webroot/Staff/sertg/
|
||||||
|
config/app.settings.php
|
||||||
|
webroot/Staff/pdf/
|
||||||
|
webroot/test.pdf
|
||||||
|
webroot/imran/test1.css
|
||||||
|
webroot/imran/test.js
|
||||||
|
webroot/imran/test.css
|
||||||
|
webroot/test.docx
|
||||||
|
webroot/Staff/php.ini
|
||||||
|
tests/
|
||||||
|
webroot/Staff/composer.lock
|
||||||
|
composer.lock
|
||||||
|
node_modules/
|
||||||
|
package-lock.json
|
||||||
|
webroot/js/b87b9ba532ace76ae9f6edfe9f72ded2.ttf
|
||||||
|
webroot/js/a1a749e89f578a49306ec2b055c073da.svg
|
||||||
|
webroot/js/962a1bf31c081691065fe333d9fa8105.svg
|
||||||
|
webroot/js/8e3c7f5520f5ae906c6cf6d7f3ddcd19.eot
|
||||||
|
webroot/js/82f60bd0b94a1ed68b1e6e309ce2e8c3.svg
|
||||||
|
webroot/AdminAccountImage/
|
||||||
|
webroot/cmsuser_logo/
|
||||||
|
webroot/new_layout/img/
|
||||||
|
config/app.settings.php
|
||||||
|
webroot/cronjob/
|
||||||
|
src/Controller/EpicvelocityController_new.php
|
||||||
|
webroot/epicvelocity/clients_docs/
|
||||||
|
webroot/epicvelocity/letters/
|
||||||
|
.idea/inspectionProfiles/profiles_settings.xml
|
||||||
|
webroot/test.css
|
||||||
|
webroot/forum/cache/
|
||||||
|
webroot/forum/install/lock
|
||||||
|
src/Controller/TestController.php
|
||||||
|
webroot/html_content/
|
||||||
|
webroot/testzip/
|
||||||
|
webroot/velocity/
|
||||||
|
webroot/rtg_optimize/
|
||||||
|
webroot/html_history_code/
|
||||||
|
webroot/epicvelocity/pdf/ringcentral/
|
||||||
|
webroot/media/
|
||||||
|
webroot/chat_attachment/
|
||||||
|
webroot/client_agreement_files/
|
||||||
|
webroot/agreenment_contents/
|
||||||
|
webroot/agreement_signed_content/
|
||||||
|
webroot/member_education_templates/
|
||||||
|
webroot/member_help_templates/
|
||||||
|
webroot/payment_vendor.zip
|
||||||
|
webroot/js.zip
|
||||||
|
webroot/css.zip
|
||||||
|
db/rtgv4_22_04_2020.sql
|
||||||
|
db/AppController.php
|
||||||
|
src.zip
|
||||||
|
webroot/api/
|
||||||
|
db/app.settings.php
|
||||||
|
webroot/Staff/sertg_export_error.txt
|
||||||
|
src/Template/Test/
|
||||||
|
webroot/test/test.pdf
|
||||||
|
scrapper/.vscode/launch.json
|
||||||
|
src/Template/Uploadhtml/creditanalysiscontent_Bk.ctp
|
||||||
|
webroot/Staff/clientfiles.txt
|
||||||
|
src/Controller/CmsusersController_bk.php
|
||||||
|
src/Controller/AppController_bk.php
|
||||||
|
webroot/forum/inc/config.php
|
||||||
|
epicvelocity/clients_docs/
|
||||||
|
epicvelocity/letters/51_1598072863evlg-pdf.zip
|
||||||
|
epicvelocity/letters/
|
||||||
|
webroot/rtg_letters/
|
||||||
|
webroot/rtg_letter_errors.txt
|
||||||
|
webroot/V2.0/rtg_letters_error.txt
|
||||||
|
webroot/imran.txt
|
||||||
|
webroot/member_email_attachment/
|
||||||
|
webroot/member_email_template_attachment/
|
||||||
|
webroot/ca.txt
|
||||||
|
vendor.zip
|
||||||
|
webroot/mpdf60.zip
|
||||||
|
db/rtg_letters_error.txt
|
||||||
|
db/rtg_letters_error_mo.txt
|
||||||
|
db/rtg_letters_error_staff.txt
|
||||||
|
|
||||||
|
webroot/credit_analysis_template/
|
||||||
|
webroot/mpdf_latest_vendor.zip
|
||||||
|
db/DashboardController.php
|
||||||
|
db/EpicvelocityController.php
|
||||||
|
db/functions.php
|
||||||
|
db/getSertgInfo.php
|
||||||
|
db/info-2021-02-25.log
|
||||||
|
db/SERTG.html
|
||||||
|
db/SERTG.php
|
||||||
|
webroot/Array/
|
||||||
|
webroot/RTG/webroot.zip
|
||||||
|
webroot/backup_resources/
|
||||||
|
webroot/member_email_template_body/
|
||||||
|
webroot/test.php
|
||||||
|
webroot/client_popup_content/
|
||||||
|
ghostdriver.log
|
||||||
|
webroot/email_queue/
|
||||||
|
webroot/certificates/img/1_bk.png
|
||||||
|
webroot/certificates/img/2_bk.png
|
||||||
|
webroot/certificates/img/3_bk.png
|
||||||
|
.idea/inspectionProfiles/Project_Default.xml
|
||||||
|
.idea/*
|
||||||
|
webroot/db_export.php
|
||||||
|
|
||||||
|
webroot/user-photo/
|
||||||
|
webroot/pdfletters/
|
||||||
|
.idea/workspace.xml
|
||||||
|
webroot/f.html
|
||||||
|
webroot/report/credit_report.json
|
||||||
|
webroot/report/credit_report2.json
|
||||||
13
.htaccess
Normal file
13
.htaccess
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteRule ^$ webroot/ [L]
|
||||||
|
RewriteRule (.*) webroot/$1 [L]
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule mod_php5.c>
|
||||||
|
php_value post_max_size 16M
|
||||||
|
php_value upload_max_filesize 5M
|
||||||
|
php_value memory_limit 128M
|
||||||
|
php_value max_execution_time 600
|
||||||
|
|
||||||
|
</IfModule>
|
||||||
94
README.md
Normal file
94
README.md
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# Learning Hub #
|
||||||
|
|
||||||
|
A web application to manage student registration, course registration, report and agent.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
## 🏗 Project Architecture
|
||||||
|
|
||||||
|
MainProject/
|
||||||
|
│
|
||||||
|
├── src/
|
||||||
|
│ ├── Controllers/
|
||||||
|
│ └── Model/
|
||||||
|
| └── Template/
|
||||||
|
├── Config/
|
||||||
|
├── webroot/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## ⚙️ Requirements
|
||||||
|
|
||||||
|
- PHP 7.4
|
||||||
|
- MySQL
|
||||||
|
- CakePHP 3
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## 🛠 Installation
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
git clone <repository-url>
|
||||||
|
cd <project-name>
|
||||||
|
|
||||||
|
add vendor which is added onedrive
|
||||||
|
```
|
||||||
|
|
||||||
|
### Database
|
||||||
|
|
||||||
|
Import database script inside file location db>>learnhub.sql
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## ▶️ Running the Project
|
||||||
|
|
||||||
|
Base API URL: http://localhost/{project-name}/
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
## 📄 Key Features
|
||||||
|
``` bash
|
||||||
|
1. Users Role : Admin, Student,Employee
|
||||||
|
```
|
||||||
|
``` bash
|
||||||
|
Admin or Employee Panel
|
||||||
|
|
||||||
|
1. Access Control
|
||||||
|
Admin or Employee can manage access control.
|
||||||
|
|
||||||
|
2. Student Management
|
||||||
|
Admin or Permitted Employee can be completed student registration process.
|
||||||
|
|
||||||
|
3. Course Management
|
||||||
|
Admin or Permitted Employee Can Add, Edit, View and Delete course.
|
||||||
|
|
||||||
|
4. Session Management
|
||||||
|
Admin or Permitted Employee Can Add, Edit, View and Delete session.
|
||||||
|
|
||||||
|
5. Feedback Management
|
||||||
|
Admin or Employee Can reply to feedback.
|
||||||
|
|
||||||
|
6. Report Management
|
||||||
|
Admin or Employee Can view report.
|
||||||
|
|
||||||
|
7. Manage Agents
|
||||||
|
Admin or Employee add, edit, view and delete agents.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
Student Panel
|
||||||
|
|
||||||
|
1. Student Profile
|
||||||
|
Student Can view his/her information.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
1. Student can apply using registration form
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
40
bin/cake
Normal file
40
bin/cake
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# Cake is a shell script for invoking CakePHP shell commands
|
||||||
|
#
|
||||||
|
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
#
|
||||||
|
# Licensed under The MIT License
|
||||||
|
# For full copyright and license information, please see the LICENSE.txt
|
||||||
|
# Redistributions of files must retain the above copyright notice.
|
||||||
|
#
|
||||||
|
# @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
# @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
# @since 1.2.0
|
||||||
|
# @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Canonicalize by following every symlink of the given name recursively
|
||||||
|
canonicalize() {
|
||||||
|
NAME="$1"
|
||||||
|
if [ -f "$NAME" ]
|
||||||
|
then
|
||||||
|
DIR=$(dirname -- "$NAME")
|
||||||
|
NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME")
|
||||||
|
fi
|
||||||
|
while [ -h "$NAME" ]; do
|
||||||
|
DIR=$(dirname -- "$NAME")
|
||||||
|
SYM=$(readlink "$NAME")
|
||||||
|
NAME=$(cd "$DIR" > /dev/null && cd $(dirname -- "$SYM") > /dev/null && pwd)/$(basename -- "$SYM")
|
||||||
|
done
|
||||||
|
echo "$NAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
CONSOLE=$(dirname -- "$(canonicalize "$0")")
|
||||||
|
APP=$(dirname "$CONSOLE")
|
||||||
|
|
||||||
|
exec php "$CONSOLE"/cake.php "$@"
|
||||||
|
exit
|
||||||
27
bin/cake.bat
Normal file
27
bin/cake.bat
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
::
|
||||||
|
:: Cake is a Windows batch script for invoking CakePHP shell commands
|
||||||
|
::
|
||||||
|
:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
:: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
::
|
||||||
|
:: Licensed under The MIT License
|
||||||
|
:: Redistributions of files must retain the above copyright notice.
|
||||||
|
::
|
||||||
|
:: @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
:: @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
:: @since 2.0.0
|
||||||
|
:: @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
::
|
||||||
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
SET app=%0
|
||||||
|
SET lib=%~dp0
|
||||||
|
|
||||||
|
php "%lib%cake.php" %*
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
|
exit /B %ERRORLEVEL%
|
||||||
33
bin/cake.php
Normal file
33
bin/cake.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/php -q
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Command-line code generation utility to automate programmer chores.
|
||||||
|
*
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
* @since 2.0.0
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
$minVersion = '5.4.16';
|
||||||
|
if (file_exists('composer.json')) {
|
||||||
|
$composer = json_decode(file_get_contents('composer.json'));
|
||||||
|
if (isset($composer->require->php)) {
|
||||||
|
$minVersion = preg_replace('/([^0-9\.])/', '', $composer->require->php);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (version_compare(phpversion(), $minVersion, '<')) {
|
||||||
|
fwrite(STDERR, sprintf("Minimum PHP version: %s. You are using: %s.\n", $minVersion, phpversion()));
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
include dirname(__DIR__) . '/config/bootstrap.php';
|
||||||
|
|
||||||
|
exit(Cake\Console\ShellDispatcher::run($argv));
|
||||||
51
composer.json
Normal file
51
composer.json
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"name": "cakephp/app",
|
||||||
|
"description": "CakePHP skeleton app",
|
||||||
|
"homepage": "http://cakephp.org",
|
||||||
|
"type": "project",
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.4.16",
|
||||||
|
"cakephp/cakephp": "~3.1",
|
||||||
|
"mobiledetect/mobiledetectlib": "2.*",
|
||||||
|
"cakephp/migrations": "~1.0",
|
||||||
|
"cakephp/plugin-installer": "*",
|
||||||
|
"mandrill/mandrill": "1.0.*",
|
||||||
|
"stripe/stripe-php": "3.13.*",
|
||||||
|
"google/apiclient": "2.0",
|
||||||
|
"knplabs/knp-snappy": "^1.1",
|
||||||
|
"kreait/firebase-php": "^1.2",
|
||||||
|
"guzzlehttp/psr7": "^1.2 || ^2.0",
|
||||||
|
"mpdf/mpdf": "^8.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"psy/psysh": "@stable",
|
||||||
|
"cakephp/debug_kit": "~3.2",
|
||||||
|
"cakephp/bake": "~1.1"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
|
||||||
|
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\Test\\": "tests",
|
||||||
|
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-install-cmd": "App\\Console\\Installer::postInstall"
|
||||||
|
},
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"prefer-stable": true,
|
||||||
|
"config": {
|
||||||
|
"allow-plugins": {
|
||||||
|
"cakephp/plugin-installer": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
composer.phar
Normal file
BIN
composer.phar
Normal file
Binary file not shown.
698
config/app.constant.php
Normal file
698
config/app.constant.php
Normal file
@@ -0,0 +1,698 @@
|
|||||||
|
<?php
|
||||||
|
//application constant
|
||||||
|
use Cake\I18n\FrozenTime;define("TOKEN_EXPIRED_AFTER", "+15 min");
|
||||||
|
define("PIN_EXPIRED_AFTER", "+10 min");
|
||||||
|
define("APP_DEFAULT_LANGUAGE", "en_US");
|
||||||
|
define("TRUE_CODE", "1");
|
||||||
|
define("FALSE_CODE", "0");
|
||||||
|
define("SUCCESS_CODE", "+000");
|
||||||
|
define("FAIL_CODE", "-1");
|
||||||
|
define("TOKEN_CHAR_NO", "8");
|
||||||
|
define("BULK_ACTION_DELETE", "1");
|
||||||
|
define('PROFILE_PIC_UPLOAD_DIR', 'profileImages/');
|
||||||
|
define("APP_DEFAULT_IMAGE_PATH", "default/default_image.png");
|
||||||
|
define("APP_REG_EMAIL_TEMPLATE_NAME", "registration/email");
|
||||||
|
define("APP_FORGOT_PASS_EMAIL_TEMPLATE_NAME", "forgotpass/forgot_password");
|
||||||
|
define("REGISTRATION_EMAIL_SCHEDULE_TRACKING_FILE", "registration_email_schedule.txt");
|
||||||
|
define("APP_EMAIL_FROM", "no-reply@ygtimes.com");
|
||||||
|
define("APP_EMAIL_FROM_DISPLAY_NAME", "Zeerow");
|
||||||
|
define("FA_CONFEDERATION", json_encode(['AFC','UEFA','CAF','CONCACAF','CONMEBOL','OFC']));
|
||||||
|
|
||||||
|
define("TEAM_TYPES", json_encode(['Football' , 'Futsal' , 'Beach football']));
|
||||||
|
|
||||||
|
|
||||||
|
define("GENDER", json_encode(['Men','Women']));
|
||||||
|
define("FORM_TYPE", json_encode(['1'=>'Static','2'=>'Form']));
|
||||||
|
|
||||||
|
|
||||||
|
define('LANGUAGE_CODE_ENGLISH', 'en');
|
||||||
|
define('LANGUAGE_CODE_KOREAN', 'ko');
|
||||||
|
|
||||||
|
define('LANGUAGES',[
|
||||||
|
'en'=>'English'
|
||||||
|
// ,'ko'=>'Korean'
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('STATUS_ACTIVE', 1);
|
||||||
|
define('STATUS_NOT_ACTIVE', 0);
|
||||||
|
define('SUPER_SUPER_ADMIN_ID', 1);
|
||||||
|
define('STATUS_PAUSE_MEMBERSHIP', 2);
|
||||||
|
|
||||||
|
|
||||||
|
define("RANDOM_KEY_LENGTH", 4); // key lenght for generating sharing key.
|
||||||
|
define("WIDTH_OF_IMAGE", 100); // Set the width of thumbnail image
|
||||||
|
define("MAX_FILE_SIZE",1288490190); // Set Maximum File size for content page. 1.2 GB
|
||||||
|
|
||||||
|
define('MANDRILL_TEMPLATE_USER_CREATION', 'user-creation-cms-en');
|
||||||
|
define('MANDRILL_TEMPLATE_FORGOT_PASSWORD', 'cms-forgot-password');
|
||||||
|
define('MANDRILL_TEMPLATE_REPLY_MESSAGE', 'reply-message');
|
||||||
|
define('INVOICE_TEMPLATE', 'invoice');
|
||||||
|
define('ESTIMATE_TEMPLATE', 'estimate');
|
||||||
|
|
||||||
|
define('MANDRILL_TEMPLATE_STUDENT_CONFIRMATION', 'student_registration_for_student');
|
||||||
|
define('MANDRILL_TEMPLATE_STUDENT_CONFIRMATION_FOR_ADMIN', 'student_registration_for_admin');
|
||||||
|
|
||||||
|
define('DEFAULT_MEMBER_ID', 2);
|
||||||
|
define('COMPANY_ID', 8);
|
||||||
|
|
||||||
|
define('MAXIMUM_ALLOW_IP', 2);
|
||||||
|
|
||||||
|
define('ADMIN_USER_GROUP_ID', 9);
|
||||||
|
define('ADMIN_USER_ROLE_ID', 9);
|
||||||
|
define('USER_GROUP_ID', 11);
|
||||||
|
define('USER_ROLE_ID', 11);
|
||||||
|
define('UNIT', 'USD');
|
||||||
|
|
||||||
|
define('STAFF_GROUP_ID', 12);
|
||||||
|
|
||||||
|
define('INVOICE_ACTIVE', 0);
|
||||||
|
define('INVOICE_INACTIVE', 1);
|
||||||
|
define('INVOICE_STATUS', json_encode(['Open','Paid','Sent','Partially Paid','Canceled','Accepted','Declined','Invoiced','Revised']));// 0 = Open, 1 = paid, 2 = sent, 3= PartiallyPaid, 4=Canceled, 5= Accepted,6=Declined,7=Invoiced,8=Revised
|
||||||
|
define('INVOICE_CURRENCY', json_encode(['$'=>'$','£'=>'£','€'=>'€','¥'=>'¥']));
|
||||||
|
define('DATE_FORMAT', 'Y-m-d');
|
||||||
|
define('CURRENCY_INDICATOR', '');
|
||||||
|
define('DISCOUNT_TYPE_INDICATOR', '%');
|
||||||
|
define("PERMISSION", json_encode(['Only show own tasks for non super admins','Clients can create tasks']));
|
||||||
|
|
||||||
|
define("TYPES", json_encode(['Payment' , 'Refund']));
|
||||||
|
define("REBILL", json_encode(['Yes' , 'No']));
|
||||||
|
define("ATTACHMENT", "attach-documents/");
|
||||||
|
define("INVOICE_LOGO", "invoice-logo/");
|
||||||
|
define("PROJECT_MEDIA_FILES", "project-media-files/");
|
||||||
|
define("PRIORITY", json_encode(['Low' , 'Medium','High']));
|
||||||
|
define('TASK_STATUS', json_encode(['Open','Done']));
|
||||||
|
define('TASK_TYPE', json_encode(['Not Billable','Billable','Billed']));
|
||||||
|
|
||||||
|
define('SUBSCRIPTION_FREQUENCY', json_encode([7=>'weekly',30=>'Monthly']));
|
||||||
|
define('SUBSCRIPTION_STATUS', json_encode([0=>'Inactive',1=>'Active',2=>'Ended',3=>'All']));
|
||||||
|
|
||||||
|
define('USER_STATUS', json_encode(['Active','InActive']));
|
||||||
|
define('MEMBER_STATUS', json_encode(['InActive','Active']));
|
||||||
|
define("USER_PHOTO", "user-photo/");
|
||||||
|
|
||||||
|
define('TICKET_STATUS', json_encode(['Open','Reopen','Closed'])); //0 = open, 1 = Reopen, 2 = close
|
||||||
|
define('TICKET_BULK_ACTION', json_encode(['Close'])); //0 = open, 1 = Reopen, 2 = close
|
||||||
|
define('INVOICE_ADDPAYMENT_TYPE', json_encode(['Cash','Credit', 'Card','Paypal','Bank Transfer','Check','Direct Debit'])); //0 = open, 1 = Reopen, 2 = close
|
||||||
|
|
||||||
|
define("CONTACT_PHOTO", "contact_photo/");//latest
|
||||||
|
define("CMSUSER_LOGO", "cmsuser_logo/");//latest
|
||||||
|
|
||||||
|
define("PROJECT_RATE_TYPE", json_encode(['Fixed price','Rate per hour','Subscription pricing']));
|
||||||
|
// we have 4 types of user & they can log in separately
|
||||||
|
define('CMS_USER_INDICATOR',1);
|
||||||
|
define('CONTACT_USER_INDICATOR',3);
|
||||||
|
define('CRM_USER_INDICATOR',2);
|
||||||
|
define('STAF_USER_INDICATOR',4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define('CSV_HEADING', json_encode(['Id','First Name','Last Name',
|
||||||
|
'Address','City','State',
|
||||||
|
'ZIP Code','CR D.O.B','Send Credential',
|
||||||
|
'Password','Email','Phone',
|
||||||
|
'CR CRA Report','CR First Name',
|
||||||
|
'CR Last Name','CR Street No','CR Street Name',
|
||||||
|
'CR City','CR State','CR Credit Bureau Address',
|
||||||
|
'CR Social Security No','CR Sincerely','CR Credit Company Name',
|
||||||
|
'CR Credit Company username','CR Credit Company Password'
|
||||||
|
]));
|
||||||
|
|
||||||
|
define('TICKET_PRIORITY',['-1'=>'All','0'=>'Low','1'=>'Medium','2'=>'High','3'=>'Urgent','4'=>'Very Urgent']);
|
||||||
|
define('SUPPORT_EMAIL','support');
|
||||||
|
define('SUPPORT_TEAM_MAIL',json_encode(['','']));
|
||||||
|
define("SUPPORT_STATUS",json_encode(['All','Open','Closed'])); //2=closed,1=open,3=archieved,0=All
|
||||||
|
|
||||||
|
|
||||||
|
define('SUPPORT_STATUS_OPEN', 1);
|
||||||
|
define('SUPPORT_STATUS_CLOSED', 2);
|
||||||
|
define('SUPPORT_STATUS_ARCHIEVED', 3);
|
||||||
|
|
||||||
|
define('CLOSE_TICKET_TIME', 15); //15 days
|
||||||
|
define('ARCHIEVE_TICKET_TIME', 30); //30 days
|
||||||
|
define('SUPPORT_MESSAGE','support_reply');
|
||||||
|
define("SUPPORT_MEDIA_FILES", "media/companies/");
|
||||||
|
define('TICKET_ATTACHMENT_SIZE', 2097152);
|
||||||
|
define('CLOSE_TICKET', 'close_ticket');
|
||||||
|
|
||||||
|
define('GUEST_STATUS',json_encode(['Inactive','Active']));
|
||||||
|
define('REGISTRATION','registration'); //guest registration email template
|
||||||
|
define('ADMIN_EMAIL','');
|
||||||
|
define('GUEST_FORGOT_PASSWORD','guests_forgot_password'); // guest forgot password email template
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define("EMAIL_EXPORT_TYPE", 1);
|
||||||
|
define("DROPBOX_EXPORT_TYPE", 2);
|
||||||
|
define("GOOGLE_DRIVE_EXPORT_TYPE", 3);
|
||||||
|
define("ZAPIER_EXPORT_TYPE", 4);
|
||||||
|
define("RINGCENTRAL_EXPORT_TYPE", 5);
|
||||||
|
define("LETTER_STREAM_TYPE", 6);
|
||||||
|
define("ONE_DRIVE_TYPE", 7);
|
||||||
|
define("MEMBER_EXPORT_OPTIONS", [
|
||||||
|
EMAIL_EXPORT_TYPE=>['name'=>'Email'],
|
||||||
|
DROPBOX_EXPORT_TYPE=>['name'=>'Dropbox'],
|
||||||
|
GOOGLE_DRIVE_EXPORT_TYPE=>['name'=>'Google Drive'],
|
||||||
|
ZAPIER_EXPORT_TYPE=>['name'=>'Zapier'],
|
||||||
|
RINGCENTRAL_EXPORT_TYPE =>['name'=>'Ring Central'],
|
||||||
|
LETTER_STREAM_TYPE =>['name'=>'Letter Stream'],
|
||||||
|
ONE_DRIVE_TYPE =>['name'=>'One Drive']
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('ADMIN_TO_MEMBER_EMAIL_TEMPLATE', 'admintomembers');
|
||||||
|
define('PROJECT_DIR_NAME','html');
|
||||||
|
define('CUSTOMER_USER_GROUP_ID',11);
|
||||||
|
|
||||||
|
define("MEMBER_ACTIVE_INACTIVE_LIST", [
|
||||||
|
''=>'All',
|
||||||
|
'1'=>'Member',
|
||||||
|
'2'=>'Not Member',
|
||||||
|
]);
|
||||||
|
|
||||||
|
define("MEMBER_EXPORT_CSV_HEADING", ['id','Username','Email','Member','Stripe Customer','Phone','Created on']);
|
||||||
|
|
||||||
|
|
||||||
|
define("GUEST_ADMIN_REG_EMAIL_TEMPLATE","guest_registration_to_admin");
|
||||||
|
define("GUEST_DOWNLOAD_COUNT",5);
|
||||||
|
|
||||||
|
define("MEMBER_STATUS_LIST", [
|
||||||
|
'3'=>'All',
|
||||||
|
'1'=>'Active Member',
|
||||||
|
'2'=>'Inactive Member',
|
||||||
|
'4'=>'Trial User'
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
define('NEXT_SELECTION_NEAREST_DAY',3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define('CRM_USER_MAX_INSERT', 2);
|
||||||
|
define('AUTOMATION_ACTION_TYPES',['1'=>'Delete all','2'=>'Make pause','3'=>'Make one time','4'=>'Make recurring','5'=>'Send Later']);
|
||||||
|
|
||||||
|
define('CHAT_AFFILIATE_USER', 1);
|
||||||
|
define('CHAT_CLIENT_USER', 3);
|
||||||
|
define('CHAT_MEMBER_USER', 2);
|
||||||
|
define('AGREEMENT_STATUS',['1'=>'Active','2'=>'Inactive']);
|
||||||
|
define('AUTHORIZE_DOT_NET_TYPE', 1);
|
||||||
|
|
||||||
|
|
||||||
|
define('AGREEMENT_ACTION_TYPES', ['1'=>'Delete all','2'=>'Make all active','3'=>'Make all inactive']);
|
||||||
|
define('PUBLIC_RECORD_DROPDOWN_INFO', ['Chapter 7'=>'Chapter 7','Chapter 13'=>'Chapter 13','Chapter 11'=>'Chapter 11','Tax Lien'=>'Tax Lien']);
|
||||||
|
|
||||||
|
define('INVOICE_CONTROLLER_ID', 4);
|
||||||
|
define('PROFILE_IMAGE_SIZE',['height'=>600,'width'=>500]);
|
||||||
|
define('LOGO_SIZE',['height'=>1372,'width'=>2527]);
|
||||||
|
|
||||||
|
define('SETUP_MESSAGE_STATUS',['1'=>'Active','2'=>'Inactive']);
|
||||||
|
|
||||||
|
|
||||||
|
define('GUEST_REMINDER_EMAIL_TEMPLATE','guest_reminder_email');
|
||||||
|
define('CLIENT_MESSAGE_EMAIL_TEMPLATE','client_message_email');
|
||||||
|
|
||||||
|
//client upload medias type id
|
||||||
|
define('IDENTIFICATION_IMAGE_ID',1);
|
||||||
|
define('MAIL_DOC_IMAGE_ID',2);
|
||||||
|
define('SSN_IMAGE_ID',3);
|
||||||
|
define('STATE_PHOTO_IMAGE_ID',4);
|
||||||
|
define('NOTARIZED_LETTER_IMAGE_ID',5);
|
||||||
|
define('CR_REPORT_IMAGE_ID',6);
|
||||||
|
define('TROUBLE_MARK_FILE_IMAGE_ID',7);
|
||||||
|
define('ITEM_CHALLENGE_FILE_IMAGE_ID',8);
|
||||||
|
|
||||||
|
|
||||||
|
define('SOFTWARE_VERSION_STATUS',['1'=>'Active','2'=>'Inactive']);
|
||||||
|
|
||||||
|
define('SUPER_RTG_LS_FAX_PKG_ID',15);
|
||||||
|
|
||||||
|
define('AUTH_ID_FOR_DEPLOYMENT',[3,2]);
|
||||||
|
|
||||||
|
define('DEPLOYMENT_SUBMODULE_ID',3227);
|
||||||
|
|
||||||
|
define('SETUP_EMAIL_ACTION_TYPES', ['1'=>'Delete all','2'=>'Send Email']);
|
||||||
|
|
||||||
|
define('EMAIL_SENT_OUT_LIST_TYPE', 1);
|
||||||
|
define('EMAIL_TEMPLATE_LIST_TYPE', 2);
|
||||||
|
define('EMAIL_CAMPAIGN_LIST_TYPE', 3);
|
||||||
|
define('EMAIL_CAMPAIGN_SENTOUT_LIST_TYPE', 4);
|
||||||
|
|
||||||
|
define('SETUP_EMAIL_ACTION_LIST_TYPES', [
|
||||||
|
EMAIL_SENT_OUT_LIST_TYPE=>'Email Sent out List',
|
||||||
|
EMAIL_TEMPLATE_LIST_TYPE=>'Template List',
|
||||||
|
EMAIL_CAMPAIGN_LIST_TYPE=>'Campaign List',
|
||||||
|
EMAIL_CAMPAIGN_SENTOUT_LIST_TYPE=>'Campaign Sent out List',
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('EMAIL_CAMPAIGN_STATUS', ['1'=>'Active','2'=>'Inactive']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define('CRA_ACCOUNT__ANALYSIS','[ACCOUNT_ANALYSIS]');
|
||||||
|
define('CRA_SUMMARY_HTML','[SUMMARY_HTML]');
|
||||||
|
define('CRA_CREDIT_SCORE','[CREDIT_SCORE]');
|
||||||
|
define('CRA_PUBLIC_RECORD','[PUBLIC_RECORD]');
|
||||||
|
define('CRA_INQUIRES','[INQUIRES]');
|
||||||
|
define('CRA_INQUIRES_COUNT','[INQUIRES_COUNT]');
|
||||||
|
define('CRA_CREDIT_UTILIZATION','[CREDIT_UTILIZATION]');
|
||||||
|
define('CRA_CREDIT_UTILIZATION_SUMMARY','[CREDIT_UTILIZATION_SUMMARY]');
|
||||||
|
define('CRA_DEROGETORY','[DEROGETORY]');
|
||||||
|
define('CRA_PUBLIC_RECORD_COUNT','[PUBLIC_RECORD_COUNT]');
|
||||||
|
define('CRA_PERSONAL_INFO','[PERSONAL_INFORMATION]');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define('CLIENT_PORTAL_DOMAIN','https://www.learninghub.com/');
|
||||||
|
define('CLIENT_PORTAL_FAVICON','images/favicon/lock_favicon.ico');
|
||||||
|
define('CLIENT_PORTAL_LOGO','/images/logo/favicon.ico');
|
||||||
|
define('CLIENT_PORTAL_DEFAULT_HEADER','Secure Client Portal');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define('CREDIT_ANALYSIS_EMAIL_SUB','Congratulations! Your Credit Analysis is Ready');
|
||||||
|
define('CREDIT_ANALYSIS_EMAIL_BODY','Congratulations! Your Credit Analysis is Ready to View Below. Please contact us if you have any further questions');
|
||||||
|
|
||||||
|
define('CREDIT_ANALYZER_EMAIL_SUB','Congratulations! Your Credit Analyzer is Ready');
|
||||||
|
define('CREDIT_ANALYZER_EMAIL_BODY','Congratulations! Your Credit Analyzer is Ready to View Below. Please contact us if you have any further questions');
|
||||||
|
|
||||||
|
define('LIMITED_VERSION_EXCEED_MESSAGE','OOPS! You have exceeded your #_LIMITED_VERSION_CLIENT_COUNT_# Person Access Limit, If you would like to Add more People Please contact Us At 614-547-6222.');
|
||||||
|
|
||||||
|
define('SAME_AS_BY', 'same_as_by');
|
||||||
|
define('LIMITED_VERSION_PKG_ID', 16);
|
||||||
|
|
||||||
|
|
||||||
|
define('USER_TYPE_DROPDOW_LIST',['1'=>'Everyone','2'=>'Me','3'=>'Team Member','4'=>'Client']);
|
||||||
|
|
||||||
|
define('LIMITED_TIME_PKG_ID', 17);
|
||||||
|
define('LIMITED_TIME_PKG_MESSAGE',
|
||||||
|
'Your #_DAYS_#'
|
||||||
|
.' days has expired, you are now ready to upgrade to the '
|
||||||
|
. 'full version of Clickletters. Please contact our customer support '
|
||||||
|
. 'team at 614-547-622 for more assistance.');
|
||||||
|
|
||||||
|
|
||||||
|
define('CLIENT_ACTION_TYPES', ['1'=>'Delete all','2'=>'Make all Active','3'=>'Make all Inactive','4'=>'Make All Graduated/Completed','5'=>'Export All']);
|
||||||
|
|
||||||
|
define('AUTOMATION_WARRING',"This letter has automations and by deleting this account all automations will also be deleted do you want to continue ?");
|
||||||
|
|
||||||
|
|
||||||
|
define('CLIENT_POPUPS_LIST',[
|
||||||
|
'1'=>'Image',
|
||||||
|
'2'=>'Video',
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('MESSAGE_LENGTH',1000); // for client message limit.
|
||||||
|
define('LETTER_COUNT_MESSAGE','#_maxlength_# character limit, #_remlength_# remaining.');
|
||||||
|
|
||||||
|
define('EMPLOYEE_USER_TYPE_DROPDOW_LIST',['1'=>'Everyone','2'=>'Me','4'=>'Client']);
|
||||||
|
|
||||||
|
define('MEMBER_EMPLOYEE_MESSAGE_TO_CLIENT','Customer Support');
|
||||||
|
|
||||||
|
define('NEXT_DATE_INTERVAL_DAYS',['15'=>'15 days','21'=>'21 days','45'=>'45 days','65'=>'65 days']);
|
||||||
|
|
||||||
|
define('UPLOAD_MEDIA_SIZE', 1048576*3);//1MB = 1048576bytes
|
||||||
|
define('UPLOAD_MEDIA_WIDTH', 900);
|
||||||
|
define('UPLOAD_MEDIA_HEIGHT', 500);
|
||||||
|
define('UPLOAD_CLIENT_MEDIA_SIZE',UPLOAD_MEDIA_SIZE/1048576); // Size in MB
|
||||||
|
define('UPLOAD_MEDIA_MESSAGE', 'Please keep upload image size less than '.UPLOAD_CLIENT_MEDIA_SIZE.'MB and proportion '.UPLOAD_MEDIA_WIDTH.' X '.UPLOAD_MEDIA_HEIGHT);
|
||||||
|
define('NOTE_CHAR_LENGTH',2000);
|
||||||
|
|
||||||
|
|
||||||
|
define('CLIENT_SEND_EMAIL_ACTION_TYPES', ['1'=>'Delete all']);
|
||||||
|
define('QUEUE_MONITOR_USER_EMAIL',['']);
|
||||||
|
|
||||||
|
|
||||||
|
define('EPIVELOCITY_FOR_EMPLOYEES_PKG_ID',20);
|
||||||
|
define('RTG_FOR_EMPLOYEES_PKG_ID',21);
|
||||||
|
|
||||||
|
define('DATE_SELECTION_BY_DAYS',[
|
||||||
|
'15'=>'15 days',
|
||||||
|
'21'=>'21 days',
|
||||||
|
'30'=>'30 days',
|
||||||
|
'45'=>'45 days',
|
||||||
|
'60'=>'60 days',
|
||||||
|
'65'=>'65 days',
|
||||||
|
'90'=>'90 days',
|
||||||
|
'180'=>'180 days',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
define('VIDEO_SETTINGS_STATUS',['1'=>'Active','0'=>'Inactive']);
|
||||||
|
|
||||||
|
|
||||||
|
define('COPY_RIGHT_YEAR','2025');
|
||||||
|
define('CLIENT_PORTAL_DEFAULT_FOOTER','Secure SSL Area | This website is protected by secure portal © '.COPY_RIGHT_YEAR.' All rights reserved.');
|
||||||
|
define('UPGRADE_BUTTON_ALERT_TEXT', 'Please contact customer support for details to upgrade your account (614-547-6222)');
|
||||||
|
|
||||||
|
define('MAIN_DOMAIN_FOOTER','<strong>Secure SSL Area | This website is protected by secure portal © '.COPY_RIGHT_YEAR.' <a href="https://www.lslh.org.uk/" target="_blank">londonschooloflearninghub</a>. </strong> All rights reserved.');
|
||||||
|
define("STUDENT_TITLE", json_encode(["Mr","Ms","Mrs","Miss","Dr"]));
|
||||||
|
define("DAYS", json_encode(["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"]));
|
||||||
|
define("MONTHS", [ "01" => "January","02" =>"February",
|
||||||
|
"03"=>"March","04" =>"April",
|
||||||
|
"05"=>"May","06" => "June",
|
||||||
|
"07" => "July","08" => "August",
|
||||||
|
"09" => "September","10" => "October",
|
||||||
|
"11" => "November","12" => "December"]);
|
||||||
|
|
||||||
|
define("STUDENT_GENDER", json_encode(["Male","Female","Others"]));
|
||||||
|
|
||||||
|
define("COUNTRIES", [
|
||||||
|
'Afghanistan' => 'Afghanistan',
|
||||||
|
'Åland Islands' => 'Åland Islands',
|
||||||
|
'Albania' => 'Albania',
|
||||||
|
'Algeria' => 'Algeria',
|
||||||
|
'American Samoa' => 'American Samoa',
|
||||||
|
'Andorra' => 'Andorra',
|
||||||
|
'Angola' => 'Angola',
|
||||||
|
'Anguilla' => 'Anguilla',
|
||||||
|
'Antarctica' => 'Antarctica',
|
||||||
|
'Antigua and Barbuda' => 'Antigua and Barbuda',
|
||||||
|
'Argentina' => 'Argentina',
|
||||||
|
'Armenia' => 'Armenia',
|
||||||
|
'Aruba' => 'Aruba',
|
||||||
|
'Australia' => 'Australia',
|
||||||
|
'Austria' => 'Austria',
|
||||||
|
'Azerbaijan' => 'Azerbaijan',
|
||||||
|
'Bahamas' => 'Bahamas',
|
||||||
|
'Bahrain' => 'Bahrain',
|
||||||
|
'Bangladesh' => 'Bangladesh',
|
||||||
|
'Barbados' => 'Barbados',
|
||||||
|
'Belarus' => 'Belarus',
|
||||||
|
'Belgium' => 'Belgium',
|
||||||
|
'Belize' => 'Belize',
|
||||||
|
'Benin' => 'Benin',
|
||||||
|
'Bermuda' => 'Bermuda',
|
||||||
|
'Bhutan' => 'Bhutan',
|
||||||
|
'Bolivia' => 'Bolivia',
|
||||||
|
'Bosnia and Herzegovina' => 'Bosnia and Herzegovina',
|
||||||
|
'Botswana' => 'Botswana',
|
||||||
|
'Bouvet Island' => 'Bouvet Island',
|
||||||
|
'Brazil' => 'Brazil',
|
||||||
|
'British Indian Ocean Territory' => 'British Indian Ocean Territory',
|
||||||
|
'Brunei Darussalam' => 'Brunei Darussalam',
|
||||||
|
'Bulgaria' => 'Bulgaria',
|
||||||
|
'Burkina Faso' => 'Burkina Faso',
|
||||||
|
'Burundi' => 'Burundi',
|
||||||
|
'Cambodia' => 'Cambodia',
|
||||||
|
'Cameroon' => 'Cameroon',
|
||||||
|
'Canada' => 'Canada',
|
||||||
|
'Cape Verde' => 'Cape Verde',
|
||||||
|
'Cayman Islands' => 'Cayman Islands',
|
||||||
|
'Central African Republic' => 'Central African Republic',
|
||||||
|
'Chad' => 'Chad',
|
||||||
|
'Chile' => 'Chile',
|
||||||
|
'China' => 'China',
|
||||||
|
'Christmas Island' => 'Christmas Island',
|
||||||
|
'Cocos (Keeling) Islands' => 'Cocos (Keeling) Islands',
|
||||||
|
'Colombia' => 'Colombia',
|
||||||
|
'Comoros' => 'Comoros',
|
||||||
|
'Congo' => 'Congo',
|
||||||
|
'Congo, The Democratic Republic of The' => 'Congo, The Democratic Republic of The',
|
||||||
|
'Cook Islands' => 'Cook Islands',
|
||||||
|
'Costa Rica' => 'Costa Rica',
|
||||||
|
'Cote D\'ivoire' => 'Cote D\'ivoire',
|
||||||
|
'Croatia' => 'Croatia',
|
||||||
|
'Cuba' => 'Cuba',
|
||||||
|
'Cyprus' => 'Cyprus',
|
||||||
|
'Czech Republic' => 'Czech Republic',
|
||||||
|
'Denmark' => 'Denmark',
|
||||||
|
'Djibouti' => 'Djibouti',
|
||||||
|
'Dominica' => 'Dominica',
|
||||||
|
'Dominican Republic' => 'Dominican Republic',
|
||||||
|
'Ecuador' => 'Ecuador',
|
||||||
|
'Egypt' => 'Egypt',
|
||||||
|
'El Salvador' => 'El Salvador',
|
||||||
|
'Equatorial Guinea' => 'Equatorial Guinea',
|
||||||
|
'Eritrea' => 'Eritrea',
|
||||||
|
'Estonia' => 'Estonia',
|
||||||
|
'Ethiopia' => 'Ethiopia',
|
||||||
|
'Falkland Islands (Malvinas)' => 'Falkland Islands (Malvinas)',
|
||||||
|
'Faroe Islands' => 'Faroe Islands',
|
||||||
|
'Fiji' => 'Fiji',
|
||||||
|
'Finland' => 'Finland',
|
||||||
|
'France' => 'France',
|
||||||
|
'French Guiana' => 'French Guiana',
|
||||||
|
'French Polynesia' => 'French Polynesia',
|
||||||
|
'French Southern Territories' => 'French Southern Territories',
|
||||||
|
'Gabon' => 'Gabon',
|
||||||
|
'Gambia' => 'Gambia',
|
||||||
|
'Georgia' => 'Georgia',
|
||||||
|
'Germany' => 'Germany',
|
||||||
|
'Ghana' => 'Ghana',
|
||||||
|
'Gibraltar' => 'Gibraltar',
|
||||||
|
'Greece' => 'Greece',
|
||||||
|
'Greenland' => 'Greenland',
|
||||||
|
'Grenada' => 'Grenada',
|
||||||
|
'Guadeloupe' => 'Guadeloupe',
|
||||||
|
'Guam' => 'Guam',
|
||||||
|
'Guatemala' => 'Guatemala',
|
||||||
|
'Guernsey' => 'Guernsey',
|
||||||
|
'Guinea' => 'Guinea',
|
||||||
|
'Guinea-bissau' => 'Guinea-bissau',
|
||||||
|
'Guyana' => 'Guyana',
|
||||||
|
'Haiti' => 'Haiti',
|
||||||
|
'Heard Island and Mcdonald Islands' => 'Heard Island and Mcdonald Islands',
|
||||||
|
'Holy See (Vatican City State)' => 'Holy See (Vatican City State)',
|
||||||
|
'Honduras' => 'Honduras',
|
||||||
|
'Hong Kong' => 'Hong Kong',
|
||||||
|
'Hungary' => 'Hungary',
|
||||||
|
'Iceland' => 'Iceland',
|
||||||
|
'India' => 'India',
|
||||||
|
'Indonesia' => 'Indonesia',
|
||||||
|
'Iran, Islamic Republic of' => 'Iran, Islamic Republic of',
|
||||||
|
'Iraq' => 'Iraq',
|
||||||
|
'Ireland' => 'Ireland',
|
||||||
|
'Isle of Man' => 'Isle of Man',
|
||||||
|
'Israel' => 'Israel',
|
||||||
|
'Italy' => 'Italy',
|
||||||
|
'Jamaica' => 'Jamaica',
|
||||||
|
'Japan' => 'Japan',
|
||||||
|
'Jersey' => 'Jersey',
|
||||||
|
'Jordan' => 'Jordan',
|
||||||
|
'Kazakhstan' => 'Kazakhstan',
|
||||||
|
'Kenya' => 'Kenya',
|
||||||
|
'Kiribati' => 'Kiribati',
|
||||||
|
'Korea, Democratic People\'s Republic of' => 'Korea, Democratic People\'s Republic of',
|
||||||
|
'Korea, Republic of' => 'Korea, Republic of',
|
||||||
|
'Kuwait' => 'Kuwait',
|
||||||
|
'Kyrgyzstan' => 'Kyrgyzstan',
|
||||||
|
'Lao People\'s Democratic Republic' => 'Lao People\'s Democratic Republic',
|
||||||
|
'Latvia' => 'Latvia',
|
||||||
|
'Lebanon' => 'Lebanon',
|
||||||
|
'Lesotho' => 'Lesotho',
|
||||||
|
'Liberia' => 'Liberia',
|
||||||
|
'Libyan Arab Jamahiriya' => 'Libyan Arab Jamahiriya',
|
||||||
|
'Liechtenstein' => 'Liechtenstein',
|
||||||
|
'Lithuania' => 'Lithuania',
|
||||||
|
'Luxembourg' => 'Luxembourg',
|
||||||
|
'Macao' => 'Macao',
|
||||||
|
'Macedonia, The Former Yugoslav Republic of' => 'Macedonia, The Former Yugoslav Republic of',
|
||||||
|
'Madagascar' => 'Madagascar',
|
||||||
|
'Malawi' => 'Malawi',
|
||||||
|
'Malaysia' => 'Malaysia',
|
||||||
|
'Maldives' => 'Maldives',
|
||||||
|
'Mali' => 'Mali',
|
||||||
|
'Malta' => 'Malta',
|
||||||
|
'Marshall Islands' => 'Marshall Islands',
|
||||||
|
'Martinique' => 'Martinique',
|
||||||
|
'Mauritania' => 'Mauritania',
|
||||||
|
'Mauritius' => 'Mauritius',
|
||||||
|
'Mayotte' => 'Mayotte',
|
||||||
|
'Mexico' => 'Mexico',
|
||||||
|
'Micronesia, Federated States of' => 'Micronesia, Federated States of',
|
||||||
|
'Moldova, Republic of' => 'Moldova, Republic of',
|
||||||
|
'Monaco' => 'Monaco',
|
||||||
|
'Mongolia' => 'Mongolia',
|
||||||
|
'Montenegro' => 'Montenegro',
|
||||||
|
'Montserrat' => 'Montserrat',
|
||||||
|
'Morocco' => 'Morocco',
|
||||||
|
'Mozambique' => 'Mozambique',
|
||||||
|
'Myanmar' => 'Myanmar',
|
||||||
|
'Namibia' => 'Namibia',
|
||||||
|
'Nauru' => 'Nauru',
|
||||||
|
'Nepal' => 'Nepal',
|
||||||
|
'Netherlands' => 'Netherlands',
|
||||||
|
'Netherlands Antilles' => 'Netherlands Antilles',
|
||||||
|
'New Caledonia' => 'New Caledonia',
|
||||||
|
'New Zealand' => 'New Zealand',
|
||||||
|
'Nicaragua' => 'Nicaragua',
|
||||||
|
'Niger' => 'Niger',
|
||||||
|
'Nigeria' => 'Nigeria',
|
||||||
|
'Niue' => 'Niue',
|
||||||
|
'Norfolk Island' => 'Norfolk Island',
|
||||||
|
'Northern Mariana Islands' => 'Northern Mariana Islands',
|
||||||
|
'Norway' => 'Norway',
|
||||||
|
'Oman' => 'Oman',
|
||||||
|
'Pakistan' => 'Pakistan',
|
||||||
|
'Palau' => 'Palau',
|
||||||
|
'Palestinian Territory, Occupied' => 'Palestinian Territory, Occupied',
|
||||||
|
'Panama' => 'Panama',
|
||||||
|
'Papua New Guinea' => 'Papua New Guinea',
|
||||||
|
'Paraguay' => 'Paraguay',
|
||||||
|
'Peru' => 'Peru',
|
||||||
|
'Philippines' => 'Philippines',
|
||||||
|
'Pitcairn' => 'Pitcairn',
|
||||||
|
'Poland' => 'Poland',
|
||||||
|
'Portugal' => 'Portugal',
|
||||||
|
'Puerto Rico' => 'Puerto Rico',
|
||||||
|
'Qatar' => 'Qatar',
|
||||||
|
'Reunion' => 'Reunion',
|
||||||
|
'Romania' => 'Romania',
|
||||||
|
'Russian Federation' => 'Russian Federation',
|
||||||
|
'Rwanda' => 'Rwanda',
|
||||||
|
'Saint Helena' => 'Saint Helena',
|
||||||
|
'Saint Kitts and Nevis' => 'Saint Kitts and Nevis',
|
||||||
|
'Saint Lucia' => 'Saint Lucia',
|
||||||
|
'Saint Pierre and Miquelon' => 'Saint Pierre and Miquelon',
|
||||||
|
'Saint Vincent and The Grenadines' => 'Saint Vincent and The Grenadines',
|
||||||
|
'Samoa' => 'Samoa',
|
||||||
|
'San Marino' => 'San Marino',
|
||||||
|
'Sao Tome and Principe' => 'Sao Tome and Principe',
|
||||||
|
'Saudi Arabia' => 'Saudi Arabia',
|
||||||
|
'Senegal' => 'Senegal',
|
||||||
|
'Serbia' => 'Serbia',
|
||||||
|
'Seychelles' => 'Seychelles',
|
||||||
|
'Sierra Leone' => 'Sierra Leone',
|
||||||
|
'Singapore' => 'Singapore',
|
||||||
|
'Slovakia' => 'Slovakia',
|
||||||
|
'Slovenia' => 'Slovenia',
|
||||||
|
'Solomon Islands' => 'Solomon Islands',
|
||||||
|
'Somalia' => 'Somalia',
|
||||||
|
'South Africa' => 'South Africa',
|
||||||
|
'South Georgia and The South Sandwich Islands' => 'South Georgia and The South Sandwich Islands',
|
||||||
|
'Spain' => 'Spain',
|
||||||
|
'Sri Lanka' => 'Sri Lanka',
|
||||||
|
'Sudan' => 'Sudan',
|
||||||
|
'Suriname' => 'Suriname',
|
||||||
|
'Svalbard and Jan Mayen' => 'Svalbard and Jan Mayen',
|
||||||
|
'Swaziland' => 'Swaziland',
|
||||||
|
'Sweden' => 'Sweden',
|
||||||
|
'Switzerland' => 'Switzerland',
|
||||||
|
'Syrian Arab Republic' => 'Syrian Arab Republic',
|
||||||
|
'Taiwan' => 'Taiwan',
|
||||||
|
'Tajikistan' => 'Tajikistan',
|
||||||
|
'Tanzania, United Republic of' => 'Tanzania, United Republic of',
|
||||||
|
'Thailand' => 'Thailand',
|
||||||
|
'Timor-leste' => 'Timor-leste',
|
||||||
|
'Togo' => 'Togo',
|
||||||
|
'Tokelau' => 'Tokelau',
|
||||||
|
'Tonga' => 'Tonga',
|
||||||
|
'Trinidad and Tobago' => 'Trinidad and Tobago',
|
||||||
|
'Tunisia' => 'Tunisia',
|
||||||
|
'Turkey' => 'Turkey',
|
||||||
|
'Turkmenistan' => 'Turkmenistan',
|
||||||
|
'Turks and Caicos Islands' => 'Turks and Caicos Islands',
|
||||||
|
'Tuvalu' => 'Tuvalu',
|
||||||
|
'Uganda' => 'Uganda',
|
||||||
|
'Ukraine' => 'Ukraine',
|
||||||
|
'United Arab Emirates' => 'United Arab Emirates',
|
||||||
|
'United Kingdom' => 'United Kingdom',
|
||||||
|
'United States' => 'United States',
|
||||||
|
'United States Minor Outlying Islands' => 'United States Minor Outlying Islands',
|
||||||
|
'Uruguay' => 'Uruguay',
|
||||||
|
'Uzbekistan' => 'Uzbekistan',
|
||||||
|
'Vanuatu' => 'Vanuatu',
|
||||||
|
'Venezuela' => 'Venezuela',
|
||||||
|
'Viet Nam' => 'Viet Nam',
|
||||||
|
'Virgin Islands, British' => 'Virgin Islands, British',
|
||||||
|
'Virgin Islands, U.S.' => 'Virgin Islands, U.S.',
|
||||||
|
'Wallis and Futuna' => 'Wallis and Futuna',
|
||||||
|
'Western Sahara' => 'Western Sahara',
|
||||||
|
'Yemen' => 'Yemen',
|
||||||
|
'Zambia' => 'Zambia',
|
||||||
|
'Zimbabwe' => 'Zimbabwe'
|
||||||
|
]);
|
||||||
|
|
||||||
|
define("FEED_BACK_STATUS",json_encode(['Pending','Resolved','Closed']));
|
||||||
|
|
||||||
|
define("ADMIN_EMAIL_LEARNING_HUB","admissions@lslh.org.uk");
|
||||||
|
|
||||||
|
define("IS_MANDATORY",['1' => 'Required', '0' => 'Not Required']);
|
||||||
|
|
||||||
|
define('FORM_SEQUENCE',[
|
||||||
|
'1' => 'First',
|
||||||
|
'2' => 'Second',
|
||||||
|
'3' => 'Third',
|
||||||
|
'4' => 'Fourth',
|
||||||
|
'5' => 'Fifth',
|
||||||
|
'6' => 'Sixth',
|
||||||
|
'7' => 'Seventh'
|
||||||
|
]);
|
||||||
|
|
||||||
|
define("AVOID_FROM_REPORT",["id","Date","student_id","status","current_checklist_id","created_by","updated_by","created_at","updated_at", "created_by_id","updated_by_id","emergency_contact_name", "emergency_contact_relation", "emergency_contact_email", "emergency_contact_phone_number", "education_name1", "education_year1", "education_institution1", "education_name2", "education_year2", "education_institution2", "education_name3", "education_year3" ,"education_institution3" ,"employer_name", "position"]);
|
||||||
|
|
||||||
|
define('ALL_REPORT_TABLES',[
|
||||||
|
'Students' => 'Student',
|
||||||
|
'Courses' => 'Course',
|
||||||
|
'Sessions' => 'Session',
|
||||||
|
'RegistrationPayments' => 'Registration Payment',
|
||||||
|
'PassportDetails' => 'Passport Detail'
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('FIXED_REPORT_VARIABLE',[
|
||||||
|
'Current Date' => FrozenTime::now()->format('jS F Y'),
|
||||||
|
'Provider' => "London School of Learning Hub",
|
||||||
|
'Bank Account Title' => 'London School of Learning Hub',
|
||||||
|
'Bank SortCode' =>'60-01-38',
|
||||||
|
'Bank AccountNo' => '53619404',
|
||||||
|
'Bank IBAN_NO' => 'GB98 NWBK 6001 3853 6194 04',
|
||||||
|
'Bank SWIFT-BIC'=> 'NWBKGB2L',
|
||||||
|
'Admin Email' => 'admissions@lslh.org.uk',
|
||||||
|
'Phone Number' => '+44-02034887793',
|
||||||
|
'Office Address' => '160 London Road Jhumat house, Barking IG11 8BB',
|
||||||
|
'ASIC Accreditation No' => 'AS90940/1121',
|
||||||
|
'Admission Officer' => 'Ms. Agata Pawlowska',
|
||||||
|
'Verification link' => 'https://www.lslh.org.uk/verification'
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('VISA_TYPE',[
|
||||||
|
'student-visa' => 'Student Visa',
|
||||||
|
'child-study-visa' => "Child Student Visa",
|
||||||
|
'visa-to-study-english' => 'Short-term study visa',
|
||||||
|
'standard-visitor' =>'Visit the UK as a Standard Visitor'
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('DECIMAL_COLUMN',[
|
||||||
|
'registration_fee',
|
||||||
|
'tuition_fees',
|
||||||
|
'total_fees_paid',
|
||||||
|
'total_fees' ,
|
||||||
|
'outstanding_fees' ,
|
||||||
|
'total_fees' ,
|
||||||
|
'living_costs'
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('STUDY_MOD',[
|
||||||
|
'1' => 'Full-time',
|
||||||
|
'2' => "Part-time",
|
||||||
|
'3' => 'Online/Distance Learning',
|
||||||
|
'4' =>'Blended Learning'
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('OFFER_LETTER_TYPE',[
|
||||||
|
'1' => 'Offer Letter',
|
||||||
|
'2' => "Conditional Offer Letter"
|
||||||
|
]);
|
||||||
|
|
||||||
|
define('DEFAULT_USER_PASSWORD','12345678');
|
||||||
|
|
||||||
|
define('USER_TYPE',['ADMINISTRATOR'=>'0','STUDENT'=>'1']);
|
||||||
|
|
||||||
|
define('DEFAULT_STUDENT_USER_GROUP',14);
|
||||||
|
define('COURSE_SEMESTER_ID',1);
|
||||||
|
|
||||||
|
//define('NOTIFICATION_TYPE',['EMAIL'=>'email','SMS'=>'sms']);
|
||||||
|
//define('PAYMENT_METHOD',['BKASH'=>'bkash','NMI'=>'nmi']);
|
||||||
|
|
||||||
|
define('AVAILABILITY_TYPE',['1'=>'UK and International','2'=>'UK']);
|
||||||
|
define('DELIVERY_MODE',[1 => 'Online', 2 => 'Blended', 3 => 'Both']);
|
||||||
|
|
||||||
|
define('ACCREDITATION_STATUS', [
|
||||||
|
1 => 'Accredited',
|
||||||
|
2 => 'Under Review'
|
||||||
|
]);
|
||||||
|
define('ENGLISH_COURSE_CATEGORY_ID',2);
|
||||||
|
|
||||||
|
?>
|
||||||
326
config/app.default.php
Normal file
326
config/app.default.php
Normal file
@@ -0,0 +1,326 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
/**
|
||||||
|
* Debug Level:
|
||||||
|
*
|
||||||
|
* Production Mode:
|
||||||
|
* false: No error messages, errors, or warnings shown.
|
||||||
|
*
|
||||||
|
* Development Mode:
|
||||||
|
* true: Errors and warnings shown.
|
||||||
|
*/
|
||||||
|
'debug' => true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure basic information about the application.
|
||||||
|
*
|
||||||
|
* - namespace - The namespace to find app classes under.
|
||||||
|
* - encoding - The encoding used for HTML + database connections.
|
||||||
|
* - base - The base directory the app resides in. If false this
|
||||||
|
* will be auto detected.
|
||||||
|
* - dir - Name of app directory.
|
||||||
|
* - webroot - The webroot directory.
|
||||||
|
* - wwwRoot - The file path to webroot.
|
||||||
|
* - baseUrl - To configure CakePHP to *not* use mod_rewrite and to
|
||||||
|
* use CakePHP pretty URLs, remove these .htaccess
|
||||||
|
* files:
|
||||||
|
* /.htaccess
|
||||||
|
* /webroot/.htaccess
|
||||||
|
* And uncomment the baseUrl key below.
|
||||||
|
* - fullBaseUrl - A base URL to use for absolute links.
|
||||||
|
* - imageBaseUrl - Web path to the public images directory under webroot.
|
||||||
|
* - cssBaseUrl - Web path to the public css directory under webroot.
|
||||||
|
* - jsBaseUrl - Web path to the public js directory under webroot.
|
||||||
|
* - paths - Configure paths for non class based resources. Supports the
|
||||||
|
* `plugins`, `templates`, `locales` subkeys, which allow the definition of
|
||||||
|
* paths for plugins, view templates and locale files respectively.
|
||||||
|
*/
|
||||||
|
'App' => [
|
||||||
|
'namespace' => 'App',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'base' => false,
|
||||||
|
'dir' => 'src',
|
||||||
|
'webroot' => 'webroot',
|
||||||
|
'wwwRoot' => WWW_ROOT,
|
||||||
|
// 'baseUrl' => env('SCRIPT_NAME'),
|
||||||
|
'fullBaseUrl' => false,
|
||||||
|
'imageBaseUrl' => 'img/',
|
||||||
|
'cssBaseUrl' => 'css/',
|
||||||
|
'jsBaseUrl' => 'js/',
|
||||||
|
'paths' => [
|
||||||
|
'plugins' => [ROOT . DS . 'plugins' . DS],
|
||||||
|
'templates' => [APP . 'Template' . DS],
|
||||||
|
'locales' => [APP . 'Locale' . DS],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Security and encryption configuration
|
||||||
|
*
|
||||||
|
* - salt - A random string used in security hashing methods.
|
||||||
|
* The salt value is also used as the encryption key.
|
||||||
|
* You should treat it as extremely sensitive data.
|
||||||
|
*/
|
||||||
|
'Security' => [
|
||||||
|
'salt' => '__SALT__',
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply timestamps with the last modified time to static assets (js, css, images).
|
||||||
|
* Will append a querystring parameter containing the time the file was modified.
|
||||||
|
* This is useful for busting browser caches.
|
||||||
|
*
|
||||||
|
* Set to true to apply timestamps when debug is true. Set to 'force' to always
|
||||||
|
* enable timestamping regardless of debug value.
|
||||||
|
*/
|
||||||
|
'Asset' => [
|
||||||
|
// 'timestamp' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the cache adapters.
|
||||||
|
*/
|
||||||
|
'Cache' => [
|
||||||
|
'default' => [
|
||||||
|
'className' => 'File',
|
||||||
|
'path' => CACHE,
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the cache used for general framework caching.
|
||||||
|
* Translation cache files are stored with this configuration.
|
||||||
|
*/
|
||||||
|
'_cake_core_' => [
|
||||||
|
'className' => 'File',
|
||||||
|
'prefix' => 'myapp_cake_core_',
|
||||||
|
'path' => CACHE . 'persistent/',
|
||||||
|
'serialize' => true,
|
||||||
|
'duration' => '+2 minutes',
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the cache for model and datasource caches. This cache
|
||||||
|
* configuration is used to store schema descriptions, and table listings
|
||||||
|
* in connections.
|
||||||
|
*/
|
||||||
|
'_cake_model_' => [
|
||||||
|
'className' => 'File',
|
||||||
|
'prefix' => 'myapp_cake_model_',
|
||||||
|
'path' => CACHE . 'models/',
|
||||||
|
'serialize' => true,
|
||||||
|
'duration' => '+2 minutes',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the Error and Exception handlers used by your application.
|
||||||
|
*
|
||||||
|
* By default errors are displayed using Debugger, when debug is true and logged
|
||||||
|
* by Cake\Log\Log when debug is false.
|
||||||
|
*
|
||||||
|
* In CLI environments exceptions will be printed to stderr with a backtrace.
|
||||||
|
* In web environments an HTML page will be displayed for the exception.
|
||||||
|
* With debug true, framework errors like Missing Controller will be displayed.
|
||||||
|
* When debug is false, framework errors will be coerced into generic HTTP errors.
|
||||||
|
*
|
||||||
|
* Options:
|
||||||
|
*
|
||||||
|
* - `errorLevel` - int - The level of errors you are interested in capturing.
|
||||||
|
* - `trace` - boolean - Whether or not backtraces should be included in
|
||||||
|
* logged errors/exceptions.
|
||||||
|
* - `log` - boolean - Whether or not you want exceptions logged.
|
||||||
|
* - `exceptionRenderer` - string - The class responsible for rendering
|
||||||
|
* uncaught exceptions. If you choose a custom class you should place
|
||||||
|
* the file for that class in src/Error. This class needs to implement a
|
||||||
|
* render method.
|
||||||
|
* - `skipLog` - array - List of exceptions to skip for logging. Exceptions that
|
||||||
|
* extend one of the listed exceptions will also be skipped for logging.
|
||||||
|
* E.g.:
|
||||||
|
* `'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']`
|
||||||
|
*/
|
||||||
|
'Error' => [
|
||||||
|
'errorLevel' => E_ALL & ~E_DEPRECATED,
|
||||||
|
'exceptionRenderer' => 'Cake\Error\ExceptionRenderer',
|
||||||
|
'skipLog' => [],
|
||||||
|
'log' => true,
|
||||||
|
'trace' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email configuration.
|
||||||
|
*
|
||||||
|
* By defining transports separately from delivery profiles you can easily
|
||||||
|
* re-use transport configuration across multiple profiles.
|
||||||
|
*
|
||||||
|
* You can specify multiple configurations for production, development and
|
||||||
|
* testing.
|
||||||
|
*
|
||||||
|
* Each transport needs a `className`. Valid options are as follows:
|
||||||
|
*
|
||||||
|
* Mail - Send using PHP mail function
|
||||||
|
* Smtp - Send using SMTP
|
||||||
|
* Debug - Do not send the email, just return the result
|
||||||
|
*
|
||||||
|
* You can add custom transports (or override existing transports) by adding the
|
||||||
|
* appropriate file to src/Mailer/Transport. Transports should be named
|
||||||
|
* 'YourTransport.php', where 'Your' is the name of the transport.
|
||||||
|
*/
|
||||||
|
'EmailTransport' => [
|
||||||
|
'default' => [
|
||||||
|
'className' => 'Mail',
|
||||||
|
// The following keys are used in SMTP transports
|
||||||
|
'host' => 'localhost',
|
||||||
|
'port' => 25,
|
||||||
|
'timeout' => 30,
|
||||||
|
'username' => 'root',
|
||||||
|
'password' => '',
|
||||||
|
'client' => null,
|
||||||
|
'tls' => null,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email delivery profiles
|
||||||
|
*
|
||||||
|
* Delivery profiles allow you to predefine various properties about email
|
||||||
|
* messages from your application and give the settings a name. This saves
|
||||||
|
* duplication across your application and makes maintenance and development
|
||||||
|
* easier. Each profile accepts a number of keys. See `Cake\Network\Email\Email`
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
'Email' => [
|
||||||
|
'default' => [
|
||||||
|
'transport' => 'default',
|
||||||
|
'from' => 'you@localhost',
|
||||||
|
//'charset' => 'utf-8',
|
||||||
|
//'headerCharset' => 'utf-8',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection information used by the ORM to connect
|
||||||
|
* to your application's datastores.
|
||||||
|
* Drivers include Mysql Postgres Sqlite Sqlserver
|
||||||
|
* See vendor\cakephp\cakephp\src\Database\Driver for complete list
|
||||||
|
*/
|
||||||
|
'Datasources' => [
|
||||||
|
'default' => [
|
||||||
|
'className' => 'Cake\Database\Connection',
|
||||||
|
'driver' => 'Cake\Database\Driver\Mysql',
|
||||||
|
'persistent' => false,
|
||||||
|
'host' => 'localhost',
|
||||||
|
/**
|
||||||
|
* CakePHP will use the default DB port based on the driver selected
|
||||||
|
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
|
||||||
|
* the following line and set the port accordingly
|
||||||
|
*/
|
||||||
|
//'port' => 'nonstandard_port_number',
|
||||||
|
'username' => 'my_app',
|
||||||
|
'password' => 'secret',
|
||||||
|
'database' => 'my_app',
|
||||||
|
'encoding' => 'utf8',
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
'cacheMetadata' => true,
|
||||||
|
'log' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set identifier quoting to true if you are using reserved words or
|
||||||
|
* special characters in your table or column names. Enabling this
|
||||||
|
* setting will result in queries built using the Query Builder having
|
||||||
|
* identifiers quoted when creating SQL. It should be noted that this
|
||||||
|
* decreases performance because each query needs to be traversed and
|
||||||
|
* manipulated before being executed.
|
||||||
|
*/
|
||||||
|
'quoteIdentifiers' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* During development, if using MySQL < 5.6, uncommenting the
|
||||||
|
* following line could boost the speed at which schema metadata is
|
||||||
|
* fetched from the database. It can also be set directly with the
|
||||||
|
* mysql configuration directive 'innodb_stats_on_metadata = 0'
|
||||||
|
* which is the recommended value in production environments
|
||||||
|
*/
|
||||||
|
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The test connection is used during the test suite.
|
||||||
|
*/
|
||||||
|
'test' => [
|
||||||
|
'className' => 'Cake\Database\Connection',
|
||||||
|
'driver' => 'Cake\Database\Driver\Mysql',
|
||||||
|
'persistent' => false,
|
||||||
|
'host' => 'localhost',
|
||||||
|
//'port' => 'nonstandard_port_number',
|
||||||
|
'username' => 'my_app',
|
||||||
|
'password' => 'secret',
|
||||||
|
'database' => 'test_myapp',
|
||||||
|
'encoding' => 'utf8',
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
'cacheMetadata' => true,
|
||||||
|
'quoteIdentifiers' => false,
|
||||||
|
'log' => false,
|
||||||
|
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures logging options
|
||||||
|
*/
|
||||||
|
'Log' => [
|
||||||
|
'debug' => [
|
||||||
|
'className' => 'Cake\Log\Engine\FileLog',
|
||||||
|
'path' => LOGS,
|
||||||
|
'file' => 'debug',
|
||||||
|
'levels' => ['notice', 'info', 'debug'],
|
||||||
|
],
|
||||||
|
'error' => [
|
||||||
|
'className' => 'Cake\Log\Engine\FileLog',
|
||||||
|
'path' => LOGS,
|
||||||
|
'file' => 'error',
|
||||||
|
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session configuration.
|
||||||
|
*
|
||||||
|
* Contains an array of settings to use for session configuration. The
|
||||||
|
* `defaults` key is used to define a default preset to use for sessions, any
|
||||||
|
* settings declared here will override the settings of the default config.
|
||||||
|
*
|
||||||
|
* ## Options
|
||||||
|
*
|
||||||
|
* - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'.
|
||||||
|
* - `cookiePath` - The url path for which session cookie is set. Maps to the
|
||||||
|
* `session.cookie_path` php.ini config. Defaults to base path of app.
|
||||||
|
* - `timeout` - The time in minutes the session should be valid for.
|
||||||
|
* Pass 0 to disable checking timeout.
|
||||||
|
* Please note that php.ini's session.gc_maxlifetime must be equal to or greater
|
||||||
|
* than the largest Session['timeout'] in all served websites for it to have the
|
||||||
|
* desired effect.
|
||||||
|
* - `defaults` - The default configuration set to use as a basis for your session.
|
||||||
|
* There are four built-in options: php, cake, cache, database.
|
||||||
|
* - `handler` - Can be used to enable a custom session handler. Expects an
|
||||||
|
* array with at least the `engine` key, being the name of the Session engine
|
||||||
|
* class to use for managing the session. CakePHP bundles the `CacheSession`
|
||||||
|
* and `DatabaseSession` engines.
|
||||||
|
* - `ini` - An associative array of additional ini values to set.
|
||||||
|
*
|
||||||
|
* The built-in `defaults` options are:
|
||||||
|
*
|
||||||
|
* - 'php' - Uses settings defined in your php.ini.
|
||||||
|
* - 'cake' - Saves session files in CakePHP's /tmp directory.
|
||||||
|
* - 'database' - Uses CakePHP's database sessions.
|
||||||
|
* - 'cache' - Use the Cache class to save sessions.
|
||||||
|
*
|
||||||
|
* To define a custom session handler, save it at src/Network/Session/<name>.php.
|
||||||
|
* Make sure the class implements PHP's `SessionHandlerInterface` and set
|
||||||
|
* Session.handler to <name>
|
||||||
|
*
|
||||||
|
* To use database sessions, load the SQL file located at config/Schema/sessions.sql
|
||||||
|
*/
|
||||||
|
'Session' => [
|
||||||
|
'defaults' => 'php',
|
||||||
|
],
|
||||||
|
];
|
||||||
389
config/app.php
Normal file
389
config/app.php
Normal file
@@ -0,0 +1,389 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
/**
|
||||||
|
* Debug Level:
|
||||||
|
*
|
||||||
|
* Production Mode:
|
||||||
|
* false: No error messages, errors, or warnings shown.
|
||||||
|
*
|
||||||
|
* Development Mode:
|
||||||
|
* true: Errors and warnings shown.
|
||||||
|
*/
|
||||||
|
'debug' => APP_CONFIG_DEBUG_MODE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure basic information about the application.
|
||||||
|
*
|
||||||
|
* - namespace - The namespace to find app classes under.
|
||||||
|
* - encoding - The encoding used for HTML + database connections.
|
||||||
|
* - base - The base directory the app resides in. If false this
|
||||||
|
* will be auto detected.
|
||||||
|
* - dir - Name of app directory.
|
||||||
|
* - webroot - The webroot directory.
|
||||||
|
* - wwwRoot - The file path to webroot.
|
||||||
|
* - baseUrl - To configure CakePHP to *not* use mod_rewrite and to
|
||||||
|
* use CakePHP pretty URLs, remove these .htaccess
|
||||||
|
* files:
|
||||||
|
* /.htaccess
|
||||||
|
* /webroot/.htaccess
|
||||||
|
* And uncomment the baseUrl key below.
|
||||||
|
* - fullBaseUrl - A base URL to use for absolute links.
|
||||||
|
* - imageBaseUrl - Web path to the public images directory under webroot.
|
||||||
|
* - cssBaseUrl - Web path to the public css directory under webroot.
|
||||||
|
* - jsBaseUrl - Web path to the public js directory under webroot.
|
||||||
|
* - paths - Configure paths for non class based resources. Supports the
|
||||||
|
* `plugins`, `templates`, `locales` subkeys, which allow the definition of
|
||||||
|
* paths for plugins, view templates and locale files respectively.
|
||||||
|
*/
|
||||||
|
'App' => [
|
||||||
|
'namespace' => 'App',
|
||||||
|
'encoding' => 'UTF-8',
|
||||||
|
'base' => false,
|
||||||
|
'dir' => 'src',
|
||||||
|
'webroot' => 'webroot',
|
||||||
|
'wwwRoot' => WWW_ROOT,
|
||||||
|
// 'baseUrl' => env('SCRIPT_NAME'),
|
||||||
|
'fullBaseUrl' => false,
|
||||||
|
'imageBaseUrl' => 'img/',
|
||||||
|
'cssBaseUrl' => 'css/',
|
||||||
|
'jsBaseUrl' => 'js/',
|
||||||
|
'paths' => [
|
||||||
|
'plugins' => [ROOT . DS . 'plugins' . DS],
|
||||||
|
'templates' => [APP . 'Template' . DS],
|
||||||
|
'locales' => [APP . 'Locale' . DS],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Security and encryption configuration
|
||||||
|
*
|
||||||
|
* - salt - A random string used in security hashing methods.
|
||||||
|
* The salt value is also used as the encryption key.
|
||||||
|
* You should treat it as extremely sensitive data.
|
||||||
|
*/
|
||||||
|
'Security' => [
|
||||||
|
'salt' => 'a26ac8c6a0c4277c3df4251dce80897b36ac331293a7dcdf220ca307b26e897c',
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply timestamps with the last modified time to static assets (js, css, images).
|
||||||
|
* Will append a querystring parameter containing the time the file was modified.
|
||||||
|
* This is useful for busting browser caches.
|
||||||
|
*
|
||||||
|
* Set to true to apply timestamps when debug is true. Set to 'force' to always
|
||||||
|
* enable timestamping regardless of debug value.
|
||||||
|
*/
|
||||||
|
'Asset' => [
|
||||||
|
// 'timestamp' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the cache adapters.
|
||||||
|
*/
|
||||||
|
'Cache' => [
|
||||||
|
'default' => [
|
||||||
|
'className' => DEFAULT_CACHE,
|
||||||
|
'path' => CACHE,
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis'=>[
|
||||||
|
'port'=>REDIS_PORT,
|
||||||
|
'duration'=>REDIS_DURATION,
|
||||||
|
'host '=>REDIS_HOST,
|
||||||
|
'database'=>REDIS_DB,
|
||||||
|
'password'=>REDIS_PASSWORD,
|
||||||
|
'persistent '=>REDIS_PERSISTENT,
|
||||||
|
'timeout'=>REDIS_TIMEOUT,
|
||||||
|
'unix_socket'=>REDIS_UNIX_SOCKET,
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the cache used for general framework caching.
|
||||||
|
* Translation cache files are stored with this configuration.
|
||||||
|
*/
|
||||||
|
'_cake_core_' => [
|
||||||
|
'className' => 'File',
|
||||||
|
'prefix' => 'myapp_cake_core_',
|
||||||
|
'path' => CACHE . 'persistent/',
|
||||||
|
'serialize' => true,
|
||||||
|
'duration' => '+2 minutes',
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the cache for model and datasource caches. This cache
|
||||||
|
* configuration is used to store schema descriptions, and table listings
|
||||||
|
* in connections.
|
||||||
|
*/
|
||||||
|
'_cake_model_' => [
|
||||||
|
'className' => 'File',
|
||||||
|
'prefix' => 'myapp_cake_model_',
|
||||||
|
'path' => CACHE . 'models/',
|
||||||
|
'serialize' => true,
|
||||||
|
'duration' => '+2 minutes',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the Error and Exception handlers used by your application.
|
||||||
|
*
|
||||||
|
* By default errors are displayed using Debugger, when debug is true and logged
|
||||||
|
* by Cake\Log\Log when debug is false.
|
||||||
|
*
|
||||||
|
* In CLI environments exceptions will be printed to stderr with a backtrace.
|
||||||
|
* In web environments an HTML page will be displayed for the exception.
|
||||||
|
* With debug true, framework errors like Missing Controller will be displayed.
|
||||||
|
* When debug is false, framework errors will be coerced into generic HTTP errors.
|
||||||
|
*
|
||||||
|
* Options:
|
||||||
|
*
|
||||||
|
* - `errorLevel` - int - The level of errors you are interested in capturing.
|
||||||
|
* - `trace` - boolean - Whether or not backtraces should be included in
|
||||||
|
* logged errors/exceptions.
|
||||||
|
* - `log` - boolean - Whether or not you want exceptions logged.
|
||||||
|
* - `exceptionRenderer` - string - The class responsible for rendering
|
||||||
|
* uncaught exceptions. If you choose a custom class you should place
|
||||||
|
* the file for that class in src/Error. This class needs to implement a
|
||||||
|
* render method.
|
||||||
|
* - `skipLog` - array - List of exceptions to skip for logging. Exceptions that
|
||||||
|
* extend one of the listed exceptions will also be skipped for logging.
|
||||||
|
* E.g.:
|
||||||
|
* `'skipLog' => ['Cake\Network\Exception\NotFoundException', 'Cake\Network\Exception\UnauthorizedException']`
|
||||||
|
*/
|
||||||
|
'Error' => [
|
||||||
|
'errorLevel' => '',
|
||||||
|
// 'exceptionRenderer' => 'Cake\Error\ExceptionRenderer',
|
||||||
|
'exceptionRenderer' => 'App\Error\AppExceptionRenderer',
|
||||||
|
'skipLog' => [],
|
||||||
|
'log' => true,
|
||||||
|
'trace' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email configuration.
|
||||||
|
*
|
||||||
|
* By defining transports separately from delivery profiles you can easily
|
||||||
|
* re-use transport configuration across multiple profiles.
|
||||||
|
*
|
||||||
|
* You can specify multiple configurations for production, development and
|
||||||
|
* testing.
|
||||||
|
*
|
||||||
|
* Each transport needs a `className`. Valid options are as follows:
|
||||||
|
*
|
||||||
|
* Mail - Send using PHP mail function
|
||||||
|
* Smtp - Send using SMTP
|
||||||
|
* Debug - Do not send the email, just return the result
|
||||||
|
*
|
||||||
|
* You can add custom transports (or override existing transports) by adding the
|
||||||
|
* appropriate file to src/Mailer/Transport. Transports should be named
|
||||||
|
* 'YourTransport.php', where 'Your' is the name of the transport.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
'EmailTransport' => [
|
||||||
|
'default' => [
|
||||||
|
'className' => APP_EMAIL_CLASS,
|
||||||
|
'host' =>APP_SMTP_HOST,
|
||||||
|
'port' => APP_SMTP_PORT,
|
||||||
|
'timeout' => APP_SMTP_TIMEOUT,
|
||||||
|
'username' => APP_SMTP_USERNAME,
|
||||||
|
'password' => APP_SMTP_PASSWORD,
|
||||||
|
'tls' => APP_SMTP_IS_TLS,
|
||||||
|
],
|
||||||
|
'Debug' => [
|
||||||
|
'className' => 'Debug'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Email delivery profiles
|
||||||
|
*
|
||||||
|
* Delivery profiles allow you to predefine various properties about email
|
||||||
|
* messages from your application and give the settings a name. This saves
|
||||||
|
* duplication across your application and makes maintenance and development
|
||||||
|
* easier. Each profile accepts a number of keys. See `Cake\Network\Email\Email`
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
'Email' => [
|
||||||
|
'default' => [
|
||||||
|
'transport' => 'default',
|
||||||
|
'from' => 'cloudhighttest@gmail.com',
|
||||||
|
//'charset' => 'utf-8',
|
||||||
|
//'headerCharset' => 'utf-8',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connection information used by the ORM to connect
|
||||||
|
* to your application's datastores.
|
||||||
|
* Drivers include Mysql Postgres Sqlite Sqlserver
|
||||||
|
* See vendor\cakephp\cakephp\src\Database\Driver for complete list
|
||||||
|
*/
|
||||||
|
'Datasources' => [
|
||||||
|
'default' => [
|
||||||
|
'className' => 'Cake\Database\Connection',
|
||||||
|
'driver' => 'Cake\Database\Driver\Mysql',
|
||||||
|
'persistent' => APP_DB_IS_PERSISTENT,
|
||||||
|
'host' => APP_DB_HOST,
|
||||||
|
/**
|
||||||
|
* CakePHP will use the default DB port based on the driver selected
|
||||||
|
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
|
||||||
|
* the following line and set the port accordingly
|
||||||
|
*/
|
||||||
|
//'port' => 'nonstandard_port_number',
|
||||||
|
'username' => APP_DB_USERNAME,
|
||||||
|
'password' => APP_DB_PASSWORD,
|
||||||
|
'database' => APP_DB_DATABASE_NAME,
|
||||||
|
'encoding' => APP_DB_ENCODING,
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
'cacheMetadata' => true,
|
||||||
|
'log' => true,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set identifier quoting to true if you are using reserved words or
|
||||||
|
* special characters in your table or column names. Enabling this
|
||||||
|
* setting will result in queries built using the Query Builder having
|
||||||
|
* identifiers quoted when creating SQL. It should be noted that this
|
||||||
|
* decreases performance because each query needs to be traversed and
|
||||||
|
* manipulated before being executed.
|
||||||
|
*/
|
||||||
|
'quoteIdentifiers' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* During development, if using MySQL < 5.6, uncommenting the
|
||||||
|
* following line could boost the speed at which schema metadata is
|
||||||
|
* fetched from the database. It can also be set directly with the
|
||||||
|
* mysql configuration directive 'innodb_stats_on_metadata = 0'
|
||||||
|
* which is the recommended value in production environments
|
||||||
|
*/
|
||||||
|
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
|
||||||
|
],
|
||||||
|
'mybb' => [
|
||||||
|
'className' => 'Cake\Database\Connection',
|
||||||
|
'driver' => 'Cake\Database\Driver\Mysql',
|
||||||
|
'persistent' => APP_DB_IS_PERSISTENT,
|
||||||
|
'host' => APP_DB_HOST,
|
||||||
|
/**
|
||||||
|
* CakePHP will use the default DB port based on the driver selected
|
||||||
|
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
|
||||||
|
* the following line and set the port accordingly
|
||||||
|
*/
|
||||||
|
//'port' => 'nonstandard_port_number',
|
||||||
|
'username' => APP_DB_USERNAME,
|
||||||
|
'password' => APP_DB_PASSWORD,
|
||||||
|
'database' => MYBB_DB_NAME,
|
||||||
|
'encoding' => APP_DB_ENCODING,
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
'cacheMetadata' => true,
|
||||||
|
'log' => true,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set identifier quoting to true if you are using reserved words or
|
||||||
|
* special characters in your table or column names. Enabling this
|
||||||
|
* setting will result in queries built using the Query Builder having
|
||||||
|
* identifiers quoted when creating SQL. It should be noted that this
|
||||||
|
* decreases performance because each query needs to be traversed and
|
||||||
|
* manipulated before being executed.
|
||||||
|
*/
|
||||||
|
'quoteIdentifiers' => false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* During development, if using MySQL < 5.6, uncommenting the
|
||||||
|
* following line could boost the speed at which schema metadata is
|
||||||
|
* fetched from the database. It can also be set directly with the
|
||||||
|
* mysql configuration directive 'innodb_stats_on_metadata = 0'
|
||||||
|
* which is the recommended value in production environments
|
||||||
|
*/
|
||||||
|
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The test connection is used during the test suite.
|
||||||
|
*/
|
||||||
|
'test' => [
|
||||||
|
'className' => 'Cake\Database\Connection',
|
||||||
|
'driver' => 'Cake\Database\Driver\Mysql',
|
||||||
|
'persistent' => false,
|
||||||
|
'host' => 'localhost',
|
||||||
|
//'port' => 'nonstandard_port_number',
|
||||||
|
'username' => 'root',
|
||||||
|
'password' => '',
|
||||||
|
'database' => 'pdfgenerator',
|
||||||
|
'encoding' => 'utf8',
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
'cacheMetadata' => true,
|
||||||
|
'quoteIdentifiers' => false,
|
||||||
|
|
||||||
|
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures logging options
|
||||||
|
*/
|
||||||
|
'Log' => [
|
||||||
|
'debug' => [
|
||||||
|
'className' => 'Cake\Log\Engine\FileLog',
|
||||||
|
'path' => LOGS,
|
||||||
|
'file' => 'debug-'.date('Y-m-d'),
|
||||||
|
'levels' => ['notice', 'info', 'debug'],
|
||||||
|
],
|
||||||
|
'error' => [
|
||||||
|
'className' => 'Cake\Log\Engine\FileLog',
|
||||||
|
'path' => LOGS,
|
||||||
|
'file' => 'error-'.date('Y-m-d'),
|
||||||
|
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
|
||||||
|
],'cli_info' => [
|
||||||
|
'className' => 'Cake\Log\Engine\FileLog',
|
||||||
|
'path' => LOGS,
|
||||||
|
'file' => 'info-'.date('Y-m-d'),
|
||||||
|
'levels' => [ 'info'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session configuration.
|
||||||
|
*
|
||||||
|
* Contains an array of settings to use for session configuration. The
|
||||||
|
* `defaults` key is used to define a default preset to use for sessions, any
|
||||||
|
* settings declared here will override the settings of the default config.
|
||||||
|
*
|
||||||
|
* ## Options
|
||||||
|
*
|
||||||
|
* - `cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'.
|
||||||
|
* - `cookiePath` - The url path for which session cookie is set. Maps to the
|
||||||
|
* `session.cookie_path` php.ini config. Defaults to base path of app.
|
||||||
|
* - `timeout` - The time in minutes the session should be valid for.
|
||||||
|
* Pass 0 to disable checking timeout.
|
||||||
|
* Please note that php.ini's session.gc_maxlifetime must be equal to or greater
|
||||||
|
* than the largest Session['timeout'] in all served websites for it to have the
|
||||||
|
* desired effect.
|
||||||
|
* - `defaults` - The default configuration set to use as a basis for your session.
|
||||||
|
* There are four built-in options: php, cake, cache, database.
|
||||||
|
* - `handler` - Can be used to enable a custom session handler. Expects an
|
||||||
|
* array with at least the `engine` key, being the name of the Session engine
|
||||||
|
* class to use for managing the session. CakePHP bundles the `CacheSession`
|
||||||
|
* and `DatabaseSession` engines.
|
||||||
|
* - `ini` - An associative array of additional ini values to set.
|
||||||
|
*
|
||||||
|
* The built-in `defaults` options are:
|
||||||
|
*
|
||||||
|
* - 'php' - Uses settings defined in your php.ini.
|
||||||
|
* - 'cake' - Saves session files in CakePHP's /tmp directory.
|
||||||
|
* - 'database' - Uses CakePHP's database sessions.
|
||||||
|
* - 'cache' - Use the Cache class to save sessions.
|
||||||
|
*
|
||||||
|
* To define a custom session handler, save it at src/Network/Session/<name>.php.
|
||||||
|
* Make sure the class implements PHP's `SessionHandlerInterface` and set
|
||||||
|
* Session.handler to <name>
|
||||||
|
*
|
||||||
|
* To use database sessions, load the SQL file located at config/Schema/sessions.sql
|
||||||
|
*/
|
||||||
|
'Session' => [
|
||||||
|
'defaults' => 'php',
|
||||||
|
'timeout'=>60//in minutes
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
];
|
||||||
212
config/bootstrap.php
Normal file
212
config/bootstrap.php
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
* @since 0.10.8
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure paths required to find CakePHP + general filepath
|
||||||
|
* constants
|
||||||
|
*/
|
||||||
|
require __DIR__ . '/paths.php';
|
||||||
|
|
||||||
|
// Use composer to load the autoloader.
|
||||||
|
require ROOT . DS . 'vendor' . DS . 'autoload.php';
|
||||||
|
|
||||||
|
require ROOT . DS . 'config' . DS . 'app.settings.php';
|
||||||
|
require ROOT . DS . 'config' . DS . 'app.constant.php';
|
||||||
|
//echo "yyy";exit;
|
||||||
|
/**
|
||||||
|
* Bootstrap CakePHP.
|
||||||
|
*
|
||||||
|
* Does the various bits of setup that CakePHP needs to do.
|
||||||
|
* This includes:
|
||||||
|
*
|
||||||
|
* - Registering the CakePHP autoloader.
|
||||||
|
* - Setting the default application paths.
|
||||||
|
*/
|
||||||
|
require CORE_PATH . 'config' . DS . 'bootstrap.php';
|
||||||
|
//echo "mmm";exit;
|
||||||
|
// You can remove this if you are confident you have intl installed.
|
||||||
|
if (!extension_loaded('intl')) {
|
||||||
|
|
||||||
|
trigger_error('You must enable the intl extension to use CakePHP.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
//echo "hello";exit;
|
||||||
|
use Cake\Cache\Cache;
|
||||||
|
use Cake\Console\ConsoleErrorHandler;
|
||||||
|
use Cake\Core\App;
|
||||||
|
use Cake\Core\Configure;
|
||||||
|
use Cake\Core\Configure\Engine\PhpConfig;
|
||||||
|
use Cake\Core\Plugin;
|
||||||
|
use Cake\Database\Type;
|
||||||
|
use Cake\Datasource\ConnectionManager;
|
||||||
|
use Cake\Error\ErrorHandler;
|
||||||
|
use Cake\Log\Log;
|
||||||
|
use Cake\Network\Email\Email;
|
||||||
|
use Cake\Network\Request;
|
||||||
|
use Cake\Routing\DispatcherFactory;
|
||||||
|
use Cake\Utility\Inflector;
|
||||||
|
use Cake\Utility\Security;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read configuration file and inject configuration into various
|
||||||
|
* CakePHP classes.
|
||||||
|
*
|
||||||
|
* By default there is only one configuration file. It is often a good
|
||||||
|
* idea to create multiple configuration files, and separate the configuration
|
||||||
|
* that changes from configuration that does not. This makes deployment simpler.
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
Configure::config('default', new PhpConfig());
|
||||||
|
Configure::load('app', 'default', false);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
die($e->getMessage() . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load an environment local configuration file.
|
||||||
|
// You can use a file like app_local.php to provide local overrides to your
|
||||||
|
// shared configuration.
|
||||||
|
//Configure::load('app_local', 'default');
|
||||||
|
|
||||||
|
// When debug = false the metadata cache should last
|
||||||
|
// for a very very long time, as we don't want
|
||||||
|
// to refresh the cache while users are doing requests.
|
||||||
|
if (!Configure::read('debug')) {
|
||||||
|
Configure::write('Cache._cake_model_.duration', '+1 years');
|
||||||
|
Configure::write('Cache._cake_core_.duration', '+1 years');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set server timezone to UTC. You can change it to another timezone of your
|
||||||
|
* choice but using UTC makes time calculations / conversions easier.
|
||||||
|
*/
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure the mbstring extension to use the correct encoding.
|
||||||
|
*/
|
||||||
|
mb_internal_encoding(Configure::read('App.encoding'));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the default locale. This controls how dates, number and currency is
|
||||||
|
* formatted and sets the default language to use for translations.
|
||||||
|
*/
|
||||||
|
ini_set('intl.default_locale', 'en_US');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register application error and exception handlers.
|
||||||
|
*/
|
||||||
|
$isCli = php_sapi_name() === 'cli';
|
||||||
|
if ($isCli) {
|
||||||
|
(new ConsoleErrorHandler(Configure::read('Error')))->register();
|
||||||
|
} else {
|
||||||
|
(new ErrorHandler(Configure::read('Error')))->register();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Include the CLI bootstrap overrides.
|
||||||
|
if ($isCli) {
|
||||||
|
require __DIR__ . '/bootstrap_cli.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the full base URL.
|
||||||
|
* This URL is used as the base of all absolute links.
|
||||||
|
*
|
||||||
|
* If you define fullBaseUrl in your config file you can remove this.
|
||||||
|
*/
|
||||||
|
if (!Configure::read('App.fullBaseUrl')) {
|
||||||
|
$s = null;
|
||||||
|
if (env('HTTPS')) {
|
||||||
|
$s = 's';
|
||||||
|
}
|
||||||
|
|
||||||
|
$httpHost = env('HTTP_HOST');
|
||||||
|
if (isset($httpHost)) {
|
||||||
|
Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost);
|
||||||
|
}
|
||||||
|
unset($httpHost, $s);
|
||||||
|
}
|
||||||
|
|
||||||
|
Cache::config(Configure::consume('Cache'));
|
||||||
|
ConnectionManager::config(Configure::consume('Datasources'));
|
||||||
|
Email::configTransport(Configure::consume('EmailTransport'));
|
||||||
|
Email::config(Configure::consume('Email'));
|
||||||
|
Log::config(Configure::consume('Log'));
|
||||||
|
Security::salt(Configure::consume('Security.salt'));
|
||||||
|
|
||||||
|
//default language
|
||||||
|
ini_set('intl.default_locale', 'en_US');
|
||||||
|
/**
|
||||||
|
* The default crypto extension in 3.0 is OpenSSL.
|
||||||
|
* If you are migrating from 2.x uncomment this code to
|
||||||
|
* use a more compatible Mcrypt based implementation
|
||||||
|
*/
|
||||||
|
// Security::engine(new \Cake\Utility\Crypto\Mcrypt());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup detectors for mobile and tablet.
|
||||||
|
*/
|
||||||
|
Request::addDetector('mobile', function ($request) {
|
||||||
|
$detector = new \Detection\MobileDetect();
|
||||||
|
return $detector->isMobile();
|
||||||
|
});
|
||||||
|
Request::addDetector('tablet', function ($request) {
|
||||||
|
$detector = new \Detection\MobileDetect();
|
||||||
|
return $detector->isTablet();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom Inflector rules, can be set to correctly pluralize or singularize
|
||||||
|
* table, model, controller names or whatever other string is passed to the
|
||||||
|
* inflection functions.
|
||||||
|
*
|
||||||
|
* Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
|
||||||
|
* Inflector::rules('irregular', ['red' => 'redlings']);
|
||||||
|
* Inflector::rules('uninflected', ['dontinflectme']);
|
||||||
|
* Inflector::rules('transliteration', ['/å/' => 'aa']);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
|
||||||
|
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
|
||||||
|
* advanced ways of loading plugins
|
||||||
|
*
|
||||||
|
* Plugin::loadAll(); // Loads all plugins at once
|
||||||
|
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
Plugin::load('Migrations');
|
||||||
|
|
||||||
|
// Only try to load DebugKit in development mode
|
||||||
|
// Debug Kit should not be installed on a production system
|
||||||
|
if (Configure::read('debug')) {
|
||||||
|
Plugin::load('DebugKit', ['bootstrap' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect middleware/dispatcher filters.
|
||||||
|
*/
|
||||||
|
DispatcherFactory::add('Asset');
|
||||||
|
DispatcherFactory::add('Routing');
|
||||||
|
DispatcherFactory::add('ControllerFactory');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable default locale format parsing.
|
||||||
|
* This is needed for matching the auto-localized string output of Time() class when parsing dates.
|
||||||
|
*/
|
||||||
|
Type::build('datetime')->useLocaleParser();
|
||||||
|
|
||||||
|
|
||||||
33
config/bootstrap_cli.php
Normal file
33
config/bootstrap_cli.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
* @since 3.0.0
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
use Cake\Core\Configure;
|
||||||
|
use Cake\Core\Exception\MissingPluginException;
|
||||||
|
use Cake\Core\Plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional bootstrapping and configuration for CLI environments should
|
||||||
|
* be put here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Set logs to different files so they don't have permission conflicts.
|
||||||
|
Configure::write('Log.cli_info.file', 'cli-info-'.date('Y-m-d'));
|
||||||
|
Configure::write('Log.debug.file', 'cli-debug');
|
||||||
|
Configure::write('Log.error.file', 'cli-error-'.date('Y-m-d'));
|
||||||
|
|
||||||
|
try {
|
||||||
|
Plugin::load('Bake');
|
||||||
|
} catch (MissingPluginException $e) {
|
||||||
|
// Do not halt if the plugin is missing
|
||||||
|
}
|
||||||
40
config/dynamic_domain.php
Normal file
40
config/dynamic_domain.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (isset($_SERVER['HTTP_REFERER'])) {
|
||||||
|
|
||||||
|
$host_dynamic_array = parse_url($_SERVER['HTTP_REFERER']);
|
||||||
|
$host_dynamic = $host_dynamic_array["scheme"] . "://" . $host_dynamic_array["host"] . "/";
|
||||||
|
|
||||||
|
define("APP_SERVER_HOST_URL", $host_dynamic);
|
||||||
|
define("SITE_DOMAIN", $host_dynamic_array["host"]);
|
||||||
|
|
||||||
|
} else if (isset($_SERVER['HTTP_HOST'])) {
|
||||||
|
|
||||||
|
if ($_SERVER['HTTP_HOST'] == APP_DEFAULT_DOMAIN) {
|
||||||
|
|
||||||
|
define("APP_SERVER_HOST_URL", "https://" . APP_DEFAULT_DOMAIN . "/");
|
||||||
|
define('SITE_DOMAIN', APP_DEFAULT_DOMAIN);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$ssl = "http://";
|
||||||
|
if(ENVIROMENT == 1){
|
||||||
|
$ssl = "https://";
|
||||||
|
}
|
||||||
|
$host_dynamic = $ssl. $_SERVER['HTTP_HOST'] . "/";
|
||||||
|
define("APP_SERVER_HOST_URL", $host_dynamic);
|
||||||
|
define('SITE_DOMAIN', $_SERVER['HTTP_HOST']);
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
define("APP_SERVER_HOST_URL", APP_SERVER_HOST_URL_DEFAULT);
|
||||||
|
define('SITE_DOMAIN', APP_DEFAULT_DOMAIN);
|
||||||
|
}
|
||||||
|
|
||||||
85
config/paths.php
Normal file
85
config/paths.php
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
* @since 3.0.0
|
||||||
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the DS to separate the directories in other defines
|
||||||
|
*/
|
||||||
|
if (!defined('DS')) {
|
||||||
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These defines should only be edited if you have cake installed in
|
||||||
|
* a directory layout other than the way it is distributed.
|
||||||
|
* When using custom settings be sure to use the DS and do not add a trailing DS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The full path to the directory which holds "src", WITHOUT a trailing DS.
|
||||||
|
*/
|
||||||
|
define('ROOT', dirname(__DIR__));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actual directory name for the application directory. Normally
|
||||||
|
* named 'src'.
|
||||||
|
*/
|
||||||
|
define('APP_DIR', 'src');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to the application's directory.
|
||||||
|
*/
|
||||||
|
define('APP', ROOT . DS . APP_DIR . DS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to the config directory.
|
||||||
|
*/
|
||||||
|
define('CONFIG', ROOT . DS . 'config' . DS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File path to the webroot directory.
|
||||||
|
*/
|
||||||
|
define('WWW_ROOT', ROOT . DS . 'webroot' . DS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to the tests directory.
|
||||||
|
*/
|
||||||
|
define('TESTS', ROOT . DS . 'tests' . DS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to the temporary files directory.
|
||||||
|
*/
|
||||||
|
define('TMP', ROOT . DS . 'tmp' . DS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to the logs directory.
|
||||||
|
*/
|
||||||
|
define('LOGS', ROOT . DS . 'logs' . DS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
|
||||||
|
*/
|
||||||
|
define('CACHE', TMP . 'cache' . DS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
|
||||||
|
*
|
||||||
|
* CakePHP should always be installed with composer, so look there.
|
||||||
|
*/
|
||||||
|
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'vendor' . DS . 'cakephp' . DS . 'cakephp');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to the cake directory.
|
||||||
|
*/
|
||||||
|
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
||||||
|
define('CAKE', CORE_PATH . 'src' . DS);
|
||||||
190
config/routes.php
Normal file
190
config/routes.php
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Routes configuration
|
||||||
|
*
|
||||||
|
* In this file, you set up routes to your controllers and their actions.
|
||||||
|
* Routes are very important mechanism that allows you to freely connect
|
||||||
|
* different URLs to chosen controllers and their actions (functions).
|
||||||
|
*
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Cake\Core\Plugin;
|
||||||
|
use Cake\Routing\Router;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default class to use for all routes
|
||||||
|
*
|
||||||
|
* The following route classes are supplied with CakePHP and are appropriate
|
||||||
|
* to set as the default:
|
||||||
|
*
|
||||||
|
* - Route
|
||||||
|
* - InflectedRoute
|
||||||
|
* - DashedRoute
|
||||||
|
*
|
||||||
|
* If no call is made to `Router::defaultRouteClass()`, the class used is
|
||||||
|
* `Route` (`Cake\Routing\Route\Route`)
|
||||||
|
*
|
||||||
|
* Note that `Route` does not do any inflections on URLs which will result in
|
||||||
|
* inconsistently cased URLs when used with `:plugin`, `:controller` and
|
||||||
|
* `:action` markers.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
Router::defaultRouteClass('DashedRoute');
|
||||||
|
|
||||||
|
Router::scope('/', function ($routes) {
|
||||||
|
|
||||||
|
|
||||||
|
$routes->setExtensions(['json']);
|
||||||
|
$routes->resources('Files');
|
||||||
|
/**
|
||||||
|
* Here, we are connecting '/' (base path) to a controller called 'Pages',
|
||||||
|
* its action called 'display', and we pass a param to select the view file
|
||||||
|
* to use (in this case, src/Template/Pages/home.ctp)...
|
||||||
|
*/
|
||||||
|
|
||||||
|
$url = $_SERVER['REQUEST_URI'];
|
||||||
|
$exploded_url = explode("/", $url);
|
||||||
|
$params_array = [];
|
||||||
|
$cmsuser_id = 0;
|
||||||
|
$client_id = 0;
|
||||||
|
if(!empty($exploded_url)){
|
||||||
|
foreach ($exploded_url as $ex_value){
|
||||||
|
if($ex_value > 0){
|
||||||
|
$params_array[] = $ex_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($params_array[0]) && $params_array[0] > 0){
|
||||||
|
$cmsuser_id = $params_array[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($cmsuser_id > 0 && $client_id == 0){
|
||||||
|
$routes->connect('/:pass', ['controller' => 'Cmsusers', 'action' => 'login']);
|
||||||
|
}
|
||||||
|
else if($cmsuser_id > 0 && $client_id > 0){
|
||||||
|
$routes->connect('/:pass/:client_id', ['controller' => 'Cmsusers', 'action' => 'login']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$routes->connect('/login', ['controller' => 'Cmsusers', 'action' => 'login']);
|
||||||
|
$routes->connect('/', ['controller' => 'Learninghub', 'action' => 'index']);
|
||||||
|
|
||||||
|
$routes->connect('/admin', ['controller' => 'Cmsusers', 'action' => 'login']);
|
||||||
|
$routes->connect('/reset_password/*', ['controller' => 'Cmsusers', 'action' => 'resetPassword']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ...and connect the rest of 'Pages' controller's URLs.
|
||||||
|
*/
|
||||||
|
$routes->connect('/users/logout/', ['controller' => 'Cmsusers', 'action' => 'logout']);
|
||||||
|
$routes->connect('/users/edit-profile/', ['controller' => 'Cmsusers', 'action' => 'editProfile']);
|
||||||
|
$routes->connect('/users/add/', ['controller' => 'Cmsusers', 'action' => 'add']);
|
||||||
|
$routes->connect('/forgot_password', ['controller' => 'Cmsusers', 'action' => 'forgotPassword']);
|
||||||
|
$routes->connect('/users/bulk-action', ['controller' => 'Cmsusers', 'action' => 'bulkAction']);
|
||||||
|
$routes->connect('/users/allowaction/*', ['controller' => 'Cmsusers', 'action' => 'allowaction']);
|
||||||
|
$routes->connect('/users/revokeaction/*', ['controller' => 'Cmsusers', 'action' => 'revokeaction']);
|
||||||
|
$routes->connect('/users/revokePassword/*', ['controller' => 'Cmsusers', 'action' => 'revokePassword']);
|
||||||
|
$routes->connect('/users/edit/*', ['controller' => 'Cmsusers', 'action' => 'edit']);
|
||||||
|
$routes->connect('/users/view/*', ['controller' => 'Cmsusers', 'action' => 'view']);
|
||||||
|
$routes->connect('/users/addmembership/*', ['controller' => 'Cmsusers', 'action' => 'addmembership']);
|
||||||
|
$routes->connect('/users/revokemembership/*', ['controller' => 'Cmsusers', 'action' => 'revokemembership']);
|
||||||
|
$routes->connect('/users/*', ['controller' => 'Cmsusers']);
|
||||||
|
|
||||||
|
$routes->connect('/pages/*', ['controller' => 'Pages']);
|
||||||
|
$routes->connect('/pages/edit/*', ['controller' => 'Pages', 'action' => 'edit']);
|
||||||
|
$routes->connect('/pages/add', ['controller' => 'Pages', 'action' => 'add']);
|
||||||
|
$routes->connect('/pages/delete/*', ['controller' => 'Pages', 'action' => 'delete']);
|
||||||
|
$routes->connect('/pages/bulk-action', ['controller' => 'Pages', 'action' => 'bulkAction']);
|
||||||
|
|
||||||
|
$routes->connect('/submodules/*', ['controller' => 'SubModules']);
|
||||||
|
$routes->connect('/submodules/add', ['controller' => 'SubModules', 'action' => 'add']);
|
||||||
|
$routes->connect('/submodules/edit/*', ['controller' => 'SubModules', 'action' => 'edit']);
|
||||||
|
$routes->connect('/submodules/delete/*', ['controller' => 'SubModules', 'action' => 'delete']);
|
||||||
|
$routes->connect('/submodules/bulk-action', ['controller' => 'SubModules', 'action' => 'bulkAction']);
|
||||||
|
|
||||||
|
|
||||||
|
$routes->connect('/companies/*', ['controller' => 'Companies']);
|
||||||
|
$routes->connect('/companies/add', ['controller' => 'Companies', 'action' => 'add']);
|
||||||
|
$routes->connect('/companies/edit/*', ['controller' => 'Companies', 'action' => 'edit']);
|
||||||
|
$routes->connect('/companies/delete/*', ['controller' => 'Companies', 'action' => 'delete']);
|
||||||
|
$routes->connect('/companies/view/*', ['controller' => 'Companies', 'action' => 'view']);
|
||||||
|
$routes->connect('/companies/bulk-action', ['controller' => 'Companies', 'action' => 'bulkAction']);
|
||||||
|
$routes->connect('/companies/uploadPicture', ['controller' => 'Companies', 'action' => 'uploadPicture']);
|
||||||
|
$routes->connect('/companies/companyActive', ['controller' => 'Companies', 'action' => 'companyActive']);
|
||||||
|
$routes->connect('/companies/trnsToaws/*', ['controller' => 'Companies', 'action' => 'trnsToaws']);
|
||||||
|
|
||||||
|
$routes->connect('/settings/edit/*', ['controller' => 'Settings', 'action' => 'edit']);
|
||||||
|
|
||||||
|
|
||||||
|
$routes->connect('/session', ['controller' => 'Session', 'action' => 'index']);
|
||||||
|
$routes->connect('/session/add', ['controller' => 'Session', 'action' => 'add']);
|
||||||
|
$routes->connect('/session/edit/*', ['controller' => 'Session', 'action' => 'edit']);
|
||||||
|
$routes->connect('/session/delete/*', ['controller' => 'Session', 'action' => 'delete']);
|
||||||
|
$routes->connect('/session/view/*', ['controller' => 'Session', 'action' => 'view']);
|
||||||
|
|
||||||
|
$routes->connect('/course', ['controller' => 'Course', 'action' => 'index']);
|
||||||
|
$routes->connect('/course/add', ['controller' => 'Course', 'action' => 'add']);
|
||||||
|
$routes->connect('/course/edit/*', ['controller' => 'Course', 'action' => 'edit']);
|
||||||
|
$routes->connect('/course/delete/*', ['controller' => 'Course', 'action' => 'delete']);
|
||||||
|
$routes->connect('/course/view/*', ['controller' => 'Course', 'action' => 'view']);
|
||||||
|
|
||||||
|
|
||||||
|
$routes->connect('/student', ['controller' => 'Student', 'action' => 'index']);
|
||||||
|
$routes->connect('/student/add', ['controller' => 'Student', 'action' => 'add']);
|
||||||
|
$routes->connect('/student/edit/*', ['controller' => 'Student', 'action' => 'edit']);
|
||||||
|
$routes->connect('/student/delete/*', ['controller' => 'Student', 'action' => 'delete']);
|
||||||
|
|
||||||
|
|
||||||
|
$routes->connect('/about', ['controller' => 'Learninghub', 'action' => 'about']);
|
||||||
|
$routes->connect('/acreditation', ['controller' => 'Learninghub', 'action' => 'acreditation']);
|
||||||
|
$routes->connect('/accomodation', ['controller' => 'Learninghub', 'action' => 'accomodation']);
|
||||||
|
$routes->connect('/application-process', ['controller' => 'Learninghub', 'action' => 'applicationProcess']);
|
||||||
|
|
||||||
|
$routes->connect('/apply-form', ['controller' => 'Learninghub', 'action' => 'applyForm']);
|
||||||
|
$routes->connect('/contact', ['controller' => 'Learninghub', 'action' => 'contact']);
|
||||||
|
$routes->connect('/courses', ['controller' => 'Learninghub', 'action' => 'courses']);
|
||||||
|
$routes->connect('/courses/:slug', ['controller' => 'Learninghub', 'action' => 'viewCourses'], [
|
||||||
|
'pass' => ['slug'],
|
||||||
|
'slug' => '[a-z0-9_\-]+'
|
||||||
|
]);
|
||||||
|
$routes->connect('/verification', ['controller' => 'Learninghub', 'action' => 'verification']);
|
||||||
|
$routes->connect('/agencies', ['controller' => 'Learninghub', 'action' => 'agent']);
|
||||||
|
$routes->connect('/courses/english', ['controller' => 'Learninghub', 'action' => 'viewEnglishCourses']);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect catchall routes for all controllers.
|
||||||
|
*
|
||||||
|
* Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for
|
||||||
|
* `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);`
|
||||||
|
* `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);`
|
||||||
|
*
|
||||||
|
* Any route class can be used with this method, such as:
|
||||||
|
* - DashedRoute
|
||||||
|
* - InflectedRoute
|
||||||
|
* - Route
|
||||||
|
* - Or your own route class
|
||||||
|
*
|
||||||
|
* You can remove these routes once you've connected the
|
||||||
|
* routes you want in your application.
|
||||||
|
*/
|
||||||
|
$routes->fallbacks('DashedRoute');
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all plugin routes. See the Plugin documentation on
|
||||||
|
* how to customize the loading of plugin routes.
|
||||||
|
*/
|
||||||
|
Plugin::routes();
|
||||||
27
config/schema/i18n.sql
Normal file
27
config/schema/i18n.sql
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
#
|
||||||
|
# Licensed under The MIT License
|
||||||
|
# For full copyright and license information, please see the LICENSE.txt
|
||||||
|
# Redistributions of files must retain the above copyright notice.
|
||||||
|
# MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
|
||||||
|
CREATE TABLE i18n (
|
||||||
|
id int(10) NOT NULL auto_increment,
|
||||||
|
locale varchar(6) NOT NULL,
|
||||||
|
model varchar(255) NOT NULL,
|
||||||
|
foreign_key int(10) NOT NULL,
|
||||||
|
field varchar(255) NOT NULL,
|
||||||
|
content mediumtext,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
# UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field),
|
||||||
|
# INDEX I18N_LOCALE_ROW(locale, model, foreign_key),
|
||||||
|
# INDEX I18N_LOCALE_MODEL(locale, model),
|
||||||
|
# INDEX I18N_FIELD(model, foreign_key, field),
|
||||||
|
# INDEX I18N_ROW(model, foreign_key),
|
||||||
|
INDEX locale (locale),
|
||||||
|
INDEX model (model),
|
||||||
|
INDEX row_id (foreign_key),
|
||||||
|
INDEX field (field)
|
||||||
|
);
|
||||||
0
config/schema/module_submodules_pages.txt
Normal file
0
config/schema/module_submodules_pages.txt
Normal file
0
config/schema/project_client.txt
Normal file
0
config/schema/project_client.txt
Normal file
15
config/schema/sessions.sql
Normal file
15
config/schema/sessions.sql
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
#
|
||||||
|
# Licensed under The MIT License
|
||||||
|
# For full copyright and license information, please see the LICENSE.txt
|
||||||
|
# Redistributions of files must retain the above copyright notice.
|
||||||
|
# MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
|
||||||
|
CREATE TABLE sessions (
|
||||||
|
id varchar(40) NOT NULL default '',
|
||||||
|
data text,
|
||||||
|
expires INT(11) NOT NULL,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
);
|
||||||
2
db/cronjob.txt
Normal file
2
db/cronjob.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
* * * * * cd /var/www/html && bin/cake EmailSender main
|
||||||
145
db/dbchanges.sql
Normal file
145
db/dbchanges.sql
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
-- 22-05-2025
|
||||||
|
CREATE TABLE agents (
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
first_name VARCHAR(50) NOT NULL,
|
||||||
|
last_name VARCHAR(50) NOT NULL,
|
||||||
|
email VARCHAR(100) NOT NULL,
|
||||||
|
phone_number VARCHAR(20),
|
||||||
|
agency_name VARCHAR(100),
|
||||||
|
hire_date DATE,
|
||||||
|
address VARCHAR(255) NULL DEFAULT NULL,
|
||||||
|
country_name VARCHAR(20),
|
||||||
|
status TINYINT(4) DEFAULT '1' COMMENT 'active=1, inactive=0',
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
-- -----------------
|
||||||
|
INSERT INTO `sub_modules` (`id`, `module_id`, `name`, `controller_name`, `icon`, `sequence`, `created_on`, `modified_on`) VALUES ('3346', '1004', 'Manage Agents', 'Agent', '<i class=\"fa fa-user\" aria-hidden=\"true\"></i>', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17') ;
|
||||||
|
INSERT INTO `pages` (`id`, `module_id`, `sub_module_id`, `name`, `method_name`, `available_to_company`, `created_on`, `modified_on`)
|
||||||
|
VALUES ('10166', '1004', '3346', 'index', 'index', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10167', '1004', '3346', 'add', 'add', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10168', '1004', '3346', 'edit', 'edit', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10169', '1004', '3346', 'view', 'view', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10170', '1004', '3346', 'delete', 'delete', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17');
|
||||||
|
|
||||||
|
-- deployed
|
||||||
|
|
||||||
|
-- new table 6/27/2025
|
||||||
|
|
||||||
|
CREATE TABLE course_categories (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY ,
|
||||||
|
name VARCHAR(150) NOT NULL,
|
||||||
|
description VARCHAR(255) NULL DEFAULT NULL ,
|
||||||
|
status TINYINT(4) DEFAULT 1 COMMENT '1 = Active, 0 = Inactive',
|
||||||
|
created_by INT ,
|
||||||
|
updated_by INT ,
|
||||||
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP ,
|
||||||
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE qualification_types (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY ,
|
||||||
|
name VARCHAR(150) NOT NULL,
|
||||||
|
description VARCHAR(255) NULL DEFAULT NULL ,
|
||||||
|
status TINYINT(4) DEFAULT 1 COMMENT '1 = Active, 0 = Inactive',
|
||||||
|
created_by INT ,
|
||||||
|
updated_by INT ,
|
||||||
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP ,
|
||||||
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE semesters (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY ,
|
||||||
|
name VARCHAR(50) NOT NULL,
|
||||||
|
description VARCHAR(255) NULL DEFAULT NULL ,
|
||||||
|
status TINYINT(4) DEFAULT 1 COMMENT '1 = Active, 0 = Inactive',
|
||||||
|
created_by INT ,
|
||||||
|
updated_by INT ,
|
||||||
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP ,
|
||||||
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE courses
|
||||||
|
add column course_category_id int COMMENT 'comes from course_categories table' AFTER name,
|
||||||
|
add column qualification_type_id int COMMENT 'comes from qualification_types table' AFTER course_category_id,
|
||||||
|
add column level TINYINT(4) COMMENT '1 to 8' AFTER qualification_type_id,
|
||||||
|
add column total_credit DECIMAL(5,2) COMMENT 'credit 120.5' AFTER level,
|
||||||
|
add column code VARCHAR(50) COMMENT 'like as 603/4373/4' AFTER total_credit,
|
||||||
|
add column progression_routes VARCHAR(255) COMMENT 'QUALIFI Level 4 qualification, or directly into employment in an associated profession.' AFTER code,
|
||||||
|
add column availability_type TINYINT(4) COMMENT 'UK and international' AFTER progression_routes,
|
||||||
|
add column delivery_mode TINYINT(4) COMMENT ' 1 = Online, 2 = Blended, 3 = Both (takes from constant)' AFTER availability_type,
|
||||||
|
add column duration TINYINT(4) COMMENT 'Duration in months' AFTER delivery_mode,
|
||||||
|
add column assessment VARCHAR(255) COMMENT 'Assignment Based' AFTER duration;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE course_semesters (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
course_id INT NOT NULL,
|
||||||
|
semester_id INT NOT NULL,
|
||||||
|
created_by INT ,
|
||||||
|
updated_by INT ,
|
||||||
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP ,
|
||||||
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE course_semester_subjects (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
course_id INT NOT NULL,
|
||||||
|
course_semester_id INT NOT NULL,
|
||||||
|
title VARCHAR(255) NOT NULL,
|
||||||
|
level TINYINT(4) NOT NULL COMMENT '1 to 8',
|
||||||
|
credit DECIMAL(5,2) NOT NULL COMMENT 'credits = 20.5 or 5 ',
|
||||||
|
is_mandatory TINYINT(4) DEFAULT 1 COMMENT '1 = mandatory, 2 = Optional',
|
||||||
|
status TINYINT(4) DEFAULT 1 COMMENT '1 = Active, 0 = Inactive',
|
||||||
|
created_by INT ,
|
||||||
|
updated_by INT ,
|
||||||
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP ,
|
||||||
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE course_semester_fees (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY ,
|
||||||
|
course_id INT NOT NULL,
|
||||||
|
online_fee DECIMAL(10,2) DEFAULT 0.00 NOT NULL,
|
||||||
|
discount DECIMAL(10,2) DEFAULT 0.00,
|
||||||
|
monthly_installment_amount DECIMAL(10,2) DEFAULT 0.00 ,
|
||||||
|
upfront_deposit DECIMAL(10,2) DEFAULT 0.00 ,
|
||||||
|
blended_fee DECIMAL(10,2) DEFAULT 0.00,
|
||||||
|
certificate_fee DECIMAL(10,2) DEFAULT 0.00 COMMENT '100.00 for printed certificate',
|
||||||
|
status TINYINT(4) DEFAULT 1 COMMENT ' 1 = Active, 0 = Inactive',
|
||||||
|
created_by INT,
|
||||||
|
updated_by INT ,
|
||||||
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP ,
|
||||||
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- -----------------
|
||||||
|
INSERT INTO `sub_modules` (`id`, `module_id`, `name`, `controller_name`, `icon`, `sequence`, `created_on`, `modified_on`) VALUES ('3347', '1004', 'Course Category', 'CourseCategories', '<i class="fa fa-angle-double-right"></i>', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('3348', '1004', 'Qualification Type', 'QualificationTypes', '<i class="fa fa-angle-double-right"></i>', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17');
|
||||||
|
INSERT INTO `pages` (`id`, `module_id`, `sub_module_id`, `name`, `method_name`, `available_to_company`, `created_on`, `modified_on`)
|
||||||
|
VALUES ('10171', '1004', '3347', 'index', 'index', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10172', '1004', '3347', 'add', 'add', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10173', '1004', '3347', 'edit', 'edit', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10174', '1004', '3347', 'view', 'view', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10175', '1004', '3347', 'delete', 'delete', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
|
||||||
|
('10177', '1004', '3348', 'index', 'index', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10178', '1004', '3348', 'add', 'add', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10179', '1004', '3348', 'edit', 'edit', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10180', '1004', '3348', 'view', 'view', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17'),
|
||||||
|
('10181', '1004', '3348', 'delete', 'delete', '1', '2024-08-28 11:46:17', '2024-08-28 11:46:17');
|
||||||
|
|
||||||
|
-- deployed
|
||||||
|
|
||||||
|
ALTER TABLE `courses` ADD `qualification_time` SMALLINT NULL DEFAULT '0' AFTER `progression_routes`, ADD `centre_specification_link` VARCHAR(200) NULL DEFAULT NULL AFTER `qualification_time`;
|
||||||
|
ALTER TABLE `courses` ADD `image_path` VARCHAR(150) NULL DEFAULT NULL AFTER `description`;
|
||||||
|
ALTER TABLE `courses` ADD `accreditation_status` TINYINT(4) NOT NULL DEFAULT '1' AFTER `code`;
|
||||||
|
|
||||||
|
-- deployed
|
||||||
16
index.php
Normal file
16
index.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
* @since 0.10.0
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
require 'webroot' . DIRECTORY_SEPARATOR . 'index.php';
|
||||||
39
phpunit.xml.dist
Normal file
39
phpunit.xml.dist
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit
|
||||||
|
colors="true"
|
||||||
|
processIsolation="false"
|
||||||
|
stopOnFailure="false"
|
||||||
|
syntaxCheck="false"
|
||||||
|
bootstrap="./tests/bootstrap.php"
|
||||||
|
>
|
||||||
|
<php>
|
||||||
|
<ini name="memory_limit" value="-1"/>
|
||||||
|
<ini name="apc.enable_cli" value="1"/>
|
||||||
|
</php>
|
||||||
|
|
||||||
|
<!-- Add any additional test suites you want to run here -->
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="App Test Suite">
|
||||||
|
<directory>./tests/TestCase</directory>
|
||||||
|
</testsuite>
|
||||||
|
<!-- Add plugin test suites here. -->
|
||||||
|
</testsuites>
|
||||||
|
|
||||||
|
<!-- Setup a listener for fixtures -->
|
||||||
|
<listeners>
|
||||||
|
<listener
|
||||||
|
class="\Cake\TestSuite\Fixture\FixtureInjector"
|
||||||
|
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
|
||||||
|
<arguments>
|
||||||
|
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
|
||||||
|
</arguments>
|
||||||
|
</listener>
|
||||||
|
</listeners>
|
||||||
|
|
||||||
|
<!-- Ignore vendor tests in code coverage reports -->
|
||||||
|
<filter>
|
||||||
|
<blacklist>
|
||||||
|
<directory suffix=".php">./vendor/</directory>
|
||||||
|
</blacklist>
|
||||||
|
</filter>
|
||||||
|
</phpunit>
|
||||||
0
satisfiable
Normal file
0
satisfiable
Normal file
39
src/Auth/CmsPasswordHasher.php
Normal file
39
src/Auth/CmsPasswordHasher.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Auth;
|
||||||
|
|
||||||
|
use Cake\Auth\AbstractPasswordHasher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: jse
|
||||||
|
* Date: 28/09/2015
|
||||||
|
* Time: 15:33
|
||||||
|
*/
|
||||||
|
class CmsPasswordHasher extends AbstractPasswordHasher
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates password hash.
|
||||||
|
*
|
||||||
|
* @param string|array $password Plain text password to hash or array of data
|
||||||
|
* required to generate password hash.
|
||||||
|
* @return string Password hash
|
||||||
|
*/
|
||||||
|
public function hash($password)
|
||||||
|
{
|
||||||
|
return md5($password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check hash. Generate hash from user provided password string or data array
|
||||||
|
* and check against existing hash.
|
||||||
|
*
|
||||||
|
* @param string|array $password Plain text password to hash or data array.
|
||||||
|
* @param string $hashedPassword Existing hashed password.
|
||||||
|
* @return bool True if hashes match else false.
|
||||||
|
*/
|
||||||
|
public function check($password, $hashedPassword)
|
||||||
|
{
|
||||||
|
return md5($password) === $hashedPassword;
|
||||||
|
}
|
||||||
|
}
|
||||||
21
src/Common/CorePermission.php
Normal file
21
src/Common/CorePermission.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Common;
|
||||||
|
|
||||||
|
|
||||||
|
class CorePermission{
|
||||||
|
|
||||||
|
protected static function isPermittedFromSessionByControllerId($controller_id){
|
||||||
|
$result = false;
|
||||||
|
$access_controllers = $_SESSION['access_controller'];
|
||||||
|
if (!empty($access_controllers)) {
|
||||||
|
foreach ($access_controllers as $controller) {
|
||||||
|
if ($controller['id'] == $controller_id) {
|
||||||
|
$result = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
42
src/Common/Permission.php
Normal file
42
src/Common/Permission.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Common;
|
||||||
|
|
||||||
|
use App\Utility\Common;
|
||||||
|
|
||||||
|
class Permission extends CorePermission
|
||||||
|
{
|
||||||
|
|
||||||
|
public static function isPermitted($controller_id = 0)
|
||||||
|
{
|
||||||
|
$result = false;
|
||||||
|
$common = new Common();
|
||||||
|
$user_type_name = $common->getCurrentUserInfo();
|
||||||
|
if ($user_type_name == "MEMBER" || self::isEmployeeAsAdmin()) {
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isEmployeeAsAdmin(){
|
||||||
|
$result = false;
|
||||||
|
$common = new Common();
|
||||||
|
$user_type_name = $common->getCurrentUserInfo();
|
||||||
|
if ($user_type_name == "EMPLOYEE" && $_SESSION['Auth']['User']['is_admin_access'] == 1) {
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setPermissionForEmployee($controller_id)
|
||||||
|
{
|
||||||
|
unset($_SESSION['hasEpicVelocity']);
|
||||||
|
if (self::isPermittedFromSessionByControllerId($controller_id) && $_SESSION['has_epic_for_employee']) {
|
||||||
|
$_SESSION['hasEpicVelocity'] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
192
src/Console/Installer.php
Normal file
192
src/Console/Installer.php
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
* @since 3.0.0
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
namespace App\Console;
|
||||||
|
|
||||||
|
use Composer\Script\Event;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides installation hooks for when this application is installed via
|
||||||
|
* composer. Customize this class to suit your needs.
|
||||||
|
*/
|
||||||
|
class Installer
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does some routine installation tasks so people don't have to.
|
||||||
|
*
|
||||||
|
* @param \Composer\Script\Event $event The composer event object.
|
||||||
|
* @throws \Exception Exception raised by validator.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function postInstall(Event $event)
|
||||||
|
{
|
||||||
|
$io = $event->getIO();
|
||||||
|
|
||||||
|
$rootDir = dirname(dirname(__DIR__));
|
||||||
|
|
||||||
|
static::createAppConfig($rootDir, $io);
|
||||||
|
static::createWritableDirectories($rootDir, $io);
|
||||||
|
|
||||||
|
// ask if the permissions should be changed
|
||||||
|
if ($io->isInteractive()) {
|
||||||
|
$validator = function ($arg) {
|
||||||
|
if (in_array($arg, ['Y', 'y', 'N', 'n'])) {
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
throw new Exception('This is not a valid answer. Please choose Y or n.');
|
||||||
|
};
|
||||||
|
$setFolderPermissions = $io->askAndValidate(
|
||||||
|
'<info>Set Folder Permissions ? (Default to Y)</info> [<comment>Y,n</comment>]? ',
|
||||||
|
$validator,
|
||||||
|
10,
|
||||||
|
'Y'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (in_array($setFolderPermissions, ['Y', 'y'])) {
|
||||||
|
static::setFolderPermissions($rootDir, $io);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
static::setFolderPermissions($rootDir, $io);
|
||||||
|
}
|
||||||
|
|
||||||
|
static::setSecuritySalt($rootDir, $io);
|
||||||
|
|
||||||
|
if (class_exists('\Cake\Codeception\Console\Installer')) {
|
||||||
|
\Cake\Codeception\Console\Installer::customizeCodeceptionBinary($event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the config/app.php file if it does not exist.
|
||||||
|
*
|
||||||
|
* @param string $dir The application's root directory.
|
||||||
|
* @param \Composer\IO\IOInterface $io IO interface to write to console.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function createAppConfig($dir, $io)
|
||||||
|
{
|
||||||
|
$appConfig = $dir . '/config/app.php';
|
||||||
|
$defaultConfig = $dir . '/config/app.default.php';
|
||||||
|
if (!file_exists($appConfig)) {
|
||||||
|
copy($defaultConfig, $appConfig);
|
||||||
|
$io->write('Created `config/app.php` file');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the `logs` and `tmp` directories.
|
||||||
|
*
|
||||||
|
* @param string $dir The application's root directory.
|
||||||
|
* @param \Composer\IO\IOInterface $io IO interface to write to console.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function createWritableDirectories($dir, $io)
|
||||||
|
{
|
||||||
|
$paths = [
|
||||||
|
'logs',
|
||||||
|
'tmp',
|
||||||
|
'tmp/cache',
|
||||||
|
'tmp/cache/models',
|
||||||
|
'tmp/cache/persistent',
|
||||||
|
'tmp/cache/views',
|
||||||
|
'tmp/sessions',
|
||||||
|
'tmp/tests'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($paths as $path) {
|
||||||
|
$path = $dir . '/' . $path;
|
||||||
|
if (!file_exists($path)) {
|
||||||
|
mkdir($path);
|
||||||
|
$io->write('Created `' . $path . '` directory');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set globally writable permissions on the "tmp" and "logs" directory.
|
||||||
|
*
|
||||||
|
* This is not the most secure default, but it gets people up and running quickly.
|
||||||
|
*
|
||||||
|
* @param string $dir The application's root directory.
|
||||||
|
* @param \Composer\IO\IOInterface $io IO interface to write to console.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function setFolderPermissions($dir, $io)
|
||||||
|
{
|
||||||
|
// Change the permissions on a path and output the results.
|
||||||
|
$changePerms = function ($path, $perms, $io) {
|
||||||
|
// Get current permissions in decimal format so we can bitmask it.
|
||||||
|
$currentPerms = octdec(substr(sprintf('%o', fileperms($path)), -4));
|
||||||
|
if (($currentPerms & $perms) == $perms) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = chmod($path, $currentPerms | $perms);
|
||||||
|
if ($res) {
|
||||||
|
$io->write('Permissions set on ' . $path);
|
||||||
|
} else {
|
||||||
|
$io->write('Failed to set permissions on ' . $path);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$walker = function ($dir, $perms, $io) use (&$walker, $changePerms) {
|
||||||
|
$files = array_diff(scandir($dir), ['.', '..']);
|
||||||
|
foreach ($files as $file) {
|
||||||
|
$path = $dir . '/' . $file;
|
||||||
|
|
||||||
|
if (!is_dir($path)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$changePerms($path, $perms, $io);
|
||||||
|
$walker($path, $perms, $io);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$worldWritable = bindec('0000000111');
|
||||||
|
$walker($dir . '/tmp', $worldWritable, $io);
|
||||||
|
$changePerms($dir . '/tmp', $worldWritable, $io);
|
||||||
|
$changePerms($dir . '/logs', $worldWritable, $io);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the security.salt value in the application's config file.
|
||||||
|
*
|
||||||
|
* @param string $dir The application's root directory.
|
||||||
|
* @param \Composer\IO\IOInterface $io IO interface to write to console.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function setSecuritySalt($dir, $io)
|
||||||
|
{
|
||||||
|
$config = $dir . '/config/app.php';
|
||||||
|
$content = file_get_contents($config);
|
||||||
|
|
||||||
|
$newKey = hash('sha256', $dir . php_uname() . microtime(true));
|
||||||
|
$content = str_replace('__SALT__', $newKey, $content, $count);
|
||||||
|
|
||||||
|
if ($count == 0) {
|
||||||
|
$io->write('No Security.salt placeholder to replace.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = file_put_contents($config, $content);
|
||||||
|
if ($result) {
|
||||||
|
$io->write('Updated Security.salt value in config/app.php');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$io->write('Unable to update Security.salt value.');
|
||||||
|
}
|
||||||
|
}
|
||||||
141
src/Controller/AgentController.php
Normal file
141
src/Controller/AgentController.php
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Agent Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\AgentsTable $Agents
|
||||||
|
*/
|
||||||
|
class AgentController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
private $controller = "agent";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('Agents');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'id' => 'asc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(first_name LIKE ' . "'%" . $search . "%'" . 'OR last_name LIKE ' . "'%" . $search .
|
||||||
|
"%'".'OR email LIKE ' . "'%" . $search . "%'".'OR phone_number LIKE ' . "'%" . $search . "%'".')' ;
|
||||||
|
}
|
||||||
|
$agents = $this->Agents->find('all')->where($condition);
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('agents', $this->paginate($agents));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '10167', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
|
||||||
|
$agent = $this->Agents->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$agent = $this->Agents->patchEntity($agent, $request);
|
||||||
|
$errors = $agent->errors();
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Agents->save($agent)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The agent has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'add']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('Unable to add the agent.'));
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$agent = $this->Agents->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$request = $this->request->data;
|
||||||
|
$agent = $this->Agents->patchEntity($agent, $request);
|
||||||
|
$errors = $agent->errors();
|
||||||
|
$agent['updated_at'] = FrozenTime::now();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Agents->save($agent)) {
|
||||||
|
$this->Flash->success(__('The agent has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The agent could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('agent', $agent);
|
||||||
|
$this->set('_serialize', ['agent']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$agent = $this->Agents->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('agent', $agent);
|
||||||
|
$this->set('_serialize', ['agent']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$agent = $this->Agents->get($id);
|
||||||
|
|
||||||
|
if ($this->Agents->delete($agent)) {
|
||||||
|
$this->Flash->success(__('The agent has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The agent could not be deleted. Please try again.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10166', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
95
src/Controller/ApiController.php
Normal file
95
src/Controller/ApiController.php
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Common\Permission;
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use RingCentral\SDK\SDK;
|
||||||
|
use App\Helper\commonLogic;
|
||||||
|
use App\Utility\Common;
|
||||||
|
use App\Utility\PdfWriter;
|
||||||
|
use Cake\View\View;
|
||||||
|
use App\Utility\IdentityIQParse;
|
||||||
|
use App\Utility\PasswordCreator;
|
||||||
|
use Cake\Routing\Router;
|
||||||
|
use App\Utility\EpicvelocityPrint;
|
||||||
|
use App\Utility\CreditAnalysis;
|
||||||
|
use HTML5_Parser;
|
||||||
|
use Kreait\Firebase;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class ApiController extends AppsController {
|
||||||
|
|
||||||
|
public function initialize() {
|
||||||
|
|
||||||
|
parent::initialize();
|
||||||
|
|
||||||
|
$this->loadComponent('RequestHandler'); // Allow JSON request handling
|
||||||
|
|
||||||
|
$this->response = $this->response->withHeader('Access-Control-Allow-Origin', '*');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function login()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->request->allowMethod(['post']);
|
||||||
|
|
||||||
|
// Disable view rendering (no need for .ctp file)
|
||||||
|
$this->viewBuilder()->setLayout(false); // Disable layout rendering if you're returning JSON
|
||||||
|
$this->response = $this->response->withType('application/json');
|
||||||
|
|
||||||
|
// Example response
|
||||||
|
$response = [
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'Login successful'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Set the response data to be serialized as JSON
|
||||||
|
$this->set($response);
|
||||||
|
$this->set('_serialize', array_keys($response)); // Automatically serialize response
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fileupload()
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post']); // Only allow POST requests
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$file = $this->request->getData('file');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Generate a new filename
|
||||||
|
$filename = time() . '-' . $file->getClientFilename();
|
||||||
|
|
||||||
|
// Define the target directory
|
||||||
|
$targetPath = WWW_ROOT . 'files' . DS;
|
||||||
|
|
||||||
|
$firebase = (new Factory)
|
||||||
|
->withServiceAccount(Configure::read('firebase.key_file'))
|
||||||
|
->createStorage();
|
||||||
|
|
||||||
|
// Access Firebase storage
|
||||||
|
$bucket = $firebase->getBucket();
|
||||||
|
|
||||||
|
// Move the file to the target directory
|
||||||
|
$file->moveTo($targetPath . $filename);
|
||||||
|
|
||||||
|
// Save the file details in the database (if applicable)
|
||||||
|
$fileEntity = $this->Files->newEmptyEntity();
|
||||||
|
$fileEntity->filename = $filename;
|
||||||
|
$fileEntity->filepath = 'files/' . $filename; // The relative path to the file
|
||||||
|
|
||||||
|
return $this->response->withType('application/json')
|
||||||
|
->withStringBody(json_encode(['status' => 'success', 'filename' => $filename]));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
179
src/Controller/AppController.php
Normal file
179
src/Controller/AppController.php
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
|
||||||
|
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
|
||||||
|
* @link https://cakephp.org CakePHP(tm) Project
|
||||||
|
* @since 0.2.9
|
||||||
|
* @license https://opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Utility\EmailQueue\EmailQueue;
|
||||||
|
use Cake\Controller\Controller;
|
||||||
|
use Cake\Mailer\Email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application Controller
|
||||||
|
*
|
||||||
|
* Add your application-wide methods in the class below, your controllers
|
||||||
|
* will inherit them.
|
||||||
|
*
|
||||||
|
* @link https://book.cakephp.org/4/en/controllers.html#the-app-controller
|
||||||
|
*/
|
||||||
|
class AppController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Initialization hook method.
|
||||||
|
*
|
||||||
|
* Use this method to add common initialization code like loading components.
|
||||||
|
*
|
||||||
|
* e.g. `$this->loadComponent('FormProtection');`
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
|
||||||
|
$this->loadComponent('RequestHandler');
|
||||||
|
$this->loadComponent('Flash');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable the following component for recommended CakePHP form protection settings.
|
||||||
|
* see https://book.cakephp.org/4/en/controllers/components/form-protection.html
|
||||||
|
*/
|
||||||
|
//$this->loadComponent('FormProtection');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendEmail($templateName, $templateContent, $to, $sub = "New registration", $attachment = "", $personalize = null) {
|
||||||
|
$APP_SMTP_USERNAME = APP_SMTP_USERNAME;
|
||||||
|
$APP_SMTP_FROM_NAME = APP_SMTP_FROM_NAME;
|
||||||
|
$APP_EMAIL_CLASS = APP_EMAIL_CLASS;
|
||||||
|
$APP_SMTP_HOST = APP_SMTP_HOST;
|
||||||
|
$APP_SMTP_PORT = APP_SMTP_PORT;
|
||||||
|
$APP_SMTP_TIMEOUT = APP_SMTP_TIMEOUT;
|
||||||
|
$APP_SMTP_PASSWORD = APP_SMTP_PASSWORD;
|
||||||
|
$APP_SMTP_IS_TLS = APP_SMTP_IS_TLS;
|
||||||
|
|
||||||
|
|
||||||
|
if (!empty($personalize)) {
|
||||||
|
$templateContent['email_signature'] = $personalize->email_signature;
|
||||||
|
if ($personalize->is_smtp == 1) {
|
||||||
|
$APP_SMTP_USERNAME = $personalize->username;
|
||||||
|
$APP_SMTP_FROM_NAME = $personalize->smtp_from;
|
||||||
|
$APP_SMTP_HOST = $personalize->smtp_host;
|
||||||
|
$APP_SMTP_PORT = $personalize->smtp_port;
|
||||||
|
$APP_SMTP_PASSWORD = $personalize->password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$SMTP_FORM_EMAIL = $APP_SMTP_USERNAME;
|
||||||
|
|
||||||
|
if($APP_SMTP_HOST == 'sandbox.smtp.mailtrap.io'){
|
||||||
|
$SMTP_FORM_EMAIL = $APP_SMTP_FROM_NAME;
|
||||||
|
}else if($APP_SMTP_HOST == "smtp.mail.yahoo.com"){
|
||||||
|
$APP_SMTP_IS_TLS = true;
|
||||||
|
$is_yahoo = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$default = [
|
||||||
|
'className' => $APP_EMAIL_CLASS,
|
||||||
|
'host' => $APP_SMTP_HOST,
|
||||||
|
'port' => $APP_SMTP_PORT,
|
||||||
|
//'timeout' => $APP_SMTP_TIMEOUT,
|
||||||
|
'username' => $APP_SMTP_USERNAME,
|
||||||
|
'password' => $APP_SMTP_PASSWORD,
|
||||||
|
//'tls' => $APP_SMTP_IS_TLS,
|
||||||
|
'tls' => true,
|
||||||
|
//'log'=> true
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($templateContent['company_email']) && !empty($templateContent['company_email'])){
|
||||||
|
$SMTP_FORM_EMAIL = $templateContent['company_email'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($templateContent['company_name']) && !empty($templateContent['company_name'])){
|
||||||
|
$APP_SMTP_FROM_NAME = $templateContent['company_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(IS_QUEUE_ENABLE){
|
||||||
|
$data = $templateContent;
|
||||||
|
$options['member_id'] = 0;
|
||||||
|
if (!empty($personalize) && $personalize->is_smtp == 1) {
|
||||||
|
if($personalize->member_id > 0){
|
||||||
|
$options['member_id'] = $personalize->member_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$new_file_link = "";
|
||||||
|
if(!empty($attachment) && file_exists($attachment)){
|
||||||
|
$att_email_queue_dir = WWW_ROOT."email_queue/".$this->Auth->user('id');
|
||||||
|
if(!is_dir($att_email_queue_dir)){
|
||||||
|
mkdir($att_email_queue_dir,0777,true);
|
||||||
|
}
|
||||||
|
$extension = pathinfo($attachment, PATHINFO_EXTENSION);
|
||||||
|
$new_file_name = time().".".$extension;
|
||||||
|
$new_file_link = $att_email_queue_dir."/".$new_file_name;
|
||||||
|
@copy($attachment, $new_file_link);
|
||||||
|
}
|
||||||
|
//$options['from_name'] = $APP_SMTP_FROM_NAME;
|
||||||
|
$options['from_name'] = $APP_SMTP_FROM_NAME;
|
||||||
|
$options['from_email'] = $SMTP_FORM_EMAIL;
|
||||||
|
$options['subject'] = $sub;
|
||||||
|
$options['template'] = $templateName;
|
||||||
|
$options['format'] = 'html';
|
||||||
|
$options['attachments'] = $new_file_link;
|
||||||
|
EmailQueue::enqueue($to, $data, $options);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
try {
|
||||||
|
$email = new Email();
|
||||||
|
if (!empty($personalize) && $personalize->is_smtp == 1) {
|
||||||
|
Email::configTransport('custom', $default);
|
||||||
|
$email->transport('custom');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$email->transport('default');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($templateContent['no_reply']) && !empty($templateContent['no_reply'])) {
|
||||||
|
$email = $email->from($APP_SMTP_FROM_NAME);
|
||||||
|
} else {
|
||||||
|
$email = $email->from($SMTP_FORM_EMAIL,$APP_SMTP_FROM_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
$email->template($templateName)
|
||||||
|
->emailFormat('html')
|
||||||
|
->to($to)
|
||||||
|
->viewVars($templateContent)
|
||||||
|
->subject($sub);
|
||||||
|
|
||||||
|
if (!empty($attachment)) {
|
||||||
|
$email->addAttachments($attachment);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$email->send();
|
||||||
|
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
$this->log($ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
849
src/Controller/AppsController.php
Normal file
849
src/Controller/AppsController.php
Normal file
@@ -0,0 +1,849 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||||
|
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
*
|
||||||
|
* Licensed under The MIT License
|
||||||
|
* For full copyright and license information, please see the LICENSE.txt
|
||||||
|
* Redistributions of files must retain the above copyright notice.
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||||
|
* @link http://cakephp.org CakePHP(tm) Project
|
||||||
|
* @since 0.2.9
|
||||||
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Common\Permission;
|
||||||
|
use App\Utility\ManageLog;
|
||||||
|
use Cake\Controller\Controller;
|
||||||
|
use Cake\Log\Log;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use Cake\Datasource\ConnectionManager;
|
||||||
|
use Cake\Event\Event;
|
||||||
|
use Cake\Mailer\Email;
|
||||||
|
use Exception;
|
||||||
|
use Mandrill;
|
||||||
|
use stdClass;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\Routing\Router;
|
||||||
|
use Cake\Mailer\Transport;
|
||||||
|
use App\Utility\EmailQueue\EmailQueue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application Controller
|
||||||
|
*
|
||||||
|
* Add your application-wide methods in the class below, your controllers
|
||||||
|
* will inherit them.
|
||||||
|
*
|
||||||
|
* @link http://book.cakephp.org/3.0/en/controllers.html#the-app-controller
|
||||||
|
*/
|
||||||
|
abstract class AppsController extends Controller {
|
||||||
|
|
||||||
|
//public $global_login_redirect = "Dashboard";
|
||||||
|
|
||||||
|
var $languages = array('en' => 'English', 'ko' => 'Korean', 'chi' => 'Chinese');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization hook method.
|
||||||
|
*
|
||||||
|
* Use this method to add common initialization code like loading components.
|
||||||
|
*
|
||||||
|
* e.g. `$this->loadComponent('Security');`
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initialize() {
|
||||||
|
parent::initialize();
|
||||||
|
|
||||||
|
|
||||||
|
$this->loadComponent('RequestHandler');
|
||||||
|
$this->loadComponent('Cookie', ['expiry' => '1 day']);
|
||||||
|
$this->loadComponent('Flash');
|
||||||
|
$this->loadModel('Settings');
|
||||||
|
|
||||||
|
$controller = 'Cmsusers';
|
||||||
|
$loginRedirect_controller = 'Dashboard';
|
||||||
|
|
||||||
|
$this->loadComponent('Auth', [
|
||||||
|
'authorize' => ['Controller'],
|
||||||
|
'authenticate' => [
|
||||||
|
'Form' => [
|
||||||
|
'userModel' => $controller,
|
||||||
|
'passwordHasher' => [
|
||||||
|
'className' => 'Cms'
|
||||||
|
],
|
||||||
|
'fields' => [
|
||||||
|
'username' => 'email',
|
||||||
|
'password' => 'password'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'loginAction' => [
|
||||||
|
'controller' => $controller,
|
||||||
|
'action' => 'login'
|
||||||
|
],
|
||||||
|
'loginRedirect' => [
|
||||||
|
'controller' => $loginRedirect_controller,
|
||||||
|
'action' => 'index'
|
||||||
|
],
|
||||||
|
'logoutRedirect' => [
|
||||||
|
'controller' => $controller,
|
||||||
|
'action' => 'login'
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->setCompanyID();
|
||||||
|
$this->Auth->allow(['display']);
|
||||||
|
|
||||||
|
$setting = $this->Settings->getCurrentSettings();
|
||||||
|
$this->set('setting', $setting);
|
||||||
|
$this->manageDomainName();
|
||||||
|
|
||||||
|
// pr($_SESSION);exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeFilter(Event $event) {
|
||||||
|
|
||||||
|
if ($this->request->session()->read('Config.language')) {
|
||||||
|
$language = $this->request->session()->read('Config.language');
|
||||||
|
if ($language != I18n::defaultLocale()) {
|
||||||
|
I18n::locale($language);
|
||||||
|
$this->set("current_lang", $language);
|
||||||
|
} else {
|
||||||
|
$this->set("current_lang", I18n::defaultLocale());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->set("current_lang", I18n::defaultLocale());
|
||||||
|
}
|
||||||
|
if ($this->request->session()->read('Auth.User.id')) {
|
||||||
|
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$current_url = strtolower(Router::url());
|
||||||
|
|
||||||
|
}
|
||||||
|
$this->user_id = $user_id = $this->request->session()->read('Auth.User.id');
|
||||||
|
$base_url = Router::url('/');
|
||||||
|
$this->set('base_url', $base_url);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCompanyID() {
|
||||||
|
$this->set('company_id', $this->Auth->user('company_id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateRandomString($length = 10) {
|
||||||
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
$charactersLength = strlen($characters);
|
||||||
|
$randomString = '';
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||||
|
}
|
||||||
|
return $randomString;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function sendEmail($templateName, $templateContent, $to, $sub = "New User registration", $attachment = "", $personalize = null) {
|
||||||
|
$APP_SMTP_USERNAME = APP_SMTP_USERNAME;
|
||||||
|
$APP_SMTP_FROM_NAME = APP_SMTP_FROM_NAME;
|
||||||
|
$APP_EMAIL_CLASS = APP_EMAIL_CLASS;
|
||||||
|
$APP_SMTP_HOST = APP_SMTP_HOST;
|
||||||
|
$APP_SMTP_PORT = APP_SMTP_PORT;
|
||||||
|
$APP_SMTP_TIMEOUT = APP_SMTP_TIMEOUT;
|
||||||
|
$APP_SMTP_PASSWORD = APP_SMTP_PASSWORD;
|
||||||
|
$APP_SMTP_IS_TLS = APP_SMTP_IS_TLS;
|
||||||
|
|
||||||
|
if (!empty($personalize)) {
|
||||||
|
$templateContent['email_signature'] = $personalize->email_signature;
|
||||||
|
if ($personalize->is_smtp == 1) {
|
||||||
|
$APP_SMTP_USERNAME = $personalize->username;
|
||||||
|
$APP_SMTP_FROM_NAME = $personalize->smtp_from;
|
||||||
|
$APP_SMTP_HOST = $personalize->smtp_host;
|
||||||
|
$APP_SMTP_PORT = $personalize->smtp_port;
|
||||||
|
$APP_SMTP_PASSWORD = $personalize->password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$SMTP_FORM_EMAIL = $APP_SMTP_USERNAME;
|
||||||
|
|
||||||
|
if($APP_SMTP_HOST == 'sandbox.smtp.mailtrap.io'){
|
||||||
|
$SMTP_FORM_EMAIL = $APP_SMTP_FROM_NAME;
|
||||||
|
}
|
||||||
|
else if($APP_SMTP_HOST == "smtp.mail.yahoo.com"){
|
||||||
|
$APP_SMTP_IS_TLS = true;
|
||||||
|
$is_yahoo = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$default = [
|
||||||
|
'className' => $APP_EMAIL_CLASS,
|
||||||
|
'host' => $APP_SMTP_HOST,
|
||||||
|
'port' => $APP_SMTP_PORT,
|
||||||
|
//'timeout' => $APP_SMTP_TIMEOUT,
|
||||||
|
'username' => $APP_SMTP_USERNAME,
|
||||||
|
'password' => $APP_SMTP_PASSWORD,
|
||||||
|
//'tls' => $APP_SMTP_IS_TLS,
|
||||||
|
'tls' => true,
|
||||||
|
//'log'=> true
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($templateContent['company_email']) && !empty($templateContent['company_email'])){
|
||||||
|
$SMTP_FORM_EMAIL = $templateContent['company_email'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($templateContent['company_name']) && !empty($templateContent['company_name'])){
|
||||||
|
$APP_SMTP_FROM_NAME = $templateContent['company_name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(IS_QUEUE_ENABLE){
|
||||||
|
$data = $templateContent;
|
||||||
|
$options['member_id'] = 0;
|
||||||
|
if (!empty($personalize) && $personalize->is_smtp == 1) {
|
||||||
|
if($personalize->member_id > 0){
|
||||||
|
$options['member_id'] = $personalize->member_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$new_file_link = "";
|
||||||
|
if(!empty($attachment) && file_exists($attachment)){
|
||||||
|
$att_email_queue_dir = WWW_ROOT."email_queue/".$this->Auth->user('id');
|
||||||
|
if(!is_dir($att_email_queue_dir)){
|
||||||
|
mkdir($att_email_queue_dir,0777,true);
|
||||||
|
}
|
||||||
|
$extension = pathinfo($attachment, PATHINFO_EXTENSION);
|
||||||
|
$new_file_name = time().".".$extension;
|
||||||
|
$new_file_link = $att_email_queue_dir."/".$new_file_name;
|
||||||
|
@copy($attachment, $new_file_link);
|
||||||
|
}
|
||||||
|
//$options['from_name'] = $APP_SMTP_FROM_NAME;
|
||||||
|
$options['from_name'] = $APP_SMTP_FROM_NAME;
|
||||||
|
$options['from_email'] = $SMTP_FORM_EMAIL;
|
||||||
|
$options['subject'] = $sub;
|
||||||
|
$options['template'] = $templateName;
|
||||||
|
$options['format'] = 'html';
|
||||||
|
$options['attachments'] = $new_file_link;
|
||||||
|
EmailQueue::enqueue($to, $data, $options);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
try {
|
||||||
|
$email = new Email();
|
||||||
|
if (!empty($personalize) && $personalize->is_smtp == 1) {
|
||||||
|
Email::configTransport('custom', $default);
|
||||||
|
$email->transport('custom');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$email->transport('default');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($templateContent['no_reply']) && !empty($templateContent['no_reply'])) {
|
||||||
|
$email = $email->from($APP_SMTP_FROM_NAME);
|
||||||
|
} else {
|
||||||
|
$email = $email->from($SMTP_FORM_EMAIL,$APP_SMTP_FROM_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
$email->template($templateName)
|
||||||
|
->emailFormat('html')
|
||||||
|
->to($to)
|
||||||
|
->viewVars($templateContent)
|
||||||
|
->subject($sub);
|
||||||
|
|
||||||
|
if (!empty($attachment)) {
|
||||||
|
$email->addAttachments($attachment);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$email->send();
|
||||||
|
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
$this->log($ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Before render callback.
|
||||||
|
*
|
||||||
|
* @param \Cake\Event\Event $event The beforeRender event.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function beforeRender(Event $event) {
|
||||||
|
|
||||||
|
if (!array_key_exists('_serialize', $this->viewVars) &&
|
||||||
|
in_array($this->response->type(), ['application/json', 'application/xml'])
|
||||||
|
) {
|
||||||
|
$this->set('_serialize', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user) {
|
||||||
|
$controller = $this->request->params['controller'];
|
||||||
|
$access_controllers_name = array();
|
||||||
|
// echo $_SESSION["userType"];exit;
|
||||||
|
if ($_SESSION["userType"] == CMS_USER_INDICATOR) {
|
||||||
|
//echo 'this is';exit;
|
||||||
|
// get current controller
|
||||||
|
// get CRM controller list from constant
|
||||||
|
// if current controller exist in CRM controller list then no need to check further code. Just return true
|
||||||
|
// echo "sdfsdf";exit;
|
||||||
|
$session = $this->request->session();
|
||||||
|
//TODO - Change the logic of saving the user permissions
|
||||||
|
$previous_permission_version = $session->read('permission_version');
|
||||||
|
$current_permission_version = TableRegistry::get('cmsusers')->get($user['id'])->permission_version;
|
||||||
|
if ($current_permission_version !== $previous_permission_version) {
|
||||||
|
unset($_SESSION['hasEpicVelocity']);
|
||||||
|
unset($_SESSION['hasVelocity']);
|
||||||
|
unset($_SESSION['hasLS_Fax_Rtg_user']);
|
||||||
|
unset($_SESSION['has_only_super_rtg_user']);
|
||||||
|
unset($_SESSION['has_limited_version']);
|
||||||
|
unset($_SESSION['has_limited_time']);
|
||||||
|
|
||||||
|
$this->loadModel('MemberPackages');
|
||||||
|
$member_id = $user['id'];
|
||||||
|
|
||||||
|
$this->addPermissionsAndVersionToSession($session, $user, $current_permission_version);
|
||||||
|
$this->limitedTimePkgCheck();
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_permissions = $session->read('user_permissions');
|
||||||
|
|
||||||
|
$request_action = strtolower($this->request->params['action']);
|
||||||
|
|
||||||
|
$pages = $this->getPages();
|
||||||
|
// print_r($pages);exit;
|
||||||
|
if (array_key_exists($request_action, $pages)) {
|
||||||
|
$action_page_id = $pages[$request_action];
|
||||||
|
foreach ($user_permissions as $permission) {
|
||||||
|
if ($permission['page_id'] == $action_page_id) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!array_key_exists("Dashboard", $this->getModules())) {
|
||||||
|
$this->Flash->error(__('You do not have permission to access this page'));
|
||||||
|
}
|
||||||
|
} else if ($_SESSION["userType"] == CRM_USER_INDICATOR) {
|
||||||
|
// CRM user
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($_SESSION['access_controller'] as $key => $access_conroller) {
|
||||||
|
// pr($access_conroller['controller_name']);
|
||||||
|
$access_controllers_name[] = $access_conroller['controller_name'];
|
||||||
|
}
|
||||||
|
if($_SESSION['Auth']['User']['type'] == 1){
|
||||||
|
//pr($this->Auth->user());exit;
|
||||||
|
if(!in_array("Uploadhtml",$access_controllers_name) && $this->Auth->user('has_analysis_analyzer') == 1){
|
||||||
|
$access_controllers_name[] = "Uploadhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($controller, $access_controllers_name)) {
|
||||||
|
|
||||||
|
$session = $this->request->session();
|
||||||
|
//TODO - Change the logic of saving the user permissions
|
||||||
|
$previous_permission_version = $session->read('permission_version');
|
||||||
|
$current_permission_version = TableRegistry::get('cmsusers')->get($user['id'])->permission_version;
|
||||||
|
|
||||||
|
|
||||||
|
if ($current_permission_version !== $previous_permission_version) {
|
||||||
|
$this->addPermissionsAndVersionToSession($session, $user, $current_permission_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
// $this->Flash->error(__('You do not have permission to access this page'));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Get current controller name
|
||||||
|
// get controller list from $_SESSION['access_controller']
|
||||||
|
// check the current controller name exist in user's DB controller access list or not
|
||||||
|
// if not, return false;
|
||||||
|
// return true;
|
||||||
|
} else if ($_SESSION["userType"] == CONTACT_USER_INDICATOR) {
|
||||||
|
|
||||||
|
$this->loadModel('Contacts');
|
||||||
|
$cmsuser_id = $this->Auth->user('id');
|
||||||
|
$contact_id = $this->Auth->user('user_id');
|
||||||
|
$client_info = $this->Contacts->find('all')->where(['id' => $contact_id, 'cmsuser_id' => $cmsuser_id])->toArray();
|
||||||
|
$client_id = $client_info[0]['client_id'];
|
||||||
|
|
||||||
|
$_SESSION['global_client_id'] = $client_id;
|
||||||
|
foreach ($_SESSION['access_controller'] as $key => $access_conroller) {
|
||||||
|
// pr($access_conroller['controller_name']);
|
||||||
|
$access_controllers_name[] = $access_conroller['controller_name'];
|
||||||
|
}
|
||||||
|
//echo $controller;exit;
|
||||||
|
if (in_array($controller, $access_controllers_name)) {
|
||||||
|
$session = $this->request->session();
|
||||||
|
//TODO - Change the logic of saving the user permissions
|
||||||
|
$previous_permission_version = $session->read('permission_version');
|
||||||
|
$current_permission_version = TableRegistry::get('cmsusers')->get($user['id'])->permission_version;
|
||||||
|
//pr($current_permission_version);exit;
|
||||||
|
if ($current_permission_version !== $previous_permission_version) {
|
||||||
|
$this->addPermissionsAndVersionToSession($session, $user, $current_permission_version);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if ($_SESSION["userType"] == STAF_USER_INDICATOR) {
|
||||||
|
|
||||||
|
$session = $this->request->session();
|
||||||
|
//TODO - Change the logic of saving the user permissions
|
||||||
|
$previous_permission_version = $session->read('permission_version');
|
||||||
|
$current_permission_version = TableRegistry::get('cmsusers')->get($user['id'])->permission_version;
|
||||||
|
if ($current_permission_version !== $previous_permission_version) {
|
||||||
|
$this->addPermissionsAndVersionToSession($session, $user, $current_permission_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($_SESSION['access_controller'] as $key => $access_conroller) {
|
||||||
|
// pr($access_conroller['controller_name']);
|
||||||
|
$access_controllers_name[] = $access_conroller['controller_name'];
|
||||||
|
}
|
||||||
|
if (in_array($controller, $access_controllers_name)) {
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} elseif ($_SESSION["userType"] == GUEST_USER_INDICATOR) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//echo $_SESSION["userType"];exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addPermissionsAndVersionToSession($session, $user, $current_permission_version) {
|
||||||
|
$connection = ConnectionManager::get('default');
|
||||||
|
|
||||||
|
$permission_sql = 'SELECT cmsusers.id AS user_id,pages.id AS page_id, pages.name AS page_name, modules.id AS module_id, sub_modules.name AS submodule_name, sub_modules.id AS submodule_id, sub_modules.controller_name AS controller, pages.method_name AS method
|
||||||
|
FROM cmsusers
|
||||||
|
INNER JOIN cmsuser_usergroups ON cmsusers.id = cmsuser_usergroups.cms_user_id
|
||||||
|
INNER JOIN usergroups ON cmsuser_usergroups.usergroup_id = usergroups.id
|
||||||
|
INNER JOIN usergroup_roles ON usergroups.id = usergroup_roles.usergroup_id
|
||||||
|
INNER JOIN roles ON usergroup_roles.role_id = roles.id
|
||||||
|
INNER JOIN role_pages ON roles.id = role_pages.role_id
|
||||||
|
INNER JOIN pages ON role_pages.page_id = pages.id
|
||||||
|
INNER JOIN sub_modules ON pages.sub_module_id = sub_modules.id
|
||||||
|
INNER JOIN modules ON sub_modules.module_id = modules.id
|
||||||
|
WHERE cmsusers.id =' . $user['id'] . " order by modules.id,sub_modules.id,pages.id";
|
||||||
|
|
||||||
|
$user_permissions = $connection->execute($permission_sql)->fetchAll('assoc');
|
||||||
|
|
||||||
|
|
||||||
|
$session->write('user_permissions', $user_permissions);
|
||||||
|
$session->write('permission_version', $current_permission_version);
|
||||||
|
|
||||||
|
if ($this->Auth->user('id') == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
$modules = TableRegistry::get('modules')->find('all')->contain([
|
||||||
|
'SubModules' => [
|
||||||
|
'sort' => ['SubModules.sequence' => 'ASC']
|
||||||
|
],
|
||||||
|
'SubModules.Pages' => [
|
||||||
|
'sort' => ['Pages.method_name' => 'ASC']
|
||||||
|
]
|
||||||
|
])
|
||||||
|
->order(['sequence' => 'ASC'])
|
||||||
|
->toArray();
|
||||||
|
} else {
|
||||||
|
$modules = TableRegistry::get('modules')->find('all')->contain([
|
||||||
|
'SubModules' => [
|
||||||
|
'sort' => ['SubModules.sequence' => 'ASC']
|
||||||
|
],
|
||||||
|
'SubModules.Pages' => [
|
||||||
|
'sort' => ['Pages.method_name' => 'ASC']
|
||||||
|
]
|
||||||
|
])->where([
|
||||||
|
'id NOT IN' => [1001, 1002, 1007]
|
||||||
|
])
|
||||||
|
->order(['sequence' => 'ASC'])
|
||||||
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
$modules = serialize($modules);
|
||||||
|
$session->write('modules', $modules);
|
||||||
|
//debug($modules);
|
||||||
|
// $session->write('permission_version_db', $user['permission_version']);
|
||||||
|
//
|
||||||
|
// $this->log($session->read('user_permissions'));
|
||||||
|
// $this->log($session->read('permission_version'));
|
||||||
|
// $this->log($session->read('permission_version_db'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModules() {
|
||||||
|
$request_controller = strtolower($this->request->params['controller']);
|
||||||
|
if ($request_controller == "dashboard") {
|
||||||
|
return array('Dashboard' => 'Dashboard');
|
||||||
|
}
|
||||||
|
$current_module_arr = array();
|
||||||
|
$current_submodule_arr = $this->getSubModules();
|
||||||
|
$modules = unserialize($this->request->session()->read('modules'));
|
||||||
|
if (!empty($modules)) {
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
foreach ($module['sub_modules'] as $submodule) {
|
||||||
|
if (current($current_submodule_arr) == $submodule['id']) {
|
||||||
|
$current_module_arr = array($module['name'] => $module['id']);
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $current_module_arr;
|
||||||
|
//return ['Master Data' =>'1002'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubModules() {
|
||||||
|
|
||||||
|
$request_controller = strtolower($this->request->params['controller']);
|
||||||
|
if ($request_controller == "dashboard") {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
$current_submodule_arr = array();
|
||||||
|
$modules = unserialize($this->request->session()->read('modules'));
|
||||||
|
if (!empty($modules)) {
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
foreach ($module['sub_modules'] as $submodule) {
|
||||||
|
if ($request_controller == strtolower($submodule['controller_name'])) {
|
||||||
|
$current_submodule_arr = array($submodule['name'] => $submodule['id']);
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $current_submodule_arr; // return ['Page Management' => '2022'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPages() {
|
||||||
|
$request_controller = strtolower($this->request->params['controller']);
|
||||||
|
if ($request_controller == "dashboard") {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
$pages_arr = array();
|
||||||
|
$current_submodule_arr = $this->getSubModules();
|
||||||
|
$modules = unserialize($this->request->session()->read('modules'));
|
||||||
|
if (!empty($modules)) {
|
||||||
|
foreach ($modules as $module) {
|
||||||
|
foreach ($module['sub_modules'] as $submodule) {
|
||||||
|
if (current($current_submodule_arr) == $submodule['id']) {
|
||||||
|
foreach ($submodule['pages'] as $page) {
|
||||||
|
$pages_arr[$page['method_name']] = $page['id'];
|
||||||
|
}
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// print_r( $pages_arr);exit;
|
||||||
|
|
||||||
|
return $pages_arr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
return ['index' =>'3035',
|
||||||
|
'add' => '3036',
|
||||||
|
'edit' => '3037',
|
||||||
|
'delete' =>'3038']; */
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to get the client IP address
|
||||||
|
public function get_client_ip() {
|
||||||
|
$ipaddress = '';
|
||||||
|
if (isset($_SERVER['HTTP_CLIENT_IP']))
|
||||||
|
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
|
else if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
|
||||||
|
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
|
else if (isset($_SERVER['HTTP_X_FORWARDED']))
|
||||||
|
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
|
||||||
|
else if (isset($_SERVER['HTTP_FORWARDED_FOR']))
|
||||||
|
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
|
||||||
|
else if (isset($_SERVER['HTTP_FORWARDED']))
|
||||||
|
$ipaddress = $_SERVER['HTTP_FORWARDED'];
|
||||||
|
else if (isset($_SERVER['REMOTE_ADDR']))
|
||||||
|
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
|
else
|
||||||
|
$ipaddress = 'UNKNOWN';
|
||||||
|
|
||||||
|
if (strlen($ipaddress) > 45){
|
||||||
|
$ipaddress = substr($ipaddress, 0,45);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $ipaddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCategoryNameById($id = null) {
|
||||||
|
$categoriesTable = TableRegistry::get('Categories');
|
||||||
|
$categories = $categoriesTable->find('all')
|
||||||
|
->select(['id', 'name'])
|
||||||
|
->where([
|
||||||
|
'Categories.status' => 1,
|
||||||
|
'Categories.id' => $id
|
||||||
|
])
|
||||||
|
->first();
|
||||||
|
$category_name = $categories->name;
|
||||||
|
return $category_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDateDifference($start_date = null, $end_date = null) {
|
||||||
|
if (strtotime($start_date) > strtotime($end_date)) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
$start_date = date_create($start_date);
|
||||||
|
$end_date = date_create($end_date);
|
||||||
|
|
||||||
|
$interval = date_diff($start_date, $end_date);
|
||||||
|
// return $interval->format($differenceFormat);
|
||||||
|
return $interval->days;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function _getSettingData() {
|
||||||
|
$settings = [];
|
||||||
|
$settingsTable = TableRegistry::get('Settings');
|
||||||
|
$settings = $settingsTable->find('all')
|
||||||
|
->where(['Settings.id' => 1])
|
||||||
|
->first();
|
||||||
|
return $settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isUser($user) {
|
||||||
|
|
||||||
|
$result = true;
|
||||||
|
|
||||||
|
$userType = 2;
|
||||||
|
if (isset($_SESSION["userType"])) {
|
||||||
|
$userType = $_SESSION["userType"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!empty($user) && $userType == 1) {
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
else if ($userType == 2 || $userType == 3) {
|
||||||
|
$result = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_SESSION["userType"] == CRM_USER_INDICATOR){
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
//pr($userType);exit;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUserType() {
|
||||||
|
|
||||||
|
if (isset($_SESSION['userType'])) {
|
||||||
|
$userType = $_SESSION['userType'];
|
||||||
|
if ($userType == CRM_USER_INDICATOR && !Permission::isEmployeeAsAdmin()) {
|
||||||
|
$this->viewBuilder()->layout("new_user_dashboard");
|
||||||
|
} else if ($userType == CMS_USER_INDICATOR || Permission::isEmployeeAsAdmin()) {
|
||||||
|
$this->viewBuilder()->layout("new_dashboard");
|
||||||
|
} else if ($userType == CONTACT_USER_INDICATOR) {
|
||||||
|
$this->viewBuilder()->layout("new_contact_user_dashboard");
|
||||||
|
} else if ($userType == STAF_USER_INDICATOR) {
|
||||||
|
$this->viewBuilder()->layout("new_dashboard");
|
||||||
|
} elseif ($_SESSION["userType"] == 5) {
|
||||||
|
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkUser() {
|
||||||
|
$user = $this->Auth->user();
|
||||||
|
if (!empty($user)) {
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAccessAllClients() {
|
||||||
|
$result = false;
|
||||||
|
if ($_SESSION['userType'] == CRM_USER_INDICATOR) {
|
||||||
|
$auth_employee_id = $this->Auth->user('user_id');
|
||||||
|
$is_show_all_clients = $this->Auth->user('is_show_all_clients');
|
||||||
|
if ($is_show_all_clients == 2) {
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setSteps($step_name, $member_id) {
|
||||||
|
$this->loadModel('CmsuserStatus');
|
||||||
|
$result = 1;
|
||||||
|
$memberStatusObj = $this->CmsuserStatus->getCmsuserStatusByMemberId($member_id)->toArray();
|
||||||
|
if ($memberStatusObj[$step_name] == 0) {
|
||||||
|
$result = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set("step_status", $result);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function manageDomainName($personalizeObject = null, $isSetDefault = 0) {
|
||||||
|
if (!defined('APP_SERVER_HOST_URL')) {
|
||||||
|
if (!empty($personalizeObject)) {
|
||||||
|
$www = "";
|
||||||
|
if ($personalizeObject->is_www == 1) {
|
||||||
|
$www = "www.";
|
||||||
|
}
|
||||||
|
$_SESSION['APP_SERVER_HOST_URL'] = $personalizeObject->domain_type . $www . $personalizeObject->domain . "/";
|
||||||
|
if (isset($_SESSION['APP_SERVER_HOST_URL']) && !empty($_SESSION['APP_SERVER_HOST_URL'])) {
|
||||||
|
define('APP_SERVER_HOST_URL', $_SESSION['APP_SERVER_HOST_URL']);
|
||||||
|
}
|
||||||
|
} else if (isset($_SESSION['APP_SERVER_HOST_URL']) && !empty($_SESSION['APP_SERVER_HOST_URL'])) {
|
||||||
|
define('APP_SERVER_HOST_URL', $_SESSION['APP_SERVER_HOST_URL']);
|
||||||
|
} elseif ($isSetDefault == 1) {
|
||||||
|
define('APP_SERVER_HOST_URL', APP_SERVER_HOST_URL_DEFAULT);
|
||||||
|
$_SESSION['APP_SERVER_HOST_URL'] = APP_SERVER_HOST_URL_DEFAULT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined('APP_SERVER_HOST_URL')) {
|
||||||
|
//unset($_SESSION['APP_SERVER_HOST_URL']);
|
||||||
|
}
|
||||||
|
|
||||||
|
//echo APP_SERVER_HOST_URL."<br/>";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCurrentDomain() {
|
||||||
|
$parse_url = parse_url($_SERVER['HTTP_REFERER']);
|
||||||
|
if (isset($_SESSION['referer_domain']) && $isFromLogout == 1) {
|
||||||
|
$domain = $_SESSION['referer_domain'];
|
||||||
|
} else {
|
||||||
|
$domain = $parse_url['host'];
|
||||||
|
$_SESSION['referer_domain'] = $domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($domain)) {
|
||||||
|
if (!empty($_SERVER['HTTP_HOST'])) {
|
||||||
|
$domain = $_SERVER['HTTP_HOST'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$domain = str_replace("www.", "", $domain);
|
||||||
|
// echo $domain;
|
||||||
|
return $domain;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getBaseUrl()
|
||||||
|
{
|
||||||
|
// output: /myproject/index.php
|
||||||
|
$currentPath = $_SERVER['PHP_SELF'];
|
||||||
|
|
||||||
|
// output: Array ( [dirname] => /myproject [basename] => index.php [extension] => php [filename] => index )
|
||||||
|
$pathInfo = pathinfo($currentPath);
|
||||||
|
|
||||||
|
// output: localhost
|
||||||
|
$hostName = $_SERVER['HTTP_HOST'];
|
||||||
|
|
||||||
|
// output: http://
|
||||||
|
$protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"],0,5))=='https'?'https':'http';
|
||||||
|
|
||||||
|
// return: http://localhost/myproject/
|
||||||
|
return $protocol.'://'.$hostName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function isUserMembershipActive($member_id) {
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
if (!$this->Cmsusers->isMembershipActive($member_id)) {
|
||||||
|
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'logout']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function limitedTimePkgCheck(){
|
||||||
|
$_SESSION['limited_time_days'] = 0;
|
||||||
|
$result = false;
|
||||||
|
if(isset($_SESSION['has_limited_time']) && $_SESSION['has_limited_time']){
|
||||||
|
|
||||||
|
$this->loadModel('App');
|
||||||
|
$this->loadModel('Settings');
|
||||||
|
$setting = $this->Settings->getCurrentSettings();
|
||||||
|
$required_days = $setting->limited_time_count;
|
||||||
|
if($required_days > 0){
|
||||||
|
$days = $this->App->daysBetween($this->Auth->user('created_on'),$this->App->getSystemCurrentTimeStamp());
|
||||||
|
if($days > $required_days){
|
||||||
|
$result = true;
|
||||||
|
$_SESSION['limited_time_days'] = $required_days;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Function for user log
|
||||||
|
public function appLog($data){
|
||||||
|
|
||||||
|
$manageLog = new ManageLog();
|
||||||
|
$manageLog->userLog($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCurrentUserType(){
|
||||||
|
$common = new \App\Utility\Common;
|
||||||
|
return $common->getCurrentUserInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function splitString($string,$limit = 100){
|
||||||
|
$small = "";
|
||||||
|
if(!empty($string)){
|
||||||
|
$small = substr($string, 0, $limit);
|
||||||
|
if(!empty($small) && strlen($string) > $limit){
|
||||||
|
$small .= "...";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $small;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getJsonData(){
|
||||||
|
$data = file_get_contents("php://input");
|
||||||
|
$this->data = (isset($data) && $data != '') ? json_decode($data, true) : array();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getApiResponse($response){
|
||||||
|
$this->response->type('json'); // this will convert your response to json
|
||||||
|
$this->response->body(json_encode($response)); // Set your response in body
|
||||||
|
$this->response->send(); // It will send your response
|
||||||
|
$this->response->stop(); // At the end stop the response
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function setClientStatus(){
|
||||||
|
$this->loadModel('ClientStatusTypes');
|
||||||
|
$client_status_list = $this->ClientStatusTypes->getActiveClientStatusByMemberId($this->Auth->user('id'));
|
||||||
|
if(!empty($client_status_list)){
|
||||||
|
$_SESSION['client_status_list'] = $client_status_list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPermissions(){
|
||||||
|
|
||||||
|
$current_module = $this->getModules();
|
||||||
|
$this->set('current_module', $current_module);
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('languages', $this->languages);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
if(!empty($user_permissions)) {
|
||||||
|
$permissions = array_filter($user_permissions, function ($permission) {
|
||||||
|
return $permission['controller'] === $this->request->params['controller'];
|
||||||
|
});
|
||||||
|
$this->set('user_permission', $permissions);
|
||||||
|
}
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
204
src/Controller/CategoriesController.php
Normal file
204
src/Controller/CategoriesController.php
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use DateTime;
|
||||||
|
use Cake\ORM\Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Categories Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\CategoriesTable $Categories
|
||||||
|
*/
|
||||||
|
class CategoriesController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return \Cake\Network\Response|null
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit=10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit= $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'sortWhitelist' => [
|
||||||
|
'Categories.created_on', 'Categories.id', 'Categories.name', 'Categories.modified_on'
|
||||||
|
],
|
||||||
|
'order' => [
|
||||||
|
'Categories.created_on' => 'desc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
}
|
||||||
|
|
||||||
|
$categories = $this->Categories->find('all')->where([
|
||||||
|
'Categories.name LIKE' => '%' . $search . '%'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$categories = $this->paginate($categories);
|
||||||
|
|
||||||
|
$this->set(compact('categories'));
|
||||||
|
$this->set('_serialize', ['categories']);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Category id.
|
||||||
|
* @return \Cake\Network\Response|null
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$category = $this->Categories->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('category', $category);
|
||||||
|
$this->set('_serialize', ['category']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$category = $this->Categories->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$category = $this->Categories->patchEntity($category, $this->request->data);
|
||||||
|
$category->created_on = date('Y-m-d h:i:s');
|
||||||
|
$category->status = 1;
|
||||||
|
if ($this->Categories->save($category)) {
|
||||||
|
$this->Flash->success(__('The category has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The category could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set(compact('category'));
|
||||||
|
$this->set('_serialize', ['category']);
|
||||||
|
|
||||||
|
$ModulesTable = TableRegistry::get('modules');
|
||||||
|
$modules = $ModulesTable->find('list');
|
||||||
|
// $subModules = $this->Pages->SubModules->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('page', 'subModules','modules'));
|
||||||
|
// // $this->set('_serialize', ['page']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Category id.
|
||||||
|
* @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$category = $this->Categories->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$category = $this->Categories->patchEntity($category, $this->request->data);
|
||||||
|
$category->modified_on = date('Y-m-d h:i:s');
|
||||||
|
if ($this->Categories->save($category)) {
|
||||||
|
$this->Flash->success(__('The category has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The category could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set(compact('category'));
|
||||||
|
$this->set('_serialize', ['category']);
|
||||||
|
|
||||||
|
$ModulesTable = TableRegistry::get('modules');
|
||||||
|
$modules = $ModulesTable->find('list');
|
||||||
|
// $subModules = $this->Pages->SubModules->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('page', 'subModules','modules'));
|
||||||
|
// // $this->set('_serialize', ['page']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Category id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
// check for subCategories
|
||||||
|
$subCategories = [];
|
||||||
|
$subCategoriesTable = TableRegistry::get('SubCategories');
|
||||||
|
$subCategories = $subCategoriesTable->find('all')->where([
|
||||||
|
'SubCategories.category_id' => $id
|
||||||
|
])->toArray();
|
||||||
|
|
||||||
|
// check for Forms
|
||||||
|
$forms = [];
|
||||||
|
$formsTable = TableRegistry::get('Forms');
|
||||||
|
$forms = $formsTable->find('all')->where([
|
||||||
|
'Forms.category_id' => $id
|
||||||
|
])->toArray();
|
||||||
|
|
||||||
|
if(empty($subCategories))
|
||||||
|
{
|
||||||
|
if(empty($forms))
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$category = $this->Categories->get($id);
|
||||||
|
if ($this->Categories->delete($category)) {
|
||||||
|
$this->Flash->success(__('The category has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The category could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The category is assigned to a Form so could not be deleted.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The category is assigned to a Sub-Category so could not be deleted.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
126
src/Controller/CheckListController.php
Normal file
126
src/Controller/CheckListController.php
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CheckList Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\CheckListsTable $CheckLists
|
||||||
|
*/
|
||||||
|
class CheckListController extends AppsController
|
||||||
|
{
|
||||||
|
private $controller = "check-list";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('CheckLists');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'id' => 'asc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(name LIKE ' . "'%" . $search . "%'" . 'OR description LIKE ' . "'%" . $search . "%'".')' ;
|
||||||
|
}
|
||||||
|
$CheckLists = $this->CheckLists->find('all')->where($condition);
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('check_lists', $this->paginate($CheckLists));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '10163', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$CheckList = $this->CheckLists->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['created_by'] = $user_id;
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['updated_by'] = $user_id;
|
||||||
|
$CheckList = $this->CheckLists->patchEntity($CheckList, $request);
|
||||||
|
$errors = $CheckList->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->CheckLists->save($CheckList)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The CheckLists has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the CheckLists.'));
|
||||||
|
}
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$check_list = $this->CheckLists->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$check_list = $this->CheckLists->patchEntity($check_list, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $check_list->errors();
|
||||||
|
|
||||||
|
$check_list['updated_at'] = FrozenTime::now();
|
||||||
|
$check_list['updated_by'] = $user_id;
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->CheckLists->save($check_list)) {
|
||||||
|
$this->Flash->success(__('The check list has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The check list could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('check_list', $check_list);
|
||||||
|
$this->set('_serialize', ['check_list']);
|
||||||
|
$this->setNextPage();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$check_list = $this->CheckLists->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('check_list', $check_list);
|
||||||
|
$this->set('_serialize', ['check_list']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10160', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
2452
src/Controller/CmsusersController.php
Normal file
2452
src/Controller/CmsusersController.php
Normal file
File diff suppressed because it is too large
Load Diff
797
src/Controller/CompaniesController.php
Normal file
797
src/Controller/CompaniesController.php
Normal file
@@ -0,0 +1,797 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use DateTime;
|
||||||
|
use ModuleConstants;
|
||||||
|
use PagesConstants;
|
||||||
|
use SubModuleConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Companies Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\CompaniesTable $Companies
|
||||||
|
*/
|
||||||
|
class CompaniesController extends AppsController {
|
||||||
|
|
||||||
|
public function initialize() {
|
||||||
|
parent::initialize();
|
||||||
|
I18n::locale('en_US');
|
||||||
|
$this->Auth->allow(['trnsToaws']);
|
||||||
|
//$this->loadComponent('Aws');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user) {
|
||||||
|
$request_action = $this->request->params['action'];
|
||||||
|
if ($request_action == "bulkAction" || $request_action == "uploadPicture" || $request_action == "removeMedia" || $request_action == "companyActive") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::isAuthorized($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
$page_limit=10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit= $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'Companies.created_on' => 'desc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
}
|
||||||
|
|
||||||
|
$companies = $this->Companies->find('all')
|
||||||
|
->where(['name LIKE' => '%' . $search . '%'])
|
||||||
|
->orWhere(['name LIKE' => '%' . $search . '%'])
|
||||||
|
->orWhere(['registration_no LIKE' => '%' . $search . '%'])
|
||||||
|
->orWhere(['tax_no LIKE' => '%' . $search . '%'])
|
||||||
|
->orWhere(['email LIKE' => '%' . $search . '%'])
|
||||||
|
->orWhere(['address1 LIKE' => '%' . $search . '%'])
|
||||||
|
->orWhere(['address2 LIKE' => '%' . $search . '%']);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('companies', $this->paginate($companies));
|
||||||
|
$this->set('_serialize', ['companies']);
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bulkAction() {
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$selectedCompanies = $this->request->data('selected_content');
|
||||||
|
$bulkAction = $this->request->data('bulk_action');
|
||||||
|
if ($bulkAction == BULK_ACTION_DELETE) {
|
||||||
|
if ($selectedCompanies == "")
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
$companiesToDelete = explode(',', $selectedCompanies);
|
||||||
|
$error = $this->deleteAll($companiesToDelete);
|
||||||
|
if (!$error) {
|
||||||
|
$this->Flash->success(__('All the selected companies have been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteAll($companies) {
|
||||||
|
foreach ($companies as &$companyIdWithPrefix) {
|
||||||
|
$companyId = str_replace('content_', '', $companyIdWithPrefix);
|
||||||
|
$company = $this->Companies->get($companyId);
|
||||||
|
if ($this->canCompanyBeDeleted($companyId)) {
|
||||||
|
$CmsUserTables = TableRegistry::get('cmsusers');
|
||||||
|
$cmsUser = $CmsUserTables->find('all')
|
||||||
|
->where(['company_id' => $company['id']])->toArray()[0];
|
||||||
|
$this->revertPermissions($company, $cmsUser);
|
||||||
|
$this->Companies->delete($company);
|
||||||
|
} else {
|
||||||
|
return (__('The Company ' . $company->name . ' cannot be deleted as it contains related entities'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Company id.
|
||||||
|
* @return void
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null) {
|
||||||
|
$company = $this->Companies->get($id, [
|
||||||
|
'contain' => ['Cmsusers', 'Roles', 'Usergroups']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('languages', $this->languages);// var $languages member variable of App Controler
|
||||||
|
|
||||||
|
$timezone_offset = TableRegistry::get('timezones')->find('all')
|
||||||
|
->select(['time_zone', 'utc_offset'])
|
||||||
|
->where(['id' => $company->timezone])->toArray();
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('timezone_offset', $timezone_offset[0]->time_zone . ' ' . $timezone_offset[0]->utc_offset);
|
||||||
|
|
||||||
|
$this->set('company', $company);
|
||||||
|
$this->set('_serialize', ['company']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
* @return \Cake\Network\Response|null
|
||||||
|
*/
|
||||||
|
public function add() {
|
||||||
|
$CmsUsersTable = TableRegistry::get('Cmsusers');
|
||||||
|
$company = $this->Companies->newEntity();
|
||||||
|
$companyBusinessInfo = $this->Companies->newEntity();
|
||||||
|
$cmsUser = $CmsUsersTable->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
//print_r($this->request->data);exit;
|
||||||
|
$company = $this->Companies->patchEntity($company, $this->request->data('company'));
|
||||||
|
$company = $this->fixCompanyForAdd($company);
|
||||||
|
$company->logo = $this->request->data("uploaded_file");
|
||||||
|
$company->added_by = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$timezone_offset = TableRegistry::get('timezones')->find('all')
|
||||||
|
->select(['utc_offset'])
|
||||||
|
->where(['id' => $_POST['company']['timezone']])->toArray();
|
||||||
|
|
||||||
|
|
||||||
|
$company->timezone_value = $timezone_offset[0]->utc_offset;
|
||||||
|
|
||||||
|
$cmsUser = $CmsUsersTable->patchEntity($cmsUser, $this->request->data('cmsuser'));
|
||||||
|
$cmsUser = $this->fixUserForAdd($cmsUser);
|
||||||
|
$companyErrors = $this->checkAndDisplayEntityErrors($company);
|
||||||
|
$userErrors = $this->checkAndDisplayEntityErrors($cmsUser);
|
||||||
|
|
||||||
|
|
||||||
|
$password = $this->request->data('cmsuser.password');
|
||||||
|
|
||||||
|
if (!$companyErrors && !$userErrors) {
|
||||||
|
$savedCompany = $this->Companies->save($company);
|
||||||
|
if ($savedCompany) {
|
||||||
|
$this->Flash->success(__('The company has been saved.'));
|
||||||
|
$cmsUser['company_id'] = $savedCompany['id'];
|
||||||
|
if ($CmsUsersTable->save($cmsUser)) {
|
||||||
|
if ($this->insertSuperUserPermission($company, $cmsUser)) {
|
||||||
|
$this->Flash->success(__('The super admin has been saved.'));
|
||||||
|
//$this->trnsToaws($savedCompany['id']);
|
||||||
|
$template_content = array(
|
||||||
|
'firstname' => $cmsUser->username,
|
||||||
|
'user_email' => $cmsUser->email,
|
||||||
|
'password' => $password,
|
||||||
|
'loginurl' => APP_SERVER_HOST_URL."admin"
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->sendEmail(MANDRILL_TEMPLATE_USER_CREATION, $template_content, $cmsUser->email);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The super admin could not be saved. Please, try again.'));
|
||||||
|
$this->revertPermissions($company, $cmsUser);
|
||||||
|
$this->Companies->delete($company);
|
||||||
|
$CmsUsersTable->delete($company);
|
||||||
|
}
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Companies->delete($company);
|
||||||
|
$this->Flash->error(__('The super admin could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The company could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$timezones_array = TableRegistry::get('timezones')->find()->toArray();
|
||||||
|
|
||||||
|
foreach ($timezones_array as $zone)
|
||||||
|
$timezones[$zone->id] = $zone->time_zone . ' ' . $zone->utc_offset;
|
||||||
|
|
||||||
|
$this->set('timezones', $timezones);
|
||||||
|
|
||||||
|
$companies = $this->Companies->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('company'));
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('languages', $this->languages);// var $languages member variable of App Controler
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set(compact('companyBusinessInfo'));
|
||||||
|
$this->set('countries', $this->getCountries());
|
||||||
|
$this->set(compact('cmsuser', 'companies'));
|
||||||
|
$this->set('_serialize', ['company']);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkAndDisplayEntityErrors($entity) {
|
||||||
|
$entityErrors = $entity->errors();
|
||||||
|
foreach ($entityErrors as $key => $value) {
|
||||||
|
foreach ($entityErrors[$key] as $errorKey => $errorValue) {
|
||||||
|
$this->Flash->error($errorValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $entityErrors;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function fixCompanyForAdd($company) {
|
||||||
|
$company['status'] = 1;
|
||||||
|
$company['country'] = $this->getCountries()[$company['country']];
|
||||||
|
$company['created_on'] = new DateTime();
|
||||||
|
$company['modified_on'] = new DateTime();
|
||||||
|
return $company;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function fixUserForAdd($cmsUser) {
|
||||||
|
$cmsUser['created_on'] = new DateTime();
|
||||||
|
$cmsUser['updated_on'] = new DateTime();
|
||||||
|
$cmsUser['status'] = 1;
|
||||||
|
return $cmsUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Company id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null) {
|
||||||
|
$CmsUserTable = TableRegistry::get('Cmsusers');
|
||||||
|
$company = $this->Companies->get($id, ['contain' => []]);
|
||||||
|
$cmsUser = $CmsUserTable->query()->where('company_id=' . $id)->first();
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$company = $this->Companies->patchEntity($company, $this->request->data('company'));
|
||||||
|
$company = $this->fixCompanyForEdit($company);
|
||||||
|
$company->logo = $this->request->data("uploaded_file");
|
||||||
|
|
||||||
|
$timezone_offset = TableRegistry::get('timezones')->find('all')
|
||||||
|
->select(['utc_offset'])
|
||||||
|
->where(['id' => $_POST['company']['timezone']])->toArray();
|
||||||
|
|
||||||
|
|
||||||
|
$company->timezone_value = $timezone_offset[0]->utc_offset;
|
||||||
|
|
||||||
|
$cmsUser = $CmsUserTable->patchEntity($cmsUser, $this->request->data('cmsuser'));
|
||||||
|
$cmsUser = $this->fixUserForEdit($cmsUser);
|
||||||
|
|
||||||
|
$companyErrors = $this->checkAndDisplayEntityErrors($company);
|
||||||
|
$userErrors = $this->checkAndDisplayEntityErrors($cmsUser);
|
||||||
|
|
||||||
|
if (!$companyErrors && !$userErrors) {
|
||||||
|
$savedCompany = $this->Companies->save($company);
|
||||||
|
if ($savedCompany) {
|
||||||
|
$this->Flash->success(__('The company has been saved.'));
|
||||||
|
$cmsUser['company_id'] = $savedCompany['id'];
|
||||||
|
|
||||||
|
if ($CmsUserTable->save($cmsUser)) {
|
||||||
|
// $this->trnsToaws($savedCompany['id']);
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
// $this->Companies->delete($company);
|
||||||
|
$this->Flash->error(__('The super admin could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The company could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('languages', $this->languages);// var $languages member variable of App Controler
|
||||||
|
|
||||||
|
$timezones_array = TableRegistry::get('timezones')->find()->toArray();
|
||||||
|
|
||||||
|
foreach ($timezones_array as $zone)
|
||||||
|
$timezones[$zone->id] = $zone->time_zone . ' ' . $zone->utc_offset;
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('timezones', $timezones);
|
||||||
|
|
||||||
|
$this->set('company', $company);
|
||||||
|
$this->set('cmsuser', $cmsUser);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('countries', $this->getCountries());
|
||||||
|
$this->set('_serialize', ['company']);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Company id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function profile() {
|
||||||
|
$id = $this->Auth->user('company_id');
|
||||||
|
$CmsUserTable = TableRegistry::get('Cmsusers');
|
||||||
|
$company = $this->Companies->get($id, ['contain' => []]);
|
||||||
|
$cmsUser = $CmsUserTable->query()->where('company_id=' . $id)->first();
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$company = $this->Companies->patchEntity($company, $this->request->data('company'));
|
||||||
|
$company = $this->fixCompanyForEdit($company);
|
||||||
|
$company->logo = $this->request->data("uploaded_file");
|
||||||
|
|
||||||
|
$timezone_offset = TableRegistry::get('timezones')->find('all')
|
||||||
|
->select(['utc_offset'])
|
||||||
|
->where(['id' => $_POST['company']['timezone']])->toArray();
|
||||||
|
|
||||||
|
|
||||||
|
$company->timezone_value = $timezone_offset[0]->utc_offset;
|
||||||
|
|
||||||
|
$cmsUser = $CmsUserTable->patchEntity($cmsUser, $this->request->data('cmsuser'));
|
||||||
|
$cmsUser = $this->fixUserForEdit($cmsUser);
|
||||||
|
|
||||||
|
$companyErrors = $this->checkAndDisplayEntityErrors($company);
|
||||||
|
$userErrors = $this->checkAndDisplayEntityErrors($cmsUser);
|
||||||
|
|
||||||
|
if (!$companyErrors && !$userErrors) {
|
||||||
|
$savedCompany = $this->Companies->save($company);
|
||||||
|
if ($savedCompany) {
|
||||||
|
$this->Flash->success(__('The company has been saved.'));
|
||||||
|
$cmsUser['company_id'] = $savedCompany['id'];
|
||||||
|
|
||||||
|
if ($CmsUserTable->save($cmsUser)) {
|
||||||
|
// $this->trnsToaws($savedCompany['id']);
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
// $this->Companies->delete($company);
|
||||||
|
$this->Flash->error(__('The super admin could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The company could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('languages', $this->languages);// var $languages member variable of App Controler
|
||||||
|
|
||||||
|
$timezones_array = TableRegistry::get('timezones')->find()->toArray();
|
||||||
|
|
||||||
|
foreach ($timezones_array as $zone)
|
||||||
|
$timezones[$zone->id] = $zone->time_zone . ' ' . $zone->utc_offset;
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('timezones', $timezones);
|
||||||
|
|
||||||
|
$this->set('company', $company);
|
||||||
|
$this->set('cmsuser', $cmsUser);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('countries', $this->getCountries());
|
||||||
|
$this->set('_serialize', ['company']);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uploadPicture($type = 'companies') {
|
||||||
|
if ($this->Auth->user()) {
|
||||||
|
$user_id = $this->Auth->user()['id'];
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
|
||||||
|
$data = $this->request->data;
|
||||||
|
$resp = array();
|
||||||
|
|
||||||
|
if (!empty($data['doc_file']['name'])) {
|
||||||
|
$file = $data['doc_file']; //put the data into a var for easy use
|
||||||
|
|
||||||
|
$ext = substr(strtolower(strrchr($file['name'], '.')), 1); //get the extension
|
||||||
|
$image_ext = array('jpg', 'jpeg', 'gif', 'bmp', 'png');
|
||||||
|
$not_image = '';
|
||||||
|
|
||||||
|
//only process if the extension is valid
|
||||||
|
if (in_array($ext, $image_ext)) {
|
||||||
|
$curr_time = date('Ymdhis');
|
||||||
|
$new_file_name = $user_id . '_' . $curr_time . '.' . $ext;
|
||||||
|
$mediaPath = '/media/' . $type . '/' . $new_file_name;
|
||||||
|
|
||||||
|
if (move_uploaded_file($file['tmp_name'], WWW_ROOT . $mediaPath)) {
|
||||||
|
$resp['file_name'] = $new_file_name;
|
||||||
|
echo json_encode($resp);
|
||||||
|
} else {
|
||||||
|
echo 'error';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$not_image = 'yes';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($not_image == 'yes') {
|
||||||
|
echo 'not_allowed';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeMedia() {
|
||||||
|
if ($this->Auth->user()) {
|
||||||
|
$this->glbl();
|
||||||
|
$f_type = $this->request->data('f_type');
|
||||||
|
$prev_name = $this->request->data('prev_name');
|
||||||
|
$f_name = $this->request->data('f_name');
|
||||||
|
$file_url = '';
|
||||||
|
if ($f_type == '1') {
|
||||||
|
$file_url = substr(WWW_ROOT, '0', '-1') . '/videos/' . $f_name;
|
||||||
|
$prev_url = substr(WWW_ROOT, '0', '-1') . '/previews/' . $prev_name;
|
||||||
|
unlink($prev_url);
|
||||||
|
} else if ($f_type == '2') {
|
||||||
|
$file_url = substr(WWW_ROOT, '0', '-1') . '/audios/' . $f_name;
|
||||||
|
} else if ($f_type == '3') {
|
||||||
|
$file_url = substr(WWW_ROOT, '0', '-1') . '/images/' . $f_name;
|
||||||
|
} else if ($f_type == '4') {
|
||||||
|
$file_url = substr(WWW_ROOT, '0', '-1') . '/media/companies/' . $f_name;
|
||||||
|
}
|
||||||
|
unlink($file_url);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function fixCompanyForEdit($company) {
|
||||||
|
$company['country'] = $this->getCountries()[$company['country']];
|
||||||
|
return $company;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function fixUserForEdit($cmsUser) {
|
||||||
|
$cmsUser['updated_on'] = new DateTime();
|
||||||
|
$cmsUser['status'] = 1;
|
||||||
|
return $cmsUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Company id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null) {
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$company = $this->Companies->get($id);
|
||||||
|
if ($this->canCompanyBeDeleted($id)) {
|
||||||
|
$CmsUserTables = TableRegistry::get('cmsusers');
|
||||||
|
$cmsUser = $CmsUserTables->find('all')
|
||||||
|
->where(['company_id' => $id])->toArray()[0];
|
||||||
|
$this->revertPermissions($company, $cmsUser);
|
||||||
|
if ($this->Companies->delete($company)) {
|
||||||
|
$this->Flash->success(__('The company has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The company could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The company could not be deleted as it contains related entities'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canCompanyBeDeleted($companyId) {
|
||||||
|
if ($companyId) {
|
||||||
|
|
||||||
|
//Check roles - Considering that more than 1 role means that it's just the default role.
|
||||||
|
$RolesTable = TableRegistry::get('roles');
|
||||||
|
$roles = $RolesTable->find('all')
|
||||||
|
->where(['company_id' => $companyId]);
|
||||||
|
if (sizeof($roles->toArray()) > 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Check User Groups - Same logic as roles
|
||||||
|
$UserGroupsTable = TableRegistry::get('usergroups');
|
||||||
|
$userGroups = $UserGroupsTable->find('all')
|
||||||
|
->where(['company_id' => $companyId]);
|
||||||
|
if (sizeof($userGroups->toArray()) > 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Check CmsUsers - Same logic as usergroups
|
||||||
|
$CmsUsersTables = TableRegistry::get('cmsusers');
|
||||||
|
$cmsUsers = $CmsUsersTables->find('all')
|
||||||
|
->where(['company_id' => $companyId]);
|
||||||
|
if (sizeof($cmsUsers->toArray()) > 1)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModules() {
|
||||||
|
return array('Company' => '1001');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubModules() {
|
||||||
|
return array('Company Management' =>'2001');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPages() {
|
||||||
|
return array('index' =>'3001','view' =>'3005', 'add' =>'3002', 'edit' =>'3003', 'delete' =>'3004');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function insertSuperUserPermission($company, $cmsUser) {
|
||||||
|
|
||||||
|
$rolesTable = TableRegistry::get('roles');
|
||||||
|
$pagesTable = TableRegistry::get('pages');
|
||||||
|
$userGroupsTable = TableRegistry::get('usergroups');
|
||||||
|
$userGroupRolesTable = TableRegistry::get('usergroup_roles');
|
||||||
|
$rolePagesTable = TableRegistry::get('role_pages');
|
||||||
|
$userUserGroupsTable = TableRegistry::get('cmsuser_usergroups');
|
||||||
|
/**
|
||||||
|
* 1. create a role for that company into the table "roles"
|
||||||
|
* 2. create a usergroup for that company into the table "usergroups"
|
||||||
|
* 3. associate newly created usergroup and role into the table "usergroup_roles"
|
||||||
|
* 4. Associate the pages to that role into the table "role_pages"
|
||||||
|
* 5. Provide Artists and Groups Permission
|
||||||
|
*/
|
||||||
|
$role = $rolesTable->newEntity();
|
||||||
|
$role['title'] = $company['name'] . '-super-admin';
|
||||||
|
$role['create_on'] = new DateTime();
|
||||||
|
$role['modified_on'] = new DateTime();
|
||||||
|
$role['status'] = 1;
|
||||||
|
$role['company_id'] = $company['id'];
|
||||||
|
|
||||||
|
$role = $rolesTable->save($role);
|
||||||
|
if (!$role) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userGroup = $userGroupsTable->newEntity();
|
||||||
|
$userGroup['group_name'] = $company['name'] . '-super-admin-group';
|
||||||
|
$userGroup['created_on'] = new DateTime();
|
||||||
|
$userGroup['modified_on'] = new DateTime();
|
||||||
|
$userGroup['status'] = 1;
|
||||||
|
$userGroup['company_id'] = $company['id'];
|
||||||
|
|
||||||
|
$userGroup = $userGroupsTable->save($userGroup);
|
||||||
|
if (!$userGroup) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userGroupRole = $userGroupRolesTable->newEntity();
|
||||||
|
$userGroupRole['role_id'] = $role['id'];
|
||||||
|
$userGroupRole['usergroup_id'] = $userGroup['id'];
|
||||||
|
|
||||||
|
$userGroupRole = $userGroupRolesTable->save($userGroupRole);
|
||||||
|
if (!$userGroupRole) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userUserGroup = $userUserGroupsTable->newEntity();
|
||||||
|
$userUserGroup['usergroup_id'] = $userGroup['id'];
|
||||||
|
$userUserGroup['cms_user_id'] = $cmsUser['id'];
|
||||||
|
|
||||||
|
$userUserGroup = $userUserGroupsTable->save($userUserGroup);
|
||||||
|
if (!$userUserGroup) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pagesWithPermission = $pagesTable->query('SELECT pages.id, pages.sub_module_id, pages.title')
|
||||||
|
->innerJoin('sub_modules', 'pages.sub_module_id = sub_modules.id')
|
||||||
|
->innerJoin('modules', 'sub_modules.module_id = modules.id')
|
||||||
|
->where('modules.id IN (' . 1003 . ',1005)');
|
||||||
|
|
||||||
|
foreach ($pagesWithPermission as $pageWithPermission) {
|
||||||
|
$rolePage = $rolePagesTable->newEntity();
|
||||||
|
|
||||||
|
$rolePage['role_id'] = $role['id'];
|
||||||
|
$rolePage['page_id'] = $pageWithPermission['id'];
|
||||||
|
if (!$rolePagesTable->save($rolePage)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rolePage = $rolePagesTable->newEntity();
|
||||||
|
$rolePage['role_id'] = $role['id'];
|
||||||
|
//$rolePage['page_id'] = PagesConstants::BASIC_SETTINGS;
|
||||||
|
$rolePagesTable->save($rolePage);
|
||||||
|
|
||||||
|
// $rolePage = $rolePagesTable->newEntity();
|
||||||
|
// $rolePage['role_id'] = $role['id'];
|
||||||
|
// $rolePage['page_id'] = PagesConstants::LIST_PAYMENT;
|
||||||
|
// $rolePagesTable->save($rolePage);
|
||||||
|
//
|
||||||
|
// $rolePage = $rolePagesTable->newEntity();
|
||||||
|
// $rolePage['role_id'] = $role['id'];
|
||||||
|
// $rolePage['page_id'] = PagesConstants::VIEW_PAYMENT_RECORD;
|
||||||
|
// $rolePagesTable->save($rolePage);
|
||||||
|
//
|
||||||
|
// $rolePage = $rolePagesTable->newEntity();
|
||||||
|
// $rolePage['role_id'] = $role['id'];
|
||||||
|
// $rolePage['page_id'] = PagesConstants::LIST_STAR_ACTIVITIES;
|
||||||
|
// $rolePagesTable->save($rolePage);
|
||||||
|
//
|
||||||
|
// $rolePage = $rolePagesTable->newEntity();
|
||||||
|
// $rolePage['role_id'] = $role['id'];
|
||||||
|
// $rolePage['page_id'] = PagesConstants::LIST_UNLOCK_ACTIVITIES;
|
||||||
|
// $rolePagesTable->save($rolePage);
|
||||||
|
//
|
||||||
|
// $rolePage = $rolePagesTable->newEntity();
|
||||||
|
// $rolePage['role_id'] = $role['id'];
|
||||||
|
// $rolePage['page_id'] = PagesConstants::VIEW_UNLOCK_ACTIVITY;
|
||||||
|
// $rolePagesTable->save($rolePage);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function trnsToaws($com_id) {
|
||||||
|
|
||||||
|
|
||||||
|
$com_info = $this->Companies->find('all')->where(['id' => $com_id])->toArray();
|
||||||
|
|
||||||
|
if (empty($com_info)) {
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentTimeStamp = date('Ymdhis');
|
||||||
|
|
||||||
|
$file_url = $com_info[0]->logo;
|
||||||
|
|
||||||
|
$file_permission = 'private';
|
||||||
|
|
||||||
|
$file_ext = explode('.', $file_url);
|
||||||
|
$new_file_name = '/media/companies/' . $com_id .'_' . $currentTimeStamp . '.' . end($file_ext);
|
||||||
|
|
||||||
|
$prev_tmp_name = substr(WWW_ROOT, '0', '-1') . '/media/companies/' . $file_url;
|
||||||
|
|
||||||
|
if (file_exists($prev_tmp_name)) {
|
||||||
|
$bucketName = AWS_OUTPUT_VIDEO_BUCKET_NAME;
|
||||||
|
$this->Aws->bucket = $bucketName;
|
||||||
|
|
||||||
|
$this->Aws->upload($prev_tmp_name, $new_file_name, $file_permission);
|
||||||
|
}
|
||||||
|
$query1 = $this->Companies->query();
|
||||||
|
$query1->update()->set([
|
||||||
|
'logo' => $com_id .'_' . $currentTimeStamp . '.' . end($file_ext),
|
||||||
|
])->where(['id' => $com_id])->execute();
|
||||||
|
|
||||||
|
if (file_exists($prev_tmp_name))
|
||||||
|
unlink($prev_tmp_name);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function revertPermissions($company, $cmsUser) {
|
||||||
|
$rolesTable = TableRegistry::get('roles');
|
||||||
|
$role = $rolesTable->find('all')->where(['company_id' => $company['id']])->toArray()[0];
|
||||||
|
|
||||||
|
$userGroupsTable = TableRegistry::get('usergroups');
|
||||||
|
$userGroup = $userGroupsTable->find('all')->where(['company_id' => $company['id']])->toArray()[0];
|
||||||
|
|
||||||
|
$rolePagesTable = TableRegistry::get('role_pages');
|
||||||
|
$rolePagesTable->deleteAll(['role_id' => $role['id']]);
|
||||||
|
|
||||||
|
$userUserGroupsTable = TableRegistry::get('cmsuser_usergroups');
|
||||||
|
$userUserGroup = $userUserGroupsTable->find('all')->where(['cms_user_id' => $cmsUser['id']])->toArray();
|
||||||
|
$this->log($userUserGroup);
|
||||||
|
if (sizeof($userUserGroup) > 0) {
|
||||||
|
$userUserGroupsTable->delete($userUserGroup[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$userGroupRolesTable = TableRegistry::get('usergroup_roles');
|
||||||
|
$userGroupRole = $userGroupRolesTable->find('all')->where(['usergroup_id' => $userGroup['id']])->toArray();
|
||||||
|
if (sizeof($userGroupRole) > 0) {
|
||||||
|
$this->log($userGroupRole);
|
||||||
|
$userGroupRolesTable->delete($userGroupRole[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$userGroupsTable->delete($userGroup);
|
||||||
|
$rolesTable->delete($role);
|
||||||
|
$cmsUsersTable = TableRegistry::get('cmsusers');
|
||||||
|
$cmsUsersTable->deleteAll(['company_id' => $company['id']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function companyActive() {
|
||||||
|
|
||||||
|
if ($this->Auth->user()) {
|
||||||
|
|
||||||
|
// $user = $this->Cmsusers->find('all')->where(['fb_id' => $_POST['fb_id']])->first();
|
||||||
|
// $user = $this->Cmsusers->find('all')->where(['id' =>$_POST['com_id']])->toArray();
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// $c = fopen('artist.txt', 'w');
|
||||||
|
// fwrite($c, $artist_info[0]->id);
|
||||||
|
// fclose($c);
|
||||||
|
//
|
||||||
|
// exit();
|
||||||
|
|
||||||
|
$companyTable = TableRegistry::get('Companies')->query();
|
||||||
|
|
||||||
|
$ret_val = $companyTable->update()
|
||||||
|
->set(['status' => 1])
|
||||||
|
->where(['id' => $_POST['com_id']])
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$this->trnsToaws($_POST['com_id']);
|
||||||
|
|
||||||
|
$artistTable = TableRegistry::get('Artists')->query();
|
||||||
|
$artistTable->update()
|
||||||
|
->set(['status' => 1])
|
||||||
|
->where(['company_id' => $_POST['com_id']])
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$artist_info = TableRegistry::get('Artists')->find('all')
|
||||||
|
->where(['company_id'=>$_POST['com_id']])->toArray();
|
||||||
|
|
||||||
|
$this->trnsToawsArt($artist_info[0]->id);
|
||||||
|
|
||||||
|
$cmsuserTable = TableRegistry::get('Cmsusers')->query();
|
||||||
|
$cmsuserTable->update()
|
||||||
|
->set(['status' => 1])
|
||||||
|
->where(['company_id' => $_POST['com_id']])
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$CmsUserTables = TableRegistry::get('cmsusers');
|
||||||
|
$cmsUser = $CmsUserTables->find('all')
|
||||||
|
->where(['company_id' => $_POST['com_id']])->toArray();
|
||||||
|
|
||||||
|
//$cmsuserTable->find('all')->select(['email'])->where(['company_id'=>$_POST['com_id']])->toArray();
|
||||||
|
// $template_content = array(
|
||||||
|
// array(
|
||||||
|
// 'name' => 'account activation',
|
||||||
|
// 'content' => 'Congratulations!! Your account have been activated'
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
//$this->sendEmail(MANDRILL_TEMPLATE_USER_CREATION, $template_content, $cmsUser[0]->email);
|
||||||
|
|
||||||
|
if ($ret_val) {
|
||||||
|
echo "ok";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getCountries() {
|
||||||
|
return ["Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica",
|
||||||
|
"Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain",
|
||||||
|
"Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina",
|
||||||
|
"Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso",
|
||||||
|
"Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile",
|
||||||
|
"China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the",
|
||||||
|
"Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti",
|
||||||
|
"Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia",
|
||||||
|
"Ethiopia", "Falkland Islands (Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "France Metropolitan", "French Guiana",
|
||||||
|
"French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece",
|
||||||
|
"Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands",
|
||||||
|
"Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran (Islamic Republic of)",
|
||||||
|
"Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic of",
|
||||||
|
"Korea, Republic of", "Kuwait", "Kyrgyzstan", "Lao, People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya",
|
||||||
|
"Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia, The Former Yugoslav Republic of", "Madagascar", "Malawi", "Malaysia", "Maldives",
|
||||||
|
"Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of",
|
||||||
|
"Moldova, Republic of", "Monaco", "Mongolia", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal",
|
||||||
|
"Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island",
|
||||||
|
"Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines",
|
||||||
|
"Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Kitts and Nevis",
|
||||||
|
"Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal",
|
||||||
|
"Seychelles", "Sierra Leone", "Singapore", "Slovakia (Slovak Republic)", "Slovenia", "Solomon Islands", "Somalia", "South Africa",
|
||||||
|
"South Georgia and the South Sandwich Islands", "Spain", "Sri Lanka", "St. Helena", "St. Pierre and Miquelon", "Sudan", "Suriname",
|
||||||
|
"Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province of China", "Tajikistan",
|
||||||
|
"Tanzania, United Republic of", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
|
||||||
|
"Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands",
|
||||||
|
"Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis and Futuna Islands",
|
||||||
|
"Western Sahara", "Yemen", "Yugoslavia", "Zambia", "Zimbabwe"];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
1323
src/Controller/Component/PreviewUploadFileComponent.php
Normal file
1323
src/Controller/Component/PreviewUploadFileComponent.php
Normal file
File diff suppressed because it is too large
Load Diff
1406
src/Controller/Component/UploadFileComponent.php
Normal file
1406
src/Controller/Component/UploadFileComponent.php
Normal file
File diff suppressed because it is too large
Load Diff
210
src/Controller/ContentsController.php
Normal file
210
src/Controller/ContentsController.php
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use DateTime;
|
||||||
|
use Cake\ORM\Query;
|
||||||
|
use Cake\Routing\Router;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Teams Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\TeamsTable $Teams
|
||||||
|
*/
|
||||||
|
class ContentsController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return \Cake\Network\Response|null
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return $this->redirect(['action' => 'add','action' => 'add']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$category_id = 0;
|
||||||
|
$sub_category_id = 0;
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$category_id = $this->request->data['category_id'];
|
||||||
|
$sub_category_id = $this->request->data['sub_category_id'];
|
||||||
|
$page = $this->request->data['content']['page'];
|
||||||
|
$html = $this->request->data['content']['html'];
|
||||||
|
|
||||||
|
$folderName = '';
|
||||||
|
$folderName = $this->getCategoryNameById($category_id);
|
||||||
|
|
||||||
|
$myfile = fopen(WWW_ROOT.$folderName.'/'.$page.".html", "w") or die("Unable to open file!");
|
||||||
|
fwrite($myfile, $html);
|
||||||
|
fclose($myfile);
|
||||||
|
$this->Flash->success(__('The contents has been saved.'));
|
||||||
|
// return $this->redirect(['action' => 'add','prev' => $page]);
|
||||||
|
return $this->redirect(['action' => 'add']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$getPrev = '';
|
||||||
|
if(isset($_GET['prev']) && $_GET['prev']){
|
||||||
|
$getPrev = $_GET['prev'];
|
||||||
|
}else{
|
||||||
|
$i = 0;
|
||||||
|
foreach(json_decode(TEAM_AGE_CATEGORY) as $key => $value){
|
||||||
|
if($i==0){
|
||||||
|
$getPrev = $key;
|
||||||
|
$i++;
|
||||||
|
}else{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$categoriesTable = TableRegistry::get('Categories');
|
||||||
|
$categories = $categoriesTable->find('list')->where([
|
||||||
|
'Categories.status' => 1,
|
||||||
|
'Categories.type' => 2
|
||||||
|
]);
|
||||||
|
$this->set(compact('categories'));
|
||||||
|
|
||||||
|
$subCategoriesTable = TableRegistry::get('SubCategories');
|
||||||
|
$subCategories = $subCategoriesTable->find('list')->where([
|
||||||
|
'SubCategories.status' => 1
|
||||||
|
]);
|
||||||
|
$this->set(compact('subCategories'));
|
||||||
|
|
||||||
|
$formsTable = TableRegistry::get('Forms');
|
||||||
|
$formsData = $formsTable->find('all')
|
||||||
|
->select(['short_name','long_name'])
|
||||||
|
->where([
|
||||||
|
'Forms.status' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$forms = array();
|
||||||
|
if(!empty($formsData)){
|
||||||
|
foreach ($formsData as $key => $value) {
|
||||||
|
$forms[$value->long_name] = $value->short_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set(compact('forms'));
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('prev', $getPrev);
|
||||||
|
$base_url = Router::url('/');
|
||||||
|
$this->set('base_url', $base_url);
|
||||||
|
$this->set('category_id', $category_id);
|
||||||
|
$this->set('sub_category_id', $sub_category_id);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
$category_id = 0;
|
||||||
|
$sub_category_id = 0;
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$category_id = $this->request->data['category_id'];
|
||||||
|
$sub_category_id = $this->request->data['sub_category_id'];
|
||||||
|
$page = $this->request->data['content']['page'];
|
||||||
|
$html = $this->request->data['content']['html'];
|
||||||
|
|
||||||
|
$folderName = '';
|
||||||
|
$folderName = $this->getCategoryNameById($category_id);
|
||||||
|
|
||||||
|
$myfile = fopen(WWW_ROOT.$folderName.'/'.$page.".html", "w") or die("Unable to open file!");
|
||||||
|
fwrite($myfile, $html);
|
||||||
|
fclose($myfile);
|
||||||
|
$this->Flash->success(__('The contents has been saved.'));
|
||||||
|
// return $this->redirect(['action' => 'add','prev' => $page]);
|
||||||
|
return $this->redirect(['action' => 'add']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$getPrev = '';
|
||||||
|
if(isset($_GET['prev']) && $_GET['prev']){
|
||||||
|
$getPrev = $_GET['prev'];
|
||||||
|
}else{
|
||||||
|
$i = 0;
|
||||||
|
foreach(json_decode(TEAM_AGE_CATEGORY) as $key => $value){
|
||||||
|
if($i==0){
|
||||||
|
$getPrev = $key;
|
||||||
|
$i++;
|
||||||
|
}else{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$categoriesTable = TableRegistry::get('Categories');
|
||||||
|
$categories = $categoriesTable->find('list')->where([
|
||||||
|
'Categories.status' => 1
|
||||||
|
]);
|
||||||
|
$this->set(compact('categories'));
|
||||||
|
|
||||||
|
$subCategoriesTable = TableRegistry::get('SubCategories');
|
||||||
|
$subCategories = $subCategoriesTable->find('list')->where([
|
||||||
|
'SubCategories.status' => 1
|
||||||
|
]);
|
||||||
|
$this->set(compact('subCategories'));
|
||||||
|
|
||||||
|
$formsTable = TableRegistry::get('Forms');
|
||||||
|
$formsData = $formsTable->find('all')
|
||||||
|
->select(['short_name','long_name'])
|
||||||
|
->where([
|
||||||
|
'Forms.status' => 1
|
||||||
|
]);
|
||||||
|
|
||||||
|
$forms = array();
|
||||||
|
if(!empty($formsData)){
|
||||||
|
foreach ($formsData as $key => $value) {
|
||||||
|
$forms[$value->long_name] = $value->short_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set(compact('forms'));
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('prev', $getPrev);
|
||||||
|
$base_url = Router::url('/');
|
||||||
|
$this->set('base_url', $base_url);
|
||||||
|
$this->set('category_id', $category_id);
|
||||||
|
$this->set('sub_category_id', $sub_category_id);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadformcontent()
|
||||||
|
{
|
||||||
|
$this->autorender = false;
|
||||||
|
$category_id = $this->request->data['cid'];
|
||||||
|
$form_name = $this->request->data['form_name'];
|
||||||
|
|
||||||
|
$base_url = Router::url('/');
|
||||||
|
$base_url = 'https://'.$_SERVER['SERVER_NAME'].$base_url;
|
||||||
|
$folderName = '';
|
||||||
|
$folderName = $this->getCategoryNameById($category_id);
|
||||||
|
$fileName = $form_name.".html";
|
||||||
|
|
||||||
|
$file_dir = $folderName.'/'.$fileName;
|
||||||
|
$fileContent = file_get_contents($file_dir);
|
||||||
|
|
||||||
|
$txtJson = json_encode($fileContent);
|
||||||
|
$this->response->type('json');
|
||||||
|
$this->response->body($txtJson);
|
||||||
|
return $this->response;
|
||||||
|
}
|
||||||
|
}
|
||||||
126
src/Controller/CourseCategoriesController.php
Normal file
126
src/Controller/CourseCategoriesController.php
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CourseCategories Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\CourseCategoriesTable $CourseCategories
|
||||||
|
*/
|
||||||
|
class CourseCategoriesController extends AppsController
|
||||||
|
{
|
||||||
|
private $controller = "course-categories";
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('CourseCategories');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'id' => 'ASC'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(name LIKE ' . "'%" . $search . "%' "
|
||||||
|
. "OR description LIKE '%" . $search . "%'" .')' ;
|
||||||
|
}
|
||||||
|
$course_categories = $this->CourseCategories->find('all')->where($condition);
|
||||||
|
$this->set('course_categories', $this->paginate($course_categories));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '10172', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$course_category = $this->CourseCategories->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['created_by'] = $user_id;
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['updated_by'] = $user_id;
|
||||||
|
$course_category = $this->CourseCategories->patchEntity($course_category, $request);
|
||||||
|
$errors = $course_category->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->CourseCategories->save($course_category)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The CourseCategories has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the CourseCategories.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$course_category = $this->CourseCategories->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$course_category = $this->CourseCategories->patchEntity($course_category, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $course_category->errors();
|
||||||
|
|
||||||
|
$course_category['updated_at'] = FrozenTime::now();
|
||||||
|
$course_category['updated_by'] = $user_id;
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->CourseCategories->save($course_category)) {
|
||||||
|
$this->Flash->success(__('The report format type has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The report format type could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('course_category', $course_category);
|
||||||
|
$this->set('_serialize', ['course_category']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$course_category = $this->CourseCategories->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('course_category', $course_category);
|
||||||
|
$this->set('_serialize', ['course_category']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10171', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
275
src/Controller/CourseController.php
Normal file
275
src/Controller/CourseController.php
Normal file
@@ -0,0 +1,275 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Utility\Common;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\Cache\Cache;
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Courses Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\CoursesTable $Courses
|
||||||
|
* @property \App\Model\Table\StudentCoursesTable $StudentCourses
|
||||||
|
* @property \App\Model\Table\CourseCategoriesTable $CourseCategories
|
||||||
|
* @property \App\Model\Table\QualificationTypesTable $QualificationTypes
|
||||||
|
* @property \App\Model\Table\CourseSemesterFeesTable $CourseSemesterFees
|
||||||
|
* @property \App\Model\Table\CourseSemesterSubjectsTable $CourseSemesterSubjects
|
||||||
|
*/
|
||||||
|
class CourseController extends AppsController
|
||||||
|
{
|
||||||
|
private $controller = "course";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('Courses');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'id' => 'asc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(name LIKE ' . "'%" . $search . "%' OR description LIKE '%" . $search . "%' " .')' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$courses = $this->Courses->find('all')->where($condition) ;
|
||||||
|
|
||||||
|
$this->set('courses', $this->paginate($courses));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '10108', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$course = $this->Courses->newEntity();
|
||||||
|
$course_request = $this->request->getData();
|
||||||
|
$course_request['status'] = 1;
|
||||||
|
$course_request['created_at'] = FrozenTime::now();
|
||||||
|
$course_request['created_by'] = $user_id;
|
||||||
|
$course_request['updated_at'] = FrozenTime::now();
|
||||||
|
$course_request['updated_by'] = $user_id;
|
||||||
|
$course = $this->Courses->patchEntity($course, $course_request);
|
||||||
|
$errors = $course->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Courses->save($course)) {
|
||||||
|
$course_request['course_id'] = $course->id;
|
||||||
|
$courseFee = $this->courseFee($course_request);
|
||||||
|
$this->courseSubject($course_request);
|
||||||
|
$this->Flash->success(__('The Courses has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the Courses.'));
|
||||||
|
}
|
||||||
|
$this->setRelatedInfos();
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$this->loadModel('CourseSemesterFees');
|
||||||
|
$this->loadModel('CourseSemesterSubjects');
|
||||||
|
$course = $this->Courses->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$course_semester_fee = $this->CourseSemesterFees->find()
|
||||||
|
->where(['course_id' => $course->id])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$course_semester_subjects = $this->CourseSemesterSubjects->find()
|
||||||
|
->where(['course_id' => $course->id])
|
||||||
|
->all();
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$course = $this->Courses->patchEntity($course, $this->request->data);
|
||||||
|
$errors = $course->errors();
|
||||||
|
$course['updated_at'] = FrozenTime::now();
|
||||||
|
$course['updated_by'] = $user_id;
|
||||||
|
// dd($this->request->data['course_semester_subjects']);
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Courses->save($course)) {
|
||||||
|
$course_fee = $this->CourseSemesterFees->patchEntity($course_semester_fee, $this->request->data);
|
||||||
|
$errors = $course_fee->errors();
|
||||||
|
if(empty($errors)){
|
||||||
|
$this->CourseSemesterFees->save($course_fee);
|
||||||
|
}
|
||||||
|
foreach ($this->request->data['course_semester_subjects'] as $key => $value) {
|
||||||
|
$subject_request = [
|
||||||
|
'course_id' => $course->id,
|
||||||
|
'course_semester_id' => COURSE_SEMESTER_ID,
|
||||||
|
'title' => $value['title'],
|
||||||
|
'level' => $course->level,
|
||||||
|
'credit' => $value['credit'],
|
||||||
|
'is_mandatory' => !empty($value['is_mandatory']) ? $value['is_mandatory'] : 2,
|
||||||
|
'updated_by' => $user_id,
|
||||||
|
'updated_at' => FrozenTime::now()
|
||||||
|
];
|
||||||
|
if (!empty($value['id'])) {
|
||||||
|
$subject = $this->CourseSemesterSubjects->get($value['id']);
|
||||||
|
}else{
|
||||||
|
$subject = $this->CourseSemesterSubjects->newEntity();
|
||||||
|
$subject_request['created_at'] = FrozenTime::now();
|
||||||
|
$subject_request['created_by'] = $user_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$subject = $this->CourseSemesterSubjects->patchEntity($subject, $subject_request);
|
||||||
|
$this->CourseSemesterSubjects->save($subject);
|
||||||
|
}
|
||||||
|
$this->Flash->success(__('The Course has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Course could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setRelatedInfos();
|
||||||
|
$this->set(compact('course_semester_fee','course_semester_subjects'));
|
||||||
|
$this->set('course', $course);
|
||||||
|
$this->set('_serialize', ['course']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$this->loadModel('CourseSemesterFees');
|
||||||
|
$this->loadModel('CourseSemesterSubjects');
|
||||||
|
$course = $this->Courses->get($id, [
|
||||||
|
'contain' => ['CourseCategories', 'QualificationTypes']
|
||||||
|
]);
|
||||||
|
$course_semester_fee = $this->CourseSemesterFees->find()
|
||||||
|
->where(['course_id' => $course->id])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$course_semester_subjects = $this->CourseSemesterSubjects->find()
|
||||||
|
->where(['course_id' => $course->id])
|
||||||
|
->all();
|
||||||
|
$this->set(compact('course_semester_fee','course_semester_subjects'));
|
||||||
|
$this->set('course', $course);
|
||||||
|
$this->set('_serialize', ['course']);
|
||||||
|
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id=null)
|
||||||
|
{
|
||||||
|
$this->loadModel('StudentCourses');
|
||||||
|
$courses = $this->Courses->get($id);
|
||||||
|
|
||||||
|
$courseCourseCount = $this->StudentCourses->find()
|
||||||
|
->where(['course_id' => $id])
|
||||||
|
->count();
|
||||||
|
|
||||||
|
if ($courseCourseCount > 0) {
|
||||||
|
$this->Flash->error(__('Cannot delete Course because it has associated course Courses.'));
|
||||||
|
} else {
|
||||||
|
if ($this->Courses->delete($courses)) {
|
||||||
|
$this->Flash->success(__('The Courses has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Courses could not be deleted. Please try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10105', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setRelatedInfos(){
|
||||||
|
$this->loadModel('CourseCategories');
|
||||||
|
$this->loadModel('QualificationTypes');
|
||||||
|
$course_categories = $this->CourseCategories->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
$qualification_types = $this->QualificationTypes->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
$this->set(compact('qualification_types','course_categories'));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function courseFee($inputData){
|
||||||
|
$this->loadModel('CourseSemesterFees');
|
||||||
|
$course_semester_fee = $this->CourseSemesterFees->newEntity();
|
||||||
|
$course_fee = [
|
||||||
|
'course_id' => $inputData['course_id'],
|
||||||
|
'online_fee' => $inputData['online_fee'],
|
||||||
|
'discount' => $inputData['discount'],
|
||||||
|
'monthly_installment_amount' => $inputData['monthly_installment_amount'],
|
||||||
|
'upfront_deposit' => $inputData['upfront_deposit'],
|
||||||
|
'blended_fee' => $inputData['blended_fee'],
|
||||||
|
'certificate_fee' => $inputData['certificate_fee'],
|
||||||
|
'status' => $inputData['status'],
|
||||||
|
'created_by' => $inputData['created_by'],
|
||||||
|
'updated_by' => $inputData['updated_by'],
|
||||||
|
'created_at' => $inputData['created_at'],
|
||||||
|
'updated_at' => $inputData['updated_at']
|
||||||
|
];
|
||||||
|
$course_semester_fee = $this->CourseSemesterFees->patchEntity($course_semester_fee, $course_fee);
|
||||||
|
$errors = $course_semester_fee->errors();
|
||||||
|
if (empty($errors)) {
|
||||||
|
return $this->CourseSemesterFees->save($course_semester_fee) ;
|
||||||
|
}else{
|
||||||
|
return $errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private function courseSubject($inputData){
|
||||||
|
$this->loadModel('CourseSemesterSubjects');
|
||||||
|
$course_subjects = [];
|
||||||
|
if(!empty($inputData['course_semester_subjects'])) {
|
||||||
|
foreach ($inputData['course_semester_subjects'] as $key => $value) {
|
||||||
|
$course_subject = [
|
||||||
|
'course_id' => $inputData['course_id'],
|
||||||
|
'course_semester_id' => COURSE_SEMESTER_ID,
|
||||||
|
'title' => $value['title'],
|
||||||
|
'level' => $inputData['level'],
|
||||||
|
'credit' => $value['credit'],
|
||||||
|
'is_mandatory' => !empty($value['is_mandatory']) ? $value['is_mandatory'] : 2,
|
||||||
|
'status' => $inputData['status'],
|
||||||
|
'created_by' => $inputData['created_by'],
|
||||||
|
'updated_by' => $inputData['updated_by'],
|
||||||
|
'created_at' => $inputData['created_at'],
|
||||||
|
'updated_at' => $inputData['updated_at']
|
||||||
|
];
|
||||||
|
$course_subjects[] = $course_subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
$entities = $this->CourseSemesterSubjects->patchEntities([], array_values($course_subjects));
|
||||||
|
return $this->CourseSemesterSubjects->saveMany($entities);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
2726
src/Controller/DashboardController.php
Normal file
2726
src/Controller/DashboardController.php
Normal file
File diff suppressed because it is too large
Load Diff
150
src/Controller/EducationController.php
Normal file
150
src/Controller/EducationController.php
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Common\Permission;
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Education Controller
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @method \App\Model\Entity\Education[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||||
|
*/
|
||||||
|
class EducationController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function initialize() {
|
||||||
|
parent::initialize();
|
||||||
|
|
||||||
|
if (Permission::isEmployeeAsAdmin()) {
|
||||||
|
$this->Auth->allow(['index', 'add', 'edit', 'delete']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->checkUser(); // is RTG User or not
|
||||||
|
|
||||||
|
$this->setUserType();
|
||||||
|
if($this->setClientControllerAccess()){
|
||||||
|
$this->Auth->allow(['geteducationcontent']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return \Cake\Http\Response|null
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->loadModel('MemberEducations');
|
||||||
|
$member_id = $this->Auth->user('id');
|
||||||
|
if($this->request->is('post')){
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['member_id'] = $member_id;
|
||||||
|
$result = $this->MemberEducations->saveEducationContent($request);
|
||||||
|
if(!empty($result)){
|
||||||
|
|
||||||
|
//add_log
|
||||||
|
$logData['action'] = "EDUCATIONSETUP_ADD_EDIT";
|
||||||
|
$logData['status'] = "success";
|
||||||
|
$logData['input_data'] = $this->request->getData();
|
||||||
|
$logData['input_data']["id"]=$result->id;
|
||||||
|
$this->appLog($logData);
|
||||||
|
|
||||||
|
$this->Flash->success(__('The eduaction content has been saved successfully.'));
|
||||||
|
$this->redirect($this->referer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = $this->MemberEducations->getEducationTempleateByMemberId($member_id);
|
||||||
|
$content['html'] = $html;
|
||||||
|
|
||||||
|
$this->set(compact('content'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function geteducationcontent(){
|
||||||
|
$this->loadModel('MemberEducations');
|
||||||
|
$member_id = $this->Auth->user('id');
|
||||||
|
$html = $this->MemberEducations->getEducationTempleateByMemberId($member_id);
|
||||||
|
$content['html'] = $html;
|
||||||
|
$this->set(compact('content'));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Education id.
|
||||||
|
* @return \Cake\Http\Response|null
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$education = $this->Education->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('education', $education);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$education = $this->Education->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$education = $this->Education->patchEntity($education, $this->request->getData());
|
||||||
|
if ($this->Education->save($education)) {
|
||||||
|
$this->Flash->success(__('The education has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('The education could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
$this->set(compact('education'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Education id.
|
||||||
|
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$education = $this->Education->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$education = $this->Education->patchEntity($education, $this->request->getData());
|
||||||
|
if ($this->Education->save($education)) {
|
||||||
|
$this->Flash->success(__('The education has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('The education could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
$this->set(compact('education'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Education id.
|
||||||
|
* @return \Cake\Http\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$education = $this->Education->get($id);
|
||||||
|
if ($this->Education->delete($education)) {
|
||||||
|
$this->Flash->success(__('The education has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The education could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
169
src/Controller/FeedBackController.php
Normal file
169
src/Controller/FeedBackController.php
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Utility\Common;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\Cache\Cache;
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Student Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\FeedBacksTable $Feedbacks
|
||||||
|
* @property \App\Model\Table\StudentSessionsTable $StudentSessions
|
||||||
|
* @property \App\Model\Table\StudentCoursesTable $StudentCourses
|
||||||
|
* @property \App\Model\Table\CoursesTable $Courses
|
||||||
|
* @property \App\Model\Table\SessionsTable $Sessions
|
||||||
|
*/
|
||||||
|
class FeedBackController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
private $controller = "feed-back";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('Feedbacks');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'id' => 'asc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(name LIKE ' . "'%" . $search . "%' "
|
||||||
|
. "OR email LIKE '%" . $search . "%' OR phone_number LIKE '%" . $search . "%' OR subject LIKE '%" . $search . "%'" .')' ;
|
||||||
|
}
|
||||||
|
$feedbacks = $this->Feedbacks->find('all')->where($condition);
|
||||||
|
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$this->set('feedbacks', $this->paginate($feedbacks));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$sessions = $this->Sessions->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->toArray();
|
||||||
|
$courses = $this->Courses->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->toArray();
|
||||||
|
$user_id = $this->Auth->user('user_id');
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
|
||||||
|
$student = $this->Students->newEntity();
|
||||||
|
$student_request = $this->request->getData();
|
||||||
|
$student_request['date_of_birth'] = $student_request["date_year"]."-".$student_request["date_month"]."-".$student_request["date_day"];
|
||||||
|
//$student_request['reference_number']= $this->generateReferenceNumber($student_request['date_of_birth'],$student_request['session_id']);
|
||||||
|
$student_request['reference_number'] = STUDENT_ID_PREFIX . time() . rand(0, 9999);
|
||||||
|
$student = $this->Students->patchEntity($student, $student_request);
|
||||||
|
$student['created_by'] = $user_id;
|
||||||
|
$student['updated_by'] = $user_id;
|
||||||
|
$student['updated_at'] = FrozenTime::now();
|
||||||
|
$student['created_at'] = FrozenTime::now();
|
||||||
|
$student['status'] = 1;
|
||||||
|
if ($this->Students->save($student)) {
|
||||||
|
|
||||||
|
$student_session = $this->StudentSessions->newEntity();
|
||||||
|
$student_session_request['student_id'] = $student['id'];
|
||||||
|
$student_session_request['session_id'] = $student_request['session_id'];
|
||||||
|
$student_session = $this->StudentSessions->patchEntity($student_session, $student_session_request);
|
||||||
|
$this->StudentSessions->save($student_session);
|
||||||
|
|
||||||
|
$student_course = $this->StudentCourses->newEntity();
|
||||||
|
$student_course_request['student_id'] = $student['id'];
|
||||||
|
$student_course_request['course_id'] = $student_request['course_id'];
|
||||||
|
$student_course_request['enrollment_date'] = FrozenTime::now();
|
||||||
|
$student_course = $this->StudentCourses->patchEntity($student_course, $student_course_request);
|
||||||
|
$this->StudentCourses->save($student_course);
|
||||||
|
|
||||||
|
$this->Flash->success(__('The student has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('Unable to add the student.'));
|
||||||
|
}
|
||||||
|
$this->set(compact('sessions','courses'));
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$feedback = $this->Feedbacks->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$request = $this->request->data;
|
||||||
|
|
||||||
|
$feedback = $this->Feedbacks->patchEntity($feedback, $request);
|
||||||
|
|
||||||
|
$errors = $feedback->errors();
|
||||||
|
|
||||||
|
$feedback['response_date'] = FrozenTime::now();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Feedbacks->save($feedback)) {
|
||||||
|
$this->feedback_email($feedback);
|
||||||
|
$this->Flash->success(__('The Feedbacks has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Feedbacks could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('feedback', $feedback);
|
||||||
|
$this->set('_serialize', ['feedback']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id=null)
|
||||||
|
{
|
||||||
|
$feedback = $this->Feedbacks->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('feedback', $feedback);
|
||||||
|
$this->set('_serialize', ['feedback']);
|
||||||
|
$this->setNextPage();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function feedback_email($feedback){
|
||||||
|
$template_content = array(
|
||||||
|
'name' => $feedback->name,
|
||||||
|
'from_message' => $feedback->message,
|
||||||
|
'reply_message' => $feedback->response_text
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->sendEmail(MANDRILL_TEMPLATE_REPLY_MESSAGE, $template_content, $feedback->email, 'Feedback Reply', "", null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10117', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
73
src/Controller/FilesController.php
Normal file
73
src/Controller/FilesController.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Common\Permission;
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use RingCentral\SDK\SDK;
|
||||||
|
use App\Helper\commonLogic;
|
||||||
|
use App\Utility\Common;
|
||||||
|
use App\Utility\PdfWriter;
|
||||||
|
use Cake\View\View;
|
||||||
|
use App\Utility\IdentityIQParse;
|
||||||
|
use App\Utility\PasswordCreator;
|
||||||
|
use Cake\Routing\Router;
|
||||||
|
use App\Utility\EpicvelocityPrint;
|
||||||
|
use App\Utility\CreditAnalysis;
|
||||||
|
use HTML5_Parser;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class FilesController extends AppsController {
|
||||||
|
|
||||||
|
public function initialize() {
|
||||||
|
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadComponent('RequestHandler'); // Allow JSON request handling
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post']); // Only allow POST requests
|
||||||
|
// Check if a file is uploaded
|
||||||
|
if (!$this->request->getData('file')) {
|
||||||
|
throw new BadRequestException(__('No file uploaded'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $this->request->getData('file');
|
||||||
|
|
||||||
|
// Basic file validation (you can add more checks here)
|
||||||
|
if ($file->getError() !== UPLOAD_ERR_OK) {
|
||||||
|
throw new InternalErrorException(__('File upload failed'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate a new filename
|
||||||
|
$filename = time() . '-' . $file->getClientFilename();
|
||||||
|
|
||||||
|
// Define the target directory
|
||||||
|
$targetPath = WWW_ROOT . 'files' . DS;
|
||||||
|
|
||||||
|
// Ensure the directory exists
|
||||||
|
$folder = new Folder($targetPath, true, 0755);
|
||||||
|
|
||||||
|
// Move the file to the target directory
|
||||||
|
$file->moveTo($targetPath . $filename);
|
||||||
|
|
||||||
|
// Save the file details in the database (if applicable)
|
||||||
|
$fileEntity = $this->Files->newEmptyEntity();
|
||||||
|
$fileEntity->filename = $filename;
|
||||||
|
$fileEntity->filepath = 'files/' . $filename; // The relative path to the file
|
||||||
|
if ($this->Files->save($fileEntity)) {
|
||||||
|
return $this->response->withType('application/json')
|
||||||
|
->withStringBody(json_encode(['status' => 'success', 'filename' => $filename]));
|
||||||
|
} else {
|
||||||
|
throw new InternalErrorException(__('Unable to save file details'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
273
src/Controller/LearninghubController.php
Normal file
273
src/Controller/LearninghubController.php
Normal file
@@ -0,0 +1,273 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Model\Entity\Log;
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
use Cake\Database\Expression\QueryExpression;
|
||||||
|
use Cake\I18n\FrozenDate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Student Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\FeedBacksTable $Feedbacks
|
||||||
|
* @property \App\Model\Table\StudentsTable $Students
|
||||||
|
* @property \App\Model\Table\StudentSessionsTable $StudentSessions
|
||||||
|
* @property \App\Model\Table\StudentCoursesTable $StudentCourses
|
||||||
|
* @property \App\Model\Table\CoursesTable $Courses
|
||||||
|
* @property \App\Model\Table\SessionsTable $Sessions
|
||||||
|
* @property \App\Model\Table\PersonalizesTable $Personalizes
|
||||||
|
* @property \App\Model\Table\AgentsTable $Agents
|
||||||
|
* @property \App\Model\Table\CourseSemesterFeesTable $CourseSemesterFees
|
||||||
|
* @property \App\Model\Table\CourseSemesterSubjectsTable $CourseSemesterSubjects
|
||||||
|
*/
|
||||||
|
class LearninghubController extends AppController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
}
|
||||||
|
public function about()
|
||||||
|
{
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
}
|
||||||
|
public function acreditation()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
}
|
||||||
|
public function accomodation()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
}
|
||||||
|
public function applicationProcess()
|
||||||
|
{
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
|
||||||
|
}
|
||||||
|
public function applyForm()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->loadModel('Students');
|
||||||
|
$this->loadModel('StudentSessions');
|
||||||
|
$this->loadModel('StudentCourses');
|
||||||
|
$this->loadModel('Courses');
|
||||||
|
$this->loadModel('Sessions');
|
||||||
|
$sessions = $this->Sessions->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
$courses = $this->Courses->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
|
||||||
|
$student = $this->Students->newEntity();
|
||||||
|
$student_request = $this->request->getData();
|
||||||
|
$student_request['date_of_birth'] = $student_request["date_year"]."-".$student_request["date_month"]."-".$student_request["date_day"];
|
||||||
|
// $student_request['reference_number'] = STUDENT_ID_PREFIX . time() . rand(0, 9999);
|
||||||
|
$student = $this->Students->patchEntity($student, $student_request);
|
||||||
|
$student['updated_at'] = FrozenTime::now();
|
||||||
|
$student['created_at'] = FrozenTime::now();
|
||||||
|
$student['current_checklist_id'] = 1;
|
||||||
|
$errors = $student->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Students->save($student)) {
|
||||||
|
|
||||||
|
$student_session = $this->StudentSessions->newEntity();
|
||||||
|
$student_session_request['student_id'] = $student['id'];
|
||||||
|
$student_session_request['session_id'] = $student_request['session_id'];
|
||||||
|
$student_session = $this->StudentSessions->patchEntity($student_session, $student_session_request);
|
||||||
|
$this->StudentSessions->save($student_session);
|
||||||
|
|
||||||
|
$student_course = $this->StudentCourses->newEntity();
|
||||||
|
$student_course_request['student_id'] = $student['id'];
|
||||||
|
$student_course_request['course_id'] = $student_request['course_id'];
|
||||||
|
$student_course_request['enrollment_date'] = FrozenTime::now();
|
||||||
|
$student_course = $this->StudentCourses->patchEntity($student_course, $student_course_request);
|
||||||
|
$this->StudentCourses->save($student_course);
|
||||||
|
|
||||||
|
$session = $sessions[$student_request['session_id']];
|
||||||
|
$course = $courses[$student_request['course_id']];
|
||||||
|
$this->registration_email($student,$session,$course);
|
||||||
|
|
||||||
|
$this->Flash->success(__('Registration Successful!'));
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
$errorMessages = [];
|
||||||
|
foreach ($errors as $field => $fieldErrors) {
|
||||||
|
foreach ($fieldErrors as $error) {
|
||||||
|
$errorMessages[] = ucfirst($field) . ': ' . $error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$allErrors = implode(' ', $errorMessages);
|
||||||
|
$this->log(['request'=> $this->request->getData(),'Student Registration failed'=> $errors]);
|
||||||
|
$this->Flash->error(__($allErrors), ['escape' => false]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set(compact('sessions','courses'));
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
|
||||||
|
}
|
||||||
|
public function courses()
|
||||||
|
{
|
||||||
|
$this->loadModel('Courses');
|
||||||
|
$courses = $this->Courses->find('all')
|
||||||
|
->contain(['CourseCategories', 'QualificationTypes'])
|
||||||
|
->where(['Courses.status' => 1, 'Courses.course_category_id !=' => ENGLISH_COURSE_CATEGORY_ID]);
|
||||||
|
$this->set(compact('courses'));
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
|
||||||
|
}
|
||||||
|
public function verification()
|
||||||
|
{
|
||||||
|
$message = '';
|
||||||
|
$student = [];
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
|
||||||
|
$this->loadModel('Students');
|
||||||
|
$this->loadModel('StudentSessions');
|
||||||
|
$this->loadModel('StudentCourses');
|
||||||
|
$this->loadModel('Courses');
|
||||||
|
$this->loadModel('Sessions');
|
||||||
|
$student_request = $this->request->getData();
|
||||||
|
$dateOfBirth = FrozenDate::createFromFormat('d-m-Y', $student_request['date_of_birth']);
|
||||||
|
$student = $this->Students->find()
|
||||||
|
->select(['id', 'reference_number', 'first_name', 'surname', 'nationality','passport_number','date_of_birth'])
|
||||||
|
->where(['status' => 1,'current_checklist_id'=>7, 'reference_number' => $student_request['reference_number'], 'date_of_birth' => $dateOfBirth ])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$student_session = $this->StudentSessions->find()
|
||||||
|
->select(['id','session_id'])
|
||||||
|
->where(['student_id' => $student['id']])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
|
||||||
|
$student_course = $this->StudentCourses->find()
|
||||||
|
->select(['id','course_id'])
|
||||||
|
->where(['student_id' => $student['id']])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$session = $this->Sessions->find()
|
||||||
|
->where(['id' => $student_session['session_id']])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$course = $this->Courses->find()
|
||||||
|
->where(['id' => $student_course['course_id']])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if(empty($student)){
|
||||||
|
$message = "Sorry! You have not been enrolled ";
|
||||||
|
}
|
||||||
|
$this->set(compact('student','session','course','message'));
|
||||||
|
}
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
|
||||||
|
}
|
||||||
|
public function contact()
|
||||||
|
{
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$this->loadModel('Feedbacks');
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$feedback = $this->Feedbacks->newEntity();
|
||||||
|
$feedback = $this->Feedbacks->patchEntity($feedback, $request);
|
||||||
|
$errors = $feedback->errors();
|
||||||
|
$feedback['created_at'] = FrozenTime::now();
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Feedbacks->save($feedback)) {
|
||||||
|
$this->Flash->success(__('Thank you for contacting us!'));
|
||||||
|
return $this->redirect(['action' => 'contact']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
|
||||||
|
}
|
||||||
|
private function registration_email($student,$session,$course){
|
||||||
|
$this->loadModel('Personalizes');
|
||||||
|
$personalize = $this->Personalizes->find()->where(['member_id'=> DEFAULT_MEMBER_ID])->first();
|
||||||
|
$template_content = array(
|
||||||
|
'student_name' => $student['title'].' '.$student['first_name'],
|
||||||
|
'student_email' => $student['email'],
|
||||||
|
'phone_number' => $student['phone_number'],
|
||||||
|
// 'reference_number' => $student['reference_number'],
|
||||||
|
'course_name' => $course,
|
||||||
|
'registration_date' => $student['created_at']->i18nFormat('dd MMMM yyyy')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->sendEmail(MANDRILL_TEMPLATE_STUDENT_CONFIRMATION, $template_content, $student->email, 'Registration Confirmation', "", $personalize);
|
||||||
|
$this->sendEmail(MANDRILL_TEMPLATE_STUDENT_CONFIRMATION_FOR_ADMIN, $template_content, ADMIN_EMAIL_LEARNING_HUB, 'Registration Confirmation', "", $personalize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function agent()
|
||||||
|
{
|
||||||
|
$this->loadModel('Agents');
|
||||||
|
$agents = $this->Agents->find('all');
|
||||||
|
$this->set(compact('agents'));
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function viewCourses($slug)
|
||||||
|
{
|
||||||
|
|
||||||
|
$slug = str_replace('-', ' ', $slug);
|
||||||
|
|
||||||
|
$this->loadModel('Courses');
|
||||||
|
$this->loadModel('CourseSemesterFees');
|
||||||
|
$this->loadModel('CourseSemesterSubjects');
|
||||||
|
$course = $this->Courses->find()
|
||||||
|
->where(function (QueryExpression $exp) use ($slug) {
|
||||||
|
return $exp->eq(
|
||||||
|
'LOWER(Courses.name)',
|
||||||
|
strtolower($slug)
|
||||||
|
);
|
||||||
|
})
|
||||||
|
->andWhere(['Courses.status' => 1])
|
||||||
|
->contain(['CourseCategories', 'QualificationTypes'])
|
||||||
|
->first();
|
||||||
|
$course_fee = $this->CourseSemesterFees->find()
|
||||||
|
->where(['course_id' => $course->id])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$course_subjects = $this->CourseSemesterSubjects->find()
|
||||||
|
->where(['course_id' => $course->id])->all();
|
||||||
|
|
||||||
|
$mandatoryCount =0 ;
|
||||||
|
$optionalCount =0;
|
||||||
|
if(!empty($course_subjects)) {
|
||||||
|
$mandatoryCount = collection($course_subjects)
|
||||||
|
->filter(function ($subject) {
|
||||||
|
return !empty($subject['is_mandatory']) && $subject['is_mandatory'] == 1;
|
||||||
|
})
|
||||||
|
->count();
|
||||||
|
$optionalCount = collection($course_subjects)
|
||||||
|
->filter(function ($subject) {
|
||||||
|
return !empty($subject['is_mandatory']) && $subject['is_mandatory'] == 2;
|
||||||
|
})
|
||||||
|
->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set(compact('course', 'course_fee', 'course_subjects','mandatoryCount','optionalCount'));
|
||||||
|
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function viewEnglishCourses()
|
||||||
|
{
|
||||||
|
$this->viewBuilder()->layout("customer_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
250
src/Controller/LetterSentHistoryController.php
Normal file
250
src/Controller/LetterSentHistoryController.php
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LetterSentHistory Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\LetterSentHistoriesTable $LetterSentHistories
|
||||||
|
* @property \App\Model\Table\LetterSentHistoryDetailsTable $LetterSentHistoryDetails
|
||||||
|
* @property \App\Model\Table\ReportFormatsTable $ReportFormats
|
||||||
|
*/
|
||||||
|
class LetterSentHistoryController extends AppsController
|
||||||
|
{
|
||||||
|
private $controller = "letter-sent-history";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('LetterSentHistories');
|
||||||
|
$this->loadModel('LetterSentHistoryDetails');
|
||||||
|
$this->loadModel('ReportFormats');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'LetterSentHistories.id' => 'ASC'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(student_email LIKE ' . "'%" . $search . "%'" .')' ;
|
||||||
|
}
|
||||||
|
$report_format_histories = $this->LetterSentHistories->find('all',[
|
||||||
|
'contain' => ['ReportFormats','ReportFormatTypes','Students']
|
||||||
|
])->where($condition);
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('report_format_histories', $this->paginate($report_format_histories));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$report_formats = $this->ReportFormats->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$report_format = $this->LetterSentHistories->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['created_by_id'] = $user_id;
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['updated_by_id'] = $user_id;
|
||||||
|
$report_format = $this->LetterSentHistories->patchEntity($report_format, $request);
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->LetterSentHistories->save($report_format)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The ReportFormatGenerationHistory has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the ReportFormatGenerationHistory.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set(compact('report_formats'));
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$report_format_generation_history = $this->LetterSentHistories->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_format = $this->ReportFormats->get($report_format_generation_history['report_format_id'], [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_formats = $this->ReportFormats->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$report_format = $this->LetterSentHistories->patchEntity($report_format_generation_history, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
|
||||||
|
$report_format['updated_at'] = FrozenTime::now();
|
||||||
|
$report_format['updated_by'] = $user_id;
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->LetterSentHistories->save($report_format)) {
|
||||||
|
$this->Flash->success(__('The report format generation history has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The report format type could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('report_format_generation_history', $report_format_generation_history);
|
||||||
|
$this->set('report_formats', $report_formats);
|
||||||
|
$this->set('report_format', $report_format);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$letter_sent_history = $this->LetterSentHistories->get($id,[
|
||||||
|
'contain' => ['ReportFormats','ReportFormatTypes','Students']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$letter_sent_history_details = $this->LetterSentHistoryDetails->find()->where(['letter_sent_history_id'=>$letter_sent_history['id']])->first();
|
||||||
|
|
||||||
|
$dynamic_value = json_decode($letter_sent_history_details['column_value'],true);
|
||||||
|
|
||||||
|
$report_variable = $this->findVariableFromHtmlContent($letter_sent_history->report_format->content);
|
||||||
|
|
||||||
|
$variable_list = $this->placedReportVariable($dynamic_value,$report_variable);
|
||||||
|
|
||||||
|
$report = $this->reportHTMLReplace($letter_sent_history->report_format->content,$variable_list);
|
||||||
|
|
||||||
|
$this->set('letter_sent_history', $letter_sent_history);
|
||||||
|
$this->set('report', $report);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function download($id)
|
||||||
|
{
|
||||||
|
$letter = $this->LetterSentHistories->get($id);
|
||||||
|
|
||||||
|
$filePath = WWW_ROOT . $letter->letter_file_path;
|
||||||
|
|
||||||
|
if (!file_exists($filePath)) {
|
||||||
|
throw new NotFoundException(__('File not found'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->withFile(
|
||||||
|
$filePath,
|
||||||
|
[
|
||||||
|
'download' => true,
|
||||||
|
'name' => $letter->letter_file_path
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resend($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post']);
|
||||||
|
|
||||||
|
$letter = $this->LetterSentHistories->get($id,[
|
||||||
|
'contain' => ['ReportFormats','ReportFormatTypes','Students']
|
||||||
|
]);
|
||||||
|
$filePath = WWW_ROOT . $letter->letter_file_path;
|
||||||
|
$template_content = array(
|
||||||
|
'student_name' => $letter->student['first_name'].' '.$letter->student['surname'],
|
||||||
|
'course'=> "",
|
||||||
|
'letter_type'=> $letter->report_format['name']
|
||||||
|
);
|
||||||
|
$report_name = $letter->report_format['name'].".pdf" ;
|
||||||
|
$this->sendEmail('send_email_to_client', $template_content, $letter->student['email'], $letter->report_format['name'], [ $report_name => $filePath], null);
|
||||||
|
|
||||||
|
$this->Flash->success(__('The letter has been resent successfully.'));
|
||||||
|
|
||||||
|
return $this->redirect($this->referer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findVariableFromHtmlContent($html_content)
|
||||||
|
{
|
||||||
|
preg_match_all('/\[(.*?)\]/', $html_content, $matches);
|
||||||
|
|
||||||
|
return $matches[1];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function placedReportVariable($dynamic_variable,$report_variables)
|
||||||
|
{
|
||||||
|
|
||||||
|
$variable_list = [];
|
||||||
|
|
||||||
|
foreach ($report_variables as $key => $value) {
|
||||||
|
|
||||||
|
if(array_key_exists($value,$dynamic_variable)) {
|
||||||
|
$variable_list[$value] = $dynamic_variable[$value];
|
||||||
|
|
||||||
|
}
|
||||||
|
if(array_key_exists($key,FIXED_REPORT_VARIABLE)) {
|
||||||
|
$variable_list[$value] = FIXED_REPORT_VARIABLE[$value];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return $variable_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reportHTMLReplace($content, $variableList) {
|
||||||
|
|
||||||
|
if (!empty($variableList)) {
|
||||||
|
foreach ($variableList as $key => $value) {
|
||||||
|
$content = str_replace("[$key]", "[$value]", $content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id=null)
|
||||||
|
{
|
||||||
|
$letter = $this->LetterSentHistories->get($id);
|
||||||
|
$letter_path = $letter->letter_file_path;
|
||||||
|
if ($this->LetterSentHistories->delete($letter)) {
|
||||||
|
$filePath = WWW_ROOT . $letter_path;
|
||||||
|
if (file_exists($filePath)) {
|
||||||
|
unlink($filePath);
|
||||||
|
}
|
||||||
|
$this->Flash->success(__('The LetterSentHistories has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The LetterSentHistories could not be deleted. Please try again.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10150', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
170
src/Controller/LogsController.php
Normal file
170
src/Controller/LogsController.php
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\LogsTable $Logs
|
||||||
|
*
|
||||||
|
* @method \App\Model\Entity\Log[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||||
|
*/
|
||||||
|
class LogsController extends AppsController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return \Cake\Http\Response|null
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
if($this->request->is('ajax')){
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$response = $this->ajaxRequest($request);
|
||||||
|
echo json_encode($response);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$page_limit = 10;
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
$this->loadModel('Logs');
|
||||||
|
$search = [];
|
||||||
|
$action_list = $this->Logs->ACCION_ARRAY;
|
||||||
|
$status_list = ['1'=>'Success','2'=>'Failed'];
|
||||||
|
$membersList = $this->Cmsusers->getAllMemberListAssocId();
|
||||||
|
//pr($membersList);exit;
|
||||||
|
$clientList = [];
|
||||||
|
$search['from_date'] = date('Y-m-d',strtotime("-7 day"));
|
||||||
|
$search['to_date'] = date('Y-m-d');
|
||||||
|
if(!empty($this->request->query)){
|
||||||
|
foreach($this->request->query as $key => $query){
|
||||||
|
if(isset($query)){
|
||||||
|
$search[$key] = $query;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($search['page_limit'])){
|
||||||
|
$page_limit = $search['page_limit'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($search['member_id'] > 0){
|
||||||
|
$this->loadModel('Clients');
|
||||||
|
$clientList = $this->Clients->getClientList($search['member_id'],"",false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit
|
||||||
|
];
|
||||||
|
$logsData = $this->Logs->getAllLogs($search);
|
||||||
|
if($logsData){
|
||||||
|
$logs = $this->paginate($logsData);
|
||||||
|
}
|
||||||
|
$this->set(compact('clientList','membersList','action_list','logs','status_list','search','page_limit'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function ajaxRequest($request){
|
||||||
|
$result = "";
|
||||||
|
$this->loadModel('Clients');
|
||||||
|
if($request['action'] == "GET_CLIENT_LIST_BY_MEMBER"){
|
||||||
|
$clientList = $this->Clients->getClientList($request['member_id'],"",false);
|
||||||
|
$html = "<option value=''>Please select</option>";
|
||||||
|
if(!empty($clientList)){
|
||||||
|
foreach($clientList as $client_id => $client){
|
||||||
|
$html .= "<option value ='".$client_id."'>".$client."</option>";
|
||||||
|
}
|
||||||
|
$result = $html;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Log id.
|
||||||
|
* @return \Cake\Http\Response|null
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$log = $this->Logs->get($id, [
|
||||||
|
'contain' => ['Members', 'Clients']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('log', $log);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$log = $this->Logs->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$log = $this->Logs->patchEntity($log, $this->request->getData());
|
||||||
|
if ($this->Logs->save($log)) {
|
||||||
|
$this->Flash->success(__('The log has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('The log could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
$members = $this->Logs->Members->find('list', ['limit' => 200]);
|
||||||
|
$clients = $this->Logs->Clients->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('log', 'members', 'clients'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Log id.
|
||||||
|
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$log = $this->Logs->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$log = $this->Logs->patchEntity($log, $this->request->getData());
|
||||||
|
if ($this->Logs->save($log)) {
|
||||||
|
$this->Flash->success(__('The log has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('The log could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
$members = $this->Logs->Members->find('list', ['limit' => 200]);
|
||||||
|
$clients = $this->Logs->Clients->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('log', 'members', 'clients'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Log id.
|
||||||
|
* @return \Cake\Http\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$log = $this->Logs->get($id);
|
||||||
|
if ($this->Logs->delete($log)) {
|
||||||
|
$this->Flash->success(__('The log has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The log could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
300
src/Controller/MemberController.php
Normal file
300
src/Controller/MemberController.php
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Common\Permission;
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\Routing\Router;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use Cake\Validation\Validator;
|
||||||
|
use DateTime;
|
||||||
|
use Google\Service\Sheets;
|
||||||
|
use Mandrill;
|
||||||
|
use Cake\Datasource\ConnectionManager;
|
||||||
|
use App\Utility\forumUtils;
|
||||||
|
use App\Helper\commonLogic;
|
||||||
|
use Cake\Network\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cmsusers Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\CmsusersTable $Cmsusers
|
||||||
|
*/
|
||||||
|
class MemberController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
|
||||||
|
$this->loadModel('Usergroups');
|
||||||
|
|
||||||
|
I18n::locale('en_US');
|
||||||
|
$this->Auth->allow(['forgotPassword']);
|
||||||
|
$this->Auth->allow(['resetPassword']);
|
||||||
|
$this->Auth->allow(['contactedit']);
|
||||||
|
$this->Auth->allow(['revokePassword']);
|
||||||
|
$this->Auth->allow(['zapierAuth']);
|
||||||
|
$this->Auth->allow(['trialaccount']);
|
||||||
|
$this->Auth->allow(['changeLanguage']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index($id = null)
|
||||||
|
{
|
||||||
|
$Cmsusers = TableRegistry::get('Cmsusers');
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'id' => 'desc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
$db_colum = ['id',
|
||||||
|
'full_name',
|
||||||
|
'roll_no',
|
||||||
|
'email',
|
||||||
|
'batch_no',
|
||||||
|
'organization',
|
||||||
|
'mobile_number',
|
||||||
|
'alternative_mobile_number',
|
||||||
|
'blood_group',
|
||||||
|
'designation',
|
||||||
|
'status',
|
||||||
|
'username',
|
||||||
|
'user_type'
|
||||||
|
];
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
|
||||||
|
$condition = ' ( full_name LIKE ' . "'%" . $search . "%' OR full_name LIKE '%" . $search . "%' "
|
||||||
|
. "OR username LIKE '%" . $search . "%' OR roll_no LIKE '%" . $search . "%' OR email LIKE '%" . $search . "%') ";
|
||||||
|
if (!empty($employee_condition)) {
|
||||||
|
$condition .= " AND " . $employee_condition;
|
||||||
|
}
|
||||||
|
$users = $Cmsusers->find('all')
|
||||||
|
->select($db_colum)
|
||||||
|
->where([ $condition, 'user_type' => 2]);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$users = $Cmsusers->find('all')
|
||||||
|
->select($db_colum)
|
||||||
|
->where(['user_type' => 2]);
|
||||||
|
}
|
||||||
|
// pr($this->paginate($users));exit;
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('users', $this->paginate($users));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('page_list', $this->getPages());
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '3046', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id User id.
|
||||||
|
* @return void
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$crmuserTable = TableRegistry::get('Cmsusers');
|
||||||
|
$user = $crmuserTable->get($id);
|
||||||
|
|
||||||
|
$this->set('user', $user);
|
||||||
|
$this->set('_serialize', ['user']);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('languages', $this->languages);
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
|
||||||
|
$this->insertData($this->request->getData('user'));
|
||||||
|
}
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('languages', $this->languages); // var $languages member variable of App Controler
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Cmsuser id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$cmsuser = $this->Cmsusers->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
//pr($this->request->data);exit;
|
||||||
|
|
||||||
|
$email = trim($this->request->data['email']);
|
||||||
|
|
||||||
|
$cmsuser = $this->Cmsusers->patchEntity($cmsuser, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $cmsuser->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Cmsusers->save($cmsuser)) {
|
||||||
|
$this->Flash->success(__('The cmsuser has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The cmsuser could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isset($errors['email']['validemail']) && !empty($errors['email']['validemail'])) {
|
||||||
|
$this->Flash->error(__('This email already exist'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$languages = [LANGUAGE_CODE_ENGLISH => 'English', LANGUAGE_CODE_KOREAN => 'Korean'];
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('cmsuser', $cmsuser);
|
||||||
|
$this->set('languages', $languages);
|
||||||
|
$this->set('_serialize', ['cmsuser']);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '3045', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function insertData($client){
|
||||||
|
|
||||||
|
$this->set('crmuserdata', $this->request->getData('user'));
|
||||||
|
|
||||||
|
$CmusersTable = TableRegistry::get('Cmsusers');
|
||||||
|
$user = $CmusersTable->newEntity();
|
||||||
|
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
|
||||||
|
|
||||||
|
$user->user_type = 2;
|
||||||
|
$user->employee_id = 1;
|
||||||
|
$user->cmsuser_id = 51;
|
||||||
|
$user->full_name = $client["full_name"];
|
||||||
|
$user->roll_no = $client["roll_no"];
|
||||||
|
$user->email = $client["email"];
|
||||||
|
$user->batch_no = $client["batch_no"];
|
||||||
|
$user->organization = $client["organization"];
|
||||||
|
$user->mobile_number = $client["mobile_number"];
|
||||||
|
$user->alternative_mobile_number = $client["alt_mobile_number"];
|
||||||
|
$user->blood_group = $client["blood_group"];
|
||||||
|
$user->designation = $client["designation"];
|
||||||
|
$user->username = $client["user_name"];
|
||||||
|
$user->status = 1;
|
||||||
|
$user->permission_version = 79;
|
||||||
|
|
||||||
|
$user->created_on = date("Y-m-d h:i:s");
|
||||||
|
$user->created_by = 51;
|
||||||
|
|
||||||
|
$user->password = $client['password'];
|
||||||
|
$checkEmail = $this->checkEmail($user->email);
|
||||||
|
|
||||||
|
if ($checkEmail) {
|
||||||
|
$crmUserData = $CmusersTable->save($user);
|
||||||
|
if (!empty($crmUserData)) {
|
||||||
|
$crmUserId = $crmUserData->id;
|
||||||
|
$CrmusersHasControllerTable = TableRegistry::get('cmsuser_usergroups');
|
||||||
|
|
||||||
|
$entities = $CrmusersHasControllerTable->newEntity();
|
||||||
|
$entities->cms_user_id = $crmUserId;
|
||||||
|
$entities->usergroup_id = 12;
|
||||||
|
$CrmusersHasControllerTable->save($entities);
|
||||||
|
|
||||||
|
|
||||||
|
$commonlogic = new commonLogic();
|
||||||
|
$personalizeInfo = $commonlogic->personalizeInfo();
|
||||||
|
$personalize = $personalizeInfo['personalize'];
|
||||||
|
$loginurl = $personalizeInfo['login_url'];
|
||||||
|
//pr($personalizeInfo);exit;
|
||||||
|
$templateContent = [
|
||||||
|
'firstname' => $client["full_name"],
|
||||||
|
'loginurl' => $loginurl,
|
||||||
|
'user_email' => $client["email"],
|
||||||
|
'password' => $client['password']
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->sendEmail(AFFILIATE_TEMPLATE_USER_CREATION, $templateContent, $client["email"], 'New Registration', "", null);
|
||||||
|
|
||||||
|
//add_log
|
||||||
|
|
||||||
|
$logData['action'] = "MEMBER_ADD";
|
||||||
|
$logData['status'] = "success";
|
||||||
|
$logData['input_data'] = $this->request->getData();
|
||||||
|
$logData['input_data']["id"] = $crmUserData->id;
|
||||||
|
$this->appLog($logData);
|
||||||
|
$this->Flash->success(__('The user has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$this->Flash->error(__('The email already exist.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private function checkEmail($email)
|
||||||
|
{
|
||||||
|
$result = false;
|
||||||
|
|
||||||
|
$CmusersTable = TableRegistry::get('Cmsusers');
|
||||||
|
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
|
||||||
|
$cmsuser = $CmusersTable->find("All")->where(['email' => $email])->first();
|
||||||
|
|
||||||
|
if(empty($cmsuser)) {
|
||||||
|
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
246
src/Controller/ModulesController.php
Normal file
246
src/Controller/ModulesController.php
Normal file
@@ -0,0 +1,246 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\Event\Event;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use DateTime;
|
||||||
|
use Cake\ORM\Query;
|
||||||
|
/**
|
||||||
|
* Modules Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\ModulesTable $Modules
|
||||||
|
*/
|
||||||
|
class ModulesController extends AppsController
|
||||||
|
{
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
I18n::locale('en_US');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user)
|
||||||
|
{
|
||||||
|
$request_action = $this->request->params['action'];
|
||||||
|
if ($request_action == "bulkAction") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::isAuthorized($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit=10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit= $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'Modules.created_on' => 'desc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
}
|
||||||
|
|
||||||
|
$modules = $this->Modules->find('all')->where([
|
||||||
|
'name LIKE' => '%' . $search . '%'
|
||||||
|
]);
|
||||||
|
$this->set('modules', $this->paginate($modules));
|
||||||
|
$this->set('_serialize', ['modules']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
|
||||||
|
//print_r($user_permissions);
|
||||||
|
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
//$this->viewBuilder()->layout("master_data");
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bulkAction()
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$selectedModules = $this->request->data('selected_content');
|
||||||
|
$bulkAction = $this->request->data('bulk_action');
|
||||||
|
if ($bulkAction == BULK_ACTION_DELETE) {
|
||||||
|
if ($selectedModules == "") return $this->redirect(['action' => 'index']);
|
||||||
|
$modulesToBeDeleted = explode(',', $selectedModules);
|
||||||
|
$error = $this->deleteAll($modulesToBeDeleted);
|
||||||
|
if (!$error) {
|
||||||
|
$this->Flash->success(__('All the selected Modules have been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteAll($modules)
|
||||||
|
{
|
||||||
|
foreach ($modules as &$moduleIdWithPrefix) {
|
||||||
|
$moduleId = str_replace('content_', '', $moduleIdWithPrefix);
|
||||||
|
$module = $this->Modules->get($moduleId);
|
||||||
|
if ($this->canModuleBeDeleted($moduleId)) {
|
||||||
|
$this->Modules->delete($module);
|
||||||
|
} else {
|
||||||
|
return (__('The Module ' . $module->name . ' cannot be deleted as it contains related Submodules'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Module id.
|
||||||
|
* @return void
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$module = $this->Modules->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
$this->set('module', $module);
|
||||||
|
$this->set('_serialize', ['module']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$newmodule = $this->Modules->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$newmodule = $this->Modules->patchEntity($newmodule, $this->request->data);
|
||||||
|
$moduleErrors = $this->checkAndDisplayEntityErrors($newmodule);
|
||||||
|
if (!$moduleErrors) {
|
||||||
|
//print_r($newmodule);exit;
|
||||||
|
if ($this->Modules->save($newmodule)) {
|
||||||
|
$this->Flash->success(__('The module has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The module could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set(compact('newmodule'));
|
||||||
|
$this->set('_serialize', ['module']);
|
||||||
|
//$this->viewBuilder()->layout("master_data");
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkAndDisplayEntityErrors($entity)
|
||||||
|
{
|
||||||
|
$entityErrors = $entity->errors();
|
||||||
|
foreach ($entityErrors as $key => $value) {
|
||||||
|
foreach ($entityErrors[$key] as $errorKey => $errorValue) {
|
||||||
|
$this->Flash->error($errorValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $entityErrors;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Module id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$newmodule = $this->Modules->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$id = $this->request->params['pass'][0];
|
||||||
|
$newmodule = $this->Modules->patchEntity($newmodule, $this->request->data);
|
||||||
|
$newmodule['modified_on'] = new DateTime();
|
||||||
|
$this->request->data['modified_on'] = new DateTime();
|
||||||
|
//print_r($newmodule);exit;
|
||||||
|
$query = $this->Modules->query();
|
||||||
|
$update = $query->update()
|
||||||
|
->set(['id' => $this->request->data['id'],'name'=>$this->request->data['name'],
|
||||||
|
'icon'=>$this->request->data['icon'],'sequence'=>$this->request->data['sequence'],
|
||||||
|
'modified_on'=>$this->request->data['modified_on']])
|
||||||
|
->where(['id' => $id])
|
||||||
|
->execute();
|
||||||
|
if ($update) {
|
||||||
|
$this->Flash->success(__('The module has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The module could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set(compact('newmodule'));
|
||||||
|
$this->set('_serialize', ['newmodule']);
|
||||||
|
//$this->viewBuilder()->layout("master_data");
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Module id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$module = $this->Modules->get($id);
|
||||||
|
if ($this->canModuleBeDeleted($id)) {
|
||||||
|
if ($this->Modules->delete($module)) {
|
||||||
|
$this->Flash->success(__('The module has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The module could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Module cannot be deleted as it contains related Submodules.'));
|
||||||
|
}
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canModuleBeDeleted($moduleId)
|
||||||
|
{
|
||||||
|
if ($moduleId) {
|
||||||
|
$SubModulesTable = TableRegistry::get('sub_modules');
|
||||||
|
$subModules = $SubModulesTable->find('all')
|
||||||
|
->where(['module_id' => $moduleId]);
|
||||||
|
|
||||||
|
if (sizeof($subModules->toArray()) > 0) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
249
src/Controller/PagesController.php
Normal file
249
src/Controller/PagesController.php
Normal file
@@ -0,0 +1,249 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use DateTime;
|
||||||
|
use Cake\ORM\Query;
|
||||||
|
/**
|
||||||
|
* Pages Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\PagesTable $Pages
|
||||||
|
*/
|
||||||
|
class PagesController extends AppsController
|
||||||
|
{
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
I18n::locale('en_US');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user)
|
||||||
|
{
|
||||||
|
$request_action = $this->request->params['action'];
|
||||||
|
if ($request_action == "getSubModulesByModule" && $this->Auth->user() || $request_action == "bulkAction") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::isAuthorized($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit=10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit= $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'contain' => ['SubModules.Modules'],
|
||||||
|
'sortWhitelist' => [
|
||||||
|
'Modules.name', 'Pages.created_on', 'SubModules.name', 'Pages.id', 'Pages.name', 'Pages.modified_on'
|
||||||
|
],
|
||||||
|
'order' => [
|
||||||
|
'Pages.created_on' => 'desc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
}
|
||||||
|
|
||||||
|
$pages = $this->Pages->find('all')->where([
|
||||||
|
'Pages.name LIKE' => '%' . $search . '%'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('pages', $this->paginate($pages));
|
||||||
|
$this->set('_serialize', ['pages']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bulkAction()
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$selectedPages = $this->request->data('selected_content');
|
||||||
|
$bulkAction = $this->request->data('bulk_action');
|
||||||
|
if ($bulkAction == BULK_ACTION_DELETE) {
|
||||||
|
if ($selectedPages == "") return $this->redirect(['action' => 'index']);
|
||||||
|
$pagesToBeDeleted = explode(',', $selectedPages);
|
||||||
|
$error = $this->deleteAll($pagesToBeDeleted);
|
||||||
|
if (!$error) {
|
||||||
|
$this->Flash->success(__('All the selected Pages have been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteAll($pages)
|
||||||
|
{
|
||||||
|
foreach ($pages as &$pagesWithIdPrefix) {
|
||||||
|
$pagesId = str_replace('content_', '', $pagesWithIdPrefix);
|
||||||
|
$page = $this->Pages->get($pagesId);
|
||||||
|
$this->Pages->delete($page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Page id.
|
||||||
|
* @return void
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$page = $this->Pages->get($id, [
|
||||||
|
'contain' => ['SubModules']
|
||||||
|
]);
|
||||||
|
$this->set('page', $page);
|
||||||
|
$this->set('_serialize', ['page']);
|
||||||
|
$this->viewBuilder()->layout("master_data");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$page = $this->Pages->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$page = $this->Pages->patchEntity($page, $this->request->data);
|
||||||
|
$pageErrors = $this->checkAndDisplayEntityErrors($page);
|
||||||
|
if (!$pageErrors) {
|
||||||
|
if ($this->Pages->save($page)) {
|
||||||
|
$this->Flash->success(__('The page has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The page could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$ModulesTable = TableRegistry::get('modules');
|
||||||
|
$modules = $ModulesTable->find('list');
|
||||||
|
// $subModules = $this->Pages->SubModules->find('list', ['limit' => 200, 'contain' => ['Modules']]);
|
||||||
|
$this->set(compact('page', 'modules'));
|
||||||
|
$this->set('_serialize', ['page']);
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkAndDisplayEntityErrors($entity)
|
||||||
|
{
|
||||||
|
$entityErrors = $entity->errors();
|
||||||
|
foreach ($entityErrors as $key => $value) {
|
||||||
|
foreach ($entityErrors[$key] as $errorKey => $errorValue) {
|
||||||
|
$this->Flash->error($errorValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $entityErrors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubModulesByModule($moduleId)
|
||||||
|
{
|
||||||
|
$this->viewBuilder()->layout(false);
|
||||||
|
|
||||||
|
$SubModulesTable = TableRegistry::get('sub_modules');
|
||||||
|
$subModules = $SubModulesTable->find('list')
|
||||||
|
->where(['module_id' => $moduleId]);
|
||||||
|
|
||||||
|
$this->log($subModules->toArray());
|
||||||
|
// debug($subModules);
|
||||||
|
$jsonObject = [
|
||||||
|
'filtered_sub_modules' => $subModules
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode($jsonObject);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Page id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$page = $this->Pages->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
//pr($this->request->data);exit;
|
||||||
|
$page = $this->Pages->patchEntity($page, $this->request->data);
|
||||||
|
if (!array_key_exists('available_to_company', $this->request->data)) {
|
||||||
|
$page['available_to_company'] = false;
|
||||||
|
}
|
||||||
|
$page['modified_on'] = new DateTime();
|
||||||
|
$id = $this->request->params['pass'][0];
|
||||||
|
$query = $this->Pages->query();
|
||||||
|
$update = $query->update()
|
||||||
|
->set(['id' => $this->request->data['id'],'module_id'=>$this->request->data['module_id'],
|
||||||
|
'sub_module_id'=>$this->request->data['sub_module_id'],'name'=>$this->request->data['name'],
|
||||||
|
'method_name'=>$this->request->data['method_name']])
|
||||||
|
->where(['id' => $id])
|
||||||
|
->execute();
|
||||||
|
if ($update) {
|
||||||
|
$this->Flash->success(__('The page has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The page could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ModulesTable = TableRegistry::get('modules');
|
||||||
|
$modules = $ModulesTable->find('list');
|
||||||
|
$subModules = $this->Pages->SubModules->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('page', 'subModules','modules'));
|
||||||
|
$this->set('_serialize', ['page']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Page id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$page = $this->Pages->get($id);
|
||||||
|
if ($this->Pages->delete($page)) {
|
||||||
|
$this->Flash->success(__('The page has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The page could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
192
src/Controller/PersonalizesController.php
Normal file
192
src/Controller/PersonalizesController.php
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Common\Permission;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use SubModuleConstants;
|
||||||
|
use Cake\Cache\Cache;
|
||||||
|
/**
|
||||||
|
* Personalizes Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\PersonalizesTable $Personalizes
|
||||||
|
*
|
||||||
|
* @method \App\Model\Entity\Personalize[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||||
|
*/
|
||||||
|
class PersonalizesController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function initialize() {
|
||||||
|
parent::initialize();
|
||||||
|
I18n::locale('en_US');
|
||||||
|
|
||||||
|
$this->checkUser(); // is RTG User or not
|
||||||
|
|
||||||
|
$this->setUserType(); // Set CRM/CMS/Contacts user
|
||||||
|
|
||||||
|
if($this->Auth->user()){
|
||||||
|
$this->Auth->allow(['deletePersonalize']);
|
||||||
|
if(Permission::isEmployeeAsAdmin()){
|
||||||
|
$this->Auth->allow('index');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return \Cake\Http\Response|null
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
|
||||||
|
$member_id = $this->Auth->user('id');
|
||||||
|
$company_id = $this->Auth->user('company_id');
|
||||||
|
|
||||||
|
$step_name = 'is_personalized_domain';
|
||||||
|
|
||||||
|
if($this->request->is('post')){
|
||||||
|
$inputData = $this->request->getData();
|
||||||
|
$inputData['member_id'] = $member_id;
|
||||||
|
$inputData['company_id'] = $company_id;
|
||||||
|
$main_domain = "londonschooloflearninghub.org";
|
||||||
|
$domain = strtolower($inputData['domain']);
|
||||||
|
$domain = str_replace("www.", "", $domain);
|
||||||
|
if($domain == $main_domain){
|
||||||
|
$this->Flash->error(__('You cannot use '.$inputData['domain']." as domain."));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$inputData['domain'] = $domain;
|
||||||
|
$inputData['is_www'] = 2;
|
||||||
|
if(!empty($inputData['www'])){
|
||||||
|
$inputData['is_www'] = 1;
|
||||||
|
}
|
||||||
|
$result = $this->Personalizes->processPersonalize($inputData,true);
|
||||||
|
|
||||||
|
if(!empty($result)){
|
||||||
|
$this->request->session()->write('Auth.User.member_footer', $inputData['footer']);
|
||||||
|
$_SESSION['personalize'] = $inputData;
|
||||||
|
$this->uploadMemberLogo($inputData);
|
||||||
|
|
||||||
|
//add_log
|
||||||
|
$logData['action'] = "PERSONALIZES_ADD_EDIT";
|
||||||
|
$logData['status'] = "success";
|
||||||
|
$logData['input_data'] = $this->request->getData();
|
||||||
|
$logData['input_data']["id"]=$result->id;
|
||||||
|
unset($logData['input_data'][password]);
|
||||||
|
$this->appLog($logData);
|
||||||
|
|
||||||
|
$this->Flash->success(__('Information has been saved.'));
|
||||||
|
Cache::delete('personalizes');
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$personalize = $this->Personalizes->find()->where(['company_id'=>$company_id])->first();
|
||||||
|
// dd($personalize);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('personalize',$personalize);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('page_list', $this->getPages());
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '3214', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deletePersonalize(){
|
||||||
|
$member_id = $this->Auth->user('id');
|
||||||
|
if($this->Personalizes->deletePersonalizeByMemberId($member_id)){
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function uploadMemberLogo($request){
|
||||||
|
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
if(!empty($request['img_path']['name'])){
|
||||||
|
$id = $this->request->session()->read('Auth.User.id');
|
||||||
|
if(!empty($request['previous_img_path'])){
|
||||||
|
unlink(WWW_ROOT.'/'.$request['previous_img_path']);
|
||||||
|
}
|
||||||
|
if (!is_dir('media/companies/'.$id)) {
|
||||||
|
mkdir('media/companies/'.$id, 0777, true);
|
||||||
|
}
|
||||||
|
$imagedes = $this->request->webroot.'webroot/media/companies/'.$id;
|
||||||
|
//$imagepath = 'webroot/media/companies/'.$last_insert_id.'/'.$request['img_path']['name'];
|
||||||
|
$imagepath = 'media/companies/'.$id.'/'.$request['img_path']['name'];
|
||||||
|
//echo $imagepath;exit;
|
||||||
|
$file = $request['img_path']; //put the data into a var for easy use
|
||||||
|
|
||||||
|
$ext = substr(strtolower(strrchr($file['name'], '.')), 1); //get the extension
|
||||||
|
$arr_ext = array('jpg', 'jpeg', 'gif', 'png'); //set allowed extensions
|
||||||
|
|
||||||
|
//only process if the extension is valid
|
||||||
|
if (in_array($ext, $arr_ext)) {
|
||||||
|
//do the actual uploading of the file. First arg is the tmp name, second arg is
|
||||||
|
//where we are putting it
|
||||||
|
move_uploaded_file($_FILES["img_path"]["tmp_name"],WWW_ROOT.'media/companies/'.$id.'/'. basename($_FILES['img_path']['name']));
|
||||||
|
} else{
|
||||||
|
$this->Flash->error(__('Profile Picture is not in right format.Please, try again.'));
|
||||||
|
return $this->redirect(['action' => 'edit']);
|
||||||
|
}
|
||||||
|
$request['img_path'] = $imagepath;
|
||||||
|
$this->request->session()->write('Auth.User.img_path', $imagepath);
|
||||||
|
} else{
|
||||||
|
$request['img_path'] = $request['previous_img_path'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($request['logo']['name'])){
|
||||||
|
if(!is_dir('cmsuser_logo')){
|
||||||
|
mkdir('cmsuser_logo',0777,true);
|
||||||
|
}
|
||||||
|
$insertedId = $this->Auth->user('id');
|
||||||
|
$logofile = $request['logo'];
|
||||||
|
$ext = substr(strtolower(strrchr($logofile['name'], '.')),1);
|
||||||
|
$logoname = explode('.',$logofile['name'])[0];
|
||||||
|
$newname = $logoname."_".$insertedId.".".$ext;
|
||||||
|
$request['logo'] = $newname;
|
||||||
|
@unlink(CMSUSER_LOGO.$request['previous_logo']);
|
||||||
|
$this->uploadlogo($newname, $ext);
|
||||||
|
}else{
|
||||||
|
$request['logo'] = $request['previous_logo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$cmsuser = $this->Cmsusers->get($this->Auth->user('id'));
|
||||||
|
$cmsuser->logo = $request['logo'];
|
||||||
|
|
||||||
|
//$cmsuser = $this->Cmsusers->patchEntity($cmsuser, $request);
|
||||||
|
|
||||||
|
// pr($cmsuser);exit;
|
||||||
|
if ($this->Cmsusers->save($cmsuser)) {
|
||||||
|
$this->request->session()->write('Auth.User.logo', $request['logo']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Profile could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function uploadlogo($newname ,$ext){
|
||||||
|
//get the extension
|
||||||
|
$arr_ext = array('jpg', 'jpeg', 'png'); //set allowed extensions
|
||||||
|
|
||||||
|
|
||||||
|
if (in_array($ext, $arr_ext)) {
|
||||||
|
//do the actual uploading of the file. First arg is the tmp name, second arg is
|
||||||
|
//where we are putting it
|
||||||
|
move_uploaded_file($_FILES["logo"]["tmp_name"],WWW_ROOT.'cmsuser_logo/'. $newname);
|
||||||
|
} else{
|
||||||
|
$this->Flash->error(__('Profile Picture is not in right format.Please, try again.'));
|
||||||
|
return $this->redirect($this->referer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
106
src/Controller/PortalController.php
Normal file
106
src/Controller/PortalController.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Utility\PdfWriter;
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
use Cake\I18n\FrozenDate;
|
||||||
|
use Cake\View\View;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Student Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\StudentsTable $Students
|
||||||
|
* @property \App\Model\Table\StudentSessionsTable $StudentSessions
|
||||||
|
* @property \App\Model\Table\StudentCoursesTable $StudentCourses
|
||||||
|
* @property \App\Model\Table\CoursesTable $Courses
|
||||||
|
* @property \App\Model\Table\SessionsTable $Sessions
|
||||||
|
* @property \App\Model\Table\RegistrationPaymentsTable $RegistrationPayments
|
||||||
|
* @property \App\Model\Table\PassportDetailsTable $PassportDetails
|
||||||
|
|
||||||
|
*/
|
||||||
|
class PortalController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('Students');
|
||||||
|
$this->loadModel('StudentSessions');
|
||||||
|
$this->loadModel('StudentCourses');
|
||||||
|
$this->loadModel('Courses');
|
||||||
|
$this->loadModel('Sessions');
|
||||||
|
$this->loadModel('RegistrationPayments');
|
||||||
|
$this->loadModel('PassportDetails');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$id = $this->Auth->user('crm_contact_user_id');
|
||||||
|
|
||||||
|
$student = $this->Students->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$student_session = $this->StudentSessions->find()
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
$student_course = $this->StudentCourses->find()
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$sessions = $this->Sessions->find()
|
||||||
|
->where(['id' => $student_session['session_id']])
|
||||||
|
->first();
|
||||||
|
$courses = $this->Courses->find()
|
||||||
|
->where(['id' => $student_course['course_id']])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$this->set(compact('sessions','courses','student_session','student_course'));
|
||||||
|
$this->set('student', $student);
|
||||||
|
$this->set('_serialize', ['student']);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('languages', $this->languages);
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function view($id=null)
|
||||||
|
{
|
||||||
|
$student = $this->Students->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$student_session = $this->StudentSessions->find()
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
$student_course = $this->StudentCourses->find()
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$sessions = $this->Sessions->find()
|
||||||
|
->where(['id' => $student_session['session_id']])
|
||||||
|
->first();
|
||||||
|
$courses = $this->Courses->find()
|
||||||
|
->where(['id' => $student_course['course_id']])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$this->set(compact('sessions','courses','student_session','student_course'));
|
||||||
|
$this->set('student', $student);
|
||||||
|
$this->set('_serialize', ['student']);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('languages', $this->languages);
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
127
src/Controller/QualificationTypesController.php
Normal file
127
src/Controller/QualificationTypesController.php
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QualificationType Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\QualificationTypesTable $QualificationTypes
|
||||||
|
*/
|
||||||
|
class QualificationTypesController extends AppsController
|
||||||
|
{
|
||||||
|
private $controller = "qualification-types";
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('QualificationTypes');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'id' => 'ASC'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(name LIKE ' . "'%" . $search . "%' "
|
||||||
|
. "OR description LIKE '%" . $search . "%'" .')' ;
|
||||||
|
}
|
||||||
|
$qualification_types = $this->QualificationTypes->find('all')->where($condition);
|
||||||
|
|
||||||
|
$this->set('qualification_types', $this->paginate($qualification_types));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '10178', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$qualification_type = $this->QualificationTypes->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['created_by'] = $user_id;
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['updated_by'] = $user_id;
|
||||||
|
$qualification_type = $this->QualificationTypes->patchEntity($qualification_type, $request);
|
||||||
|
$errors = $qualification_type->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->QualificationTypes->save($qualification_type)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The QualificationTypes has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the QualificationTypes.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$qualification_type = $this->QualificationTypes->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$qualification_type = $this->QualificationTypes->patchEntity($qualification_type, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $qualification_type->errors();
|
||||||
|
|
||||||
|
$qualification_type['updated_at'] = FrozenTime::now();
|
||||||
|
$qualification_type['updated_by'] = $user_id;
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->QualificationTypes->save($qualification_type)) {
|
||||||
|
$this->Flash->success(__('The report format type has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The report format type could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('qualification_type', $qualification_type);
|
||||||
|
$this->set('_serialize', ['qualification_type']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$qualification_type = $this->QualificationTypes->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('qualification_type', $qualification_type);
|
||||||
|
$this->set('_serialize', ['qualification_type']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10177', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
598
src/Controller/RegistrationsController.php
Normal file
598
src/Controller/RegistrationsController.php
Normal file
@@ -0,0 +1,598 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\Routing\Router;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use Cake\Validation\Validator;
|
||||||
|
use DateTime;
|
||||||
|
use Mandrill;
|
||||||
|
use Stripe;
|
||||||
|
/**
|
||||||
|
* Cmsusers Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\CmsusersTable $Cmsusers
|
||||||
|
*/
|
||||||
|
class RegistrationsController extends AppsController {
|
||||||
|
|
||||||
|
public function initialize() {
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
$this->loadModel('Usergroups');
|
||||||
|
I18n::locale('en_US');
|
||||||
|
// $this->Auth->allow(['forgotPassword']);
|
||||||
|
// $this->Auth->allow(['resetPassword']);
|
||||||
|
// $this->Auth->allow(['termsService']);
|
||||||
|
// $this->Auth->allow(['fbLogin']);
|
||||||
|
// $this->Auth->allow(['fbLoginRegister']);
|
||||||
|
// $this->Auth->allow(['checkArtistRegistered']);
|
||||||
|
// $this->Auth->allow(['uploadPicture']);
|
||||||
|
// $this->Auth->allow(['removeMedia']);
|
||||||
|
// $this->Auth->allow(['uploadArtistPicture']);
|
||||||
|
// $this->Auth->allow(['removeArtistMedia']);
|
||||||
|
// $this->Auth->allow(['emailSent']);
|
||||||
|
// $this->Auth->allow(['changeLanguage']);
|
||||||
|
$this->Auth->allow(['guest']);
|
||||||
|
$this->Auth->allow(['checkemail']);
|
||||||
|
$this->Auth->allow(['stripeCreateCharge']);
|
||||||
|
$this->Auth->allow(['terms']);
|
||||||
|
$this->Auth->allow(['testSQL']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user) {
|
||||||
|
$request_action = $this->request->params['action'];
|
||||||
|
if ($request_action == "logout" || $request_action == "login" || $request_action == "bulkAction" || $request_action == "terms" || $request_action == "editProfile" || $request_action == "guest") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
// return parent::isAuthorized($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testSQL(){
|
||||||
|
|
||||||
|
\Stripe\Stripe::setApiKey(APP_STRIPE_SECRET_KEY);
|
||||||
|
|
||||||
|
$successfulCharge = false;
|
||||||
|
|
||||||
|
$stripe = "cus_BNJ6lKuVhSNM2N";
|
||||||
|
|
||||||
|
$chargeList = \Stripe\Charge::all(
|
||||||
|
array(
|
||||||
|
'limit' => 110, // in the first time, put 5 then 10, 15, 20 etc....till 50
|
||||||
|
'created' => array(
|
||||||
|
'gte' => strtotime('-4380 min'),
|
||||||
|
'lte' => strtotime('0 min')
|
||||||
|
),
|
||||||
|
"failure_code"=>null,
|
||||||
|
"customer" => $stripe
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($chargeList->data as $charge) {
|
||||||
|
// Do something with $subscription
|
||||||
|
|
||||||
|
if(empty($charge->failure_code)) {
|
||||||
|
|
||||||
|
$successfulCharge = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($successfulCharge);exit;
|
||||||
|
|
||||||
|
|
||||||
|
$this->loadModel('CmsuserUsergroups');
|
||||||
|
|
||||||
|
$availableCmsUserGroups = $this->CmsuserUsergroups->find('all',[
|
||||||
|
'conditions'=>[
|
||||||
|
'CmsuserUsergroups.cms_user_id'=>169,
|
||||||
|
'CmsuserUsergroups.usergroup_id'=>11
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($availableCmsUserGroups->toArray());
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
/* public function guest() {
|
||||||
|
// pr($this->request->data); die;
|
||||||
|
$cmsuser = $this->Cmsusers->newEntity();
|
||||||
|
if ($this->request->is('post'))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$cmsuser = $this->prepareCustomerObject($cmsuser);
|
||||||
|
$password = $this->request->data('password');
|
||||||
|
|
||||||
|
$this->request->session()->write('Auth.GuestUser', $cmsuser);
|
||||||
|
$this->request->session()->write('Auth.GuestUserPass', $password);
|
||||||
|
|
||||||
|
|
||||||
|
// payment here
|
||||||
|
$payment_status = $this->paymentInStrip($cmsuser);
|
||||||
|
|
||||||
|
// save user after payment
|
||||||
|
if($payment_status == 'successed')
|
||||||
|
{
|
||||||
|
$cmsuser = $this->request->session()->read('Auth.GuestUser');
|
||||||
|
$new_password = $this->request->session()->read('Auth.GuestUserPass');
|
||||||
|
$cmsuser->current_plan_id = $this->request->session()->read('Auth.plan_id');
|
||||||
|
$cmsuser->stripe_customer_id = $this->request->session()->read('Auth.stripe_customer_id');
|
||||||
|
|
||||||
|
$this->request->session()->delete("Auth.GuestUser");
|
||||||
|
$this->request->session()->delete("Auth.GuestUserPass");
|
||||||
|
$this->request->session()->delete("Auth.stripe_customer_id");
|
||||||
|
$this->request->session()->delete("Auth.plan_id");
|
||||||
|
// pr($cmsuser);
|
||||||
|
unset($cmsuser->token_no);
|
||||||
|
unset($cmsuser->retype_password);
|
||||||
|
// pr($cmsuser);die;
|
||||||
|
|
||||||
|
if ($this->Cmsusers->save($cmsuser)) {
|
||||||
|
|
||||||
|
// add User To User Group
|
||||||
|
$this->addUserToUserGroup($cmsuser->id, USER_GROUP_ID);
|
||||||
|
// add User To Default Packages
|
||||||
|
$this->addUserToPackages($user_id = $cmsuser->id, $package_id = PACKAGE_ID);
|
||||||
|
|
||||||
|
$this->Flash->success(__('The Guest User has been created.'));
|
||||||
|
|
||||||
|
// $template_content = array(
|
||||||
|
// array(
|
||||||
|
// 'name' => 'firstname',
|
||||||
|
// 'content' => $cmsuser->username
|
||||||
|
// ),
|
||||||
|
// array(
|
||||||
|
// 'name' => 'user_email',
|
||||||
|
// 'content' => $cmsuser->email
|
||||||
|
// ),
|
||||||
|
// array(
|
||||||
|
// 'name' => 'password',
|
||||||
|
// 'content' => $new_password
|
||||||
|
// ),
|
||||||
|
// array(
|
||||||
|
// 'name' => 'loginurl',
|
||||||
|
// 'content' => APP_SERVER_HOST_URL
|
||||||
|
// ));
|
||||||
|
$template_content = array(
|
||||||
|
'firstname' => $cmsuser->username,
|
||||||
|
'user_email'=> $cmsuser->email,
|
||||||
|
'password' => $new_password,
|
||||||
|
'loginurl' => APP_SERVER_HOST_URL
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->sendEmail(MANDRILL_TEMPLATE_USER_CREATION, $template_content, $cmsuser->email);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'login']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The user could not be saved. Please, try again.'));
|
||||||
|
$this->log($cmsuser->errors());
|
||||||
|
pr($cmsuser->errors());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// $this->Flash->error(__('payment_status = '.$payment_status));
|
||||||
|
$this->Flash->error(__('The user could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// $languages = [LANGUAGE_CODE_ENGLISH => 'English', LANGUAGE_CODE_KOREAN => 'Korean'];
|
||||||
|
// $user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
// $this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('cmsuser', $cmsuser);
|
||||||
|
// $this->set('languages', $languages);
|
||||||
|
$this->set('_serialize', ['cmsuser']);
|
||||||
|
// $this->set('current_module', $this->getModules());
|
||||||
|
$nav_arr[0] = array('action'=>'index','page_id'=>'3045','icon'=>'<i class="fa fa-list"></i>','label'=>'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout("before_login");
|
||||||
|
} */
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function checkSubscription(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$plan_id_array = $this->objectToArray(json_decode(RTG_PLAN_ID));
|
||||||
|
|
||||||
|
$total_record_processed = 0;
|
||||||
|
|
||||||
|
foreach($plan_id_array as $index=>$stripePlanId){
|
||||||
|
|
||||||
|
\Stripe\Stripe::setApiKey(APP_STRIPE_SECRET_KEY);
|
||||||
|
|
||||||
|
$Subscriptions = \Stripe\Subscription::all(
|
||||||
|
array(
|
||||||
|
'limit' => 110, // in the first time, put 5 then 10, 15, 20 etc....till 50
|
||||||
|
'created' => array(
|
||||||
|
'gte' => strtotime('-25 min'),
|
||||||
|
'lte' => strtotime('0 min')
|
||||||
|
),
|
||||||
|
//'starting_after' => 'sub_BQdvHBBf8lfjsR',
|
||||||
|
"plan" => $stripePlanId
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($Subscriptions->data as $subscription) {
|
||||||
|
// Do something with $subscription
|
||||||
|
//$subscription->id
|
||||||
|
|
||||||
|
$customerObj = \Stripe\Customer::retrieve($subscription->customer);
|
||||||
|
$customer = $customerObj->__toArray(true);
|
||||||
|
//$customer = $customerArray['sources']['data'][0];
|
||||||
|
$cmsuser = [];
|
||||||
|
$isRecordExist = $this->checkemail($customer['email']);
|
||||||
|
if(!$isRecordExist){
|
||||||
|
|
||||||
|
$total_record_processed++;
|
||||||
|
|
||||||
|
$cmsuser = $this->Cmsusers->newEntity();
|
||||||
|
$password = rand(100000,999999);
|
||||||
|
$cmsuser = $this->createUser($cmsuser,["email" => $customer['email'],
|
||||||
|
"password" => $password,
|
||||||
|
"address_zip" => "",
|
||||||
|
"stripe_customer_id" => $customer['id'],
|
||||||
|
"phone" => "",
|
||||||
|
"cardholder_name" => "",
|
||||||
|
"permission_version" => "1",
|
||||||
|
"ip" => "",
|
||||||
|
"is_first_login" => "1",
|
||||||
|
"package_id" => "2",
|
||||||
|
"img_path" => "",
|
||||||
|
"username" => $customer['email'],
|
||||||
|
"language" => "en",
|
||||||
|
"retype_password" => $password,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$customerName = explode("@",$customer['email']);
|
||||||
|
|
||||||
|
if ($this->Cmsusers->save($cmsuser)) {
|
||||||
|
|
||||||
|
// add User To User Group
|
||||||
|
$this->addUserToUserGroup($cmsuser->id, USER_GROUP_ID);
|
||||||
|
// add User To Default Packages
|
||||||
|
$this->addUserToPackages($cmsuser->id,PACKAGE_ID);
|
||||||
|
$this->addUserToPackages($cmsuser->id,PACKAGE_WAVE_1_ID);
|
||||||
|
|
||||||
|
$template_content = array(
|
||||||
|
'firstname' => $customerName[0],
|
||||||
|
'user_email'=> $customer['email'],
|
||||||
|
'password' => $password,
|
||||||
|
'loginurl' => APP_SERVER_HOST_URL
|
||||||
|
);
|
||||||
|
//echo "Going to send email to :::".$customer['email'];
|
||||||
|
$this->sendEmail(MANDRILL_TEMPLATE_USER_CREATION, $template_content, $cmsuser->email);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
// echo "::::::No data added----".$customer['email']."<br>\n";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//insert logs into process logs
|
||||||
|
|
||||||
|
|
||||||
|
//$total_record_processed
|
||||||
|
$this->saveLogs("REG",$total_record_processed);
|
||||||
|
echo "Customer process completed...";
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function saveLogs($process_name,$number_of_record_processed){
|
||||||
|
$logTable = TableRegistry::get("ProcessLogs");
|
||||||
|
$entity = $logTable->newEntity();
|
||||||
|
|
||||||
|
$entity->process_name = $process_name;
|
||||||
|
$entity->number_of_record_processed = $number_of_record_processed;
|
||||||
|
$entity->created_on = date('Y-m-d h:i:s');
|
||||||
|
|
||||||
|
$logTable->save($entity);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function objectToArray($d) {
|
||||||
|
if (is_object($d))
|
||||||
|
$d = get_object_vars($d);
|
||||||
|
return is_array($d) ? array_map(__METHOD__, $d) : $d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $cmsuser
|
||||||
|
* @return \Cake\Datasource\EntityInterface
|
||||||
|
*/
|
||||||
|
private function createUser($cmsuser,$data) {
|
||||||
|
$cmsuser = $this->Cmsusers->patchEntity($cmsuser, $data);
|
||||||
|
$cmsuser->reset_password_token = '';
|
||||||
|
$cmsuser->created_on = date('Y-m-d H:i:s'); // date('Y-m-d H:i:s', strtotime("-61 day")); //
|
||||||
|
$cmsuser->updated_on = date('Y-m-d H:i:s');
|
||||||
|
$cmsuser->status = STATUS_ACTIVE;
|
||||||
|
$cmsuser->company_id = 8;
|
||||||
|
return $cmsuser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* private function paymentInStrip($user)
|
||||||
|
{
|
||||||
|
require(ROOT.'/vendor/stripe/stripe-php/lib/Stripe.php');
|
||||||
|
// payment code is here
|
||||||
|
$stripe_customer_id = '';
|
||||||
|
$customerObj = $this->stripeCreateCustomer($user->email,$user->token_no);
|
||||||
|
if(!empty($customerObj)){
|
||||||
|
$stripe_customer_id = $customerObj['id'];
|
||||||
|
}
|
||||||
|
$this->request->session()->write('Auth.stripe_customer_id', $stripe_customer_id);
|
||||||
|
|
||||||
|
if(!empty($stripe_customer_id)){
|
||||||
|
// $cardObj = $this->stripeCreateCard($stripe_customer_id);
|
||||||
|
|
||||||
|
$defaultPlan = $this->getDefaultPlan();
|
||||||
|
$plan_id = '';
|
||||||
|
$plan_price = 0;
|
||||||
|
if(!empty($defaultPlan)){
|
||||||
|
$plan_id = $defaultPlan->stripe_plan_id;
|
||||||
|
$plan_price = $defaultPlan->price;
|
||||||
|
}
|
||||||
|
$subscriptionObj = [];
|
||||||
|
if(!empty($stripe_customer_id) && !empty($plan_id)){
|
||||||
|
$subscriptionObj = $this->stripeCreateSubscription($stripe_customer_id, $plan_id);
|
||||||
|
|
||||||
|
$this->request->session()->write('Auth.plan_id', $plan_id);
|
||||||
|
|
||||||
|
$chargeObj = [];
|
||||||
|
|
||||||
|
// if(!empty($user->token_no)){
|
||||||
|
// $chargeObj = $this->stripeCreateCharge($plan_price, $stripe_customer_id);
|
||||||
|
// }
|
||||||
|
// if(!empty($chargeObj)) {
|
||||||
|
if(!empty($subscriptionObj)) {
|
||||||
|
// return true;
|
||||||
|
$code = 'successed';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$code = 'failed';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$code = 'failed';
|
||||||
|
}
|
||||||
|
// payment status is success
|
||||||
|
|
||||||
|
return $code;
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* public function stripeCreateCustomer($email = null, $token_no = null)
|
||||||
|
{
|
||||||
|
//Create a new customer and card information
|
||||||
|
Stripe\Stripe::setApiKey(APP_STRIPE_SECRET_KEY);
|
||||||
|
|
||||||
|
$customerObj = \Stripe\Customer::create(array(
|
||||||
|
"description" => "Customer for RTG",
|
||||||
|
"source" => $token_no,
|
||||||
|
"email" => $email,
|
||||||
|
// obtained with Stripe.js
|
||||||
|
));
|
||||||
|
// pr($customerObj['id']);
|
||||||
|
// pr($customerObj);
|
||||||
|
// exit;
|
||||||
|
return $customerObj;
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* public function stripeCreateCard($customer_id = null)
|
||||||
|
{
|
||||||
|
//Create a new card information
|
||||||
|
Stripe\Stripe::setApiKey(APP_STRIPE_SECRET_KEY);
|
||||||
|
|
||||||
|
$customer = \Stripe\Customer::retrieve($customer_id);
|
||||||
|
$cardObj = $customer->sources->create(array("source" => "tok_visa"));
|
||||||
|
|
||||||
|
return $cardObj;
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* public function stripeCreateSubscription($customer_id = null, $plan_id = null)
|
||||||
|
{
|
||||||
|
//Create a new Subscription
|
||||||
|
\Stripe\Stripe::setApiKey(APP_STRIPE_SECRET_KEY);
|
||||||
|
|
||||||
|
$subscriptionObj = \Stripe\Subscription::create(array(
|
||||||
|
"customer" => $customer_id,
|
||||||
|
"items" => array(
|
||||||
|
array(
|
||||||
|
"plan" => $plan_id,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
return $subscriptionObj;
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* public function stripeCreateCharge($price = 0, $stripe_customer_id = '',$package_id="")
|
||||||
|
{
|
||||||
|
//Create a new charge
|
||||||
|
\Stripe\Stripe::setApiKey(APP_STRIPE_SECRET_KEY);
|
||||||
|
|
||||||
|
// $chargeObj = \Stripe\Charge::create(array(
|
||||||
|
// "amount" => intval($price),
|
||||||
|
// "currency" => "usd",
|
||||||
|
// // "source" => $token_no, // obtained with Stripe.js
|
||||||
|
// "description" => "Charge for RTG Member"
|
||||||
|
// ));
|
||||||
|
|
||||||
|
|
||||||
|
$chargeObj = \Stripe\Charge::create(array(
|
||||||
|
"amount" => ($price*100), // amount in cents, again
|
||||||
|
"currency" => "usd",
|
||||||
|
"customer" => $stripe_customer_id,
|
||||||
|
"description" => "Charge for RTG package ID#".$package_id)
|
||||||
|
);
|
||||||
|
return $chargeObj;
|
||||||
|
} */
|
||||||
|
|
||||||
|
/* private function getDefaultPlan()
|
||||||
|
{
|
||||||
|
$defaultPlan = [];
|
||||||
|
$table_plan = TableRegistry::get("Plans");
|
||||||
|
$defaultPlan = $table_plan->find('all')
|
||||||
|
->select(['name','price','stripe_plan_id','is_default_plan'])
|
||||||
|
->where(['Plans.is_default_plan'=>1])
|
||||||
|
->first();
|
||||||
|
return $defaultPlan;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function addUserToUserGroup($user_id, $usergroup_id)
|
||||||
|
{
|
||||||
|
$table_user_groups_user = TableRegistry::get("CmsuserUsergroups");
|
||||||
|
$entity = $table_user_groups_user->newEntity();
|
||||||
|
$entity->cms_user_id = $user_id;
|
||||||
|
$entity->usergroup_id = $usergroup_id;
|
||||||
|
if($table_user_groups_user->save($entity)){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addUserToPackages($user_id, $package_id)
|
||||||
|
{
|
||||||
|
$table_member_packages = TableRegistry::get("MemberPackages");
|
||||||
|
$entity = $table_member_packages->newEntity();
|
||||||
|
$entity->member_id = $user_id;
|
||||||
|
$entity->package_id = $package_id;
|
||||||
|
$entity->status = 1;
|
||||||
|
$entity->created_on = date('Y-m-d h:i:s');
|
||||||
|
if($table_member_packages->save($entity)){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $cmsuser
|
||||||
|
* @return \Cake\Datasource\EntityInterface
|
||||||
|
*/
|
||||||
|
/* private function prepareCustomerObject($cmsuser) {
|
||||||
|
$cmsuser = $this->Cmsusers->patchEntity($cmsuser, $this->request->data);
|
||||||
|
$cmsuser->reset_password_token = '';
|
||||||
|
$cmsuser->created_on = date('Y-m-d H:i:s');
|
||||||
|
$cmsuser->updated_on = date('Y-m-d H:i:s');
|
||||||
|
$cmsuser->status = STATUS_ACTIVE;
|
||||||
|
$cmsuser->company_id = COMPANY_ID; //$this->Auth->user('company_id');
|
||||||
|
// $cmsuser->current_plan_id = PACKAGE_ID;
|
||||||
|
return $cmsuser;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public function terms()
|
||||||
|
{
|
||||||
|
$session = $this->request->session();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
if($this->request->data['terms'] == 1){
|
||||||
|
|
||||||
|
//TODO - Change the logic of saving the user permissions
|
||||||
|
// $previous_permission_version= $session->read('permission_version');
|
||||||
|
// $user= $session->read('Auth.User');
|
||||||
|
// $current_permission_version=TableRegistry::get('cmsusers')->get($user['id'])->permission_version;
|
||||||
|
// if($current_permission_version!==$previous_permission_version){
|
||||||
|
// $this->addPermissionsAndVersionToSession($session, $user,$current_permission_version);
|
||||||
|
// }
|
||||||
|
|
||||||
|
$user = $this->Auth->user();
|
||||||
|
|
||||||
|
//change first time login
|
||||||
|
if(!empty($user)){
|
||||||
|
$CmsusersTable = TableRegistry::get('Cmsusers');
|
||||||
|
$CmsusersObj = $CmsusersTable->newEntity();
|
||||||
|
// $CmsusersObj = $CmsusersTable->get();
|
||||||
|
// pr($CmsusersObj);exit;
|
||||||
|
if($_SESSION['userType']==4){
|
||||||
|
$user_id_or_cms_user_id = $user["user_id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_SESSION['userType']==1){
|
||||||
|
$user_id_or_cms_user_id = $user["id"];
|
||||||
|
}
|
||||||
|
$CmsusersObj->id = $user_id_or_cms_user_id;
|
||||||
|
$CmsusersObj->is_first_login = 2;
|
||||||
|
$user["is_first_login"] = $CmsusersObj->is_first_login;
|
||||||
|
if($user["is_trial_user"] == 1){
|
||||||
|
$this->loadModel('App');
|
||||||
|
$CmsusersObj->created_on = $this->App->getSystemCurrentTimeStamp();
|
||||||
|
}
|
||||||
|
$CmsusersTable->save($CmsusersObj);
|
||||||
|
|
||||||
|
$this->Auth->setUser($user);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$user_permissions= $session->read('prev_user_permissions');
|
||||||
|
// $session->delete("prev_user_permissions");
|
||||||
|
$session->write('user_permissions', $user_permissions);
|
||||||
|
if($_SESSION['userType']==4){
|
||||||
|
$redirectController = $_SESSION['access_controller'][0]['controller_name'];
|
||||||
|
$this->redirect(['controller' =>$redirectController,'action' => 'index']);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->redirect(['controller' =>'Dashboard','action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$prev_user_permissions= $session->read('user_permissions');
|
||||||
|
$session->write('prev_user_permissions', $prev_user_permissions);
|
||||||
|
// $session->delete("user_permissions");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->viewBuilder()->layout("before_login");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkemail($email)
|
||||||
|
{
|
||||||
|
// $defaultCmsusers = [];
|
||||||
|
// $email = $this->request->data['email'];
|
||||||
|
$result = false;
|
||||||
|
|
||||||
|
$table_Cmsusers = TableRegistry::get("Cmsusers");
|
||||||
|
$defaultCmsusers = $table_Cmsusers->find('all')
|
||||||
|
->select(['id','email'])
|
||||||
|
->where(['Cmsusers.email'=>$email])
|
||||||
|
->first();
|
||||||
|
// return $defaultCmsusers;
|
||||||
|
if(!empty($defaultCmsusers)){
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
/* else {
|
||||||
|
$txt = 'Email is exist. Please change your email.';
|
||||||
|
}
|
||||||
|
$txtJson = json_encode($txt);
|
||||||
|
$this->response->type('json');
|
||||||
|
$this->response->body($txtJson);
|
||||||
|
return $this->response; */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
168
src/Controller/ReportFormatController.php
Normal file
168
src/Controller/ReportFormatController.php
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
use Cake\View\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReportFormat Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\ReportFormatsTable $ReportFormats
|
||||||
|
* @property \App\Model\Table\ReportFormatTypesTable $ReportFormatTypes
|
||||||
|
* @property \App\Model\Table\ReportFormatVariablesTable $ReportFormatVariables
|
||||||
|
*/
|
||||||
|
class ReportFormatController extends AppsController
|
||||||
|
{
|
||||||
|
private $controller = "report-format";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('ReportFormats');
|
||||||
|
$this->loadModel('ReportFormatTypes');
|
||||||
|
$this->loadModel('ReportFormatVariables');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'ReportFormats.id' => 'asc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(name LIKE ' . "'%" . $search . "%'" .')' ;
|
||||||
|
}
|
||||||
|
$report_formats = $this->ReportFormats->find('all')->where($condition);
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('report_formats', $this->paginate($report_formats));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '10139', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$report_format_types = $this->ReportFormatTypes->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$report_format = $this->ReportFormats->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['created_by'] = $user_id;
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['updated_by'] = $user_id;
|
||||||
|
$report_format = $this->ReportFormats->patchEntity($report_format, $request);
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormats->save($report_format)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The ReportFormat has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the ReportFormat.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set(compact('report_format_types'));
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$report_format = $this->ReportFormats->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_format_types = $this->ReportFormatTypes->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
$report_format_variables = $this->ReportFormatVariables->find('all')->where(['report_format_id'=>$id]);
|
||||||
|
//dd($report_format['content']);
|
||||||
|
if($report_format->report_format_type_id == 4 && empty($report_format['content'])){
|
||||||
|
$report_format['content'] = $this->visaLetterTemplate("sfsfsf");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$report_format = $this->ReportFormats->patchEntity($report_format, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
|
||||||
|
$report_format['updated_at'] = FrozenTime::now();
|
||||||
|
$report_format['updated_by'] = $user_id;
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormats->save($report_format)) {
|
||||||
|
$this->Flash->success(__('The report format type has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The report format type could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('report_format', $report_format);
|
||||||
|
$this->set('report_format_types', $report_format_types);
|
||||||
|
$this->set('report_format_variables', $report_format_variables);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$report_format = $this->ReportFormats->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_format_type = $this->ReportFormatTypes->get($report_format['report_format_type_id'], [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('report_format', $report_format);
|
||||||
|
$this->set('report_format_type', $report_format_type);
|
||||||
|
|
||||||
|
$this->set([
|
||||||
|
'response' => $report_format,
|
||||||
|
'_serialize' => ['response']
|
||||||
|
]);
|
||||||
|
$this->setNextPage();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function visaLetterTemplate($content)
|
||||||
|
{
|
||||||
|
$view = new View($this->request, $this->response);
|
||||||
|
return $view->element('letter_templates/visa_letter_template', compact('content'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10136', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
137
src/Controller/ReportFormatGenerationHistoryController.php
Normal file
137
src/Controller/ReportFormatGenerationHistoryController.php
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReportFormatGenerationHistory Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\ReportFormatGenerationHistoriesTable $ReportFormatGenerationHistories
|
||||||
|
* @property \App\Model\Table\ReportFormatsTable $ReportFormats
|
||||||
|
*/
|
||||||
|
class ReportFormatGenerationHistoryController extends AppsController
|
||||||
|
{
|
||||||
|
private $controller = "report-format-generation-history";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('ReportFormatGenerationHistories');
|
||||||
|
$this->loadModel('ReportFormats');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'ReportFormatGenerationHistories.id' => 'ASC'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
$report_format_histories = $this->ReportFormatGenerationHistories->find('all');
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('report_format_histories', $this->paginate($report_format_histories));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$report_formats = $this->ReportFormats->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$report_format = $this->ReportFormatGenerationHistories->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['created_by_id'] = $user_id;
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['updated_by_id'] = $user_id;
|
||||||
|
$report_format = $this->ReportFormatGenerationHistories->patchEntity($report_format, $request);
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormatGenerationHistories->save($report_format)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The ReportFormatGenerationHistory has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the ReportFormatGenerationHistory.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set(compact('report_formats'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$report_format_generation_history = $this->ReportFormatGenerationHistories->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_format = $this->ReportFormats->get($report_format_generation_history['report_format_id'], [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_formats = $this->ReportFormats->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$report_format = $this->ReportFormatGenerationHistories->patchEntity($report_format_generation_history, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
|
||||||
|
$report_format['updated_at'] = FrozenTime::now();
|
||||||
|
$report_format['updated_by'] = $user_id;
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormatGenerationHistories->save($report_format)) {
|
||||||
|
$this->Flash->success(__('The report format generation history has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The report format type could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('report_format_generation_history', $report_format_generation_history);
|
||||||
|
$this->set('report_formats', $report_formats);
|
||||||
|
$this->set('report_format', $report_format);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$report_format_generation_history = $this->ReportFormatGenerationHistories->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_format = $this->ReportFormats->get($report_format_generation_history['report_format_id'], [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('report_format_generation_history', $report_format_generation_history);
|
||||||
|
$this->set('report_format', $report_format);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
127
src/Controller/ReportFormatTypeController.php
Normal file
127
src/Controller/ReportFormatTypeController.php
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReportFormatType Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\ReportFormatTypesTable $ReportFormatTypes
|
||||||
|
*/
|
||||||
|
class ReportFormatTypeController extends AppsController
|
||||||
|
{
|
||||||
|
private $controller = "report-format-type";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('ReportFormatTypes');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'id' => 'ASC'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(name LIKE ' . "'%" . $search . "%' "
|
||||||
|
. "OR description LIKE '%" . $search . "%'" .')' ;
|
||||||
|
}
|
||||||
|
$ReportFormatTypes = $this->ReportFormatTypes->find('all')->where($condition);
|
||||||
|
|
||||||
|
$this->set('ReportFormatTypes', $this->paginate($ReportFormatTypes));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '10133', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$ReportFormatType = $this->ReportFormatTypes->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['created_by'] = $user_id;
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['updated_by'] = $user_id;
|
||||||
|
$ReportFormatType = $this->ReportFormatTypes->patchEntity($ReportFormatType, $request);
|
||||||
|
$errors = $ReportFormatType->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormatTypes->save($ReportFormatType)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The ReportFormatTypes has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the ReportFormatTypes.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$report_format_type = $this->ReportFormatTypes->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$report_format_type = $this->ReportFormatTypes->patchEntity($report_format_type, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $report_format_type->errors();
|
||||||
|
|
||||||
|
$report_format_type['updated_at'] = FrozenTime::now();
|
||||||
|
$report_format_type['updated_by'] = $user_id;
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormatTypes->save($report_format_type)) {
|
||||||
|
$this->Flash->success(__('The report format type has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The report format type could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('report_format_type', $report_format_type);
|
||||||
|
$this->set('_serialize', ['report_format_type']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$report_format_type = $this->ReportFormatTypes->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('report_format_type', $report_format_type);
|
||||||
|
$this->set('_serialize', ['report_format_type']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10130', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
172
src/Controller/ReportFormatVariableController.php
Normal file
172
src/Controller/ReportFormatVariableController.php
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReportFormatVariable Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\ReportFormatVariablesTable $ReportFormatVariables
|
||||||
|
* @property \App\Model\Table\ReportFormatsTable $ReportFormats
|
||||||
|
*/
|
||||||
|
class ReportFormatVariableController extends AppsController
|
||||||
|
{
|
||||||
|
private $controller = "report-format-variable";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('ReportFormatVariables');
|
||||||
|
$this->loadModel('ReportFormats');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'ReportFormatVariables.id' => 'ASC'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(variable_name LIKE ' . "'%" . $search . "%' "
|
||||||
|
. "OR data_type LIKE '%" . $search . "%' OR table_name LIKE '%" . $search . "%' OR column_name LIKE '%" . $search . "%'" .')' ;
|
||||||
|
}
|
||||||
|
$report_format_variables = $this->ReportFormatVariables->find('all', [
|
||||||
|
'contain' => ['ReportFormats']
|
||||||
|
])->where($condition);
|
||||||
|
|
||||||
|
// dd($report_format_variables->sql());
|
||||||
|
|
||||||
|
$this->set('report_format_variables', $this->paginate($report_format_variables));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '10146', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add($id=null)
|
||||||
|
{
|
||||||
|
$report_formats = $this->ReportFormats->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
$variable_list = [];
|
||||||
|
if($id != null){
|
||||||
|
$variable_list = $this->getSchemaValue($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$report_format = $this->ReportFormatVariables->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['created_by_id'] = $user_id;
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['updated_by_id'] = $user_id;
|
||||||
|
$report_format = $this->ReportFormatVariables->patchEntity($report_format, $request);
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormatVariables->save($report_format)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The ReportFormatVariable has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the ReportFormatVariable.'));
|
||||||
|
}
|
||||||
|
$this->set([
|
||||||
|
'response' => $variable_list,
|
||||||
|
'_serialize' => ['response']
|
||||||
|
]);
|
||||||
|
$this->set(compact('report_formats','variable_list'));
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$report_format_variable = $this->ReportFormatVariables->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_formats = $this->ReportFormats->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$report_format = $this->ReportFormatVariables->patchEntity($report_format_variable, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
|
||||||
|
$report_format['updated_at'] = FrozenTime::now();
|
||||||
|
$report_format['updated_by'] = $user_id;
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormatVariables->save($report_format)) {
|
||||||
|
$this->Flash->success(__('The report format type has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The report format type could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('report_format_variable', $report_format_variable);
|
||||||
|
$this->set('report_formats', $report_formats);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$report_format_variable = $this->ReportFormatVariables->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_format = $this->ReportFormats->get($report_format_variable['report_format_id'], [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('report_format_variable', $report_format_variable);
|
||||||
|
$this->set('report_format', $report_format);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSchemaValue($table_name){
|
||||||
|
$this->loadModel($table_name);
|
||||||
|
$schema = $this->$table_name->getSchema();
|
||||||
|
$columns = $schema->columns();
|
||||||
|
$column_data = [];
|
||||||
|
foreach ($columns as $key => $value) {
|
||||||
|
if(!in_array($value,AVOID_FROM_REPORT)) {
|
||||||
|
$column_data[$value] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $column_data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10143', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
}
|
||||||
153
src/Controller/ReportFormatVariableValueController.php
Normal file
153
src/Controller/ReportFormatVariableValueController.php
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ReportFormatVariableValue Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\ReportFormatVariableValuesTable $ReportFormatVariableValues
|
||||||
|
* @property \App\Model\Table\ReportFormatVariablesTable $ReportFormatVariables
|
||||||
|
* @property \App\Model\Table\ReportFormatGenerationHistoriesTable $ReportFormatGenerationHistories
|
||||||
|
* @property \App\Model\Table\ReportFormatsTable $ReportFormats
|
||||||
|
*/
|
||||||
|
class ReportFormatVariableValueController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('ReportFormatVariableValues');
|
||||||
|
$this->loadModel('ReportFormatVariables');
|
||||||
|
$this->loadModel('ReportFormatGenerationHistories');
|
||||||
|
$this->loadModel('ReportFormats');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'ReportFormatVariableValues.id' => 'asc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
$report_format_variable_values = $this->ReportFormatVariableValues->find('all', [
|
||||||
|
'contain' => ['ReportFormats','ReportFormatVariables','ReportFormatGenerationHistories']]
|
||||||
|
);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('report_format_variable_values', $this->paginate($report_format_variable_values));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('page_list', $this->getPages());
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '3046', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$report_formats = $this->ReportFormats->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$report_format = $this->ReportFormatVariableValues->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['created_by_id'] = $user_id;
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['updated_by_id'] = $user_id;
|
||||||
|
$report_format = $this->ReportFormatVariableValues->patchEntity($report_format, $request);
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormatVariableValues->save($report_format)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The ReportFormatVariableValue has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
$this->Flash->error(__('Unable to add the ReportFormatVariableValue.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set(compact('report_formats'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$report_format_variable = $this->ReportFormatVariableValues->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_formats = $this->ReportFormats->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$report_format = $this->ReportFormatVariableValues->patchEntity($report_format_variable, $this->request->data);
|
||||||
|
|
||||||
|
$errors = $report_format->errors();
|
||||||
|
|
||||||
|
$report_format['updated_at'] = FrozenTime::now();
|
||||||
|
$report_format['updated_by'] = $user_id;
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->ReportFormatVariableValues->save($report_format)) {
|
||||||
|
$this->Flash->success(__('The report format type has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The report format type could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('report_format_variable', $report_format_variable);
|
||||||
|
$this->set('report_formats', $report_formats);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '3045', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id)
|
||||||
|
{
|
||||||
|
$report_format_variable = $this->ReportFormatVariableValues->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$report_format = $this->ReportFormats->get($report_format_variable['report_format_id'], [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('report_format_variable', $report_format_variable);
|
||||||
|
$this->set('report_format', $report_format);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('languages', $this->languages);
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
321
src/Controller/RolePagesAssociationController.php
Normal file
321
src/Controller/RolePagesAssociationController.php
Normal file
@@ -0,0 +1,321 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use ModuleConstants;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use PagesConstants;
|
||||||
|
use SubModuleConstants;
|
||||||
|
use Cake\Validation\Validator;
|
||||||
|
/**
|
||||||
|
* RolePagesAssociation Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\RolePagesAssociationTable $RolePagesAssociation
|
||||||
|
*/
|
||||||
|
class RolePagesAssociationController extends AppsController {
|
||||||
|
public function initialize() {
|
||||||
|
parent::initialize ();
|
||||||
|
$this->loadModel ( 'Roles' );
|
||||||
|
$this->loadModel ( 'Modules' );
|
||||||
|
$this->loadModel ( 'RolePages' );
|
||||||
|
I18n::locale ( 'en_US' );
|
||||||
|
}
|
||||||
|
public function isAuthorized($user) {
|
||||||
|
$request_action = $this->request->params ['action'];
|
||||||
|
if ($request_action == "getAssociatedPages" && $this->Auth->user ()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::isAuthorized ( $user );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
$userCompanyID = $this->Auth->user ( 'company_id' );
|
||||||
|
|
||||||
|
if ($this->Auth->user ( 'id' ) == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
$selected_pages = $this->Roles->find ( 'all' )->where ( [ ] );
|
||||||
|
} else {
|
||||||
|
$selected_pages = $this->Roles->find ( 'all' )->where ( [
|
||||||
|
'company_id' => $userCompanyID
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
$rolesArray = [ ];
|
||||||
|
foreach ( $selected_pages as $role ) {
|
||||||
|
$rolesArray [$role->id] = $role->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
// $companies_id = TableRegistry::get('companies')->find('all')
|
||||||
|
// ->select(['id'])
|
||||||
|
// ->where(['status' => 1, 'added_by' => SUPER_SUPER_ADMIN_ID])->toArray();
|
||||||
|
//
|
||||||
|
// foreach ($companies_id as $com_id)
|
||||||
|
// $companies[] = $com_id->id;
|
||||||
|
if ($this->Auth->user ( 'id' ) == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
$modules = $this->Modules->find ( 'all' )->contain ( [
|
||||||
|
'SubModules',
|
||||||
|
'SubModules.Pages'
|
||||||
|
] )->where ( [
|
||||||
|
'id NOT IN' => [
|
||||||
|
1001,
|
||||||
|
1002
|
||||||
|
]
|
||||||
|
] );
|
||||||
|
} else {
|
||||||
|
$modules = $this->Modules->find ( 'all' )->contain ( [
|
||||||
|
'SubModules',
|
||||||
|
'SubModules.Pages'
|
||||||
|
] )->where ( [
|
||||||
|
'id NOT IN' => [
|
||||||
|
1001,
|
||||||
|
1002,
|
||||||
|
1007
|
||||||
|
]
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->is ( 'post' )) {
|
||||||
|
//echo '<pre>';print_r($this->request->data());exit;
|
||||||
|
if(empty($this->request->data ['role'])){
|
||||||
|
$this->Flash->error ( __ ( 'The role can not be empty.' ) );
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$submittingChecked = $this->request->data('submittingcheck');
|
||||||
|
|
||||||
|
if($submittingChecked){
|
||||||
|
$submittingChecked = explode(',', $submittingChecked);
|
||||||
|
}else{
|
||||||
|
$submittingChecked = array();
|
||||||
|
}
|
||||||
|
//echo '<pre>';print_r($submittingChecked);exit;
|
||||||
|
$this->set ( 'submittingcheck', $submittingChecked);
|
||||||
|
|
||||||
|
$selected_pages = $this->request->data ( 'selected_pages' );
|
||||||
|
// echo '<pre>';print_r($selected_pages);exit;
|
||||||
|
if ($selected_pages) {
|
||||||
|
$selected_pages = explode ( ',', $selected_pages );
|
||||||
|
} else {
|
||||||
|
$selected_pages = array ();
|
||||||
|
}
|
||||||
|
$this->log ( $selected_pages );
|
||||||
|
|
||||||
|
$roleID = $this->request->data ( 'role' );
|
||||||
|
$this->log ( $roleID );
|
||||||
|
|
||||||
|
$deleteAll = $this->RolePages->deleteAll ( [
|
||||||
|
'role_id' => $roleID
|
||||||
|
] );
|
||||||
|
|
||||||
|
if (! empty ( $selected_pages )) {
|
||||||
|
foreach ( $selected_pages as $role ) {
|
||||||
|
$entity = $this->RolePages->newEntity ();
|
||||||
|
$entity->role_id = $roleID;
|
||||||
|
$entity->page_id = str_replace ( 'page_', '', $role );
|
||||||
|
$this->log ( "inserting.." );
|
||||||
|
if (! $this->RolePages->save ( $entity )) {
|
||||||
|
$this->Flash->error ( __ ( 'The roles could not be associated. Please, try again.' ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cms_users = TableRegistry::get ( 'usergroup_roles' )->find ()->select ( [
|
||||||
|
'usergroup_roles.id'
|
||||||
|
] )->select ( [
|
||||||
|
'cmsuser_usergroups.cms_user_id'
|
||||||
|
] )->join ( [
|
||||||
|
'table' => 'cmsuser_usergroups ',
|
||||||
|
'alias' => 'cmsuser_usergroups ',
|
||||||
|
'type' => 'INNER',
|
||||||
|
'conditions' => 'usergroup_roles.usergroup_id =cmsuser_usergroups.usergroup_id'
|
||||||
|
] )->where ( [
|
||||||
|
'usergroup_roles.role_id' => $roleID
|
||||||
|
] );
|
||||||
|
|
||||||
|
foreach ( $cms_users as $user ) {
|
||||||
|
$user_id = $user->cmsuser_usergroups ['cms_user_id'];
|
||||||
|
$current_permission_version = TableRegistry::get ( 'cmsusers' )->get ( $user_id )->permission_version;
|
||||||
|
if ($current_permission_version == "999") {
|
||||||
|
$current_permission_version = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = TableRegistry::get ( 'cmsusers' )->query ();
|
||||||
|
$query->update ()->set ( [
|
||||||
|
'permission_version' => $current_permission_version + 1
|
||||||
|
] )->where ( [
|
||||||
|
'id' => $user_id
|
||||||
|
] )->execute ();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->Flash->success ( __ ( 'The roles has been associated to the user group.' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$modulesArray = [ ];
|
||||||
|
foreach ( $modules as $module ) {
|
||||||
|
$modulesArray [$module->id] = $module->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$userPermissions = $this->request->session ()->read ( 'user_permissions' );
|
||||||
|
|
||||||
|
|
||||||
|
$this->set ( 'roles', $rolesArray );
|
||||||
|
$this->set ( 'companymodules', $modulesArray );
|
||||||
|
$this->set ( 'modules', $modules );
|
||||||
|
$this->set ( 'user_permission', $userPermissions );
|
||||||
|
//$this->viewBuilder ()->layout ( "after_login" );
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('page_list', $this->getPages());
|
||||||
|
$nav_arr[0] = array('action'=>'','page_id'=>'','icon'=>'','label'=>'');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
public function getAssociatedPages($roleId) {
|
||||||
|
$this->viewBuilder ()->layout ( false );
|
||||||
|
|
||||||
|
$selectedPages = $this->RolePages->find ( 'all' )->where ( [
|
||||||
|
'role_id' => $roleId
|
||||||
|
] )->toArray ();
|
||||||
|
|
||||||
|
$selectedPagesID = [ ];
|
||||||
|
foreach ( $selectedPages as $page ) {
|
||||||
|
array_push ( $selectedPagesID, 'page_' . $page->page_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (!empty($selectedPagesID)) {
|
||||||
|
// $selectedPages = $this->Pages->find('all')->where([
|
||||||
|
// 'id IN' => $selectedPagesID
|
||||||
|
// ]);
|
||||||
|
// } else {
|
||||||
|
// $selectedPages = array();
|
||||||
|
// }
|
||||||
|
|
||||||
|
$jsonObject = [
|
||||||
|
'selected_pages' => $selectedPagesID
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode ( $jsonObject );
|
||||||
|
die ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id
|
||||||
|
* Role Pages Association id.
|
||||||
|
* @return void
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null) {
|
||||||
|
$rolePagesAssociation = $this->RolePagesAssociation->get ( $id, [
|
||||||
|
'contain' => [ ]
|
||||||
|
] );
|
||||||
|
$this->set ( 'rolePagesAssociation', $rolePagesAssociation );
|
||||||
|
$this->set ( '_serialize', [
|
||||||
|
'rolePagesAssociation'
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add() {
|
||||||
|
$rolePagesAssociation = $this->RolePagesAssociation->newEntity ();
|
||||||
|
if ($this->request->is ( 'post' )) {
|
||||||
|
$rolePagesAssociation = $this->RolePagesAssociation->patchEntity ( $rolePagesAssociation, $this->request->data );
|
||||||
|
if ($this->RolePagesAssociation->save ( $rolePagesAssociation )) {
|
||||||
|
$this->Flash->success ( __ ( 'The role pages association has been saved.' ) );
|
||||||
|
return $this->redirect ( [
|
||||||
|
'action' => 'index'
|
||||||
|
] );
|
||||||
|
} else {
|
||||||
|
$this->Flash->error ( __ ( 'The role pages association could not be saved. Please, try again.' ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set ( compact ( 'rolePagesAssociation' ) );
|
||||||
|
$this->set ( '_serialize', [
|
||||||
|
'rolePagesAssociation'
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id
|
||||||
|
* Role Pages Association id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null) {
|
||||||
|
$rolePagesAssociation = $this->RolePagesAssociation->get ( $id, [
|
||||||
|
'contain' => [ ]
|
||||||
|
] );
|
||||||
|
if ($this->request->is ( [
|
||||||
|
'patch',
|
||||||
|
'post',
|
||||||
|
'put'
|
||||||
|
] )) {
|
||||||
|
$rolePagesAssociation = $this->RolePagesAssociation->patchEntity ( $rolePagesAssociation, $this->request->data );
|
||||||
|
if ($this->RolePagesAssociation->save ( $rolePagesAssociation )) {
|
||||||
|
$this->Flash->success ( __ ( 'The role pages association has been saved.' ) );
|
||||||
|
return $this->redirect ( [
|
||||||
|
'action' => 'index'
|
||||||
|
] );
|
||||||
|
} else {
|
||||||
|
$this->Flash->error ( __ ( 'The role pages association could not be saved. Please, try again.' ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set ( compact ( 'rolePagesAssociation' ) );
|
||||||
|
$this->set ( '_serialize', [
|
||||||
|
'rolePagesAssociation'
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id
|
||||||
|
* Role Pages Association id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null) {
|
||||||
|
$this->request->allowMethod ( [
|
||||||
|
'post',
|
||||||
|
'delete'
|
||||||
|
] );
|
||||||
|
$rolePagesAssociation = $this->RolePagesAssociation->get ( $id );
|
||||||
|
if ($this->RolePagesAssociation->delete ( $rolePagesAssociation )) {
|
||||||
|
$this->Flash->success ( __ ( 'The role pages association has been deleted.' ) );
|
||||||
|
} else {
|
||||||
|
$this->Flash->error ( __ ( 'The role pages association could not be deleted. Please, try again.' ) );
|
||||||
|
}
|
||||||
|
return $this->redirect ( [
|
||||||
|
'action' => 'index'
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
public function getModules() {
|
||||||
|
return array (
|
||||||
|
'Access Control' => '1003'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public function getSubModules() {
|
||||||
|
return array (
|
||||||
|
'Role & Page Association' => '2054'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public function getPages() {
|
||||||
|
return array (
|
||||||
|
'index' => '3078'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
237
src/Controller/RolesController.php
Normal file
237
src/Controller/RolesController.php
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use ModuleConstants;
|
||||||
|
use PagesConstants;
|
||||||
|
use SubModuleConstants;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use Cake\ORM\Query;
|
||||||
|
/**
|
||||||
|
* Roles Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\RolesTable $Roles
|
||||||
|
*/
|
||||||
|
class RolesController extends AppsController
|
||||||
|
{
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
I18n::locale('en_US');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user)
|
||||||
|
{
|
||||||
|
$request_action = $this->request->params['action'];
|
||||||
|
if ($request_action == "bulkAction") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::isAuthorized($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit=10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit= $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
];
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->Auth->user('id') == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
$roles = $this->Roles->find('all')->where([
|
||||||
|
'title LIKE' => '%' . $search . '%',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$roles = $this->Roles->find('all')->where([
|
||||||
|
'title LIKE' => '%' . $search . '%',
|
||||||
|
'company_id' => $this->Auth->user('company_id')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('roles', $this->paginate($roles));
|
||||||
|
$this->set('_serialize', ['roles']);
|
||||||
|
//$this->viewBuilder()->layout('role_management');
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('page_list', $this->getPages());
|
||||||
|
$nav_arr[0] = array('action'=>'add','page_id'=>'3056','icon'=>'<i class="fa fa-plus-circle"></i>','label'=>'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$this->viewBuilder()->layout('custom_layout');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Role id.
|
||||||
|
* @return void
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$role = $this->Roles->get($id, [
|
||||||
|
'contain' => ['Companies', 'RolePages']
|
||||||
|
]);
|
||||||
|
$this->set('role', $role);
|
||||||
|
$this->set('_serialize', ['role']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$role = $this->Roles->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$role = $this->Roles->patchEntity($role, $this->request->data);
|
||||||
|
$role->status = STATUS_ACTIVE;
|
||||||
|
$role->created_on = date('Y-m-d H:i:s');
|
||||||
|
$role->modified_on = date('Y-m-d H:i:s');
|
||||||
|
$role->company_id = $this->Auth->user('company_id');
|
||||||
|
|
||||||
|
if ($this->Roles->save($role)) {
|
||||||
|
$this->Flash->success(__('The role has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$errors = $role->errors();
|
||||||
|
if ($errors['title']) {
|
||||||
|
$this->Flash->error(__('The role title is not unique'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The role could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set(compact('role'));
|
||||||
|
$this->set('_serialize', ['role']);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$nav_arr[0] = array('action'=>'index','page_id'=>'3055','icon'=>'<i class="fa fa-list"></i>','label'=>'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout('custom_layout');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Role id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$role = $this->Roles->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$role = $this->Roles->patchEntity($role, $this->request->data);
|
||||||
|
// $role->title = $this->request->data('role_name');
|
||||||
|
$query = $this->Roles->query();
|
||||||
|
$update = $query->update()
|
||||||
|
->set(['title' => $this->request->data['title']])
|
||||||
|
->where(['id' => $this->request->data['id']])
|
||||||
|
->execute();
|
||||||
|
if ($update) {
|
||||||
|
//if ($this->Roles->save($role)) {
|
||||||
|
$this->Flash->success(__('The role has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The role could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set(compact('role'));
|
||||||
|
$this->set('_serialize', ['role']);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$nav_arr[0] = array('action'=>'index','page_id'=>'3055','icon'=>'<i class="fa fa-list"></i>','label'=>'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout('custom_layout');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Role id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$role = $this->Roles->get($id, [
|
||||||
|
'contain' => ['RolePages']
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (empty($role->role_pages)) {
|
||||||
|
if ($this->Roles->delete($role)) {
|
||||||
|
$this->Flash->success(__('The role has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The role could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The role contains Pages so could not be deleted.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function bulkAction()
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$selectedRoles = $this->request->data('selected_content');
|
||||||
|
$bulkAction = $this->request->data('bulk_action');
|
||||||
|
|
||||||
|
if ($bulkAction == BULK_ACTION_DELETE) {
|
||||||
|
if ($selectedRoles == "") return $this->redirect(['action' => 'index']);
|
||||||
|
$rolesToDelete = explode(',', $selectedRoles);
|
||||||
|
$error = $this->deleteAll($rolesToDelete);
|
||||||
|
if (!$error) {
|
||||||
|
$this->Flash->success(__('All the selected roles has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteAll($roles)
|
||||||
|
{
|
||||||
|
foreach ($roles as &$roleID) {
|
||||||
|
$roleID = str_replace('content_', '', $roleID);
|
||||||
|
|
||||||
|
$role = $this->Roles->get($roleID, [
|
||||||
|
'contain' => ['RolePages']
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (empty($role->role_pages)) {
|
||||||
|
if (!$this->Roles->delete($role)) {
|
||||||
|
return (__('The role ' . $role->title . ' could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (__('The role ' . $role->title . ' contains Pages so could not be deleted.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
166
src/Controller/SessionController.php
Normal file
166
src/Controller/SessionController.php
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Utility\Common;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\Cache\Cache;
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Student Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\SessionsTable $Sessions
|
||||||
|
* @property \App\Model\Table\StudentSessionsTable $StudentSessions
|
||||||
|
*/
|
||||||
|
class SessionController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
private $controller = "session";
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('Sessions');
|
||||||
|
$this->set('controller', $this->controller);
|
||||||
|
$this->setPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'id' => 'asc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
// $condition = ['status' => 1];
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(name LIKE ' . "'%" . $search ."%' OR duration_month like '%" . $search. "%' " .')' ;
|
||||||
|
}
|
||||||
|
$sessions = $this->Sessions->find('all')->where($condition);
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('sessions', $this->paginate($sessions));
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '10112', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
|
||||||
|
$Sessions = $this->Sessions->newEntity();
|
||||||
|
$request = $this->request->getData();
|
||||||
|
$request['status'] = 1;
|
||||||
|
$request['created_at'] = FrozenTime::now();
|
||||||
|
$request['updated_at'] = FrozenTime::now();
|
||||||
|
$request['start_date'] = new FrozenTime($request['start_date']);
|
||||||
|
$request['end_date'] = $request['start_date']->add(new \DateInterval('P' . $request['duration_month'] . 'M'));
|
||||||
|
$request['created_by'] = $user_id;
|
||||||
|
$request['updated_by'] = $user_id;
|
||||||
|
|
||||||
|
$Sessions = $this->Sessions->patchEntity($Sessions, $request);
|
||||||
|
|
||||||
|
$errors = $Sessions->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Sessions->save($Sessions)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The session has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'add']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('Unable to add the session.'));
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$session = $this->Sessions->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$request = $this->request->data;
|
||||||
|
$request['start_date'] = new FrozenTime($request['start_date']);
|
||||||
|
$request['end_date'] = $request['start_date']->add(new \DateInterval('P' . $request['duration_month'] . 'M'));
|
||||||
|
|
||||||
|
$session = $this->Sessions->patchEntity($session, $request);
|
||||||
|
|
||||||
|
$errors = $session->errors();
|
||||||
|
|
||||||
|
$session['updated_at'] = FrozenTime::now();
|
||||||
|
$session['updated_by'] = $user_id;
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Sessions->save($session)) {
|
||||||
|
$this->Flash->success(__('The Session has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Session could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('errors', $errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->set('session', $session);
|
||||||
|
$this->set('_serialize', ['session']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id=null)
|
||||||
|
{
|
||||||
|
$session = $this->Sessions->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('session', $session);
|
||||||
|
$this->set('_serialize', ['session']);
|
||||||
|
$this->setNextPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id=null)
|
||||||
|
{
|
||||||
|
$this->loadModel('StudentSessions');
|
||||||
|
|
||||||
|
$session = $this->Sessions->get($id);
|
||||||
|
|
||||||
|
$studentSessionCount = $this->StudentSessions->find()
|
||||||
|
->where(['session_id' => $id])
|
||||||
|
->count();
|
||||||
|
|
||||||
|
if ($studentSessionCount > 0) {
|
||||||
|
$this->Flash->error(__('Cannot delete session because it has associated student sessions.'));
|
||||||
|
} else {
|
||||||
|
if ($this->Sessions->delete($session)) {
|
||||||
|
$this->Flash->success(__('The session has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The session could not be deleted. Please try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
private function setNextPage(){
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '10109', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
205
src/Controller/SettingsController.php
Normal file
205
src/Controller/SettingsController.php
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Utility\Common;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\Cache\Cache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\SettingsTable $Settings
|
||||||
|
*/
|
||||||
|
class SettingsController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
I18n::locale('en_US');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
// $this->loadModel('Certificates');
|
||||||
|
// $this->loadModel('Tshirts');
|
||||||
|
$setting = $this->Settings->getCurrentSettings();
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
if (!empty($this->request->data['logo_path']['name'])) {
|
||||||
|
if (!empty($this->request->data['previous_logo_path'])) {
|
||||||
|
unlink(WWW_ROOT . '/' . $this->request->data['previous_logo_path']);
|
||||||
|
}
|
||||||
|
$logopath = 'images/logo/' . $this->request->data['logo_path']['name'];
|
||||||
|
$file = $this->request->data['logo_path']; //put the data into a var for easy use
|
||||||
|
$ext = substr(strtolower(strrchr($file['name'], '.')), 1); //get the extension
|
||||||
|
$arr_ext = array('jpg', 'jpeg', 'gif', 'png'); //set allowed extensions
|
||||||
|
|
||||||
|
//only process if the extension is valid
|
||||||
|
if (in_array($ext, $arr_ext)) {
|
||||||
|
//do the actual uploading of the file. First arg is the tmp name, second arg is
|
||||||
|
//where we are putting it
|
||||||
|
move_uploaded_file($_FILES["logo_path"]["tmp_name"], WWW_ROOT . 'images/logo/' . basename($_FILES['logo_path']['name']));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('Logo is not in right format.Please, try again.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->request->data['logo_path'] = $logopath;
|
||||||
|
} else {
|
||||||
|
$this->request->data['logo_path'] = $this->request->data['previous_logo_path'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->request->data['favicon_path']['name'])) {
|
||||||
|
if (!empty($this->request->data['previous_favicon_path'])) {
|
||||||
|
unlink(WWW_ROOT . '/' . $this->request->data['previous_favicon_path']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$file = $this->request->data['favicon_path']; //put the data into a var for easy use
|
||||||
|
$ext = substr(strtolower(strrchr($file['name'], '.')), 1); //get the extension
|
||||||
|
$arr_ext = array('jpg', 'jpeg', 'gif', 'png', 'ico'); //set allowed extensions
|
||||||
|
$this->request->data['favicon_path']['name'] = "favicon.".$ext;
|
||||||
|
$faviconpath = 'images/favicon/' . $this->request->data['favicon_path']['name'];
|
||||||
|
//only process if the extension is valid
|
||||||
|
if (in_array($ext, $arr_ext)) {
|
||||||
|
//do the actual uploading of the file. First arg is the tmp name, second arg is
|
||||||
|
//where we are putting it
|
||||||
|
move_uploaded_file($_FILES["favicon_path"]["tmp_name"], WWW_ROOT . $faviconpath);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('Logo is not in right format.Please, try again.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->request->data['favicon_path'] = $faviconpath;
|
||||||
|
} else {
|
||||||
|
$this->request->data['favicon_path'] = $this->request->data['previous_favicon_path'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// inquiry image
|
||||||
|
$folder_path = "AdminAccountImage/";
|
||||||
|
if (!is_dir('AdminAccountImage')) {
|
||||||
|
mkdir('AdminAccountImage', 0777, true);
|
||||||
|
$folder_path = "AdminAccountImage/";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->request->data['enhance_img']['name'])) {
|
||||||
|
if (!empty($this->request->data['previous_enhance_img_path'])) {
|
||||||
|
unlink(WWW_ROOT . '/' . $folder_path . $this->request->data['previous_enhance_img_path']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $this->request->data['enhance_img']; //put the data into a var for easy use
|
||||||
|
$ext = substr(strtolower(strrchr($file['name'], '.')), 1); //get the extension
|
||||||
|
$arr_ext = array('jpg', 'jpeg', 'gif', 'png'); //set allowed extensions
|
||||||
|
$logopath = $folder_path . ENHANCE_IMAGE.".".$ext;
|
||||||
|
//only process if the extension is valid
|
||||||
|
if (in_array($ext, $arr_ext)) {
|
||||||
|
//do the actual uploading of the file. First arg is the tmp name, second arg is
|
||||||
|
//where we are putting it
|
||||||
|
move_uploaded_file($_FILES["enhance_img"]["tmp_name"], WWW_ROOT . $folder_path . ENHANCE_IMAGE.".".$ext);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('Image is not in right format.Please, try again.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->request->data['enhance_img'] = $logopath;
|
||||||
|
} else {
|
||||||
|
$this->request->data['enhance_img'] = $this->request->data['previous_enhance_img_path'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// enhance image
|
||||||
|
if (!empty($this->request->data['inquiry_img']['name'])) {
|
||||||
|
if (!empty($this->request->data['previous_inquiry_img_path'])) {
|
||||||
|
unlink(WWW_ROOT . '/' . $folder_path . $this->request->data['previous_inquiry_img_path']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $this->request->data['inquiry_img']; //put the data into a var for easy use
|
||||||
|
$ext = substr(strtolower(strrchr($file['name'], '.')), 1); //get the extension
|
||||||
|
$arr_ext = array('jpg', 'jpeg', 'gif', 'png'); //set allowed extensions
|
||||||
|
$logopath = $folder_path . INQUIRY_IMAGE.".".$ext;
|
||||||
|
//only process if the extension is valid
|
||||||
|
if (in_array($ext, $arr_ext)) {
|
||||||
|
//do the actual uploading of the file. First arg is the tmp name, second arg is
|
||||||
|
//where we are putting it
|
||||||
|
move_uploaded_file($_FILES["inquiry_img"]["tmp_name"], WWW_ROOT."/".$folder_path .INQUIRY_IMAGE.".".$ext);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('Image is not in right format.Please, try again.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->request->data['inquiry_img'] = $logopath;
|
||||||
|
} else {
|
||||||
|
$this->request->data['inquiry_img'] = $this->request->data['previous_inquiry_img_path'];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//$this->request->data['updated_on'] = date('Y-m-d H:i:s');
|
||||||
|
$settingEntity = $this->Settings->patchEntity($setting, $this->request->data);
|
||||||
|
$settingEntity->trial_account_key = str_replace(TRIAL_ACCOUNT_URL,"",$settingEntity->trial_account_key);
|
||||||
|
$settingEntity->time_zone = $this->request->data['time_zone'];
|
||||||
|
if ($this->Settings->save($settingEntity)) {
|
||||||
|
//Cache::write('setting',$setting);
|
||||||
|
// $this->updateCertificateUrl();
|
||||||
|
// $this->updateTshirtUrl();
|
||||||
|
$this->Flash->success(__('The setting has been saved.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The setting could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// $certificates = $this->Certificates->getAllCertificates();
|
||||||
|
// $tshirts = $this->Tshirts->getAllTshirts();
|
||||||
|
$common = new Common;
|
||||||
|
$this->set('time_zone_list', $common->tz_key_value_list());
|
||||||
|
// $this->set(compact('setting','certificates','tshirts'));
|
||||||
|
$this->set(compact('setting'));
|
||||||
|
//$this->set('_serialize', ['setting']);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
private function updateCertificateUrl(){
|
||||||
|
$request_certificate = $this->request->getData('certificate');
|
||||||
|
if(!empty($request_certificate)){
|
||||||
|
foreach($request_certificate as $certificate_id => $certificate){
|
||||||
|
$endpoint = trim(end(explode('/', $certificate)));
|
||||||
|
$this->Certificates->updateUniqueString($certificate_id,$endpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function updateTshirtUrl(){
|
||||||
|
$request_tshirt = $this->request->getData('tshirt');
|
||||||
|
if(!empty($request_tshirt)){
|
||||||
|
foreach($request_tshirt as $tshirt_id => $tshirt){
|
||||||
|
$endpoint = trim(end(explode('/', $tshirt)));
|
||||||
|
$this->Tshirts->updateUniqueString($tshirt_id,$endpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getModules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'Settings' => '1004'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubModules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'Site Settings' => '2070'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPages()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => '3081'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
141
src/Controller/SoftwareVersionsController.php
Normal file
141
src/Controller/SoftwareVersionsController.php
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SoftwareVersions Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\SoftwareVersionsTable $SoftwareVersions
|
||||||
|
*
|
||||||
|
* @method \App\Model\Entity\SoftwareVersion[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||||
|
*/
|
||||||
|
class SoftwareVersionsController extends AppsController
|
||||||
|
{
|
||||||
|
public function initialize() {
|
||||||
|
parent::initialize();
|
||||||
|
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('page_list', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
$this->loadModel('SoftwareVersions');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return \Cake\Http\Response|null
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit = 10;
|
||||||
|
$search = [];
|
||||||
|
$request_params = $this->request->query;
|
||||||
|
if(!empty($request_params)){
|
||||||
|
$search = $request_params;
|
||||||
|
$page_limit = $search['page_limit'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit
|
||||||
|
];
|
||||||
|
$softwareVersions = $this->paginate($this->SoftwareVersions->getAllSoftwareVersions($search));
|
||||||
|
|
||||||
|
$this->set(compact('softwareVersions','search'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Software Version id.
|
||||||
|
* @return \Cake\Http\Response|null
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$softwareVersion = $this->SoftwareVersions->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$id_disable = true;
|
||||||
|
$this->set(compact('softwareVersion','id_disable'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$request = $this->request->getData();
|
||||||
|
//$request['release_date'] = date('Y-m-d H:i:s', strtotime($request['release_date']));
|
||||||
|
if ($this->SoftwareVersions->insertAgreementFormat($request)) {
|
||||||
|
$this->Flash->success(__('The software version has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('The software version could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
$this->set(compact('softwareVersion'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Software Version id.
|
||||||
|
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$softwareVersion = $this->SoftwareVersions->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$request = $this->request->getData();
|
||||||
|
if(isset($request['is_new']) && $request['is_new'] == 1){
|
||||||
|
$request['is_new'] = 1;
|
||||||
|
}else{
|
||||||
|
$request['is_new'] = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->SoftwareVersions->updateSoftwareVersion($id,$request)) {
|
||||||
|
$this->Flash->success(__('The software version has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('The software version could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
$id_disable = false;
|
||||||
|
$this->set(compact('softwareVersion','id_disable'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Software Version id.
|
||||||
|
* @return \Cake\Http\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$softwareVersion = $this->SoftwareVersions->get($id);
|
||||||
|
if ($this->SoftwareVersions->delete($softwareVersion)) {
|
||||||
|
$this->Flash->success(__('The software version has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The software version could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
879
src/Controller/StudentController.php
Normal file
879
src/Controller/StudentController.php
Normal file
@@ -0,0 +1,879 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Utility\PdfWriter;
|
||||||
|
use Cake\I18n\FrozenTime;
|
||||||
|
use Cake\I18n\FrozenDate;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use Cake\View\View;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Student Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\StudentsTable $Students
|
||||||
|
* @property \App\Model\Table\StudentSessionsTable $StudentSessions
|
||||||
|
* @property \App\Model\Table\StudentCoursesTable $StudentCourses
|
||||||
|
* @property \App\Model\Table\CoursesTable $Courses
|
||||||
|
* @property \App\Model\Table\SessionsTable $Sessions
|
||||||
|
* @property \App\Model\Table\PersonalizesTable $Personalizes
|
||||||
|
* @property \App\Model\Table\CheckListsTable $CheckLists
|
||||||
|
* @property \App\Model\Table\RegistrationPaymentsTable $RegistrationPayments
|
||||||
|
* @property \App\Model\Table\ReportFormatsTable $ReportFormats
|
||||||
|
* @property \App\Model\Table\ReportFormatVariablesTable $ReportFormatVariables
|
||||||
|
* @property \App\Model\Table\ReportFormatGenerationHistoriesTable $ReportFormatGenerationHistories
|
||||||
|
* @property \App\Model\Table\ReportFormatVariableValuesTable $ReportFormatVariableValues
|
||||||
|
* @property \App\Model\Table\StudentCheckListsTable $StudentCheckLists
|
||||||
|
* @property \App\Model\Table\PassportDetailsTable $PassportDetails
|
||||||
|
* @property \App\Model\Table\LetterSentHistoriesTable $LetterSentHistories
|
||||||
|
* @property \App\Model\Table\LetterSentHistoryDetailsTable $LetterSentHistoryDetails
|
||||||
|
* @property \App\Model\Table\CmsusersTable $Cmsusers
|
||||||
|
* @property \App\Model\Table\AgentsTable $Agents
|
||||||
|
*/
|
||||||
|
class StudentController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function initialize(): void
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('Students');
|
||||||
|
$this->loadModel('StudentSessions');
|
||||||
|
$this->loadModel('StudentCourses');
|
||||||
|
$this->loadModel('Courses');
|
||||||
|
$this->loadModel('Sessions');
|
||||||
|
$this->loadModel('CheckLists');
|
||||||
|
$this->loadModel('RegistrationPayments');
|
||||||
|
$this->loadModel('ReportFormats');
|
||||||
|
$this->loadModel('ReportFormatVariables');
|
||||||
|
$this->loadModel('StudentCheckLists');
|
||||||
|
$this->loadModel('PassportDetails');
|
||||||
|
$this->loadModel('Agents');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$agents = $this->Agents->find('list',[
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => function ($agent) {
|
||||||
|
return $agent->first_name . ' ' . $agent->last_name;
|
||||||
|
}
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
$page_limit = 10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit = $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'order' => [
|
||||||
|
'Students.id' => 'asc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
$condition = '(Students.first_name LIKE ' . "'%" . $search . "%' OR Students.surname LIKE '%" . $search . "%' "
|
||||||
|
. "OR Students.gender LIKE '%" . $search . "%' OR Students.title LIKE '%" . $search . "%' OR Students.email LIKE '%" . $search . "%' OR Students.reference_number like '%".$search."%'"
|
||||||
|
."OR Students.phone_number LIKE '%" . $search . "%'" . "OR Students.gender LIKE '%" . $search . "%'" .
|
||||||
|
"OR Students.nationality LIKE '%" . $search . "%'" .')' ;
|
||||||
|
}
|
||||||
|
if (isset($this->request->query['agent_id'])) {
|
||||||
|
$agent_id = $this->request->query('agent_id');
|
||||||
|
$condition .= " AND Students.referring_agent_id = " . (int)$agent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$students = $this->Students->find('all')->where($condition);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('student_permission', $user_permissions);
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('students', $this->paginate($students));
|
||||||
|
$this->set('agents', $agents);
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('page_list', $this->getPages());
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$nav_arr[0] = array('action' => 'add', 'page_id' => '3046', 'icon' => '<i class="fa fa-plus-circle"></i>', 'label' => 'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$sessions = $this->Sessions->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
$courses = $this->Courses->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
$user_id = $this->Auth->user('user_id');
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
|
||||||
|
$student = $this->Students->newEntity();
|
||||||
|
$student_request = $this->request->getData();
|
||||||
|
$student_request['date_of_birth'] = $student_request["date_year"]."-".$student_request["date_month"]."-".$student_request["date_day"];
|
||||||
|
//$student_request['reference_number']= $this->generateReferenceNumber($student_request['date_of_birth'],$student_request['session_id']);
|
||||||
|
$student_request['reference_number'] = STUDENT_ID_PREFIX . time() . rand(0, 9999);
|
||||||
|
$student = $this->Students->patchEntity($student, $student_request);
|
||||||
|
$student['created_by'] = $user_id;
|
||||||
|
$student['updated_by'] = $user_id;
|
||||||
|
$student['updated_at'] = FrozenTime::now();
|
||||||
|
$student['created_at'] = FrozenTime::now();
|
||||||
|
$student['current_checklist_id'] = 1;
|
||||||
|
$student['status'] = 1;
|
||||||
|
if ($this->Students->save($student)) {
|
||||||
|
|
||||||
|
$student_session = $this->StudentSessions->newEntity();
|
||||||
|
$student_session_request['student_id'] = $student['id'];
|
||||||
|
$student_session_request['session_id'] = $student_request['session_id'];
|
||||||
|
$student_session = $this->StudentSessions->patchEntity($student_session, $student_session_request);
|
||||||
|
$this->StudentSessions->save($student_session);
|
||||||
|
|
||||||
|
$student_course = $this->StudentCourses->newEntity();
|
||||||
|
$student_course_request['student_id'] = $student['id'];
|
||||||
|
$student_course_request['course_id'] = $student_request['course_id'];
|
||||||
|
$student_course_request['enrollment_date'] = FrozenTime::now();
|
||||||
|
$student_course = $this->StudentCourses->patchEntity($student_course, $student_course_request);
|
||||||
|
$this->StudentCourses->save($student_course);
|
||||||
|
|
||||||
|
$session = $sessions[$student_request['session_id']];
|
||||||
|
$course = $courses[$student_request['course_id']];
|
||||||
|
// $this->registration_email($student,$session,$course);
|
||||||
|
|
||||||
|
$this->Flash->success(__('Registration Successful!'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
$this->Flash->error(__('Unable to registration.'));
|
||||||
|
}
|
||||||
|
$this->set(compact('sessions','courses'));
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id=null)
|
||||||
|
{
|
||||||
|
$sessions = $this->Sessions->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
$courses = $this->Courses->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
$Student = $this->Students->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
$student_session = $this->StudentSessions->find()
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
$student_course = $this->StudentCourses->find()
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
$request = $this->request->data;
|
||||||
|
|
||||||
|
$Student = $this->Students->patchEntity($Student, $request);
|
||||||
|
|
||||||
|
$errors = $Student->errors();
|
||||||
|
|
||||||
|
$Student['updated_at'] = FrozenTime::now();
|
||||||
|
$Student['updated_by'] = $user_id;
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Students->save($Student)) {
|
||||||
|
$this->Flash->success(__('The Student has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Student could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set(compact('sessions','courses','student_session','student_course'));
|
||||||
|
$this->set('Student', $Student);
|
||||||
|
$this->set('_serialize', ['Student']);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$nav_arr[0] = array('action' => 'index', 'page_id' => '3045', 'icon' => '<i class="fa fa-list"></i>', 'label' => 'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view($id=null)
|
||||||
|
{
|
||||||
|
$student = $this->Students->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$student_session = $this->StudentSessions->find()
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
$student_course = $this->StudentCourses->find()
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$sessions = $this->Sessions->find()
|
||||||
|
->where(['id' => $student_session['session_id']])
|
||||||
|
->first();
|
||||||
|
$courses = $this->Courses->find()
|
||||||
|
->where(['id' => $student_course['course_id']])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$this->set(compact('sessions','courses','student_session','student_course'));
|
||||||
|
$this->set('student', $student);
|
||||||
|
$this->set('_serialize', ['student']);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('languages', $this->languages);
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verification()
|
||||||
|
{
|
||||||
|
$student = [];
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$student_request = $this->request->getData();
|
||||||
|
$student = $this->Students->find()
|
||||||
|
->select(['id', 'reference_number', 'first_name', 'surname', 'nationality'])
|
||||||
|
->where(['status' => 1, 'reference_number' => $student_request['reference_number'], 'passport_number' => $student_request['passport_number'] ])
|
||||||
|
->first();
|
||||||
|
$this->set(compact('student'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->viewBuilder()->layout('outside/layout');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registration($id=null)
|
||||||
|
{
|
||||||
|
$Student = $this->Students->get($id, [
|
||||||
|
'contain' => ['RegistrationPayments','PassportDetails']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$check_lists = $this->CheckLists->find('all')->where(['status'=>1]);
|
||||||
|
|
||||||
|
$sessions = $this->Sessions->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
$courses = $this->Courses->find('list', [
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => 'name'
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
$agents = $this->Agents->find('list',[
|
||||||
|
'keyField' => 'id',
|
||||||
|
'valueField' => function ($agent) {
|
||||||
|
return $agent->first_name . ' ' . $agent->last_name;
|
||||||
|
}
|
||||||
|
])->where(['status'=>1])->toArray();
|
||||||
|
|
||||||
|
$student_session = $this->StudentSessions->find()
|
||||||
|
->contain(['Sessions'])
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
$Student['session'] = $student_session;
|
||||||
|
|
||||||
|
$student_course = $this->StudentCourses->find()
|
||||||
|
->contain(['Courses'])
|
||||||
|
->where(['student_id' => $id])
|
||||||
|
->first();
|
||||||
|
$Student['course'] = $student_course;
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
if($student_course['course_id'] == 2) {
|
||||||
|
$report_format = $this->ReportFormats->find()->where(['report_format_type_id' => 5])->first();
|
||||||
|
$visa_report_format = $this->ReportFormats->find()->where(['report_format_type_id' => 6])->first();
|
||||||
|
}else{
|
||||||
|
$report_format = $this->ReportFormats->find()->where(['report_format_type_id' => 1])->first();
|
||||||
|
$visa_report_format = $this->ReportFormats->find()->where(['report_format_type_id' => 2])->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
$offer_variable_list = $this->reportGenerate($report_format['id'],$report_format['content'],$Student);
|
||||||
|
|
||||||
|
$report_replaced_data = $this->reportHTMLReplace($report_format['content'],$offer_variable_list);
|
||||||
|
|
||||||
|
$visa_variable_list = $this->reportGenerate($visa_report_format['id'],$visa_report_format['content'],$Student);
|
||||||
|
|
||||||
|
$visa_report_replaced_data = $this->reportHTMLReplace($visa_report_format['content'],$visa_variable_list);
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$request = $this->request->data;
|
||||||
|
$key = array_search($request['step'], FORM_SEQUENCE);
|
||||||
|
|
||||||
|
if (empty($request['last_join_date']) || !empty($Student['last_join_date']) ) {
|
||||||
|
$request['last_join_date'] = $Student['last_join_date']; ;
|
||||||
|
} else {
|
||||||
|
$request['last_join_date'] = new FrozenTime($request['last_join_date']); // or default value if needed
|
||||||
|
}
|
||||||
|
$Student = $this->Students->patchEntity($Student, $request);
|
||||||
|
$errors = $Student->errors();
|
||||||
|
|
||||||
|
if($request['step'] == (FORM_SEQUENCE)[1] && empty($Student['reference_number'])) {
|
||||||
|
$random = mt_rand(100, 999);
|
||||||
|
$idPadded = str_pad($Student->id, 3, '0', STR_PAD_LEFT);
|
||||||
|
$Student['reference_number'] = STUDENT_ID_PREFIX . $random . $idPadded;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $key == $Student['current_checklist_id'] && $key < count(FORM_SEQUENCE)) {
|
||||||
|
$Student['current_checklist_id'] = $Student['current_checklist_id'] + 1;
|
||||||
|
}
|
||||||
|
$Student['updated_at'] = FrozenTime::now();
|
||||||
|
$Student['updated_by'] = $user_id;
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->Students->save($Student)) {
|
||||||
|
$this->Flash->success(__('The Student has been updated.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Student could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($request['step'] == (FORM_SEQUENCE)[4]) {
|
||||||
|
$registration_payment = $this->RegistrationPayments->find()->where(['student_id' => $Student['id']])->first();
|
||||||
|
$registration_payment_request = [
|
||||||
|
'student_id' => $Student['id'],
|
||||||
|
'letter_type' => $request['letter_type'],
|
||||||
|
'registration_fee' => $request['registration_fee'],
|
||||||
|
'tuition_fees' => $request['tuition_fees'],
|
||||||
|
'total_fees' => $request['total_fees'],
|
||||||
|
'total_fees_paid' => $request['total_fees_paid'],
|
||||||
|
'outstanding_fees' => $request['outstanding_fees'],
|
||||||
|
'bank_details' => $request['bank_details'],
|
||||||
|
'iban' => $request['iban'],
|
||||||
|
'account_no' => $request['account_no'],
|
||||||
|
'updated_by_id' => $user_id,
|
||||||
|
'updated_at' => FrozenTime::now()
|
||||||
|
];
|
||||||
|
if ($registration_payment) {
|
||||||
|
$registration_payment = $this->RegistrationPayments->patchEntity($registration_payment, $registration_payment_request);
|
||||||
|
} else {
|
||||||
|
$registration_payment_request['created_by_id'] = $user_id;
|
||||||
|
$registration_payment_request['created_at'] = FrozenTime::now();
|
||||||
|
$registration_payment = $this->RegistrationPayments->newEntity();
|
||||||
|
$registration_payment = $this->RegistrationPayments->patchEntity($registration_payment, $registration_payment_request);
|
||||||
|
}
|
||||||
|
$errors = $registration_payment->errors();
|
||||||
|
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->RegistrationPayments->save($registration_payment)) {
|
||||||
|
$this->user_add($Student);
|
||||||
|
$this->Flash->success(__('The Registration Payment has been updated.'));
|
||||||
|
return $this->redirect(array('action' => 'registration/'.$id));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Registration Payment could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($request['step'] == (FORM_SEQUENCE)[5]) {
|
||||||
|
$offer_report_value = $this->placedReportVariable($report_format['content'],$request['content']);
|
||||||
|
$report_replaced_data = str_replace(['<em>', '</em>','<p> </p>'], '', $request['content']);
|
||||||
|
$report_replaced_data = str_replace(['[', ']'], '', $report_replaced_data);
|
||||||
|
// $report_replaced_data = $this->offerLetterTemplate($report_replaced_data);
|
||||||
|
$filename = uniqid('offer_letter_', true).'.pdf';
|
||||||
|
$folder = 'reports' . DS. $Student['id'] ;
|
||||||
|
$file_path = $this->reportSaveInStorage($folder, $filename, $report_replaced_data);
|
||||||
|
$this->letterSentHistory($report_format['id'],$report_format['report_format_type_id'],$Student,$folder.DS.$filename,$offer_report_value,$user_id);
|
||||||
|
// $this->reportGenerationHistory($report_format['id'], $Student['first_name'].' '.$Student['surname'],$Student['email'],$folder.DS.$filename,$user_id);
|
||||||
|
$template_content = array(
|
||||||
|
'student_name' => $Student['first_name'].' '.$Student['surname'],
|
||||||
|
'course'=> $Student->course->course['name'],
|
||||||
|
'letter_type'=> 'Conditional Offer'
|
||||||
|
);
|
||||||
|
$this->sendEmail('send_email_to_client', $template_content, $Student['email'], 'Conditional Offer Letter', ["Offer_Letter.pdf"=>$file_path], null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($request['step'] == (FORM_SEQUENCE)[6]) {
|
||||||
|
$passport_details = $this->PassportDetails->find()->where(['student_id' => $Student['id']])->first();
|
||||||
|
|
||||||
|
$passport_details_request = [
|
||||||
|
'student_id' => $Student['id'],
|
||||||
|
'passport_no' => $Student['passport_number'],
|
||||||
|
'verification_link' => $request['verification_link'],
|
||||||
|
'verification_code_img_path' => $request['verification_code_img_path'],
|
||||||
|
'visa_type' => $request['visa_type'],
|
||||||
|
'living_costs' => $request['living_costs'],
|
||||||
|
'duration' => $request['duration'],
|
||||||
|
'total_fees' => ($request['living_costs']*$request['duration']),
|
||||||
|
'updated_by_id' => $user_id,
|
||||||
|
'updated_at' => FrozenTime::now()
|
||||||
|
];
|
||||||
|
if ($passport_details) {
|
||||||
|
$passport_details = $this->PassportDetails->patchEntity($passport_details, $passport_details_request);
|
||||||
|
} else {
|
||||||
|
$passport_details_request['created_by_id'] = $user_id;
|
||||||
|
$passport_details_request['created_at'] = FrozenTime::now();
|
||||||
|
$passport_details = $this->PassportDetails->newEntity();
|
||||||
|
$passport_details = $this->PassportDetails->patchEntity($passport_details, $passport_details_request);
|
||||||
|
}
|
||||||
|
$errors = $passport_details->errors();
|
||||||
|
if (empty($errors)) {
|
||||||
|
if ($this->PassportDetails->save($passport_details)) {
|
||||||
|
$this->Flash->success(__('The Passport Details has been updated.'));
|
||||||
|
return $this->redirect(array('action' => 'registration/'.$id));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Passport Details could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($request['step'] == (FORM_SEQUENCE)[7]) {
|
||||||
|
$visa_report_value = $this->placedReportVariable($visa_report_format['content'],$request['visa_content']);
|
||||||
|
$report_replaced_data = str_replace(['<em>', '</em>','<p> </p>'], '', $request['visa_content']);
|
||||||
|
$report_replaced_data = str_replace(['[', ']'], '', $report_replaced_data);
|
||||||
|
$filename = uniqid('visa_letter_', true).'.pdf';
|
||||||
|
$folder = 'reports' . DS. $Student['id'] ;
|
||||||
|
// $report_replaced_data = $this->visaLetterTemplate($report_replaced_data);
|
||||||
|
$file_path = $this->reportSaveInStorage($folder, $filename, $report_replaced_data);
|
||||||
|
$this->letterSentHistory($visa_report_format['id'],$visa_report_format['report_format_type_id'],$Student,$folder.DS.$filename,$visa_report_value,$user_id);
|
||||||
|
// $this->reportGenerationHistory($visa_report_format['id'], $Student['first_name'].' '.$Student['surname'],$Student['email'],$folder.DS.$filename,$user_id);
|
||||||
|
$template_content = array(
|
||||||
|
'student_name' => $Student['first_name'].' '.$Student['surname'],
|
||||||
|
'course'=> $Student->course->course['name'],
|
||||||
|
'letter_type'=> 'Visa '
|
||||||
|
);
|
||||||
|
$this->sendEmail('send_email_to_client', $template_content, $Student['email'], 'Visa Letter', ["Visa_Letter.pdf"=>$file_path], null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set(compact('agents','check_lists','Student','user_id','sessions','courses','student_session','student_course','report_format','report_replaced_data','visa_report_replaced_data'));
|
||||||
|
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function user_add($Student)
|
||||||
|
{
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
$this->loadModel('cmsuser_usergroups');
|
||||||
|
$cmsuser = $this->Cmsusers->find()->where(['crm_contact_user_id' => $Student['id']])->first();
|
||||||
|
if(empty($cmsuser)) {
|
||||||
|
$cmsuser = $this->Cmsusers->newEntity();
|
||||||
|
$cmsuser->crm_contact_user_id = $Student['id'];
|
||||||
|
$cmsuser->user_type = USER_TYPE['STUDENT'];
|
||||||
|
$cmsuser->username = $Student['email'];
|
||||||
|
$cmsuser->password = DEFAULT_USER_PASSWORD;
|
||||||
|
$cmsuser->email = $Student['email'];
|
||||||
|
$cmsuser->created_on = FrozenTime::now();
|
||||||
|
$cmsuser->updated_on = FrozenTime::now();
|
||||||
|
$cmsuser->reset_password_token = '';
|
||||||
|
$cmsuser->status = STATUS_ACTIVE;
|
||||||
|
$cmsuser->language = 'en';
|
||||||
|
$cmsuser->last_active_date = FrozenTime::now();
|
||||||
|
$cmsuser->company_id = $this->Auth->user('company_id');
|
||||||
|
$cmsuser->updated_at = FrozenTime::now();
|
||||||
|
|
||||||
|
$isUnique = $this->checkUniqueEmail($cmsuser->email);
|
||||||
|
if ($isUnique) {
|
||||||
|
$cmsuser = $this->Cmsusers->save($cmsuser);
|
||||||
|
if ($cmsuser) {
|
||||||
|
$this->addUserToUserGroup($cmsuser->id,DEFAULT_STUDENT_USER_GROUP);
|
||||||
|
}
|
||||||
|
$this->sendUserInfo($Student, DEFAULT_USER_PASSWORD);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function addUserToUserGroup($user_id, $usergroup_id)
|
||||||
|
{
|
||||||
|
$table_user_groups_user = TableRegistry::get("CmsuserUsergroups");
|
||||||
|
$entity = $table_user_groups_user->newEntity();
|
||||||
|
$entity->cms_user_id = $user_id;
|
||||||
|
$entity->usergroup_id = $usergroup_id;
|
||||||
|
$table_user_groups_user->save($entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkUniqueEmail($email)
|
||||||
|
{
|
||||||
|
$result = true;
|
||||||
|
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
$cmsuser = $this->Cmsusers->find()->where(['email' => $email])->first();
|
||||||
|
|
||||||
|
if (!empty($cmsuser)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
public function enrollstudent($id = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
if ($this->request->allowMethod(['post', 'delete'])) {
|
||||||
|
|
||||||
|
$Student = $this->Students->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
$Student['status'] = 1;
|
||||||
|
$Student['updated_at'] = FrozenTime::now();
|
||||||
|
$Student['updated_by'] = $user_id;
|
||||||
|
|
||||||
|
if ($this->Students->save($Student)) {
|
||||||
|
$this->Flash->success(__('The Student has been enrolled successfully.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->Flash->error(__('The Student could not be enrolled. Please, try again.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function sendUserInfo($student,$password){
|
||||||
|
|
||||||
|
$template_content = array(
|
||||||
|
'student_name' => $student['title'].' '.$student['first_name'],
|
||||||
|
'student_email' => $student['email'],
|
||||||
|
'user_name' => $student['email'],
|
||||||
|
'password' => $password
|
||||||
|
);
|
||||||
|
$this->sendEmail('user_info_for_student', $template_content, $student->email, 'Portal Information', "",null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reportHTMLReplace($content, $variableList) {
|
||||||
|
|
||||||
|
if (!empty($variableList)) {
|
||||||
|
foreach ($variableList as $key => $value) {
|
||||||
|
$content = str_replace("[$key]", "[$value]", $content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findVariableFromHtmlContent($html_content)
|
||||||
|
{
|
||||||
|
preg_match_all('/\[(.*?)\]/', $html_content, $matches);
|
||||||
|
|
||||||
|
return $matches[1];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVariableValue($base_content, $variable_values){
|
||||||
|
$data = [];
|
||||||
|
foreach ($base_content as $key => $value) {
|
||||||
|
$data[$value] = $variable_values[$key] ;
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
public function reportFormatVariableUpdate($report_values,$report_format_id,$receiver_email){
|
||||||
|
$this->loadModel('ReportFormatVariableValues');
|
||||||
|
$this->loadModel('ReportFormatVariables');
|
||||||
|
$this->loadModel('ReportFormatGenerationHistories');
|
||||||
|
|
||||||
|
$user_id = $this->Auth->user('id');
|
||||||
|
|
||||||
|
$report_format_generation_history = $this->ReportFormatGenerationHistories->find()->where(['report_format_id' => $report_format_id,'receiver_emails' => $receiver_email])->first();
|
||||||
|
|
||||||
|
$report_format_generation_history_request = [
|
||||||
|
'name' => "Offer Letter",
|
||||||
|
'report_format_id' => $report_format_id,
|
||||||
|
'status' => 1,
|
||||||
|
'updated_by_id' => $user_id,
|
||||||
|
'updated_at' => FrozenTime::now()
|
||||||
|
];
|
||||||
|
|
||||||
|
if (empty($report_format_generation_history)) {
|
||||||
|
$report_format_generation_history_request['receiver_emails'] = $receiver_email;
|
||||||
|
$report_format_generation_history_request['created_by_id'] = $user_id;
|
||||||
|
$report_format_generation_history_request['created_at'] = FrozenTime::now();
|
||||||
|
$report_format_generation_history = $this->ReportFormatGenerationHistories->newEntity();
|
||||||
|
$report_format_generation_history = $this->ReportFormatGenerationHistories->patchEntity($report_format_generation_history, $report_format_generation_history_request);
|
||||||
|
$this->ReportFormatGenerationHistories->save($report_format_generation_history);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($report_values as $key => $value) {
|
||||||
|
if(!in_array($key,AVOID_FROM_REPORT)) {
|
||||||
|
$report_format_variable = $this->ReportFormatVariables->find()->where(['report_format_id' => $report_format_id, 'variable_name' => $key])->first();
|
||||||
|
$report_format_variable_value = $this->ReportFormatVariableValues->find()->where(['report_format_variable_id' => $report_format_variable['id']])->first();
|
||||||
|
$ReportFormatVariableValueRequest = [
|
||||||
|
'report_format_id' => $report_format_id,
|
||||||
|
'value' => $value,
|
||||||
|
'report_format_variable_id' => $report_format_variable['id'],
|
||||||
|
'report_format_generation_history_id' => $report_format_generation_history['id'],
|
||||||
|
'status' => 1,
|
||||||
|
'updated_by_id' => $user_id,
|
||||||
|
'updated_at' => FrozenTime::now()
|
||||||
|
];
|
||||||
|
if (empty($report_format_variable_value)) {
|
||||||
|
$ReportFormatVariableValueRequest['created_by_id'] = $user_id;
|
||||||
|
$ReportFormatVariableValueRequest['created_at'] = FrozenTime::now();
|
||||||
|
$report_format_variable_value = $this->ReportFormatVariableValues->newEntity();
|
||||||
|
$report_format_variable_value = $this->ReportFormatVariableValues->patchEntity($report_format_variable_value, $ReportFormatVariableValueRequest);
|
||||||
|
}
|
||||||
|
$report_format_variable_value = $this->ReportFormatVariableValues->patchEntity($report_format_variable_value, $ReportFormatVariableValueRequest);
|
||||||
|
$this->ReportFormatVariableValues->save($report_format_variable_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reportSaveInStorage($folder,$filename,$content)
|
||||||
|
{
|
||||||
|
$folder = WWW_ROOT .$folder;
|
||||||
|
if (!is_dir($folder)) {
|
||||||
|
mkdir($folder, 0775, true);
|
||||||
|
}
|
||||||
|
$path = $folder . DS . $filename;
|
||||||
|
|
||||||
|
if (file_exists($path)) {
|
||||||
|
unlink($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mpdfWrite($content, $folder,$filename);
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
public function reportGetFromStorage($student_id,$report_format_id)
|
||||||
|
{
|
||||||
|
$content = null;
|
||||||
|
$filename = $report_format_id.'.doc';
|
||||||
|
|
||||||
|
$folder = WWW_ROOT . 'reports' . DS. $student_id ;
|
||||||
|
$filePath = $folder . DS . $filename;
|
||||||
|
if (file_exists($filePath)) {
|
||||||
|
$content = file_get_contents($filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reportGenerate($report_format_id,$base_content,$student)
|
||||||
|
{
|
||||||
|
$report_variables = $this->findVariableFromHtmlContent($base_content);
|
||||||
|
|
||||||
|
$report_format_variable = $this->ReportFormatVariables->find()
|
||||||
|
->select(['variable_name', 'column_name', 'table_name'])
|
||||||
|
->where(['report_format_id' => $report_format_id])->toArray();
|
||||||
|
|
||||||
|
$report_format_variable_value = [];
|
||||||
|
|
||||||
|
foreach ($report_format_variable as $variable) {
|
||||||
|
if ($variable->table_name === 'Students') {
|
||||||
|
$column_value = $student->get($variable->column_name);
|
||||||
|
if($variable->column_name == 'date_of_birth'){
|
||||||
|
$column_value = $column_value->format('d-m-Y');
|
||||||
|
}
|
||||||
|
if($variable->column_name == 'last_join_date'){
|
||||||
|
if(!empty($column_value) ) {
|
||||||
|
$column_value = $column_value->format('jS F Y');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($variable->column_name == 'mod_of_study'){
|
||||||
|
$column_value = STUDY_MOD[$column_value];
|
||||||
|
}
|
||||||
|
if($variable->column_name == 'first_name'){
|
||||||
|
$column_value = $column_value.' '.$student->get('surname');
|
||||||
|
}
|
||||||
|
$report_format_variable_value[$variable->variable_name] = $column_value;
|
||||||
|
}
|
||||||
|
if ($variable->table_name === 'Sessions') {
|
||||||
|
$column_value = $student->session->session->get($variable->column_name);
|
||||||
|
if($variable->column_name == 'start_date' || $variable->column_name == 'end_date'){
|
||||||
|
$column_value = $column_value->format('jS F Y');
|
||||||
|
|
||||||
|
}
|
||||||
|
$report_format_variable_value[$variable->variable_name] = $column_value;
|
||||||
|
}
|
||||||
|
if ($variable->table_name === 'Courses') {
|
||||||
|
$column_value = $student->course->course->get($variable->column_name);
|
||||||
|
if($variable->column_name == 'course_category_id'){
|
||||||
|
$column_value = $this->setCourseCategory($column_value);
|
||||||
|
}
|
||||||
|
$report_format_variable_value[$variable->variable_name] = $column_value;
|
||||||
|
|
||||||
|
}
|
||||||
|
if ($variable->table_name === 'RegistrationPayments' && !empty($student->registration_payment)) {
|
||||||
|
$column_value = $student->registration_payment->get($variable->column_name);
|
||||||
|
if($variable->column_name == 'letter_type'){
|
||||||
|
$column_value = OFFER_LETTER_TYPE[$column_value];
|
||||||
|
}
|
||||||
|
if(in_array($variable->column_name,DECIMAL_COLUMN)){
|
||||||
|
$column_value = number_format($column_value, 2);
|
||||||
|
}
|
||||||
|
$report_format_variable_value[$variable->variable_name] = $column_value;
|
||||||
|
}
|
||||||
|
if ($variable->table_name === 'PassportDetails' && !empty($student->passport_detail)) {
|
||||||
|
$column_value = $student->passport_detail->get($variable->column_name);
|
||||||
|
if(in_array($variable->column_name,DECIMAL_COLUMN)){
|
||||||
|
$column_value = number_format($column_value, 2);
|
||||||
|
}
|
||||||
|
$report_format_variable_value[$variable->variable_name] = $column_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$variable_list = [];
|
||||||
|
|
||||||
|
foreach ($report_variables as $key => $value) {
|
||||||
|
|
||||||
|
if(array_key_exists($value,$report_format_variable_value)) {
|
||||||
|
$variable_list[$value] = $report_format_variable_value[$value];
|
||||||
|
|
||||||
|
}
|
||||||
|
if(array_key_exists($value,FIXED_REPORT_VARIABLE)) {
|
||||||
|
$variable_list[$value] = FIXED_REPORT_VARIABLE[$value];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $variable_list;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function placedReportVariable($base_content,$dynamic_content)
|
||||||
|
{
|
||||||
|
$report_variables = $this->findVariableFromHtmlContent($base_content);
|
||||||
|
$report_value_variables = $this->findVariableFromHtmlContent($dynamic_content);
|
||||||
|
|
||||||
|
$variable_list = [];
|
||||||
|
|
||||||
|
foreach ($report_variables as $key => $value) {
|
||||||
|
|
||||||
|
if(array_key_exists($key,$report_value_variables)) {
|
||||||
|
$variable_list[$value] = $report_value_variables[$key];
|
||||||
|
|
||||||
|
}
|
||||||
|
if(array_key_exists($key,FIXED_REPORT_VARIABLE)) {
|
||||||
|
$variable_list[$value] = FIXED_REPORT_VARIABLE[$value];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return $variable_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function mpdfWrite($html,$file_path,$file_name,$extra = []){
|
||||||
|
$pdfWriter = new PdfWriter();
|
||||||
|
// $pdfWriter->Write($html, $file_path. '/' . $file_name);
|
||||||
|
|
||||||
|
$bg_image = WWW_ROOT.'/reports/report_pad.jpg';
|
||||||
|
$backgroundStyle = 'style="background: url('. $bg_image .') no-repeat top center; background-size: 100% 100%;"';
|
||||||
|
$html = str_replace('class="page"', $backgroundStyle, $html);
|
||||||
|
|
||||||
|
$imagePath = WWW_ROOT.'/reports/verification_link.png';
|
||||||
|
$newImgTag = '<img class="qrcode" src="'.$imagePath.'" alt="QR Code" />';
|
||||||
|
$html = preg_replace('/<img class="qrcode"[^>]*>/', $newImgTag, $html);
|
||||||
|
|
||||||
|
$pdfWriter->mpdfWrite($html, $file_path.DS, $file_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offerLetterTemplate($content)
|
||||||
|
{
|
||||||
|
$view = new View($this->request, $this->response);
|
||||||
|
return $view->element('offer_letter_template', compact('content'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function visaLetterTemplate($content)
|
||||||
|
{
|
||||||
|
$view = new View($this->request, $this->response);
|
||||||
|
return $view->element('visa_letter', compact('content'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reportGenerationHistory($report_format_id,$student_name,$student_email,$file_path,$user_id){
|
||||||
|
$this->loadModel('ReportFormatGenerationHistories');
|
||||||
|
$report_format_generation_history = $this->ReportFormatGenerationHistories->newEntity();
|
||||||
|
$report_format_generation_history_request = [
|
||||||
|
'report_format_id' => $report_format_id,
|
||||||
|
'name' => $student_name,
|
||||||
|
'receiver_emails' => $student_email,
|
||||||
|
'file_path' => $file_path,
|
||||||
|
'expiration_at' => frozenTime::now()->addMonths(2),
|
||||||
|
'status' => 1,
|
||||||
|
'updated_by_id' => $user_id,
|
||||||
|
'updated_at' => FrozenTime::now(),
|
||||||
|
'created_by_id' => $user_id,
|
||||||
|
'created_at' => FrozenTime::now()
|
||||||
|
];
|
||||||
|
$report_format_generation_history = $this->ReportFormatGenerationHistories->patchEntity($report_format_generation_history, $report_format_generation_history_request);
|
||||||
|
$this->ReportFormatGenerationHistories->save($report_format_generation_history);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function letterSentHistory($report_format_id,$report_type_id,$student,$file_path,$column_value,$user_id){
|
||||||
|
$this->loadModel('LetterSentHistories');
|
||||||
|
$letter_sent_history = $this->LetterSentHistories->newEntity();
|
||||||
|
$letter_sent_history_request = [
|
||||||
|
'report_type_id' => $report_type_id,
|
||||||
|
'report_format_id' => $report_format_id,
|
||||||
|
'student_id' => $student['id'],
|
||||||
|
'student_email' => $student['email'],
|
||||||
|
'sent_date' => FrozenTime::now(),
|
||||||
|
'letter_file_path' => $file_path,
|
||||||
|
'updated_by_id' => $user_id,
|
||||||
|
'updated_at' => FrozenTime::now(),
|
||||||
|
'created_by_id' => $user_id,
|
||||||
|
'created_at' => FrozenTime::now()
|
||||||
|
];
|
||||||
|
$letter_sent_history = $this->LetterSentHistories->patchEntity($letter_sent_history, $letter_sent_history_request);
|
||||||
|
$this->LetterSentHistories->save($letter_sent_history);
|
||||||
|
$this->letterSentHistoryDetails($letter_sent_history['id'],json_encode($column_value),$user_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function letterSentHistoryDetails($letter_sent_history_id,$column_value,$user_id){
|
||||||
|
$this->loadModel('LetterSentHistoryDetails');
|
||||||
|
$letter_sent_history_detail = $this->LetterSentHistoryDetails->newEntity();
|
||||||
|
$letter_sent_history_detail_request = [
|
||||||
|
'letter_sent_history_id' => $letter_sent_history_id,
|
||||||
|
'column_value' => $column_value,
|
||||||
|
'updated_by_id' => $user_id,
|
||||||
|
'updated_at' => FrozenTime::now(),
|
||||||
|
'created_by_id' => $user_id,
|
||||||
|
'created_at' => FrozenTime::now()
|
||||||
|
];
|
||||||
|
$letter_sent_history_detail = $this->LetterSentHistoryDetails->patchEntity($letter_sent_history_detail, $letter_sent_history_detail_request);
|
||||||
|
$this->LetterSentHistoryDetails->save($letter_sent_history_detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id=null)
|
||||||
|
{
|
||||||
|
$student = $this->Students->get($id);
|
||||||
|
|
||||||
|
if ($this->Students->delete($student)) {
|
||||||
|
|
||||||
|
$this->Flash->success(__('The Student has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Student could not be deleted. Please try again.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setCourseCategory($id){
|
||||||
|
$categories = [
|
||||||
|
1 => 'Business Management',
|
||||||
|
2 => 'English Language',
|
||||||
|
3 => 'Health and Social Care',
|
||||||
|
4 => 'Hospitality and Tourism Management',
|
||||||
|
5 => 'Business Innovation and Entrepreneurship',
|
||||||
|
6 => 'Information Technology',
|
||||||
|
7 => 'Nursing and Midwifery'
|
||||||
|
];
|
||||||
|
|
||||||
|
return $categories[$id];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
232
src/Controller/StudentsController.php
Normal file
232
src/Controller/StudentsController.php
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\Event\Event;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use DateTime;
|
||||||
|
use ModuleConstants;
|
||||||
|
use PagesConstants;
|
||||||
|
use SubModuleConstants;
|
||||||
|
use Cake\ORM\Query;
|
||||||
|
/**
|
||||||
|
* Modules Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\ModulesTable $Modules
|
||||||
|
*/
|
||||||
|
class StudentsController extends AppsController
|
||||||
|
{
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
I18n::locale('en_US');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user)
|
||||||
|
{
|
||||||
|
$request_action = $this->request->params['action'];
|
||||||
|
if ($request_action == "bulkAction") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::isAuthorized($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => 10,
|
||||||
|
'order' => [
|
||||||
|
'Students.created_on' => 'desc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
}
|
||||||
|
|
||||||
|
$modules = $this->Students->find('all')->where([
|
||||||
|
'name LIKE' => '%' . $search . '%'
|
||||||
|
]);
|
||||||
|
$this->set('modules', $this->paginate($modules));
|
||||||
|
$this->set('_serialize', ['modules']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('pages', $this->getPages());
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bulkAction()
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$selectedModules = $this->request->data('selected_content');
|
||||||
|
$bulkAction = $this->request->data('bulk_action');
|
||||||
|
if ($bulkAction == BULK_ACTION_DELETE) {
|
||||||
|
if ($selectedModules == "") return $this->redirect(['action' => 'index']);
|
||||||
|
$modulesToBeDeleted = explode(',', $selectedModules);
|
||||||
|
$error = $this->deleteAll($modulesToBeDeleted);
|
||||||
|
if (!$error) {
|
||||||
|
$this->Flash->success(__('All the selected Modules have been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteAll($modules)
|
||||||
|
{
|
||||||
|
foreach ($modules as &$moduleIdWithPrefix) {
|
||||||
|
$moduleId = str_replace('content_', '', $moduleIdWithPrefix);
|
||||||
|
$module = $this->Modules->get($moduleId);
|
||||||
|
if ($this->canModuleBeDeleted($moduleId)) {
|
||||||
|
$this->Modules->delete($module);
|
||||||
|
} else {
|
||||||
|
return (__('The Module ' . $module->name . ' cannot be deleted as it contains related Submodules'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$module = $this->Modules->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
$this->set('module', $module);
|
||||||
|
$this->set('_serialize', ['module']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$newmodule = $this->Modules->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$newmodule = $this->Modules->patchEntity($newmodule, $this->request->data);
|
||||||
|
$moduleErrors = $this->checkAndDisplayEntityErrors($newmodule);
|
||||||
|
if (!$moduleErrors) {
|
||||||
|
//pr($newmodule);exit;
|
||||||
|
if ($this->Modules->save($newmodule)) {
|
||||||
|
$this->Flash->success(__('The module has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The module could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set(compact('newmodule'));
|
||||||
|
$this->set('_serialize', ['module']);
|
||||||
|
//$this->viewBuilder()->layout("master_data");
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkAndDisplayEntityErrors($entity)
|
||||||
|
{
|
||||||
|
$entityErrors = $entity->errors();
|
||||||
|
foreach ($entityErrors as $key => $value) {
|
||||||
|
foreach ($entityErrors[$key] as $errorKey => $errorValue) {
|
||||||
|
$this->Flash->error($errorValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $entityErrors;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$newmodule = $this->Modules->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$id = $this->request->params['pass'][0];
|
||||||
|
//pr($this->request->data);exit;
|
||||||
|
$newmodule = $this->Modules->patchEntity($newmodule, $this->request->data);
|
||||||
|
$newmodule['modified_on'] = new DateTime();
|
||||||
|
$query = $this->Modules->query();
|
||||||
|
$update = $query->update()
|
||||||
|
->set(['id' => $this->request->data['id'],'name'=>$this->request->data['name'],
|
||||||
|
'icon'=>$this->request->data['icon'],'sequence'=>$this->request->data['sequence']])
|
||||||
|
->where(['id' => $id])
|
||||||
|
->execute();
|
||||||
|
if ($update) {
|
||||||
|
$this->Flash->success(__('The module has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The module could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set(compact('newmodule'));
|
||||||
|
$this->set('_serialize', ['newmodule']);
|
||||||
|
//$this->viewBuilder()->layout("master_data");
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$module = $this->Modules->get($id);
|
||||||
|
if ($this->canModuleBeDeleted($id)) {
|
||||||
|
if ($this->Modules->delete($module)) {
|
||||||
|
$this->Flash->success(__('The module has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The module could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Module cannot be deleted as it contains related Submodules.'));
|
||||||
|
}
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canModuleBeDeleted($moduleId)
|
||||||
|
{
|
||||||
|
if ($moduleId) {
|
||||||
|
$SubModulesTable = TableRegistry::get('sub_modules');
|
||||||
|
$subModules = $SubModulesTable->find('all')
|
||||||
|
->where(['module_id' => $moduleId]);
|
||||||
|
|
||||||
|
if (sizeof($subModules->toArray()) > 0) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModules()
|
||||||
|
{
|
||||||
|
return ['School' =>'100'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubModules()
|
||||||
|
{
|
||||||
|
return ['Student Management' => '200'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPages()
|
||||||
|
{
|
||||||
|
return ['index' =>'301',
|
||||||
|
'add' => '302',
|
||||||
|
'edit' => '303',
|
||||||
|
'delete' =>'304'];
|
||||||
|
}
|
||||||
|
}
|
||||||
199
src/Controller/SubCategoriesController.php
Normal file
199
src/Controller/SubCategoriesController.php
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use DateTime;
|
||||||
|
use Cake\ORM\Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SubCategories Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\SubCategoriesTable $SubCategories
|
||||||
|
*/
|
||||||
|
class SubCategoriesController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return \Cake\Network\Response|null
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
// $subCategories = $this->paginate($this->SubCategories);
|
||||||
|
|
||||||
|
// $this->set(compact('subCategories'));
|
||||||
|
// $this->set('_serialize', ['subCategories']);
|
||||||
|
|
||||||
|
$page_limit=10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit= $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'contain' => ['Categories'],
|
||||||
|
'sortWhitelist' => [
|
||||||
|
'Categories.name','SubCategories.created_on', 'SubCategories.id', 'SubCategories.name', 'SubCategories.modified_on'
|
||||||
|
],
|
||||||
|
'order' => [
|
||||||
|
'SubCategories.created_on' => 'desc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
}
|
||||||
|
|
||||||
|
$subCategories = $this->SubCategories->find('all')->where([
|
||||||
|
'SubCategories.name LIKE' => '%' . $search . '%'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$subCategories = $this->paginate($subCategories);
|
||||||
|
|
||||||
|
$this->set(compact('subCategories'));
|
||||||
|
$this->set('_serialize', ['subCategories','categories']);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Sub Category id.
|
||||||
|
* @return \Cake\Network\Response|null
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$subCategory = $this->SubCategories->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('subCategory', $subCategory);
|
||||||
|
$this->set('_serialize', ['subCategory']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$subCategory = $this->SubCategories->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$subCategory = $this->SubCategories->patchEntity($subCategory, $this->request->data);
|
||||||
|
$subCategory->created_on = date('Y-m-d h:i:s');
|
||||||
|
$subCategory->status = 1;
|
||||||
|
if ($this->SubCategories->save($subCategory)) {
|
||||||
|
$this->Flash->success(__('The sub category has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The sub category could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$categoriesTable = TableRegistry::get('Categories');
|
||||||
|
$categories = $categoriesTable->find('list')->where([
|
||||||
|
'Categories.status' => 1
|
||||||
|
]);
|
||||||
|
$this->set(compact('categories'));
|
||||||
|
|
||||||
|
$this->set(compact('subCategory'));
|
||||||
|
$this->set('_serialize', ['subCategory']);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Sub Category id.
|
||||||
|
* @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$subCategory = $this->SubCategories->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$subCategory = $this->SubCategories->patchEntity($subCategory, $this->request->data);
|
||||||
|
$subCategory->modified_on = date('Y-m-d h:i:s');
|
||||||
|
if ($this->SubCategories->save($subCategory)) {
|
||||||
|
$this->Flash->success(__('The sub category has been saved.'));
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The sub category could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$categoriesTable = TableRegistry::get('Categories');
|
||||||
|
$categories = $categoriesTable->find('list')->where([
|
||||||
|
'Categories.status' => 1
|
||||||
|
]);
|
||||||
|
$this->set(compact('categories'));
|
||||||
|
|
||||||
|
$this->set(compact('subCategory'));
|
||||||
|
$this->set('_serialize', ['subCategory']);
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Sub Category id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
// check for Forms
|
||||||
|
$forms = [];
|
||||||
|
$formsTable = TableRegistry::get('Forms');
|
||||||
|
$forms = $formsTable->find('all')->where([
|
||||||
|
'Forms.sub_category_id' => $id
|
||||||
|
])->toArray();
|
||||||
|
|
||||||
|
if(empty($forms))
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$subCategory = $this->SubCategories->get($id);
|
||||||
|
if ($this->SubCategories->delete($subCategory)) {
|
||||||
|
$this->Flash->success(__('The sub category has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The sub category could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The sub category is assigned to a Form so could not be deleted.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
}
|
||||||
248
src/Controller/SubModulesController.php
Normal file
248
src/Controller/SubModulesController.php
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use DateTime;
|
||||||
|
use Cake\ORM\Query;
|
||||||
|
/**
|
||||||
|
* SubModules Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\SubModulesTable $SubModules
|
||||||
|
*/
|
||||||
|
class SubModulesController extends AppsController
|
||||||
|
{
|
||||||
|
public function initialize()
|
||||||
|
{
|
||||||
|
parent::initialize();
|
||||||
|
I18n::locale('en_US');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user)
|
||||||
|
{
|
||||||
|
$request_action = $this->request->params['action'];
|
||||||
|
if ($request_action == "bulkAction") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::isAuthorized($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$page_limit=10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit= $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit,
|
||||||
|
'contain' => ['Modules'],
|
||||||
|
'sortWhitelist' => [
|
||||||
|
'Modules.name', 'SubModules.created_on', 'SubModules.name', 'SubModules.modified_on', 'SubModules.id'
|
||||||
|
],
|
||||||
|
'order' => [
|
||||||
|
'SubModules.created_on' => 'desc'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
}
|
||||||
|
|
||||||
|
$sub_modules = $this->SubModules->find('all')->where([
|
||||||
|
'SubModules.name LIKE' => '%' . $search . '%'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->set('subModules', $this->paginate($sub_modules));
|
||||||
|
$this->set('_serialize', ['subModules']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
//$this->viewBuilder()->layout("master_data");
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bulkAction()
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$selectedSubModules = $this->request->data('selected_content');
|
||||||
|
$bulkAction = $this->request->data('bulk_action');
|
||||||
|
if ($bulkAction == BULK_ACTION_DELETE) {
|
||||||
|
if ($selectedSubModules == "") return $this->redirect(['action' => 'index']);
|
||||||
|
$subModulesToDelete = explode(',', $selectedSubModules);
|
||||||
|
$error = $this->deleteAll($subModulesToDelete);
|
||||||
|
if (!$error) {
|
||||||
|
$this->Flash->success(__('All the selected Submodules have been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteAll($subModules)
|
||||||
|
{
|
||||||
|
foreach ($subModules as &$subModulesWithId) {
|
||||||
|
$subModuleId = str_replace('content_', '', $subModulesWithId);
|
||||||
|
$subModule = $this->SubModules->get($subModuleId);
|
||||||
|
if ($this->canSubModuleBeDeleted($subModuleId)) {
|
||||||
|
$this->SubModules->delete($subModule);
|
||||||
|
} else {
|
||||||
|
return (__('The Submodule ' . $subModule->name . ' cannot be deleted as it contains pages'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Sub Module id.
|
||||||
|
* @return void
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$subModule = $this->SubModules->get($id, [
|
||||||
|
'contain' => ['Modules', 'Pages']
|
||||||
|
]);
|
||||||
|
$this->set('subModule', $subModule);
|
||||||
|
$this->set('_serialize', ['subModule']);
|
||||||
|
$this->viewBuilder()->layout("master_data");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$subModule = $this->SubModules->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$subModule = $this->SubModules->patchEntity($subModule, $this->request->data);
|
||||||
|
$subModuleErrors = $this->checkAndDisplayEntityErrors($subModule);
|
||||||
|
if (!$subModuleErrors) {
|
||||||
|
if ($this->SubModules->save($subModule)) {
|
||||||
|
$this->Flash->success(__('The sub module has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The sub module could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$modules = $this->SubModules->Modules->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('subModule', 'modules'));
|
||||||
|
$this->set('_serialize', ['subModule']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
//$this->viewBuilder()->layout("master_data");
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkAndDisplayEntityErrors($entity)
|
||||||
|
{
|
||||||
|
$entityErrors = $entity->errors();
|
||||||
|
foreach ($entityErrors as $key => $value) {
|
||||||
|
foreach ($entityErrors[$key] as $errorKey => $errorValue) {
|
||||||
|
$this->Flash->error($errorValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $entityErrors;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Sub Module id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$subModule = $this->SubModules->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
//pr($this->request->data);exit;
|
||||||
|
$id = $this->request->params['pass'][0];
|
||||||
|
$subModule = $this->SubModules->patchEntity($subModule, $this->request->data);
|
||||||
|
$subModule['modified_on'] = new DateTime();
|
||||||
|
$query = $this->SubModules->query();
|
||||||
|
$update = $query->update()
|
||||||
|
->set(['id' => $this->request->data['id'],'module_id'=>$this->request->data['module_id'],
|
||||||
|
'name' => $this->request->data['name'],'icon'=>$this->request->data['icon'],
|
||||||
|
'sequence'=>$this->request->data['sequence'],'controller_name'=>$this->request->data['controller_name'],
|
||||||
|
'modified_on'=>$subModule['modified_on']])
|
||||||
|
->where(['id' => $id])
|
||||||
|
->execute();
|
||||||
|
if ($update) {
|
||||||
|
$this->Flash->success(__('The sub module has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The sub module could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$modules = $this->SubModules->Modules->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('subModule', 'modules'));
|
||||||
|
$this->set('_serialize', ['subModule']);
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('sub_modules', $this->getSubModules());
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
//$this->viewBuilder()->layout("master_data");
|
||||||
|
$this->viewBuilder()->layout("custom_layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Sub Module id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$subModule = $this->SubModules->get($id);
|
||||||
|
if ($this->canSubModuleBeDeleted($id)) {
|
||||||
|
if ($this->SubModules->delete($subModule)) {
|
||||||
|
$this->Flash->success(__('The sub module has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The sub module could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Submodule cannot be deleted as it contains related pages.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function canSubModuleBeDeleted($subModuleId)
|
||||||
|
{
|
||||||
|
if ($subModuleId) {
|
||||||
|
$PagesTable = TableRegistry::get('pages');
|
||||||
|
$pages = $PagesTable->find('all')
|
||||||
|
->where(['sub_module_id' => $subModuleId]);
|
||||||
|
if (sizeof($pages->toArray()) > 0) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
165
src/Controller/UserGroupRoleAssociationController.php
Normal file
165
src/Controller/UserGroupRoleAssociationController.php
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UserGroupRoleAssociation Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\UserGroupRoleAssociationTable $UserGroupRoleAssociation
|
||||||
|
*/
|
||||||
|
class UserGroupRoleAssociationController extends AppsController {
|
||||||
|
|
||||||
|
public function initialize() {
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('UsergroupRoles');
|
||||||
|
$this->loadModel('Roles');
|
||||||
|
$this->loadModel('Usergroups');
|
||||||
|
I18n::locale('en_US');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user) {
|
||||||
|
$request_action = $this->request->params['action'];
|
||||||
|
if ($request_action == "getRoles" && $this->Auth->user()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::isAuthorized($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
|
||||||
|
if ($this->Auth->user('id') == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
$usergroups = $this->Usergroups->find('all')->where([
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$usergroups = $this->Usergroups->find('all')->where([
|
||||||
|
'company_id' => $this->Auth->user('company_id')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$userArray = [];
|
||||||
|
foreach ($usergroups as $group) {
|
||||||
|
$userArray[$group->id] = $group->group_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$roles = $this->request->data('roles');
|
||||||
|
$user_groupID = $this->request->data('user_groups');
|
||||||
|
|
||||||
|
$this->UsergroupRoles->deleteAll(['usergroup_id' => $user_groupID]);
|
||||||
|
if (!empty($roles)) {
|
||||||
|
foreach ($roles as $role) {
|
||||||
|
$entity = $this->UsergroupRoles->newEntity();
|
||||||
|
$entity->usergroup_id = $user_groupID;
|
||||||
|
$entity->role_id = $role;
|
||||||
|
if (!$this->UsergroupRoles->save($entity)) {
|
||||||
|
/* Update group users permission Version */
|
||||||
|
$cms_users = TableRegistry::get ( 'cmsuser_usergroups' )->find ('all')->where ( [
|
||||||
|
'usergroup_id' => $user_groupID
|
||||||
|
] );
|
||||||
|
|
||||||
|
foreach ( $cms_users as $user ) {
|
||||||
|
$user_id = $user->cms_user_id;
|
||||||
|
$current_permission_version = TableRegistry::get ( 'cmsusers' )->get ( $user_id )->permission_version;
|
||||||
|
if ($current_permission_version == "999") {
|
||||||
|
$current_permission_version = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = TableRegistry::get ( 'cmsusers' )->query ();
|
||||||
|
$query->update ()->set ( [
|
||||||
|
'permission_version' => $current_permission_version + 1
|
||||||
|
] )->where ( [
|
||||||
|
'id' => $user_id
|
||||||
|
] )->execute ();
|
||||||
|
}
|
||||||
|
/* end group users permission Version*/
|
||||||
|
$this->Flash->error(__('The roles could not be associated. Please, try again.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->Flash->success(__('The roles has been associated to the user group.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->success(__('The roles has been deleted from the user group.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('user_groups', $userArray);
|
||||||
|
//$this->viewBuilder()->layout('usergroup_management');
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('page_list', $this->getPages());
|
||||||
|
$this->viewBuilder()->layout('custom_layout');
|
||||||
|
$nav_arr[0] = array('action'=>'add','page_id'=>'3056','icon'=>'<i class="fa fa-plus-circle"></i>','label'=>'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRoles($userGroupID) {
|
||||||
|
|
||||||
|
$this->viewBuilder()->layout(false);
|
||||||
|
|
||||||
|
if ($this->Auth->user('company_id') == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
|
||||||
|
$company_id_of_userGroupID = TableRegistry::get('usergroups')->find('all')
|
||||||
|
->select(['company_id'])->where(['id' => $userGroupID])->toArray();
|
||||||
|
|
||||||
|
$com_id = $company_id_of_userGroupID[0]->company_id;
|
||||||
|
} else {
|
||||||
|
$com_id = $this->Auth->user('company_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
//exit();
|
||||||
|
|
||||||
|
$selectedRoles = $this->UsergroupRoles->find('all')->where([
|
||||||
|
'usergroup_id' => $userGroupID
|
||||||
|
]);
|
||||||
|
|
||||||
|
$selectedRoleIDs = [];
|
||||||
|
foreach ($selectedRoles as $role) {
|
||||||
|
array_push($selectedRoleIDs, $role->role_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($selectedRoleIDs)) {
|
||||||
|
$selectedRoles = $this->Roles->find('all')->where([
|
||||||
|
'id IN' => $selectedRoleIDs,
|
||||||
|
'company_id' => $com_id
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$selectedRoles = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$roles = [];
|
||||||
|
if (!empty($selectedRoleIDs)) {
|
||||||
|
|
||||||
|
$roles = $this->Roles->find('all')->where([
|
||||||
|
'company_id' => $com_id,
|
||||||
|
'id NOT IN' => $selectedRoleIDs
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$roles = $this->Roles->find('all')->where([
|
||||||
|
'company_id' => $com_id
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->log($roles);
|
||||||
|
$jsonObject = [
|
||||||
|
'selected_roles' => $selectedRoles,
|
||||||
|
'available_roles' => $roles
|
||||||
|
];
|
||||||
|
|
||||||
|
echo json_encode($jsonObject);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
353
src/Controller/UsergroupsController.php
Normal file
353
src/Controller/UsergroupsController.php
Normal file
@@ -0,0 +1,353 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Cake\I18n\I18n;
|
||||||
|
use Cake\ORM\TableRegistry;
|
||||||
|
use ModuleConstants;
|
||||||
|
use PagesConstants;
|
||||||
|
use SubModuleConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Usergroups Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\UsergroupsTable $Usergroups
|
||||||
|
*/
|
||||||
|
class UsergroupsController extends AppsController {
|
||||||
|
|
||||||
|
public function initialize() {
|
||||||
|
parent::initialize();
|
||||||
|
$this->loadModel('Cmsusers');
|
||||||
|
I18n::locale('en_US');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isAuthorized($user) {
|
||||||
|
$request_action = $this->request->params['action'];
|
||||||
|
if ($request_action == "bulkAction") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return parent::isAuthorized($user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
$page_limit=10;
|
||||||
|
if (isset($this->request->query['page_limit'])) {
|
||||||
|
$page_limit= $this->request->query('page_limit');
|
||||||
|
}
|
||||||
|
$this->paginate = [
|
||||||
|
'limit' => $page_limit
|
||||||
|
];
|
||||||
|
|
||||||
|
$search = '';
|
||||||
|
if (isset($this->request->query['search'])) {
|
||||||
|
$search = $this->request->query('search');
|
||||||
|
}
|
||||||
|
if ($this->Auth->user('id') == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
$usergroups = $this->Usergroups->find('all')->where([
|
||||||
|
'group_name LIKE' => '%' . $search . '%',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$usergroups = $this->Usergroups->find('all')->where([
|
||||||
|
'group_name LIKE' => '%' . $search . '%',
|
||||||
|
'company_id' => $this->Auth->user('company_id')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('searchText', $search);
|
||||||
|
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||||
|
$this->set('usergroups', $this->paginate($usergroups));
|
||||||
|
$this->set('_serialize', ['usergroups']);
|
||||||
|
//$this->viewBuilder()->layout('usergroup_management');
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$this->set('module_pages', $this->getPages());
|
||||||
|
$this->set('page_list', $this->getPages());
|
||||||
|
$this->set('page_limit', $page_limit);
|
||||||
|
$nav_arr[0] = array('action'=>'add','page_id'=>'3066','icon'=>'<i class="fa fa-plus-circle"></i>','label'=>'Add');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout('custom_layout');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id Usergroup id.
|
||||||
|
* @return void
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null) {
|
||||||
|
$usergroup = $this->Usergroups->get($id, [
|
||||||
|
'contain' => ['Companies', 'UsergroupRoles']
|
||||||
|
]);
|
||||||
|
$this->set('usergroup', $usergroup);
|
||||||
|
$this->set('_serialize', ['usergroup']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add() {
|
||||||
|
$user_group = $this->Usergroups->newEntity();
|
||||||
|
$table_user_groups_user = TableRegistry::get("CmsuserUsergroups");
|
||||||
|
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
|
||||||
|
$user_group = $this->Usergroups->patchEntity($user_group, $this->request->data);
|
||||||
|
$user_group->status = STATUS_ACTIVE;
|
||||||
|
$user_group->created_on = date('Y-m-d H:i:s');
|
||||||
|
$user_group->modified_on = date('Y-m-d H:i:s');
|
||||||
|
$user_group->company_id = $this->Auth->user('company_id');
|
||||||
|
|
||||||
|
if ($this->Usergroups->save($user_group)) {
|
||||||
|
|
||||||
|
$users = $this->request->data('cmsusers');
|
||||||
|
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$entity = $table_user_groups_user->newEntity();
|
||||||
|
$entity->cms_user_id = $user;
|
||||||
|
$entity->usergroup_id = $user_group->id;
|
||||||
|
$table_user_groups_user->save($entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->Flash->success(__('The User Group has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$errors = $user_group->errors();
|
||||||
|
if ($errors['group_name']) {
|
||||||
|
$this->Flash->error($errors['group_name']['valid']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The User Group could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$usersIDS = $table_user_groups_user->find('all')->select('cms_user_id');
|
||||||
|
|
||||||
|
if ($this->Auth->user('company_id') == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
$users = $this->Cmsusers->find('all')->where([
|
||||||
|
'id NOT IN' => $usersIDS
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$users = $this->Cmsusers->find('all')->where([
|
||||||
|
'id NOT IN' => $usersIDS,
|
||||||
|
'company_id' => $this->Auth->user('company_id')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo "<pre>";
|
||||||
|
// print_r($usersIDS);
|
||||||
|
// echo "<pre>";
|
||||||
|
// exit();
|
||||||
|
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('users', $users);
|
||||||
|
$this->set(compact('user_group'));
|
||||||
|
$this->set('_serialize', ['user_group']);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$nav_arr[0] = array('action'=>'index','page_id'=>'3045','icon'=>'<i class="fa fa-list"></i>','label'=>'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout('custom_layout');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id Usergroup id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null) {
|
||||||
|
$usergroup = $this->Usergroups->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
|
||||||
|
$table_user_groups_user = TableRegistry::get("CmsuserUsergroups");
|
||||||
|
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
|
||||||
|
|
||||||
|
if ($usergroup->group_name != trim($this->request->data['group_name'])) {
|
||||||
|
$usergroup = $this->Usergroups->patchEntity($usergroup, $this->request->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->Usergroups->save($usergroup)) {
|
||||||
|
|
||||||
|
$users = $this->request->data('cmsusers');
|
||||||
|
$table_user_groups_user->deleteAll(['usergroup_id' => $id]);
|
||||||
|
if (!empty($users)) {
|
||||||
|
foreach ($users as $user) {
|
||||||
|
$entity = $table_user_groups_user->newEntity();
|
||||||
|
$entity->cms_user_id = $user;
|
||||||
|
$entity->usergroup_id = $usergroup->id;
|
||||||
|
$table_user_groups_user->save($entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->Flash->success(__('The usergroup has been updated.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The usergroup could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$user_permissions = $this->request->session()->read('user_permissions');
|
||||||
|
|
||||||
|
$usersIDS = $table_user_groups_user->find('all')->select('cms_user_id');
|
||||||
|
|
||||||
|
if ($this->Auth->user('company_id') == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
$users = $this->Cmsusers->find('all',array('order'=>array('email'=>'asc')))->where([
|
||||||
|
'id NOT IN' => $usersIDS
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$users = $this->Cmsusers->find('all',array('order'=>array('email'=>'asc')))->where([
|
||||||
|
'id NOT IN' => $usersIDS,
|
||||||
|
'company_id' => $this->Auth->user('company_id')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$selectedusers = $usersIDS = $table_user_groups_user->find('all')->where(['usergroup_id' => $id])->toArray();
|
||||||
|
|
||||||
|
$selectedUserIDs = array();
|
||||||
|
if (!empty($selectedusers)) {
|
||||||
|
foreach ($selectedusers as $uid) {
|
||||||
|
array_push($selectedUserIDs, $uid->cms_user_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($selectedUserIDs)) {
|
||||||
|
if ($this->Auth->user('company_id') == SUPER_SUPER_ADMIN_ID) {
|
||||||
|
$selectedusers = $this->Cmsusers->find('all',array('order'=>array('email'=>'asc')))->where([
|
||||||
|
'id IN' => $selectedUserIDs
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
$selectedusers = $this->Cmsusers->find('all',array('order'=>array('email'=>'asc')))->where([
|
||||||
|
'id IN' => $selectedUserIDs,
|
||||||
|
'company_id' => $this->Auth->user('company_id')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set('user_permission', $user_permissions);
|
||||||
|
$this->set('users', $users);
|
||||||
|
$this->set('selectedusers', $selectedusers);
|
||||||
|
$this->set(compact('usergroup', 'companies'));
|
||||||
|
$this->set('_serialize', ['usergroup']);
|
||||||
|
$this->set('current_module', $this->getModules());
|
||||||
|
$nav_arr[0] = array('action'=>'index','page_id'=>'3045','icon'=>'<i class="fa fa-list"></i>','label'=>'List');
|
||||||
|
$this->set('nav_arr', $nav_arr);
|
||||||
|
$this->viewBuilder()->layout('custom_layout');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id Usergroup id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null) {
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$usergroup = $this->Usergroups->get($id, [
|
||||||
|
'contain' => ['CmsuserUsergroups', 'UsergroupRoles']
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (empty($usergroup->cmsuser_usergroups)) {
|
||||||
|
if (empty($usergroup->usergroup_roles)) {
|
||||||
|
|
||||||
|
if ($this->Usergroups->delete($usergroup)) {
|
||||||
|
$this->Flash->success(__('The Usergroup has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Usergroup could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Usergroup is associated with roles, so could not be deleted.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The Usergroup contains users so could not be deleted.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bulkAction() {
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$selectedUsergroups = $this->request->data('selected_content');
|
||||||
|
$bulkAction = $this->request->data('bulk_action');
|
||||||
|
|
||||||
|
if ($bulkAction == BULK_ACTION_DELETE) {
|
||||||
|
if ($selectedUsergroups == "")
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
$usergroupsToDelete = explode(',', $selectedUsergroups);
|
||||||
|
$error = $this->deleteAll($usergroupsToDelete);
|
||||||
|
if (!$error) {
|
||||||
|
$this->Flash->success(__('All the selected usergroups has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error($error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function deleteAll($usergroups) {
|
||||||
|
foreach ($usergroups as &$usergroupID) {
|
||||||
|
$usergroupID = str_replace('content_', '', $usergroupID);
|
||||||
|
|
||||||
|
$usergroup = $this->Usergroups->get($usergroupID, [
|
||||||
|
'contain' => ['CmsuserUsergroups', 'UsergroupRoles']
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (empty($usergroup->cmsuser_usergroups)) {
|
||||||
|
if (empty($usergroup->usergroup_roles)) {
|
||||||
|
|
||||||
|
if (!$this->Usergroups->delete($usergroup)) {
|
||||||
|
return (__('The Usergroup' . $usergroup->group_name . ' could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (__('The Usergroup ' . $usergroup->group_name . ' is associated with roles, so could not be deleted.'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (__('The Usergroup ' . $usergroup->group_name . ' contains users so could not be deleted.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getModules()
|
||||||
|
{
|
||||||
|
return array('Access Control' =>'1003');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubModules()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'User Management' => '2050',
|
||||||
|
'Role Management' =>'2051',
|
||||||
|
'User Group Management' =>'2052',
|
||||||
|
'User Group & Role Association' =>'2053',
|
||||||
|
'Role & Page Association' => '2054'
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getPages() {
|
||||||
|
return array(
|
||||||
|
'index' => '3065',
|
||||||
|
'add' =>'3066',
|
||||||
|
'edit' =>'3067',
|
||||||
|
'delete' => '3068'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
127
src/Controller/UsersController.php
Normal file
127
src/Controller/UsersController.php
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use App\Controller\AppsController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Users Controller
|
||||||
|
*
|
||||||
|
* @property \App\Model\Table\UsersTable $Users
|
||||||
|
*/
|
||||||
|
class UsersController extends AppsController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->paginate = [
|
||||||
|
'contain' => ['Socials']
|
||||||
|
];
|
||||||
|
$this->set('users', $this->paginate($this->Users));
|
||||||
|
$this->set('_serialize', ['users']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View method
|
||||||
|
*
|
||||||
|
* @param string|null $id User id.
|
||||||
|
* @return void
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function view($id = null)
|
||||||
|
{
|
||||||
|
$user = $this->Users->get($id, [
|
||||||
|
'contain' => ['Socials', 'ApiTokens', 'Collections', 'ContentCommentLikes', 'ContentCommentReports', 'ContentComments', 'ContentCommentsCopy', 'ContentLikes', 'FriendInvitations', 'LogEvents', 'PaymentReceipts', 'StarActivities', 'TokenTransactions', 'UnlockingAbilityChangeHistories', 'UnlockingActivities']
|
||||||
|
]);
|
||||||
|
$this->set('user', $user);
|
||||||
|
$this->set('_serialize', ['user']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add method
|
||||||
|
*
|
||||||
|
* @return void Redirects on successful add, renders view otherwise.
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
$user = $this->Users->newEntity();
|
||||||
|
if ($this->request->is('post')) {
|
||||||
|
$user = $this->Users->patchEntity($user, $this->request->data);
|
||||||
|
if ($this->Users->save($user)) {
|
||||||
|
$this->Flash->success(__('The user has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The user could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$socials = $this->Users->Socials->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('user', 'socials'));
|
||||||
|
$this->set('_serialize', ['user']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit method
|
||||||
|
*
|
||||||
|
* @param string|null $id User id.
|
||||||
|
* @return void Redirects on successful edit, renders view otherwise.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function edit($id = null)
|
||||||
|
{
|
||||||
|
$user = $this->Users->get($id, [
|
||||||
|
'contain' => []
|
||||||
|
]);
|
||||||
|
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||||
|
$user = $this->Users->patchEntity($user, $this->request->data);
|
||||||
|
if ($this->Users->save($user)) {
|
||||||
|
$this->Flash->success(__('The user has been saved.'));
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The user could not be saved. Please, try again.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$socials = $this->Users->Socials->find('list', ['limit' => 200]);
|
||||||
|
$this->set(compact('user', 'socials'));
|
||||||
|
$this->set('_serialize', ['user']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete method
|
||||||
|
*
|
||||||
|
* @param string|null $id User id.
|
||||||
|
* @return \Cake\Network\Response|null Redirects to index.
|
||||||
|
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||||
|
*/
|
||||||
|
public function delete($id = null)
|
||||||
|
{
|
||||||
|
$this->request->allowMethod(['post', 'delete']);
|
||||||
|
$user = $this->Users->get($id);
|
||||||
|
if ($this->Users->delete($user)) {
|
||||||
|
$this->Flash->success(__('The user has been deleted.'));
|
||||||
|
} else {
|
||||||
|
$this->Flash->error(__('The user could not be deleted. Please, try again.'));
|
||||||
|
}
|
||||||
|
return $this->redirect(['action' => 'index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModules()
|
||||||
|
{
|
||||||
|
// TODO: Implement getModules() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSubModules()
|
||||||
|
{
|
||||||
|
// TODO: Implement getSubModules() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPages()
|
||||||
|
{
|
||||||
|
// TODO: Implement getPages() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
39
src/Error/AppExceptionRenderer.php
Normal file
39
src/Error/AppExceptionRenderer.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Error;
|
||||||
|
|
||||||
|
use Cake\Error\ExceptionRenderer;
|
||||||
|
use Cake\Http\Exception\NotFoundException;
|
||||||
|
use Cake\Routing\Exception\MissingControllerException;
|
||||||
|
use Cake\View\Exception\MissingTemplateException;
|
||||||
|
use Cake\Controller\Exception\MissingActionException;
|
||||||
|
|
||||||
|
class AppExceptionRenderer extends ExceptionRenderer
|
||||||
|
{
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
// Handle missing controller or other not found errors
|
||||||
|
if (
|
||||||
|
$this->error instanceof MissingControllerException ||
|
||||||
|
$this->error instanceof NotFoundException ||
|
||||||
|
$this->error instanceof MissingTemplateException||
|
||||||
|
$this->error instanceof MissingActionException
|
||||||
|
) {
|
||||||
|
return $this->_renderCustom404();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::render();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _renderCustom404()
|
||||||
|
{
|
||||||
|
$this->controller->response = $this->controller->response->withStatus(404);
|
||||||
|
|
||||||
|
$this->controller->viewBuilder()
|
||||||
|
->layout(false)
|
||||||
|
->templatePath('Error')
|
||||||
|
->template('custom_404');
|
||||||
|
|
||||||
|
return $this->_outputMessage('custom_404');
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
src/Locale/en_US/default.mo
Normal file
BIN
src/Locale/en_US/default.mo
Normal file
Binary file not shown.
2
src/Locale/en_US/default.po
Normal file
2
src/Locale/en_US/default.po
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
msgid "Letter Set"
|
||||||
|
msgstr "Letter Set"
|
||||||
BIN
src/Locale/ja_JP/default.mo
Normal file
BIN
src/Locale/ja_JP/default.mo
Normal file
Binary file not shown.
285
src/Locale/ja_JP/default.po
Normal file
285
src/Locale/ja_JP/default.po
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"POT-Creation-Date: \n"
|
||||||
|
"PO-Revision-Date: \n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=iso-8859-1\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: ja_JP\n"
|
||||||
|
"X-Generator: Poedit 1.8.5\n"
|
||||||
|
|
||||||
|
msgid "NICKNAME_NOT_SENT_CODE"
|
||||||
|
msgstr "Nickname is required"
|
||||||
|
|
||||||
|
msgid "EMAIL_ALREADY_EXIST_IN_SYSTEM"
|
||||||
|
msgstr "Email already exist in system"
|
||||||
|
|
||||||
|
msgid "USER_COULD_NOT_REGISTERED_CODE"
|
||||||
|
msgstr "User could not be registered"
|
||||||
|
|
||||||
|
msgid "USER_NOT_FOUND_CODE"
|
||||||
|
msgstr "ç»é²ãããªãã£ãæç§°ã§ãã"
|
||||||
|
|
||||||
|
msgid "LOG_INSERTION_FAILED_CODE"
|
||||||
|
msgstr "Log insertion failed"
|
||||||
|
|
||||||
|
msgid "USER_ID_IS_REQUIRED_CODE"
|
||||||
|
msgstr "User id required"
|
||||||
|
|
||||||
|
msgid "VALID_EMAIL_IS_REQUIRED_CODE"
|
||||||
|
msgstr "Please use a valid email address"
|
||||||
|
|
||||||
|
msgid "SOCIAL_ID_REQUIRED_CODE"
|
||||||
|
msgstr "Social is required"
|
||||||
|
|
||||||
|
msgid "PASSWORD_IS_REQUIRED_CODE"
|
||||||
|
msgstr "Password is required"
|
||||||
|
|
||||||
|
msgid "IS_REC_MARKETING_EMAIL_CODE"
|
||||||
|
msgstr "The field is_rec_marketing_email must be either '1' OR '0'"
|
||||||
|
|
||||||
|
msgid "USER_TYPE_REQUIRED_CODE"
|
||||||
|
msgstr "User_type value is not correct"
|
||||||
|
|
||||||
|
msgid "API_TOKEN_NOT_SET_CODE"
|
||||||
|
msgstr "api_token has not been sent"
|
||||||
|
|
||||||
|
msgid "PLATFORM_FIELD_REQUIRED_CODE"
|
||||||
|
msgstr "Platform field is required"
|
||||||
|
|
||||||
|
msgid "UDID_FIELD_REQUIRED_CODE"
|
||||||
|
msgstr "udid field is required"
|
||||||
|
|
||||||
|
msgid "INPUT_DATA_NOT_FOUND_CODE"
|
||||||
|
msgstr "Input data not found"
|
||||||
|
|
||||||
|
msgid "INPUT_DATA_KEY_NAME_NOT_CORRECT_CODE"
|
||||||
|
msgstr "Required input data key name is not correct or not sent"
|
||||||
|
|
||||||
|
msgid "INPUT_DATA_VALUE_FOUND_EMPTY_CODE"
|
||||||
|
msgstr "Required input value found empty"
|
||||||
|
|
||||||
|
msgid "TOKEN_GENERATION_FAIL_CODE"
|
||||||
|
msgstr "API token generation failed"
|
||||||
|
|
||||||
|
msgid "USER_TOKEN_UPDATE_FAIL_CODE"
|
||||||
|
msgstr "User's token update failed"
|
||||||
|
|
||||||
|
msgid "VALID_IMAGE_IS_REQUIRED"
|
||||||
|
msgstr "Valid image is required.Image upload failed."
|
||||||
|
|
||||||
|
msgid "IMAGE_SIZE_EXCEED_MAX_LIMIT"
|
||||||
|
msgstr "Image size exceed maximum allowed limit"
|
||||||
|
|
||||||
|
msgid "NICK_NAME_ALREADY_EXIST"
|
||||||
|
msgstr "éè¤ãããããã¯ãã¼ã ãåå¨ãã¾ã"
|
||||||
|
|
||||||
|
msgid "API_TOKEN_NOT_VALID"
|
||||||
|
msgstr "API token is not valid"
|
||||||
|
|
||||||
|
msgid "API_TOKEN_IS_EXPIRED"
|
||||||
|
msgstr "API token has benn expired already"
|
||||||
|
|
||||||
|
msgid "USER_ACCOUNT_NOT_ACTIVATED_YET"
|
||||||
|
msgstr "Account is not activated yet"
|
||||||
|
|
||||||
|
msgid "PIN_IS_NOT_VALID"
|
||||||
|
msgstr "å
¥åããã³ã¼ããåããªãã§ãã åã³è©¦ã¿ã¦ãã ãã"
|
||||||
|
|
||||||
|
msgid "INVALID_LANGUAGE_CODE_SENT"
|
||||||
|
msgstr "Language code is not valid"
|
||||||
|
|
||||||
|
msgid "NICKNAME_LENGTH_AND_ENLGIH_CODE"
|
||||||
|
msgstr "ããã¯ãã¼ã ã¯è±æ2~16è
ã§å
¥åãã¦ãã ããã"
|
||||||
|
|
||||||
|
msgid "PASSWORD_LENGTH_AND_ALPHANUMERIC_CODE"
|
||||||
|
msgstr "æè¨¼çªå·ã¯ãè±å¤§æåã»å°æåãæ°åã®8~12è
ã§å
¥åãã¦ãã ããã"
|
||||||
|
|
||||||
|
msgid "NICKNAME_IS_NOT_REGISTERED_CODE"
|
||||||
|
msgstr "Nickname is not registered"
|
||||||
|
|
||||||
|
msgid "NICKNAME_AND_PASSWORD_DONT_MATCH_CODE"
|
||||||
|
msgstr "ããã¯ãã¼ã ã¨ãã¹ã¯ã¼ããä¸è´ãã¾ããã"
|
||||||
|
|
||||||
|
msgid "EMAIL_IS_NOT_REGISTERED_CODE"
|
||||||
|
msgstr "å å
¥ãã¦ããªãã¡ã¼ã«ã§ãã ããä¸åº¦ç¢ºèªããé¡ããã¾ãã"
|
||||||
|
|
||||||
|
msgid "VERIFICATION_EMAIL_HAS_BEEN_SENT_REGISTRATION_CODE"
|
||||||
|
msgstr "å
¥åãã¦ããã ããã¡ã¼ã«ã§ãã¹ã¯ã¼ãæ
å ±ãéãã¾ããã"
|
||||||
|
|
||||||
|
msgid "VERIFICATION_EMAIL_HAS_BEEN_SENT_FORGOT_PASS_CODE"
|
||||||
|
msgstr "Verification e-mail has been sent to your e-mail.Please follow the instructions in the e-mail to retrieve your account"
|
||||||
|
|
||||||
|
msgid "PIN_IS_EXPIRED_CODE"
|
||||||
|
msgstr "Pin is expired"
|
||||||
|
|
||||||
|
msgid "UNKNOWN_ERROR_CODE"
|
||||||
|
msgstr "Exception occurred or unknown error"
|
||||||
|
|
||||||
|
msgid "Email"
|
||||||
|
msgstr "メール"
|
||||||
|
|
||||||
|
msgid "Password"
|
||||||
|
msgstr "パスワード"
|
||||||
|
|
||||||
|
msgid "Login"
|
||||||
|
msgstr "ログイン"
|
||||||
|
|
||||||
|
msgid "Forgot your password?"
|
||||||
|
msgstr "パスワードをお忘れですか?"
|
||||||
|
|
||||||
|
msgid "login_err_msg"
|
||||||
|
msgstr "間違ったユーザー名またはパスワード。もう一度やり直してください"
|
||||||
|
|
||||||
|
msgid "Reset Password"
|
||||||
|
msgstr "パスワードのリセット"
|
||||||
|
|
||||||
|
msgid "forgot_password_desc"
|
||||||
|
msgstr "あなたがログインするために使用するメールアドレスを入力してください"
|
||||||
|
|
||||||
|
msgid "forgot_password_err"
|
||||||
|
msgstr "あなたが入力した電子メールIDは、私たちと一緒に登録されていません。もう一度やり直してください。"
|
||||||
|
|
||||||
|
msgid "forgot_password_success"
|
||||||
|
msgstr "電子メールは正常にパスワードをリセットするための命令を使用して電子メールに送信されました。"
|
||||||
|
|
||||||
|
msgid "new_password"
|
||||||
|
msgstr "新しいパスワードを入力"
|
||||||
|
|
||||||
|
msgid "re_new_password"
|
||||||
|
msgstr "新しいパスワード再入力"
|
||||||
|
|
||||||
|
msgid "reset_password_btn"
|
||||||
|
msgstr "パスワードのリセット"
|
||||||
|
|
||||||
|
msgid "reset_password_error"
|
||||||
|
msgstr "無効なリンク。あなたのパスワードをリセットしたい場合は、{0}ここに</a>をクリックしてください。"
|
||||||
|
|
||||||
|
msgid "reset_password_success"
|
||||||
|
msgstr "パスワードが正常にリセットされています。新しいパスワードを使用してログインしてください。"
|
||||||
|
|
||||||
|
msgid "next_btn"
|
||||||
|
msgstr "次"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_KR"
|
||||||
|
msgstr "タイトル韓国"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_EN"
|
||||||
|
msgstr "タイトル英語"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_JP"
|
||||||
|
msgstr "タイトル日本語"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_CN"
|
||||||
|
msgstr "タイトル中国"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_KR"
|
||||||
|
msgstr "韓国語"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_EN"
|
||||||
|
msgstr "英語"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_JP"
|
||||||
|
msgstr "日本語"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_CN"
|
||||||
|
msgstr "中国語"
|
||||||
|
|
||||||
|
msgid "CONTENT_PAGE_HEADING"
|
||||||
|
msgstr "リスト"
|
||||||
|
|
||||||
|
msgid "CONTENT_SUBJECT"
|
||||||
|
msgstr "被験者"
|
||||||
|
|
||||||
|
msgid "CONTENT_AUTHOR"
|
||||||
|
msgstr "著者"
|
||||||
|
|
||||||
|
msgid "CONTENT_CATEGORY"
|
||||||
|
msgstr "カテゴリ"
|
||||||
|
|
||||||
|
msgid "CONTENT_TAGS"
|
||||||
|
msgstr "タグ"
|
||||||
|
|
||||||
|
msgid "CONTENT_LANGUAGE"
|
||||||
|
msgstr "言語"
|
||||||
|
|
||||||
|
msgid "CONTENT_COMMENTS"
|
||||||
|
msgstr "注釈"
|
||||||
|
|
||||||
|
msgid "CONTENT_PUBLISH_DATE"
|
||||||
|
msgstr "日付"
|
||||||
|
|
||||||
|
msgid "CONTENT_THUMBNAIL"
|
||||||
|
msgstr "サムネイル"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_ALL"
|
||||||
|
msgstr "すべて"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_PUBLISHED"
|
||||||
|
msgstr "公開されました"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_SEEZURE"
|
||||||
|
msgstr "発作"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_INDIVIDUAL"
|
||||||
|
msgstr "個々の記事"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_TRASH"
|
||||||
|
msgstr "ごみ"
|
||||||
|
|
||||||
|
msgid "CONTENT_SEARCH_BTN"
|
||||||
|
msgstr "記事を探します"
|
||||||
|
|
||||||
|
msgid "CONTENT_APPLICATION_BTN"
|
||||||
|
msgstr "アプリケーション"
|
||||||
|
|
||||||
|
msgid "CONTENT_FILTER_BTN"
|
||||||
|
msgstr "フィルタ"
|
||||||
|
|
||||||
|
msgid "NEXT_BTN"
|
||||||
|
msgstr "Next"
|
||||||
|
|
||||||
|
msgid "COUNTDOWN_TITLE"
|
||||||
|
msgstr "Mobile App Content Countdown"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_COUNTDOWN_ACTIVATE"
|
||||||
|
msgstr "COUNTDOWN ACTIVATED"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_COUNTDOWN_DESC"
|
||||||
|
msgstr "It displays the countdown to the mobile content."
|
||||||
|
|
||||||
|
msgid "COUNTDOWN_END"
|
||||||
|
msgstr "End Date"
|
||||||
|
|
||||||
|
msgid "COUNTDOWN_END_DESC"
|
||||||
|
msgstr "Set the end date countdown. Mobile content, and displays the remaining time,until end date"
|
||||||
|
|
||||||
|
msgid "COUNTDOWN"
|
||||||
|
msgstr "Countdown"
|
||||||
|
|
||||||
|
msgid "DAYS"
|
||||||
|
msgstr "Days"
|
||||||
|
|
||||||
|
msgid "HOURS"
|
||||||
|
msgstr "Hours"
|
||||||
|
|
||||||
|
msgid "MINUTES"
|
||||||
|
msgstr "Minutes"
|
||||||
|
|
||||||
|
msgid "SECONDS"
|
||||||
|
msgstr "Seconds"
|
||||||
|
|
||||||
|
msgid "YOUKU_ADDRESS"
|
||||||
|
msgstr "Youku Iframe Address"
|
||||||
|
|
||||||
|
msgid "YOUKU_LABEL"
|
||||||
|
msgstr "Youku Iframe Address"
|
||||||
|
|
||||||
|
msgid "FROM_DATE"
|
||||||
|
msgstr "From Date"
|
||||||
|
|
||||||
|
msgid "TO_DATE"
|
||||||
|
msgstr "To Date"
|
||||||
BIN
src/Locale/ko_KP/default.mo
Normal file
BIN
src/Locale/ko_KP/default.mo
Normal file
Binary file not shown.
287
src/Locale/ko_KP/default.po
Normal file
287
src/Locale/ko_KP/default.po
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"POT-Creation-Date: \n"
|
||||||
|
"PO-Revision-Date: \n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: ko_KP\n"
|
||||||
|
"X-Generator: Poedit 1.8.5\n"
|
||||||
|
|
||||||
|
msgid "NICKNAME_NOT_SENT_CODE"
|
||||||
|
msgstr "Nickname is required"
|
||||||
|
|
||||||
|
msgid "EMAIL_ALREADY_EXIST_IN_SYSTEM"
|
||||||
|
msgstr "Email already exist in system"
|
||||||
|
|
||||||
|
msgid "USER_COULD_NOT_REGISTERED_CODE"
|
||||||
|
msgstr "User could not be registered"
|
||||||
|
|
||||||
|
msgid "USER_NOT_FOUND_CODE"
|
||||||
|
msgstr "등록되지 않은 닉네임입니다. "
|
||||||
|
|
||||||
|
msgid "LOG_INSERTION_FAILED_CODE"
|
||||||
|
msgstr "Log insertion failed"
|
||||||
|
|
||||||
|
msgid "USER_ID_IS_REQUIRED_CODE"
|
||||||
|
msgstr "User id required"
|
||||||
|
|
||||||
|
msgid "VALID_EMAIL_IS_REQUIRED_CODE"
|
||||||
|
msgstr "올바른 이메일 형식을 입력해주세요. "
|
||||||
|
|
||||||
|
msgid "SOCIAL_ID_REQUIRED_CODE"
|
||||||
|
msgstr "Social is required"
|
||||||
|
|
||||||
|
msgid "PASSWORD_IS_REQUIRED_CODE"
|
||||||
|
msgstr "Password is required"
|
||||||
|
|
||||||
|
msgid "IS_REC_MARKETING_EMAIL_CODE"
|
||||||
|
msgstr "The field is_rec_marketing_email must be either '1' OR '0'"
|
||||||
|
|
||||||
|
msgid "USER_TYPE_REQUIRED_CODE"
|
||||||
|
msgstr "User_type value is not correct"
|
||||||
|
|
||||||
|
msgid "API_TOKEN_NOT_SET_CODE"
|
||||||
|
msgstr "api_token has not been sent"
|
||||||
|
|
||||||
|
msgid "PLATFORM_FIELD_REQUIRED_CODE"
|
||||||
|
msgstr "Platform field is required"
|
||||||
|
|
||||||
|
msgid "UDID_FIELD_REQUIRED_CODE"
|
||||||
|
msgstr "udid field is required"
|
||||||
|
|
||||||
|
msgid "INPUT_DATA_NOT_FOUND_CODE"
|
||||||
|
msgstr "Input data not found"
|
||||||
|
|
||||||
|
msgid "INPUT_DATA_KEY_NAME_NOT_CORRECT_CODE"
|
||||||
|
msgstr "Required input data key name is not correct or not sent"
|
||||||
|
|
||||||
|
msgid "INPUT_DATA_VALUE_FOUND_EMPTY_CODE"
|
||||||
|
msgstr "Required input value found empty"
|
||||||
|
|
||||||
|
msgid "TOKEN_GENERATION_FAIL_CODE"
|
||||||
|
msgstr "API token generation failed"
|
||||||
|
|
||||||
|
msgid "USER_TOKEN_UPDATE_FAIL_CODE"
|
||||||
|
msgstr "User's token update failed"
|
||||||
|
|
||||||
|
msgid "VALID_IMAGE_IS_REQUIRED"
|
||||||
|
msgstr "Valid image is required.Image upload failed."
|
||||||
|
|
||||||
|
msgid "IMAGE_SIZE_EXCEED_MAX_LIMIT"
|
||||||
|
msgstr "Image size exceed maximum allowed limit"
|
||||||
|
|
||||||
|
msgid "NICK_NAME_ALREADY_EXIST"
|
||||||
|
msgstr "중복된 닉네임이 존재합니다."
|
||||||
|
|
||||||
|
msgid "API_TOKEN_NOT_VALID"
|
||||||
|
msgstr "API token is not valid"
|
||||||
|
|
||||||
|
msgid "API_TOKEN_IS_EXPIRED"
|
||||||
|
msgstr "API token has benn expired already"
|
||||||
|
|
||||||
|
msgid "USER_ACCOUNT_NOT_ACTIVATED_YET"
|
||||||
|
msgstr "Account is not activated yet"
|
||||||
|
|
||||||
|
msgid "PIN_IS_NOT_VALID"
|
||||||
|
msgstr "입력하신 코드가 맞지 않습니다. 다시 시도해 주세요."
|
||||||
|
|
||||||
|
msgid "INVALID_LANGUAGE_CODE_SENT"
|
||||||
|
msgstr "Language code is not valid"
|
||||||
|
|
||||||
|
msgid "NICKNAME_LENGTH_AND_ENLGIH_CODE"
|
||||||
|
msgstr "닉네임은 영문2~16자로 입력해주세요. "
|
||||||
|
|
||||||
|
msgid "PASSWORD_LENGTH_AND_ALPHANUMERIC_CODE"
|
||||||
|
msgstr "비밀번호는 영문 대소문자, 숫자 조합 8~12자로 입력해주세요. "
|
||||||
|
|
||||||
|
msgid "NICKNAME_IS_NOT_REGISTERED_CODE"
|
||||||
|
msgstr "Nickname is not registered"
|
||||||
|
|
||||||
|
msgid "NICKNAME_AND_PASSWORD_DONT_MATCH_CODE"
|
||||||
|
msgstr "닉네임과 비밀번호가 일치하지 않습니다. "
|
||||||
|
|
||||||
|
msgid "EMAIL_IS_NOT_REGISTERED_CODE"
|
||||||
|
msgstr "가입되지 않은 이메일입니다. 다시 확인해 주세요."
|
||||||
|
|
||||||
|
msgid "VERIFICATION_EMAIL_HAS_BEEN_SENT_REGISTRATION_CODE"
|
||||||
|
msgstr ""
|
||||||
|
"입력하신 이메일로 비밀번호 정보를 보냈습니다. \n"
|
||||||
|
"이메일을 확인해주세요."
|
||||||
|
|
||||||
|
msgid "VERIFICATION_EMAIL_HAS_BEEN_SENT_FORGOT_PASS_CODE"
|
||||||
|
msgstr "Verification e-mail has been sent to your e-mail.Please follow the instructions in the e-mail to retrieve your account"
|
||||||
|
|
||||||
|
msgid "PIN_IS_EXPIRED_CODE"
|
||||||
|
msgstr "Pin is expired"
|
||||||
|
|
||||||
|
msgid "UNKNOWN_ERROR_CODE"
|
||||||
|
msgstr "Exception occurred or unknown error"
|
||||||
|
|
||||||
|
msgid "Email"
|
||||||
|
msgstr "이메일"
|
||||||
|
|
||||||
|
msgid "Password"
|
||||||
|
msgstr "암호"
|
||||||
|
|
||||||
|
msgid "Login"
|
||||||
|
msgstr "로그인"
|
||||||
|
|
||||||
|
msgid "Forgot your password?"
|
||||||
|
msgstr "비밀번호를 잊어 버렸습니까?"
|
||||||
|
|
||||||
|
msgid "login_err_msg"
|
||||||
|
msgstr "잘못된 사용자 이름이나 암호를 입력합니다. 다시 시도하십시오"
|
||||||
|
|
||||||
|
msgid "Reset Password"
|
||||||
|
msgstr "암호를 재설정"
|
||||||
|
|
||||||
|
msgid "forgot_password_desc"
|
||||||
|
msgstr "당신이 로그인하는 데 사용되는 이메일 주소를 입력"
|
||||||
|
|
||||||
|
msgid "forgot_password_err"
|
||||||
|
msgstr "입력 한 이메일 ID가 우리와 함께 등록되어 있지 않습니다. 다시 시도하십시오."
|
||||||
|
|
||||||
|
msgid "forgot_password_success"
|
||||||
|
msgstr "이메일이 성공적으로 비밀번호를 재설정하는 방법에 귀하의 이메일로 전송되었습니다."
|
||||||
|
|
||||||
|
msgid "new_password"
|
||||||
|
msgstr "새 암호를 입력"
|
||||||
|
|
||||||
|
msgid "re_new_password"
|
||||||
|
msgstr "새 암호 다시 입력"
|
||||||
|
|
||||||
|
msgid "reset_password_btn"
|
||||||
|
msgstr "암호를 재설정"
|
||||||
|
|
||||||
|
msgid "reset_password_error"
|
||||||
|
msgstr "잘못된 링크. 비밀번호를 재설정하려는 경우 {0}여기에</a> 를 클릭하십시오."
|
||||||
|
|
||||||
|
msgid "reset_password_success"
|
||||||
|
msgstr "비밀번호가 성공적으로 재설정되었습니다. 새 비밀번호를 사용하여 로그인하십시오."
|
||||||
|
|
||||||
|
msgid "next_btn"
|
||||||
|
msgstr "다음"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_KR"
|
||||||
|
msgstr "제목 한국어"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_EN"
|
||||||
|
msgstr "제목 영어"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_JP"
|
||||||
|
msgstr "제목 일본어"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_CN"
|
||||||
|
msgstr "제목 중국어"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_KR"
|
||||||
|
msgstr "한국어"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_EN"
|
||||||
|
msgstr "영어"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_JP"
|
||||||
|
msgstr "일본의"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_CN"
|
||||||
|
msgstr "중국어"
|
||||||
|
|
||||||
|
msgid "CONTENT_PAGE_HEADING"
|
||||||
|
msgstr "명부"
|
||||||
|
|
||||||
|
msgid "CONTENT_SUBJECT"
|
||||||
|
msgstr "제목"
|
||||||
|
|
||||||
|
msgid "CONTENT_AUTHOR"
|
||||||
|
msgstr "저자"
|
||||||
|
|
||||||
|
msgid "CONTENT_CATEGORY"
|
||||||
|
msgstr "범주"
|
||||||
|
|
||||||
|
msgid "CONTENT_TAGS"
|
||||||
|
msgstr "태그"
|
||||||
|
|
||||||
|
msgid "CONTENT_LANGUAGE"
|
||||||
|
msgstr "언어"
|
||||||
|
|
||||||
|
msgid "CONTENT_COMMENTS"
|
||||||
|
msgstr "댓글"
|
||||||
|
|
||||||
|
msgid "CONTENT_PUBLISH_DATE"
|
||||||
|
msgstr "날짜"
|
||||||
|
|
||||||
|
msgid "CONTENT_THUMBNAIL"
|
||||||
|
msgstr "미리보기"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_ALL"
|
||||||
|
msgstr "모든"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_PUBLISHED"
|
||||||
|
msgstr "게시"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_SEEZURE"
|
||||||
|
msgstr "발작"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_INDIVIDUAL"
|
||||||
|
msgstr "개별 기사"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_TRASH"
|
||||||
|
msgstr "휴지통"
|
||||||
|
|
||||||
|
msgid "CONTENT_SEARCH_BTN"
|
||||||
|
msgstr "기사 검색"
|
||||||
|
|
||||||
|
msgid "CONTENT_APPLICATION_BTN"
|
||||||
|
msgstr "신청"
|
||||||
|
|
||||||
|
msgid "CONTENT_FILTER_BTN"
|
||||||
|
msgstr "필터"
|
||||||
|
|
||||||
|
msgid "NEXT_BTN"
|
||||||
|
msgstr "Next"
|
||||||
|
|
||||||
|
msgid "COUNTDOWN_TITLE"
|
||||||
|
msgstr "Mobile App Content Countdown"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_COUNTDOWN_ACTIVATE"
|
||||||
|
msgstr "COUNTDOWN ACTIVATED"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_COUNTDOWN_DESC"
|
||||||
|
msgstr "It displays the countdown to the mobile content."
|
||||||
|
|
||||||
|
msgid "COUNTDOWN_END"
|
||||||
|
msgstr "End Date"
|
||||||
|
|
||||||
|
msgid "COUNTDOWN_END_DESC"
|
||||||
|
msgstr "Set the end date countdown. Mobile content, and displays the remaining time,until end date"
|
||||||
|
|
||||||
|
msgid "COUNTDOWN"
|
||||||
|
msgstr "Countdown"
|
||||||
|
|
||||||
|
msgid "DAYS"
|
||||||
|
msgstr "Days"
|
||||||
|
|
||||||
|
msgid "HOURS"
|
||||||
|
msgstr "Hours"
|
||||||
|
|
||||||
|
msgid "MINUTES"
|
||||||
|
msgstr "Minutes"
|
||||||
|
|
||||||
|
msgid "SECONDS"
|
||||||
|
msgstr "Seconds"
|
||||||
|
|
||||||
|
msgid "YOUKU_ADDRESS"
|
||||||
|
msgstr "Youku Iframe Address"
|
||||||
|
|
||||||
|
msgid "YOUKU_LABEL"
|
||||||
|
msgstr "Youku Iframe Address"
|
||||||
|
|
||||||
|
msgid "FROM_DATE"
|
||||||
|
msgstr "From Date"
|
||||||
|
|
||||||
|
msgid "TO_DATE"
|
||||||
|
msgstr "To Date"
|
||||||
65
src/Locale/sp_SP/default.po
Normal file
65
src/Locale/sp_SP/default.po
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
msgid "Letter Set"
|
||||||
|
msgstr "Conjunto de letras"
|
||||||
|
|
||||||
|
msgid "Email Subject"
|
||||||
|
msgstr "Asunto del email"
|
||||||
|
|
||||||
|
msgid "Email Body"
|
||||||
|
msgstr "Cuerpo del correo electronico"
|
||||||
|
|
||||||
|
msgid "Prefix"
|
||||||
|
msgstr "Prefijo"
|
||||||
|
|
||||||
|
msgid "Customer Name"
|
||||||
|
msgstr "Nombre del cliente"
|
||||||
|
|
||||||
|
msgid "Customer First Name"
|
||||||
|
msgstr "Nombre del cliente"
|
||||||
|
|
||||||
|
msgid "Customer Last Name"
|
||||||
|
msgstr "Apellido del cliente"
|
||||||
|
|
||||||
|
msgid "Suffix"
|
||||||
|
msgstr "Sufijo"
|
||||||
|
|
||||||
|
msgid "Customer SSN"
|
||||||
|
msgstr "NSS del cliente"
|
||||||
|
|
||||||
|
msgid "Customer Birthday"
|
||||||
|
msgstr "Dirección del cliente"
|
||||||
|
|
||||||
|
msgid "Customer Address"
|
||||||
|
msgstr "Ciudad del cliente, Estado, Código postal"
|
||||||
|
|
||||||
|
msgid "Price for Service"
|
||||||
|
msgstr "Precio por Servicio"
|
||||||
|
|
||||||
|
msgid "Admin Email"
|
||||||
|
msgstr "Correo electrónico del administrador"
|
||||||
|
|
||||||
|
msgid "Today Date"
|
||||||
|
msgstr "Fecha de hoy"
|
||||||
|
|
||||||
|
msgid "Client Information"
|
||||||
|
msgstr "Información del cliente"
|
||||||
|
|
||||||
|
msgid "Company Information"
|
||||||
|
msgstr "Información de la empresa"
|
||||||
|
|
||||||
|
msgid "Company Name"
|
||||||
|
msgstr "nombre de empresa"
|
||||||
|
|
||||||
|
msgid "Company Address"
|
||||||
|
msgstr "Dirección de la empresa"
|
||||||
|
|
||||||
|
msgid "Company City/State/Zip"
|
||||||
|
msgstr "Ciudad/Estado/Código postal de la empresa"
|
||||||
|
|
||||||
|
msgid "Company Phone"
|
||||||
|
msgstr "Teléfono de la empresa"
|
||||||
|
|
||||||
|
msgid "Company Fax"
|
||||||
|
msgstr "Fax de la empresa"
|
||||||
|
|
||||||
|
msgid "Company Website"
|
||||||
|
msgstr "Página Web de la compañía"
|
||||||
BIN
src/Locale/zh_CN/default.mo
Normal file
BIN
src/Locale/zh_CN/default.mo
Normal file
Binary file not shown.
287
src/Locale/zh_CN/default.po
Normal file
287
src/Locale/zh_CN/default.po
Normal file
@@ -0,0 +1,287 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"POT-Creation-Date: \n"
|
||||||
|
"PO-Revision-Date: \n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: zh_CN\n"
|
||||||
|
"X-Generator: Poedit 1.8.5\n"
|
||||||
|
|
||||||
|
msgid "NICKNAME_NOT_SENT_CODE"
|
||||||
|
msgstr "Nickname is required"
|
||||||
|
|
||||||
|
msgid "EMAIL_ALREADY_EXIST_IN_SYSTEM"
|
||||||
|
msgstr "Email already exist in system"
|
||||||
|
|
||||||
|
msgid "USER_COULD_NOT_REGISTERED_CODE"
|
||||||
|
msgstr "User could not be registered"
|
||||||
|
|
||||||
|
msgid "USER_NOT_FOUND_CODE"
|
||||||
|
msgstr "未登记的昵称。"
|
||||||
|
|
||||||
|
msgid "LOG_INSERTION_FAILED_CODE"
|
||||||
|
msgstr "Log insertion failed"
|
||||||
|
|
||||||
|
msgid "USER_ID_IS_REQUIRED_CODE"
|
||||||
|
msgstr "User id required"
|
||||||
|
|
||||||
|
msgid "VALID_EMAIL_IS_REQUIRED_CODE"
|
||||||
|
msgstr "正确的电子邮件的形式,请输入。"
|
||||||
|
|
||||||
|
msgid "SOCIAL_ID_REQUIRED_CODE"
|
||||||
|
msgstr "Social is required"
|
||||||
|
|
||||||
|
msgid "PASSWORD_IS_REQUIRED_CODE"
|
||||||
|
msgstr "Password is required"
|
||||||
|
|
||||||
|
msgid "IS_REC_MARKETING_EMAIL_CODE"
|
||||||
|
msgstr "The field is_rec_marketing_email must be either '1' OR '0'"
|
||||||
|
|
||||||
|
msgid "USER_TYPE_REQUIRED_CODE"
|
||||||
|
msgstr "User_type value is not correct"
|
||||||
|
|
||||||
|
msgid "API_TOKEN_NOT_SET_CODE"
|
||||||
|
msgstr "api_token has not been sent"
|
||||||
|
|
||||||
|
msgid "PLATFORM_FIELD_REQUIRED_CODE"
|
||||||
|
msgstr "Platform field is required"
|
||||||
|
|
||||||
|
msgid "UDID_FIELD_REQUIRED_CODE"
|
||||||
|
msgstr "udid field is required"
|
||||||
|
|
||||||
|
msgid "INPUT_DATA_NOT_FOUND_CODE"
|
||||||
|
msgstr "Input data not found"
|
||||||
|
|
||||||
|
msgid "INPUT_DATA_KEY_NAME_NOT_CORRECT_CODE"
|
||||||
|
msgstr "Required input data key name is not correct or not sent"
|
||||||
|
|
||||||
|
msgid "INPUT_DATA_VALUE_FOUND_EMPTY_CODE"
|
||||||
|
msgstr "Required input value found empty"
|
||||||
|
|
||||||
|
msgid "TOKEN_GENERATION_FAIL_CODE"
|
||||||
|
msgstr "API token generation failed"
|
||||||
|
|
||||||
|
msgid "USER_TOKEN_UPDATE_FAIL_CODE"
|
||||||
|
msgstr "User's token update failed"
|
||||||
|
|
||||||
|
msgid "VALID_IMAGE_IS_REQUIRED"
|
||||||
|
msgstr "Valid image is required.Image upload failed."
|
||||||
|
|
||||||
|
msgid "IMAGE_SIZE_EXCEED_MAX_LIMIT"
|
||||||
|
msgstr "Image size exceed maximum allowed limit"
|
||||||
|
|
||||||
|
msgid "NICK_NAME_ALREADY_EXIST"
|
||||||
|
msgstr "重复的绰号。"
|
||||||
|
|
||||||
|
msgid "API_TOKEN_NOT_VALID"
|
||||||
|
msgstr "API token is not valid"
|
||||||
|
|
||||||
|
msgid "API_TOKEN_IS_EXPIRED"
|
||||||
|
msgstr "API token has benn expired already"
|
||||||
|
|
||||||
|
msgid "USER_ACCOUNT_NOT_ACTIVATED_YET"
|
||||||
|
msgstr "Account is not activated yet"
|
||||||
|
|
||||||
|
msgid "PIN_IS_NOT_VALID"
|
||||||
|
msgstr "您输入的密码不匹配。 请再尝试一次"
|
||||||
|
|
||||||
|
msgid "INVALID_LANGUAGE_CODE_SENT"
|
||||||
|
msgstr "Language code is not valid"
|
||||||
|
|
||||||
|
msgid "NICKNAME_LENGTH_AND_ENLGIH_CODE"
|
||||||
|
msgstr "在2至16的英文昵称,请输入。"
|
||||||
|
|
||||||
|
msgid "PASSWORD_LENGTH_AND_ALPHANUMERIC_CODE"
|
||||||
|
msgstr "密码是大小写英文,数字8至12人组合,请输入。"
|
||||||
|
|
||||||
|
msgid "NICKNAME_IS_NOT_REGISTERED_CODE"
|
||||||
|
msgstr "未登记的昵称。"
|
||||||
|
|
||||||
|
msgid "NICKNAME_AND_PASSWORD_DONT_MATCH_CODE"
|
||||||
|
msgstr "网名和密码不一致。"
|
||||||
|
|
||||||
|
msgid "EMAIL_IS_NOT_REGISTERED_CODE"
|
||||||
|
msgstr "用户的电子邮件。 再确认一下。"
|
||||||
|
|
||||||
|
msgid "VERIFICATION_EMAIL_HAS_BEEN_SENT_REGISTRATION_CODE"
|
||||||
|
msgstr ""
|
||||||
|
"您输入的密码信息,以电子邮件寄来的。 \n"
|
||||||
|
"邮件确认一下。"
|
||||||
|
|
||||||
|
msgid "VERIFICATION_EMAIL_HAS_BEEN_SENT_FORGOT_PASS_CODE"
|
||||||
|
msgstr "Verification e-mail has been sent to your e-mail.Please follow the instructions in the e-mail to retrieve your account"
|
||||||
|
|
||||||
|
msgid "PIN_IS_EXPIRED_CODE"
|
||||||
|
msgstr "Pin is expired"
|
||||||
|
|
||||||
|
msgid "UNKNOWN_ERROR_CODE"
|
||||||
|
msgstr "Exception occurred or unknown error"
|
||||||
|
|
||||||
|
msgid "Email"
|
||||||
|
msgstr "电子邮件"
|
||||||
|
|
||||||
|
msgid "Password"
|
||||||
|
msgstr "密码"
|
||||||
|
|
||||||
|
msgid "Login"
|
||||||
|
msgstr "登录"
|
||||||
|
|
||||||
|
msgid "Forgot your password?"
|
||||||
|
msgstr "忘记密码了吗?"
|
||||||
|
|
||||||
|
msgid "login_err_msg"
|
||||||
|
msgstr "错误的用户名或密码。 请再试一次"
|
||||||
|
|
||||||
|
msgid "Reset Password"
|
||||||
|
msgstr "重设密码"
|
||||||
|
|
||||||
|
msgid "forgot_password_desc"
|
||||||
|
msgstr "输入您用于登录您的电子邮件地址"
|
||||||
|
|
||||||
|
msgid "forgot_password_err"
|
||||||
|
msgstr "您输入的电子邮件ID是没有注册登记。 请再试一次。"
|
||||||
|
|
||||||
|
msgid "forgot_password_success"
|
||||||
|
msgstr "电子邮件已成功发送到您的电子邮件与说明重置您的密码。"
|
||||||
|
|
||||||
|
msgid "new_password"
|
||||||
|
msgstr "새 암호를 입력"
|
||||||
|
|
||||||
|
msgid "re_new_password"
|
||||||
|
msgstr "再次输入新密码"
|
||||||
|
|
||||||
|
msgid "reset_password_btn"
|
||||||
|
msgstr "重设密码"
|
||||||
|
|
||||||
|
msgid "reset_password_error"
|
||||||
|
msgstr "链接无效。请点击{0}这里</a>,如果你想重置密码。"
|
||||||
|
|
||||||
|
msgid "reset_password_success"
|
||||||
|
msgstr "您的密码已成功重置。使用新密码登录。"
|
||||||
|
|
||||||
|
msgid "next_btn"
|
||||||
|
msgstr "下一个"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_KR"
|
||||||
|
msgstr "韩国称号"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_EN"
|
||||||
|
msgstr "职称英语"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_JP"
|
||||||
|
msgstr "标题日本"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_TITLE_CN"
|
||||||
|
msgstr "中国标题"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_KR"
|
||||||
|
msgstr "朝鲜的"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_EN"
|
||||||
|
msgstr "英语"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_JP"
|
||||||
|
msgstr "日本"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_DESC_CN"
|
||||||
|
msgstr "中国"
|
||||||
|
|
||||||
|
msgid "CONTENT_PAGE_HEADING"
|
||||||
|
msgstr "名单"
|
||||||
|
|
||||||
|
msgid "CONTENT_SUBJECT"
|
||||||
|
msgstr "学科"
|
||||||
|
|
||||||
|
msgid "CONTENT_AUTHOR"
|
||||||
|
msgstr "笔者"
|
||||||
|
|
||||||
|
msgid "CONTENT_CATEGORY"
|
||||||
|
msgstr "类别"
|
||||||
|
|
||||||
|
msgid "CONTENT_TAGS"
|
||||||
|
msgstr "标签"
|
||||||
|
|
||||||
|
msgid "CONTENT_LANGUAGE"
|
||||||
|
msgstr "语言"
|
||||||
|
|
||||||
|
msgid "CONTENT_COMMENTS"
|
||||||
|
msgstr "评论"
|
||||||
|
|
||||||
|
msgid "CONTENT_PUBLISH_DATE"
|
||||||
|
msgstr "日期"
|
||||||
|
|
||||||
|
msgid "CONTENT_THUMBNAIL"
|
||||||
|
msgstr "缩略图"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_ALL"
|
||||||
|
msgstr "所有"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_PUBLISHED"
|
||||||
|
msgstr "发布时间"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_SEEZURE"
|
||||||
|
msgstr "发作"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_INDIVIDUAL"
|
||||||
|
msgstr "个别条款"
|
||||||
|
|
||||||
|
msgid "CONTENT_SHOW_TRASH"
|
||||||
|
msgstr "垃圾"
|
||||||
|
|
||||||
|
msgid "CONTENT_SEARCH_BTN"
|
||||||
|
msgstr "文章搜索"
|
||||||
|
|
||||||
|
msgid "CONTENT_APPLICATION_BTN"
|
||||||
|
msgstr "应用"
|
||||||
|
|
||||||
|
msgid "CONTENT_FILTER_BTN"
|
||||||
|
msgstr "过滤器"
|
||||||
|
|
||||||
|
msgid "NEXT_BTN"
|
||||||
|
msgstr "Next"
|
||||||
|
|
||||||
|
msgid "COUNTDOWN_TITLE"
|
||||||
|
msgstr "Mobile App Content Countdown"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_COUNTDOWN_ACTIVATE"
|
||||||
|
msgstr "COUNTDOWN ACTIVATED"
|
||||||
|
|
||||||
|
msgid "ADD_CONTENT_COUNTDOWN_DESC"
|
||||||
|
msgstr "It displays the countdown to the mobile content."
|
||||||
|
|
||||||
|
msgid "COUNTDOWN_END"
|
||||||
|
msgstr "End Date"
|
||||||
|
|
||||||
|
msgid "COUNTDOWN_END_DESC"
|
||||||
|
msgstr "Set the end date countdown. Mobile content, and displays the remaining time,until end date"
|
||||||
|
|
||||||
|
msgid "COUNTDOWN"
|
||||||
|
msgstr "Countdown"
|
||||||
|
|
||||||
|
msgid "DAYS"
|
||||||
|
msgstr "Days"
|
||||||
|
|
||||||
|
msgid "HOURS"
|
||||||
|
msgstr "Hours"
|
||||||
|
|
||||||
|
msgid "MINUTES"
|
||||||
|
msgstr "Minutes"
|
||||||
|
|
||||||
|
msgid "SECONDS"
|
||||||
|
msgstr "Seconds"
|
||||||
|
|
||||||
|
msgid "YOUKU_ADDRESS"
|
||||||
|
msgstr "Youku Iframe Address"
|
||||||
|
|
||||||
|
msgid "YOUKU_LABEL"
|
||||||
|
msgstr "Youku Iframe Address"
|
||||||
|
|
||||||
|
msgid "FROM_DATE"
|
||||||
|
msgstr "From Date"
|
||||||
|
|
||||||
|
msgid "TO_DATE"
|
||||||
|
msgstr "To Date"
|
||||||
37
src/Model/Behavior/SoftDeletableBehavior.php
Normal file
37
src/Model/Behavior/SoftDeletableBehavior.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: rsi
|
||||||
|
* Date: 12-Nov-15
|
||||||
|
* Time: 10:51 PM
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Model\Behavior;
|
||||||
|
|
||||||
|
use Cake\ORM\Behavior;
|
||||||
|
|
||||||
|
class SoftDeletableBehavior extends Behavior
|
||||||
|
{
|
||||||
|
function setup(&$Model, $settings = array()) {
|
||||||
|
// do any setup here
|
||||||
|
}
|
||||||
|
|
||||||
|
// override the delete function (behavior methods that override model methods take precedence)
|
||||||
|
function delete(&$Model, $id = null) {
|
||||||
|
$Model->id = $id;
|
||||||
|
log("yooooooooooooooooo");
|
||||||
|
log($Model);
|
||||||
|
// save the deleted field with current date-time
|
||||||
|
if ($Model->saveField('status', STATUS_NOT_ACTIVE)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function beforeFind(&$Model, $query) {
|
||||||
|
// only include records that have null deleted columns
|
||||||
|
$query->where([$this->_table->registryAlias().".status" => STATUS_ACTIVE]);
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
}
|
||||||
0
src/Model/Behavior/empty
Normal file
0
src/Model/Behavior/empty
Normal file
21
src/Model/Entity/Agent.php
Normal file
21
src/Model/Entity/Agent.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
class Agent extends Entity
|
||||||
|
{
|
||||||
|
protected $_accessible = [
|
||||||
|
'first_name' => true,
|
||||||
|
'last_name' => true,
|
||||||
|
'email' => true,
|
||||||
|
'phone_number' => true,
|
||||||
|
'agency_name' => true,
|
||||||
|
'hire_date' => true,
|
||||||
|
'address' => true,
|
||||||
|
'country_name' => true,
|
||||||
|
'status' => true,
|
||||||
|
'created_at' => true,
|
||||||
|
'updated_at' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
33
src/Model/Entity/Category.php
Normal file
33
src/Model/Entity/Category.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Category Entity
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property \Cake\I18n\Time $created_on
|
||||||
|
* @property \Cake\I18n\Time $modified_on
|
||||||
|
* @property int $status
|
||||||
|
*
|
||||||
|
* @property \App\Model\Entity\SubCategory[] $sub_categories
|
||||||
|
*/
|
||||||
|
class Category extends Entity
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
|
*
|
||||||
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
|
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||||
|
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_accessible = [
|
||||||
|
'*' => true,
|
||||||
|
'id' => false
|
||||||
|
];
|
||||||
|
}
|
||||||
40
src/Model/Entity/CheckList.php
Normal file
40
src/Model/Entity/CheckList.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CheckList Entity
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string|null $description
|
||||||
|
* @property int $status
|
||||||
|
* @property int|null $sequence
|
||||||
|
* @property int|null $created_by_id
|
||||||
|
* @property int|null $updated_by_id
|
||||||
|
* @property \Cake\I18n\Time|null $created_at
|
||||||
|
* @property \Cake\I18n\Time|null $updated_at
|
||||||
|
*/
|
||||||
|
class CheckList extends Entity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
|
*
|
||||||
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
|
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||||
|
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_accessible = [
|
||||||
|
'name' => true,
|
||||||
|
'description' => true,
|
||||||
|
'status' => true,
|
||||||
|
'sequence' => true,
|
||||||
|
'created_by_id' => true,
|
||||||
|
'updated_by_id' => true,
|
||||||
|
'created_at' => true,
|
||||||
|
'updated_at' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
44
src/Model/Entity/Cmsuser.php
Normal file
44
src/Model/Entity/Cmsuser.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use App\Auth\CmsPasswordHasher;
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cmsuser Entity.
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $language
|
||||||
|
* @property string $username
|
||||||
|
* @property string $password
|
||||||
|
* @property string $email
|
||||||
|
* @property string $reset_password_token
|
||||||
|
* @property \Cake\I18n\Time $created_on
|
||||||
|
* @property \Cake\I18n\Time $updated_on
|
||||||
|
* @property bool $status
|
||||||
|
* @property int $company_id
|
||||||
|
* @property \App\Model\Entity\Company $company
|
||||||
|
*/
|
||||||
|
class Cmsuser extends Entity
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
|
*
|
||||||
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
|
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||||
|
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_accessible = [
|
||||||
|
'*' => true,
|
||||||
|
'id' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
protected function _setPassword($value)
|
||||||
|
{
|
||||||
|
$hasher = new CmsPasswordHasher();
|
||||||
|
return $hasher->hash($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
47
src/Model/Entity/CmsuserStatus.php
Normal file
47
src/Model/Entity/CmsuserStatus.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CmsuserStatus Entity
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $cmsuser_id
|
||||||
|
* @property int $is_account_profile_set
|
||||||
|
* @property int $is_first_client_added
|
||||||
|
* @property int $is_credit_report_uploaded
|
||||||
|
* @property int $is_send_first_letter
|
||||||
|
* @property int $is_automation
|
||||||
|
* @property int $is_personalized_domain
|
||||||
|
* @property int $is_agreement
|
||||||
|
* @property \Cake\I18n\Time|null $created_at
|
||||||
|
* @property \Cake\I18n\Time|null $updated_at
|
||||||
|
*
|
||||||
|
* @property \App\Model\Entity\Cmsuser $cmsuser
|
||||||
|
*/
|
||||||
|
class CmsuserStatus extends Entity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
|
*
|
||||||
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
|
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||||
|
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_accessible = [
|
||||||
|
'cmsuser_id' => true,
|
||||||
|
'is_account_profile_set' => true,
|
||||||
|
'is_first_client_added' => true,
|
||||||
|
'is_credit_report_uploaded' => true,
|
||||||
|
'is_send_first_letter' => true,
|
||||||
|
'is_automation' => true,
|
||||||
|
'is_personalized_domain' => true,
|
||||||
|
'is_agreement' => true,
|
||||||
|
'created_at' => true,
|
||||||
|
'updated_at' => true,
|
||||||
|
'cmsuser' => true
|
||||||
|
];
|
||||||
|
}
|
||||||
55
src/Model/Entity/Company.php
Normal file
55
src/Model/Entity/Company.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Company Entity.
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $cname
|
||||||
|
* @property string $cemail
|
||||||
|
* @property string $address1
|
||||||
|
* @property string $address2
|
||||||
|
* @property string $postcode
|
||||||
|
* @property string $phone
|
||||||
|
* @property string $email
|
||||||
|
* @property string $fax
|
||||||
|
* @property string $city
|
||||||
|
* @property string $state
|
||||||
|
* @property string $country
|
||||||
|
* @property string $confederation
|
||||||
|
* @property string $general_secretary
|
||||||
|
* @property string $logo
|
||||||
|
* @property string $registration_no
|
||||||
|
* @property string $ranking_w
|
||||||
|
* @property string $ranking_m
|
||||||
|
* @property string $tax_no
|
||||||
|
* @property int $no_of_employees
|
||||||
|
* @property bool $cmmi_level
|
||||||
|
* @property float $yearly_revenue
|
||||||
|
* @property bool $status
|
||||||
|
* @property \Cake\I18n\Time $created_on
|
||||||
|
* @property \Cake\I18n\Time $modified_on
|
||||||
|
* @property \App\Model\Entity\Cmsuser[] $cmsusers
|
||||||
|
* @property \App\Model\Entity\Role[] $roles
|
||||||
|
* @property \App\Model\Entity\Usergroup[] $usergroups
|
||||||
|
*/
|
||||||
|
class Company extends Entity
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
|
*
|
||||||
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
|
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||||
|
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_accessible = [
|
||||||
|
'*' => true,
|
||||||
|
'id' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
66
src/Model/Entity/Course.php
Normal file
66
src/Model/Entity/Course.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Course Entity
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property int $course_category_id
|
||||||
|
* @property int $qualification_type_id
|
||||||
|
* @property int $level
|
||||||
|
* @property double $total_credit
|
||||||
|
* @property string $code
|
||||||
|
* @property string $progression_routes
|
||||||
|
* @property int $availability_type
|
||||||
|
* @property int $delivery_mode
|
||||||
|
* @property int $duration
|
||||||
|
* @property int|null $qualification_time
|
||||||
|
* @property string|null $centre_specification_link
|
||||||
|
* @property string|null $image_path
|
||||||
|
* @property string $assessment
|
||||||
|
* @property string|null $description
|
||||||
|
* @property int|null $status
|
||||||
|
* @property int $accreditation_status
|
||||||
|
* @property int|null $created_by
|
||||||
|
* @property int|null $updated_by
|
||||||
|
* @property \Cake\I18n\Time|null $created_at
|
||||||
|
* @property \Cake\I18n\Time|null $updated_at
|
||||||
|
*/
|
||||||
|
class Course extends Entity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
|
*
|
||||||
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
|
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||||
|
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_accessible = [
|
||||||
|
'name' => true,
|
||||||
|
'course_category_id' => true,
|
||||||
|
'qualification_type_id' => true,
|
||||||
|
'level'=>true,
|
||||||
|
'total_credit'=>true,
|
||||||
|
'code'=>true,
|
||||||
|
'progression_routes'=>true,
|
||||||
|
'availability_type'=>true,
|
||||||
|
'delivery_mode'=>true,
|
||||||
|
'duration'=>true,
|
||||||
|
'assessment'=>true,
|
||||||
|
'description' => true,
|
||||||
|
'qualification_time' => true,
|
||||||
|
'centre_specification_link' => true,
|
||||||
|
'accreditation_status' => true,
|
||||||
|
'image_path' => true,
|
||||||
|
'status' => true,
|
||||||
|
'created_by' => true,
|
||||||
|
'updated_by' => true,
|
||||||
|
'created_at' => true,
|
||||||
|
'updated_at' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
19
src/Model/Entity/CourseCategory.php
Normal file
19
src/Model/Entity/CourseCategory.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
class CourseCategory extends Entity
|
||||||
|
{
|
||||||
|
protected $_accessible = [
|
||||||
|
'name' => true,
|
||||||
|
'description' => true,
|
||||||
|
'status' => true,
|
||||||
|
'created_by' => true,
|
||||||
|
'updated_by' => true,
|
||||||
|
'created_at' => true,
|
||||||
|
'updated_at' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
18
src/Model/Entity/CourseSemester.php
Normal file
18
src/Model/Entity/CourseSemester.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
class CourseSemester extends Entity
|
||||||
|
{
|
||||||
|
protected $_accessible = [
|
||||||
|
'course_id' => true,
|
||||||
|
'semester_id' => true,
|
||||||
|
'created_by' => true,
|
||||||
|
'updated_by' => true,
|
||||||
|
'created_at' => true,
|
||||||
|
'updated_at' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
24
src/Model/Entity/CourseSemesterFee.php
Normal file
24
src/Model/Entity/CourseSemesterFee.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
class CourseSemesterFee extends Entity
|
||||||
|
{
|
||||||
|
protected $_accessible = [
|
||||||
|
'course_id' => true,
|
||||||
|
'online_fee' => true,
|
||||||
|
'discount' => true,
|
||||||
|
'monthly_installments' => true,
|
||||||
|
'upfront_deposit' => true,
|
||||||
|
'blended_fee' => true,
|
||||||
|
'certificate_fee' => true,
|
||||||
|
'status' => true,
|
||||||
|
'created_by' => true,
|
||||||
|
'updated_by' => true,
|
||||||
|
'created_at' => true,
|
||||||
|
'updated_at' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
22
src/Model/Entity/CourseSemesterSubject.php
Normal file
22
src/Model/Entity/CourseSemesterSubject.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
class CourseSemesterSubject extends Entity
|
||||||
|
{
|
||||||
|
protected $_accessible = [
|
||||||
|
'course_id' => true,
|
||||||
|
'course_semester_id' => true,
|
||||||
|
'title' => true,
|
||||||
|
'level' => true,
|
||||||
|
'credit' => true,
|
||||||
|
'is_mandatory' => true,
|
||||||
|
'status' => true,
|
||||||
|
'created_by' => true,
|
||||||
|
'updated_by' => true,
|
||||||
|
'created_at' => true,
|
||||||
|
'updated_at' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
69
src/Model/Entity/EmailQueue.php
Normal file
69
src/Model/Entity/EmailQueue.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmailQueue Entity
|
||||||
|
*
|
||||||
|
* @property string $id
|
||||||
|
* @property string $member_id
|
||||||
|
* @property string $email
|
||||||
|
* @property string|null $from_name
|
||||||
|
* @property string|null $from_email
|
||||||
|
* @property string $subject
|
||||||
|
* @property string $config
|
||||||
|
* @property string $template
|
||||||
|
* @property string $layout
|
||||||
|
* @property string $theme
|
||||||
|
* @property string $format
|
||||||
|
* @property string $template_vars
|
||||||
|
* @property string|null $headers
|
||||||
|
* @property bool $sent
|
||||||
|
* @property bool $locked
|
||||||
|
* @property int $send_tries
|
||||||
|
* @property \Cake\I18n\Time|null $send_at
|
||||||
|
* @property \Cake\I18n\Time $created
|
||||||
|
* @property \Cake\I18n\Time|null $modified
|
||||||
|
* @property string|null $attachments
|
||||||
|
*
|
||||||
|
* @property \App\Model\Entity\Member $member
|
||||||
|
* @property \App\Model\Entity\Phinxlog[] $phinxlog
|
||||||
|
*/
|
||||||
|
class EmailQueue extends Entity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
|
*
|
||||||
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
|
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||||
|
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_accessible = [
|
||||||
|
'member_id' => true,
|
||||||
|
'email' => true,
|
||||||
|
'from_name' => true,
|
||||||
|
'from_email' => true,
|
||||||
|
'subject' => true,
|
||||||
|
'config' => true,
|
||||||
|
'template' => true,
|
||||||
|
'layout' => true,
|
||||||
|
'theme' => true,
|
||||||
|
'format' => true,
|
||||||
|
'template_vars' => true,
|
||||||
|
'headers' => true,
|
||||||
|
'sent' => true,
|
||||||
|
'locked' => true,
|
||||||
|
'send_tries' => true,
|
||||||
|
'send_at' => true,
|
||||||
|
'created' => true,
|
||||||
|
'modified' => true,
|
||||||
|
'attachments' => true,
|
||||||
|
'member' => true,
|
||||||
|
'phinxlog' => true,
|
||||||
|
'exception' => true,
|
||||||
|
'parent_id' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
44
src/Model/Entity/Feedback.php
Normal file
44
src/Model/Entity/Feedback.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Model\Entity;
|
||||||
|
|
||||||
|
use Cake\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FeedBack Entity
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $email
|
||||||
|
* @property string|null $phone_number
|
||||||
|
* @property string|null $subject
|
||||||
|
* @property string $message
|
||||||
|
* @property \Cake\I18n\Time|null $inquiry_date
|
||||||
|
* @property int|null $status
|
||||||
|
* @property string|null $response_text
|
||||||
|
* @property \Cake\I18n\Time|null $response_date
|
||||||
|
* @property \Cake\I18n\Time|null $created_at
|
||||||
|
*/
|
||||||
|
class FeedBack extends Entity
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Fields that can be mass assigned using newEntity() or patchEntity().
|
||||||
|
*
|
||||||
|
* Note that when '*' is set to true, this allows all unspecified fields to
|
||||||
|
* be mass assigned. For security purposes, it is advised to set '*' to false
|
||||||
|
* (or remove it), and explicitly make individual fields accessible as needed.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $_accessible = [
|
||||||
|
'name' => true,
|
||||||
|
'email' => true,
|
||||||
|
'phone_number' => true,
|
||||||
|
'subject' => true,
|
||||||
|
'message' => true,
|
||||||
|
'inquiry_date' => true,
|
||||||
|
'status' => true,
|
||||||
|
'response_text' => true,
|
||||||
|
'response_date' => true,
|
||||||
|
'created_at' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user