'doList', 'cancel' => 'doBack', 'new' => 'doNew', 'insert' => 'doInsert', 'edit' => 'doEdit', 'del' => 'doDelete', 'choose_event' => 'doChooseEvent', 'find_event' => 'doFindEvent', 'form' => 'doForm', 'downloadCertificate' => 'doDownloadCertificate', ); var $opt = array ( 'form_title_off' => true ); function _doListBind(DB_List $list) { $list->def_order_by = 'event_date DESC'; $list->tableAttribs['id'] = 'event-history-grid'; $list->insertColLast( 'event_date', array( 'title' => 'Date', 'order_by' => 'event_date', 'date_format' => '%b %e, %Y', 'width' => 70, 'tpl' => DB_LIST_CELL_DATE, 'params' => array('event_date'), ) ); $list->insertColLast( 'event_name', array( 'title' => 'Event', 'order_by'=> 'event_name', 'width' => 250, 'url' => 'admin/event/report?id_event=', 'tpl' => DB_LIST_CELL_LINK, 'params' => array('id_event', 'event_name'), ) ); $list->insertColLast( 'reg_date', array( 'title' => 'Registration Date', 'order_by' => 'added', 'width' => 115, 'date_format' => '%b %e, %Y', 'tpl' => DB_LIST_CELL_DATE, 'params' => array('added'), ) ); $list->insertColLast( 'amount', array( 'title' => 'Amount', 'order_by'=> 'amount', 'width' => 70, 'tpl' => DB_LIST_CELL_MONEY, 'params' => array('amount'), ) ); $list->insertColLast( 'attended', array( 'title' => 'Attended', 'order_by'=> 'attended', 'width' => 100, 'tpl' => DB_LIST_CELL_TEXT_CENTER, 'params' => array('attended'), ) ); $list->insertColLast( 'certificate', array( 'title' => 'CE Certificate', 'order_by' => 'certificate', 'width' => 100, 'fullAlias' => App_Event_Certificate_Obj::ADMIN_FULL_ALIAS, 'tpl' => 'Event/Certificate/cells/download.tpl', 'params' => array('allowed' => 'certificate_allowed', 'id' => 'id'), ) ); $list->insertColLast( 'options', array( 'title' => 'Options', 'width' => 70, 'del_link'=> BASE_URL . '/' . CURR_PAGE_FULL . '?action=del&id=', 'tpl' => DB_LIST_CELL_DEL, 'params' => array('id'), ) ); $list->bind(); return true; } function addLink() { $item = array( 'tpl' => 'center_link.tpl', 'link_list' => array( array( 'title' => '<< Back to individual ', 'link' => BASE_URL . '/admin/member?action=edit&id=' . $this->DBObj->id_individual ), ) ); $this->Doc->addContent($item); } function _getNewForm() { $this->Doc->addItemProp('JSs','js/member_event_functions.js'); $this->Doc->addItemProp('JSs','js/event_functions.js'); $EventForm = SiteMap::getObj('Event/Form/Form.php', 3); /** @var $form Form */ $form = $EventForm->getForm($this->Doc); $form->cancelUrl = Constant::get('BASE_URL') . '/' . CURR_PAGE_FULL; $form->_attributes['action']='admin/event/report'; $form->removeElement('id_event'); $form->removeElement('amount'); $this->setFormTitle($form, 'Assign new Event'); $form->addElement('hidden', 'action', 'add_attendee'); $form->addElement('hidden', 'subaction', 'submit'); $form->addElement('hidden', 'id_member', $this->DBObj->id_individual); Session::setData('admin/event/report','backUrl',Constant::get('BASE_URL') . '/' . CURR_PAGE_FULL); Session::setData('admin/event/report','backUrlMsg',CURR_PAGE); $form->insertElementBefore(Form::createElement( 'select', 'id_event', 'Select Event', array('Select Event')+$this->DBObj->db->queryAll('SELECT id, name FROM mn_Event WHERE eventdate+INTERVAL 1 YEAR>=NOW() ORDER BY eventdate DESC', 0, null, true), array('onchange'=>'refreshEvent()') ),'fild[5]'); $form->addElement('calendar', 'added', 'Payment Date'); $data = Session::getData('admin/event/report', 'formFields'); if (empty($data['added'])) { $form->setDefaults(array('added'=>mktime())); } $form->setSubmitTitle('Register'); if (empty($data)) { return $form; } if (isset($data['id_event'])) { $form->getElement('id_event')->setValue($data['id_event']);; } if (isset($data['fild'][5])) { $form->getElement('fild[5]')->setValue($data['fild'][5]); } if (isset($data['added'])) { $form->getElement('added')->setValue($data['added']); } Session::clearData('admin/event/report', 'formFields'); $this->Doc->addInitFunction('refreshEvent'); return $form; } function getChooseEventForm() { require_once 'class/Form/Form.class.php'; $form = new Form($this->Doc, 'form_choose_event'.strtolower(get_class($this->DBObj)), $method, '', '_self', array('class'=>'form form_choose_event_'.strtolower(get_class($this->DBObj)))); $form->addElement('hidden', 'id_member', $this->DBObj->id_individual); $form->addElement('select', 'id_event', 'Event', $this->DBObj->getEvent4Select(), array('style'=>'width:400px')); $form->addRuleRequired(array('id_event'), 'server'); $this->Doc->addItemProp('JSs', 'js/jquery.bgiframe.min.js'); $this->Doc->addItemProp('JSs', "js/jquery.ajaxQueue.js"); $form->addFormRule(array($this, 'validForm')); return $form; } function validForm($data) { $err = array(); if (!$this->DBObj->isUniqueEvent($data['id_member'], $data['id_event'])) { $err['event'] = 'This Individual is already registered for this event'; } if (!intval($data['id_event'])) { $err['event'] = 'Event not found'; } return (empty($err))?true:$err; } function doChooseEvent() { $form = $this->getChooseEventForm(); if (isset($_POST['action']) && $form->validate()) { $id_event = $form->exportValue('id_event'); require_once('class/HTTP.php'); skHTTP::redirect(BASE_URL.'/'.CURR_PAGE_FULL.'?action=form&id_event='.$id_event); } $form->addElement('hidden', 'action', 'choose_event'); $form->setSubmitTitle('Register'); $form->exec(); } function doFindEventAjax() { $res = $this->DBObj->findEvent($_REQUEST['q']); if (is_array($res) && !empty($res)) { foreach ($res as $k=>$v) { echo $v['name'].' - '.date('m/d/Y', strtotime($v['eventdate'])).'|'.$v['id']."\n"; } } exit; $this->displayJSON($res); } function doForm() { $id_event = intval($_REQUEST['id_event']); $eventData = $this->DBObj->getEventById($id_event); if (intval($eventData['id_form'])) { $EventForm = SiteMap::getObj('Event/Form/Form.php', intval($eventData['id_form'])); $form = $EventForm->getForm($this->Doc, $id_event); $form->setConstants(array('action'=>'form')); $form->addElement('hidden', 'id_event', $id_event); $form->setCancelType(FORM_CBT_CANCEL); $form->cancelUrl = Constant::get('BASE_URL').'/'.CURR_PAGE.'?action=choose_event'; if (isset($_POST['action']) && $form->validate()) { $EventForm_Req = SiteMap::getObj('Event/Form/Req/Req.php', intval($eventData['id_form'])); $EventForm_Req->id_member = $this->DBObj->id_individual; $EventForm_Req->initFromForm($form); $EventForm_Req->save($id_event, $EventForm->AuthorizeNetResponce); Session::setData(CURR_PAGE, 'msg', 'Registration complete'); $this->doBack(); } else { $form->setSubmitTitle('Complete Registration'); $form->exec(); } } else { $EventForm_Req = SiteMap::getObj('Event/Form/Req/Req.php', intval($eventData['id_form'])); $EventForm_Req->id_member = $this->DBObj->id_individual; $EventForm_Req->save($id_event, $EventForm->AuthorizeNetResponce); Session::setData(CURR_PAGE, 'msg', 'Registration completed'); $this->doBack(); } } function doList() { $this->Doc->addItem(array('tpl'=>'text.tpl','text'=>'Event List for '.$this->DBObj->db->queryOne('SELECT CONCAT(first_name, " ",last_name) FROM mn_Member WHERE id='.(int)$this->DBObj->id_individual))); parent::doList(); } }