71 lines
2.3 KiB
PHP
71 lines
2.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace themes\merakomis\structure;
|
||
|
|
|
||
|
|
use ms\ms\structure\msModuleTable;
|
||
|
|
use themes\merakomis\Emp;
|
||
|
|
|
||
|
|
class merakomisModuleTable extends msModuleTable {
|
||
|
|
static $table_name = '';
|
||
|
|
static $PORTAL = 'portal';
|
||
|
|
static $cache = [];
|
||
|
|
|
||
|
|
static function getByIDCached($id){
|
||
|
|
if(isset(static::$cache['id'][$id])){
|
||
|
|
return static::$cache['id'][$id];
|
||
|
|
}
|
||
|
|
return static::$cache['id'][$id] = static::getByID($id);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
static function getByIDForMyPortal($id){
|
||
|
|
$c = static::getByID($id);
|
||
|
|
return ($c[static::$PORTAL] == \Site::$portal_id) ? $c : null;
|
||
|
|
}
|
||
|
|
|
||
|
|
static function whereSearch($s){
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
public static function getTableData(array $options = array()) {
|
||
|
|
|
||
|
|
$isArchive = property_exists(get_called_class(),'REMOVED');
|
||
|
|
if($options[\Query::WHERE]) {
|
||
|
|
$options[\Query::WHERE] = \Where::_and([
|
||
|
|
$options[\Query::WHERE],
|
||
|
|
//\Where::_operator(static::$PORTAL,'=',\Site::$portal_id),
|
||
|
|
$isArchive ? \Where::_operator(static::$REMOVED,'=',0) : null,
|
||
|
|
]);
|
||
|
|
} else {
|
||
|
|
if($isArchive) {
|
||
|
|
$options[\Query::WHERE] = \Where::_and([
|
||
|
|
//\Where::_operator(static::$PORTAL,'=',\Site::$portal_id),
|
||
|
|
$isArchive ? \Where::_operator(static::$REMOVED, '=', 0) : null,
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
return parent::getTableData($options); // TODO: Change the autogenerated stub
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public static function afterUadd($values, $id, $result) {
|
||
|
|
parent::afterUadd($values, $id, $result); // TODO: Change the autogenerated stub
|
||
|
|
return [
|
||
|
|
'notify'=>[
|
||
|
|
'content'=>'Успешно сохранено'
|
||
|
|
]
|
||
|
|
];
|
||
|
|
}
|
||
|
|
public static function checkUserAddAccess(array $values = [], int $id = 0, bool $isEdit = false): bool {
|
||
|
|
return Emp::$IS_AUTH;
|
||
|
|
//return parent::checkUserAddAccess($values, $id, $isEdit); // TODO: Change the autogenerated stub
|
||
|
|
}
|
||
|
|
|
||
|
|
static function getNameListForNowPortal(): array {
|
||
|
|
$options[\Query::WHERE] = new \Where(\Where::_operator(static::$PORTAL,'=',\Site::$portal_id));
|
||
|
|
return parent::getNameList($options); // TODO: Change the autogenerated stub
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|