id_event = $options['_restAlias']; $this->DBObj = new App_Event_Team_Admin_Obj(Qs_Request::getRequestValue('id')); } function exec(&$Doc) { $this->Doc = $Doc; if (false === ($event = $this->DBObj->findEvent($this->id_event))) { $this->Doc->display404(); return; } $this->DBObj->setEvent($event); $this->Doc->setTitle('Event: ' . $event['name']); parent::exec(); } function _doListBind(DB_List &$list) { $list->tpl = BASE_PATH . '/tpl/Event/Team/Admin/list.tpl'; $list->tableAttribs['id'] = 'event-team-grid'; $list->insertColLast( 'teamname', array( 'title' => 'Team Name', 'order_by' => 'teamname', 'tpl' => constant('DB_LIST_CELL_TEXT'), 'params' => array('teamname') ) ); $list->insertColLast( 'members', array( 'title' => 'Members', 'tpl' => 'Event/Team/Admin/cells/members.tpl', 'link' => Constant::get('BASE_URL') .'/admin/event/report?' . http_build_query( array( 'action' => 'add_attendee', 'id_event' => $this->DBObj->getEvent('id'), 'team_option' => 'exisitingteam', 'sessionName' => CURR_PAGE_FULL ) ), 'params' => array('members') ) ); $list->insertColLast( 'options', array( 'title' => 'Options', 'tpl' => constant('DB_LIST_CELL_EDIT_DEL'), 'edit_link' => $this->fullUrl(array('action' => 'edit')) . '&id=', 'del_link' => $this->fullUrl(array('action' => 'del')) . '&id=', 'delMessage' => 'Do you really want to delete this team including member\' registrations?', 'params' => array('id') ) ); } function _bindFormFields(Form $form) { $form->addElement('text', 'teamname', 'Team Name'); $form->addRuleRequired(array('teamname')); return $form; } function doList() { $this->_saveBackUrl(); $this->addLink(); require_once('class/DB/List/List.php'); $DB_List = new DB_List($this->Doc, $this->DBObj, $this->functionalFields); $this->_doListBind($DB_List); $DB_List->exec(); return true; } function doEdit() { $this->DBObj->initFromDB(); $form = $this->_getEditForm(); $form->setDefaults($this->DBObj->getData()); if (empty($form->cancelUrl)) { $form->cancelUrl = $this->getBackUrl(); } $this->renderForm($form); } function setBackUrl($url, $sessionName = null) { if (is_null($sessionName)) { $sessionName = CURR_PAGE_FULL; } Session::setData($sessionName, 'query_string', $url); } function getBackUrl($page = '') { $page = (string)$page; if ($page == '') { $page = CURR_PAGE_FULL; } $backUrl = Session::getData($page, 'query_string'); if (empty($backUrl)) { $backUrl = BASE_URL . '/' . $page; } return $backUrl; } function addLink() { $query = array( 'action' => 'add_attendee', 'id_event' => $this->DBObj->getEvent('id'), 'team_option' => 'newteam', 'sessionName' => CURR_PAGE_FULL ); $item = array( 'tpl' => 'center_link.tpl', 'link_list' => array( array('title' => 'Event: ' . $this->DBObj->getEvent('name')), array( 'link' => 'admin/event/report?id_event=' . $this->DBObj->getEvent('id'), 'title' => 'Attendee Mode' ), array( 'link' => $this->fullUrl(array('action' => 'new', 'sessionName' => CURR_PAGE_FULL)), 'title' => 'Add new Team' ), array( 'link' => Constant::get('BASE_URL') .'/admin/event/report?'. http_build_query($query), 'title' => 'Add new Team with attendee' ) ) ); $this->Doc->addContent($item); } }