00001 <? 00009 class BaseInvitations extends MyManager 00010 { 00015 public function __construct($class = 'Invite') 00016 { 00017 $this->useFullTextSearch = false; 00018 parent::__construct($class); 00019 } 00020 00026 public function getSearchParamXml() 00027 { 00028 $xml = parent::getSearchParamXml(); 00029 00030 $xml .= "<param name=\"outvites\"/>"; 00031 00032 return $xml; 00033 } 00034 00040 public function getSearchWhere($params) 00041 { 00042 global $me; 00043 00044 $sql = parent::getSearchWhere($params); 00045 00046 if ($params['outvites']) 00047 $sql .= " AND inviter_id = '$me->id' "; 00048 else 00049 $sql .= " AND invitee_id = '$me->id' "; 00050 00051 return $sql; 00052 } 00053 00057 public function initSearchPage() 00058 { 00059 $this->assertLogin(); 00060 00061 parent::initSearchPage(); 00062 00063 if ($this->params('outvites')) 00064 $this->pageTitle = "Invitations I've Sent"; 00065 else 00066 $this->pageTitle = "My Invitations"; 00067 } 00068 00072 public function drawHTMLOutput() 00073 { 00074 echo $this->getSearchNav(); 00075 00076 parent::drawHTMLOutput(); 00077 } 00078 00084 protected function getSearchNav() 00085 { 00086 $links = $this->getSearchLinks(); 00087 return "<p>" . implode(" | ", $links) . "</p>"; 00088 } 00089 00095 protected function getSearchLinks() 00096 { 00097 $nav = array(); 00098 00099 if ($this->params('outvites')) 00100 $nav[] = $this->getLink(".search", "My Invitations"); 00101 else 00102 $nav[] = $this->getLink(".search?outvites=1", "Invitations I've Sent"); 00103 00104 $nav[] = $this->getLink(strtolower($this->objectType), "New Invitation"); 00105 00106 return $nav; 00107 } 00108 } 00109 ?>