uriData = $uriData; $this->DIR = __DIR__ ?: dirname(__FILE__); $this->controller = new cmsTextManagerController($this->uriData, $this->DIR, basename($this->DIR)); } public function run() { $action = getV('action'); switch ($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': cJSON::sendOk($this->controller->editCmsTableRecord(getV('id'))); break; case 'selfSave': if(getV('id')){ if($this->controller->oUser->chkPermission('CMS_TEXTMANAGER_EDIT', false, false)) cJSON::sendOk($this->controller->saveRecordData(getV('id'), getP('fields'))); else cJSON::sendError(); }else{ if($this->controller->oUser->chkPermission('CMS_TEXTMANAGER_ADD_NEW', false, false)) cJSON::sendOk($this->controller->saveRecordData(getV('id'), getP('fields'))); else cJSON::sendError(); } break; case 'deleteRecords': if($this->controller->oUser->chkPermission('CMS_TEXTMANAGER_DELETE')) cJSON::sendOk($this->controller->delete(getP('fields'))); break; case 'changeRecordsStatus': if($this->controller->oUser->chkPermission('CMS_TEXTMANAGER_EDIT')) cJSON::sendOk($this->controller->changeEnumFields(getP('baseField'), getP('fields'))); break; case 'getFileLink': cJSON::sendOk($this->controller->getLinkToFile(getV('link'), getV('file_id'))); break; case 'f_link': cJSON::sendOk($this->controller->getLinkToArticle(getV('id'))); break; default: $this->controller->run(); break; } } }