public function init() { // If visiting a department... $department_details = Catalog::GetDepartmentDetails($this->_mDepartmentId); $this->mName = $department_details['name']; $this->mDescription = $department_details['description']; if (isset($this->_mCategoryId)) { // If visiting a category... $category_details = Catalog::GetCategoryDetails($this->_mCategoryId); // Header title $this->mName .= ' » ' . $category_details['name']; // Description $this->mDescription = $category_details['description']; } }
public function init() { // Если посещаем отдел $department_details = Catalog::GetDepartmentDetails($this->_mDepartmentId); $this->mName = $department_details['name']; $this->mDescription = $department_details['description']; // Если посещаем категорию if (isset($this->_mCategoryId)) { $category_details = Catalog::GetCategoryDetails($this->_mCategoryId); $this->mName = $this->mName . ' » ' . $category_details['name']; $this->mDescription = $category_details['description']; $this->mEditActionTarget = Link::ToDepartmentCategoriesAdmin($this->_mDepartmentId); $this->mEditAction = 'edit_cat_' . $this->_mCategoryId; $this->mEditButtonCaption = 'Радактировать категорию'; } else { $this->mEditActionTarget = Link::ToDepartmentsAdmin(); $this->mEditAction = 'edit_dept' . $this->_mDepartmentId; $this->mEditButtonCaption = 'Редактировать отдел'; } }
public function __construct() { if (isset($_GET['DepartmentId'])) { $this->mDepartmentId = (int) $_GET['DepartmentId']; } else { trigger_error('Department not set'); } $department_details = Catalog::GetDepartmentDetails($this->mDepartmentId); $this->mDepartmentName = $department_details['name']; foreach ($_POST as $key => $value) { // On button click... if (substr($key, 0, 6) == 'submit') { $last_underscore = strrpos($key, '_'); $this->_mAction = substr($key, strlen('submit_'), $last_underscore - strlen('submit_')); $this->_mActionedCategoryId = (int) substr($key, $last_underscore + 1); break; } } $this->mLinkToDepartmentsAdmin = Link::ToDepartmentsAdmin(); $this->mLinkToDepartmentCategoriesAdmin = Link::ToDepartmentCategoriesAdmin($this->mDepartmentId); }