/** * Retrieve a topic by its ID. * @param $topicId string * @return HelpTopic */ function &getTopic($topicId) { $cache =& $this->_getCache($topicId); $data = $cache->getContents(); // check if data exists after loading if (!is_array($data)) { $returner = false; return $returner; } $topic = new HelpTopic(); $topic->setId($data['topic'][0]['attributes']['id']); $topic->setTitle($data['topic'][0]['attributes']['title']); $topic->setTocId($data['topic'][0]['attributes']['toc']); if (isset($data['topic'][0]['attributes']['subtoc'])) { $topic->setSubTocId($data['topic'][0]['attributes']['subtoc']); } if (isset($data['section'])) { foreach ($data['section'] as $sectionData) { $section = new HelpTopicSection(); $section->setTitle(isset($sectionData['attributes']['title']) ? $sectionData['attributes']['title'] : null); $section->setContent($sectionData['value']); $topic->addSection($section); } } if (isset($data['related_topic'])) { foreach ($data['related_topic'] as $relatedTopic) { $relatedTopicArray = array('id' => $relatedTopic['attributes']['id'], 'title' => $relatedTopic['attributes']['title']); $topic->addRelatedTopic($relatedTopicArray); } } return $topic; }
public function beforeValidate() { // Alias if ($this->alias) { $this->alias = makeAlias($this->alias); } else { $this->alias = makeAlias($this->question); } if ($this->isNewRecord) { // Check if we already have an alias with those parameters if (HelpTopic::model()->exists('alias=:alias', array(':alias' => $this->alias))) { $this->addError('alias', at('There is already a help topic with that alias.')); } } else { // Check if we already have an alias with those parameters if (HelpTopic::model()->exists('alias=:alias AND id!=:id', array(':id' => $this->id, ':alias' => $this->alias))) { $this->addError('alias', at('There is already a help topic with that alias.')); } } return parent::beforeValidate(); }
/** * Retrieves a toc by its ID. * @param $tocId string * @return HelpToc */ function &getToc($tocId) { $cache =& $this->_getCache($tocId); $data = $cache->getContents(); // check if data exists after loading if (!is_array($data)) { $returner = false; return $returner; } $toc = new HelpToc(); $toc->setId($data['toc'][0]['attributes']['id']); $toc->setTitle($data['toc'][0]['attributes']['title']); if (isset($data['toc'][0]['attributes']['parent_topic'])) { $toc->setParentTopicId($data['toc'][0]['attributes']['parent_topic']); } if (isset($data['topic'])) { foreach ($data['topic'] as $topicData) { $topic = new HelpTopic(); $topic->setId($topicData['attributes']['id']); $topic->setTitle($topicData['attributes']['title']); $toc->addTopic($topic); } } if (isset($data['breadcrumb'])) { foreach ($data['breadcrumb'] as $breadcrumbData) { $toc->addBreadcrumb($breadcrumbData['attributes']['title'], $breadcrumbData['attributes']['url']); } } return $toc; }
/** * Delete help topic action */ public function actionDelete() { // Check Access checkAccessThrowException('op_helptopics_delete'); if (isset($_GET['id']) && ($model = HelpTopic::model()->findByPk($_GET['id']))) { alog(at("Deleted Help Topic '{name}'.", array('{name}' => $model->name))); $model->delete(); fok(at('Help Topic Deleted.')); $this->redirect(array('helptopics/index')); } else { $this->redirect(array('helptopics/index')); } }
/** * Lists all models. */ public function actionAdmin() { Acl::hasPrivilege($this->privileges, $this->resource, Acl::ACTION_VIEW); $this->pageTitle = 'Manage ' . $this->homeTitle; $this->render('admin', array('model' => HelpTopic::model()->searchModel())); }
assert(!isset(self::$list[$id])); self::$list[$id] = new HelpTopic($id, $name, $description); } } HelpTopic::register("topics", "Help topics"); HelpTopic::register("chair", "Chair’s guide", "How to run a conference using HotCRP."); HelpTopic::register("search", "Search", "About paper searching."); HelpTopic::register("keywords", "Search keywords", "Quick reference to search keywords and syntax."); HelpTopic::register("tags", "Tags", "How to use tags to define paper sets and discussion orders."); HelpTopic::register("tracks", "Tracks", "How tags can control PC access to papers."); HelpTopic::register("scoresort", "Sorting scores", "How scores are sorted in paper lists."); HelpTopic::register("revround", "Review rounds", "Review rounds are sets of reviews with different deadlines."); HelpTopic::register("revrate", "Review ratings", "Rating the quality of reviews."); HelpTopic::register("votetags", "Voting", "PC members can vote for papers using tags."); HelpTopic::register("ranking", "Ranking", "PC members can rank papers using tags."); HelpTopic::register("formulas", "Formulas", "Create and display formulas in search orders."); if (!isset($_REQUEST["t"]) && preg_match(',\\A/(\\w+)\\z,i', Navigation::path())) { $_REQUEST["t"] = substr(Navigation::path(), 1); } $topic = defval($_REQUEST, "t", "topics"); if ($topic == "syntax") { $topic = "keywords"; } if (!isset(HelpTopic::$list[$topic])) { $topic = "topics"; } if ($topic === "topics") { $Conf->header("Help", "help", actionBar()); } else { $Conf->header("Help ∕ <strong>" . HelpTopic::$list[$topic]->name . "</strong>", "help", actionBar()); }