/** * (non-PHPdoc) * @see FormlessAction::onView() */ public function onView() { $this->getOutput()->setPageTitle($this->getPageTitle()); $c = $this->getItemClass(); // Yeah, this is needed in PHP 5.3 >_> $object = $c::get($this->getTitle()->getText()); if ($object === false) { $this->getOutput()->addWikiMsg('ep-' . strtolower($this->getName()) . '-norevs'); $lastRev = EPRevision::selectRow(null, array('type' => EPPageObject::getTypeForNS($this->getTitle()->getNamespace()), 'object_identifier' => $this->getTitle()->getText(), 'deleted' => true), array('SORT BY' => EPRevision::getPrefixedField('time'), 'ORDER' => 'DESC')); if ($lastRev !== false) { // TODO: show available info about deletion $this->getOutput()->addWikiMsg('ep-' . strtolower($this->getName()) . '-deleted'); } } else { $this->displayRevisions($object); } return ''; }
/** * Returns the title to return to after the form has been submitted, * or when form use is aborted for some other reason. * * @since 0.1 * * @param boolean $addedItem * * @return Title */ protected function getReturnToTitle($addedItem = false) { if ($this->getRequest()->getCheck('wpreturnto')) { return Title::newFromText($this->getRequest()->getText('wpreturnto')); } elseif (!$addedItem && $this->isNew()) { $c = $this->getItemClass(); // Yeah, this is needed in PHP 5.3 >_> return SpecialPage::getTitleFor($c::getListPage()); } elseif ($this->item !== false) { return $this->item->getTitle(); } else { $c = $this->getItemClass(); // Yeah, this is needed in PHP 5.3 >_> $fieldName = 'wpitem-' . $c::getIdentifierField(); if ($this->getRequest()->getCheck($fieldName)) { return $c::getTitleFor($this->getRequest()->getText($fieldName)); } else { return $this->getTitle(); } } }
/** * (non-PHPdoc) * @see EPDBObject::setField() */ public function setField($name, $value) { if ($name === 'instructors') { $this->instructors = false; } parent::setField($name, $value); }
/** * (non-PHPdoc) * @see EPDBObject::save() */ public function save() { if ($this->hasField('name')) { $this->setField('name', $GLOBALS['wgLang']->ucfirst($this->getField('name'))); } return parent::save(); }