Файл: system/controllers/admin/frontend.php
Строк: 103
<?php
class admin extends cmsFrontend {
const perpage = 15;
public $installer_upload_path = 'installer';
//============================================================================//
//============================================================================//
public function before($action_name) {
if (!cmsUser::isAdmin()) { cmsCore::error404(); }
parent::before($action_name);
$template = cmsTemplate::getInstance();
$template->setLayout('admin');
$template->setMenuItems('cp_main', $this->getAdminMenu());
}
//============================================================================//
//============================================================================//
public function getAdminMenu(){
return array(
array(
'title' => LANG_CP_SECTION_CONTENT,
'url' => href_to($this->name, 'content'),
'options' => array(
'class' => 'item-content'
)
),
array(
'title' => LANG_CP_SECTION_CTYPES,
'url' => href_to($this->name, 'ctypes'),
'options' => array(
'class' => 'item-ctypes'
)
),
array(
'title' => LANG_CP_SECTION_MENU,
'url' => href_to($this->name, 'menu'),
'options' => array(
'class' => 'item-menu'
)
),
array(
'title' => LANG_CP_SECTION_WIDGETS,
'url' => href_to($this->name, 'widgets'),
'options' => array(
'class' => 'item-widgets'
)
),
array(
'title' => LANG_CP_SECTION_CONTROLLERS,
'url' => href_to($this->name, 'controllers'),
'options' => array(
'class' => 'item-controllers'
)
),
array(
'title' => LANG_CP_SECTION_USERS,
'url' => href_to($this->name, 'users'),
'options' => array(
'class' => 'item-users'
)
),
array(
'title' => LANG_CP_SECTION_SETTINGS,
'url' => href_to($this->name, 'settings'),
'options' => array(
'class' => 'item-settings'
)
),
);
}
//============================================================================//
//============================================================================//
public function getCtypeMenu($do='add', $id=null){
return array(
array(
'title' => LANG_CP_CTYPE_SETTINGS,
'url' => href_to($this->name, 'ctypes', ($do == 'add' ? array('add') : array('edit', $id)))
),
array(
'title' => LANG_CP_CTYPE_LABELS,
'url' => href_to($this->name, 'ctypes', array('labels', $id)),
'disabled' => ($do == 'add')
),
array(
'title' => LANG_CP_CTYPE_FIELDS,
'url' => href_to($this->name, 'ctypes', array('fields', $id)),
'disabled' => ($do == 'add')
),
array(
'title' => LANG_CP_CTYPE_PROPS,
'url' => href_to($this->name, 'ctypes', array('props', $id)),
'disabled' => ($do == 'add')
),
array(
'title' => LANG_CP_CTYPE_PERMISSIONS,
'url' => href_to($this->name, 'ctypes', array('perms', $id)),
'disabled' => ($do == 'add')
),
array(
'title' => LANG_CP_CTYPE_DATASETS,
'url' => href_to($this->name, 'ctypes', array('datasets', $id)),
'disabled' => ($do == 'add')
),
array(
'title' => LANG_MODERATORS,
'url' => href_to($this->name, 'ctypes', array('moderators', $id)),
'disabled' => ($do == 'add')
)
);
}
//============================================================================//
//============================================================================//
public function getSettingsMenu(){
return array(
array(
'title' => LANG_BASIC_OPTIONS,
'url' => href_to($this->name, 'settings')
),
array(
'title' => LANG_CP_SCHEDULER,
'url' => href_to($this->name, 'settings', array('scheduler'))
),
);
}
//============================================================================//
//============================================================================//
public function loadControllerBackend($controller_name, $request){
$config = cmsConfig::getInstance();
$ctrl_file = $config->root_path . 'system/controllers/'.$controller_name.'/backend.php';
if(!file_exists($ctrl_file)){
$this->halt(sprintf(LANG_CP_ERR_BACKEND_NOT_FOUND, $controller_name));
}
include_once($ctrl_file);
$controller_class = 'backend' . string_to_camel('_', $controller_name);
$backend = new $controller_class($request);
return $backend;
}
//============================================================================//
//============================================================================//
}