function onInitForm(&$controller) { $model = $controller->get_model(); if (!isset($model->id)) { $model->readData($controller->get_model_id()); } $header_id = $model->getHeaderTextId(); if (!$header_id) { return false; } require_once 'AMP/Content/Article.inc.php'; $article = new Article(AMP_Registry::getDbcon(), $header_id); $section = $article->getParent(); $allowed_sections = AMP_lookup('sectionMap'); if (!isset($allowed_sections[$section])) { $this->_saved_header = $header_id; $form = $controller->get_form(); $form->dropField('url'); } }
function findArticle($article_id) { $location = new Article($this->dbcon, $article_id); $this->current_section = $location->getParent(); $this->current_element = $this->_trimText($location->getName()); $this->content_type = AMP_CONTENT_PAGETYPE_ARTICLE; }
function isAllowed($action, $model_id = false) { if ($model_id) { require_once 'AMP/Content/Article.inc.php'; $article = new Article(AMP_Registry::getDbcon(), $model_id); if (!$article->hasData()) { return false; } $section_id = $article->getParent(); $allowed_sections = AMP_lookup('sectionMap'); if ($section_id == AMP_CONTENT_MAP_ROOT_SECTION) { return true; } if (!$allowed_sections) { return false; } if (!isset($allowed_sections[$section_id])) { return false; } } return parent::isAllowed($action, $model_id); }
/** * globalizeArticleVars * * @param Article $articleinfo The article whose values are to be globalized */ function _globalizeArticleVars(&$articleinfo) { $GLOBALS['MM_class'] = $articleinfo->getClass(); $GLOBALS['MM_type'] = $articleinfo->getParent(); $GLOBALS['MM_author'] = $articleinfo->getAuthor(); $GLOBALS['MM_title'] = $articleinfo->getTitle(); $GLOBALS['MM_shortdesc'] = $articleinfo->getBlurb(); }