コード例 #1
0
 public function remove($user = null)
 {
     global $wgUser;
     if ($user === null) {
         $user = $wgUser;
     }
     Ad::removeAd($this->getName(), $user);
 }
コード例 #2
0
 public function processEditAd($formData)
 {
     // First things first! Figure out what the heck we're actually doing!
     switch ($formData['action']) {
         case 'delete':
             if (!$this->editable) {
                 return null;
             }
             try {
                 Ad::removeAd($this->adName, $this->getUser());
                 $this->getOutput()->redirect($this->getTitle('')->getCanonicalURL());
                 $this->adFormRedirectRequired = true;
             } catch (MWException $ex) {
                 return $ex->getMessage() . " <br /> " . $this->msg('promoter-ad-still-bound', $this->adName);
             }
             break;
         case 'archive':
             if (!$this->editable) {
                 return null;
             }
             return 'Archiving currently does not work';
             break;
         case 'clone':
             if (!$this->editable) {
                 return null;
             }
             $newAdName = $formData['cloneName'];
             Ad::fromName($this->adName)->cloneAd($newAdName, $this->getUser());
             $this->getOutput()->redirect($this->getTitle("Edit/{$newAdName}")->getCanonicalURL());
             $this->adFormRedirectRequired = true;
             break;
         case 'save':
             if (!$this->editable) {
                 return null;
             }
             return $this->processSaveAdAction($formData);
             break;
         default:
             // Nothing was requested, so do nothing
             break;
     }
 }