/** * @ingroup ObjectManagers * @brief Get a users invitations. * * Built-in privacy for only selecting the current users invitations, which they * can reply to. Also handles sent invitations. */ class BaseInvitations extends MyManager { /** * constructor * @see ObjectManager::__construct() */ public function __construct($class = 'Invite') { $this->useFullTextSearch = false; parent::__construct($class); } /** * add in extra pages to module * * outvites - invitations i've sent */ public function getSearchParamXml() { $xml = parent::getSearchParamXml(); $xml .= ""; return $xml; } /** * get only my invites / outvites * * @see ObjectManager::getSearchParamXml() */ public function getSearchWhere($params) { global $me; $sql = parent::getSearchWhere($params); if ($params['outvites']) $sql .= " AND inviter_id = '$me->id' "; else $sql .= " AND invitee_id = '$me->id' "; return $sql; } /** * prep our search page and make us log in */ public function initSearchPage() { $this->assertLogin(); parent::initSearchPage(); if ($this->params('outvites')) $this->pageTitle = "Invitations I've Sent"; else $this->pageTitle = "My Invitations"; } /** * draw our page, and navigation too */ public function drawHTMLOutput() { echo $this->getSearchNav(); parent::drawHTMLOutput(); } /** * get invite navigation html * * @return a
that contains the navigation links */ protected function getSearchNav() { $links = $this->getSearchLinks(); return "
" . implode(" | ", $links) . "
"; } /** * get our links for our search pages * * @return an array of tag links for navigation */ protected function getSearchLinks() { $nav = array(); if ($this->params('outvites')) $nav[] = $this->getLink(".search", "My Invitations"); else $nav[] = $this->getLink(".search?outvites=1", "Invitations I've Sent"); $nav[] = $this->getLink(strtolower($this->objectType), "New Invitation"); return $nav; } } ?>