v26.6.0 updates
This commit is contained in:
@@ -1,25 +1,4 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of Ice Framework.
|
||||
|
||||
Ice Framework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Ice Framework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Ice Framework. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
namespace Classes;
|
||||
|
||||
abstract class AbstractInitialize
|
||||
|
||||
@@ -1,27 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
This file is part of Ice Framework.
|
||||
|
||||
Ice Framework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Ice Framework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Ice Framework. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
|
||||
/**
|
||||
* BaseService class serves as the core logic for managing the application and for handling most
|
||||
* of the tasks related to retriving and saving data. This can be referred within any module using
|
||||
@@ -74,6 +52,8 @@ class BaseService
|
||||
public $modelClassMap = array();
|
||||
public $currentProfileId = false;
|
||||
|
||||
protected $pro = null;
|
||||
|
||||
private static $me = null;
|
||||
|
||||
private function __construct()
|
||||
@@ -1098,6 +1078,42 @@ class BaseService
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function cleanUpIgnoreKeys($obj)
|
||||
{
|
||||
unset($obj->keysToIgnore);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function cleanUpApprovalModelParameters($obj)
|
||||
{
|
||||
unset($obj->notificationModuleName);
|
||||
unset($obj->notificationUnitName);
|
||||
unset($obj->notificationUnitPrefix);
|
||||
unset($obj->notificationUnitAdminUrl);
|
||||
unset($obj->preApproveSettingName);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function cleanUpAll($obj)
|
||||
{
|
||||
$obj = $this->cleanUpAdoDB($obj);
|
||||
$obj = $this->cleanUpIgnoreKeys($obj);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function cleanUpUser($obj)
|
||||
{
|
||||
$obj = $this->cleanUpAdoDB($obj);
|
||||
unset($obj->password);
|
||||
unset($obj->login_hash);
|
||||
unset($obj->googleUserData);
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function setDB($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
@@ -1529,6 +1545,26 @@ class BaseService
|
||||
return call_user_func_array(array(new $class(), $ch->method), $parameters);
|
||||
}
|
||||
|
||||
public function initializePro()
|
||||
{
|
||||
$this->pro = null;
|
||||
if (class_exists('\\Classes\\ProVersion')) {
|
||||
$pro = new ProVersion();
|
||||
if (method_exists($pro, 'isModuleEnabled')) {
|
||||
$this->pro = $pro;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function isModuleEnabled($type, $name)
|
||||
{
|
||||
if ($this->pro === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->pro->isModuleEnabled($type, $name);
|
||||
}
|
||||
|
||||
public function cleanNonUTFChar($obj)
|
||||
{
|
||||
$regex = <<<'END'
|
||||
|
||||
@@ -1,25 +1,4 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of Ice Framework.
|
||||
|
||||
Ice Framework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Ice Framework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Ice Framework. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
namespace Classes;
|
||||
|
||||
use Model\File;
|
||||
|
||||
@@ -228,7 +228,7 @@ class MigrationManager
|
||||
if (count($migrationList) > 0 && (empty($migration->id) || $migrationList[0].".php" != $migration->file)) {
|
||||
LogManager::getInstance()->info("ensureMigrations - execute migrations");
|
||||
$this->queueMigrations();
|
||||
$this->runPendingMigrations();
|
||||
}
|
||||
$this->runPendingMigrations();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace Classes;
|
||||
|
||||
use Classes\Data\DataReader;
|
||||
use Classes\Data\Query\DataQuery;
|
||||
use Classes\Upload\Uploader;
|
||||
use Employees\Common\Model\Employee;
|
||||
use Users\Common\Model\User;
|
||||
use Utils\SessionUtils;
|
||||
@@ -327,4 +328,26 @@ class RestEndPoint
|
||||
$inputJSON = file_get_contents('php://input');
|
||||
return json_decode($inputJSON, true);
|
||||
}
|
||||
|
||||
protected function getFile()
|
||||
{
|
||||
return $_FILES;
|
||||
}
|
||||
|
||||
public function uploadFile(User $user)
|
||||
{
|
||||
$fileData = $this->getFile();
|
||||
$postData = [
|
||||
'file_name' => '_NEW_',
|
||||
'user' => $user->employee,
|
||||
'file_group' => static::ELEMENT_NAME
|
||||
];
|
||||
|
||||
$fileResponse = Uploader::upload($postData, $fileData);
|
||||
if ($fileResponse->getStatus() === IceResponse::SUCCESS) {
|
||||
return new IceResponse(IceResponse::SUCCESS, ['data' => $fileResponse->getData()], 201);
|
||||
}
|
||||
|
||||
return $fileResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,4 @@
|
||||
<?php
|
||||
/*
|
||||
This file is part of Ice Framework.
|
||||
|
||||
Ice Framework is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Ice Framework is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Ice Framework. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------
|
||||
|
||||
Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd]
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
namespace Classes;
|
||||
|
||||
abstract class SubActionManager
|
||||
@@ -56,16 +35,19 @@ abstract class SubActionManager
|
||||
$this->emailTemplates = $emailTemplates;
|
||||
}
|
||||
|
||||
public function getEmailTemplate($name)
|
||||
public function getEmailTemplate($name, $modulePath = null)
|
||||
{
|
||||
if ($modulePath == null) {
|
||||
$modulePath = MODULE_PATH;
|
||||
}
|
||||
//Read module email templates
|
||||
if ($this->emailTemplates == null) {
|
||||
$this->emailTemplates = array();
|
||||
if (is_dir(MODULE_PATH.'/emailTemplates/')) {
|
||||
$ams = scandir(MODULE_PATH.'/emailTemplates/');
|
||||
if (is_dir($modulePath.'/emailTemplates/')) {
|
||||
$ams = scandir($modulePath.'/emailTemplates/');
|
||||
foreach ($ams as $am) {
|
||||
if (!is_dir(MODULE_PATH.'/emailTemplates/'.$am) && $am != '.' && $am != '..') {
|
||||
$this->emailTemplates[$am] = file_get_contents(MODULE_PATH.'/emailTemplates/'.$am);
|
||||
if (!is_dir($modulePath.'/emailTemplates/'.$am) && $am != '.' && $am != '..') {
|
||||
$this->emailTemplates[$am] = file_get_contents($modulePath.'/emailTemplates/'.$am);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,37 +87,43 @@ class UIManager
|
||||
$this->currentProfileBlock = array(
|
||||
"profileImage"=>$profileCurrent->image,
|
||||
"firstName"=>$profileCurrent->first_name,
|
||||
"lastName"=>$profileCurrent->last_name
|
||||
"lastName"=>$profileCurrent->last_name,
|
||||
"profile_url"=>CLIENT_BASE_URL.'?g=admin&n=employees&m=admin_Employees',
|
||||
);
|
||||
|
||||
$this->switchedProfileBlock = array(
|
||||
"profileImage"=>$profileSwitched->image,
|
||||
"firstName"=>$profileSwitched->first_name,
|
||||
"lastName"=>$profileSwitched->last_name
|
||||
"lastName"=>$profileSwitched->last_name,
|
||||
"profile_url"=>CLIENT_BASE_URL.'?g=modules&n=employees&m=module_Personal_Information',
|
||||
);
|
||||
} elseif (!empty($profileCurrent)) {
|
||||
$this->currentProfileBlock = array(
|
||||
"profileImage"=>$profileCurrent->image,
|
||||
"firstName"=>$profileCurrent->first_name,
|
||||
"lastName"=>$profileCurrent->last_name
|
||||
"lastName"=>$profileCurrent->last_name,
|
||||
"profile_url"=>CLIENT_BASE_URL.'?g=modules&n=employees&m=module_Personal_Information',
|
||||
);
|
||||
} elseif (!empty($profileSwitched)) {
|
||||
$this->currentProfileBlock = array(
|
||||
"profileImage"=>BASE_URL."images/user_male.png",
|
||||
"firstName"=>$this->user->username,
|
||||
"lastName"=>""
|
||||
"lastName"=>"",
|
||||
"profile_url"=>CLIENT_BASE_URL.'?g=admin&n=employees&m=admin_Employees',
|
||||
);
|
||||
|
||||
$this->switchedProfileBlock = array(
|
||||
"profileImage"=>$profileSwitched->image,
|
||||
"firstName"=>$profileSwitched->first_name,
|
||||
"lastName"=>$profileSwitched->last_name
|
||||
"lastName"=>$profileSwitched->last_name,
|
||||
"profile_url"=>CLIENT_BASE_URL.'?g=modules&n=employees&m=module_Personal_Information',
|
||||
);
|
||||
} else {
|
||||
$this->currentProfileBlock = array(
|
||||
"profileImage"=>BASE_URL."images/user_male.png",
|
||||
"firstName"=>$this->user->username,
|
||||
"lastName"=>""
|
||||
"lastName"=>"",
|
||||
"profile_url"=>CLIENT_BASE_URL.'?g=admin&n=employees&m=admin_Employees',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user