예제 #1
0
 /**
  * (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 '';
 }
예제 #2
0
 /**
  * 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();
         }
     }
 }
예제 #3
0
 /**
  * (non-PHPdoc)
  * @see EPDBObject::setField()
  */
 public function setField($name, $value)
 {
     if ($name === 'instructors') {
         $this->instructors = false;
     }
     parent::setField($name, $value);
 }
예제 #4
0
 /**
  * (non-PHPdoc)
  * @see EPDBObject::save()
  */
 public function save()
 {
     if ($this->hasField('name')) {
         $this->setField('name', $GLOBALS['wgLang']->ucfirst($this->getField('name')));
     }
     return parent::save();
 }