Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

base-alert.inc.php

Go to the documentation of this file.
00001 <?
00010 class BaseAlert extends MyObject
00011 {
00015     public function __construct($data = null, $table = 'alerts')
00016     {
00017         parent::__construct($data, $table);
00018     }
00019 
00025     public function canView()
00026     {
00027         global $me;
00028         
00029         return ($this->user_id == $me->id);
00030     } 
00031     
00037     public function canDelete()
00038     {
00039         return $this->canView();
00040     }
00041     
00047     protected function getEditPageXml()
00048     {
00049         return '';
00050     }
00051 
00055     public function drawDeletePage()
00056     {
00057         $this->delete();
00058 
00059         echo 'Alert deleted.';
00060     }
00061 
00069     public function initViewPage()
00070     {
00071         //ya gotta log in buddy
00072         $this->assertLogin();
00073         
00074         //do our checks.
00075         parent::initViewPage();
00076 
00077         //this alert will self desctruct
00078         $this->delete();
00079 
00080         //send them home.
00081         Util::redirect($this->url);
00082     }
00083 
00089     public function getName($link = false)
00090     {
00091         return parent::getName($link, $this->text);
00092     } 
00093 
00097     public function drawLine()
00098     {
00099         $this->getName(true);
00100     }
00101 
00105     public function drawRow()
00106     {
00107         $this->drawLine();
00108     } 
00109 
00115     public function getRssItem()
00116     {
00117         $item = parent::getRssItem();
00118 
00119         $item->title = $this->getName();
00120         $item->description = $this->getName(true);
00121 
00122         return $item;
00123     }
00124     
00130     public function getPublicData()
00131     {
00132         $data = $this->getPublicData();
00133 
00134         $data['alert'] = $this->getName(true);
00135         $data['text'] = $this->text;
00136         $data['url'] = $this->url;
00137 
00138         return $data;
00139     }
00140     
00146     public function getCreateFieldsArray()
00147     {
00148         $arr = parent::getCreateFieldsArray();
00149 
00150         unset($arr['add_date']);
00151         unset($arr['edit_date']);
00152         
00153         $arr['url'] = "url varchar(255) default '' not null";
00154         $arr['text'] = "`text` varchar(255) default '' not null";
00155 
00156         return $arr;
00157     }
00158 
00164     public function getCreateIndexesArray()
00165     {
00166         $arr = parent::getCreateIndexesArray();
00167 
00168         unset($arr['add_date']);
00169         unset($arr['edit_date']);
00170     
00171         return $arr;
00172     }
00173 }
00174 ?>

Generated on Fri Oct 27 12:26:40 2006 for BaseJumper by doxygen 1.3.9.1