/** * Allows customization of categories which allow new discussions to be events * Sets config value Plugins.EventCalendar.CategoryIDs * * @param object $Sender SettingsController */ public function SettingsController_EventCalendar_Create($Sender) { $Sender->Permission('Garden.Settings.Manage'); $Sender->Title(T('Event Calendar Settings')); $Sender->AddSideMenu('settings/EventCalendar'); $Sender->SetData('Info', T('Event Calendar Info', 'Creation of events can be regulated by category <strong>and</strong> user role. You can set up the categories here, but don\'t forget to assign some permissions in the <a href="/index.php?p=dashboard/role">standard permission section</a> in the dashboard, otherwise you users wouldn\'t be able to use this plugin!')); $Sender->SetData('CategoriesLabel', 'Please choose categories in which the creation of events should be allowed'); $Validation = new Gdn_Validation(); // $Validation->ApplyRule('Plugins.EventCalendar.CategoryIDs', 'RequiredArray', T('You have to choose at least one category. If you don\'t want to use the plugin any longer, please deactivate it')); $ConfigurationModel = new Gdn_ConfigurationModel($Validation); $ConfigurationModel->SetField(array('Plugins.EventCalendar.CategoryIDs')); $Form = $Sender->Form; $Sender->Form->SetModel($ConfigurationModel); if ($Sender->Form->AuthenticatedPostBack() != FALSE) { if ($Sender->Form->Save() != FALSE) { $Sender->StatusMessage = T('Saved'); } } else { $Sender->Form->SetData($ConfigurationModel->Data); } $CategoryModel = new Gdn_Model('Category'); $Sender->CategoryData = $CategoryModel->GetWhere(array('AllowDiscussions' => 1, 'CategoryID <>' => -1)); $Sender->EventCategory = C('Plugins.EventCalendar.CategoryIDs'); $Sender->Render('settings', '', 'plugins/EventCalendar'); }
/** * Make output to be returned from the references() function * * @return string XHTML ready for output */ function referencesFormat($group) { if (count($this->mRefs) == 0 or empty($this->mRefs[$group])) { return ''; } wfProfileIn(__METHOD__); wfProfileIn(__METHOD__ . '-entries'); $ent = array(); foreach ($this->mRefs[$group] as $k => $v) { $ent[] = $this->referencesFormatEntry($k, $v); } $prefix = wfMsgForContentNoTrans('cite_references_prefix'); $suffix = wfMsgForContentNoTrans('cite_references_suffix'); $content = implode("\n", $ent); // Let's try to cache it. $parserInput = $prefix . $content . $suffix; global $wgMemc; $cacheKey = wfMemcKey('citeref', md5($parserInput), $this->mParser->Title()->getArticleID()); wfProfileOut(__METHOD__ . '-entries'); global $wgCiteCacheReferences; if ($wgCiteCacheReferences) { wfProfileIn(__METHOD__ . '-cache-get'); $data = $wgMemc->get($cacheKey); wfProfileOut(__METHOD__ . '-cache-get'); } if (empty($data)) { wfProfileIn(__METHOD__ . '-parse'); // Live hack: parse() adds two newlines on WM, can't reproduce it locally -ævar $ret = rtrim($this->parse($parserInput), "\n"); if ($wgCiteCacheReferences) { $serData = $this->mParser->serialiseHalfParsedText($ret); $wgMemc->set($cacheKey, $serData, 86400); } wfProfileOut(__METHOD__ . '-parse'); } else { $ret = $this->mParser->unserialiseHalfParsedText($data); } wfProfileOut(__METHOD__); //done, clean up so we can reuse the group unset($this->mRefs[$group]); unset($this->mGroupCnt[$group]); return $ret; }
/** * If this object has a "Head" object as a property, this will set it's Title value. * * @param string $Title The value to pass to $this->Head->Title(). */ public function Title($Title) { if ($this->Head) { $this->Head->Title($Title); } }