46 lines
1.6 KiB
PHP
46 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace BRSystems\Core\Cms\cmsCountToClass;
|
|
|
|
use BRSystems\Core\Cms\cmsCountToClass\inc\cmsCountToClassController;
|
|
use BRSystems\Core\Library\cJSON\cJSON;
|
|
|
|
/**
|
|
* cmsCountToClass
|
|
*
|
|
* @category cmsCountToClass
|
|
* @author Aivars Žukovskis <keiss.mareks@gmail.com>
|
|
* @since Version 3.0
|
|
*/
|
|
class cmsCountToClass
|
|
{
|
|
public cmsCountToClassController $controller;
|
|
|
|
public function __construct($uriData)
|
|
{
|
|
$DIR = __DIR__ ?: dirname(__FILE__);
|
|
$this->controller = new cmsCountToClassController($uriData, $DIR, basename($DIR));
|
|
}
|
|
|
|
public function run()
|
|
{
|
|
switch (getV('action')) {
|
|
case 'filter_table':
|
|
cJSON::sendok($this->controller->createCmsTable(getP('page'), getP('filter'), getP('headers')));
|
|
case 'selfSave':
|
|
$editPermission = 'CMS_APP_COUNT_TO_CLASS_EDIT';
|
|
if (getV('id') && $this->controller->oUser->chkPermission($editPermission, false, false)) {
|
|
cJSON::sendok($this->controller->saveRecordData(getV('id'), getP('field')));
|
|
}
|
|
cJSON::senderror(['data' => $this->controller->gM("No access to save records")]);
|
|
case 'deleteRecords':
|
|
if ($this->controller->oUser->chkPermission('CMS_APP_COUNT_TO_CLASS_DELETE')) {
|
|
cJSON::sendok($this->controller->delete(getP('fields')));
|
|
}
|
|
cJSON::senderror(['data' => $this->controller->gM("No access to delete records")]);
|
|
default:
|
|
$this->controller->run();
|
|
break;
|
|
}
|
|
}
|
|
} |