'event-registration-recipients-left-id', 'topItem' => 'event-registration-list-top' ); protected $_queueMessageBoxTemplate = 'Event/Form/Req/queue-message-box.tpl'; function EventForm_Req_Grid(&$Page, &$DBObj) { $this->actions['export_to_csv'] = 'doExportCSV'; $this->actions['export_to_xls'] = 'doExportXLS'; $this->actions['dailyreport'] = 'doDailyReportForm'; $this->actions['signin'] = 'doSignInReport'; $this->actions['mail'] = 'doMailReport'; $this->actions['roster'] = 'doRosterReport'; $this->actions['daily'] = 'doDailyReport'; $this->actions['team'] = 'doTeamReport'; $this->actions['add_attendee'] = 'doAddAttendee'; $this->actions['showmember'] = 'doShowMember'; $this->actions['payments'] = 'doPayments'; $this->actions['assigncredit'] = 'doCECreditsForm'; $this->actions['findmember'] = 'doFindMember'; $this->actions['savecredits'] = 'doSaveCredits'; $this->actions['setattend'] = 'doSetAttend'; $this->actions['savechanges'] = 'doSaveChanges'; $this->actions['cancel'] = 'doBack'; $this->actions['pulse-portal-export'] = 'doPulsePortalExport'; $this->actions['sendCertificate'] = '_doSendCertificate'; $this->actions['resendCertificate'] = '_doSendCertificate'; $this->actions['sendCertificates'] = '_doSendCertificates'; $this->actions['getQueueStatus'] = '_doGetQueueStatus'; $this->actions['renderList'] = '_doRenderList'; $this->DB_Grid($Page, $DBObj); } function doDailyReportForm() { require_once 'class/Form/Form.class.php'; $form = new Form($this->Doc, 'reportform', 'get', Constant::get('BASE_URL') . '/' . CURR_PAGE . "show", '_blank', array('class' => 'form form_' . strtolower(get_class($this->DBObj)))); $form->tpl = 'tpl/Event/dailyreportform.tpl'; $form->setRendType(FORM_RENDERER_ARRAY_SMARTY); $date = &$form->addElement('calendar', 'date'); $date->setValue(mktime()); $hAction=$form->addElement('hidden', 'action'); $hAction->setValue('daily'); $form->addElement('select', 'groupby', '', array('event'=>'Events', 'payment' => 'Payment Types')); $form->addElement('submit', 'submit', 'Get Report', array('class' => 'btn')); $form->exec(); } function _bindFormFields(Form $form) { $this->getEventObj()->id = $this->DBObj->getData('id_event'); $options = $this->getEventObj()->getExistingTeams4Select($this->_getData('id_team')); $form->addElement('select', 'id_team', 'Team Name', array('0' => '- None -') + (array) $options); $form->addFormRule(array($this, 'validateForm')); return $form; } function validateForm(array $data) { $errors = array(); if ($data['id_team'] && !$this->DBObj->hasTeamPlace($this->getEventObj()->id, $data['id_team'])) { $errors['id_team'] = 'The selected team has no place'; } return empty($errors) ? true : $errors; } function _getEditForm() { $this->DBObj->initFromDB(); return parent::_getEditForm(); } function doEdit() { $form = $this->_getEditForm(); if (null === ($item = $this->DBObj->getData())) { $this->Doc->display404(); return; } $form->setDefaults($item); $this->renderForm($form); } function doUpdate() { $this->DBObj->initFromDB(); return parent::doUpdate(); } function renderForm(Form $form) { $form->return_form_arr = true; $item = $this->DBObj->getData(); $this->getEventObj()->initFromDB(); if (Event::GROUP_TYPE == $this->getEventObj()->getData('id_type')) { $item['form'] = $form->exec(); } $item['backUrl'] = CURR_PAGE . '?action=cancel'; $item['tpl'] = 'Event/Form/Req/edit.tpl'; $this->Doc->addContent($item); } function doSetAttendAjax() { $attended = (int) $_REQUEST['attend']; $this->DBObj->_data = array('attended' => $attended); $this->DBObj->update(); if (!$attended) { $this->DBObj->deleteCertificate(); } $sql = "SELECT `id_event`, `id_member` FROM mn_EventFormReq WHERE `id` = ".(int)$this->DBObj->id; $res = $this->DBObj->db->queryRow($sql); Qs_Db::isError($res); $sql = "SELECT `ce_credits` FROM mn_Event WHERE `id` = ".$this->DBObj->db->quote($res['id_event'], 'integer'); $res2 = $this->DBObj->db->queryRow($sql); Qs_Db::isError($res2); $nCredits = $res2['ce_credits']; $sql = 'SELECT * FROM mn_EventCECreditHistory WHERE id_individual = '.$this->DBObj->db->quote($res['id_member'], 'integer').' AND id_event = '.$this->DBObj->db->quote($res['id_event'], 'integer'); $nRows = $this->DBObj->db->queryAll($sql); Qs_Db::isError($nRows); $nRows = count($nRows); if(!$nRows && (int)$_REQUEST['attend'] && $nCredits>0) { $sql = 'INSERT INTO mn_EventCECreditHistory (id_individual, id_event, event_date, name, credits, added, changed) SELECT id_member, e.id, eventdate, name, "' . $nCredits . '", NOW(), NOW() FROM mn_EventFormReq efr INNER JOIN mn_Event e ON efr.id_event=e.id WHERE e.id=' . $this->DBObj->db->quote($res['id_event'], 'integer') . ' AND attended=1 AND `deleted` = "n" AND id_member NOT IN ( SELECT id_individual FROM mn_EventCECreditHistory WHERE id_event=' . $this->DBObj->db->quote($res['id_event'], 'integer') . ')'; Qs_Db::isError($this->DBObj->db->query($sql)); } elseif($nRows && !(int)$_REQUEST['attend']) { $sql = 'DELETE FROM mn_EventCECreditHistory WHERE id_individual = '.$this->DBObj->db->quote($res['id_member'], 'integer').' AND id_event = '.$this->DBObj->db->quote($res['id_event'], 'integer'); Qs_Db::isError($this->DBObj->db->query($sql)); } $response = $this->_getListInfoResponse(array($this->DBObj->id)); $this->displayJSON($response); } function doSaveChangesAjax() { $this->DBObj->_data=array('added'=>$_REQUEST['new_date'],'payment_type'=>(int)$_REQUEST['new_pay_meth'],'amount'=>(int)$_REQUEST['new_amount']); $this->DBObj->update(); $response = array( 'isValid' => true, 'notCompletedQueueItemIds' => $this->DBObj->getNotCompletedQueueItemIds() ); $this->displayJSON($response); } function addLink() { $addLink = array( 'tpl' => 'center_link.tpl', 'link_list' => array( array('title' => 'Event: ' . $this->DBObj->getEventNameByID()), array( 'link' => 'admin/event/group-report/' . $this->DBObj->id_event, 'title' => 'Group Mode' ), array( 'link' => Constant::get('BASE_URL') . '/' . CURR_PAGE . '?action=add_attendee' . '&id_event=' . $this->DBObj->id_event, 'title' => 'Add Attendee' ) ) ); $this->Doc->addContent($addLink); } function getFilterForm() { $form = parent::getFilterForm(); $form->addElement('hidden', 'id_event', $this->DBObj->id_event); $form->removeElement('cancel_btn'); // $form->updateElementAttr('cancel', // array( // 'onclick' => "document.location.href='" . Constant::get('BASE_URL') . '/' . CURR_PAGE . "?id_event=" . $this->DBObj->id_event . "'")); return $form; } function getReportForm() { require_once 'class/Form/Form.class.php'; $form = new Form($this->Doc, 'reportform', 'get', Constant::get('BASE_URL') . '/' . CURR_PAGE . "show?id_event=" . $this->DBObj->id_event, '_blank', array('class' => 'form form_' . strtolower(get_class($this->DBObj)))); $form->tpl = 'tpl/Event/reportform.tpl'; $form->setRendType(FORM_RENDERER_ARRAY_SMARTY); $aReportTypes = array( '' => 'Choose a Report -->', 'signin' => 'Sign In Sheets', 'mail' => 'Full .csv Download', 'roster' => 'Roster', 'pulse-portal-export' => 'Pulse Portal Export' ); if ($this->DBObj->getEventTypeByID() == 4) $aReportTypes['team'] = $this->DBObj->getGroupNameByID() . ' report'; $form->addElement('select', 'action', '', $aReportTypes); // , array('onchange' => 'showdate(this.value)', 'onclick' => 'showdate(this.value)') $form->addElement('hidden', 'id_event', $this->DBObj->id_event); $form->addElement('submit', 'submit', 'Download', array('class' => 'btn')); $this->Doc->addItemProp('JSs', 'js/report_functions.js'); $this->Doc->addItemProp('JSs', 'js/jquery.blockUI.js'); $options = array( 'eventId' => $this->DBObj->id_event, 'ids' => $this->_queueMessageHtmlIds, 'notCompletedQueueItemIds' => $this->DBObj->getNotCompletedQueueItemIds() ); $this->Doc->addInitObject('App_Event_Registration', array($options), 'appEventRegistration'); return $form; } function getEventObj() { if (null === $this->_eventObj) { require_once('app/Event/Event.php'); $this->_eventObj = new Event(Qs_Request::getRequestValue('id_event')); } return $this->_eventObj; } function doList() { $this->_saveBackUrl(); $this->addLink(); $filterForm = $this->getFilterForm(); $this->DBObj->setFilter($filterForm->getElementValue('query')); $filterForm->exec(); $reportForm = $this->getReportForm(); $reportForm->exec(); $this->_addTopListItem(); 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(); $this->Doc->addContent( array( 'tpl' => 'text.tpl', 'text' => '' . '' . '
' . '
' . '' . '
' ) ); return true; } protected function _addTopListItem() { $this->Doc->addItem($this->_getTopListItem()); } protected function _renderTopListItem() { $item = $this->_getTopListItem(); $this->Doc->assign('item', $item); return $this->Doc->fetch($item['tpl']); } protected function _getTopListItem() { $item = array( 'certificateRecipientsCount' => $this->DBObj->getCertificateRecipientsCount(), 'membersCountWithoutReLicenseNumber' => $this->DBObj->getMembersCountWithoutReLicenseNumber(), 'averageIndustryExperience' => $this->DBObj->getAverageIndustryExperience(), 'education' => $this->DBObj->getEventDataById('education'), 'ce_credits' => $this->DBObj->getEventCreditsById(), '_ids' => $this->_queueMessageHtmlIds, 'tpl' => 'Event/Form/Req/list-top.tpl' ); return $item; } function &_getDataGrid4Export() { require_once 'Structures/DataGrid.php'; $datagrid = & new Structures_DataGrid(); $datagrid->addColumn(new Structures_DataGrid_Column('Added', 'added', 'added')); $flds = $this->_getFlds(); foreach ($flds as $fld) { $datagrid->addColumn(new Structures_DataGrid_Column($fld['label'], 'f_' . $fld['id'])); } $filtFrm = $this->getFilterForm(); $this->DBObj->setFilter($filtFrm->getElementValue('query')); $data = $this->DBObj->getlist4Grid(array('order_by' => 'added DESC')); $out = array(); foreach ($data['list'] as $key => $row) { $out[$key] = array('added' => $row['added'], 'ip' => $row['ip']); foreach ($flds as $fld) { $out[$key]['f_' . $fld['id']] = (string) $row[$fld['id']]; } } $test = $datagrid->bind($out); if (PEAR::isError($test)) { echo $test->getMessage(); } return $datagrid; } function doExportXLS() { $datagrid = $this->_getDataGrid4Export(); $datagrid->setRenderer(DATAGRID_RENDER_XLS, array('filename' => 'Form_Mail_export.xls')); $datagrid->render(); exit(); return true; } function doExportCSV() { $datagrid = $this->_getDataGrid4Export(); $datagrid->setRenderer(DATAGRID_RENDER_CSV, array('filename' => 'Form_Mail_export.csv')); $datagrid->render(); exit(); return true; } function _getFlds() { $Field = SiteMap::getObj('FormMail/Field/Field.php', $this->DBObj->id_fm); $fields = $Field->getList4Grid(array('order_by' => 'sorter')); return $fields['list']; } function _doListBind(DB_List $list) { $list->def_order_by = $this->DBObj->tableName . '.added'; $list->urlVarNames[] = 'id_fm'; $list->urlVarNames[] = 'id_event'; $list->tableAttribs['id'] = 'event-attendee-grid'; $list->insertColLast( 'registered', array( 'title' => 'Date Registered', 'width' => '120', 'tpl' => constant('DB_LIST_CELL_DATE'), 'order_by' => $this->DBObj->tableName . '.added', 'date_format' => '%B %e, %Y', 'params' => array('added') ) ); $list->insertColLast( 'attendee', array( 'title' => 'Attendee Name, Company', 'tpl' => constant('DB_LIST_CELL_TEXT'), 'order_by' => 'attendee', 'params' => array('attendee') ) ); $list->insertColLast( 'payment', array( 'title' => 'Payment Type', 'width' => '100', 'tpl' => constant('DB_LIST_CELL_TEXT'), 'order_by' => 'payment', 'params' => array('payment') ) ); $list->insertColLast( 'amount', array( 'title' => 'Amount', 'width' => '50', 'tpl' => constant('DB_LIST_CELL_MONEY'), 'order_by' => 'amount', 'params' => array('amount') ) ); $list->insertColLast( 'reLicense', array( 'title' => 'RE License', 'tpl' => constant('DB_LIST_CELL_TEXT_CENTER'), 'order_by' => 'member_re_license_number', 'params' => array('member_re_license_number') ) ); $list->insertColLast( 'attended', array( 'title' => 'Attended', 'order_by'=> 'attended_title', 'width' => 50, 'tpl' => 'Event/List/cells/attendance.tpl', 'params' => array('id', 'attended_title'), ) ); if ($this->DBObj->getEventDataById('education')) { $list->insertColLast( 'ceCertificate', array( 'title' => 'CE Certificate', 'tpl' => 'Event/List/cells/ce_certificate.tpl', ) ); } $list->insertColLast( 'options', array( 'title' => 'Options', 'width' => 120, 'tpl' => 'Event/List/cells/options.tpl', 'edit_link' => Constant::get('BASE_URL') . '/' . CURR_PAGE . '?action=edit&id=', 'del_link' => Constant::get('BASE_URL') . '/' . CURR_PAGE . '?action=del&id=', 'params' => array('id') ) ); $list->ipp = 1048576; return true; } function doSignInReport() { $DB_List = $this->getListReport(); $DB_List->reportname = 'Sign-In Sheets'; $DB_List->def_order_by = "person"; $DB_List->insertColLast('person', array('tpl' => DB_LIST_CELL_TEXT, 'params' => array('person'))); $DB_List->insertColLast('email', array('tpl' => DB_LIST_CELL_TEXT, 'params' => array('email'))); $DB_List->name = 'signin'; $DB_List->ipp = 1048576; $this->DBObj->report = 'signin'; $this->execListReport($DB_List); } function doMailReport() { $this->DBObj->report = 'mail'; $aList = $this->DBObj->getList4Grid(); header('Content-Type: text/csv;'); header('Content-Disposition: attachment; filename=report.csv'); // echo ("\"First Name,Last Name,Phone,Designation,Email,RE License,Company,Company Address,Company City,Company State,Company Zip,Amount Paid,Payment Type,Date\"\r\n"); echo ("Agent ID, First Name,Last Name,Phone,Designation,Email,RE License,Company ID,Company,Company Address,Company City,Company State,Company Zip,Amount Paid,Payment Type,Payment Date,Attended\r\n"); foreach ($aList['list'] as $aPerson) { echo ('"'.$aPerson['id'] . '","'.$aPerson['first_name'] . '","' . $aPerson['last_name'] . '","' . $aPerson['primary_phone'] . '","' . $aPerson['designations'] . '","' . $aPerson['email'] . '","' . $aPerson['re_license_number'] . '","' . $aPerson['id_company'] . '","' . $aPerson['name'] . '","' . $aPerson['mailing_address'] . '","' . $aPerson['mailing_city'] . '","' . $aPerson['mailing_state'] . '","' . $aPerson['mailing_zip'] . '","' . $aPerson['amount'] . '","' . $aPerson['payment'] . '","' . $aPerson['added'] . '","' . $aPerson['attended'] . "\"\r\n"); } die(); } function doRosterReport() { $DB_List = $this->getListReport(); $this->DBObj->report = 'roster'; $DB_List->insertColFirst('nrds_id', array('title' => 'NRDS ID', 'width' => '120', 'tpl' => DB_LIST_CELL_TEXT, 'order_by' => 'payment,m.nrds_id', 'params' => array('nrds_id'))); $this->_doRosterBind($DB_List); $DB_List->removeCol('phone'); $DB_List->reportname = 'Roster'; $DB_List->summarycolspan = 4 ; $this->execListReport($DB_List); return true; } function getListReport() { require_once ('class/DB/List/List.php'); $DB_List = new DB_List($this->Doc, $this->DBObj, $this->functionalFields); $DB_List->urlVarNames[] = 'id_fm'; $DB_List->urlVarNames[] = 'id_event'; $DB_List->urlVarNames[] = 'action'; $DB_List->name = 'report'; return $DB_List; } function execListReport($DB_List) { $this->Doc->setTitle($this->DBObj->getEventNameByID()); $DB_List->ipp=1048576; $DB_List->eventname = $this->DBObj->getEventNameByID(); $DB_List->eventdate = $this->DBObj->getEventDateByID(); // vdie($DB_List); $DB_List->exec(); return true; } function _doRosterBind(&$DB_List, $mainorder='payment') { $DB_List->mainorder=$mainorder; $DB_List->def_order_by = $mainorder.",last_name,first_name"; $DB_List->insertColLast('member', array('title' => 'Name', 'width' => '200', 'tpl' => DB_LIST_CELL_TEXT, 'order_by' => $mainorder.',last_name,first_name', 'params' => array('member_name'))); $DB_List->insertColLast('company', array('title' => 'Company', 'width' => '200', 'tpl' => DB_LIST_CELL_TEXT, 'order_by' => $mainorder.',company_name', 'params' => array('company_name'))); $DB_List->insertColLast('phone', array('title' => 'Phone', 'width' => '180', 'tpl' => DB_LIST_CELL_TEXT, 'order_by' => $mainorder.',phone', 'params' => array('phone'))); $DB_List->insertColLast('email', array('title' => 'Email', 'width' => '180', 'tpl' => DB_LIST_CELL_TEXT, 'order_by' => $mainorder.',email', 'params' => array('email'))); $DB_List->insertColLast('amount', array('title' => 'Amount', 'width' => '180', 'tpl' => DB_LIST_CELL_MONEY, 'order_by' => $mainorder.',amount', 'params' => array('amount'))); $DB_List->insertColLast('registered', array('title' => 'Date', 'width' => '180', 'tpl' => DB_LIST_CELL_DATE, 'order_by' => $mainorder.',added', 'date_format' => '%D', 'params' => array('added'))); $DB_List->bind(); return true; } function doDailyReport() { $DB_List = $this->getListReport(); $this->DBObj->report = 'daily'; $this->DBObj->date_registered = $_REQUEST['date']['Y'] . '-' . $_REQUEST['date']['M'] . '-' . $_REQUEST['date']['d']; $DB_List->reportname = $_REQUEST['date']['M'] . '/' . $_REQUEST['date']['d'] . '/' . $_REQUEST['date']['Y'] . ' - Daily Online Payments Report'; $DB_List->daily=1; $DB_List->urlVarNames[] = 'date'; /*if ($_REQUEST['groupby']!='payment') $this->_doRosterBind($DB_List,'event_name'); else */ $DB_List->insertColFirst('member_id', array('title' => 'Agent ID', 'width' => '120', 'tpl' => DB_LIST_CELL_TEXT, 'order_by' => 'payment,event_name,member_id', 'params' => array('member_id'))); $this->_doRosterBind($DB_List,'payment,event_name'); $DB_List->removeCol('phone'); $DB_List->removeCol('email'); $DB_List->summarycolspan = 3; /* if ($_REQUEST['groupby']!='payment') { $DB_List->insertColAfter('payment', array('title' => 'Payment Type', 'width' => '150', 'tpl' => DB_LIST_CELL_TEXT, 'order_by' => 'payment', 'params' => array('payment')),'company'); } else { $DB_List->insertColAfter('event', array('title' => 'Event', 'width' => '150', 'tpl' => DB_LIST_CELL_TEXT, 'order_by' => 'payment,event_name', 'params' => array('event_name')),'company'); }*/ $this->execListReport($DB_List); return true; } function doTeamReport() { require_once('app/Event/Event.php'); $eventObj = new Event($this->DBObj->id_event); $item = array( 'tpl' => 'List/team-list.tpl', 'teams' => $eventObj->getTeamPersons4Report(), 'reportname' => ucfirst($this->DBObj->getGroupNameByID()) . 's List', 'eventname' => $this->DBObj->getEventNameByID(), 'eventdate' => $this->DBObj->getEventDateByID() ); $this->Doc->addContent($item); } function doAddAttendee() { $this->DBObj->id_fm = $id_fm = $this->DBObj->getFormIDByID() ? $this->DBObj->getFormIDByID() : 3; $EventForm = SiteMap::getObj('Event/Form/Form.php', $id_fm); $form = $EventForm->getForm($this->Doc, $this->DBObj->id_event); $form->insertElementBefore(Form::createElement('calendar', 'added', 'Payment Date'), $form->_elements[1]->_attributes['name']); $form->insertElementBefore(Form::createElement('text', 'member', 'Search member', array('id' => 'member', 'style' => 'width:300px;')), $form->_elements[0]->_attributes['name']); $Event = SiteMap::getObj('Event/Event.php', $this->DBObj->id_event); $Event->initFromDB(); if (!$Event->getData('member_cost') && !$Event->getData('nonmember_cost')) $cCost='Free'; elseif (!$Event->getData('member_cost')) $cCost='Member: Free, Non-Member: $'.number_format($Event->getData('nonmember_cost'),2); elseif (!$Event->getData('nonmember_cost')) $cCost='Member: $'.number_format($Event->getData('member_cost'),2); else $cCost='Member: $'.number_format($Event->getData('member_cost'),2).', Non-Member: $'.number_format($Event->getData('nonmember_cost'),2); $cEventInfo=''; if ($Event->getData('address')) $cEventInfo.=''; $cEventInfo.='
Event Name:'.$Event->getData('name').'
When:'.$Event->getData('eventdate').'
Where:'.$Event->getData('address').' (View Map)
Cost:'.$cCost.'
CE Credits:'.$Event->getData('ce_credits').'
'; $form->insertElementBefore(Form::createElement('static', 'eventinfo', 'Event', $cEventInfo), 'member'); $form->addElement('hidden', 'id_member', '', array('id' => 'member_id')); $form->addElement('hidden', 'action', 'add_attendee'); $form->addElement('hidden', 'id_event', $this->DBObj->id_event); $form->addFormRule(array($this, 'validmember')); $form->setSubmitTitle("Add"); $form->cancelUrl = $this->_getBackUrlEx(Qs_Request::getRequestValue('sessionName')); $form->cancelType = FORM_CBT_CANCEL; $form->setTitle('Add attendee to '.$this->DBObj->getEventNameByID()); $form->addElement('hidden', 'sessionName'); $defaults = Qs_Request::getGet(); $defaults = array_intersect_key($defaults, array_fill_keys(array('team_option', 'sessionName', 'id_team'), '')); $form->setDefaults($defaults); $this->Doc->addItemProp('JSs', "js/jquery.bgiframe.min.js"); $this->Doc->addItemProp('JSs', "js/jquery.ajaxQueue.js"); $this->Doc->addItemProp('JSs', "js/thickbox-compressed.js"); $this->Doc->addItemProp('JSs', "js/jquery.autocomplete.js"); $this->Doc->addItemProp('JSs', "js/event_functions.js"); $this->Doc->addItemProp('CSSs', "css/jquery.autocomplete.css"); $this->Doc->addContent(array('tpl'=>'text.tpl','text'=>'')); if ($this->DBObj->getEventTypeByID() == 4) $this->Doc->addItemProp('initFuncs', 'showteaminfo'); $this->Doc->addItemProp('initFuncs', 'setautocomplete'); $form->setDefaults(array('added'=>mktime())); switch ($_REQUEST['subaction']) { case 'submit' : if ($form->validate()) { $this->DBObj->initFromForm($form); $this->DBObj->save($this->DBObj->id_event); Session::setData(Session::getData('admin/event/report','backUrlMsg'), 'msg', 'Attendee added'); require_once 'class/HTTP.php'; $sessionName = $form->exportValue('sessionName'); $membersCount = 1 + count(Qs_Request::getPostValue('anothermember_emails', array())); if (!empty($sessionName)) { $url = $this->getBackUrl($sessionName); $message = 'New ' . Qs_Translate::getPlural('member', $membersCount) . ' ' . Qs_Translate::getPlural(array('has', 'have'), $membersCount) . ' ' . 'been successfully added'; switch ($form->exportValue('team_option')) { case 'newteam': $message .= ' to newly created team'; break; case 'exisitingteam': $message .= ' to existing team'; break; default: break; } $this->setBackMessage($message, $sessionName); } else { $url = Session::getData('admin/event/report', 'backUrl'); } skHTTP::redirect($url); } else { if (strpos(Session::getData('admin/event/report','backUrl'),'member/event_history')===false) { $form->addElement('hidden', 'subaction', 'submit'); $form->exec(); } else { require_once 'class/HTTP.php'; $errors = array_unique($form->_errors); Session::setData( Session::getData('admin/event/report','backUrlMsg'), 'msg', implode('
', $errors) ); $formFields = array( 'id_member' => $_REQUEST['id_member'], 'id_event' => $_REQUEST['id_event'], 'fild' => $_REQUEST['fild'], 'added' => $_REQUEST['added'], 'amount' => $_REQUEST['amount'], ); Session::setData('admin/event/report', 'formFields', $formFields); skHTTP::redirect(Session::getData('admin/event/report','backUrl').'?action=new'); } } break; default : Session::setData('admin/event/report','backUrl',Constant::get('BASE_URL') . '/' . CURR_PAGE . '/?id_event=' . $this->DBObj->id_event); Session::setData('admin/event/report','backUrlMsg',CURR_PAGE); $form->addElement('hidden', 'subaction', 'submit'); $form->exec(); break; } } protected function _getBackUrlEx($sessionName = null) { if (!empty($sessionName)) { return $this->getBackUrl($sessionName); } $url = Session::getData('admin/event/report', 'backUrl'); if (empty($url)) { $url = BASE_URL . '/' . CURR_PAGE . '?id_event=' . $this->DBObj->id_event; } return $url; } function validmember(&$aData) { if (!$aData['id_member']) { $aData['id_member']=$this->DBObj->db->queryOne('SELECT id FROM mn_Member WHERE email='.$this->DBObj->db->quote($aData['member'])); if (!$aData['id_member']) return array('member' => 'Please enter a valid MNCAR Member'); } $nRegistered=$this->DBObj->db->queryOne('SELECT id FROM mn_EventFormReq WHERE id_member='.$this->DBObj->db->quote($aData['id_member']).' AND deleted="n" AND id_event='.$this->DBObj->db->quote($aData['id_event'])); if ($nRegistered) return array('member' => 'This member is already registered to this event'); else return true; } function doShowMemberAjax($companyFlag = false, $excludedMemberId = null) { $cFilter = strtolower($_GET["q"]); if (!$cFilter) die(); require_once ('app/Event/EventMember.php'); $eventMember = EventMember::getInstance(); if ($companyFlag) { $members = $eventMember->getMembersWithCompanyForEventRegistration($cFilter, $excludedMemberId); } else { $members = $eventMember->getMembersWithLocationForEventRegistration($cFilter, $excludedMemberId); } $eventObj = $this->getEventObj(); $eventObj->initFromDB(); foreach ($members as $member) { $field = Member::hasMemberCost($member) ? 'member_cost' : 'nonmember_cost'; /* event with type 2 - Open Event, event with type 3 - Brokerage Basics. Only for this events can be nonmember cost * 1- Member Event, 4 - Group Event * * This condition is here, because: * Event_Show::doRegistrationForm() use this condition for allowing registration on event */ if ((in_array($eventObj->getData('id_type'), array(2, 3)) || Member::hasEventRegistration($member))) { echo str_replace('|', '/', $member['member']) . "|" . $member['id'] . "|" . number_format($eventObj->getData($field), 2) . "\n"; } } die(); } function doPayments() { $this->Doc->addContent(array('tpl' => 'center_link.tpl', 'title' => 'Back to Events', 'link' => BASE_URL . '/' . PARENT_PAGE)); $filterForm = $this->getFilterForm(); $this->DBObj->setFilter($filterForm->getElementValue('query')); $filterForm->addElement('hidden', 'action', 'payment'); $filterForm->removeElement('cacnel'); $filterForm->addElement('button', 'cancel', 'Cancel', array('class' => 'btn', 'onclick' => "document.location.href='" . Constant::get('BASE_URL') . '/' . CURR_PAGE . "?action=payments&id_event=" . $this->DBObj->id_event . "'")); $filterForm->exec(); $DB_List = $this->getListReport(); $this->DBObj->report = 'payments'; $DB_List->urlVarNames[] = 'id_event'; $DB_List->urlVarNames[] = 'action'; unset($DB_List->name); // = 'payments'; $DB_List->eventname = $this->DBObj->getEventNameByID(); $this->_doPaymentBind($DB_List); $DB_List->exec(); return true; } function _doPaymentBind(&$DB_List) { $DB_List->insertColLast('registered', array('title' => 'Date Registered', 'width' => '180', 'tpl' => DB_LIST_CELL_DATE, 'order_by' => 'added', 'date_format' => '%B %e, %Y %I:%M %p', 'params' => array('added'))); $DB_List->insertColLast('attendee', array('title' => 'Attendee Name, Company', 'width' => '240', 'tpl' => DB_LIST_CELL_TEXT, 'order_by' => 'attendee', 'params' => array('attendee'))); $DB_List->insertColLast('amount', array('title' => 'Amount', 'width' => '120', 'tpl' => DB_LIST_CELL_MONEY, 'order_by' => 'amount', 'params' => array('amount'))); $DB_List->insertColLast('id_transaction', array('title' => 'AuthorizeNet Transaction ID', 'width' => '180', 'tpl' => DB_LIST_CELL_TEXT, 'params' => array('id_transaction'))); $DB_List->bind(); } function doCECreditsForm() { require_once ('class/DB/List/List.php'); $this->_saveBackUrl(); $DB_List = new DB_List($this->Doc, $this->DBObj, $this->functionalFields); $DB_List->urlVarNames[] = 'id_fm'; $DB_List->urlVarNames[] = 'id_event'; $DB_List->urlVarNames[] = 'action'; $DB_List->name = 'cecredits'; $this->DBObj->report = 'cecredits'; $DB_List->insertColFirst('nrds_id', array('title' => 'NRDS #', 'width' => '100', 'tpl' => DB_LIST_CELL_TEXT, 'params' => array('nrds_id'))); $DB_List->insertColLast('member', array('title' => 'Name', 'width' => '180', 'tpl' => DB_LIST_CELL_TEXT, 'params' => array('member_name'))); $DB_List->insertColLast('company', array('title' => 'Company', 'width' => '150', 'tpl' => DB_LIST_CELL_TEXT, 'params' => array('company'))); $DB_List->insertColLast('location', array('title' => 'Location', 'width' => '150', 'tpl' => DB_LIST_CELL_TEXT, 'params' => array('location'))); $DB_List->insertColLast('attended', array('title' => 'Attended?', 'width' => '60', 'tpl' =>'Event/List/cells/attended.tpl', 'params' => array('id', 'attended'))); $DB_List->insertColLast('credits', array('title' => 'Credits', 'width' => '60', 'tpl' =>DB_LIST_CELL_TEXT, 'params' => array('credits'))); $DB_List->eventname = $this->DBObj->getEventNameByID(); $DB_List->eventdate = $this->DBObj->getEventDateByID(); $DB_List->id_event = $this->DBObj->id_event; $DB_List->credits = $this->DBObj->getCECreditsByID(); $DB_List->ipp=1048576; $DB_List->def_order_by='m.last_name, m.first_name'; $DB_List->exec(); $this->Doc->addItemProp('JSs','js/report_functions.js'); return true; } function doFindMemberAjax() { $nrdsId = ctype_digit($_REQUEST['nrds_id']) ? $_REQUEST['nrds_id'] : 0; if ($nrdsId) { $aResult=$this->DBObj->db->queryRow("SELECT m.id, m.first_name, m.middle_initial, m.last_name, c.name company, CONCAT(l.name,' (',l.physical_city,')') location FROM mn_Member m LEFT JOIN mn_Location l ON m.id_location=l.id LEFT JOIN mn_Company c ON l.id_company=c.id LEFT JOIN mn_EventFormReq efr ON m.id=efr.id_member AND id_event=".(int)$_REQUEST['id_event']." WHERE efr.id_member IS NULL AND m.nrds_id=" . S_db2::quoteBigInt($nrdsId)); if ($aResult) echo "". $nrdsId ." ".$aResult['first_name']." ".$aResult['middle_initial'].($aResult['middle_initial']?". ":"").$aResult['last_name']." ".$aResult['company']." ".$aResult['location']."
"; } die(); } function doSaveCredits() { $this->DBObj->savecredits($_REQUEST['id_event'], $_REQUEST['attended'], $_REQUEST['newattendee'], $_REQUEST['credits_count']); Session::setData($this->_getPage4SaveMessage(), 'msg', 'CE Credits updated'); $this->doBack(); } function doPulsePortalExport() { $statement = $this->DBObj->getPulsePortalExportStatement(); $columns = array( 'StateAbbreviation' => 'State Abbreviation', 'ProviderID' => 'Provider ID', 'CourseID' => 'Course ID', 'CourseOfferingEndDate' => 'Course Offering End Date', 'CourseOfferingBeginDate' => 'Course Offering Begin Date', 'CourseOfferingBeginTime' => 'Course Offering Begin Time', 'PostalCodeforCourseOffering' => 'Postal Code for Course Offering', 'InstructionHours' => 'Instruction Hours', 'SocialSecurityNumber' => 'Social Security Number', 'NationalProducerNumber' => 'National Producer Number', 'LicenseNumber' => 'License Number', 'LastName' => 'Last Name', 'InstructionCategoryCode' => 'Instruction Category Code' ); $fileName = 'PulsePortalExport_' . date('Y-m-d_H-i-s') . '.csv'; $this->_exportCsv($statement, $columns, $fileName); } protected function _doSendCertificate() { $this->DBObj->initFromDB(); $data = $this->DBObj->getData(); $this->DBObj->id_event = $data['id_event']; $this->DBObj->removeQueue(array('id_event' => $data['id_event'], 'id_member' => $data['id_member'])); $this->DBObj->addQueue(array('id' => $data['id'])); if (true !== ($error = $this->_runQueue())) { $this->_setBackError($error); } $this->doBack(); } protected function _runQueue() { $url = BASE_URL_HTTP . '/__send-certificates'; if (defined('SITE_AUTH_LOGIN') && defined('SITE_AUTH_PASSWORD')) { $url = str_replace( '://', '://' . constant('SITE_AUTH_LOGIN') . ':' . constant('SITE_AUTH_PASSWORD') . '@' , $url ); } if (true !== ($error = Qs_Job::start($url))) { switch ($error) { case Qs_Job::ERROR_CONNECTION_FAILED: return 'Can not start sending process. Connection Failed.'; case Qs_Job::ERROR_WRITE_SOCKET: return 'Can not start sending process. Socket Write Error.'; default: break; } } return true; } protected function _doSendCertificatesAjax() { $totalRecipients = $this->DBObj->addQueue(); $message = $this->_getCertificateAddedToQueueMessage($totalRecipients); $response = array( 'isValid' => $totalRecipients > 0 ); if (true !== ($error = $this->_runQueue())) { sendDeveloperEmail($error); $response['isValid'] = false; $response['redirectUrl'] = $this->_getBackUrlEx(); $message = $error; } if ($response['isValid']) { $item = compact('totalRecipients', 'message'); $item['recipientsLeft'] = $totalRecipients; $response['message'] = $this->_renderQueueMessageBox($item); } else { $response['message'] = $message; } $this->displayJSON($response); } protected function _doGetQueueStatusAjax() { $response = array( 'isValid' => true, 'recipientsLeft' => $this->DBObj->getRecipientsLeft() ); if (!$response['recipientsLeft']) { $this->_setBackMessage('All certificates are sent successfully.'); $response['redirectUrl'] = $this->_getBackUrlEx(); } $this->displayJSON($response); } protected function _renderQueueMessageBox(array $item) { $item['_ids'] = $this->_queueMessageHtmlIds; $this->Doc->assign('item', $item); return $this->Doc->fetch($this->_queueMessageBoxTemplate); } protected function _doSendCertificates() { $affectedRows = $this->DBObj->addQueue(); $this->setBackMessage($this->_getCertificateAddedToQueueMessage($affectedRows)); $this->doBack(); } protected function _getCertificateAddedToQueueMessage($affectedRows) { if (!$affectedRows) { return 'Currently there are no active CE certificates available'; } return Qs_Translate::getPlural(array('CE certificate is', 'CE certificates are'), $affectedRows) . ' set into a queue for ' . $affectedRows . ' mail ' . Qs_Translate::getPlural('recipient', $affectedRows) . '.'; } protected function _doRenderList() { die(); } protected function _doRenderListAjax() { $ids = Qs_Request::getGetValue('notCompletedQueueItemIds'); $response = $this->_getListInfoResponse($ids); $this->displayJSON($response); } protected function _getListInfoResponse($ids) { $response = array( 'isValid' => true, 'notCompletedQueueItemIds' => $this->DBObj->getNotCompletedQueueItemIds(), 'callbacks' => array( array('appEventRegistration.updateListTopItem' => array(array('html' => $this->_renderTopListItem()))) ) ); if (!empty($ids)) { $this->DBObj->addFilter(array('id' => $ids)); $response['listInfo'] = $this->_getListInfo(); } return $response; } protected function _getListInfo($columns = array('ceCertificate')) { require_once ('class/DB/List/List.php'); $DB_List = new DB_List($this->Doc, $this->DBObj, $this->functionalFields); $this->_doListBind($DB_List); $item = $DB_List->toArray(); $result = array(); $this->Doc->assign('item', $item); foreach ($item['items'] as $row) { $this->Doc->assign('row', $row); $result[$row['id']] = array(); $resultRow = &$result[$row['id']]; foreach ($item['column'] as $name => $row_format) { if (!in_array($name, $columns)) { continue; } $this->Doc->assign('row_format', $row_format); $resultRow['cells'][$name] = array( 'html' => trim($this->Doc->fetch($row_format['tpl'])) ); } } return $result; } }