inital commit
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
465
src/Common/PDFLetters.php
Normal file
465
src/Common/PDFLetters.php
Normal file
@@ -0,0 +1,465 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Common;
|
||||
|
||||
|
||||
use App\Helper\commonLogic;
|
||||
use App\Utility\Common;
|
||||
use App\Utility\createDirZip;
|
||||
use Aws\CloudFront\Exception\Exception;
|
||||
use ZipArchive;
|
||||
use RecursiveIteratorIterator;
|
||||
use RecursiveDirectoryIterator;
|
||||
|
||||
class PDFLetters
|
||||
{
|
||||
const ROOT_FORDER = 'pdfletters';
|
||||
const ZIP_FORDER = 'zip';
|
||||
|
||||
private function dbopen() {
|
||||
$dbhost = APP_DB_HOST;
|
||||
$dbuser = APP_DB_USERNAME;
|
||||
$dbpass = APP_DB_PASSWORD;
|
||||
$dbname = APP_DB_DATABASE_NAME;
|
||||
|
||||
$conn = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
|
||||
$conn->set_charset("utf8");
|
||||
// Check connection
|
||||
if (mysqli_connect_errno()) {
|
||||
//echo "Failed to connect to MySQL: " . mysqli_connect_error();
|
||||
}
|
||||
return $conn;
|
||||
}
|
||||
|
||||
public static function storePdfLetter($inputData){
|
||||
$connection = self::dbopen();
|
||||
$connection->begin_transaction();
|
||||
$result = [];
|
||||
|
||||
try {
|
||||
$current_date_time = self::getSystemCurrentTimeStamp();
|
||||
$client_id = $inputData['client_id'];
|
||||
$velocity_id = $inputData['velocity_id'];
|
||||
$velocity_type = $inputData['velocity_type'];
|
||||
$file_path = $inputData['file_path'];
|
||||
$global_create_new_sertg_id = $inputData['global_create_new_sertg_id'];
|
||||
list($member_id, $user_id, $user_type) = self::getAuthUserIdAndType();
|
||||
$root_folder = __DIR__.'/../../webroot/'.self::ROOT_FORDER;
|
||||
$velocity_type_array = EPIC_AND_SERTG_DROPDOWN;
|
||||
$deleteCondition['velocity_id'] = $velocity_id;
|
||||
$deleteCondition['velocity_type'] = $velocity_type;
|
||||
self::deletepdf($deleteCondition);
|
||||
$previous_file = $root_folder . "/" . $velocity_type_array[$velocity_type] . "/" . $member_id . "/" . $client_id . "/" . $velocity_id;
|
||||
self::deleteDir($previous_file);
|
||||
$insertDataArray = [];
|
||||
$insertData['client_id'] = $client_id;
|
||||
$insertData['velocity_id'] = $velocity_id;
|
||||
$insertData['velocity_type'] = $velocity_type;
|
||||
$insertData['file_path'] = basename($file_path);
|
||||
$insertData['member_id'] = $member_id;
|
||||
$insertData['created_by'] = $user_id;
|
||||
$insertData['user_type'] = $user_type;
|
||||
$insertData['personal_info'] = $inputData['personal_info'];
|
||||
$insertData['dob'] = $inputData['dob'];
|
||||
$insertData['ssn'] = $inputData['ssn'];
|
||||
$insertData['letter_types'] = $inputData['letter_types'];
|
||||
$insertData['next_action_date'] = $inputData['next_action_date'] ?? null;
|
||||
$final_day = LETTER_DELETION_DAYS;
|
||||
$insertData['file_remove_date'] = date('Y-m-d', strtotime($current_date_time. ' + '.$final_day.' days'));
|
||||
$insertDataArray[] = $insertData;
|
||||
|
||||
if(!empty($global_create_new_sertg_id) && $global_create_new_sertg_id > 0 && $global_create_new_sertg_id != $velocity_id){
|
||||
$insertData['velocity_id'] = $global_create_new_sertg_id;
|
||||
$insertDataArray[] = $insertData;
|
||||
}
|
||||
|
||||
if (!empty(self::insertPdf($insertDataArray))) {
|
||||
$result = $insertDataArray;
|
||||
if (!is_dir($previous_file)) {
|
||||
mkdir($previous_file, 0777, true);
|
||||
}
|
||||
copy($file_path,$previous_file . "/" . basename($file_path));
|
||||
if(is_file($previous_file . "/" . basename($file_path))){
|
||||
$connection->commit();
|
||||
@unlink($file_path);
|
||||
$response['message'] = "Letter has been saved for ".LETTER_DELETION_DAYS." days";
|
||||
$response['url'] = APP_SERVER_HOST_URL_DEFAULT."pdf-letters";
|
||||
$response['url'] = '<br/><br/><a style="text-decoration:underline; color:green" target="_blank" href="'.$response['url'].'">Click here to see letters</a>';
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}else{
|
||||
throw new \Exception('File not uploaded');
|
||||
}
|
||||
}
|
||||
}catch (\Exception $ex){
|
||||
$result['errors'] = $ex->getMessage();
|
||||
$connection->rollback();
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function rcopy($src, $dst){
|
||||
$files = scandir($src);
|
||||
foreach ($files as $file) {
|
||||
if ($file != "." && $file != "..") {
|
||||
rcopy("$src/$file", "$dst/$file");
|
||||
}
|
||||
}
|
||||
}
|
||||
public static function insertpdf($inputData){
|
||||
$conn = self::dbopen();
|
||||
$result = false;
|
||||
if (!empty($inputData)) {
|
||||
$current_date_time = self::getSystemCurrentTimeStamp();
|
||||
$sql = "";
|
||||
foreach ($inputData as $data) {
|
||||
$data['created_at'] = $current_date_time;
|
||||
$column_string = "";
|
||||
$data_string = "";
|
||||
foreach ($data as $column => $data){
|
||||
if(!empty($column_string)){
|
||||
$column_string .= ",".$column;
|
||||
}else{
|
||||
$column_string = $column;
|
||||
}
|
||||
|
||||
if(!empty($data_string)){
|
||||
$data_string .= ",'{$data}'";
|
||||
}else{
|
||||
$data_string = "'{$data}'";
|
||||
}
|
||||
}
|
||||
$stmt = "(".$data_string.")";
|
||||
if(!empty($sql)){
|
||||
$sql .= ",".$stmt;
|
||||
}else{
|
||||
$sql = $stmt;
|
||||
}
|
||||
}
|
||||
if(!empty($column_string)) {
|
||||
$sql = "INSERT INTO `pdf_letters` ($column_string) VALUES ".$sql;
|
||||
}
|
||||
/*echo($sql);
|
||||
echo("<pre>");
|
||||
print_r($inputData);
|
||||
exit;*/
|
||||
if($conn->query($sql)){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function updatepdf($id,$fields){
|
||||
$conn = self::dbopen();
|
||||
$result = false;
|
||||
$data_string = "";
|
||||
if (!empty($fields)) {
|
||||
foreach ($fields as $column => $data) {
|
||||
if (!empty($data_string)) {
|
||||
$data_string .= "," . $column . " = '" . $data."'";
|
||||
} else {
|
||||
$data_string = $column . " = '" . $data."'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($data_string)){
|
||||
$sql = "UPDATE `pdf_letters` SET ".$data_string." WHERE id = ".$id;
|
||||
$result = $conn->query($sql);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
public static function deletepdf($condition)
|
||||
{
|
||||
$connection = self::dbopen();
|
||||
$result = false;
|
||||
$condition_string = "";
|
||||
if (!empty($condition)) {
|
||||
foreach ($condition as $column => $data){
|
||||
if(!empty($condition_string)){
|
||||
$condition_string .= " AND ".$column." = ".$data;
|
||||
}else{
|
||||
$condition_string = $column." = ".$data;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'DELETE FROM `pdf_letters` WHERE '.$condition_string;
|
||||
if($connection->query($sql)){
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getSystemCurrentTimeStamp($formate = '', $time_zone = '')
|
||||
{
|
||||
if (!empty($time_zone)) {
|
||||
date_default_timezone_set($time_zone);
|
||||
} else {
|
||||
$current_time_zone = $_SESSION['Auth']['User']['time_zone'];
|
||||
if (!empty($current_time_zone)) {
|
||||
date_default_timezone_set($current_time_zone);
|
||||
} else {
|
||||
date_default_timezone_set("UTC");
|
||||
}
|
||||
}
|
||||
|
||||
if ($formate == '') {
|
||||
return date("Y-m-d H:i:s");
|
||||
} else {
|
||||
return date($formate);
|
||||
}
|
||||
}
|
||||
|
||||
private static function getAuthUserIdAndType(){
|
||||
$user_type = 0;
|
||||
$user_id = 0;
|
||||
$member_id = $_SESSION['Auth']['User']['id'];
|
||||
if ($_SESSION['userType'] == CMS_USER_INDICATOR) {
|
||||
$user_id = $member_id;
|
||||
$user_type = 1;
|
||||
} else if ($_SESSION['userType'] == CRM_USER_INDICATOR) {
|
||||
$user_id = $_SESSION['Auth']['User']['user_id'];
|
||||
$user_type = 2;
|
||||
}
|
||||
|
||||
return [$member_id,$user_id,$user_type];
|
||||
}
|
||||
|
||||
public static function deleteDir($dirPath) {
|
||||
$result = false;
|
||||
try {
|
||||
if (!is_dir($dirPath)) {
|
||||
return ;
|
||||
}
|
||||
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
|
||||
$dirPath .= '/';
|
||||
}
|
||||
$files = glob($dirPath . '*', GLOB_MARK);
|
||||
foreach ($files as $file) {
|
||||
if (is_dir($file)) {
|
||||
self::deleteDir($file);
|
||||
} else {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
rmdir($dirPath);
|
||||
$result =true;
|
||||
} catch (\Exception $ex){
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function fileDownloadById($id){
|
||||
$conn = self::dbopen();
|
||||
$final_result = false;
|
||||
$member_id = $_SESSION['Auth']['User']['id'];
|
||||
$sql = "select * from pdf_letters where member_id = $member_id AND id = $id";
|
||||
$result = $conn->query($sql);
|
||||
if ($result->num_rows > 0) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$file_path = WWW_ROOT.self::ROOT_FORDER.'/'.EPIC_AND_SERTG_DROPDOWN[$row['velocity_type']]."/".$row['member_id']."/".$row['client_id']."/".$row['velocity_id'];
|
||||
$file_path .= "/".$row['file_path'];
|
||||
if(is_file($file_path)) {
|
||||
$updateData['download_count'] = ++$row['download_count'];
|
||||
$updateData['updated_at'] = self::getSystemCurrentTimeStamp();
|
||||
self::updatepdf($row['id'],$updateData);
|
||||
$zipname = WWW_ROOT . self::ROOT_FORDER . "/" . self::ZIP_FORDER . "/" . $row['member_id'] . "/";
|
||||
if (!is_dir($zipname)) {
|
||||
mkdir($zipname, 0777, true);
|
||||
}
|
||||
$zipname .= time() . '.zip';
|
||||
$file_array[] = $file_path;
|
||||
if(self::createzipByfiles($file_array,$zipname)){
|
||||
self::downloadheader($zipname);
|
||||
@unlink($zipname);
|
||||
$final_result = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $final_result;
|
||||
}
|
||||
|
||||
public static function multiplefileDownloadById($ids){
|
||||
$conn = self::dbopen();
|
||||
$conn->begin_transaction();
|
||||
$final_result = false;
|
||||
$member_id = $_SESSION['Auth']['User']['id'];
|
||||
if(!empty($ids)) {
|
||||
$sql = "select * from pdf_letters where member_id = $member_id AND id IN (".implode(",",$ids).")";
|
||||
$result = $conn->query($sql);
|
||||
if ($result->num_rows > 0) {
|
||||
$current_date_time = self::getSystemCurrentTimeStamp();
|
||||
$file_array = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$file_path = self::ROOT_FORDER.'/' . EPIC_AND_SERTG_DROPDOWN[$row['velocity_type']] . "/" . $row['member_id'] . "/" . $row['client_id'] . "/" . $row['velocity_id'];
|
||||
$file_path .= "/" . $row['file_path'];
|
||||
if (is_file($file_path)) {
|
||||
$updateData['download_count'] = ++$row['download_count'];
|
||||
$updateData['updated_at'] = $current_date_time;
|
||||
self::updatepdf($row['id'], $updateData);
|
||||
$file_array[] = $file_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($file_array)) {
|
||||
$zipname = WWW_ROOT . self::ROOT_FORDER . "/" . self::ZIP_FORDER . "/" . $member_id . "/";
|
||||
if (!is_dir($zipname)) {
|
||||
mkdir($zipname, 0777, true);
|
||||
}
|
||||
$zipname .= time() . '.zip';
|
||||
if(self::createzipByfiles($file_array,$zipname)){
|
||||
$conn->commit();
|
||||
self::downloadheader($zipname);
|
||||
@unlink($zipname);
|
||||
$final_result = true;
|
||||
}else{
|
||||
$conn->rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
return $final_result;
|
||||
}
|
||||
|
||||
public function createzipByfiles($files,$file_name){
|
||||
$zipname = $file_name;
|
||||
$zip = new ZipArchive;
|
||||
$zip->open($zipname, ZipArchive::CREATE | ZipArchive::OVERWRITE);
|
||||
foreach ($files as $file) {
|
||||
$zip->addFile($file,basename($file));
|
||||
}
|
||||
return $zip->close();
|
||||
|
||||
}
|
||||
public function downloadheader($file_path){
|
||||
/*header('Content-Description: File Transfer');
|
||||
header('Content-type: application/zip');
|
||||
header('Content-Disposition: attachment; filename="'.basename($file_path).'"');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate');
|
||||
header('Pragma: public');
|
||||
header('Content-Length: ' . filesize($file_path));
|
||||
readfile($file_path);*/
|
||||
ob_clean();
|
||||
ob_end_flush(); // more important function - (without - error corrupted zip)
|
||||
header('Content-Type: application/octet-stream');
|
||||
header("Content-Transfer-Encoding: Binary");
|
||||
header("Content-disposition: attachment; filename=\"" . basename($file_path) . "\"");
|
||||
header('Content-Length: ' . filesize($file_path));
|
||||
readfile($file_path);
|
||||
}
|
||||
|
||||
public static function preparePersonalInfo($personal_info_decode){
|
||||
$address = "";
|
||||
|
||||
// street no
|
||||
if(!empty($personal_info_decode['street_no'])){
|
||||
$address = $personal_info_decode['street_no'];
|
||||
}
|
||||
|
||||
// street name
|
||||
if(!empty($personal_info_decode['street_name'])){
|
||||
|
||||
if(!empty($address)){
|
||||
$address .= ", ".$personal_info_decode['street_name'];
|
||||
}else{
|
||||
$address = $personal_info_decode['street_name'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// city
|
||||
if(!empty($personal_info_decode['city'])){
|
||||
|
||||
if(!empty($address)){
|
||||
$address .= ", ".$personal_info_decode['city'];
|
||||
}else{
|
||||
$address = $personal_info_decode['city'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// state
|
||||
if(!empty($personal_info_decode['state'])){
|
||||
|
||||
if(!empty($address)){
|
||||
$address .= ", ".$personal_info_decode['state'];
|
||||
}else{
|
||||
$address = $personal_info_decode['state'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$name = "";
|
||||
|
||||
if(!empty($personal_info_decode['first_name'])){
|
||||
$name = $personal_info_decode['first_name'];
|
||||
}
|
||||
|
||||
if(!empty($personal_info_decode['last_name'])){
|
||||
|
||||
if(!empty($name)){
|
||||
$name .= " ".$personal_info_decode['last_name'];
|
||||
}else{
|
||||
$name = $personal_info_decode['last_name'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!empty($name)){
|
||||
$personal_info = $name;
|
||||
}
|
||||
|
||||
if(!empty($address)){
|
||||
if(!empty($personal_info)){
|
||||
$personal_info .= "<br/>".$address;
|
||||
}else{
|
||||
$name = $address;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($personal_info_decode['name_address'])){
|
||||
if(empty($personal_info)){
|
||||
$personal_info = $personal_info_decode['name_address'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $personal_info;
|
||||
}
|
||||
|
||||
|
||||
public static function getRowsClass($from_date, $to_date){
|
||||
$from_date = date('Y-m-d',strtotime($from_date));
|
||||
$to_date = date('Y-m-d',strtotime($to_date));
|
||||
$days = Common::daysBetweenDate($from_date,$to_date);
|
||||
$css = "";
|
||||
|
||||
if ($days <= 0){
|
||||
$css = "red";
|
||||
}else if($days > 0 && $days <= 3){
|
||||
$css = "yellow";
|
||||
}else if($days > 3){
|
||||
$css = "green";
|
||||
}
|
||||
|
||||
/*echo $days;
|
||||
echo "<br/>";
|
||||
echo $from_date."====".$to_date;
|
||||
echo "<br/>";*/
|
||||
return $css;
|
||||
}
|
||||
}
|
||||
83
src/Common/Permission.php
Normal file
83
src/Common/Permission.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?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;
|
||||
} else if ($user_type_name == "EMPLOYEE") {
|
||||
$result = self::isEmployeePermitted($controller_id);
|
||||
} else if ($user_type_name == "AFFILIATE") {
|
||||
$result = self::isAffiliatePermitted($controller_id);
|
||||
} else if ($user_type_name == "CLIENT") {
|
||||
|
||||
$client_allow_array = [CREDIT_REPORT_STATUS_CONTROLLER_ID];
|
||||
$result = in_array($controller_id,$client_allow_array);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
for employe permission check
|
||||
*/
|
||||
public static function isEmployeePermitted($controller_id)
|
||||
{
|
||||
$result = false;
|
||||
$allowed_list = [
|
||||
SECURE_PORTAL_CONTROLLER_ID,
|
||||
CLIENT_DASHBOARD_PANEL_ID,
|
||||
UPLOAD_MEDIA_PANEL_ID,
|
||||
CLIENT_PORTAL_BUTTON_ID,
|
||||
ADD_CLIENT_CONTROLLER_ID
|
||||
];
|
||||
if (self::isPermittedFromSessionByControllerId($controller_id) || in_array($controller_id,$allowed_list)) {
|
||||
$result = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/*
|
||||
for Affiliate permission check
|
||||
*/
|
||||
public static function isAffiliatePermitted($controller_id)
|
||||
{
|
||||
$result = false;
|
||||
if (self::isPermittedFromSessionByControllerId($controller_id)) {
|
||||
$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.');
|
||||
}
|
||||
}
|
||||
1073
src/Controller/AffiliateController.php
Normal file
1073
src/Controller/AffiliateController.php
Normal file
File diff suppressed because it is too large
Load Diff
176
src/Controller/AffiliateDashboardController.php
Normal file
176
src/Controller/AffiliateDashboardController.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Common\Permission;
|
||||
use App\Controller\AppController;
|
||||
use App\Helper\commonLogic;
|
||||
|
||||
/**
|
||||
* AffiliateDashboard Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\AffiliateDashboard[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class AffiliateDashboardController extends AppController
|
||||
{
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
$this->setUserType();
|
||||
|
||||
if($this->setAffiliateControllerAccess() || ($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 1 && !Permission::isEmployeeAsAdmin())){
|
||||
$this->Auth->allow(['index']);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->loadModel('MemberNotes');
|
||||
$this->loadModel('MemberReminders');
|
||||
$affiliate_user_id = $this->Auth->user('user_id');
|
||||
$member_id = $this->Auth->user('id');
|
||||
|
||||
$client_id = 0;
|
||||
$limit = 5;
|
||||
$user_type_for_note_and_reminder = 2;
|
||||
$this->memberReminderNoteActions($affiliate_user_id,$client_id);
|
||||
$this->loadModel('Notes');
|
||||
$latest_notes = $this->Notes->getNotesByCrmuserIdWithMemberId($member_id,$affiliate_user_id,$limit);
|
||||
$member_notes = $this->MemberNotes->getMemberNotesByClientIdWithMemberId($affiliate_user_id,$client_id,$user_type_for_note_and_reminder);
|
||||
$member_reminders = $this->MemberReminders->getRemindersByClientIdWithMemberId($affiliate_user_id,$client_id,$user_type_for_note_and_reminder);
|
||||
|
||||
$this->set(compact('latest_notes','member_notes','member_reminders'));
|
||||
}
|
||||
|
||||
|
||||
private function memberReminderNoteActions($member_id,$client_id){
|
||||
$this->loadModel('MemberNotes');
|
||||
$this->loadModel('MemberReminders');
|
||||
|
||||
if($this->request->is('ajax')){
|
||||
$request = $this->request->getData();
|
||||
$common = new commonLogic();
|
||||
$common->memberReminderNoteAjaxActions($request);
|
||||
}
|
||||
if($_SERVER['REQUEST_METHOD'] == "POST"){
|
||||
$request = $_POST;
|
||||
$member_note_title = $request['member_note_title'];
|
||||
$member_note_desc = $request['member_note_desc'];
|
||||
$member_reminder_title = $request['member_reminder_title'];
|
||||
$member_reminder_desc = $request['member_reminder_desc'];
|
||||
$member_remainder_date = $request['remainder_date'];
|
||||
|
||||
if(!empty($member_note_title) && !empty($member_note_desc)){
|
||||
$noteData['title'] = $member_note_title;
|
||||
$noteData['description'] = $member_note_desc;
|
||||
$noteData['member_id'] = $member_id;
|
||||
$noteData['client_id'] = $client_id;
|
||||
$noteData['user_type'] = 2;
|
||||
$response = $this->MemberNotes->addMemberNote($noteData);
|
||||
if($response){
|
||||
$this->Flash->success(__('A new note successfully added.'));
|
||||
}else{
|
||||
$this->Flash->error(__('Note has not been added.Please try again.'));
|
||||
}
|
||||
|
||||
}else if(!empty($member_reminder_title) && !empty($member_reminder_desc) && !empty($member_remainder_date)){
|
||||
$reminderData['title'] = $member_reminder_title;
|
||||
$reminderData['description'] = $member_reminder_desc;
|
||||
$reminderData['member_id'] = $member_id;
|
||||
$reminderData['client_id'] = $client_id;
|
||||
$reminderData['remainder_date'] = $member_remainder_date;
|
||||
$reminderData['user_type'] = 2;
|
||||
$response = $this->MemberReminders->addMemberReminder($reminderData);
|
||||
if($response){
|
||||
$this->Flash->success(__('A new reminder successfully added.'));
|
||||
return $this->redirect($this->referer());
|
||||
}else{
|
||||
$this->Flash->error(__('Reminder has not been added.Please try again.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Affiliate Dashboard id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$affiliateDashboard = $this->AffiliateDashboard->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('affiliateDashboard', $affiliateDashboard);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$affiliateDashboard = $this->AffiliateDashboard->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$affiliateDashboard = $this->AffiliateDashboard->patchEntity($affiliateDashboard, $this->request->getData());
|
||||
if ($this->AffiliateDashboard->save($affiliateDashboard)) {
|
||||
$this->Flash->success(__('The affiliate dashboard has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The affiliate dashboard could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('affiliateDashboard'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Affiliate Dashboard 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)
|
||||
{
|
||||
$affiliateDashboard = $this->AffiliateDashboard->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$affiliateDashboard = $this->AffiliateDashboard->patchEntity($affiliateDashboard, $this->request->getData());
|
||||
if ($this->AffiliateDashboard->save($affiliateDashboard)) {
|
||||
$this->Flash->success(__('The affiliate dashboard has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The affiliate dashboard could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('affiliateDashboard'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Affiliate Dashboard 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']);
|
||||
$affiliateDashboard = $this->AffiliateDashboard->get($id);
|
||||
if ($this->AffiliateDashboard->delete($affiliateDashboard)) {
|
||||
$this->Flash->success(__('The affiliate dashboard has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The affiliate dashboard could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
378
src/Controller/AgreementController.php
Normal file
378
src/Controller/AgreementController.php
Normal file
@@ -0,0 +1,378 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use App\Helper\commonLogic;
|
||||
use App\Utility\Common;
|
||||
/**
|
||||
* Agreement Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\Agreement[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class AgreementController extends AppController
|
||||
{
|
||||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
$this->checkRTGuser(); // is RTG User or not
|
||||
|
||||
$this->setUserType();
|
||||
$user_permissions = $this->request->session()->read('user_permissions');
|
||||
$this->set('user_permission', $user_permissions);
|
||||
if($this->employeeAccessMethod()){
|
||||
$this->Auth->allow(['index','add','edit','delete']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$search = [];
|
||||
$this->loadModel('AgreementFormats');
|
||||
|
||||
$member_id =$this->Auth->user('id');
|
||||
$requestparams = $this->request->query();
|
||||
$page_limit = 10;
|
||||
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
if(isset($request['agreement_action_types'])){
|
||||
$selected_agreement_format_ids = [];
|
||||
if(!empty($request['selected_content'])){
|
||||
$selected_agreement_format_ids = explode(',', $request['selected_content']);
|
||||
}
|
||||
|
||||
if($request['agreement_action_types'] == 1){ // delete all
|
||||
$result = $this->deleteSelectedAgreement($selected_agreement_format_ids);
|
||||
if($result){
|
||||
$this->Flash->success(__('The selected agreement(s) has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The action could not be executed. Please, try again.'));
|
||||
}
|
||||
}else if($request['agreement_action_types'] == 2){ // make active
|
||||
$status = 1;
|
||||
$result = $this->AgreementFormats->updateStatusByIdList($selected_agreement_format_ids,$status);
|
||||
if($result){
|
||||
$this->Flash->success(__('The selected agreement(s) has been made active.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The action could not be executed. Please, try again.'));
|
||||
}
|
||||
}else if($request['agreement_action_types'] == 3){ // make inactive
|
||||
$status = 2;
|
||||
$result = $this->AgreementFormats->updateStatusByIdList($selected_agreement_format_ids,$status);
|
||||
if($result){
|
||||
$this->Flash->success(__('The selected agreement(s) has been made inactive.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The action could not be executed. Please, try again.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
$search['status'] = 1;
|
||||
if(!empty($requestparams)){
|
||||
$search = $requestparams;
|
||||
}
|
||||
if(isset($search['page_limit']) && !empty($search['page_limit'])){
|
||||
$page_limit = $search['page_limit'];
|
||||
}
|
||||
$this->paginate = [
|
||||
'limit' => $page_limit
|
||||
];
|
||||
$cols = ['id','title','status','created_at','updated_at'];
|
||||
$agreements = $this->AgreementFormats->getAgreementByMemberId($member_id,$search);
|
||||
|
||||
|
||||
if(!empty($agreements)){
|
||||
$agreements = $this->paginate($agreements);
|
||||
}
|
||||
$this->set('current_module', $this->getModules());
|
||||
$this->set('page_list', $this->getPages());
|
||||
$this->set('module_pages', $this->getPages());
|
||||
$this->set(compact('agreements','search','page_limit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Agreement id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$agreement = $this->Agreement->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('agreement', $agreement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$this->loadModel('Clients');
|
||||
$this->loadModel('PredefinedAgreementFormats');
|
||||
$step_name = 'is_agreement';
|
||||
if($this->request->is('ajax')){
|
||||
$request = $this->request->getData();
|
||||
if($request['action'] == "GET_TEMPLATE"){
|
||||
$template['id'] = $request['template_id'];
|
||||
$agreementsTemplates = $this->PredefinedAgreementFormats->getAgreementTemplateById($template['id']);
|
||||
//pr($agreementsTemplates);exit;
|
||||
$response['title'] = $agreementsTemplates->title;
|
||||
$response['content'] = $agreementsTemplates->content;
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->request->is('post')){
|
||||
$this->loadModel('AgreementFormats');
|
||||
$this->loadModel('AgreementAssignments');
|
||||
$request = $this->request->getData();
|
||||
$step_status = $request['step_status'];
|
||||
if($step_status == 0){
|
||||
$this->loadModel('CmsuserStatus');
|
||||
$this->CmsuserStatus->upgradeCmsuserStatus($this->Auth->user('id'), $step_name);
|
||||
}
|
||||
$inputData['member_id'] = $this->Auth->user('id');
|
||||
$inputData['title'] = $request['title'];
|
||||
$common = new Common;
|
||||
$file_path = "agreenment_contents/".$inputData['member_id'];
|
||||
$inputData['content'] = $common->htmlFilewrite($request['content'], $file_path);
|
||||
$inputData['status'] = $request['status'];
|
||||
$result = $this->AgreementFormats->insertAgreementFormat($inputData);
|
||||
if(!empty($result)){
|
||||
if(!empty($request['client_ids'])){
|
||||
$commonLogic = new commonLogic;
|
||||
foreach($request['client_ids'] as $client_id){
|
||||
$assignment['current_values'] = $commonLogic->saveAgreementInfo($inputData['member_id'],$client_id);
|
||||
$assignment['agreement_format_id'] = $result->id;
|
||||
$assignment['client_id'] = $client_id;
|
||||
$assignment['member_id'] = $inputData['member_id'];
|
||||
$this->AgreementAssignments->insertAgreementAssignment($assignment);
|
||||
}
|
||||
}
|
||||
|
||||
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
$everything = new \App\Utility\Everythings();
|
||||
$everythinData['action_on_id'] = SAME_AS_BY;
|
||||
$everythinData['action_on_name'] = SAME_AS_BY;
|
||||
$everythinData['event_name'] = "agreement_add";
|
||||
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
|
||||
$everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// Everything Insertion
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "AGREEMENT_ADD";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$logData['input_data']["id"] = $result->id;
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('The agreement has been added successfully.'));
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The agreement has not been added.Please try again.'));
|
||||
}else{
|
||||
$this->setSteps($step_name, $this->Auth->user('id'));
|
||||
}
|
||||
|
||||
$member_id = $this->Auth->user('id');
|
||||
$clientList = $this->Clients->getClientList($member_id);
|
||||
$template['status'] = 1;
|
||||
$templateCols = ['id','title'];
|
||||
$agreementsTemplates = $this->PredefinedAgreementFormats->getAllAgreementTemplates($template,$templateCols);
|
||||
$templateList = [];
|
||||
if(!empty($agreementsTemplates->toArray())){
|
||||
foreach ($agreementsTemplates as $temp){
|
||||
$templateList[$temp->id] = $temp->title;
|
||||
}
|
||||
}
|
||||
$this->set(compact('clientList','templateList'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Agreement 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)
|
||||
{
|
||||
$member_id = $this->Auth->user('id');
|
||||
$this->loadModel('AgreementFormats');
|
||||
$this->loadModel('AgreementAssignments');
|
||||
$this->loadModel('PredefinedAgreementFormats');
|
||||
$this->loadModel('Clients');
|
||||
$content_path = "agreenment_contents/".$member_id."/";
|
||||
if($this->request->is('ajax')){
|
||||
$request = $this->request->getData();
|
||||
if($request['action'] == "GET_TEMPLATE"){
|
||||
$template['id'] = $request['template_id'];
|
||||
$agreementsTemplates = $this->PredefinedAgreementFormats->getAgreementTemplateById($template['id']);
|
||||
//pr($agreementsTemplates);exit;
|
||||
$response['title'] = $agreementsTemplates->title;
|
||||
$response['content'] = $agreementsTemplates->content;
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
$inputData['id'] = $id;
|
||||
$inputData['member_id'] = $member_id;
|
||||
$inputData['title'] = $request['title'];
|
||||
$inputData['content'] = $request['content'];
|
||||
$inputData['status'] = $request['status'];
|
||||
$result = $this->AgreementFormats->updateAgreementFormat($inputData);
|
||||
|
||||
if(!empty($result)){
|
||||
|
||||
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
$everything = new \App\Utility\Everythings();
|
||||
$everythinData['action_on_id'] = SAME_AS_BY;
|
||||
$everythinData['action_on_name'] = SAME_AS_BY;
|
||||
$everythinData['event_name'] = "agreement_edit";
|
||||
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
|
||||
$everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// Everything Insertion
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "AGREEMENT_EDIT";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$logData['input_data']["id"]=$id;
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('The agreement has been updated successfully.'));
|
||||
return $this->redirect(['action' => 'index']);
|
||||
// $this->AgreementAssignments->deleteAll(['agreement_format_id'=>$id]);
|
||||
// if(!empty($request['client_ids'])){
|
||||
// foreach($request['client_ids'] as $client_id){
|
||||
// $assignment['agreement_format_id'] = $id;
|
||||
// $assignment['client_id'] = $client_id;
|
||||
// $assignment['member_id'] = $inputData['member_id'];
|
||||
// $this->AgreementAssignments->insertAgreementAssignment($assignment);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $this->Flash->success(__('The agreement has been updated successfully.'));
|
||||
// return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The agreement has not been updated.Please try again.'));
|
||||
}
|
||||
|
||||
$agreement = $this->AgreementFormats->getAgreementByIdWithMemberId($member_id, $id);
|
||||
$agreement->content = file_get_contents($content_path.$agreement->content);
|
||||
$selected_client_idList = $this->AgreementAssignments->getClientIdListByIdAgreementFormatId($id);
|
||||
$clientList = $this->Clients->getClientList($member_id);
|
||||
$template['status'] = 1;
|
||||
$templateCols = ['id','title'];
|
||||
$agreementsTemplates = $this->PredefinedAgreementFormats->getAllAgreementTemplates($template,$templateCols);
|
||||
$templateList = [];
|
||||
if(!empty($agreementsTemplates->toArray())){
|
||||
foreach ($agreementsTemplates as $temp){
|
||||
$templateList[$temp->id] = $temp->title;
|
||||
}
|
||||
}
|
||||
$this->set(compact('agreement','clientList','selected_client_idList','templateList'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Agreement 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']);
|
||||
$this->loadModel('AgreementFormats');
|
||||
$this->loadModel('AgreementAssignments');
|
||||
$member_id = $this->Auth->user('id');
|
||||
$agreements = $this->AgreementFormats->getAgreementByIdWithMemberId($member_id, $id);
|
||||
if($agreements->status == 1){
|
||||
$isExistClient = $this->AgreementAssignments->isExistClient($id);
|
||||
if($isExistClient){
|
||||
$status = 2;
|
||||
$this->AgreementFormats->updateStatusById($id,$status);
|
||||
|
||||
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
$everything = new \App\Utility\Everythings();
|
||||
$everythinData['action_on_id'] = SAME_AS_BY;
|
||||
$everythinData['action_on_name'] = SAME_AS_BY;
|
||||
$everythinData['event_name'] = "agreement_delete";
|
||||
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
|
||||
$everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// Everything Insertion
|
||||
//add_log
|
||||
$logData['action'] = "AGREEMENT_DELETE";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$logData['input_data']["id"]=$id;
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('The agreement has been deleted.'));
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->AgreementFormats->deleteAgreementById($id);
|
||||
if($result){
|
||||
|
||||
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
$everything = new \App\Utility\Everythings();
|
||||
$everythinData['action_on_id'] = SAME_AS_BY;
|
||||
$everythinData['action_on_name'] = SAME_AS_BY;
|
||||
$everythinData['event_name'] = "agreement_delete";
|
||||
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
|
||||
$everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// Everything Insertion
|
||||
|
||||
$this->Flash->success(__('The agreement has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The agreement could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
private function deleteSelectedAgreement($idList){
|
||||
$member_id = $this->Auth->user('id');
|
||||
$this->loadModel('AgreementFormats');
|
||||
$this->loadModel('AgreementAssignments');
|
||||
$finalResult = false;
|
||||
if(!empty($idList)){
|
||||
foreach ($idList as $id){
|
||||
$agreements = $this->AgreementFormats->getAgreementByIdWithMemberId($member_id, $id);
|
||||
if($agreements->status == 1){
|
||||
$isExistClient = $this->AgreementAssignments->isExistClient($id);
|
||||
if($isExistClient){
|
||||
$status = 2;
|
||||
$this->AgreementFormats->updateStatusById($id,$status);
|
||||
}
|
||||
}else if($agreements->status == 2){
|
||||
$this->AgreementFormats->deleteAgreementById($id);
|
||||
}
|
||||
}
|
||||
$finalResult = true;
|
||||
}
|
||||
|
||||
return $finalResult;
|
||||
}
|
||||
}
|
||||
143
src/Controller/AgreementTemplateController.php
Normal file
143
src/Controller/AgreementTemplateController.php
Normal file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
|
||||
/**
|
||||
* AgreementTemplate Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\AgreementTemplate[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class AgreementTemplateController extends AppController
|
||||
{
|
||||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
|
||||
$this->loadModel('PredefinedAgreementFormats');
|
||||
$user_permissions = $this->request->session()->read('user_permissions');
|
||||
$this->set('user_permission', $user_permissions);
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$search = [];
|
||||
|
||||
$requestparams = $this->request->query();
|
||||
$page_limit = 10;
|
||||
if(!empty($requestparams)){
|
||||
$search = $requestparams;
|
||||
}
|
||||
|
||||
if(isset($search['page_limit']) && !empty($search['page_limit'])){
|
||||
$page_limit = $search['page_limit'];
|
||||
}
|
||||
$this->paginate = [
|
||||
'limit' => $page_limit
|
||||
];
|
||||
$agreements = $this->PredefinedAgreementFormats->getAllAgreementTemplates($search);
|
||||
if(!empty($agreements)){
|
||||
$agreements = $this->paginate($agreements);
|
||||
}
|
||||
$this->set('current_module', $this->getModules());
|
||||
$this->set('page_list', $this->getPages());
|
||||
$this->set('module_pages', $this->getPages());
|
||||
$this->set(compact('agreements','search','page_limit'));
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Agreement Template id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$agreementTemplate = $this->AgreementTemplate->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('agreementTemplate', $agreementTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
$inputData['member_id'] = $this->Auth->user('id');
|
||||
$inputData['title'] = $request['title'];
|
||||
$inputData['content'] = $request['content'];
|
||||
$inputData['status'] = $request['status'];
|
||||
$result = $this->PredefinedAgreementFormats->insertAgreementFormat($inputData);
|
||||
if(!empty($result)){
|
||||
$this->Flash->success(__('The agreement template has been added successfully.'));
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The agreement template has not been added.Please try again.'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Agreement Template 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)
|
||||
{
|
||||
$member_id = $this->Auth->user('id');
|
||||
$this->loadModel('AgreementFormats');
|
||||
$this->loadModel('AgreementAssignments');
|
||||
$this->loadModel('Clients');
|
||||
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
$inputData['id'] = $id;
|
||||
$inputData['member_id'] = $member_id;
|
||||
$inputData['title'] = $request['title'];
|
||||
$inputData['content'] = $request['content'];
|
||||
$inputData['status'] = $request['status'];
|
||||
$result = $this->PredefinedAgreementFormats->updateAgreementFormat($inputData);
|
||||
if(!empty($result)){
|
||||
$this->Flash->success(__('The agreement template has been updated successfully.'));
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The agreement template has not been updated.Please try again.'));
|
||||
}
|
||||
|
||||
$agreement = $this->PredefinedAgreementFormats->getAgreementTemplateById($id);
|
||||
$this->set(compact('agreement'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Agreement Template 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']);
|
||||
$result = $this->PredefinedAgreementFormats->deleteAgreementTemplateById($id);
|
||||
if($result){
|
||||
$this->Flash->success(__('The agreement template has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The agreement template could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
2387
src/Controller/AppController.php
Normal file
2387
src/Controller/AppController.php
Normal file
File diff suppressed because it is too large
Load Diff
467
src/Controller/AutomationScheduleController.php
Normal file
467
src/Controller/AutomationScheduleController.php
Normal file
@@ -0,0 +1,467 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Common\Permission;
|
||||
use App\Controller\AppController;
|
||||
|
||||
/**
|
||||
* AutomationSchedule Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\AutomationSchedule[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class AutomationScheduleController extends AppController {
|
||||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
|
||||
if (Permission::isEmployeeAsAdmin()) {
|
||||
$this->Auth->allow(['index', 'add', 'edit', 'delete']);
|
||||
}
|
||||
|
||||
$this->set('user_permission', $this->request->session()->read('user_permissions'));
|
||||
$this->checkRTGuser(); // is RTG User or not
|
||||
|
||||
$this->setUserType(); // Set CRM/CMS/Contacts user
|
||||
// $this->loadModel('MemberPackages');
|
||||
// $isVelocityUser = $this->MemberPackages->isVelocityuser($this->Auth->user('id'));
|
||||
// if($_SESSION['hasEpicVelocity'] || $_SESSION['hasVelocity']){
|
||||
//
|
||||
// }else{
|
||||
// return $this->redirect($this->referer());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index() {
|
||||
$this->loadModel('AutomationSchedules');
|
||||
$this->loadModel('Automationsetup');
|
||||
$this->loadModel('Sertg');
|
||||
$this->loadModel('LetterExtras');
|
||||
$this->loadModel('Clients');
|
||||
$requestparams = $this->request->query();
|
||||
$sertgList = [];
|
||||
$letterList = [];
|
||||
$sertg_personal_info = [];
|
||||
$letter_personal_info = [];
|
||||
$member_id = $this->Auth->user('id');
|
||||
$automation_id_list = [];
|
||||
$search = [];
|
||||
$export_type = 1;
|
||||
$automation_type = "";
|
||||
$client_id = "";
|
||||
$searchText = "";
|
||||
if(!empty($requestparams)){
|
||||
$search = $requestparams;
|
||||
}
|
||||
$auttomation_table_condition = "";
|
||||
$page_limit = 10;
|
||||
if (isset($this->request->query['page_limit'])) {
|
||||
$page_limit = $this->request->query('page_limit');
|
||||
}
|
||||
$this->paginate = [
|
||||
'limit' => $page_limit
|
||||
|
||||
];
|
||||
if(isset($search['file_type']) && !empty($search['file_type'])){
|
||||
$export_type = $search['file_type'];
|
||||
}else{
|
||||
$search['file_type'] = $export_type;
|
||||
}
|
||||
//echo $export_type;exit;
|
||||
if(isset($search['automation_type']) && !empty($search['automation_type'])){
|
||||
$automation_type = $search['automation_type'];
|
||||
}
|
||||
|
||||
if(isset($search['client_id']) && !empty($search['client_id'])){
|
||||
$client_id = $search['client_id'];
|
||||
}
|
||||
|
||||
if(isset($search['search']) && !empty($search['search'])){
|
||||
$searchText = $search['search'];
|
||||
}
|
||||
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
$request['automations'] = [];
|
||||
if(!empty($request['selected_content'])){
|
||||
$request['automations'] = explode(",",$request['selected_content']);
|
||||
}
|
||||
//pr($request);exit;
|
||||
if($request['automation_action_type'] == 1){
|
||||
$isDeleted = $this->AutomationSchedules->automationDeleteByIds($request['automations']);
|
||||
if($isDeleted){
|
||||
$this->Flash->success(__('The selected automation schedule has been deleted.'));
|
||||
// return $this->redirect(['action' => 'index']);
|
||||
}else{
|
||||
$this->Flash->error(__('The selected automation schedule could not be deleted. Please, try again.'));
|
||||
}
|
||||
} else if($request['automation_action_type'] == 2){
|
||||
$isDeleted = $this->AutomationSchedules->automationStatusUpdateByIds($request['automations'],3);
|
||||
if($isDeleted){
|
||||
$this->Flash->success(__('The selected automation schedule has been paused.'));
|
||||
//return $this->redirect(['action' => 'index']);
|
||||
}else{
|
||||
$this->Flash->error(__('The selected automation schedule could not be paused. Please, try again.'));
|
||||
}
|
||||
}else if($request['automation_action_type'] == 3){
|
||||
$isDeleted = $this->AutomationSchedules->automationStatusUpdateByIds($request['automations'],1);
|
||||
if($isDeleted){
|
||||
$this->Flash->success(__('The selected automation schedule has been one time.'));
|
||||
//return $this->redirect(['action' => 'index']);
|
||||
}else{
|
||||
$this->Flash->error(__('The selected automation schedule could not be one time. Please, try again.'));
|
||||
}
|
||||
}else if($request['automation_action_type'] == 4){
|
||||
$isDeleted = $this->AutomationSchedules->automationStatusUpdateByIds($request['automations'],2);
|
||||
if($isDeleted){
|
||||
$this->Flash->success(__('The selected automation schedule has been recurring.'));
|
||||
//return $this->redirect(['action' => 'index']);
|
||||
}else{
|
||||
$this->Flash->error(__('The selected automation schedule could not be recurring. Please, try again.'));
|
||||
}
|
||||
}else if($request['automation_action_type'] == 5){
|
||||
$isDeleted = $this->AutomationSchedules->automationStatusUpdateByIds($request['automations'],4);
|
||||
if($isDeleted){
|
||||
$this->Flash->success(__('The selected automation schedule has been twice.'));
|
||||
//return $this->redirect(['action' => 'index']);
|
||||
}else{
|
||||
$this->Flash->error(__('The selected automation schedule could not be twice. Please, try again.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$automationSchedules = $this->AutomationSchedules->getAutomationScheduleListBymemberId($member_id,$search);
|
||||
$automation_info = [];
|
||||
$automation_schedule_id_list = [];
|
||||
if($automationSchedules){
|
||||
foreach($automationSchedules as $automationSchedule){
|
||||
if($automationSchedule->velocity_type == 1){
|
||||
$sertgList[] = $automationSchedule->sertg_id;
|
||||
}else if($automationSchedule->velocity_type == 2){
|
||||
$letterList[] = $automationSchedule->sertg_id;
|
||||
}else if($automationSchedule->velocity_type == 3){
|
||||
$rtgLetterList[] = $automationSchedule->sertg_id;
|
||||
}
|
||||
|
||||
if($automationSchedule->is_enable == 1){
|
||||
$automation_id_list[] = $automationSchedule->automation_id;
|
||||
$automation_schedule_id_list[$automationSchedule->id][] = $automationSchedule->automation_id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!empty($automation_id_list)){
|
||||
$automation_id_list = array_unique($automation_id_list);
|
||||
$automation_info_list = $this->Automationsetup->getAutomationByIdList($automation_id_list);
|
||||
if(!empty($automation_schedule_id_list)){
|
||||
foreach ($automation_schedule_id_list as $schedule_id => $schlist){
|
||||
if(!empty($schlist)){
|
||||
foreach($schlist as $slist){
|
||||
if(!empty($automation_info[$schedule_id])){
|
||||
$automation_info[$schedule_id] .= ", ".$automation_info_list[$slist];
|
||||
}else{
|
||||
$automation_info[$schedule_id] = $automation_info_list[$slist];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!empty($automationSchedules)){
|
||||
$automationSchedule = $this->paginate($automationSchedules->distinct('AutomationSchedules.id'));
|
||||
}else{
|
||||
$automationSchedule = [];
|
||||
}
|
||||
|
||||
$clientList = $this->Clients->getClientList($member_id);
|
||||
$user_permissions = $this->request->session()->read('user_permissions');
|
||||
$this->set('user_permission', $user_permissions);
|
||||
$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(compact('page_limit','search','clientList','export_type','automationSchedules','letter_personal_info','sertg_personal_info','automation_info'));
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Automation Schedule id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null) {
|
||||
$automationSchedule = $this->AutomationSchedule->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('automationSchedule', $automationSchedule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
|
||||
private function generateEpicVelocityModal($member_id) {
|
||||
$this->loadModel('Letters');
|
||||
$this->loadModel('LetterExtras');
|
||||
$letterInfo = $this->LetterExtras->getAllLettersListByMemberId($member_id);
|
||||
$allShortName = json_decode(LETTER_TYPES_SHORT_NAME);
|
||||
if (!empty($letterInfo)) {
|
||||
foreach ($letterInfo as $letter) {
|
||||
//pr($client);exit;
|
||||
$res['id'] = $letter->letter->id;
|
||||
$res['dob'] = date('d/m/Y', strtotime($letter->dob));
|
||||
$personal_info = json_decode($letter->personal_info, true);
|
||||
$res['personal_info'] = $personal_info['client_name'] . "<br/>" . $personal_info['address'];
|
||||
$res['ssn'] = $letter->ssn;
|
||||
$res['client_id'] = $letter->client_id;
|
||||
$res['slected_letter'] = "";
|
||||
if (isset($letter->letter_types) && !empty($letter->letter_types)) {
|
||||
$letter->letter_types = explode(',', $letter->letter_types);
|
||||
foreach ($letter->letter_types as $type) {
|
||||
if (!empty($res['slected_letter'])) {
|
||||
$res['slected_letter'] .= ", " . $allShortName->{$type};
|
||||
} else {
|
||||
$res['slected_letter'] = $allShortName->{$type};
|
||||
}
|
||||
}
|
||||
}
|
||||
$res['letter_id'] = $res['id'];
|
||||
$res['created_on'] = isset($letter->created_on) ? date('Y-m-d', strtotime($letter->created_on)) : ""; //$clientInfo['client']->dob;
|
||||
$res['next_section_date'] = isset($letter->next_action_date) ? $letter->next_action_date : ""; //$clientInfo['client']->dob;
|
||||
$response[] = $res;
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function generateSertgModal($member_id) {
|
||||
$response = [];
|
||||
if ($member_id > 0) {
|
||||
$allShortName = json_decode(LETTER_TYPES_SHORT_NAME);
|
||||
$this->loadModel('Sertg');
|
||||
$sertgList = $this->Sertg->getSertgByMemberId($member_id);
|
||||
|
||||
if (!empty($sertgList)) {
|
||||
foreach ($sertgList as $sertg) {
|
||||
$res['id'] = $sertg->id;
|
||||
$res['dob'] = $sertg->dob;
|
||||
$res['personal_info'] = $sertg->personal_info;
|
||||
$res['ssn'] = $sertg->ssn;
|
||||
$res['slected_letter'] = "";
|
||||
$res['client_id'] = $sertg->client_id;
|
||||
if (isset($sertg->lettertypes) && !empty($sertg->lettertypes)) {
|
||||
$sertg->lettertypes = explode(',', $sertg->lettertypes);
|
||||
foreach ($sertg->lettertypes as $type) {
|
||||
if (!empty($res['slected_letter'])) {
|
||||
$res['slected_letter'] .= ", " . $allShortName->{$type};
|
||||
} else {
|
||||
$res['slected_letter'] = $allShortName->{$type};
|
||||
}
|
||||
}
|
||||
}
|
||||
$res['letter_id'] = $res['id'];
|
||||
$res['created_on'] = isset($sertg->created_on) ? date('Y-m-d', strtotime($sertg->created_on)) : ""; //$clientInfo['client']->dob;
|
||||
$res['next_section_date'] = isset($sertg->next_section_date) ? $letter->next_section_date : ""; //$clientInfo['client']->dob;
|
||||
$response[] = $res;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function add() {
|
||||
$member_id = $this->Auth->user('id');
|
||||
if ($this->request->is('ajax')) {
|
||||
$request = $this->request->getData();
|
||||
$member_id = $this->Auth->user('id');
|
||||
if ($request['action'] == 'GET_CLIENT_FILES_LIST_POPUP') {
|
||||
$velocity_type = $request['velocity_type'];
|
||||
if($velocity_type == 2){
|
||||
$response = $this->generateEpicVelocityModal($member_id);
|
||||
}else if($velocity_type == 1){
|
||||
$response = $this->generateSertgModal($member_id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
$this->loadModel('AutomationSchedules');
|
||||
$this->loadModel('AutomationScheduleExports');
|
||||
$automationSchedule['sertg_id'] = $request['sertg_id'];
|
||||
$automationSchedule['member_id'] = $this->Auth->user('id');
|
||||
$automationSchedule['client_id'] = $request['client_id'];
|
||||
$automationSchedule['type'] = $request['type'];
|
||||
$automationSchedule['velocity_type'] = $request['velocity_type'];
|
||||
$automationSchedule['day_value'] = $request['number_of_day'];
|
||||
$automation = $this->AutomationSchedules->addSchedule($automationSchedule);
|
||||
if($automation){
|
||||
$scheduleExport['automation_schedule_id'] = $automation->id;
|
||||
$scheduleExport['automation_schedule_id'] = $scheduleExport['automation_schedule_id'];
|
||||
$scheduleExport['automation_id_list'] = $request['export_type'];
|
||||
$this->AutomationScheduleExports->insertScheduleExports($scheduleExport);
|
||||
$this->Flash->success(__('The automation schedule has been saved.'));
|
||||
}else{
|
||||
$this->Flash->error(__('The automation schedule could not be saved. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}else{
|
||||
$this->loadModel('Automationsetup');
|
||||
$automation_info = $this->Automationsetup->getMemberExportsByMemberId($member_id);
|
||||
$this->set(compact('automation_info'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Automation Schedule 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) {
|
||||
$member_id = $this->Auth->user('id');
|
||||
// if ($this->request->is('ajax')) {
|
||||
// $request = $this->request->getData();
|
||||
// if ($request['action'] == 'GET_CLIENT_FILES_LIST_POPUP') {
|
||||
// $velocity_type = $request['velocity_type'];
|
||||
// if($velocity_type == 2){
|
||||
// $response = $this->generateEpicVelocityModal($member_id);
|
||||
// }else if($velocity_type == 1){
|
||||
// $response = $this->generateSertgModal($member_id);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// echo json_encode($response);
|
||||
// exit;
|
||||
// }
|
||||
|
||||
$this->loadModel('AutomationSchedules');
|
||||
$this->loadModel('AutomationScheduleExports');
|
||||
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$request = $this->request->getData();
|
||||
$automationSchedule['sertg_id'] = $request['sertg_id'];
|
||||
$automationSchedule['member_id'] = $this->Auth->user('id');
|
||||
$automationSchedule['client_id'] = $request['client_id'];
|
||||
$automationSchedule['type'] = $request['type'];
|
||||
//$automationSchedule['velocity_type'] = $request['velocity_type'];
|
||||
$automationSchedule['day_value'] = $request['number_of_day'];
|
||||
$automationSchedule = $this->AutomationSchedules->updateSchedule($automationSchedule,$id);
|
||||
|
||||
if ($automationSchedule) {
|
||||
//$this->AutomationScheduleExports->deleteScheduleExportByAutomationScheduleId($id);
|
||||
$scheduleExport['automation_schedule_id'] = $id;
|
||||
|
||||
$all_exports_ids = [];
|
||||
if(!empty($request['all_export_ids'])){
|
||||
$all_exports_ids = json_decode($request['all_export_ids'],true);
|
||||
}
|
||||
|
||||
$scheduleExport['selected_export_ids'] = $request['export_type'];
|
||||
$scheduleExport['all_export_ids'] = $all_exports_ids;
|
||||
|
||||
$this->AutomationScheduleExports->updateScheduleExportsById($scheduleExport);
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "AUTOMATIONSCHEDULE_EDIT";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('The automation schedule has been saved.'));
|
||||
}else{
|
||||
$this->Flash->error(__('The automation schedule could not be saved. Please, try again.'));
|
||||
}
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}else{
|
||||
$this->loadModel('Sertg');
|
||||
$this->loadModel('Automationsetup');
|
||||
$this->loadModel('LetterExtras');
|
||||
$selected_export_type = [];
|
||||
$all_selected_export_type = [];
|
||||
$assosAutomationExportByAutomationId = [];
|
||||
$automation_schedule = $this->AutomationSchedules->getAutomationScheduleById($id,$member_id);
|
||||
$velcity_type = $automation_schedule->velocity_type;
|
||||
if(!empty($automation_schedule->automation_schedule_exports)){
|
||||
foreach($automation_schedule->automation_schedule_exports as $export){
|
||||
if($export->is_enable == 1){
|
||||
$selected_export_type[] = $export->automation_id;
|
||||
}
|
||||
$all_selected_export_type[] = $export->automation_id;
|
||||
$assosAutomationExportByAutomationId[$export->automation_id] = $export->id;
|
||||
}
|
||||
}
|
||||
|
||||
//$automation_info = $this->Automationsetup->getMemberExportsByMemberId($member_id);
|
||||
$automation_info = $this->Automationsetup->getAutomationByIdList($all_selected_export_type);
|
||||
|
||||
$sertg_id = $automation_schedule->sertg_id;
|
||||
if($velcity_type == 1){
|
||||
$velocity = $this->Sertg->getSertgById($sertg_id,$member_id);
|
||||
$personal_info = $velocity->personal_info;
|
||||
}else if($velcity_type == 2){
|
||||
$velocity = $this->LetterExtras->getLetterById($sertg_id,$member_id);
|
||||
$personal_info = json_decode($velocity->personal_info, true);
|
||||
$personal_info = $personal_info['client_name'] . "<br/>" . $personal_info['address'];
|
||||
}
|
||||
|
||||
$this->set(compact('assosAutomationExportByAutomationId','personal_info','automation_schedule','selected_export_type','automation_info'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Automation Schedule id.
|
||||
* @return \Cake\Http\Response|null Redirects to index.
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
|
||||
if($this->request->is('post')){
|
||||
$this->loadModel('AutomationSchedules');
|
||||
$this->loadModel('AutomationScheduleExports');
|
||||
if ($this->AutomationSchedules->deleteAutomationScheduleById($id)) {
|
||||
$this->AutomationScheduleExports->deleteScheduleExportByAutomationScheduleId($id);
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "AUTOMATIONSCHEDULE_DELETE";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('The automation schedule has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The automation schedule could not be deleted. Please, try again.'));
|
||||
}
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
420
src/Controller/AutomationsetupController.php
Normal file
420
src/Controller/AutomationsetupController.php
Normal file
@@ -0,0 +1,420 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Common\Permission;
|
||||
use App\Controller\AppController;
|
||||
use App\Utility\DropboxAuthorize;
|
||||
use Cake\I18n\I18n;
|
||||
|
||||
use RingCentral\SDK\SDK;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use GuzzleHttp\Client as GuzzleHttpClient;
|
||||
use Krizalys\Onedrive\Client;
|
||||
use Microsoft\Graph\Graph;
|
||||
/**
|
||||
* MemberExports Controller
|
||||
*
|
||||
* @property \App\Model\Table\MemberExportsTable $MemberExports
|
||||
*
|
||||
* @method \App\Model\Entity\MemberExport[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class AutomationsetupController extends AppController {
|
||||
|
||||
public function initialize() {
|
||||
|
||||
parent::initialize();
|
||||
$_SESSION["crm_url_active"] = 2;
|
||||
$this->viewBuilder()->layout("new_dashboard");
|
||||
I18n::locale('en_US');
|
||||
$this->Auth->allow(['sendbox','paymentsetup']);
|
||||
//pr($this->request->session()->read('user_permissions'));exit;
|
||||
$this->set('user_permission', $this->request->session()->read('user_permissions'));
|
||||
$this->checkRTGuser(); // is RTG User or not
|
||||
|
||||
$this->setUserType(); // Set CRM/CMS/Contacts user
|
||||
$this->checkAutomationSetupPermission();
|
||||
}
|
||||
|
||||
private function checkAutomationSetupPermission() {
|
||||
|
||||
if(Permission::isEmployeeAsAdmin()){
|
||||
$this->Auth->allow('index');
|
||||
return ;
|
||||
}
|
||||
//$this->loadModel('MemberPackages');
|
||||
//$isVelocityUser = $this->MemberPackages->isVelocityuser($this->Auth->user('id'));
|
||||
if($_SESSION['hasEpicVelocity'] || $_SESSION['hasVelocity'] || $_SESSION['hasLS_Fax_Rtg_user']){
|
||||
|
||||
}else{
|
||||
|
||||
$this->Flash->error(__("You don't have permission for Automation Setup"));
|
||||
return $this->redirect($this->referer());
|
||||
}
|
||||
}
|
||||
|
||||
public function sendbox() {
|
||||
if ($this->request->is('ajax')) {
|
||||
$this->loadModel('Ringcentral');
|
||||
$inputData = $this->request->getData();
|
||||
$credentials['account_phone'] = $inputData['ring_account'];
|
||||
$credentials['extension'] = !empty($inputData['ring_extension']) ? $inputData['ring_extension'] : 101;
|
||||
$credentials['password'] = $inputData['ring_password'];
|
||||
$credentials['clientId'] = $inputData['ring_client_id'];
|
||||
$credentials['clientsecret'] = $inputData['ring_client_secret'];
|
||||
$credentials['server'] = $inputData['ring_server'];
|
||||
$credentials['sender_number'] = $inputData['ring_account'];
|
||||
$credentials['dateFrom'] = 'yyyy-mm-dd';
|
||||
$credentials['dateTo'] = 'yyyy-mm-dd';
|
||||
$credentials['smsText'] = 'This is a Test SMS from RTG';
|
||||
$credentials['receiverFaxNo'] = $inputData['ring_fax_default_number'];
|
||||
$credentials['mobileNumber'] = $inputData['ring_mobile_no_sender'];
|
||||
|
||||
//pr($credentials);exit;
|
||||
$fileToFax = realpath('dummy1.pdf');
|
||||
if ($inputData['type'] == 1) {
|
||||
$response['type'] = 1;
|
||||
$status = $this->Ringcentral->sendSMSbyRingCentral($credentials['mobileNumber'], $credentials['smsText'], $credentials);
|
||||
|
||||
if ($status['status']) {
|
||||
$response['status'] = "success";
|
||||
} else {
|
||||
$response['status'] = "notsuccess";
|
||||
}
|
||||
} elseif ($inputData['type'] == 2) {
|
||||
$res = $this->Ringcentral->sendBoxFax($credentials, $fileToFax);
|
||||
if ($res == "success") {
|
||||
$response['type'] = 2;
|
||||
}
|
||||
$response['status'] = $res;
|
||||
}
|
||||
$response['data'] = $this->ringCentralIntoDB($inputData, $response['status']);
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
} else {
|
||||
$member_id = $this->Auth->user('id');
|
||||
$ringcentralSandboxTable = TableRegistry::get('rincentral_sandbox');
|
||||
$ringcentralSandboxInfo = $ringcentralSandboxTable->find()->where(['member_id' => $member_id])->first();
|
||||
//pr($ringcentralSandboxInfo);exit;
|
||||
$this->set(compact('ringcentralSandboxInfo'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|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' => [
|
||||
'Automationsetup.id' => 'desc'
|
||||
]
|
||||
];
|
||||
$searchText = '';
|
||||
$searchString = "";
|
||||
$export_type = "";
|
||||
if (isset($this->request->query['search']) && !empty($this->request->query['search'])) {
|
||||
$searchText = $this->request->query['search'];
|
||||
$searchString = "(name LIKE '%" . $searchText . "%')";
|
||||
}
|
||||
|
||||
if (isset($this->request->query['export_id']) && !empty($this->request->query['export_id'])) {
|
||||
$export_type = $this->request->query['export_id'];
|
||||
if (!empty($searchString)) {
|
||||
$searchString .= " AND export_id = " . $export_type;
|
||||
} else {
|
||||
$searchString = "export_id = " . $export_type;
|
||||
}
|
||||
}
|
||||
$memberExports = $this->Automationsetup->find()->where(['member_id' => $this->Auth->user('id'), $searchString]);
|
||||
$memberExports = $this->paginate($memberExports);
|
||||
//$this->set('searchText', $search);
|
||||
$this->set(compact('memberExports', 'page_limit', 'searchText', 'export_type'));
|
||||
$this->set('current_module', $this->getModules());
|
||||
$this->set('page_list', $this->getPages());
|
||||
$this->set('module_pages', $this->getPages());
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Member Export id.
|
||||
* @return \Cake\Http\Response|void
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null) {
|
||||
|
||||
$memberExport = $this->Automationsetup->get($id);
|
||||
|
||||
$this->set('memberExport', $memberExport);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add() {
|
||||
|
||||
$step_name = 'is_automation';
|
||||
if ($this->request->is('post')) {
|
||||
$requestData = $this->request->getData();
|
||||
$requestData['email_body'] = nl2br($this->request->getData('email_body'));
|
||||
$requestData = array_filter($requestData);
|
||||
if ($saved = $this->Automationsetup->create($requestData)) {
|
||||
$step_status = $this->request->data['step_status'];
|
||||
if($step_status == 0){
|
||||
$this->loadModel('CmsuserStatus');
|
||||
$this->CmsuserStatus->upgradeCmsuserStatus($this->Auth->user('id'), $step_name);
|
||||
}
|
||||
$this->Flash->success(__('The member export has been saved.'));
|
||||
if($requestData['export_id'] == 2) {
|
||||
return $this->redirect(['action' => 'edit',$saved->id]);
|
||||
}
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The member export could not be saved. Please, try again.'));
|
||||
|
||||
}else{
|
||||
$this->setSteps($step_name, $this->Auth->user('id'));
|
||||
}
|
||||
//$members = $this->MemberExports->Members->find('list', ['limit' => 200]);
|
||||
//$exports = $this->MemberExports->Exports->find('list', ['limit' => 200]);
|
||||
$cmsuser_id = $this->Auth->user('id');
|
||||
$auth_email = $this->Auth->user('email');
|
||||
$this->set(compact('memberExport', 'cmsuser_id', 'auth_email'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Member Export id.
|
||||
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
|
||||
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||
*/
|
||||
public function edit($id = null) {
|
||||
|
||||
$exportData = [];
|
||||
$exportData['zap_required'] = "";
|
||||
$exportData['google_required'] = "";
|
||||
$exportData['dropbox_required'] = "";
|
||||
$exportData['email_required'] = "";
|
||||
$exportData['ring_fax_required'] = "";
|
||||
$exportData['email_subject'] = "";
|
||||
$exportData['email_body'] = "";
|
||||
$exportData['ring_isEmailReceived'] = "";
|
||||
$exportData['letter_stream_required'] = "";
|
||||
|
||||
$memberExport = $this->Automationsetup->get($id);
|
||||
$export_id = $memberExport->export_id;
|
||||
$db_member_id = $memberExport->member_id;
|
||||
$auth_user_id = $this->Auth->user('id');
|
||||
if($this->verifyUser($db_member_id, $auth_user_id)){
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$json_data = json_decode($memberExport->input_json);
|
||||
//pr($json_data);exit;
|
||||
if ($export_id == 1) {
|
||||
$exportData['email'] = $json_data->email;
|
||||
$exportData['email_required'] = "required";
|
||||
$exportData['email_subject'] = $json_data->email_subject;
|
||||
$exportData['email_body'] = $json_data->email_body;
|
||||
} else if ($export_id == 2) {
|
||||
$exportData['dropbox_user_name'] = $json_data->user_name;
|
||||
$exportData['dropbox_password'] = $json_data->password;
|
||||
$exportData['dropbox_refresh_token'] = $json_data->dropbox_refresh_token;
|
||||
//$exportData['dropbox_token'] = $json_data->dropbox_token;
|
||||
$dropboxAuthorize = DropboxAuthorize::getAuthorizeDropboxButton($exportData['dropbox_user_name'],$exportData['dropbox_password']);
|
||||
$exportData['authorize_button'] = $dropboxAuthorize['button'];
|
||||
$exportData['authorize_url'] = $dropboxAuthorize['url'];
|
||||
$_SESSION['db_id'] = $id;
|
||||
$exportData['dropbox_required'] = "required";
|
||||
} else if ($export_id == 3) {
|
||||
$exportData['google_client_id'] = $json_data->google_client_id;
|
||||
$exportData['google_client_secret'] = $json_data->google_client_secret;
|
||||
$exportData['google_token'] = $json_data->google_token;
|
||||
$exportData['google_refresh_token'] = $json_data->google_refresh_token;
|
||||
$exportData['google_required'] = "required";
|
||||
} else if ($export_id == 4) {
|
||||
$exportData['zap_access_key'] = $json_data->access_key;
|
||||
$exportData['zap_required'] = "required";
|
||||
} else if ($export_id == RINGCENTRAL_EXPORT_TYPE) {
|
||||
$exportData['ring_client_id'] = $json_data->ring_client_id;
|
||||
$exportData['ring_client_secret'] = $json_data->ring_client_secret;
|
||||
$exportData['ring_account'] = $json_data->ring_account;
|
||||
$exportData['ring_password'] = $json_data->ring_password;
|
||||
$exportData['ring_server'] = $json_data->ring_server;
|
||||
$exportData['ring_extension'] = $json_data->ring_extension;
|
||||
$exportData['ring_mobile_no_sender'] = $json_data->ring_mobile_no_sender;
|
||||
|
||||
$exportData['ring_fax_default_number'] = $json_data->ring_fax_default_number;
|
||||
$exportData['ring_fax_trans_number'] = $json_data->ring_fax_trans_number;
|
||||
if(!empty($json_data->ring_fax_trans_number)){
|
||||
$exportData['ring_fax_trans_number'] = explode(',',$json_data->ring_fax_trans_number);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$exportData['ring_fax_equifax_number'] = $json_data->ring_fax_equifax_number;
|
||||
if(!empty($json_data->ring_fax_equifax_number)){
|
||||
$exportData['ring_fax_equifax_number'] = explode(',',$json_data->ring_fax_equifax_number);
|
||||
}
|
||||
|
||||
$exportData['ring_fax_experian_number'] = $json_data->ring_fax_experian_number;
|
||||
|
||||
if(!empty($json_data->ring_fax_experian_number)){
|
||||
$exportData['ring_fax_experian_number'] = explode(',',$json_data->ring_fax_experian_number);
|
||||
}
|
||||
$exportData['ring_fax_innovis_number'] = $json_data->ring_fax_innovis_number;
|
||||
$exportData['ring_fax_lexisnexis_number'] = $json_data->ring_fax_lexisnexis_number;
|
||||
$exportData['ring_fax_sagestream_number'] = $json_data->ring_fax_sagestream_number;
|
||||
$exportData['ring_fax_chex_systems_number'] = $json_data->ring_fax_chex_systems_number;
|
||||
$exportData['ring_fax_mib_inc_number'] = $json_data->ring_fax_mib_inc_number;
|
||||
$exportData['ring_factor_inc_number'] = $json_data->ring_factor_inc_number;
|
||||
$exportData['ring_data_furnishers_number'] = $json_data->ring_data_furnishers_number;
|
||||
$exportData['ring_other_number'] = $json_data->ring_other_number;
|
||||
$exportData['ring_fax_required'] = "required";
|
||||
if (isset($json_data->ring_isEmailReceived) && $json_data->ring_isEmailReceived == 1) {
|
||||
$exportData['ring_isEmailReceived'] = "checked";
|
||||
}
|
||||
}else if($export_id == LETTER_STREAM_TYPE){
|
||||
$exportData['letter_stream_required'] = "required";
|
||||
$exportData['letter_stream_api_key'] = $json_data->letter_stream_api_key;
|
||||
$exportData['letter_stream_api_id'] = $json_data->letter_stream_api_id;
|
||||
$exportData['letter_stream_name_1'] = $json_data->letter_stream_name_1;
|
||||
$exportData['letter_stream_name_2'] = $json_data->letter_stream_name_2;
|
||||
$exportData['letter_stream_address_1'] = $json_data->letter_stream_address_1;
|
||||
$exportData['letter_stream_address_2'] = $json_data->letter_stream_address_2;
|
||||
$exportData['letter_stream_city'] = $json_data->letter_stream_city;
|
||||
$exportData['letter_stream_state'] = $json_data->letter_stream_state;
|
||||
$exportData['letter_stream_zip'] = $json_data->letter_stream_zip;
|
||||
|
||||
}else if ($export_id == ONE_DRIVE_TYPE) {
|
||||
$exportData['one_drive_client_id'] = $json_data->one_drive_client_id;
|
||||
$exportData['one_drive_client_secret'] = $json_data->one_drive_client_secret;
|
||||
$exportData['one_drive_code'] = $json_data->one_drive_code;
|
||||
$exportData['one_drive_required'] = "required";
|
||||
}
|
||||
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$this->request->data['email_body'] = nl2br($this->request->getData('email_body'));
|
||||
$memberExport = $this->Automationsetup->patchEntity($memberExport, $this->request->getData());
|
||||
$data = $this->request->getData();
|
||||
|
||||
if (!empty($data['ring_fax_trans_number'])) {
|
||||
$data['ring_fax_trans_number'] = implode(",", $data['ring_fax_trans_number']);
|
||||
}
|
||||
|
||||
if (!empty($data['ring_fax_equifax_number'])) {
|
||||
$data['ring_fax_equifax_number'] = implode(",", $data['ring_fax_equifax_number']);
|
||||
}
|
||||
|
||||
if (!empty($data['ring_fax_experian_number'])) {
|
||||
$data['ring_fax_experian_number'] = implode(",", $data['ring_fax_experian_number']);
|
||||
}
|
||||
|
||||
$data = array_map('trim', $data);
|
||||
$memberExport->input_json = json_encode($data);
|
||||
|
||||
if ($this->Automationsetup->save($memberExport)) {
|
||||
$this->Flash->success(__('The member export has been saved.'));
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
$this->Flash->error(__('The member export could not be saved. Please, try again.'));
|
||||
}
|
||||
|
||||
$cmsuser_id = $this->Auth->user('id');
|
||||
$this->set(compact('memberExport', 'cmsuser_id', 'exportData'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Member Export id.
|
||||
* @return \Cake\Http\Response|null Redirects to index.
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
|
||||
$auth_user_id = $this->Auth->user('id');
|
||||
$this->request->allowMethod(['post', 'delete']);
|
||||
$this->loadModel('AutomationScheduleExports');
|
||||
$hasSchedule = $this->AutomationScheduleExports->hasAutomation($id);
|
||||
if($hasSchedule){
|
||||
$this->Flash->error(__('This automation has already used for automation schedule. You cannot delete it.'));
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$memberExport = $this->Automationsetup->get($id);
|
||||
$db_member_id = $memberExport->member_id;
|
||||
|
||||
if($this->verifyUser($db_member_id, $auth_user_id)){
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
if ($this->Automationsetup->delete($memberExport)) {
|
||||
$this->Flash->success(__('The member export has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The member export could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
private function ringCentralIntoDB($inputData, $isSuccess) {
|
||||
$current_dateTime = date('Y-m-d H:i:s');
|
||||
$member_id = $this->Auth->user('id');
|
||||
$ringcentralSandboxTable = TableRegistry::get('rincentral_sandbox');
|
||||
$ringcentralSandboxInfo = $ringcentralSandboxTable->find()->where(['member_id' => $member_id])->first();
|
||||
|
||||
if (!empty($ringcentralSandboxInfo)) {
|
||||
$ringcentralSandbox = $ringcentralSandboxTable->get($ringcentralSandboxInfo->id);
|
||||
} else {
|
||||
$ringcentralSandbox = $ringcentralSandboxTable->newEntity();
|
||||
$ringcentralSandbox->created_on = $current_dateTime;
|
||||
}
|
||||
|
||||
$ringcentralSandbox->member_id = $member_id;
|
||||
$ringcentralSandbox->username = $inputData['ring_account'];
|
||||
$ringcentralSandbox->extension = !empty($inputData['ring_extension']) ? $inputData['ring_extension'] : 101;
|
||||
$ringcentralSandbox->password = $inputData['ring_password'];
|
||||
$ringcentralSandbox->client_id = $inputData['ring_client_id'];
|
||||
$ringcentralSandbox->client_secret = $inputData['ring_client_secret'];
|
||||
$ringcentralSandbox->api_server_url = $inputData['ring_server'];
|
||||
$ringcentralSandbox->sms_receiver_num = $inputData['ring_mobile_no_sender'];
|
||||
$ringcentralSandbox->fax_receiver_num = $inputData['ring_fax_default_number'];
|
||||
$ringcentralSandbox->modified_on = $current_dateTime;
|
||||
$ringcentralSandbox->fax_receiver_num = $inputData['ring_fax_default_number'];
|
||||
if ($isSuccess == "success") {
|
||||
if ($inputData['type'] == 1) {
|
||||
if (is_int($ringcentralSandbox->sms_sent)) {
|
||||
$ringcentralSandbox->sms_sent = $ringcentralSandbox->sms_sent + 1;
|
||||
} else {
|
||||
$ringcentralSandbox->sms_sent = 1;
|
||||
}
|
||||
} else if ($inputData['type'] == 2) {
|
||||
if (is_int($ringcentralSandbox->fax_sent)) {
|
||||
$ringcentralSandbox->fax_sent = $ringcentralSandbox->fax_sent + 1;
|
||||
} else {
|
||||
$ringcentralSandbox->fax_sent = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = $ringcentralSandboxTable->save($ringcentralSandbox);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
267
src/Controller/CalendarController.php
Normal file
267
src/Controller/CalendarController.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
|
||||
use App\Controller\AppController;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use Cake\Datasource\ConnectionManager;
|
||||
use ModuleConstants;
|
||||
use PagesConstants;
|
||||
use SubModuleConstants;
|
||||
use Cake\I18n\I18n;
|
||||
use App\Helper\commonLogic;
|
||||
/**
|
||||
* Users Controller
|
||||
*
|
||||
* @property \App\Model\Table\UsersTable $Users
|
||||
*/
|
||||
class CalendarController extends AppController {
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
|
||||
$this->loadModel('Clients');
|
||||
$this->viewBuilder()->layout("new_dashboard");
|
||||
I18n::locale('en_US');
|
||||
$this->Auth->allow(['upgrade']);
|
||||
$this->Auth->allow(['addEvent']);
|
||||
$this->Auth->allow(['editEvent']);
|
||||
$this->Auth->allow(['deleteEvent']);
|
||||
$this->Auth->allow(['getAllEvent']);
|
||||
|
||||
$this->checkRTGuser(); // is RTG User or not
|
||||
|
||||
$this->setUserType(); // Set CRM/CMS/Contacts user
|
||||
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index($date = "") {
|
||||
$this->loadModel('CalenderNotification');
|
||||
$this->loadModel('AutomationSchedules');
|
||||
$this->loadModel('App');
|
||||
$cmsuser_id = $this->Auth->user('id');
|
||||
$commonLogic = new commonLogic;
|
||||
$color_assoc = $commonLogic->getcalendarBackgroundAndFontColorAssoc();
|
||||
if ($this->request->is('ajax')) {
|
||||
$request = $this->request->getData();
|
||||
$response = $commonLogic->calenderAjaxRequest($request);
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
$first_date_of_month = date('Y-m-01');
|
||||
$last_date_of_month = date('Y-m-t');
|
||||
$search_params['from_date'] =$first_date_of_month;
|
||||
$search_params['to_date'] = $last_date_of_month;
|
||||
$notificationList = $this->CalenderNotification->getCalenderNotificationByMemberId($cmsuser_id,[]);
|
||||
|
||||
if(!empty($notificationList)){
|
||||
foreach($notificationList as $date => $notification){
|
||||
$calender_result[] = [
|
||||
'title' => $notification['title'],
|
||||
'start' => $date,
|
||||
'constraint' => $notification['description'],
|
||||
'backgroundColor' => $notification['color'],
|
||||
'textColor' => $color_assoc[$notification['color']]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$calender_result_json = null;
|
||||
if(!empty($calender_result)){
|
||||
$calender_result_json = json_encode($calender_result);
|
||||
}
|
||||
|
||||
$today = $this->App->getSystemCurrentTimeStamp('Y-m-d');
|
||||
//pr($this->request->query['month']);exit;
|
||||
if(isset($this->request->query['date'])){
|
||||
$date = $this->request->query['date'];
|
||||
$today = date('Y-m-d',strtotime($date));
|
||||
}
|
||||
$calender_form_id = 'calender-area-form';
|
||||
$this->set(compact('calender_result_json','today','calender_form_id'));
|
||||
$this->render('calender');
|
||||
|
||||
//pr($calender_result_json);exit;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id User id.
|
||||
* @return void
|
||||
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null) {
|
||||
|
||||
// $client = $this->Clients->get($id);
|
||||
// $this->set('client', $client);
|
||||
// $this->set('_serialize', ['client']);
|
||||
//
|
||||
// $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");
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return void Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function addEvent(){
|
||||
$request = $this->request->data();
|
||||
if($this->request->is('ajax')){
|
||||
$user_id=$this->Auth->user('user_id');
|
||||
if(!isset($user_id)){
|
||||
|
||||
$user_id = $this->Auth->user('id');
|
||||
}
|
||||
|
||||
$calendarsTable = TableRegistry::get('calendars');
|
||||
$calendar = $calendarsTable->newEntity();
|
||||
|
||||
//$calendar->cmsuser_id = $user_id;
|
||||
$calendar->user_id = $user_id;
|
||||
$calendar->user_type = $_SESSION['userType'];
|
||||
$calendar->name = $request['name'];
|
||||
$calendar->description = '';
|
||||
$calendar->color_class = $request['color'];
|
||||
$calendar->start_date = $request['start_date'];
|
||||
$calendar->end_date = $request['end_date'];
|
||||
$calendar->created_on = date("Y-m-d h:i:s");
|
||||
$calendar->created_by = $user_id;
|
||||
|
||||
if(isset($request['description'])){
|
||||
$calendar->description = $request['description'];
|
||||
}
|
||||
//$id = $request['project_id'];
|
||||
//pr($projectMilestone);exit;
|
||||
if($calendarsTable->save($calendar))
|
||||
{
|
||||
echo json_encode($this->Flash->success(__('The event has been saved.')));
|
||||
die();
|
||||
} else {
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 editEvent(){
|
||||
$request = $this->request->data();
|
||||
if($this->request->is('ajax')){
|
||||
$user_id=$this->Auth->user('user_id');
|
||||
if(!isset($user_id)){
|
||||
|
||||
$user_id = $this->Auth->user('id');
|
||||
}
|
||||
//$cmsuser_id = $this->Auth->user('id');
|
||||
$calendarsTable = TableRegistry::get('calendars');
|
||||
$calendar = $calendarsTable->get($request['event_id']);
|
||||
|
||||
//$calendar->cmsuser_id = $cmsuser_id;
|
||||
$calendar->user_id = $user_id;
|
||||
$calendar->name = $request['name'];
|
||||
$calendar->description = '';
|
||||
$calendar->color_class = $request['color'];
|
||||
$calendar->start_date = $request['start_date'];
|
||||
$calendar->end_date = $request['end_date'];
|
||||
$calendar->created_on = date("Y-m-d h:i:s");
|
||||
$calendar->created_by = $user_id;
|
||||
|
||||
if(isset($request['description'])){
|
||||
$calendar->description = $request['description'];
|
||||
}
|
||||
|
||||
if($calendarsTable->save($calendar))
|
||||
{
|
||||
echo json_encode($this->Flash->success(__('The event has been updated.')));
|
||||
die();
|
||||
} else {
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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']);
|
||||
// $manageClient = $this->Clients->get($id);
|
||||
// if ($this->Clients->delete($manageClient)) {
|
||||
// $this->Flash->success(__('The Company has been deleted.'));
|
||||
// } else {
|
||||
// $this->Flash->error(__('The Company could not be deleted. Please, try again.'));
|
||||
// }
|
||||
//
|
||||
// return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
public function deleteEvent() {
|
||||
$request = $this->request->data();
|
||||
|
||||
if ($this->request->is('ajax')) {
|
||||
|
||||
$calendarTable = TableRegistry::get('calendars');
|
||||
$calendar = $calendarTable->get($request['event_id']);
|
||||
|
||||
//$id = $request['project_id'];
|
||||
if ($calendarTable->delete($calendar)) {
|
||||
|
||||
echo json_encode($this->Flash->success(__('The event has been deleted.')));
|
||||
die();
|
||||
} else {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllEvent() {
|
||||
if ($this->request->is('ajax')) {
|
||||
$id = $this->Auth->user('user_id');
|
||||
if (!isset($id)) {
|
||||
|
||||
$id = $this->Auth->user('id');
|
||||
}
|
||||
$event = TableRegistry::get('calendars')
|
||||
->find('all')
|
||||
->where(['user_id' => $id, 'user_type' => $_SESSION['userType']])
|
||||
->toArray();
|
||||
|
||||
echo json_encode($event);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
private function deleteAll($companies) {
|
||||
|
||||
// foreach ($companies as &$companyIdWithPrefix) {
|
||||
// $clientId = str_replace('content_', '', $companyIdWithPrefix);
|
||||
// pr($clientId);exit();
|
||||
// $client = $this->Clients->get($clientId);
|
||||
// $this->Clients->delete($client);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
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\AppController;
|
||||
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 AppController
|
||||
{
|
||||
|
||||
/**
|
||||
* 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']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
191
src/Controller/CertificateController.php
Normal file
191
src/Controller/CertificateController.php
Normal file
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use App\Utility\Certificate;
|
||||
use Cake\View\View;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*Certificate Controller
|
||||
* *
|
||||
* @method \App\Model\Entity\Certificate[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = []) */
|
||||
class CertificateController extends AppController
|
||||
{
|
||||
|
||||
/**
|
||||
* Links
|
||||
*
|
||||
* @certificate/CHC/ehcplmmdgujaoerzhhhfglwkqakdeqzx --- Credit Hacker Challenge
|
||||
* @certificate/CRS01/yihjpcxejusqlrwtfkxhvjydmjoiiclh --- Credit Repair Software/Business Essentials
|
||||
* @certificate/M2CM01/jikhyrpbxljiyncvecixilkluvjbkalq --- Metro 2 Compliance Method
|
||||
*/
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
$this->Auth->allow(['CHC', 'CRS', 'M2CM']);
|
||||
if ($this->Auth->user()) {
|
||||
$this->Auth->allow(['getcertificatelistbymemberId']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|void
|
||||
*/
|
||||
public function CHC($unique_string)
|
||||
{
|
||||
|
||||
$this->loadModel('Certificates');
|
||||
$certificate = $this->Certificates->getCertificateByUniqueString('CHC', $unique_string);
|
||||
|
||||
if (!empty($certificate)) {
|
||||
|
||||
$_SESSION['member_certificate'] = [
|
||||
'certificate_id' => $certificate->id,
|
||||
'name' => $certificate->name
|
||||
];
|
||||
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'login']);
|
||||
}
|
||||
|
||||
die('Invalid Request');
|
||||
}
|
||||
|
||||
public function CRS($unique_string)
|
||||
{
|
||||
|
||||
$this->loadModel('Certificates');
|
||||
$certificate = $this->Certificates->getCertificateByUniqueString('CRS', $unique_string);
|
||||
|
||||
if (!empty($certificate)) {
|
||||
|
||||
$_SESSION['member_certificate'] = [
|
||||
'certificate_id' => $certificate->id,
|
||||
'name' => $certificate->name
|
||||
];
|
||||
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'login']);
|
||||
}
|
||||
|
||||
die('Invalid Request');
|
||||
}
|
||||
|
||||
public function M2CM($unique_string)
|
||||
{
|
||||
|
||||
$this->loadModel('Certificates');
|
||||
$certificate = $this->Certificates->getCertificateByUniqueString('M2CM', $unique_string);
|
||||
|
||||
if (!empty($certificate)) {
|
||||
|
||||
$_SESSION['member_certificate'] = [
|
||||
'certificate_id' => $certificate->id,
|
||||
'name' => $certificate->name
|
||||
];
|
||||
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'login']);
|
||||
}
|
||||
|
||||
die('Invalid Request');
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $idCertificate id.
|
||||
* @return \Cake\Http\Response|void
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function generatecertificate()
|
||||
{
|
||||
$request = $this->request->getData();
|
||||
if($this->request->is('ajax')){
|
||||
if($request['action'] == "session_unset"){
|
||||
if($request['session_unset'] == "1"){
|
||||
unset($_SESSION['member_certificate']);
|
||||
$response['status'] = true;
|
||||
$response['message'] = "Certificate session unset successfully";
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
die();
|
||||
}
|
||||
$inputData['member_id'] = $this->Auth->user('id');
|
||||
$inputData['certificate_id'] = 0;
|
||||
if($_SESSION['member_certificate']['certificate_id'] > 0){
|
||||
$inputData['certificate_id'] = $_SESSION['member_certificate']['certificate_id'];
|
||||
}
|
||||
$certificate_name = $_SESSION['member_certificate']['name'];
|
||||
$inputData['member_name'] = trim($request['fname'] . " " . $request['lname']);
|
||||
$this->loadModel('MemberCertificates');
|
||||
|
||||
if($inputData['certificate_id'] > 0 && $this->MemberCertificates->updateOrInsertMemberCertificate($inputData['member_id'], $inputData['certificate_id'], $inputData)) {
|
||||
|
||||
$pdf_file_path = Certificate::certificate_generate_for_pdf($inputData);
|
||||
$pdf_file_path = WWW_ROOT.$pdf_file_path;
|
||||
|
||||
$templateContent['certificate_name'] = $_SESSION['member_certificate']['name'];
|
||||
$templateContent['content'] = $inputData['member_name'];
|
||||
$templateContent['company_name'] = "Admin";
|
||||
$templateContent['company_email'] = NO_REPLY_EMAIL;
|
||||
|
||||
$subject = Certificate::CERTIFICATE_EMAIL_SUBJECTS[$inputData['certificate_id']];
|
||||
$this->sendEmail('certificate_email', $templateContent, $request['email'], $subject, $pdf_file_path);
|
||||
$download_name = str_replace(' ', '_', $certificate_name);
|
||||
$this->downloadFile($pdf_file_path,"pdf", $download_name);
|
||||
unset($_SESSION['member_certificate']);
|
||||
}
|
||||
|
||||
return $this->redirect(['controller' => 'Cmsusers', 'action' => 'login']);
|
||||
}
|
||||
|
||||
|
||||
private function downloadFile($file_path,$extension,$download_name){
|
||||
header('Content-Type: application/octet-stream');
|
||||
header("Content-Transfer-Encoding: Binary");
|
||||
header("Content-disposition: attachment; filename=\"" . "{$download_name}.{$extension}" . "\"");
|
||||
readfile($file_path);
|
||||
unlink($file_path);
|
||||
}
|
||||
|
||||
public function getcertificatelistbymemberId()
|
||||
{
|
||||
|
||||
if ($this->request->is('ajax')) {
|
||||
$response = [];
|
||||
$request = $this->request->getData();
|
||||
$this->loadModel('MemberCertificates');
|
||||
if ($request['action'] == "GET_CERTIFICATE_LIST") {
|
||||
$member_id = $request['member_id'];
|
||||
|
||||
$certificates = $this->MemberCertificates->getCertificateListByMemberId($member_id);
|
||||
$view = new View($this->request, $this->response);
|
||||
$response['html'] = $view->element('certificate/certificate_list', ['memberCertificates' => $certificates]);
|
||||
} else if ($request['action'] == "UPDATE_DOWNLOAD_STATUS") {
|
||||
$member_certificate_id = $request['member_certificate_id'];
|
||||
$status = $request['status'];
|
||||
$response['status'] = $this->MemberCertificates->updateById($member_certificate_id, ['downloaded' => $status]);
|
||||
$member_id = $request['member_id'];
|
||||
|
||||
$certificates = $this->MemberCertificates->getCertificateListByMemberId($member_id);
|
||||
|
||||
$view = new View($this->request, $this->response);
|
||||
$response['html'] = $view->element('certificate/certificate_list', ['memberCertificates' => $certificates]);
|
||||
$response['message'] = "Certificate download revoked successfully";
|
||||
|
||||
if ($response['status']) {
|
||||
$response['message'] = "Certificate download permitted successfully";
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
6731
src/Controller/ClientController.php
Normal file
6731
src/Controller/ClientController.php
Normal file
File diff suppressed because it is too large
Load Diff
749
src/Controller/ClientCreditreportController.php
Normal file
749
src/Controller/ClientCreditreportController.php
Normal file
@@ -0,0 +1,749 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use Cake\ORM\TableRegistry;
|
||||
use App\Helper\commonLogic;
|
||||
use App\Utility\Common;
|
||||
use App\Utility\PasswordCreator;
|
||||
/**
|
||||
* ClientCreditreport Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\ClientCreditreport[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class ClientCreditreportController extends AppController
|
||||
{
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
if($this->setClientControllerAccess()){
|
||||
$this->Auth->allow(['index','clearMedia']);
|
||||
}
|
||||
|
||||
if($this->employeeAccessMethod() || ($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 2)){
|
||||
$this->Auth->allow(['clientcreditreportlist']);
|
||||
}
|
||||
|
||||
if($_SESSION['userType'] == CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 2){
|
||||
$this->Auth->allow(['creditreportstatus']);
|
||||
}
|
||||
$this->checkRTGuser(); // is RTG User or not
|
||||
|
||||
$this->setUserType(); // Set CRM/CMS/Contacts user
|
||||
// $this->Auth->allow(['creditreportstatus']);
|
||||
$this->isUserPermitted(CREDIT_REPORT_STATUS_CONTROLLER_ID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function clientcreditreportlist(){
|
||||
$page_limit = 10;
|
||||
$status = '';
|
||||
$selected_status = '';
|
||||
$client_type = 1;
|
||||
$affiliate_client_id = 0;
|
||||
$employee_id = 0;
|
||||
$affiliate_client_list = [];
|
||||
$$emlpoyee_list = [];
|
||||
$affiliate_condition = "";
|
||||
$this->loadModel('Contacts');
|
||||
$is_show_all_clients = $this->Auth->user('is_show_all_clients');
|
||||
if (isset($this->request->query['page_limit'])) {
|
||||
$page_limit = $this->request->query('page_limit');
|
||||
}
|
||||
|
||||
if (isset($this->request->query['client_type'])) {
|
||||
$client_type = $this->request->query('client_type');
|
||||
}
|
||||
|
||||
if (isset($this->request->query['affiliate_client_id'])) {
|
||||
$affiliate_client_id = $this->request->query('affiliate_client_id');
|
||||
}
|
||||
|
||||
if (isset($this->request->query['employee_id'])) {
|
||||
$employee_id = $this->request->query('employee_id');
|
||||
}
|
||||
|
||||
if (isset($this->request->query['status']) && !empty($this->request->query['status'])) {
|
||||
$status = "Clients.status = " . $this->request->query('status');
|
||||
$selected_status = $this->request->query('status');
|
||||
}
|
||||
$this->paginate = [
|
||||
'limit' => $page_limit,
|
||||
'order' => [
|
||||
'Clients.id' => 'desc',
|
||||
'Contacts.id' => 'desc'
|
||||
]
|
||||
];
|
||||
|
||||
$cmsuser_id = $this->Auth->user('id');
|
||||
$search = '';
|
||||
if ($this->isAffiliateUser()) {
|
||||
$affiliate_client_id = $this->Auth->user('user_id');
|
||||
$affiliate_condition = "Clients.crmuser_id = " . $affiliate_client_id;
|
||||
} else {
|
||||
//$affiliate_condition = "Clients.crmuser_id = 0";
|
||||
if ($affiliate_client_id == -1) {
|
||||
$affiliate_condition = "Clients.crmuser_id > 0";
|
||||
} else if ($affiliate_client_id > 0) {
|
||||
$affiliate_condition = "Clients.crmuser_id = " . $affiliate_client_id;
|
||||
}
|
||||
|
||||
if($employee_id == -1){
|
||||
if(!empty($affiliate_condition)){
|
||||
$affiliate_condition .= " AND Clients.employee_id > 0";
|
||||
}else{
|
||||
$affiliate_condition = " Clients.employee_id > 0";
|
||||
}
|
||||
}else if($employee_id > 0){
|
||||
if(!empty($affiliate_condition)){
|
||||
$affiliate_condition .= " AND Clients.employee_id = " . $employee_id;
|
||||
}else{
|
||||
$affiliate_condition = " Clients.employee_id = " . $employee_id;
|
||||
}
|
||||
}
|
||||
list($affiliate_client_list,$emlpoyee_list,$employee_affiliate_list) = $this->generateAffiliateList($employee_id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$is_source = 0;
|
||||
if ($this->request->params['action'] == 'clientonboarding') {
|
||||
$is_source = 1;
|
||||
}
|
||||
|
||||
if (!empty($affiliate_condition)) {
|
||||
$affiliate_condition .= " AND Clients.is_source = " . $is_source;
|
||||
} else {
|
||||
$affiliate_condition = "Clients.is_source = " . $is_source;
|
||||
}
|
||||
|
||||
if($is_show_all_clients == 2){
|
||||
$auth_employee_id = $this->Auth->user('user_id');
|
||||
if (!empty($affiliate_condition)) {
|
||||
$affiliate_condition .= " AND Clients.employee_id = ".$auth_employee_id;
|
||||
} else {
|
||||
$affiliate_condition = "Clients.employee_id = ".$auth_employee_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($this->request->query['search']) && !empty($this->request->query['search'])) {
|
||||
$search = $this->request->query('search');
|
||||
$condition = ' ( Clients.name LIKE ' . "'%" . $search . "%' OR Clients.phone LIKE '%" . $search . "%' OR Clients.website LIKE '%" . $search . "%'"
|
||||
. "OR Contacts.first_name LIKE '%" . $search . "%' OR Contacts.last_name LIKE '%" . $search . "%') ";
|
||||
$clients = $this->Contacts->find('all')->contain(['Clients'])
|
||||
->where([$affiliate_condition, 'Clients.cmsuser_id' => $cmsuser_id, $condition, $clientId, $status]);
|
||||
} else {
|
||||
$clients = $this->Contacts->find('all')->contain(['Clients'])
|
||||
->where([$affiliate_condition, 'Contacts.is_primary_contact' => 1,
|
||||
'Clients.cmsuser_id' => $cmsuser_id, $clientId, $status]);
|
||||
}
|
||||
|
||||
$user_permissions = $this->request->session()->read('user_permissions');
|
||||
$this->loadModel('Sertg');
|
||||
$paginated_clients = [];
|
||||
foreach ($this->paginate($clients) as $client) {
|
||||
$client->sertg_file = $sertg_file;
|
||||
$paginated_clients[] = $client;
|
||||
}
|
||||
|
||||
if($_SESSION['hasEpicVelocity'] || $_SESSION['hasVelocity']){
|
||||
$isVelocityUser = true;
|
||||
}
|
||||
|
||||
$this->set('client_type', $client_type);
|
||||
$this->set('affliliate_client_id', $affiliate_client_id);
|
||||
$this->set('affiliate_client_list', $affiliate_client_list);
|
||||
$this->set('employee_affiliate_list', $employee_affiliate_list);
|
||||
$this->set('employee_list', $emlpoyee_list);
|
||||
$this->set('employee_id', $employee_id);
|
||||
$this->set('isAffitliate', $this->isAffiliateUser());
|
||||
$this->set('status', $selected_status);
|
||||
$this->set('user_permission', $user_permissions);
|
||||
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||
$this->set('clients', $paginated_clients); //$this->paginate($clients));
|
||||
$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->set('isVelocityUser', $isVelocityUser);
|
||||
$this->set("is_source", $is_source);
|
||||
}
|
||||
|
||||
public function creditreportstatus($client_id){
|
||||
$isAffliliate = false;
|
||||
if($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 2){
|
||||
$isAffliliate = true;
|
||||
}
|
||||
|
||||
if($isAffliliate){
|
||||
$this->loadModel('Clients');
|
||||
$crmuser_id = $this->Auth->user('user_id');
|
||||
$result = $this->Clients->isAffliliateHasClient($crmuser_id,$client_id);
|
||||
if(!$result){
|
||||
$this->redirect(['action'=>'clientcreditreportlist']);
|
||||
}
|
||||
}
|
||||
$page = 1;
|
||||
$page_limit = 10;
|
||||
$search_contain = "";
|
||||
$source_type = "";
|
||||
if($this->request->is('ajax')){
|
||||
$ajaxData = $this->request->getData();
|
||||
$response = "";
|
||||
if($ajaxData['action']== "ITEM_CHANGE"){
|
||||
$response = $this->itemChange($ajaxData);
|
||||
}else if($ajaxData['action']== "ACCOUNT_TYPE_CHANGE"){
|
||||
$response = $this->accountTypeChange($ajaxData);
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
$commonLogic = new commonLogic;
|
||||
$data = $commonLogic->commonCreditReportStatus($this->request->query,$client_id);
|
||||
$data['isEditmode'] = true;
|
||||
//pr($data);exit;
|
||||
$this->set($data);
|
||||
$this->render('/Client/creditreportstatus');
|
||||
}
|
||||
|
||||
private function accountTypeChange($inputData){
|
||||
$result = false;
|
||||
if($inputData['type'] == "PB"){
|
||||
$this->loadModel('DataPublicRecords');
|
||||
$result = $this->DataPublicRecords->changePublicRecordValueById($inputData);
|
||||
}else if($inputData['type'] == "ACC"){
|
||||
$this->loadModel('DataItemKeyValues');
|
||||
$result =$this->DataItemKeyValues->changeItemkeyValueById($inputData);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function itemChange($inputData){
|
||||
$result = false;
|
||||
if($inputData['item_type'] == "ACC"){
|
||||
$this->loadModel('DataItemKeyValues');
|
||||
$result =$this->DataItemKeyValues->updateItemValueById($inputData);
|
||||
}else if($inputData['item_type'] == "PB"){
|
||||
$this->loadModel('DataPublicRecords');
|
||||
$result = $this->DataPublicRecords->updatePublicRecordValueById($inputData);
|
||||
}else if($inputData['item_type'] == "INQ"){
|
||||
$this->loadModel('DataInquiries');
|
||||
$result = $this->DataInquiries->updateInquiryValueById($inputData);
|
||||
}else if($inputData['item_type'] == "PI"){
|
||||
$this->loadModel('DataBasicKeyValues');
|
||||
$result =$this->DataBasicKeyValues->updateItemValueById($inputData);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function isAffiliateUser() {
|
||||
$result = false;
|
||||
if ($this->Auth->user('type') == AFFILIATE_USER_TYPE) {
|
||||
$result = true;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$passcreator = new PasswordCreator;
|
||||
$identity_iq_link = $this->Auth->user('identity_iq_link');
|
||||
$smart_credit_link = $this->Auth->user('smart_credit_link');
|
||||
|
||||
$this->loadModel('Cmsusers');
|
||||
$this->loadModel('Personalizes');
|
||||
$this->loadModel('ClientImagesHistory');
|
||||
$user = $this->Auth->user();
|
||||
|
||||
if(!empty($user)){
|
||||
if(!empty($user['identity_iq_link'])){
|
||||
$credit_report_dropdown[1] = REPORT_SOURCE_TYPES[1];
|
||||
}
|
||||
if(!empty($user['smart_credit_link'])){
|
||||
$credit_report_dropdown[3] = REPORT_SOURCE_TYPES[3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->loadModel('CreditReports');
|
||||
|
||||
if ($_SESSION['userType'] == CONTACT_USER_INDICATOR) {
|
||||
if (empty($id)) {
|
||||
$id = $this->Auth->user('client_id');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($id) || $id == "undefined") {
|
||||
return $this->redirect($this->referer());
|
||||
}
|
||||
|
||||
|
||||
if (isset($id)) {
|
||||
$client_id = $id;
|
||||
} else {
|
||||
|
||||
$user_id = $this->Auth->user('user_id');
|
||||
$user_row = TableRegistry::get('contacts')->find('all')->where(['id' => $user_id])->toArray();
|
||||
//pr($user_row);exit();
|
||||
$client_id = $user_row[0]['client_id'];
|
||||
}
|
||||
$is_photo_upload_section = false;
|
||||
$request = $this->request->getData();
|
||||
// dd($request,$client_id);exit;
|
||||
//is_client_info
|
||||
if($request['is_client_info'] == 0 && $this->request->is('post')){
|
||||
|
||||
if (isset($this->request->data['uploadmedia']['identification'])) {
|
||||
$rtg_letter_image_id = 1;
|
||||
$image_path = 'identification';
|
||||
} elseif (isset($this->request->data['uploadmedia']['mail_doc'])) {
|
||||
$rtg_letter_image_id = 2;
|
||||
$image_path = 'mail_doc';
|
||||
} elseif (isset($this->request->data['uploadmedia']['ssn'])) {
|
||||
$rtg_letter_image_id = 3;
|
||||
$image_path = 'ssn';
|
||||
} elseif (isset($this->request->data['uploadmedia']['state_photo_id']) && !empty($this->request->data['uploadmedia']['state_photo_id'])) {
|
||||
$rtg_letter_image_id = 4;
|
||||
$image_path = 'state_photo_id';
|
||||
} elseif (isset($this->request->data['uploadmedia']['notarized_letter'])) {
|
||||
$rtg_letter_image_id = 5;
|
||||
$image_path = 'notarized_letter';
|
||||
} elseif (isset($this->request->data['uploadmedia']['cr_report'])) {
|
||||
$rtg_letter_image_id = 6;
|
||||
$image_path = 'cr_report';
|
||||
} elseif (isset($this->request->data['uploadmedia']['trouble_mark_file'])) {
|
||||
$rtg_letter_image_id = 7;
|
||||
$image_path = 'trouble_mark_file';
|
||||
} elseif (isset($this->request->data['uploadmedia']['item_challenge_file'])) {
|
||||
$rtg_letter_image_id = 8;
|
||||
$image_path = 'item_challenge_file';
|
||||
}
|
||||
|
||||
if (isset($this->request->data['image_id']) && !empty($this->request->data['uploadmedia'][$image_path])) {
|
||||
$is_photo_upload_section = true;
|
||||
$image_id = $this->request->data['image_id'];
|
||||
$uploadmediaTable = TableRegistry::get('uploadmedias');
|
||||
$uploadmedia = $uploadmediaTable->get($image_id);
|
||||
$image = $this->request->data['uploadmedia'][$image_path];
|
||||
//$unique_name = uniqid() . '.jpg';
|
||||
$pos = strpos($image, ';');
|
||||
$extension = end(explode("/",explode(':', substr($image, 0, $pos))[1]));
|
||||
$unique_name = uniqid().$uploadmedia->rtg_letter_image_id. '.'.$extension;
|
||||
|
||||
if ($this->uploadFile($image, $unique_name, $client_id)) {
|
||||
unlink(CONTACT_PHOTO . $uploadmedia->image_path);
|
||||
$uploadmedia->image_path = $client_id . '/' . $unique_name;
|
||||
$uploadmedia->modified_on = date("Y-m-d h:i:s");
|
||||
|
||||
if ($saved_data = $uploadmediaTable->save($uploadmedia)) {
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "CLIENTREPORT_ADD_EDIT";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data']["id"] = $saved_data->id;
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$logData['input_data']['uploadmedia'][$image_path] = "IMAGE_BASE_64";
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('Media has been updated Successfully!.'));
|
||||
$historyUpdate['client_id'] = $client_id;
|
||||
$historyUpdate['image_type_id'] = $rtg_letter_image_id;
|
||||
$historyUpdate['action_type'] = 1;
|
||||
$this->ClientImagesHistory->insertOrUpdate($historyUpdate);
|
||||
|
||||
} else {
|
||||
$this->Flash->error(__('Media has not been updated!.'));
|
||||
}
|
||||
|
||||
return $this->redirect($this->referer());
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!empty($this->request->data['uploadmedia'][$image_path])) {
|
||||
$is_photo_upload_section = true;
|
||||
$uploadmediaTable = TableRegistry::get('uploadmedias');
|
||||
$uploadmedia = $uploadmediaTable->newEntity();
|
||||
$uploadmedia->client_id = $client_id;
|
||||
//pr($rtg_letter_image_id);exit;
|
||||
$uploadmedia->rtg_letter_image_id = $rtg_letter_image_id;
|
||||
$image = $this->request->data['uploadmedia'][$image_path];
|
||||
//var_dump($image); exit;
|
||||
$pos = strpos($image, ';');
|
||||
$extension = end(explode("/",explode(':', substr($image, 0, $pos))[1]));
|
||||
$unique_name = uniqid() . '.'.$extension;
|
||||
//$unique_name = uniqid() . '.jpg';
|
||||
|
||||
if ($saved_data = $this->uploadFile($image, $unique_name, $client_id)) {
|
||||
$uploadmedia->image_path = $client_id . '/' . $unique_name;
|
||||
$uploadmedia->created_on = date("Y-m-d h:i:s");
|
||||
$uploadmedia->modified_on = date("Y-m-d h:i:s");
|
||||
if ($uploadmediaTable->save($uploadmedia)) {
|
||||
|
||||
// client image history add
|
||||
$this->loadModel('ClientImagesHistory');
|
||||
$historyUpdate['client_id'] = $client_id;
|
||||
$historyUpdate['image_type_id'] = $rtg_letter_image_id;
|
||||
$historyUpdate['action_type'] = 1;
|
||||
$this->ClientImagesHistory->insertOrUpdate($historyUpdate);
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "CLIENTREPORT_ADD_EDIT";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data']["id"] = $saved_data->id;
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$logData['input_data']['uploadmedia'][$image_path] = "IMAGE_BASE_64";
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('Media has been uploaded.'));
|
||||
|
||||
} else {
|
||||
$this->Flash->error(__('Media has not been uploaded.'));
|
||||
}
|
||||
return $this->redirect($this->referer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//pr($client_id);exit;
|
||||
$creditreport = TableRegistry::get('creditreportsetups')->find('all')->where(['client_id' => $client_id])->toArray();
|
||||
if (empty($this->request->data['creditreport']['cra_report'])) {
|
||||
$this->request->data['creditreport']['cra_report'] = "N/A";
|
||||
}
|
||||
|
||||
if (count($creditreport) > 0) {
|
||||
|
||||
if (!$is_photo_upload_section && $this->request->is('post')) {
|
||||
$creditreport = $creditreport[0];
|
||||
$creditreport->cra_report = $this->request->data['creditreport']['cra_report'];
|
||||
$creditreport->credit_bureau_address = $this->request->data['creditreport']['credit_bureau_address'];
|
||||
$creditreport->credit_report_company_type = $this->request->data['creditreport']['company_type'];
|
||||
$creditreport->first_name = $this->request->data['creditreport']['first_name'];
|
||||
$creditreport->last_name = $this->request->data['creditreport']['last_name'];
|
||||
$creditreport->street_no = $this->request->data['creditreport']['street_no'];
|
||||
$creditreport->street_name = $this->request->data['creditreport']['street_name'];
|
||||
$creditreport->city = $this->request->data['creditreport']['city'];
|
||||
$creditreport->state = $this->request->data['creditreport']['state'];
|
||||
|
||||
$creditreport->social_secuirty_no = $this->request->data['creditreport']['ssn'];
|
||||
$creditreport->sincerely = $this->request->data['creditreport']['sincerely'];
|
||||
$creditreport->birth_date = $this->request->data['creditreport']['birth_date'];
|
||||
$creditreport->credit_report_company_name = $this->request->data['creditreport']['credit_report_company_name'];
|
||||
$creditreport->credit_report_company_username = $this->request->data['creditreport']['credit_report_company_username'];
|
||||
$creditreport->credit_report_company_password = $this->request->data['creditreport']['credit_report_company_password'];
|
||||
$creditreport->client_id = $client_id;
|
||||
$creditreport->modified_on = date("Y-m-d H:i:s");
|
||||
$creditreportEntity = $this->CreditReports->patchEntity($creditreport, $this->request->data['creditreport']);
|
||||
|
||||
$error = $creditreportEntity->errors();
|
||||
if (!empty($error)) {
|
||||
$this->set('errors', $error);
|
||||
} else {
|
||||
if ($saved_data = $this->CreditReports->save($creditreportEntity)) {
|
||||
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
$everything = new \App\Utility\Everythings();
|
||||
$everythinData['action_on_id'] = $client_id;
|
||||
$everythinData['action_on_name'] = $creditreport->first_name." ".$creditreport->last_name;
|
||||
$everythinData['event_name'] = "creditreportsetup_updated_by_client";
|
||||
$everythinData['action_on_usertype'] = CONTACT_USER_INDICATOR;
|
||||
$everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// Everything Insertion
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "CLIENTREPORT_ADD_EDIT";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data']["id"] = $saved_Data->id;
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('The Credit Report has been updated.'));
|
||||
return $this->redirect($this->referer());
|
||||
} else {
|
||||
$this->Flash->error(__('The Credit Report is not updated'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$creditreport[0]->credit_report_company_password = $passcreator->customEncryptionDecryption($creditreport[0]->credit_report_company_password, 'decrypt');
|
||||
//dd($creditreport[0]);
|
||||
$this->set('creditreport', $creditreport[0]);
|
||||
} else {
|
||||
|
||||
if($request['is_client_info'] == 1&& $this->request->is('post')) {
|
||||
|
||||
$creditreporttable = TableRegistry::get('creditreportsetups');
|
||||
$creditreport = $creditreporttable->newEntity();
|
||||
if ($_SESSION['userType'] != CONTACT_USER_INDICATOR) {
|
||||
$creditreport->cra_report = $this->request->data['creditreport']['cra_report'];
|
||||
$creditreport->credit_bureau_address = $this->request->data['creditreport']['credit_bureau_address'];
|
||||
}
|
||||
$creditreport->credit_report_company_type = $this->request->data['creditreport']['company_type'];
|
||||
$creditreport->first_name = $this->request->data['creditreport']['first_name'];
|
||||
$creditreport->last_name = $this->request->data['creditreport']['last_name'];
|
||||
$creditreport->street_no = $this->request->data['creditreport']['street_no'];
|
||||
$creditreport->street_name = $this->request->data['creditreport']['street_name'];
|
||||
$creditreport->city = $this->request->data['creditreport']['city'];
|
||||
$creditreport->state = $this->request->data['creditreport']['state'];
|
||||
|
||||
$creditreport->social_secuirty_no = $this->request->data['creditreport']['ssn'];
|
||||
$creditreport->sincerely = $this->request->data['creditreport']['sincerely'];
|
||||
$creditreport->birth_date = $this->request->data['creditreport']['birth_date'];
|
||||
$creditreport->credit_report_company_name = $this->request->data['creditreport']['credit_report_company_name'];
|
||||
$creditreport->credit_report_company_username = $this->request->data['creditreport']['credit_report_company_username'];
|
||||
$creditreport->credit_report_company_password = $this->request->data['creditreport']['credit_report_company_password'];
|
||||
$creditreport->client_id = $client_id;
|
||||
$creditreport->created_on = date("Y-m-d H:i:s");
|
||||
$creditreport->modified_on = date("Y-m-d H:i:s");
|
||||
$creditreportEntity = $this->CreditReports->patchEntity($creditreport, $this->request->data['creditreport']);
|
||||
|
||||
$error = $creditreportEntity->errors();
|
||||
if (!empty($error)) {
|
||||
$this->set('errors', $error);
|
||||
} else {
|
||||
if ($saved_data = $creditreporttable->save($creditreportEntity)) {
|
||||
|
||||
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
$everything = new \App\Utility\Everythings();
|
||||
$everythinData['action_on_id'] = $client_id;
|
||||
$everythinData['action_on_name'] = $creditreport->first_name." ".$creditreport->last_name;
|
||||
$everythinData['event_name'] = "creditreportsetup_updated_by_client";
|
||||
$everythinData['action_on_usertype'] = CONTACT_USER_INDICATOR;
|
||||
$everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// Everything Insertion
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "CLIENTREPORT_ADD_EDIT";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data']["id"] = $saved_data->id;
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('The Credit Report has been updated.'));
|
||||
return $this->redirect($this->referer());
|
||||
} else {
|
||||
$this->Flash->error(__('The Credit Report is not updated'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//setting the video tutorial
|
||||
$identification = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 1])->toArray();
|
||||
$mail_doc = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 2])->toArray();
|
||||
$ssn = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 3])->toArray();
|
||||
$state_photo_id = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 4])->toArray();
|
||||
$notarized_letter = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 5])->toArray();
|
||||
$cr_report = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 6])->toArray();
|
||||
$trouble_mark_file = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 7])->toArray();
|
||||
$item_challenge_file = TableRegistry::get('uploadmedias')->find('all')->where(['client_id' => $client_id, 'rtg_letter_image_id' => 8])->toArray();
|
||||
//pr($state_photo_id);exit;
|
||||
if (count($identification) > 0) {
|
||||
$this->set('identification', $identification[0]);
|
||||
}
|
||||
if (count($mail_doc) > 0) {
|
||||
$this->set('mail_doc', $mail_doc[0]);
|
||||
}
|
||||
if (count($ssn) > 0) {
|
||||
$this->set('ssn', $ssn[0]);
|
||||
}
|
||||
if (count($state_photo_id) > 0) {
|
||||
$this->set('state_photo_id', $state_photo_id[0]);
|
||||
}
|
||||
if (count($notarized_letter) > 0) {
|
||||
$this->set('notarized_letter', $notarized_letter[0]);
|
||||
}
|
||||
if (count($cr_report) > 0) {
|
||||
$this->set('cr_report', $cr_report[0]);
|
||||
}
|
||||
if (count($trouble_mark_file) > 0) {
|
||||
$this->set('trouble_mark_file', $trouble_mark_file[0]);
|
||||
}
|
||||
if (count($item_challenge_file) > 0) {
|
||||
$this->set('item_challenge_file', $item_challenge_file[0]);
|
||||
}
|
||||
|
||||
$formsTable = TableRegistry::get('Forms');
|
||||
$result = $formsTable->get(66);
|
||||
$this->set('result', $result);
|
||||
$this->set('credit_report_dropdown', $credit_report_dropdown);
|
||||
$this->set(compact('identity_iq_link','smart_credit_link','privacy_guard_link'));
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Client Creditreport id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$clientCreditreport = $this->ClientCreditreport->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('clientCreditreport', $clientCreditreport);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$clientCreditreport = $this->ClientCreditreport->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$clientCreditreport = $this->ClientCreditreport->patchEntity($clientCreditreport, $this->request->getData());
|
||||
if ($this->ClientCreditreport->save($clientCreditreport)) {
|
||||
$this->Flash->success(__('The client creditreport has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The client creditreport could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientCreditreport'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Client Creditreport 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)
|
||||
{
|
||||
$clientCreditreport = $this->ClientCreditreport->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$clientCreditreport = $this->ClientCreditreport->patchEntity($clientCreditreport, $this->request->getData());
|
||||
if ($this->ClientCreditreport->save($clientCreditreport)) {
|
||||
$this->Flash->success(__('The client creditreport has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The client creditreport could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientCreditreport'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Client Creditreport 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']);
|
||||
$clientCreditreport = $this->ClientCreditreport->get($id);
|
||||
if ($this->ClientCreditreport->delete($clientCreditreport)) {
|
||||
$this->Flash->success(__('The client creditreport has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The client creditreport could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
private function uploadFile($image, $unique_name, $client_id) {
|
||||
|
||||
$extension = pathinfo($unique_name, PATHINFO_EXTENSION);
|
||||
|
||||
if (!is_dir('contact_photo/' . $client_id)) {
|
||||
mkdir('contact_photo/' . $client_id, 0777, true);
|
||||
}
|
||||
|
||||
$target_dir = 'contact_photo/' . $client_id . '/';
|
||||
$target_file = $target_dir . basename($unique_name);
|
||||
|
||||
if (is_array($image) && isset($image["tmp_name"]) && !empty($image["tmp_name"])) {
|
||||
move_uploaded_file($image["tmp_name"], $target_file);
|
||||
$image_size = $image["size"];
|
||||
} else {
|
||||
|
||||
$default_base_64_string = 'data:image/jpeg;base64,';
|
||||
$extension = strtolower($extension);
|
||||
if($extension == "png"){
|
||||
$default_base_64_string = 'data:image/png;base64,';
|
||||
}else if($extension == "jpg" || $extension == "jpeg"){
|
||||
$default_base_64_string = 'data:image/jpeg;base64,';
|
||||
}else if($extension == "bmp"){
|
||||
$default_base_64_string = 'data:image/bmp;base64,';
|
||||
}
|
||||
|
||||
$data = str_replace($default_base_64_string, '', $image);
|
||||
$data = base64_decode($data);
|
||||
// $data = str_replace('data:image/jpeg;base64,', '', $image);
|
||||
// $data = base64_decode($data);
|
||||
|
||||
file_put_contents($target_file, $data);
|
||||
$image_size = filesize($target_file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($image_size > UPLOAD_MEDIA_SIZE) {
|
||||
unlink($target_file);
|
||||
$this->Flash->error(__('Sorry your file size is greater than '.UPLOAD_MEDIA_SIZE.' Mb.'));
|
||||
return false;
|
||||
} else {
|
||||
//file_put_contents($target_file, $data);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function clearMedia($image_id = Null) {
|
||||
//echo $image_id;exit;
|
||||
//$this->request->allowMethod(['post', 'delete']);
|
||||
//$image_id = $this->request->data['image_id'];
|
||||
$uploadmediaTable = TableRegistry::get('uploadmedias');
|
||||
|
||||
$uploadmedia = $uploadmediaTable->get($image_id);
|
||||
//pr($uploadmedia);exit;
|
||||
if ($uploadmediaTable->delete($uploadmedia)) {
|
||||
unlink(CONTACT_PHOTO . $uploadmedia->image_path);
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "CLIENTREPORT_DELETE";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('Media has been deleted successfully!.'));
|
||||
|
||||
$this->loadModel('ClientImagesHistory');
|
||||
$historyUpdate['client_id'] = $uploadmedia->client_id;
|
||||
$historyUpdate['image_type_id'] = $uploadmedia->rtg_letter_image_id;
|
||||
$historyUpdate['action_type'] = 2;
|
||||
$this->ClientImagesHistory->insertOrUpdate($historyUpdate);
|
||||
|
||||
return $this->redirect($this->referer());
|
||||
} else {
|
||||
$this->Flash->error(__('Media has not been deleted!.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
136
src/Controller/ClientFilesController.php
Normal file
136
src/Controller/ClientFilesController.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use App\Helper\commonLogic;
|
||||
/**
|
||||
* ClientFiles Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\ClientFile[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class ClientFilesController extends AppController
|
||||
{
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
if($this->setClientControllerAccess()){
|
||||
$this->Auth->Allow(['agreementfiles']);
|
||||
}
|
||||
$this->setUserType();
|
||||
}
|
||||
|
||||
public function agreementfiles($assignment_id = ""){
|
||||
if($assignment_id > 0){
|
||||
$this->agreementdownload($assignment_id);
|
||||
}
|
||||
$member_id = $this->Auth->user('id');
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
$this->loadModel('AgreementAssignments');
|
||||
$extras['status'] = 1;
|
||||
$extras['isFirst'] = false;
|
||||
$extras['colums'] = ['id','AgreementFormats.title'];
|
||||
$agreements = $this->AgreementAssignments->getAgreementFormatWithClientAssignmentByMemberIdAndClientId($member_id,$client_id,$extras);
|
||||
$this->set(compact('agreements'));
|
||||
}
|
||||
|
||||
|
||||
private function agreementdownload($assignment_id = ""){
|
||||
if($this->request->is('post') && $this->Auth->user()){
|
||||
if($assignment_id > 0){
|
||||
$common = new commonLogic();
|
||||
$common->downloadAgreementByAssignmentId($assignment_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$clientFiles = $this->paginate($this->ClientFiles);
|
||||
|
||||
$this->set(compact('clientFiles'));
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Client File id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$clientFile = $this->ClientFiles->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('clientFile', $clientFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$clientFile = $this->ClientFiles->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$clientFile = $this->ClientFiles->patchEntity($clientFile, $this->request->getData());
|
||||
if ($this->ClientFiles->save($clientFile)) {
|
||||
$this->Flash->success(__('The client file has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The client file could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientFile'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Client File 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)
|
||||
{
|
||||
$clientFile = $this->ClientFiles->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$clientFile = $this->ClientFiles->patchEntity($clientFile, $this->request->getData());
|
||||
if ($this->ClientFiles->save($clientFile)) {
|
||||
$this->Flash->success(__('The client file has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The client file could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientFile'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Client File 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']);
|
||||
$clientFile = $this->ClientFiles->get($id);
|
||||
if ($this->ClientFiles->delete($clientFile)) {
|
||||
$this->Flash->success(__('The client file has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The client file could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
269
src/Controller/ClientNoteController.php
Normal file
269
src/Controller/ClientNoteController.php
Normal file
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use Cake\View\View;
|
||||
/**
|
||||
* ClientNote Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\ClientNote[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class ClientNoteController extends AppController
|
||||
{
|
||||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
if($this->setClientControllerAccess()){
|
||||
$this->Auth->Allow(['note','clientchat','addnote']);
|
||||
}
|
||||
|
||||
$this->setUserType();
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function note($crmuser_id = null, $user_name = ""){
|
||||
$member_id = $this->Auth->user('id');
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
|
||||
if($this->request->is('ajax')){
|
||||
$request = $this->request->getData();
|
||||
$request['client_id'] = $client_id;
|
||||
$response = $this->getChatAjax($request);
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
$page_limit = 10;
|
||||
$this->loadModel('Notes');
|
||||
$this->paginate = [
|
||||
'limit' => $page_limit,
|
||||
'order' => [
|
||||
'Notes.id' => 'desc'
|
||||
]
|
||||
];
|
||||
|
||||
if($this->request->params['_matchedRoute'] == "/client/notelist/*"){
|
||||
|
||||
}else{
|
||||
//$notes = $this->Notes->getNotesByCrmuserIdWithMemberId($member_id,$crmuser_id);
|
||||
}
|
||||
$note_category = [1,2,4];
|
||||
$notes = $this->Notes->getNotesByClientIdWithMemberId($member_id,$client_id,0,$note_category);
|
||||
if(!empty($notes)){
|
||||
$notes = $this->paginate($notes);
|
||||
}
|
||||
|
||||
$ajax_url = '/ClientNote/note/'.$crmuser_id;
|
||||
$this->set(compact('notes','crmuser_id','ajax_url','user_name'));
|
||||
$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('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);
|
||||
}
|
||||
|
||||
|
||||
private function getChatAjax($inputData){
|
||||
$response = null;
|
||||
$member_id = $this->Auth->user('id');
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
$this->loadModel('NoteDetails');
|
||||
$this->loadModel('Notes');
|
||||
$this->loadModel('Crmusers');
|
||||
$this->loadModel('Clients');
|
||||
$userType = 3;
|
||||
$parent_name = $_SESSION['Auth']['User']['member_name'];
|
||||
$child_name = $_SESSION['Auth']['User']['client_name'];
|
||||
if($inputData['action'] == 'GET_REPLY_DATA'){
|
||||
$note_id = $inputData['note_id'];
|
||||
$notes = $this->NoteDetails->getNotesDetailsByNoteIdWithMemberId($member_id,$note_id);
|
||||
$first_note_info = $notes[0];
|
||||
if($first_note_info->note_type == 4){
|
||||
$employee_id = $first_note_info->note->crmuser_id;
|
||||
$parent_info = $this->Crmusers->find()->where(['id'=>$employee_id])->first();
|
||||
$parent_name = $parent_info->first_name." ".$parent_info->last_name;
|
||||
}
|
||||
$noteData['status'] = 1;
|
||||
$noteData['note_id'] = $note_id;
|
||||
$this->NoteDetails->updateAll(['status'=>1],['note_id'=>$note_id]);
|
||||
$count_reply = 0;
|
||||
$view = new View($this->request, $this->response);
|
||||
$view->viewPath = 'ClientNote';
|
||||
$view->layout = false;
|
||||
$title = $inputData['title'];
|
||||
$view->set(compact('notes','title','note_id','parent_name','child_name'));
|
||||
$html = $view->render('chat_layout');
|
||||
$response = $html;
|
||||
} else if($inputData['action'] == 'SEND_REPLY_MESSAGE'){
|
||||
|
||||
$note_id = $inputData['note_id'];
|
||||
$data['note_id'] = $note_id;
|
||||
$data['note_type'] = $userType;
|
||||
$data['status'] = 2;
|
||||
$data['note'] = $inputData['note'];
|
||||
if(!empty($inputData['attachment'])){
|
||||
$new_name = uniqid().time().".jpg";
|
||||
$file_name = $this->chatAttachmentUpload($inputData['attachment'],$new_name);
|
||||
$data['attachment'] = $file_name;
|
||||
}
|
||||
$note = $this->NoteDetails->addNoteDetail($data);
|
||||
$noteData['note_id'] = $note_id;
|
||||
$noteData['status'] = 2;
|
||||
$this->Notes->updateNote($noteData);
|
||||
$view = new View($this->request, $this->response);
|
||||
$view->viewPath = 'ClientNote';
|
||||
$view->layout = false;
|
||||
$view->set(compact('note'));
|
||||
$html = $view->render('chat_msg');
|
||||
$response = $html;
|
||||
$this->Clients->updateNoteStatusById($client_id,1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
public function clientchat(){
|
||||
$member_id = $this->Auth->user('id');
|
||||
$crmuser_id = $this->Auth->user('user_id');
|
||||
$client_id = 0;
|
||||
if($_SESSION['userType'] == CONTACT_USER_INDICATOR){
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
}
|
||||
if($this->request->is('ajax')){
|
||||
$request = $this->request->getData();
|
||||
//pr($request);exit;
|
||||
$request['crmuser_id'] = $crmuser_id;
|
||||
if($client_id > 0){
|
||||
$request['client_id'] = $client_id;
|
||||
$request['crmuser_id'] = 0;
|
||||
}
|
||||
|
||||
$response = $this->getChatAjax($request);
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$page_limit = 10;
|
||||
$this->loadModel('Notes');
|
||||
$this->paginate = [
|
||||
'limit' => $page_limit,
|
||||
'order' => [
|
||||
'Notes.id' => 'desc'
|
||||
]
|
||||
];
|
||||
|
||||
if($_SESSION['userType'] == CONTACT_USER_INDICATOR){
|
||||
$notes = $this->Notes->getNotesByClientIdWithMemberId($member_id,$client_id);
|
||||
$crmuser_id = $client_id;
|
||||
}else{
|
||||
$notes = $this->Notes->getNotesByCrmuserIdWithMemberId($member_id,$crmuser_id);
|
||||
}
|
||||
if(!empty($notes)){
|
||||
$notes = $this->paginate($notes);
|
||||
}
|
||||
$ajax_url = '/ClientNote/clientchat/';
|
||||
$this->set(compact('notes','crmuser_id','ajax_url'));
|
||||
$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('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->render('note');
|
||||
}
|
||||
|
||||
public function addnote() {
|
||||
$member_id = $this->Auth->user('id');
|
||||
$employee_id = $this->Auth->user('employee_id');
|
||||
$crmuser_id = $employee_id;
|
||||
$this->loadModel('Clients');
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
$note_type = 3;
|
||||
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
$actionName = '/ClientNote/clientchat';
|
||||
$count_reply = 1;
|
||||
$this->loadModel('Notes');
|
||||
$this->loadModel('NoteDetails');
|
||||
$this->loadModel('Crmusers');
|
||||
if(!empty($request['title']) && !empty($request['message'])){
|
||||
$noteData['note'] = $request['message'];
|
||||
$noteData['title'] = $request['title'];
|
||||
$noteData['cmsuser_id'] = $member_id;
|
||||
$noteData['crmuser_id'] = $crmuser_id;
|
||||
$noteData['client_id'] = $client_id;
|
||||
$noteData['title'] = $request['title'];
|
||||
$noteData['status'] = 2;
|
||||
if(!empty($request['attachment'])){
|
||||
$new_name = uniqid().time().".jpg";
|
||||
$file_name = $this->chatAttachmentUpload($request['attachment'],$new_name);
|
||||
$noteData['attachment'] = $file_name;
|
||||
}
|
||||
$result = $this->Notes->addNote($noteData);
|
||||
$noteData['note_id'] = $result->id;
|
||||
$noteData['note_type'] = $note_type;
|
||||
$noteData['status'] = 2;
|
||||
$result1 = $this->NoteDetails->addNoteDetail($noteData);
|
||||
if($_SESSION['userType'] == CONTACT_USER_INDICATOR){
|
||||
$this->Clients->updateNoteStatusById($client_id,$count_reply);
|
||||
$actionName = '/ClientNote/addnote';
|
||||
}else {
|
||||
$this->Crmusers->updateNoteStatusById($crmuser_id,$count_reply);
|
||||
}
|
||||
if(!empty($result1)){
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "NOTES_ADD";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data']["id"]=$result1->id;
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success(__('Note has been sent successfully.'));
|
||||
return $this->redirect('/ClientNote/note');
|
||||
}
|
||||
}else{
|
||||
$this->Flash->error(__('Note has not been sent.Please try again.'));
|
||||
}
|
||||
if($_SESSION['userType'] == CONTACT_USER_INDICATOR){
|
||||
return $this->redirect($this->referer());
|
||||
}
|
||||
return $this->redirect($actionName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function chatAttachmentUpload($file,$new_name){
|
||||
$member_id = $this->Auth->user('id');
|
||||
$dir = "chat_attachment/".$member_id;
|
||||
if (!is_dir($dir)) {
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
$target_file = $dir."/".$new_name;
|
||||
if(!empty($file)){
|
||||
//$data = str_replace('data:image/jpeg;base64,', '', $file);
|
||||
//$data = base64_decode($data);
|
||||
$exploded_string = explode(',',$file);
|
||||
$data = base64_decode($exploded_string[1]);
|
||||
file_put_contents($target_file, $data);
|
||||
}
|
||||
|
||||
return $target_file;
|
||||
}
|
||||
}
|
||||
149
src/Controller/ClientPopupsController.php
Normal file
149
src/Controller/ClientPopupsController.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Common\Permission;
|
||||
use App\Controller\AppController;
|
||||
|
||||
/**
|
||||
* ClientPopups Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\ClientPopup[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class ClientPopupsController extends AppController
|
||||
{
|
||||
|
||||
public function initialize() {
|
||||
|
||||
parent::initialize();
|
||||
|
||||
if (Permission::isEmployeeAsAdmin()) {
|
||||
$this->Auth->allow(['index', 'add', 'edit', 'delete']);
|
||||
}
|
||||
|
||||
$this->checkRTGuser(); // is RTG User or not
|
||||
|
||||
$this->setUserType();
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$member_id = $this->Auth->user('id');
|
||||
$this->loadModel('ClientPopups');
|
||||
|
||||
if($this->request->is('ajax')){
|
||||
$request = $this->request->getData();
|
||||
$response['status'] = false;
|
||||
$response['message'] = "";
|
||||
if($request['action'] == "CLEAR_CONTENT"){
|
||||
$member_id = $request['member_id'];
|
||||
if($response['status'] = $this->ClientPopups->removeContentById($member_id)){
|
||||
$response['message'] = "Content has been removed.";
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
die();
|
||||
}
|
||||
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
$request['member_id'] = $member_id;
|
||||
|
||||
if($this->ClientPopups->insertOrUpdateCientPopups($request)){
|
||||
$this->Flash->success(__('Client Popups has been saved.'));
|
||||
}
|
||||
}
|
||||
$client_popup = $this->ClientPopups->getClientPopupByMemberId($member_id);
|
||||
$content_path = "/images/no_image.png";
|
||||
if(file_exists($client_popup->content_path)){
|
||||
$content_path = "/".$client_popup->content_path;
|
||||
}
|
||||
|
||||
$this->set(compact('client_popup','content_path'));
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Client Popup id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$clientPopup = $this->ClientPopups->get($id, [
|
||||
'contain' => [],
|
||||
]);
|
||||
|
||||
$this->set('clientPopup', $clientPopup);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$clientPopup = $this->ClientPopups->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$clientPopup = $this->ClientPopups->patchEntity($clientPopup, $this->request->getData());
|
||||
if ($this->ClientPopups->save($clientPopup)) {
|
||||
$this->Flash->success(__('The client popup has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The client popup could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientPopup'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Client Popup 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)
|
||||
{
|
||||
$clientPopup = $this->ClientPopups->get($id, [
|
||||
'contain' => [],
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$clientPopup = $this->ClientPopups->patchEntity($clientPopup, $this->request->getData());
|
||||
if ($this->ClientPopups->save($clientPopup)) {
|
||||
$this->Flash->success(__('The client popup has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The client popup could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientPopup'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Client Popup 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']);
|
||||
$clientPopup = $this->ClientPopups->get($id);
|
||||
if ($this->ClientPopups->delete($clientPopup)) {
|
||||
$this->Flash->success(__('The client popup has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The client popup could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
741
src/Controller/ClientSecurePortalLoginController.php
Normal file
741
src/Controller/ClientSecurePortalLoginController.php
Normal file
@@ -0,0 +1,741 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Common\Permission;
|
||||
use App\Controller\AppController;
|
||||
use App\Helper\commonLogic;
|
||||
use Cake\Controller\Controller;
|
||||
|
||||
/**
|
||||
*ClientSecurePortalLogin Controller
|
||||
* *
|
||||
* @method \App\Model\Entity\ClientSecurePortalLogin[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = []) */
|
||||
class ClientSecurePortalLoginController extends AppController
|
||||
{
|
||||
public function initialize()
|
||||
{
|
||||
|
||||
parent::initialize();
|
||||
|
||||
$this->checkRTGuser(); // is RTG User or not
|
||||
$this->setUserType();
|
||||
|
||||
/*if ($_SESSION['userType'] == CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 1) {
|
||||
$isAllclients = $this->isAccessAllClients();
|
||||
|
||||
if ($isAllclients) {
|
||||
$employee_id = $this->Auth->user('user_id');
|
||||
$client_id = $this->request->params['pass'][0];
|
||||
if (!empty($client_id) && !empty($employee_id)) {
|
||||
if (!$this->isValidEmployee($employee_id, $client_id) && $this->request->params['action'] != "index") {
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
$isPermitted = Permission::isPermitted(SECURE_PORTAL_CONTROLLER_ID);
|
||||
if($isPermitted){
|
||||
$this->Auth->allow(['index']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|void
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->clientList();
|
||||
}
|
||||
|
||||
|
||||
private function clientList() {
|
||||
$member_id = $this->Auth->user('id');
|
||||
$userTypeName = $this->getCurrentUserType();
|
||||
$this->loadModel('Clients');
|
||||
$affiliate_type = 0;
|
||||
if ($this->request->is('ajax')) {
|
||||
$inputData = $this->request->getData();
|
||||
$this->loadModel('ClientAssignments');
|
||||
$member_id = $this->Auth->user('id');
|
||||
if ($inputData['action'] == 'CLIENT_STATUS_UPDATE') {
|
||||
$message = "Status has not been updated.";
|
||||
$response = $this->Clients->statusUpdateById($inputData['client_id'], $inputData['status']);
|
||||
if ($response) {
|
||||
$message = "Status has been updated successfully.";
|
||||
}
|
||||
} else if($inputData['action'] == 'CLIENT_SHIFT'){
|
||||
|
||||
$check_type = $inputData['check_type'];
|
||||
$employee_id = 0;
|
||||
$affiliate_id = 0;
|
||||
$employee_list = $inputData['employee_list'];
|
||||
$employee_affiliate_list = $inputData['employee_affiliate_list'];
|
||||
$affiliateList = $inputData['affiliateList'];
|
||||
|
||||
if(!empty($employee_list)){
|
||||
$employee_list = json_decode($employee_list,true);
|
||||
}
|
||||
|
||||
if(!empty($employee_affiliate_list)){
|
||||
$employee_affiliate_list = json_decode($employee_affiliate_list,true);
|
||||
}
|
||||
|
||||
if(!empty($affiliateList)){
|
||||
$affiliateList = json_decode($affiliateList,true);
|
||||
}
|
||||
$organizedData = $this->organizeClientShifting($inputData);
|
||||
extract($organizedData);
|
||||
$client_name = $inputData['client_name'];
|
||||
$message = 'The Client "' . $client_name . '" has not been moved succesfully.';
|
||||
|
||||
$final_assoc = $inputData['final_assoc'];
|
||||
//pr($final_assoc);exit;
|
||||
$crmuser_id = $inputData['crmuser_id'];
|
||||
$client_id = $inputData['client_id'];
|
||||
$this->loadModel('ReminderNotification');
|
||||
if($check_type == "unchecked"){
|
||||
if($crmuser_id > 0){
|
||||
$response = $this->ClientAssignments->deleteRelation($client_id,$crmuser_id);
|
||||
$crmuserRefferenceIds = $this->Crmusers->getCrmUsersByIdsWithRefference([$crmuser_id]);
|
||||
if(!empty($crmuserRefferenceIds)){
|
||||
$updateData = current($crmuserRefferenceIds);
|
||||
$updateData['client_id'] = $client_id;
|
||||
$this->ReminderNotification->reminderNotificationStatusUpdate($updateData,0); // 0 = in active reminder
|
||||
}
|
||||
}else{
|
||||
$response = $this->ClientAssignments->deleteMemberRelation($client_id,$member_id);
|
||||
}
|
||||
}else if($check_type == "checked"){
|
||||
if($crmuser_id > 0){
|
||||
$this->loadModel('Crmusers');
|
||||
$crmuserRefferenceIds = $this->Crmusers->getCrmUsersByIdsWithRefference([$crmuser_id]);
|
||||
if(!empty($crmuserRefferenceIds)){
|
||||
$updateData = current($crmuserRefferenceIds);
|
||||
$updateData['client_id'] = $client_id;
|
||||
$this->ReminderNotification->reminderNotificationStatusUpdate($updateData,1); // 1 = active reminder
|
||||
}
|
||||
}else{
|
||||
$crmuserRefferenceIds[] = ['refference_id'=>$member_id,'refference_type'=>1]; // 1 = member type
|
||||
}
|
||||
|
||||
$this->loadModel('Clients');
|
||||
$this->Clients->moveClient($inputData['client_id'],0); // 0 = move to main client list
|
||||
|
||||
$response = $this->ClientAssignments->updateClientRelation($inputData['client_id'],$crmuserRefferenceIds);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//$response = $this->Clients->assignAffiliateOrEmployee($inputData['client_id'],$employee_id,$affiliate_id);
|
||||
if($response){
|
||||
if(!empty($client_name)){
|
||||
$message = 'The Client "' . $client_name . '" has been moved succesfully.';
|
||||
}else{
|
||||
$message = 'Client has been moved succesfully.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else if($inputData['action'] == 'EMPLOYEE_AFFILIATE_LIST'){
|
||||
$commonLogic = new commonLogic();
|
||||
$message = $commonLogic->clientsFilteringByMemberOREmployees($inputData);
|
||||
|
||||
}else if($inputData['action'] == 'GET_AGREEMENT_LIST'){
|
||||
$message = $this->getAgrementListByClientId($inputData);
|
||||
}else if($inputData['action'] == "ASSIN_AGREEMENT"){
|
||||
$message = $this->assignAgreementByClientId($inputData);
|
||||
}elseif ($inputData['action'] == "DELETE_AGREEMENT_FORMAT") {
|
||||
$message = $this->deleteAgreementFormatById($inputData);
|
||||
}else if($inputData['action'] == "AGREEMENT_REASSIGNED"){
|
||||
$inputData['member_id'] = $member_id;
|
||||
$message = $this->reassignedAgreement($inputData);
|
||||
$message['html'] = $this->getAgrementListByClientId($inputData);
|
||||
|
||||
}else if($inputData['action'] == "REVOKE_AGREEMENT_REASSIGNED"){
|
||||
$this->loadModel('AgreementAssignments');
|
||||
$status = 1;
|
||||
$inputData['member_id'] = $member_id;
|
||||
$res = $this->AgreementAssignments->makeReAssignedAgreement($inputData,$status);
|
||||
$message['status'] = false;
|
||||
$message['message'] = "Revoked is not succesfull.";
|
||||
if($res){
|
||||
$message['status'] = true;
|
||||
$message['message'] = "Successfully revoked re-assigned.";
|
||||
$message['html'] = $this->getAgrementListByClientId($inputData);
|
||||
|
||||
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
$everything = new \App\Utility\Everythings();
|
||||
$everythinData['action_on_id'] = SAME_AS_BY;
|
||||
$everythinData['action_on_name'] = SAME_AS_BY;
|
||||
$everythinData['event_name'] = "agreement_revoked_reassign";
|
||||
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
|
||||
$everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// Everything Insertion
|
||||
}
|
||||
|
||||
}else if ($inputData['action'] == 'GET_CLIENT_EMAIL') {
|
||||
// pr($inputData);exit;
|
||||
$client_id = $inputData['client_id'];
|
||||
$client_info = $this->Contacts->getPrimaryClientInfoByClientId($client_id);
|
||||
$message['client_info'] = $client_info;
|
||||
}else if ($inputData['action'] == 'SEND_CLIENT_EMAIL') {
|
||||
$this->loadModel('SendEmailToClients');
|
||||
$user_type = $this->getCurrentUserType();
|
||||
|
||||
$client_id = $inputData['client_id'];
|
||||
$email_subject = $inputData['client_email_subject'];
|
||||
$to_email = trim($inputData['client_email']);
|
||||
$email_body = nl2br($inputData['client_email_body']);
|
||||
$member_contact_name= $this->Auth->user('contact_name');
|
||||
$member_contact_company= $this->Auth->user('company_name');
|
||||
|
||||
if($user_type == 'MEMBER'){
|
||||
$inputData['sender_id'] = $this->Auth->User('id');
|
||||
$inputData['sender_type'] = 1;
|
||||
}else if($user_type == 'EMPLOYEE'){
|
||||
$inputData['sender_id'] = $this->Auth->User('user_id');
|
||||
$inputData['sender_type'] = 2;
|
||||
}
|
||||
$client_send_email = $this->SendEmailToClients->insertClientSendEmail($inputData);
|
||||
// pr($inputData);exit;
|
||||
if((!empty($member_contact_name) && !empty($member_contact_company))){
|
||||
$client_regards = "Regards,<br/>".$member_contact_name.','.$member_contact_company;
|
||||
}elseif (!empty($member_contact_name)){
|
||||
$client_regards = "Regards,<br/>".$member_contact_name;
|
||||
}elseif (!empty($member_contact_company)){
|
||||
$client_regards = "Regards,<br/>".$member_contact_company;
|
||||
}else{
|
||||
$client_regards = "Regards<br/>";
|
||||
}
|
||||
$commonlogic = new commonLogic;
|
||||
$personalize = $commonlogic->personalizeInfo();
|
||||
|
||||
$templateContent = [
|
||||
'regards' => $client_regards,
|
||||
'email_body' => $email_body
|
||||
];
|
||||
|
||||
if(!empty($personalize['email_signature'])){
|
||||
$templateContent['email_signature'] = $personalize['email_signature'];
|
||||
}
|
||||
|
||||
$this->sendEmail('send_email_to_client', $templateContent, $to_email, $email_subject, "", $personalize['personalize']);
|
||||
$message['status'] = true;
|
||||
}else if ($inputData['action'] == 'SEND_CLIENT_LOGIN_CREDENTIAL') {
|
||||
$password = $inputData['password'];
|
||||
$c_password = $inputData['c_password'];
|
||||
$contact_id = $inputData['contact_id'];
|
||||
$message = "";
|
||||
|
||||
if($password == $c_password){
|
||||
$this->loadModel('Contacts');
|
||||
$contact_data['password'] = md5($password);
|
||||
$contact_data['raw_password'] = $password;
|
||||
|
||||
if($this->Contacts->updateContactById($contact_id,$contact_data)){
|
||||
$contact = $this->Contacts->getContactsById($contact_id);
|
||||
$email = $contact->email;
|
||||
|
||||
if(!empty($email)) {
|
||||
$message = 'Client login credential sent successfully.';
|
||||
$member_contact_name = $this->Auth->user('contact_name');
|
||||
$member_contact_company = $this->Auth->user('company_name');
|
||||
|
||||
if ((!empty($member_contact_name) && !empty($member_contact_company))) {
|
||||
$client_regards = "Regards,<br/>" . $member_contact_name . ',' . $member_contact_company;
|
||||
} elseif (!empty($member_contact_name)) {
|
||||
$client_regards = "Regards,<br/>" . $member_contact_name;
|
||||
} elseif (!empty($member_contact_company)) {
|
||||
$client_regards = "Regards,<br/>" . $member_contact_company;
|
||||
} else {
|
||||
$client_regards = "Regards,<br/>";
|
||||
}
|
||||
$commonlogic = new commonLogic;
|
||||
$personalize = $commonlogic->personalizeInfo();
|
||||
$loginurl = $personalize['login_url'];
|
||||
|
||||
$templateContent = [
|
||||
'firstname' => $contact->first_name . " " . $contact->last_name,
|
||||
'loginurl' => $loginurl,
|
||||
'user_email' => $email,
|
||||
'password' => $contact->raw_password,
|
||||
'member_name' => $this->Auth->user('email'),
|
||||
'regards' => $client_regards
|
||||
];
|
||||
|
||||
if (!empty($personalize['email_signature'])) {
|
||||
$templateContent['email_signature'] = $personalize['email_signature'];
|
||||
}
|
||||
|
||||
$this->sendEmail(MANDRILL_TEMPLATE_USER_CREATION, $templateContent, $email, "Client Portal Credential", "", $personalize['personalize']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
echo json_encode($message);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
|
||||
if(isset($request['client_action_types']) && $request['client_action_types'] > 0){
|
||||
|
||||
$selected_client_ids = [];
|
||||
if(!empty($request['selected_content'])){
|
||||
$selected_client_ids = explode(',', $request['selected_content']);
|
||||
}
|
||||
|
||||
if( $request['client_action_types'] == 1){ // For Delete All
|
||||
$result = $this->Clients->deleteClientRelatedInfoByClientId($member_id,$selected_client_ids);
|
||||
if($result){
|
||||
$this->Flash->success(__('The selected clients has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The action could not be executed. Please, try again.'));
|
||||
}
|
||||
|
||||
}else if( $request['client_action_types'] == 2){//For Make All Active
|
||||
$status = 1;
|
||||
$result = $this->Clients->updateStatusByIdList($selected_client_ids,$status);
|
||||
if($result){
|
||||
$this->Flash->success(__('The selected clients has been made active.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The action could not be executed. Please, try again.'));
|
||||
}
|
||||
}else if( $request['client_action_types'] == 3){//For Make All InActive
|
||||
$status = 2;
|
||||
$result = $this->Clients->updateStatusByIdList($selected_client_ids,$status);
|
||||
// print_r($result);exit;
|
||||
if($result){
|
||||
$this->Flash->success(__('The selected clients has been made Inactive.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The action could not be executed. Please, try again.'));
|
||||
}
|
||||
}else if( $request['client_action_types'] == 4){//For Make All Graduated/Completed
|
||||
$status = 3;
|
||||
$result = $this->Clients->updateStatusByIdList($selected_client_ids,$status);
|
||||
// print_r($result);exit;
|
||||
if($result){
|
||||
$this->Flash->success(__('The selected clients has been made Inactive.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The action could not be executed. Please, try again.'));
|
||||
}
|
||||
}else if( $request['client_action_types'] == 5){//For Export All
|
||||
if(!empty($selected_client_ids) && is_array($selected_client_ids)){
|
||||
$export_condition = "Clients.id in (".implode(",",$selected_client_ids).")";
|
||||
$this->query_to_csv($export_condition, $member_id);
|
||||
}
|
||||
}
|
||||
}else if(isset($request['selected_reference_ids']) && !empty($request['selected_reference_ids'])){
|
||||
$selected_reference_ids = json_decode($request['selected_reference_ids'],true);
|
||||
$selected_client_ids = [];
|
||||
$final_assoc = [];
|
||||
if(!empty($request['selected_content'])){
|
||||
$selected_client_ids = explode(',', $request['selected_content']);
|
||||
}
|
||||
|
||||
if(!empty($selected_client_ids)){
|
||||
$this->loadModel('ClientAssignments');
|
||||
foreach($selected_client_ids as $c_id){
|
||||
if(!empty($selected_reference_ids)){
|
||||
foreach($selected_reference_ids as $r_id => $r_type){
|
||||
if($r_type == 1 && $r_id == 0){
|
||||
$r_id = $member_id;
|
||||
}
|
||||
$final_assoc[] = [
|
||||
'client_id'=>$c_id,
|
||||
'refference_id'=>$r_id,
|
||||
'refference_type'=>$r_type
|
||||
];
|
||||
$this->ClientAssignments->deleteMemberRelation($c_id, $r_id, $r_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($final_assoc)){
|
||||
if($this->ClientAssignments->insertClientAssignMents($final_assoc)){
|
||||
$this->Flash->success(__('The selected clients has been assigned.'));
|
||||
}
|
||||
}
|
||||
//pr($final_assoc);exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$clientId = "";
|
||||
if ($_SESSION['userType'] == CONTACT_USER_INDICATOR) {
|
||||
$client_id = $_SESSION['global_client_id'];
|
||||
$clientId = 'id =' . $client_id;
|
||||
return $this->redirect('/client/view/' . $client_id);
|
||||
}
|
||||
|
||||
$page_limit = 10;
|
||||
$selected_status = 1; // for ui select active
|
||||
$status = "Clients.status = ".$selected_status; // default active client
|
||||
$client_type = 1;
|
||||
$affiliate_client_id = 0;
|
||||
$employee_id = 0;
|
||||
$affiliate_client_list = [];
|
||||
$emlpoyee_list = [];
|
||||
$affiliate_condition = "";
|
||||
if(isset($this->request->query['show_client_checkbox'])){
|
||||
$this->set('show_client_checkbox',1);
|
||||
}
|
||||
$is_show_all_clients = $this->Auth->user('is_show_all_clients');
|
||||
if (isset($this->request->query['page_limit'])) {
|
||||
$page_limit = $this->request->query('page_limit');
|
||||
}
|
||||
|
||||
|
||||
if (isset($this->request->query['client_type'])) {
|
||||
$client_type = $this->request->query('client_type');
|
||||
}
|
||||
|
||||
if (isset($this->request->query['affiliate_client_id'])) {
|
||||
$affiliate_client_id = $this->request->query('affiliate_client_id');
|
||||
}
|
||||
|
||||
if (isset($this->request->query['employee_id'])) {
|
||||
$employee_id = $this->request->query('employee_id');
|
||||
}
|
||||
|
||||
if (isset($this->request->query['status']) && !empty($this->request->query['status'])) {
|
||||
$status = "Clients.status = " . $this->request->query('status');
|
||||
$selected_status = $this->request->query('status');
|
||||
if($selected_status == "all"){
|
||||
$status = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->paginate = [
|
||||
'limit' => $page_limit,
|
||||
'order' => [
|
||||
'Clients.id' => 'desc',
|
||||
'Contacts.id' => 'desc'
|
||||
],
|
||||
'maxLimit'=>500
|
||||
];
|
||||
|
||||
$cmsuser_id = $this->Auth->user('id');
|
||||
$search = '';
|
||||
|
||||
if (false) { // is affiliate user check
|
||||
$affiliate_client_id = $this->Auth->user('user_id');
|
||||
$affiliate_type = 2;
|
||||
if($this->Auth->user('is_employee_affiliate')){
|
||||
$affiliate_type = 4;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$is_employee = false;
|
||||
if ($_SESSION['userType'] == CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 1) {
|
||||
$is_employee = true;
|
||||
}
|
||||
list($affiliate_client_list,$emlpoyee_list,$employee_affiliate_list) = $this->generateAffiliateList($employee_id,$is_employee);
|
||||
|
||||
}
|
||||
|
||||
$is_source = 0;
|
||||
if ($this->request->params['action'] == 'clientonboarding') {
|
||||
$is_source = 1;
|
||||
}
|
||||
|
||||
if($userTypeName != "AFFILIATE"){
|
||||
if (!empty($affiliate_condition)) {
|
||||
$affiliate_condition .= " AND Clients.is_source = " . $is_source;
|
||||
} else {
|
||||
$affiliate_condition = "Clients.is_source = " . $is_source;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($is_show_all_clients == 2){
|
||||
$auth_employee_id = $this->Auth->user('user_id');
|
||||
}
|
||||
|
||||
|
||||
// echo $affiliate_condition;exit;
|
||||
if (isset($this->request->query['search']) && !empty($this->request->query['search'])) {
|
||||
$search = $this->request->query('search');
|
||||
$condition = ' ( Clients.name LIKE ' . "'%" . $search . "%' OR Clients.phone LIKE '%" . $search . "%' OR Clients.website LIKE '%" . $search . "%'"
|
||||
. "OR Contacts.first_name LIKE '%" . $search . "%' OR Contacts.last_name LIKE '%" . $search ."%'"
|
||||
." OR CONCAT(Contacts.first_name, ' ' , Contacts.last_name) LIKE '%" . $search ."%'"
|
||||
." OR Contacts.email LIKE '%" . $search ."%'"
|
||||
. ") ";
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($_SESSION['userType'] == CMS_USER_INDICATOR
|
||||
|| ($_SESSION['userType'] == STAF_USER_INDICATOR && $this->Auth->user('is_employee_to_member'))
|
||||
|| ($_SESSION['userType']== CRM_USER_INDICATOR)){
|
||||
$clients = $this->Contacts->find('all')
|
||||
->contain(['Clients']);
|
||||
|
||||
$is_filtering = true;
|
||||
/*
|
||||
For All Employee $employee_id = -1
|
||||
For A single employee $employee_id > 0
|
||||
For All Affiliate $affiliate_client_id = -1
|
||||
For A single Affiliate $affiliate_client_id > 0
|
||||
*/
|
||||
|
||||
$reference_type_array = [];
|
||||
$reference_id_array = [];
|
||||
|
||||
if($userTypeName == "EMPLOYEE"){
|
||||
if($this->Auth->user('is_show_all_clients') == 1){
|
||||
$is_filtering = false;
|
||||
}else{
|
||||
$reference_type_array[] = 3;
|
||||
$reference_id_array[] = $this->Auth->user('user_id');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($employee_id == -1){
|
||||
$reference_type_array[] = 3;
|
||||
}else if($employee_id > 0){
|
||||
$reference_type_array[] = 3;
|
||||
$reference_id_array[] = $employee_id;
|
||||
}
|
||||
|
||||
if ($affiliate_client_id == -1 || $affiliate_client_id == -2) {
|
||||
|
||||
$reference_type_array[] = 2;
|
||||
$reference_type_array[] = 4;
|
||||
|
||||
} else if ($affiliate_client_id > 0) {
|
||||
if($affiliate_type == 0){
|
||||
$this->loadModel('Crmusers');
|
||||
$crmusers = $this->Crmusers->find()->where(['Crmusers.id' => $affiliate_client_id])->first();
|
||||
$affiliate_type = 2;
|
||||
if($crmusers->employee_id > 0){
|
||||
$affiliate_type = 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($affiliate_type > 0){
|
||||
$reference_id_array[] = $affiliate_client_id;
|
||||
$reference_type_array[] = $affiliate_type;
|
||||
}else{
|
||||
$reference_type_array[] = 2;
|
||||
$reference_type_array[] = 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$new_dynamic_condition = "";
|
||||
|
||||
if(!empty($reference_type_array)){
|
||||
$reference_type_array = array_unique($reference_type_array);
|
||||
$new_dynamic_condition = 'CAT.refference_type in('.implode(",",$reference_type_array).")";
|
||||
}
|
||||
|
||||
if(!empty($reference_id_array)){
|
||||
$reference_id_array = array_unique($reference_id_array);
|
||||
$current_condition = 'CAT.refference_id in('.implode(",",$reference_id_array).")";
|
||||
if(!empty($new_dynamic_condition)){
|
||||
$new_dynamic_condition .= " AND ".$current_condition;
|
||||
}else{
|
||||
$new_dynamic_condition = $current_condition;
|
||||
}
|
||||
}
|
||||
|
||||
if($is_filtering && !empty($new_dynamic_condition)){
|
||||
$clients = $clients->join([
|
||||
'table' => 'client_assignments',
|
||||
'alias' => 'CAT',
|
||||
'type' => 'INNER',
|
||||
'conditions' => [
|
||||
'Contacts.client_id = CAT.client_id',
|
||||
$new_dynamic_condition
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
$clients = $clients
|
||||
->where([$condition,$affiliate_condition,'Contacts.is_primary_contact' => 1,
|
||||
'Clients.cmsuser_id' => $cmsuser_id, $clientId, $status])
|
||||
->distinct('Contacts.client_id');
|
||||
|
||||
}else if($_SESSION['userType']== CRM_USER_INDICATOR){
|
||||
$this->loadModel('ClientAssignments');
|
||||
$CRM_AUTH_ID = $this->Auth->user('user_id');
|
||||
$u_type = "refference_type = 1";
|
||||
if($_SESSION['Auth']['User']['type'] == 1){
|
||||
$u_type = "refference_type = 3";
|
||||
}else if($_SESSION['Auth']['User']['type'] == 2){
|
||||
$u_type = "refference_type = 2 OR refference_type = 4";
|
||||
if($this->Auth->user('is_employee_affiliate')){
|
||||
$u_type = "refference_type = 4";
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($u_type)){
|
||||
$emp_client_ids = $this->ClientAssignments->getClientsByUserTypeIdAndCondition($CRM_AUTH_ID,$u_type);
|
||||
}
|
||||
|
||||
$clients = [];
|
||||
if(!empty($emp_client_ids)){
|
||||
$clients = $this->Contacts->find('all')->contain(['Clients'])
|
||||
->where(['Clients.id IN'=>$emp_client_ids, 'Clients.cmsuser_id' => $cmsuser_id, $clientId, $status]);
|
||||
}
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
$user_permissions = $this->request->session()->read('user_permissions');
|
||||
$this->loadModel('Sertg');
|
||||
$paginated_clients = $clients;
|
||||
$paginated_clients = $this->paginate($paginated_clients);
|
||||
|
||||
$client_ids = [];
|
||||
$client_employee_relations = [];
|
||||
$client_letter_set_assoc = [];
|
||||
|
||||
|
||||
|
||||
if(!empty($client_ids)){
|
||||
$this->loadModel('ClientAssignments');
|
||||
$user_type = 0;
|
||||
if ($_SESSION['userType']== CRM_USER_INDICATOR && $_SESSION['Auth']['User']['type'] == 1) {
|
||||
$user_type = 4;
|
||||
}
|
||||
|
||||
$client_employee_relationsData = $this->ClientAssignments->getClientsRealtionsByClientIds($client_ids, $user_type);
|
||||
$client_employee_relations = $client_employee_relationsData['employees'];
|
||||
}
|
||||
// pr($client_employee_relationsData);
|
||||
// pr($client_employee_relations);exit;
|
||||
if($_SESSION['hasEpicVelocity'] || $_SESSION['hasVelocity']){
|
||||
$isVelocityUser = true;
|
||||
}
|
||||
|
||||
|
||||
$this->loadModel('Notes');
|
||||
$noteList = $this->Notes->getNotesByMemberIdWithNoteList($cmsuser_id);
|
||||
$this->set('noteList', $noteList);
|
||||
$this->set('client_type', $client_type);
|
||||
$this->set('affliliate_client_id', $affiliate_client_id);
|
||||
$this->set('affiliate_client_list', $affiliate_client_list);
|
||||
$this->set('employee_affiliate_list', $employee_affiliate_list);
|
||||
$this->set('employee_list', $emlpoyee_list);
|
||||
$this->set('employee_id', $employee_id);
|
||||
$this->set('status', $selected_status);
|
||||
$this->set('user_permission', $user_permissions);
|
||||
$this->set('bulk_actions', [BULK_ACTION_DELETE => "Move to trash"]);
|
||||
$this->set('clients', $paginated_clients); //$this->paginate($clients));
|
||||
$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->set('isVelocityUser', $isVelocityUser);
|
||||
$this->set("is_source", $is_source);
|
||||
$this->set("client_employee_relations", $client_employee_relations);
|
||||
$this->set("client_employee_relationsData", $client_employee_relationsData);
|
||||
$this->set("client_letter_set_assoc", $client_letter_set_assoc);
|
||||
|
||||
//$this->viewBuilder()->layout("custom_layout");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $idClient Secure Portal Login id.
|
||||
* @return \Cake\Http\Response|void
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('clientSecurePortalLogin', $clientSecurePortalLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->patchEntity($clientSecurePortalLogin, $this->request->getData());
|
||||
if ($this->ClientSecurePortalLogin->save($clientSecurePortalLogin)) {
|
||||
$this->Flash->success(__('Theclient secure portal login has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('Theclient secure portal login could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientSecurePortalLogin'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $idClient Secure Portal Login id.
|
||||
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
|
||||
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||
*/
|
||||
public function edit($id = null)
|
||||
{
|
||||
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->patchEntity($clientSecurePortalLogin, $this->request->getData());
|
||||
if ($this->ClientSecurePortalLogin->save($clientSecurePortalLogin)) {
|
||||
$this->Flash->success(__('Theclient secure portal login has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('Theclient secure portal login could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientSecurePortalLogin'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $idClient Secure Portal Login 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']);
|
||||
$clientSecurePortalLogin = $this->ClientSecurePortalLogin->get($id);
|
||||
if ($this->ClientSecurePortalLogin->delete($clientSecurePortalLogin)) {
|
||||
$this->Flash->success(__('Theclient secure portal login has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('Theclient secure portal login could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
202
src/Controller/ClientStatusController.php
Normal file
202
src/Controller/ClientStatusController.php
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use App\Utility\Common;
|
||||
use App\Utility\CreditAnalysis;
|
||||
use App\Utility\PdfWriter;
|
||||
use Cake\Routing\Router;
|
||||
use App\Helper\commonLogic;
|
||||
use Cake\View\View;
|
||||
|
||||
/**
|
||||
* ClientStatus Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\ClientStatus[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class ClientStatusController extends AppController
|
||||
{
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
if($this->setClientControllerAccess()){
|
||||
$this->Auth->allow(['creditreportstatus']);
|
||||
}
|
||||
//$this->checkRTGuser(); // is RTG User or not
|
||||
|
||||
$this->setUserType(); // Set CRM/CMS/Contacts user
|
||||
}
|
||||
|
||||
private function itemChange($inputData){
|
||||
$result = false;
|
||||
if($inputData['item_type'] == "ACC"){
|
||||
$this->loadModel('DataItemKeyValues');
|
||||
$result =$this->DataItemKeyValues->updateItemValueById($inputData);
|
||||
}else if($inputData['item_type'] == "PB"){
|
||||
$this->loadModel('DataPublicRecords');
|
||||
$result = $this->DataPublicRecords->updatePublicRecordValueById($inputData);
|
||||
}else if($inputData['item_type'] == "INQ"){
|
||||
$this->loadModel('DataInquiries');
|
||||
$result = $this->DataInquiries->updateInquiryValueById($inputData);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$clientStatus = $this->paginate($this->ClientStatus);
|
||||
|
||||
$this->set(compact('clientStatus'));
|
||||
}
|
||||
|
||||
public function creditreportstatus(){
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
|
||||
if ($this->request->is('ajax')) {
|
||||
$ajaxData = $this->request->getData();
|
||||
$action = $ajaxData['action'];
|
||||
$this->showclientshtml($action,$client_id);
|
||||
|
||||
|
||||
}
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
$commonLogic = new commonLogic;
|
||||
$data = $commonLogic->commonCreditReportStatus($this->request->query,$client_id);
|
||||
$data['isEditmode'] = false;
|
||||
$this->set($data);
|
||||
$this->render('/Client/creditreportstatus');
|
||||
}
|
||||
|
||||
|
||||
public function challengeHistory(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Client Status id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$clientStatus = $this->ClientStatus->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('clientStatus', $clientStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$clientStatus = $this->ClientStatus->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$clientStatus = $this->ClientStatus->patchEntity($clientStatus, $this->request->getData());
|
||||
if ($this->ClientStatus->save($clientStatus)) {
|
||||
$this->Flash->success(__('The client status has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The client status could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientStatus'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Client Status 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)
|
||||
{
|
||||
$clientStatus = $this->ClientStatus->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$clientStatus = $this->ClientStatus->patchEntity($clientStatus, $this->request->getData());
|
||||
if ($this->ClientStatus->save($clientStatus)) {
|
||||
$this->Flash->success(__('The client status has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The client status could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientStatus'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Client Status 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']);
|
||||
$clientStatus = $this->ClientStatus->get($id);
|
||||
if ($this->ClientStatus->delete($clientStatus)) {
|
||||
$this->Flash->success(__('The client status has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The client status could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
public function showclientshtml($action,$client_id) {
|
||||
|
||||
$this->loadModel('HtmlCodeHistories');
|
||||
if($action == "GET_ANALYZER"){
|
||||
$result = [];
|
||||
$this->loadModel('CreditAnalyzerReports');
|
||||
$client_info = $this->HtmlCodeHistories->getClientInfo($client_id);
|
||||
|
||||
if(!empty($client_info)) {
|
||||
$HtmlCodeHistories = $this->HtmlCodeHistories->getHistoryCreditScoreById($client_info['id']);
|
||||
$data = $this->CreditAnalyzerReports->getData($client_info['member_id'], $client_id, $client_info['id']);
|
||||
$result['status'] = false;
|
||||
if (!empty($data)) {
|
||||
$creditanalysis = new CreditAnalysis();
|
||||
$analyzer = $creditanalysis->creditAnalyzerReportData($data);
|
||||
$response = $creditanalysis->getnerateAnalyzerReportFromDB($analyzer);
|
||||
if (!empty($response['content'])) {
|
||||
$result['status'] = true;
|
||||
$result['credit_score'] = $response['credit_score'];
|
||||
//pr($result['credit_score']);exit;
|
||||
$result['html'] = $response['content'];
|
||||
|
||||
$score_data = [];
|
||||
$score_data['trans'] = $HtmlCodeHistories['trans'];
|
||||
$score_data['exp'] = $HtmlCodeHistories['exp'];
|
||||
$score_data['equif'] = $HtmlCodeHistories['equif'];
|
||||
//pr($score_data);exit;
|
||||
$view = new View($this->request, $this->response);
|
||||
$view->viewPath = 'Client';
|
||||
$view->layout = false;
|
||||
//$view->set('data',$score_data);
|
||||
$history_credit_points = $this->HtmlCodeHistories->getLastTwoHistoryPointsByMemberId($member_id, $client_id);
|
||||
$chart = $view->element('js_chart', ['data' => $score_data, 'credit_points' => $history_credit_points]);
|
||||
$result['html'] = str_replace(CRA_CREDIT_SCORE, $chart, $result['html']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($result);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
133
src/Controller/ClientStatusTypesController.php
Normal file
133
src/Controller/ClientStatusTypesController.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Common\Permission;
|
||||
use App\Controller\AppController;
|
||||
|
||||
/**
|
||||
*ClientStatusTypes Controller
|
||||
* * @property \App\Model\Table\ClientStatusTypesTable $ClientStatusTypes *
|
||||
* @method \App\Model\Entity\ClientStatusType[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class ClientStatusTypesController extends AppController
|
||||
{
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize(); // TODO: Change the autogenerated stub
|
||||
|
||||
if (Permission::isEmployeeAsAdmin()) {
|
||||
$this->Auth->allow(['index', 'add', 'edit', 'delete']);
|
||||
}
|
||||
|
||||
$this->checkRTGuser(); // is RTG User or not
|
||||
|
||||
$this->setUserType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|void
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$member_id = $this->Auth->user('id');
|
||||
$result = $this->ClientStatusTypes->getClientStatusWithClients($member_id);
|
||||
// dd($result);
|
||||
$this->set(compact('result'));
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $idClient Status Type id.
|
||||
* @return \Cake\Http\Response|void
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$clientStatusType = $this->ClientStatusTypes->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('clientStatusType', $clientStatusType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$member_id = $this->Auth->user('id');
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
if(!isset($request['status'])){
|
||||
$request['status'] = 0;
|
||||
}
|
||||
$validated = $this->ClientStatusTypes->newEntity($request);
|
||||
if(empty($validated->errors())){
|
||||
$inputData[] = [
|
||||
'name'=>$request['name'],
|
||||
'color'=>$request['color'],
|
||||
'status'=>$request['status'],
|
||||
'member_id'=>$member_id
|
||||
];
|
||||
if($this->ClientStatusTypes->add($inputData)){
|
||||
$this->Flash->success('The client status type has been saved.');
|
||||
$this->setClientStatus();
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}else{
|
||||
$this->set('errors',$validated->errors());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $idClient Status Type id.
|
||||
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
|
||||
* @throws \Cake\Network\Exception\NotFoundException When record not found.
|
||||
*/
|
||||
public function edit($id = null)
|
||||
{
|
||||
$clientStatusType = $this->ClientStatusTypes->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$clientStatusType = $this->ClientStatusTypes->patchEntity($clientStatusType, $this->request->getData());
|
||||
if ($this->ClientStatusTypes->save($clientStatusType)) {
|
||||
$this->Flash->success(__('Theclient status type has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('Theclient status type could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientStatusType'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $idClient Status Type 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']);
|
||||
$clientStatusType = $this->ClientStatusTypes->get($id);
|
||||
if ($this->ClientStatusTypes->delete($clientStatusType)) {
|
||||
$this->Flash->success(__('Theclient status type has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('Theclient status type could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
449
src/Controller/ClientdashboardController.php
Normal file
449
src/Controller/ClientdashboardController.php
Normal file
@@ -0,0 +1,449 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
use App\Helper\commonLogic;
|
||||
use App\Utility\PasswordCreator;
|
||||
use Cake\Routing\Router;
|
||||
|
||||
/**
|
||||
* Clientdashboard Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\Clientdashboard[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class ClientdashboardController extends AppController {
|
||||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
if($this->setClientControllerAccess()){
|
||||
$this->Auth->allow(['index','creditreport','clientsignature','agreementdownload']);
|
||||
}
|
||||
|
||||
$this->checkRTGuser(); // is RTG User or not
|
||||
|
||||
$this->setUserType(); // Set CRM/CMS/Contacts user
|
||||
//pr($this->Auth->user());exit;
|
||||
}
|
||||
|
||||
|
||||
public function clientsignature(){
|
||||
|
||||
if(!isset($_SESSION['has_agreement'])){
|
||||
return $this->redirect(['controller'=>'Clientdashboard','action'=>'index']);
|
||||
}
|
||||
$this->loadModel('AgreementAssignments');
|
||||
$this->viewBuilder()->layout("client_signature");
|
||||
$contact_id = $this->Auth->user('user_id');
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
$member_id = $this->Auth->user('id');
|
||||
$commonLogic = new commonLogic;
|
||||
|
||||
if($this->request->is('post')){
|
||||
|
||||
$request = $this->request->getData();
|
||||
$sign = $request['sign'];
|
||||
$sign_name = $request['name'];
|
||||
$inputData['id'] = $contact_id;
|
||||
$inputData['signature_name'] = $sign_name;
|
||||
$inputData['signature_value'] = $sign;
|
||||
$inputData['status'] = 1;
|
||||
$inputData['id'] = $request['agreement_assignment_id']; //current_content_path
|
||||
$inputData['current_content_path'] = $request['current_content']; //current_content_path
|
||||
$inputData['member_id'] = $member_id; //current_content_path
|
||||
$default_sign = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAADICAYAAABS39xVAAAFz0lEQVR4Xu3UAQkAAAwCwdm/9HI83BLIOdw5AgQIRAQWySkmAQIEzmB5AgIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiBgsPwAAQIZAYOVqUpQAgQMlh8gQCAjYLAyVQlKgIDB8gMECGQEDFamKkEJEDBYfoAAgYyAwcpUJSgBAgbLDxAgkBEwWJmqBCVAwGD5AQIEMgIGK1OVoAQIGCw/QIBARsBgZaoSlAABg+UHCBDICBisTFWCEiDwGVgAyc5eaH0AAAAASUVORK5CYII=";
|
||||
if(empty($inputData['signature_name']) && $inputData['signature_value'] == $default_sign){
|
||||
return $this->redirect($this->referer());
|
||||
|
||||
}
|
||||
|
||||
//$result = $this->Contacts->setSignByContactId($inputData);
|
||||
$result = $this->AgreementAssignments->assignmentUpdateById($inputData);
|
||||
if($result){
|
||||
$member_email = $this->Auth->user('member_email');
|
||||
$templateContent = [
|
||||
'title'=>$request['title'],
|
||||
'client_name'=>$this->Auth->user('client_name')
|
||||
];
|
||||
$file_path = $commonLogic->createAgrementPdf($inputData['id']);
|
||||
$personalize = $commonLogic->personalizeInfo();
|
||||
$subject = $templateContent['client_name']." has signed agreement.";
|
||||
$this->sendEmail('agreement', $templateContent, $member_email,$subject,$file_path,$personalize['personalize']);
|
||||
@unlink($file_path);
|
||||
|
||||
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
$everything = new \App\Utility\Everythings();
|
||||
$everythinData['action_on_id'] = $this->Auth->user('client_id');
|
||||
$everythinData['action_on_name'] = $this->Auth->user('client_name');
|
||||
$everythinData['event_name'] = "agreement_signed";
|
||||
$everythinData['action_on_usertype'] = CONTACT_USER_INDICATOR;
|
||||
$everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// Everything Insertion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$extras['status'] = 0;
|
||||
$extras['isFirst'] = true;
|
||||
$agreements = $this->AgreementAssignments->getAgreementFormatWithClientAssignmentByMemberIdAndClientId($member_id,$client_id,$extras);
|
||||
//pr($agreements);exit;
|
||||
$extra['today'] = $agreements->agreement_format->created_at;
|
||||
if(empty($agreements)){
|
||||
unset($_SESSION['has_agreement']);
|
||||
return $this->redirect(['controller'=>'Clientdashboard','action'=>'index']);
|
||||
}
|
||||
$file_path = "agreenment_contents/".$agreements->agreement_format->member_id."/".$agreements->agreement_format->content;
|
||||
$content = file_get_contents($file_path);
|
||||
$content = $commonLogic->agreementHTMLreplace($content,$agreements->current_values);
|
||||
$this->set(compact('agreements','content'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
$this->loadModel('HtmlCodeHistories');
|
||||
$this->loadModel('Uploadmedias');
|
||||
$this->loadModel('Creditreportsetups');
|
||||
$client_text="CLIENT_";
|
||||
if($this->request->is('ajax')){
|
||||
$request = $this->request->getData();
|
||||
$auth = $this->Auth->user();
|
||||
$member_id = $auth['id'];
|
||||
$request['creditreport']['client_id'] = $client_id;
|
||||
|
||||
if($request['action'] == "SEND_EMAIL"){
|
||||
$this->loadModel('Personalizes');
|
||||
$personalize = $this->Personalizes->getPersonalizeByMemberId($member_id);
|
||||
$templateContent['subject'] = $request['subject'];
|
||||
$templateContent['body'] = nl2br($request['body']);
|
||||
$templateContent['email_signature'] = $auth['member_email'];
|
||||
if(!empty($personalize->email_signature)){
|
||||
$templateContent['email_signature'] = $personalize->email_signature;
|
||||
}
|
||||
|
||||
$to = $request['to'];
|
||||
$this->sendEmail('client_member_email', $templateContent, $to,$templateContent['subject'],"",$personalize);
|
||||
$response = TRUE;
|
||||
|
||||
}else if($request['action'] == "CREDIT_MONITORING"){
|
||||
|
||||
$passcreator = new PasswordCreator;
|
||||
$creditreport = $request['creditreport'];
|
||||
$creditreport['client_id'] = $client_id;
|
||||
$creditreport['credit_report_company_name'] = $request['credit_report']['credit_report_company_name'];
|
||||
$creditreport['credit_report_company_type'] = $creditreport['company_type'];
|
||||
$creditreport['credit_report_company_password'] = $passcreator->customEncryptionDecryption($creditreport['credit_report_company_password'], 'encrypt');
|
||||
|
||||
if(!empty($creditreport)){
|
||||
$response = $this->Creditreportsetups->insertOrUpdateCreditReport($creditreport);
|
||||
}
|
||||
|
||||
}else if($request['action'] == "UPLOAD_DRIVING_LICENSE"){
|
||||
if(isset($request['creditreport']['photo_id']) && !empty($request['creditreport']['photo_id'])){
|
||||
$inputData['action'] = $request['action'];
|
||||
$inputData['creditreport']['client_id'] = $client_id;
|
||||
$inputData['creditreport']['state_photo_id'] = $request['creditreport']['photo_id'];
|
||||
$response = $this->Uploadmedias->uploadFromClientPanelPopup($inputData['creditreport']);
|
||||
$this->addClientImageHistory($client_id,4);
|
||||
$logData['action'] = $client_text.$request['action'];
|
||||
$logData['response'] = $response;
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$logData['client_id'] = $client_id;
|
||||
$this->appLog($logData);
|
||||
}
|
||||
}else if($request['action'] == "UPLOAD_UTILITY_BILL"){
|
||||
if(isset($request['creditreport']['proof_address']) && !empty($request['creditreport']['proof_address'])){
|
||||
$inputData['action'] = $request['action'];
|
||||
$inputData['creditreport']['client_id'] = $client_id;
|
||||
$inputData['creditreport']['mail_doc'] = $request['creditreport']['proof_address'];
|
||||
$response = $this->Uploadmedias->uploadFromClientPanelPopup($inputData['creditreport']);
|
||||
$this->addClientImageHistory($client_id,2);
|
||||
$logData['action'] = $client_text.$request['action'];
|
||||
$logData['response'] = $response;
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$logData['client_id'] = $client_id;
|
||||
$this->appLog($logData);
|
||||
}
|
||||
}else if($request['action'] == "UPLOAD_SSN_PHOTO"){
|
||||
if(isset($request['creditreport']['ssn_photo']) && !empty($request['creditreport']['ssn_photo'])){
|
||||
$inputData['action'] = $request['action'];
|
||||
$inputData['creditreport']['client_id'] = $client_id;
|
||||
$request['creditreport']['ssn'] = $request['creditreport']['ssn_photo'];
|
||||
$inputData['creditreport']['ssn'] = $request['creditreport']['ssn_photo'];
|
||||
//unset($request['creditreport']['ssn_photo']);
|
||||
$response = $this->Uploadmedias->uploadFromClientPanelPopup($inputData['creditreport']);
|
||||
$this->addClientImageHistory($client_id,3);
|
||||
$logData['action'] = $client_text.$request['action'];
|
||||
$logData['response'] = $response;
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$logData['client_id'] = $client_id;
|
||||
$this->appLog($logData);
|
||||
}
|
||||
}
|
||||
|
||||
$client_steps = $this->popupcondition();
|
||||
$final_response['message'] = false;
|
||||
$final_response['status'] = false;
|
||||
if($response){
|
||||
$final_response['status'] = true;
|
||||
if($client_steps['is_steps_completed']){
|
||||
$final_response['message'] = "You have completed your steps.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo json_encode($final_response);
|
||||
exit;
|
||||
}
|
||||
|
||||
$this->popupcondition();
|
||||
$common = new commonLogic();
|
||||
$member_id = $this->Auth->user('id');
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
$rq_query = $this->request->query();
|
||||
$result = $common->clientDashboardByClientIdAndMemberId($member_id,$client_id,$rq_query);
|
||||
extract($result);
|
||||
$this->loadModel('Crmusers');
|
||||
$employee_id = $this->Auth->user('employee_id');
|
||||
$employees = [];
|
||||
if($employee_id > 0){
|
||||
$employees = $this->Crmusers->getEmployeeByEmployeeId($employee_id);
|
||||
}
|
||||
$diff_month = 3;
|
||||
if(isset($rq_query['diff_month'])){
|
||||
$diff_month = $rq_query['diff_month'];
|
||||
}
|
||||
$linechartData = $this->HtmlCodeHistories->getCreditScoreByMonthDifference($diff_month,$member_id,$client_id);
|
||||
|
||||
//pr($_SESSION);exit;
|
||||
// $identity_iq_link = $this->Auth->user('identity_iq_link');
|
||||
// $smart_credit_link = $this->Auth->user('smart_credit_link');
|
||||
// $privacy_guard_link = "";
|
||||
// //echo $identity_iq_link;exit;
|
||||
// $this->set(compact('identity_iq_link','smart_credit_link','privacy_guard_link'));
|
||||
$this->getAffiliateInfoForClient($client_id);
|
||||
$this->set(compact('diff_month','linechartData','employees','export_type','all_remain','deleted_items','all_challenged_item','crs_data','pre_negative_item','pre_public_records','pre_inquiries','deleted_item','remain','challenged_item','percent','summary'));
|
||||
}
|
||||
private function getAffiliateInfoForClient($client_id){
|
||||
|
||||
$email = "";
|
||||
$name = "";
|
||||
$phone = "";
|
||||
$searchData = ['client_id'=>$client_id,'refference_type' => 2]; // for affiliate type = 2
|
||||
// get affiliate id by client id
|
||||
$affiliate_id=$this->loadModel('ClientAssignments')->getAffiliateByClientId($searchData);
|
||||
// get affiliate user info by affiliate id
|
||||
if(!empty($affiliate_id)) {
|
||||
$affiliate_infoData= $this->loadModel('Crmusers')->getCrmuserInfoById($affiliate_id['refference_id']);
|
||||
$email=$affiliate_infoData['email'];
|
||||
$name=$affiliate_infoData['first_name'].' '.$affiliate_infoData['last_name'];
|
||||
$phone=$affiliate_infoData['phone'];
|
||||
}
|
||||
$affiliate_info = [
|
||||
'name' => $name,
|
||||
'email'=> $email,
|
||||
'phone'=> $phone
|
||||
];
|
||||
$this->set(compact('affiliate_info'));
|
||||
}
|
||||
private function addClientImageHistory($client_id,$rtg_letter_image_id){
|
||||
$this->loadModel('ClientImagesHistory');
|
||||
$historyUpdate['client_id'] = $client_id;
|
||||
$historyUpdate['image_type_id'] = $rtg_letter_image_id;
|
||||
$historyUpdate['action_type'] = 1;
|
||||
$this->ClientImagesHistory->insertOrUpdate($historyUpdate);
|
||||
}
|
||||
|
||||
public function agreementdownload($assignment_id = ""){
|
||||
if($this->request->is('post') && $this->Auth->user()){
|
||||
if($assignment_id > 0){
|
||||
$common = new commonLogic();
|
||||
$common->downloadAgreementByAssignmentId($assignment_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function popupcondition() {
|
||||
$user = $this->Auth->user();
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
$this->loadModel('Uploadmedias');
|
||||
$this->loadModel('Creditreportsetups');
|
||||
$passcreator = new PasswordCreator;
|
||||
|
||||
//pr($_SESSION);exit;
|
||||
$popup_steps[0] = true;
|
||||
$popup_steps[1] = true;
|
||||
$popup_steps[2] = true;
|
||||
$popup_steps[3] = true;
|
||||
$popup_steps[4] = true;
|
||||
$popup_steps[5] = true;
|
||||
|
||||
$utility_image_url = '/images/client_modal/utility.png';
|
||||
$photo_id_image_url = '/images/client_modal/driver_lc.jpg';
|
||||
$ssn_image_url = '/images/client_modal/ssn.jpg';
|
||||
|
||||
$this->loadModel('Cmsusers');
|
||||
$this->loadModel('ClientPopups');
|
||||
$client_popup_info = $this->ClientPopups->getClientPopupByMemberId($user['id']);
|
||||
$member = $this->Cmsusers->getCmsuserById($user['id']);
|
||||
if(!empty($member['identity_iq_link'])){
|
||||
$credit_report_dropdown[1] = REPORT_SOURCE_TYPES[1];
|
||||
$identity_iq_link = $member['identity_iq_link'];
|
||||
}
|
||||
if(!empty($member['smart_credit_link'])){
|
||||
$credit_report_dropdown[3] = REPORT_SOURCE_TYPES[3];
|
||||
$smart_credit_link = $member['smart_credit_link'];
|
||||
}
|
||||
|
||||
$medias = $this->Uploadmedias->getUploadMediaByClientId($client_id);
|
||||
//pr($medias);exit;
|
||||
$creditreport = $this->Creditreportsetups->getCreditReportByClientId($client_id);
|
||||
|
||||
$image_type_id_list = [];
|
||||
if(!empty($medias)){
|
||||
foreach ($medias as $m){
|
||||
$image_type_id_list[] = $m->rtg_letter_image_id;
|
||||
$image_path = "contact_photo/".$m->image_path;
|
||||
if(file_exists($image_path)){
|
||||
if($m->rtg_letter_image_id == 2){
|
||||
$utility_image_url = "/".$image_path;
|
||||
}else if($m->rtg_letter_image_id == 4){
|
||||
$photo_id_image_url = "/".$image_path;
|
||||
}else if($m->rtg_letter_image_id == 3){
|
||||
$ssn_image_url = "/".$image_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(in_array(2, $image_type_id_list)){ //For utility bill 2
|
||||
$popup_steps[5] = false;
|
||||
|
||||
}
|
||||
|
||||
if(in_array(4, $image_type_id_list) || in_array(1, $image_type_id_list)){ // For photo id 4
|
||||
$popup_steps[3] = false;
|
||||
}
|
||||
|
||||
if(in_array(3, $image_type_id_list)){ //For ssn 3
|
||||
$popup_steps[4] = false;
|
||||
}
|
||||
|
||||
if(!empty($creditreport)){
|
||||
$popup_steps[2] = false;
|
||||
}
|
||||
|
||||
$is_steps_completed = true;
|
||||
|
||||
if($popup_steps[2] || $popup_steps[3] || $popup_steps[4] || $popup_steps[5]){
|
||||
$is_steps_completed = false;
|
||||
}
|
||||
|
||||
// pr($client_popup_info);exit;
|
||||
$this->set(
|
||||
compact(
|
||||
'client_popup_info',
|
||||
'photo_id_image_url',
|
||||
'ssn_image_url',
|
||||
'utility_image_url',
|
||||
'creditreport',
|
||||
'popup_steps',
|
||||
'credit_report_dropdown',
|
||||
'identity_iq_link',
|
||||
'smart_credit_link',
|
||||
'is_steps_completed'
|
||||
)
|
||||
);
|
||||
|
||||
// return [
|
||||
// 'is_steps_completed' => $is_steps_completed
|
||||
// ];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Clientdashboard id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null) {
|
||||
$clientdashboard = $this->Clientdashboard->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('clientdashboard', $clientdashboard);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add() {
|
||||
$clientdashboard = $this->Clientdashboard->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$clientdashboard = $this->Clientdashboard->patchEntity($clientdashboard, $this->request->getData());
|
||||
if ($this->Clientdashboard->save($clientdashboard)) {
|
||||
$this->Flash->success(__('The clientdashboard has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The clientdashboard could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientdashboard'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Clientdashboard 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) {
|
||||
$clientdashboard = $this->Clientdashboard->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$clientdashboard = $this->Clientdashboard->patchEntity($clientdashboard, $this->request->getData());
|
||||
if ($this->Clientdashboard->save($clientdashboard)) {
|
||||
$this->Flash->success(__('The clientdashboard has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The clientdashboard could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientdashboard'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Clientdashboard 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']);
|
||||
$clientdashboard = $this->Clientdashboard->get($id);
|
||||
if ($this->Clientdashboard->delete($clientdashboard)) {
|
||||
$this->Flash->success(__('The clientdashboard has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The clientdashboard could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
}
|
||||
282
src/Controller/ClientmessageController.php
Normal file
282
src/Controller/ClientmessageController.php
Normal file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Controller\AppController;
|
||||
|
||||
/**
|
||||
* Clientmessage Controller
|
||||
*
|
||||
*
|
||||
* @method \App\Model\Entity\Clientmessage[]|\Cake\Datasource\ResultSetInterface paginate($object = null, array $settings = [])
|
||||
*/
|
||||
class ClientmessageController extends AppController
|
||||
{
|
||||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
$this->setUserType();
|
||||
if($this->setClientControllerAccess()){
|
||||
$this->Auth->allow(['clientmessage']);
|
||||
}
|
||||
if($this->setAffiliateControllerAccess()){
|
||||
$this->Auth->allow(['affiliatemessage']);
|
||||
}
|
||||
// pr($_SESSION);exit;
|
||||
}
|
||||
|
||||
public function clientmessage(){
|
||||
|
||||
$isAffiliate = $this->setAffiliateControllerAccess();
|
||||
if($_SESSION['userType'] == CONTACT_USER_INDICATOR || $isAffiliate){
|
||||
$client_id = $this->Auth->user('client_id');
|
||||
$member_id = $this->Auth->user('id');
|
||||
$this->loadModel('ClientMessages');
|
||||
$this->loadModel('Contacts');
|
||||
$this->loadModel('Crmusers');
|
||||
$employee_id = 0;
|
||||
$userType = 1;
|
||||
if($isAffiliate){
|
||||
$client_id = $this->Auth->user('user_id');
|
||||
$userType = 2;
|
||||
$inputData['status'] = 2;
|
||||
}
|
||||
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
|
||||
$inputData['member_id'] = $member_id;
|
||||
$inputData['client_id'] = $client_id;
|
||||
$inputData['employee_id'] = 0;
|
||||
$inputData['message'] = $request['message'];
|
||||
$inputData['type'] = 2;
|
||||
|
||||
$inputData['user_type'] = $userType;
|
||||
// pr($inputData);exit;
|
||||
$result = $this->ClientMessages->insertClientMessage($inputData);
|
||||
$this->Contacts->upadateMessageCount($client_id,1);
|
||||
if(!empty($result)){
|
||||
|
||||
// Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
$everything = new \App\Utility\Everythings();
|
||||
$everythinData['action_on_id'] = $this->Auth->user('id');
|
||||
$everythinData['action_on_name'] = $this->Auth->user('member_name');
|
||||
$everythinData['event_name'] = "client_message_to_member";
|
||||
$everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
|
||||
$everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// Everything Insertion
|
||||
|
||||
|
||||
//add_log
|
||||
$logData['action'] = "MESSAGES_ADD";
|
||||
$logData['status'] = "success";
|
||||
$logData['input_data']["id"]=$result->id;
|
||||
$logData['input_data'] = $this->request->getData();
|
||||
$this->appLog($logData);
|
||||
|
||||
$this->Flash->success('Message sent successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
if($_SESSION['userType'] == CONTACT_USER_INDICATOR){
|
||||
$_SESSION['client_notification']['client_message'] = 0;
|
||||
}
|
||||
$updateCondition = ['client_id'=>$client_id,'user_type'=>$userType];
|
||||
if($userType == 2){
|
||||
$updateCondition['type'] = 1;
|
||||
}
|
||||
//$client_notification['client_message'] = 0;
|
||||
$this->ClientMessages->updateAll(['status'=>1],$updateCondition);
|
||||
if($userType == 2){
|
||||
$this->set('affliliate_message',null);
|
||||
}
|
||||
$messages = $this->ClientMessages->getMessageByMemberIdAndClientId($member_id,$client_id,$employee_id,$userType);
|
||||
|
||||
$first_message_row = "";
|
||||
$employee_id_list = [];
|
||||
if(!empty($messages)){
|
||||
foreach ($messages as $m){
|
||||
// $m->message = trim(strip_tags($m->message,'<a>'));
|
||||
if($m->type == 3 && $m->employee_id > 0){
|
||||
$first_message_row = $m;
|
||||
$employee_id_list[] = $m->employee_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
//dd($messages);
|
||||
// pr($userType);exit;
|
||||
|
||||
$parent_name = "";
|
||||
$member_info['profile_image'] = "/images/customer_service.png";
|
||||
//pr($this->Auth->user());exit;
|
||||
if(file_exists($this->Auth->user('image_path'))){
|
||||
$member_info['profile_image'] = "/".$this->Auth->user('image_path');
|
||||
}
|
||||
if(!empty($this->Auth->user('company_name'))){
|
||||
$parent_name = $this->Auth->user('company_name');
|
||||
}else if(!empty($this->Auth->user('name'))){
|
||||
$parent_name = $this->Auth->user('name');
|
||||
}
|
||||
$employee_name_list = [];
|
||||
// if(!empty($employee_id_list)){
|
||||
// $employee_id_list = array_unique($employee_id_list);
|
||||
// $parent_info = $this->Crmusers->find()->where(['id IN'=>$employee_id_list])->toArray();
|
||||
// // pr($parent_info);exit;
|
||||
// if(!empty($parent_info)){
|
||||
// foreach($parent_info as $p_info){
|
||||
// if($p_info->id > 0 ){
|
||||
// $employee_name_list[$p_info->id] = $p_info->first_name." ".$p_info->last_name;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
$this->set(compact('member_info','messages','client_notification','employee_name_list','isAffiliate'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function affiliatemessage(){
|
||||
$this->loadModel('TeamMessages');
|
||||
$member_id = $this->Auth->user('id');
|
||||
$user_type_info = $this->getCurrentUserType();
|
||||
|
||||
$inputData['sender_id'] = $this->Auth->user('user_id');
|
||||
$inputData['sender_type'] = 2;
|
||||
$inputData['receiver_id'] = $this->Auth->user('id');
|
||||
$inputData['receiver_type'] = 1;
|
||||
|
||||
if($this->request->is('post')){
|
||||
$request = $this->request->getData();
|
||||
$inputData['message'] = $request['message'];
|
||||
|
||||
|
||||
|
||||
$result = $this->TeamMessages->insertTeamMessage($inputData);
|
||||
|
||||
// if(!empty($result)){
|
||||
// // Everything Insertion (2 = crmuser, 1 = member, 3 = contact user, 4 = staff user)
|
||||
// $everything = new \App\Utility\Everythings();
|
||||
// $everythinData['action_on_id'] = $this->Auth->user('id');
|
||||
// $everythinData['action_on_name'] = $this->Auth->user('member_name');
|
||||
// $everythinData['event_name'] = "client_message_to_member";
|
||||
// $everythinData['action_on_usertype'] = CMS_USER_INDICATOR;
|
||||
// $everything->everythingWrapper($this->Auth->user(), $everythinData);
|
||||
// // Everything Insertion
|
||||
|
||||
|
||||
// //add_log
|
||||
// $logData['action'] = "MESSAGES_ADD";
|
||||
// $logData['status'] = "success";
|
||||
// $logData['input_data']["id"]=$result->id;
|
||||
// $logData['input_data'] = $this->request->getData();
|
||||
// $this->appLog($logData);
|
||||
|
||||
// $this->Flash->success('Message sent successfully.');
|
||||
// }
|
||||
}
|
||||
|
||||
$member_info['profile_image'] = "/images/customer_service.png";
|
||||
//pr($this->Auth->user());exit;
|
||||
if(file_exists($this->Auth->user('image_path'))){
|
||||
$member_info['profile_image'] = "/".$this->Auth->user('image_path');
|
||||
}
|
||||
/* pr($_SESSION);exit; */
|
||||
$this->TeamMessages->updatedMessages($inputData['sender_id'],$inputData['sender_type'],$inputData['receiver_id'],$inputData['receiver_type']);
|
||||
|
||||
$messages = $this->TeamMessages->getTeamMessages($inputData['sender_id'],$inputData['sender_type'],$inputData['receiver_id'],$inputData['receiver_type']);
|
||||
$affliliate_message = 0;
|
||||
$this->set(compact('messages','member_info','affliliate_message'));
|
||||
}
|
||||
/**
|
||||
* Index method
|
||||
*
|
||||
* @return \Cake\Http\Response|null
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$clientmessage = $this->paginate($this->Clientmessage);
|
||||
|
||||
$this->set(compact('clientmessage'));
|
||||
}
|
||||
|
||||
/**
|
||||
* View method
|
||||
*
|
||||
* @param string|null $id Clientmessage id.
|
||||
* @return \Cake\Http\Response|null
|
||||
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function view($id = null)
|
||||
{
|
||||
$clientmessage = $this->Clientmessage->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
|
||||
$this->set('clientmessage', $clientmessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$clientmessage = $this->Clientmessage->newEntity();
|
||||
if ($this->request->is('post')) {
|
||||
$clientmessage = $this->Clientmessage->patchEntity($clientmessage, $this->request->getData());
|
||||
if ($this->Clientmessage->save($clientmessage)) {
|
||||
$this->Flash->success(__('The clientmessage has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The clientmessage could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientmessage'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit method
|
||||
*
|
||||
* @param string|null $id Clientmessage 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)
|
||||
{
|
||||
$clientmessage = $this->Clientmessage->get($id, [
|
||||
'contain' => []
|
||||
]);
|
||||
if ($this->request->is(['patch', 'post', 'put'])) {
|
||||
$clientmessage = $this->Clientmessage->patchEntity($clientmessage, $this->request->getData());
|
||||
if ($this->Clientmessage->save($clientmessage)) {
|
||||
$this->Flash->success(__('The clientmessage has been saved.'));
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
$this->Flash->error(__('The clientmessage could not be saved. Please, try again.'));
|
||||
}
|
||||
$this->set(compact('clientmessage'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Clientmessage 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']);
|
||||
$clientmessage = $this->Clientmessage->get($id);
|
||||
if ($this->Clientmessage->delete($clientmessage)) {
|
||||
$this->Flash->success(__('The clientmessage has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The clientmessage could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
2642
src/Controller/CmsusersController.php
Normal file
2642
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 AppController {
|
||||
|
||||
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"];
|
||||
}
|
||||
|
||||
}
|
||||
212
src/Controller/Component/AwsComponent.php
Normal file
212
src/Controller/Component/AwsComponent.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
namespace App\Controller\Component;
|
||||
use Cake\Controller\Component;
|
||||
/**
|
||||
* Amazon S3 services Comonent.
|
||||
*/
|
||||
|
||||
require 'aws/aws-autoloader.php';
|
||||
use Aws\Common\Exception\RuntimeException;
|
||||
use Aws\Common\Exception\MultipartUploadException;
|
||||
use Aws\S3\Model\MultipartUpload\UploadBuilder;
|
||||
use Aws\S3\S3Client;
|
||||
use \DateTime;
|
||||
use Aws\CloudFront\CloudFrontClient;
|
||||
use Aws\ElasticTranscoder\ElasticTranscoderClient;
|
||||
|
||||
class AwsComponent extends Component {
|
||||
|
||||
/**
|
||||
* @var : name of bucket in which we are going to operate
|
||||
*/
|
||||
public $bucket = 'suruchi';
|
||||
|
||||
/**
|
||||
* @var : Amazon S3Client object
|
||||
*/
|
||||
private $s3 = null;
|
||||
|
||||
|
||||
public function __construct(){
|
||||
|
||||
$this->s3 = S3Client::factory(array(
|
||||
'key' => AWS_KEY,
|
||||
'secret' => AWS_SECRET,
|
||||
'region' => AWS_REGION,
|
||||
));
|
||||
|
||||
$this->cloudFront = CloudFrontClient::factory(array(
|
||||
'private_key' => AWS_PRIVATE_KEY,
|
||||
'key_pair_id' => AWS_KEY_PAIR_ID,
|
||||
|
||||
));
|
||||
|
||||
|
||||
$this->transcoder = ElasticTranscoderClient::factory(array(
|
||||
'key' => AWS_KEY,
|
||||
'secret' => AWS_SECRET,
|
||||
'region' => AWS_REGION,
|
||||
'default_caching_config' => '/tmp'
|
||||
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function createHLSJob($pipeline_id, $input_key, $output_key, $output_key_prefix, $hls_presets, $segment_duration){
|
||||
# Setup the job input using the provided input key.
|
||||
$input = array('Key' => $input_key);
|
||||
|
||||
#Setup the job outputs using the HLS presets.
|
||||
//$output_key = hash('sha256', utf8_encode($input_key));
|
||||
|
||||
# Specify the outputs based on the hls presets array spefified.
|
||||
$outputs = array();
|
||||
$outputs_preview = array();
|
||||
foreach ($hls_presets as $prefix => $preset_id) {
|
||||
if($preset_id == "1351620000001-100200"){ //for gif preview
|
||||
array_push($outputs_preview, array('Key' => "$output_key", 'PresetId' => $preset_id));
|
||||
|
||||
} else {
|
||||
array_push($outputs, array('Key' => "$output_key", 'PresetId' => $preset_id, 'SegmentDuration' => $segment_duration));
|
||||
}
|
||||
}
|
||||
|
||||
# Setup master playlist which can be used to play using adaptive bitrate.
|
||||
$playlist = array(
|
||||
'Name' => 'hls_' . $output_key,
|
||||
'Format' => 'HLSv3',
|
||||
'OutputKeys' => array_map(function($x) { return $x['Key']; }, $outputs)
|
||||
);
|
||||
|
||||
# Create the job.
|
||||
$create_job_request = array(
|
||||
'PipelineId' => $pipeline_id,
|
||||
'Input' => $input,
|
||||
'Outputs' => $outputs,
|
||||
'OutputKeyPrefix' => $output_key_prefix,
|
||||
//'Playlists' => array($playlist)
|
||||
);
|
||||
$create_job_result = $this->transcoder->createJob($create_job_request)->toArray();
|
||||
return $job = $create_job_result['Job'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getSingedURL($object){
|
||||
//var_dump($this->cloudFront);
|
||||
$dateTime = new DateTime("+10000 min");
|
||||
// $expiry = date('Y-m-d H:i:s', strtotime("+10 min"));
|
||||
return $this->cloudFront->getSignedUrl([
|
||||
'url'=>$this->cloudeFrontURL."/".$object,
|
||||
'expires'=>$dateTime->getTimestamp()
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function getSignedCookie($object){
|
||||
//var_dump($this->cloudFront);
|
||||
$dateTime = new DateTime("+10000 min");
|
||||
// $expiry = date('Y-m-d H:i:s', strtotime("+10 min"));
|
||||
return $this->cloudFront->getSignedCookie([
|
||||
'url'=>$this->cloudeFrontURL."/".$object,
|
||||
'expires'=>$dateTime->getTimestamp()
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @desc : to upload file on bucket with specified path
|
||||
* @param : keyname > path of file which need to be uploaded
|
||||
* @return : uploaded file object
|
||||
* @created on : 14.03.2014
|
||||
*/
|
||||
|
||||
public function upload($keyname=null, $filename=null, $file_permission=NULL){
|
||||
|
||||
try {
|
||||
$uploader = UploadBuilder::newInstance()
|
||||
->setClient($this->s3)
|
||||
->setSource($keyname)
|
||||
->setBucket($this->bucket)
|
||||
->setKey($filename)
|
||||
->setOption('ACL', $file_permission)
|
||||
->build();
|
||||
|
||||
|
||||
return $uploader->upload();
|
||||
|
||||
} catch (MultipartUploadException $e) {
|
||||
if(Configure::read('debug')) echo 'S3 Exception :'.$e->getMessage() ;
|
||||
$uploader->abort();
|
||||
} catch (Exception $e) {
|
||||
if(Configure::read('debug')) echo 'Exception :'.$e->getMessage() ;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @desc : to delete multiple objects from bucket
|
||||
* @param : array(
|
||||
array('Key' => $keyname1),
|
||||
array('Key' => $keyname2),
|
||||
array('Key' => $keyname3),
|
||||
)
|
||||
* @return : boolean
|
||||
* @created on : 14.03.2014
|
||||
*/
|
||||
public function delete($objects=array()){
|
||||
try{
|
||||
return $this->s3->deleteObjects(array(
|
||||
'Bucket' => $this->bucket,
|
||||
'Objects' => $objects
|
||||
));
|
||||
} catch (RuntimeException $e) {
|
||||
if(Configure::read('debug')) echo 'RuntimeException Exception :'.$e->getMessage() ;
|
||||
} catch (Exception $e) {
|
||||
if(Configure::read('debug')) echo 'Exception :'.$e->getMessage() ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @desc : to empty specified folder
|
||||
* @param : folder to which you want to empty
|
||||
* @return : deleted file count
|
||||
* @created on :14.03.2014
|
||||
*/
|
||||
public function emptyFolder($folder=null,$regexp='/\.[0-9a-z]+$/'){
|
||||
try{
|
||||
return $this->s3->deleteMatchingObjects($this->bucket, $folder, $regexp);
|
||||
|
||||
} catch (RuntimeException $e) {
|
||||
if(Configure::read('debug')) echo 'RuntimeException Exception :'.$e->getMessage() ;
|
||||
} catch (Exception $e) {
|
||||
if(Configure::read('debug')) echo 'Exception :'.$e->getMessage() ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if file already exist in bucket
|
||||
*/
|
||||
public function check_file_existence($bucket, $file)
|
||||
{
|
||||
try{
|
||||
return $this->s3->doesObjectExist($bucket, $file);
|
||||
|
||||
} catch (RuntimeException $e) {
|
||||
if(Configure::read('debug')) echo 'RuntimeException Exception :'.$e->getMessage() ;
|
||||
} catch (Exception $e) {
|
||||
if(Configure::read('debug')) echo 'Exception :'.$e->getMessage() ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
}
|
||||
120
src/Controller/Component/MpdfComponent.php
Normal file
120
src/Controller/Component/MpdfComponent.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* Component for working with mPDF class.
|
||||
* mPDF has to be in the vendors directory.
|
||||
*/
|
||||
|
||||
class MpdfComponent extends Component {
|
||||
/**
|
||||
* Instance of mPDF class
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $pdf;
|
||||
/**
|
||||
* Default values for mPDF constructor
|
||||
* @var array
|
||||
*/
|
||||
protected $_configuration = array(
|
||||
// mode: 'c' for core fonts only, 'utf8-s' for subset etc.
|
||||
'mode' => 'utf8-s',
|
||||
// page format: 'A0' - 'A10', if suffixed with '-L', force landscape
|
||||
'format' => 'A4',
|
||||
// default font size in points (pt)
|
||||
'font_size' => 0,
|
||||
// default font
|
||||
'font' => NULL,
|
||||
// page margins in mm
|
||||
'margin_left' => 15,
|
||||
'margin_right' => 15,
|
||||
'margin_top' => 16,
|
||||
'margin_bottom' => 16,
|
||||
'margin_header' => 9,
|
||||
'margin_footer' => 9
|
||||
);
|
||||
/**
|
||||
* Flag set to true if mPDF was initialized
|
||||
* @var bool
|
||||
*/
|
||||
protected $_init = false;
|
||||
/**
|
||||
* Name of the file on the output
|
||||
* @var string
|
||||
*/
|
||||
protected $_filename = NULL;
|
||||
/**
|
||||
* Destination - posible values are I, D, F, S
|
||||
* @var string
|
||||
*/
|
||||
protected $_output = 'I';
|
||||
|
||||
/**
|
||||
* Initialize
|
||||
* Add vendor and define mPDF class.
|
||||
*/
|
||||
public function init($configuration = array()) {
|
||||
// mPDF class has many notices - suppress them
|
||||
error_reporting(0);
|
||||
|
||||
// import mPDF
|
||||
App::import('Vendor', 'Mpdf.mpdf/mpdf');
|
||||
if (!class_exists('mPDF'))
|
||||
throw new CakeException('Vendor class mPDF not found!');
|
||||
|
||||
// override default values
|
||||
$c = array_merge($this->_configuration, $configuration);
|
||||
|
||||
// initialize
|
||||
$this->pdf = new mPDF($c['mode'], $c['format'], $c['font_size'], $c['font'], $c['margin_left'], $c['margin_right'], $c['margin_top'], $c['margin_bottom'], $c['margin_header'], $c['margin_footer']);
|
||||
$this->_init = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set filename of the output file
|
||||
*/
|
||||
public function setFilename($filename) {
|
||||
$this->_filename = (string)$filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set destination of the output
|
||||
*/
|
||||
public function setOutput($output) {
|
||||
if (in_array($output, array('I', 'D', 'F', 'S')))
|
||||
$this->_output = $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdown of the component
|
||||
* View is rendered but not yet sent to browser.
|
||||
*/
|
||||
public function shutdown(Controller $controller) {
|
||||
if ($this->_init) {
|
||||
$this->pdf->WriteHTML((string)$controller->response);
|
||||
$this->pdf->Output($this->_filename, $this->_output);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Passing method calls and variable setting to mPDF library.
|
||||
*/
|
||||
public function __set($name, $value) {
|
||||
$this->pdf->$name = $value;
|
||||
}
|
||||
|
||||
public function __get($name) {
|
||||
return $this->pdf->$name;
|
||||
}
|
||||
|
||||
public function __isset($name) {
|
||||
return isset($this->pdf->$name);
|
||||
}
|
||||
|
||||
public function __unset($name) {
|
||||
unset($this->pdf->$name);
|
||||
}
|
||||
|
||||
public function __call($name, $arguments) {
|
||||
call_user_func_array(array($this->pdf, $name), $arguments);
|
||||
}
|
||||
}
|
||||
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
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\AutoScaling;
|
||||
|
||||
use Aws\Common\Client\AbstractClient;
|
||||
use Aws\Common\Client\ClientBuilder;
|
||||
use Aws\Common\Enum\ClientOptions as Options;
|
||||
use Guzzle\Common\Collection;
|
||||
use Guzzle\Service\Resource\Model;
|
||||
use Guzzle\Service\Resource\ResourceIteratorInterface;
|
||||
|
||||
/**
|
||||
* Client to interact with Auto Scaling
|
||||
*
|
||||
* @method Model attachInstances(array $args = array()) {@command AutoScaling AttachInstances}
|
||||
* @method Model createAutoScalingGroup(array $args = array()) {@command AutoScaling CreateAutoScalingGroup}
|
||||
* @method Model createLaunchConfiguration(array $args = array()) {@command AutoScaling CreateLaunchConfiguration}
|
||||
* @method Model createOrUpdateTags(array $args = array()) {@command AutoScaling CreateOrUpdateTags}
|
||||
* @method Model deleteAutoScalingGroup(array $args = array()) {@command AutoScaling DeleteAutoScalingGroup}
|
||||
* @method Model deleteLaunchConfiguration(array $args = array()) {@command AutoScaling DeleteLaunchConfiguration}
|
||||
* @method Model deleteNotificationConfiguration(array $args = array()) {@command AutoScaling DeleteNotificationConfiguration}
|
||||
* @method Model deletePolicy(array $args = array()) {@command AutoScaling DeletePolicy}
|
||||
* @method Model deleteScheduledAction(array $args = array()) {@command AutoScaling DeleteScheduledAction}
|
||||
* @method Model deleteTags(array $args = array()) {@command AutoScaling DeleteTags}
|
||||
* @method Model describeAccountLimits(array $args = array()) {@command AutoScaling DescribeAccountLimits}
|
||||
* @method Model describeAdjustmentTypes(array $args = array()) {@command AutoScaling DescribeAdjustmentTypes}
|
||||
* @method Model describeAutoScalingGroups(array $args = array()) {@command AutoScaling DescribeAutoScalingGroups}
|
||||
* @method Model describeAutoScalingInstances(array $args = array()) {@command AutoScaling DescribeAutoScalingInstances}
|
||||
* @method Model describeAutoScalingNotificationTypes(array $args = array()) {@command AutoScaling DescribeAutoScalingNotificationTypes}
|
||||
* @method Model describeLaunchConfigurations(array $args = array()) {@command AutoScaling DescribeLaunchConfigurations}
|
||||
* @method Model describeMetricCollectionTypes(array $args = array()) {@command AutoScaling DescribeMetricCollectionTypes}
|
||||
* @method Model describeNotificationConfigurations(array $args = array()) {@command AutoScaling DescribeNotificationConfigurations}
|
||||
* @method Model describePolicies(array $args = array()) {@command AutoScaling DescribePolicies}
|
||||
* @method Model describeScalingActivities(array $args = array()) {@command AutoScaling DescribeScalingActivities}
|
||||
* @method Model describeScalingProcessTypes(array $args = array()) {@command AutoScaling DescribeScalingProcessTypes}
|
||||
* @method Model describeScheduledActions(array $args = array()) {@command AutoScaling DescribeScheduledActions}
|
||||
* @method Model describeTags(array $args = array()) {@command AutoScaling DescribeTags}
|
||||
* @method Model describeTerminationPolicyTypes(array $args = array()) {@command AutoScaling DescribeTerminationPolicyTypes}
|
||||
* @method Model disableMetricsCollection(array $args = array()) {@command AutoScaling DisableMetricsCollection}
|
||||
* @method Model enableMetricsCollection(array $args = array()) {@command AutoScaling EnableMetricsCollection}
|
||||
* @method Model executePolicy(array $args = array()) {@command AutoScaling ExecutePolicy}
|
||||
* @method Model putNotificationConfiguration(array $args = array()) {@command AutoScaling PutNotificationConfiguration}
|
||||
* @method Model putScalingPolicy(array $args = array()) {@command AutoScaling PutScalingPolicy}
|
||||
* @method Model putScheduledUpdateGroupAction(array $args = array()) {@command AutoScaling PutScheduledUpdateGroupAction}
|
||||
* @method Model resumeProcesses(array $args = array()) {@command AutoScaling ResumeProcesses}
|
||||
* @method Model setDesiredCapacity(array $args = array()) {@command AutoScaling SetDesiredCapacity}
|
||||
* @method Model setInstanceHealth(array $args = array()) {@command AutoScaling SetInstanceHealth}
|
||||
* @method Model suspendProcesses(array $args = array()) {@command AutoScaling SuspendProcesses}
|
||||
* @method Model terminateInstanceInAutoScalingGroup(array $args = array()) {@command AutoScaling TerminateInstanceInAutoScalingGroup}
|
||||
* @method Model updateAutoScalingGroup(array $args = array()) {@command AutoScaling UpdateAutoScalingGroup}
|
||||
* @method ResourceIteratorInterface getDescribeAutoScalingGroupsIterator(array $args = array()) The input array uses the parameters of the DescribeAutoScalingGroups operation
|
||||
* @method ResourceIteratorInterface getDescribeAutoScalingInstancesIterator(array $args = array()) The input array uses the parameters of the DescribeAutoScalingInstances operation
|
||||
* @method ResourceIteratorInterface getDescribeLaunchConfigurationsIterator(array $args = array()) The input array uses the parameters of the DescribeLaunchConfigurations operation
|
||||
* @method ResourceIteratorInterface getDescribeNotificationConfigurationsIterator(array $args = array()) The input array uses the parameters of the DescribeNotificationConfigurations operation
|
||||
* @method ResourceIteratorInterface getDescribePoliciesIterator(array $args = array()) The input array uses the parameters of the DescribePolicies operation
|
||||
* @method ResourceIteratorInterface getDescribeScalingActivitiesIterator(array $args = array()) The input array uses the parameters of the DescribeScalingActivities operation
|
||||
* @method ResourceIteratorInterface getDescribeScheduledActionsIterator(array $args = array()) The input array uses the parameters of the DescribeScheduledActions operation
|
||||
* @method ResourceIteratorInterface getDescribeTagsIterator(array $args = array()) The input array uses the parameters of the DescribeTags operation
|
||||
*
|
||||
* @link http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-autoscaling.html User guide
|
||||
* @link http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.AutoScaling.AutoScalingClient.html API docs
|
||||
*/
|
||||
class AutoScalingClient extends AbstractClient
|
||||
{
|
||||
const LATEST_API_VERSION = '2011-01-01';
|
||||
|
||||
/**
|
||||
* Factory method to create a new Auto Scaling client using an array of configuration options.
|
||||
*
|
||||
* @param array|Collection $config Client configuration data
|
||||
*
|
||||
* @return self
|
||||
* @link http://docs.aws.amazon.com/aws-sdk-php/guide/latest/configuration.html#client-configuration-options
|
||||
*/
|
||||
public static function factory($config = array())
|
||||
{
|
||||
return ClientBuilder::factory(__NAMESPACE__)
|
||||
->setConfig($config)
|
||||
->setConfigDefaults(array(
|
||||
Options::VERSION => self::LATEST_API_VERSION,
|
||||
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/autoscaling-%s.php'
|
||||
))
|
||||
->build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\AutoScaling\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable LifecycleState values
|
||||
*/
|
||||
class LifecycleState extends Enum
|
||||
{
|
||||
const PENDING = 'Pending';
|
||||
const QUARANTINED = 'Quarantined';
|
||||
const IN_SERVICE = 'InService';
|
||||
const TERMINATING = 'Terminating';
|
||||
const TERMINATED = 'Terminated';
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\AutoScaling\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable ScalingActivityStatusCode values
|
||||
*/
|
||||
class ScalingActivityStatusCode extends Enum
|
||||
{
|
||||
const WAITING_FOR_SPOT_INSTANCE_REQUEST_ID = 'WaitingForSpotInstanceRequestId';
|
||||
const WAITING_FOR_SPOT_INSTANCE_ID = 'WaitingForSpotInstanceId';
|
||||
const WAITING_FOR_INSTANCE_ID = 'WaitingForInstanceId';
|
||||
const PRE_IN_SERVICE = 'PreInService';
|
||||
const IN_PROGRESS = 'InProgress';
|
||||
const SUCCESSFUL = 'Successful';
|
||||
const FAILED = 'Failed';
|
||||
const CANCELLED = 'Cancelled';
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\AutoScaling\Exception;
|
||||
|
||||
/**
|
||||
* The named Auto Scaling group or launch configuration already exists.
|
||||
*/
|
||||
class AlreadyExistsException extends AutoScalingException {}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\AutoScaling\Exception;
|
||||
|
||||
use Aws\Common\Exception\ServiceResponseException;
|
||||
|
||||
/**
|
||||
* Default service exception class
|
||||
*/
|
||||
class AutoScalingException extends ServiceResponseException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\AutoScaling\Exception;
|
||||
|
||||
/**
|
||||
* The NextToken value is invalid.
|
||||
*/
|
||||
class InvalidNextTokenException extends AutoScalingException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\AutoScaling\Exception;
|
||||
|
||||
/**
|
||||
* The quota for capacity groups or launch configurations for this customer has already been reached.
|
||||
*/
|
||||
class LimitExceededException extends AutoScalingException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\AutoScaling\Exception;
|
||||
|
||||
/**
|
||||
* This is returned when you cannot delete a launch configuration or Auto Scaling group because it is being used.
|
||||
*/
|
||||
class ResourceInUseException extends AutoScalingException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\AutoScaling\Exception;
|
||||
|
||||
/**
|
||||
* You cannot delete an Auto Scaling group while there are scaling activities in progress for that group.
|
||||
*/
|
||||
class ScalingActivityInProgressException extends AutoScalingException {}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFormation;
|
||||
|
||||
use Aws\Common\Client\AbstractClient;
|
||||
use Aws\Common\Client\ClientBuilder;
|
||||
use Aws\Common\Enum\ClientOptions as Options;
|
||||
use Guzzle\Common\Collection;
|
||||
use Guzzle\Service\Resource\Model;
|
||||
use Guzzle\Service\Resource\ResourceIteratorInterface;
|
||||
|
||||
/**
|
||||
* Client to interact with AWS CloudFormation
|
||||
*
|
||||
* @method Model cancelUpdateStack(array $args = array()) {@command CloudFormation CancelUpdateStack}
|
||||
* @method Model createStack(array $args = array()) {@command CloudFormation CreateStack}
|
||||
* @method Model deleteStack(array $args = array()) {@command CloudFormation DeleteStack}
|
||||
* @method Model describeStackEvents(array $args = array()) {@command CloudFormation DescribeStackEvents}
|
||||
* @method Model describeStackResource(array $args = array()) {@command CloudFormation DescribeStackResource}
|
||||
* @method Model describeStackResources(array $args = array()) {@command CloudFormation DescribeStackResources}
|
||||
* @method Model describeStacks(array $args = array()) {@command CloudFormation DescribeStacks}
|
||||
* @method Model estimateTemplateCost(array $args = array()) {@command CloudFormation EstimateTemplateCost}
|
||||
* @method Model getStackPolicy(array $args = array()) {@command CloudFormation GetStackPolicy}
|
||||
* @method Model getTemplate(array $args = array()) {@command CloudFormation GetTemplate}
|
||||
* @method Model listStackResources(array $args = array()) {@command CloudFormation ListStackResources}
|
||||
* @method Model listStacks(array $args = array()) {@command CloudFormation ListStacks}
|
||||
* @method Model setStackPolicy(array $args = array()) {@command CloudFormation SetStackPolicy}
|
||||
* @method Model updateStack(array $args = array()) {@command CloudFormation UpdateStack}
|
||||
* @method Model validateTemplate(array $args = array()) {@command CloudFormation ValidateTemplate}
|
||||
* @method ResourceIteratorInterface getDescribeStackEventsIterator(array $args = array()) The input array uses the parameters of the DescribeStackEvents operation
|
||||
* @method ResourceIteratorInterface getDescribeStackResourcesIterator(array $args = array()) The input array uses the parameters of the DescribeStackResources operation
|
||||
* @method ResourceIteratorInterface getDescribeStacksIterator(array $args = array()) The input array uses the parameters of the DescribeStacks operation
|
||||
* @method ResourceIteratorInterface getListStackResourcesIterator(array $args = array()) The input array uses the parameters of the ListStackResources operation
|
||||
* @method ResourceIteratorInterface getListStacksIterator(array $args = array()) The input array uses the parameters of the ListStacks operation
|
||||
*
|
||||
* @link http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-cloudformation.html User guide
|
||||
* @link http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.CloudFormation.CloudFormationClient.html API docs
|
||||
*/
|
||||
class CloudFormationClient extends AbstractClient
|
||||
{
|
||||
const LATEST_API_VERSION = '2010-05-15';
|
||||
|
||||
/**
|
||||
* Factory method to create a new AWS CloudFormation client using an array of configuration options.
|
||||
*
|
||||
* @param array|Collection $config Client configuration data
|
||||
*
|
||||
* @return self
|
||||
* @link http://docs.aws.amazon.com/aws-sdk-php/guide/latest/configuration.html#client-configuration-options
|
||||
*/
|
||||
public static function factory($config = array())
|
||||
{
|
||||
return ClientBuilder::factory(__NAMESPACE__)
|
||||
->setConfig($config)
|
||||
->setConfigDefaults(array(
|
||||
Options::VERSION => self::LATEST_API_VERSION,
|
||||
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/cloudformation-%s.php'
|
||||
))
|
||||
->build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFormation\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable Capability values
|
||||
*/
|
||||
class Capability extends Enum
|
||||
{
|
||||
const CAPABILITY_IAM = 'CAPABILITY_IAM';
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFormation\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable OnFailure values
|
||||
*/
|
||||
class OnFailure extends Enum
|
||||
{
|
||||
const DO_NOTHING = 'DO_NOTHING';
|
||||
const ROLLBACK = 'ROLLBACK';
|
||||
const DELETE = 'DELETE';
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFormation\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable ResourceStatus values
|
||||
*/
|
||||
class ResourceStatus extends Enum
|
||||
{
|
||||
const CREATE_IN_PROGRESS = 'CREATE_IN_PROGRESS';
|
||||
const CREATE_FAILED = 'CREATE_FAILED';
|
||||
const CREATE_COMPLETE = 'CREATE_COMPLETE';
|
||||
const DELETE_IN_PROGRESS = 'DELETE_IN_PROGRESS';
|
||||
const DELETE_FAILED = 'DELETE_FAILED';
|
||||
const DELETE_COMPLETE = 'DELETE_COMPLETE';
|
||||
const UPDATE_IN_PROGRESS = 'UPDATE_IN_PROGRESS';
|
||||
const UPDATE_FAILED = 'UPDATE_FAILED';
|
||||
const UPDATE_COMPLETE = 'UPDATE_COMPLETE';
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFormation\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable StackStatus values
|
||||
*/
|
||||
class StackStatus extends Enum
|
||||
{
|
||||
const CREATE_IN_PROGRESS = 'CREATE_IN_PROGRESS';
|
||||
const CREATE_FAILED = 'CREATE_FAILED';
|
||||
const CREATE_COMPLETE = 'CREATE_COMPLETE';
|
||||
const ROLLBACK_IN_PROGRESS = 'ROLLBACK_IN_PROGRESS';
|
||||
const ROLLBACK_FAILED = 'ROLLBACK_FAILED';
|
||||
const ROLLBACK_COMPLETE = 'ROLLBACK_COMPLETE';
|
||||
const DELETE_IN_PROGRESS = 'DELETE_IN_PROGRESS';
|
||||
const DELETE_FAILED = 'DELETE_FAILED';
|
||||
const DELETE_COMPLETE = 'DELETE_COMPLETE';
|
||||
const UPDATE_IN_PROGRESS = 'UPDATE_IN_PROGRESS';
|
||||
const UPDATE_COMPLETE_CLEANUP_IN_PROGRESS = 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS';
|
||||
const UPDATE_COMPLETE = 'UPDATE_COMPLETE';
|
||||
const UPDATE_ROLLBACK_IN_PROGRESS = 'UPDATE_ROLLBACK_IN_PROGRESS';
|
||||
const UPDATE_ROLLBACK_FAILED = 'UPDATE_ROLLBACK_FAILED';
|
||||
const UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS = 'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS';
|
||||
const UPDATE_ROLLBACK_COMPLETE = 'UPDATE_ROLLBACK_COMPLETE';
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFormation\Exception;
|
||||
|
||||
/**
|
||||
* Resource with the name requested already exists.
|
||||
*/
|
||||
class AlreadyExistsException extends CloudFormationException {}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFormation\Exception;
|
||||
|
||||
use Aws\Common\Exception\ServiceResponseException;
|
||||
|
||||
/**
|
||||
* Default service exception class
|
||||
*/
|
||||
class CloudFormationException extends ServiceResponseException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFormation\Exception;
|
||||
|
||||
/**
|
||||
* The template contains resources with capabilities that were not specified in the Capabilities parameter.
|
||||
*/
|
||||
class InsufficientCapabilitiesException extends CloudFormationException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFormation\Exception;
|
||||
|
||||
/**
|
||||
* Quota for the resource has already been reached.
|
||||
*/
|
||||
class LimitExceededException extends CloudFormationException {}
|
||||
File diff suppressed because it is too large
Load Diff
229
src/Controller/Component/aws/Aws/CloudFront/CloudFrontClient.php
Normal file
229
src/Controller/Component/aws/Aws/CloudFront/CloudFrontClient.php
Normal file
@@ -0,0 +1,229 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront;
|
||||
|
||||
use Aws\Common\Client\AbstractClient;
|
||||
use Aws\Common\Client\ClientBuilder;
|
||||
use Aws\Common\Enum\ClientOptions as Options;
|
||||
use Aws\Common\Exception\InvalidArgumentException;
|
||||
use Aws\Common\Exception\Parser\DefaultXmlExceptionParser;
|
||||
use Aws\Common\Exception\RequiredExtensionNotLoadedException;
|
||||
use Guzzle\Common\Collection;
|
||||
use Guzzle\Http\Url;
|
||||
use Guzzle\Service\Resource\Model;
|
||||
use Guzzle\Service\Resource\ResourceIteratorInterface;
|
||||
|
||||
/**
|
||||
* Client to interact with Amazon CloudFront
|
||||
*
|
||||
* @method Model createCloudFrontOriginAccessIdentity(array $args = array()) {@command CloudFront CreateCloudFrontOriginAccessIdentity}
|
||||
* @method Model createDistribution(array $args = array()) {@command CloudFront CreateDistribution}
|
||||
* @method Model createInvalidation(array $args = array()) {@command CloudFront CreateInvalidation}
|
||||
* @method Model createStreamingDistribution(array $args = array()) {@command CloudFront CreateStreamingDistribution}
|
||||
* @method Model deleteCloudFrontOriginAccessIdentity(array $args = array()) {@command CloudFront DeleteCloudFrontOriginAccessIdentity}
|
||||
* @method Model deleteDistribution(array $args = array()) {@command CloudFront DeleteDistribution}
|
||||
* @method Model deleteStreamingDistribution(array $args = array()) {@command CloudFront DeleteStreamingDistribution}
|
||||
* @method Model getCloudFrontOriginAccessIdentity(array $args = array()) {@command CloudFront GetCloudFrontOriginAccessIdentity}
|
||||
* @method Model getCloudFrontOriginAccessIdentityConfig(array $args = array()) {@command CloudFront GetCloudFrontOriginAccessIdentityConfig}
|
||||
* @method Model getDistribution(array $args = array()) {@command CloudFront GetDistribution}
|
||||
* @method Model getDistributionConfig(array $args = array()) {@command CloudFront GetDistributionConfig}
|
||||
* @method Model getInvalidation(array $args = array()) {@command CloudFront GetInvalidation}
|
||||
* @method Model getStreamingDistribution(array $args = array()) {@command CloudFront GetStreamingDistribution}
|
||||
* @method Model getStreamingDistributionConfig(array $args = array()) {@command CloudFront GetStreamingDistributionConfig}
|
||||
* @method Model listCloudFrontOriginAccessIdentities(array $args = array()) {@command CloudFront ListCloudFrontOriginAccessIdentities}
|
||||
* @method Model listDistributions(array $args = array()) {@command CloudFront ListDistributions}
|
||||
* @method Model listInvalidations(array $args = array()) {@command CloudFront ListInvalidations}
|
||||
* @method Model listStreamingDistributions(array $args = array()) {@command CloudFront ListStreamingDistributions}
|
||||
* @method Model updateCloudFrontOriginAccessIdentity(array $args = array()) {@command CloudFront UpdateCloudFrontOriginAccessIdentity}
|
||||
* @method Model updateDistribution(array $args = array()) {@command CloudFront UpdateDistribution}
|
||||
* @method Model updateStreamingDistribution(array $args = array()) {@command CloudFront UpdateStreamingDistribution}
|
||||
* @method waitUntilStreamingDistributionDeployed(array $input) The input array uses the parameters of the GetStreamingDistribution operation and waiter specific settings
|
||||
* @method waitUntilDistributionDeployed(array $input) The input array uses the parameters of the GetDistribution operation and waiter specific settings
|
||||
* @method waitUntilInvalidationCompleted(array $input) The input array uses the parameters of the GetInvalidation operation and waiter specific settings
|
||||
* @method ResourceIteratorInterface getListCloudFrontOriginAccessIdentitiesIterator(array $args = array()) The input array uses the parameters of the ListCloudFrontOriginAccessIdentities operation
|
||||
* @method ResourceIteratorInterface getListDistributionsIterator(array $args = array()) The input array uses the parameters of the ListDistributions operation
|
||||
* @method ResourceIteratorInterface getListInvalidationsIterator(array $args = array()) The input array uses the parameters of the ListInvalidations operation
|
||||
* @method ResourceIteratorInterface getListStreamingDistributionsIterator(array $args = array()) The input array uses the parameters of the ListStreamingDistributions operation
|
||||
*
|
||||
* @link http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-cloudfront.html User guide
|
||||
* @link http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.CloudFront.CloudFrontClient.html API docs
|
||||
*/
|
||||
class CloudFrontClient extends AbstractClient
|
||||
{
|
||||
const LATEST_API_VERSION = '2013-11-22';
|
||||
|
||||
/**
|
||||
* Factory method to create a new Amazon CloudFront client using an array of configuration options.
|
||||
*
|
||||
* CloudFront specific options (in addition to the default client configuration options):
|
||||
* - key_pair_id: The ID of the key pair used to sign CloudFront URLs for private distributions.
|
||||
* - private_key: The filepath ot the private key used to sign CloudFront URLs for private distributions.
|
||||
*
|
||||
* @param array|Collection $config Client configuration data
|
||||
*
|
||||
* @return self
|
||||
* @link http://docs.aws.amazon.com/aws-sdk-php/guide/latest/configuration.html#client-configuration-options
|
||||
*/
|
||||
public static function factory($config = array())
|
||||
{
|
||||
// Decide which signature to use
|
||||
if (isset($config[Options::VERSION]) && $config[Options::VERSION] < self::LATEST_API_VERSION) {
|
||||
$config[Options::SIGNATURE] = new CloudFrontSignature();
|
||||
}
|
||||
|
||||
// Instantiate the CloudFront client
|
||||
return ClientBuilder::factory(__NAMESPACE__)
|
||||
->setConfig($config)
|
||||
->setConfigDefaults(array(
|
||||
Options::VERSION => self::LATEST_API_VERSION,
|
||||
Options::SERVICE_DESCRIPTION => __DIR__ . '/Resources/cloudfront-%s.php',
|
||||
))
|
||||
->setExceptionParser(new DefaultXmlExceptionParser())
|
||||
->build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a signed URL. Keep in mind that URLs meant for use in media/flash players may have different requirements
|
||||
* for URL formats (e.g. some require that the extension be removed, some require the file name to be prefixed -
|
||||
* mp4:<path>, some require you to add "/cfx/st" into your URL). See
|
||||
* http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WorkingWithStreamingDistributions.html for
|
||||
* additional details and help.
|
||||
*
|
||||
* This method accepts an array of configuration options:
|
||||
* - url: (string) URL of the resource being signed (can include query string and wildcards). For example:
|
||||
* rtmp://s5c39gqb8ow64r.cloudfront.net/videos/mp3_name.mp3
|
||||
* http://d111111abcdef8.cloudfront.net/images/horizon.jpg?size=large&license=yes
|
||||
* - policy: (string) JSON policy. Use this option when creating a signed URL for a custom policy.
|
||||
* - expires: (int) UTC Unix timestamp used when signing with a canned policy. Not required when passing a
|
||||
* custom 'policy' option.
|
||||
* - key_pair_id: (string) The ID of the key pair used to sign CloudFront URLs for private distributions.
|
||||
* - private_key: (string) The filepath ot the private key used to sign CloudFront URLs for private distributions.
|
||||
*
|
||||
* @param array $options Array of configuration options used when signing
|
||||
*
|
||||
* @return string The file URL with authentication parameters
|
||||
* @throws InvalidArgumentException if key_pair_id and private_key have not been configured on the client
|
||||
* @throws RequiredExtensionNotLoadedException if the openssl extension is not installed
|
||||
* @link http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/WorkingWithStreamingDistributions.html
|
||||
*/
|
||||
public function getSignedUrl(array $options)
|
||||
{
|
||||
if (!extension_loaded('openssl')) {
|
||||
//@codeCoverageIgnoreStart
|
||||
throw new RequiredExtensionNotLoadedException('The openssl extension is required to sign CloudFront urls.');
|
||||
//@codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// Initialize the configuration data and ensure that the url was specified
|
||||
$options = Collection::fromConfig($options, array_filter(array(
|
||||
'key_pair_id' => $this->getConfig('key_pair_id'),
|
||||
'private_key' => $this->getConfig('private_key'),
|
||||
)), array('url', 'key_pair_id', 'private_key'));
|
||||
|
||||
// Determine the scheme of the url
|
||||
$urlSections = explode('://', $options['url']);
|
||||
if (count($urlSections) < 2) {
|
||||
throw new InvalidArgumentException('Invalid URL: ' . $options['url']);
|
||||
}
|
||||
|
||||
// Get the real scheme by removing wildcards from the scheme
|
||||
$scheme = str_replace('*', '', $urlSections[0]);
|
||||
$policy = $options['policy'] ?: $this->createCannedPolicy($scheme, $options['url'], $options['expires']);
|
||||
// Strip whitespace from the policy
|
||||
$policy = str_replace(' ', '', $policy);
|
||||
|
||||
$url = Url::factory($scheme . '://' . $urlSections[1]);
|
||||
if ($options['policy']) {
|
||||
// Custom policies require that the encoded policy be specified in the URL
|
||||
$url->getQuery()->set('Policy', strtr(base64_encode($policy), '+=/', '-_~'));
|
||||
} else {
|
||||
// Canned policies require that the Expires parameter be set in the URL
|
||||
$url->getQuery()->set('Expires', $options['expires']);
|
||||
}
|
||||
|
||||
// Sign the policy using the CloudFront private key
|
||||
$signedPolicy = $this->rsaSha1Sign($policy, $options['private_key']);
|
||||
// Remove whitespace, base64 encode the policy, and replace special characters
|
||||
$signedPolicy = strtr(base64_encode($signedPolicy), '+=/', '-_~');
|
||||
|
||||
$url->getQuery()
|
||||
->set('Signature', $signedPolicy)
|
||||
->set('Key-Pair-Id', $options['key_pair_id']);
|
||||
|
||||
if ($scheme != 'rtmp') {
|
||||
// HTTP and HTTPS signed URLs include the full URL
|
||||
return (string) $url;
|
||||
} else {
|
||||
// Use a relative URL when creating Flash player URLs
|
||||
$url->getQuery()->useUrlEncoding(false);
|
||||
$url->setScheme(null)->setHost(null);
|
||||
return substr($url, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign a policy string using OpenSSL RSA SHA1
|
||||
*
|
||||
* @param string $policy Policy to sign
|
||||
* @param string $privateKeyFilename File containing the OpenSSL private key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function rsaSha1Sign($policy, $privateKeyFilename)
|
||||
{
|
||||
$signature = '';
|
||||
openssl_sign($policy, $signature, file_get_contents($privateKeyFilename));
|
||||
|
||||
return $signature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a canned policy for a particular URL and expiration
|
||||
*
|
||||
* @param string $scheme Parsed scheme without wildcards
|
||||
* @param string $url URL that is being signed
|
||||
* @param int $expires Time in which the signature expires
|
||||
*
|
||||
* @return string
|
||||
* @throws InvalidArgumentException if the expiration is not set
|
||||
*/
|
||||
protected function createCannedPolicy($scheme, $url, $expires)
|
||||
{
|
||||
if (!$expires) {
|
||||
throw new InvalidArgumentException('An expires option is required when using a canned policy');
|
||||
}
|
||||
|
||||
// Generate a canned policy
|
||||
if ($scheme == 'http' || $scheme == 'https') {
|
||||
$resource = $url;
|
||||
} elseif ($scheme == 'rtmp') {
|
||||
$parts = parse_url($url);
|
||||
$pathParts = pathinfo($parts['path']);
|
||||
// Add path leading to file, strip file extension, and add a query string if present
|
||||
$resource = ltrim($pathParts['dirname'] . '/' . $pathParts['basename'], '/')
|
||||
. (isset($parts['query']) ? "?{$parts['query']}" : '');
|
||||
} else {
|
||||
throw new InvalidArgumentException("Invalid URI scheme: {$scheme}. Must be one of http or rtmp.");
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'{"Statement":[{"Resource":"%s","Condition":{"DateLessThan":{"AWS:EpochTime":%d}}}]}',
|
||||
$resource,
|
||||
$expires
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront;
|
||||
|
||||
use Aws\Common\Credentials\CredentialsInterface;
|
||||
use Aws\Common\Enum\DateFormat;
|
||||
use Aws\Common\Signature\SignatureInterface;
|
||||
use Guzzle\Http\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* Amazon CloudFront signature implementation
|
||||
* @link http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RESTAuthentication.html
|
||||
*/
|
||||
class CloudFrontSignature implements SignatureInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function signRequest(RequestInterface $request, CredentialsInterface $credentials)
|
||||
{
|
||||
// Add a date header if one is not set
|
||||
if (!$request->hasHeader('date') && !$request->hasHeader('x-amz-date')) {
|
||||
$request->setHeader('Date', gmdate(DateFormat::RFC2822));
|
||||
}
|
||||
|
||||
$stringToSign = (string) $request->getHeader('Date') ?: (string) $request->getHeader('x-amz-date');
|
||||
$request->getParams()->set('aws.string_to_sign', $stringToSign);
|
||||
|
||||
$request->setHeader(
|
||||
'Authorization',
|
||||
'AWS ' . $credentials->getAccessKeyId() . ':' . $this->signString($stringToSign, $credentials)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign a signature string by applying SHA-1 HMAC hashing.
|
||||
*
|
||||
* @param string $string The signature string to hash.
|
||||
* @param CredentialsInterface $credentials Signing credentials.
|
||||
*
|
||||
* @return string The hashed signature string.
|
||||
*/
|
||||
public function signString($string, CredentialsInterface $credentials)
|
||||
{
|
||||
return base64_encode(hash_hmac('sha1', $string, $credentials->getSecretKey(), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable GeoRestrictionType values
|
||||
*/
|
||||
class GeoRestrictionType extends Enum
|
||||
{
|
||||
const BLACKLIST = 'blacklist';
|
||||
const WHITELIST = 'whitelist';
|
||||
const NONE = 'none';
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable ItemSelection values
|
||||
*/
|
||||
class ItemSelection extends Enum
|
||||
{
|
||||
const NONE = 'none';
|
||||
const WHITELIST = 'whitelist';
|
||||
const ALL = 'all';
|
||||
}
|
||||
33
src/Controller/Component/aws/Aws/CloudFront/Enum/Method.php
Normal file
33
src/Controller/Component/aws/Aws/CloudFront/Enum/Method.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable Method values
|
||||
*/
|
||||
class Method extends Enum
|
||||
{
|
||||
const GET = 'GET';
|
||||
const HEAD = 'HEAD';
|
||||
const POST = 'POST';
|
||||
const PUT = 'PUT';
|
||||
const PATCH = 'PATCH';
|
||||
const OPTIONS = 'OPTIONS';
|
||||
const DELETE = 'DELETE';
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable OriginProtocolPolicy values
|
||||
*/
|
||||
class OriginProtocolPolicy extends Enum
|
||||
{
|
||||
const HTTP_ONLY = 'http-only';
|
||||
const MATCH_VIEWER = 'match-viewer';
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable PriceClass values
|
||||
*/
|
||||
class PriceClass extends Enum
|
||||
{
|
||||
const PRICE_CLASS_100 = 'PriceClass_100';
|
||||
const PRICE_CLASS_200 = 'PriceClass_200';
|
||||
const PRICE_CLASS_ALL = 'PriceClass_All';
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Enum;
|
||||
|
||||
use Aws\Common\Enum;
|
||||
|
||||
/**
|
||||
* Contains enumerable ViewerProtocolPolicy values
|
||||
*/
|
||||
class ViewerProtocolPolicy extends Enum
|
||||
{
|
||||
const ALLOW_ALL = 'allow-all';
|
||||
const HTTPS_ONLY = 'https-only';
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Access denied.
|
||||
*/
|
||||
class AccessDeniedException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a BatchTooLargeException error is encountered
|
||||
*/
|
||||
class BatchTooLargeException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a CNAMEAlreadyExistsException error is encountered
|
||||
*/
|
||||
class CNAMEAlreadyExistsException extends CloudFrontException {}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
use Aws\Common\Exception\ServiceResponseException;
|
||||
|
||||
/**
|
||||
* Default service exception class
|
||||
*/
|
||||
class CloudFrontException extends ServiceResponseException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* If the CallerReference is a value you already sent in a previous request to create an identity but the content of the CloudFrontOriginAccessIdentityConfig is different from the original request, CloudFront returns a CloudFrontOriginAccessIdentityAlreadyExists error.
|
||||
*/
|
||||
class CloudFrontOriginAccessIdentityAlreadyExistsException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a CloudFrontOriginAccessIdentityInUseException error is encountered
|
||||
*/
|
||||
class CloudFrontOriginAccessIdentityInUseException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The caller reference you attempted to create the distribution with is associated with another distribution.
|
||||
*/
|
||||
class DistributionAlreadyExistsException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a DistributionNotDisabledException error is encountered
|
||||
*/
|
||||
class DistributionNotDisabledException extends CloudFrontException {}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
use Aws\Common\Exception\ServiceResponseException;
|
||||
|
||||
/**
|
||||
* Default service exception class
|
||||
*/
|
||||
class Exception extends ServiceResponseException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Origin and CallerReference cannot be updated.
|
||||
*/
|
||||
class IllegalUpdateException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The value of Quantity and the size of Items do not match.
|
||||
*/
|
||||
class InconsistentQuantitiesException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The argument is invalid.
|
||||
*/
|
||||
class InvalidArgumentException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The default root object file name is too big or contains an invalid character.
|
||||
*/
|
||||
class InvalidDefaultRootObjectException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a InvalidErrorCodeException error is encountered
|
||||
*/
|
||||
class InvalidErrorCodeException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Your request contains forward cookies option which doesn't match with the expectation for the whitelisted list of cookie names. Either list of cookie names has been specified when not allowed or list of cookie names is missing when expected.
|
||||
*/
|
||||
class InvalidForwardCookiesException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a InvalidGeoRestrictionParameterException error is encountered
|
||||
*/
|
||||
class InvalidGeoRestrictionParameterException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The If-Match version is missing or not valid for the distribution.
|
||||
*/
|
||||
class InvalidIfMatchVersionException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a InvalidLocationCodeException error is encountered
|
||||
*/
|
||||
class InvalidLocationCodeException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The origin access identity is not valid or doesn't exist.
|
||||
*/
|
||||
class InvalidOriginAccessIdentityException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The Amazon S3 origin server specified does not refer to a valid Amazon S3 bucket.
|
||||
*/
|
||||
class InvalidOriginException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The relative path is too big, is not URL-encoded, or does not begin with a slash (/).
|
||||
*/
|
||||
class InvalidRelativePathException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* This operation requires the HTTPS protocol. Ensure that you specify the HTTPS protocol in your request, or omit the RequiredProtocols element from your distribution configuration.
|
||||
*/
|
||||
class InvalidRequiredProtocolException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a InvalidResponseCodeException error is encountered
|
||||
*/
|
||||
class InvalidResponseCodeException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a InvalidViewerCertificateException error is encountered
|
||||
*/
|
||||
class InvalidViewerCertificateException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* This operation requires a body. Ensure that the body is present and the Content-Type header is set.
|
||||
*/
|
||||
class MissingBodyException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The specified origin access identity does not exist.
|
||||
*/
|
||||
class NoSuchCloudFrontOriginAccessIdentityException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The specified distribution does not exist.
|
||||
*/
|
||||
class NoSuchDistributionException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The specified invalidation does not exist.
|
||||
*/
|
||||
class NoSuchInvalidationException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* No origin exists with the specified Origin Id.
|
||||
*/
|
||||
class NoSuchOriginException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The specified streaming distribution does not exist.
|
||||
*/
|
||||
class NoSuchStreamingDistributionException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* The precondition given in one or more of the request-header fields evaluated to false.
|
||||
*/
|
||||
class PreconditionFailedException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a StreamingDistributionAlreadyExistsException error is encountered
|
||||
*/
|
||||
class StreamingDistributionAlreadyExistsException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Exception that occurs when a StreamingDistributionNotDisabledException error is encountered
|
||||
*/
|
||||
class StreamingDistributionNotDisabledException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* You cannot create anymore cache behaviors for the distribution.
|
||||
*/
|
||||
class TooManyCacheBehaviorsException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* You cannot create anymore custom ssl certificates.
|
||||
*/
|
||||
class TooManyCertificatesException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Processing your request would cause you to exceed the maximum number of origin access identities allowed.
|
||||
*/
|
||||
class TooManyCloudFrontOriginAccessIdentitiesException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Your request contains more cookie names in the whitelist than are allowed per cache behavior.
|
||||
*/
|
||||
class TooManyCookieNamesInWhiteListException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Your request contains more CNAMEs than are allowed per distribution.
|
||||
*/
|
||||
class TooManyDistributionCNAMEsException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* Processing your request would cause you to exceed the maximum number of distributions allowed.
|
||||
*/
|
||||
class TooManyDistributionsException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* You have exceeded the maximum number of allowable InProgress invalidation batch requests, or invalidation objects.
|
||||
*/
|
||||
class TooManyInvalidationsInProgressException extends CloudFrontException {}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
* A copy of the License is located at
|
||||
*
|
||||
* http://aws.amazon.com/apache2.0
|
||||
*
|
||||
* or in the "license" file accompanying this file. This file is distributed
|
||||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
* express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Aws\CloudFront\Exception;
|
||||
|
||||
/**
|
||||
* You cannot create anymore origins for the distribution.
|
||||
*/
|
||||
class TooManyOriginsException extends CloudFrontException {}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user