67 lines
2.3 KiB
PHP
67 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace BRSystems\Core\Cms\cmsPubUsers;
|
|
|
|
use BRSystems\Core\Cms\cmsPubUsers\inc\cmsPubUsersController;
|
|
use BRSystems\Core\Library\cJSON\cJSON;
|
|
|
|
class cmsPubUsers
|
|
{
|
|
public $DIR;
|
|
public $uriData;
|
|
public $controller;
|
|
|
|
public function __construct($uriData)
|
|
{
|
|
$this->uriData = $uriData;
|
|
$this->DIR = __DIR__ ?: dirname(__FILE__);
|
|
$this->controller = new cmsPubUsersController($this->uriData, $this->DIR, basename($this->DIR));
|
|
}
|
|
|
|
public function run()
|
|
{
|
|
switch (getV('action')) {
|
|
case 'edit':
|
|
$this->controller->run(true);
|
|
break;
|
|
case 'filter_table':
|
|
cJSON::sendOk($this->controller->createCmsTable(getP('page'), getP('filter'), getP('headers')));
|
|
break;
|
|
case 'selfLoad':
|
|
if ($this->controller->oUser->chkPermission('CMS_APP_USER_EDIT')) {
|
|
cJSON::sendOk($this->controller->editCmsTableRecord(getV('id')));
|
|
}
|
|
break;
|
|
case 'selfSave':
|
|
if (getV('id')) {
|
|
if ($this->controller->oUser->chkPermission('CMS_APP_USER_EDIT')) {
|
|
$this->controller->saveRecordData(getV('id'), getP('fields'));
|
|
}
|
|
} else {
|
|
if ($this->controller->oUser->chkPermission('CMS_APP_USER_ADD_NEW')) {
|
|
$this->controller->saveRecordData(getV('id'), getP('fields'));
|
|
}
|
|
}
|
|
cJSON::sendError();
|
|
break;
|
|
case 'deleteRecords':
|
|
if ($this->controller->oUser->chkPermission('CMS_APP_USER_DELETE')) {
|
|
cJSON::sendOk($this->controller->delete(getP('fields')));
|
|
}
|
|
break;
|
|
case 'changeRecordsStatus':
|
|
if ($this->controller->oUser->chkPermission('CMS_APP_USER_EDIT')) {
|
|
cJSON::sendOk($this->controller->changeEnumFields(getP('baseField'), getP('fields')));
|
|
}
|
|
break;
|
|
case 'genRandomPwd':
|
|
cJSON::sendOk($this->controller->genTempPWD());
|
|
break;
|
|
|
|
default:
|
|
$this->controller->run();
|
|
break;
|
|
}
|
|
}
|
|
}
|