Making code PSR2 compliant

This commit is contained in:
gamonoid
2017-09-24 19:23:30 +02:00
parent 05b57e0236
commit 6c61577583
160 changed files with 1432 additions and 1086 deletions

View File

@@ -41,23 +41,55 @@ abstract class ApproveModel extends BaseModel
$employee = BaseService::getInstance()->getElement('Employee', $currentEmpId);
if (!empty($employee->supervisor)) {
$notificationMsg = "A new ".$this->notificationUnitName." has been added by " . $employee->first_name . " " . $employee->last_name . ". Please visit ".$this->notificationModuleName." module to review it";
$notificationMsg = "A new "
.$this->notificationUnitName." has been added by "
. $employee->first_name . " " . $employee->last_name
. ". Please visit ".$this->notificationModuleName." module to review it";
BaseService::getInstance()->notificationManager->addNotification($employee->supervisor, $notificationMsg, '{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}', $this->notificationModuleName, null, false, $sendNotificationEmail);
BaseService::getInstance()->notificationManager->addNotification(
$employee->supervisor,
$notificationMsg,
'{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}',
$this->notificationModuleName,
null,
false,
$sendNotificationEmail
);
} else {
$user = BaseService::getInstance()->getCurrentUser();
if ($user->user_level == "Admin") {
//Auto approve
$obj->status = "Approved";
$notificationMsg = "Your ".$this->notificationUnitName." is auto approved since you are an administrator and do not have any supervisor assigned";
BaseService::getInstance()->notificationManager->addNotification(null, $notificationMsg, '{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}', $this->notificationModuleName, $user->id, false, $sendNotificationEmail);
$notificationMsg = "Your ".$this->notificationUnitName
." is auto approved since you are an administrator and do not have any supervisor assigned";
BaseService::getInstance()->notificationManager->addNotification(
null,
$notificationMsg,
'{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}',
$this->notificationModuleName,
$user->id,
false,
$sendNotificationEmail
);
} else {
//If the user do not have a supervisor, notify all admins
$admins = BaseService::getInstance()->getAllAdmins();
foreach ($admins as $admin) {
$notificationMsg = "A new ".$this->notificationUnitName." has been added by " . $employee->first_name . " " . $employee->last_name . ". Please visit ".$this->notificationModuleName." module to review it. You are getting this notification since you are an administrator and the user do not have any supervisor assigned.";
BaseService::getInstance()->notificationManager->addNotification(null, $notificationMsg, '{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}', $this->notificationModuleName, $admin->id, false, $sendNotificationEmail);
$notificationMsg = "A new ".$this->notificationUnitName." has been added by "
.$employee->first_name . " " . $employee->last_name . ". Please visit "
.$this->notificationModuleName
." module to review it. You are getting this notification since you are an "
."administrator and the user do not have any supervisor assigned.";
BaseService::getInstance()->notificationManager->addNotification(
null,
$notificationMsg,
'{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}',
$this->notificationModuleName,
$admin->id,
false,
$sendNotificationEmail
);
}
}
}
@@ -102,9 +134,20 @@ abstract class ApproveModel extends BaseModel
$employee = BaseService::getInstance()->getElement('Employee', $currentEmpId);
if (!empty($employee->supervisor)) {
$notificationMsg = $this->notificationUnitPrefix." ".$this->notificationUnitName." has been updated by " . $employee->first_name . " " . $employee->last_name . ". Please visit ".$this->notificationModuleName." module to review it";
$notificationMsg = $this->notificationUnitPrefix." "
.$this->notificationUnitName." has been updated by "
.$employee->first_name . " " . $employee->last_name
.". Please visit ".$this->notificationModuleName." module to review it";
BaseService::getInstance()->notificationManager->addNotification($employee->supervisor, $notificationMsg, '{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}', $this->notificationModuleName, null, false, $sendNotificationEmail);
BaseService::getInstance()->notificationManager->addNotification(
$employee->supervisor,
$notificationMsg,
'{"type":"url","url":"'.$this->notificationUnitAdminUrl.'"}',
$this->notificationModuleName,
null,
false,
$sendNotificationEmail
);
} else {
$user = BaseService::getInstance()->getCurrentUser();
@@ -113,8 +156,21 @@ abstract class ApproveModel extends BaseModel
//If the user do not have a supervisor, notify all admins
$admins = BaseService::getInstance()->getAllAdmins();
foreach ($admins as $admin) {
$notificationMsg = $this->notificationUnitPrefix." ".$this->notificationUnitName." request has been updated by " . $employee->first_name . " " . $employee->last_name . ". Please visit ".$this->notificationModuleName." module to review it. You are getting this notification since you are an administrator and the user do not have any supervisor assigned.";
BaseService::getInstance()->notificationManager->addNotification(null, $notificationMsg, '{"type":"url","url":"g=admin&n=travel&m=admin_Employees"}', "Travel Module", $admin->id, false, $sendNotificationEmail);
$notificationMsg = $this->notificationUnitPrefix." "
.$this->notificationUnitName." request has been updated by "
.$employee->first_name . " " . $employee->last_name
.". Please visit ".$this->notificationModuleName
." module to review it. You are getting this notification since you are "
."an administrator and the user do not have any supervisor assigned.";
BaseService::getInstance()->notificationManager->addNotification(
null,
$notificationMsg,
'{"type":"url","url":"g=admin&n=travel&m=admin_Employees"}',
"Travel Module",
$admin->id,
false,
$sendNotificationEmail
);
}
}
}
@@ -140,7 +196,10 @@ abstract class ApproveModel extends BaseModel
{
$currentEmployee = BaseService::getInstance()->getCurrentProfileId();
$approveal = new EmployeeApproval();
$approveals = $approveal->Find("type = ? and approver = ? and status = -1 and active = 1", array($this->getType(), $currentEmployee));
$approveals = $approveal->Find(
"type = ? and approver = ? and status = -1 and active = 1",
array($this->getType(), $currentEmployee)
);
$ids = array();
foreach ($approveals as $appr) {
$ids[] = $appr->element;

View File

@@ -10,5 +10,5 @@ namespace Model;
class Audit extends BaseModel
{
var $_table = 'AuditLog';
public $table = 'AuditLog';
}

View File

@@ -6,7 +6,7 @@ use Classes\IceResponse;
class BaseModel extends \ADOdb_Active_Record
{
var $keysToIgnore = array(
public $keysToIgnore = array(
"_table",
"_dbat",
"_tableat",

View File

@@ -10,5 +10,5 @@ namespace Model;
class Cron extends BaseModel
{
var $_table = 'Crons';
public $table = 'Crons';
}

View File

@@ -10,5 +10,5 @@ namespace Model;
class DataEntryBackup extends BaseModel
{
var $_table = 'DataEntryBackups';
public $table = 'DataEntryBackups';
}

View File

@@ -10,7 +10,7 @@ namespace Model;
class File extends BaseModel
{
var $_table = 'Files';
public $table = 'Files';
public function getAdminAccess()
{
return array("get","element","save","delete");

View File

@@ -10,5 +10,5 @@ namespace Model;
class IceEmail extends BaseModel
{
var $_table = 'Emails';
public $table = 'Emails';
}

View File

@@ -10,5 +10,5 @@ namespace Model;
class Migration extends BaseModel
{
var $_table = 'Migrations';
public $table = 'Migrations';
}

View File

@@ -10,5 +10,5 @@ namespace Model;
class Notification extends BaseModel
{
var $_table = 'Notifications';
public $table = 'Notifications';
}

View File

@@ -31,5 +31,5 @@ class Report extends BaseModel
return $entry;
}
var $_table = 'Reports';
public $table = 'Reports';
}

View File

@@ -37,5 +37,5 @@ class ReportFile extends BaseModel
return $entry;
}
var $_table = 'ReportFiles';
public $table = 'ReportFiles';
}

View File

@@ -10,5 +10,5 @@ namespace Model;
class RestAccessToken extends BaseModel
{
var $_table = 'RestAccessTokens';
public $table = 'RestAccessTokens';
}

View File

@@ -36,5 +36,5 @@ class Setting extends BaseModel
return $obj;
}
var $_table = 'Settings';
public $table = 'Settings';
}

View File

@@ -10,5 +10,5 @@ namespace Model;
class StatusChangeLog extends BaseModel
{
var $_table = 'StatusChangeLogs';
public $table = 'StatusChangeLogs';
}

View File

@@ -31,5 +31,5 @@ class UserReport extends BaseModel
return $entry;
}
var $_table = 'UserReports';
public $table = 'UserReports';
}