protected function beforeSave() { if (empty($this->timestamp)) { $this->timestamp = time(); } $this->lastUpdated = time(); if (!empty($this->user) && $this->isNewRecord) { $eventsData = X2Model::model('EventsData')->findByAttributes(array('type' => $this->type, 'user' => $this->user)); if (isset($eventsData)) { $eventsData->count++; } else { $eventsData = new EventsData(); $eventsData->user = $this->user; $eventsData->type = $this->type; $eventsData->count = 1; } $eventsData->save(); } if ($this->type == 'record_deleted') { $this->text = preg_replace('/(<script(.*?)>|<\\/script>)/', '', $this->text); } return parent::beforeSave(); }
public function delete_event() { $id = $_GET[id]; EventsData::delete_event($id); $this->set('events', EventsData::get_upcoming_events()); $this->set('history', EventsData::get_past_events()); $this->show('events/events_index.tpl'); }
public function listAllAction() { if ($this->view->aclIsAllowed('events', 'edit', true)) { // NEW LIST GENERATOR CODE // $tables = array('EventsData' => array('ED_ID', 'ED_CategoryID'), 'EventsIndex' => array('EI_EventsDataID', 'EI_LanguageID', 'EI_Title', 'EI_Status'), 'Status' => array('S_Code'), 'CategoriesIndex' => array('CI_Title')); $field_list = array('EI_Title' => array('width' => '300px'), 'CI_Title' => array(), 'S_Code' => array('width' => '80px', 'postProcess' => array('type' => 'dictionnary', 'prefix' => 'status_'))); $events = new EventsData(); $select = $events->select()->from('EventsData')->setIntegrityCheck(false)->join('EventsIndex', 'EventsData.ED_ID = EventsIndex.EI_EventsDataID')->join('Status', 'EventsIndex.EI_Status = Status.S_ID')->joinRight('CategoriesIndex', 'EventsData.ED_CategoryID = CategoriesIndex.CI_CategoryID')->joinRight('Categories', 'EventsData.ED_CategoryID = Categories.C_ID')->joinRight('Languages', 'Languages.L_ID = EventsIndex.EI_LanguageID')->where('EI_LanguageID = ?', $this->_defaultEditLanguage)->where('EventsIndex.EI_LanguageID = CategoriesIndex.CI_LanguageID')->where('C_ModuleID = ?', $this->_moduleID); //->order('EI_Title'); $options = array('commands' => array($this->view->link($this->view->url(array('controller' => 'index', 'action' => 'add')), $this->view->getCibleText('button_add_events'), array('class' => 'action_submit add'))), 'filters' => array('events-category-filter' => array('default_value' => null, 'associatedTo' => 'ED_CategoryID', 'choices' => Cible_FunctionsCategories::getFilterCategories($this->_moduleID)), 'events-status-filter' => array('label' => 'Filtre 2', 'default_value' => null, 'associatedTo' => 'S_Code', 'choices' => array('' => $this->view->getCibleText('filter_empty_status'), 'online' => $this->view->getCibleText('status_online'), 'offline' => $this->view->getCibleText('status_offline')))), 'action_panel' => array('width' => '50', 'actions' => array('edit' => array('label' => $this->view->getCibleText('button_edit'), 'url' => "{$this->view->baseUrl()}/events/index/edit/eventID/%ID%/lang/%LANG%/return/list-all/", 'findReplace' => array(array('search' => '%ID%', 'replace' => 'ED_ID'), array('search' => '%LANG%', 'replace' => 'L_Suffix'))), 'delete' => array('label' => $this->view->getCibleText('button_delete'), 'url' => "{$this->view->baseUrl()}/events/index/delete/eventID/%ID%/return/list-all/", 'findReplace' => array('search' => '%ID%', 'replace' => 'ED_ID'))))); $mylist = new Cible_Paginator($select, $tables, $field_list, $options); $this->view->assign('mylist', $mylist); } }
if ($pilot->pilotid == Auth::$pilotid) { echo ' <a href="' . SITE_URL . '/index.php/events/remove_signup?id=' . $pilot->pilotid . '&event=' . $event->id . '">- Remove</a>'; } echo '<br />'; } $slot_time = $slot_time + $event->slot_interval * 60; } echo '</td>'; } else { echo '<td>Available Signups</td>'; echo '<td align="left">'; $slot_time = strtotime($event->time); $slots = 1; while ($slots <= $event->slot_limit) { $test = date('G:i', $slot_time); $check2 = EventsData::signup_time($event->id, $test); if (!$check2) { echo date('G:i', $slot_time) . ' - <a href="' . SITE_URL . '/index.php/events/signup?eid=' . $event->id . '&pid=' . Auth::$userinfo->pilotid . '&time=' . date('G:i', $slot_time) . '">Open</a><br />'; $slots++; } else { $pilot = PilotData::getPilotData($check2->pilot_id); echo date('G:i', $slot_time) . ' - '; echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid) . ' - '; echo $pilot->firstname . ' ' . $pilot->lastname . '<br />'; } $slot_time = $slot_time + $event->slot_interval * 60; } echo '</td>'; ?> </tr> <?php