function display($tpl = null) { // Assign data to the view $this->msg = $this->get('Msg'); // check for errors if (count($errors = $this->get('Errors'))) { JLog::dd(implode('<br />', $errors), JLog::WARNING, 'jerror'); return false; } // Display the view parent::display($tpl); }
function display($tpl = null) { $this->msg = '<h1>' . JText::_('COM_EASYRESERVATION_RESERVABLES') . '</h1>'; foreach ($this->get('Reservables') as $reservable) { $this->msg .= '<br />' . $reservable->id . ' ' . $reservable->name; } // check for errors if (count($errors = $this->get('Errors'))) { JLog::dd(implode('<br />', $errors), JLog::WARNING, 'jerror'); return false; } // Display the view parent::display($tpl); }
function display($tpl = null) { $this->user = JFactory::getUser(); $this->occupations = $this->get('Occupations'); $this->reservables = $this->get('Reservables'); $this->start_date = $this->get('StartDate'); $days = $this->get('Days') - 1; $startHour = $this->get('StartHour'); $endHour = $this->get('EndHour'); $this->msg('<table class="occupation_table">')->nl(); $this->msg('<thead><tr>'); $this->tag(' ', 'th'); foreach (range(0, $days) as $i) { $this->tag($this->convertDate($this->addDays($this->start_date, $i)), 'th', 'colspan="' . count($this->reservables) . '"' . $this->css_class($this->days($i))); } $this->msg('</tr>')->nl(); $this->msg('<tr>'); $this->tag(JText::_('COM_EASYRESERVATION_OCCUPATION_TIME'), 'th'); foreach (range(0, $days) as $i) { foreach ($this->reservables as $reservable) { $this->tag($reservable->name, 'th', $this->css_class($this->days($i))); } } $this->msg('</tr></thead><tbody>')->nl(); foreach (range($startHour, $endHour) as $time) { $this->msg('<tr>'); $this->tag("{$time}:00 - " . ($time + 1) . ':00', 'td', 'align="center"'); foreach (range(0, $days) as $i) { foreach ($this->reservables as $reservable) { $this->printOccupation($i, $time, $reservable->id); } } $this->msg('</tr>')->nl(); } $this->msg('</tbody></table>')->nl(); if ($this->user->id > 0) { $this->link('COM_EASYRESERVATION_OCCUPATION_NEW_RESERVATION', 'index.php?option=com_easyreservation&view=newreservation'); $this->msg(' '); $this->link('COM_EASYRESERVATION_OCCUPATION_MY_RESERVATIONS', 'index.php?option=com_easyreservation&view=reservations'); } else { $this->link('COM_EASYRESERVATION_OCCUPATION_SUBMIT_LOGIN', 'index.php?option=com_users&view=login'); } // check for errors if (count($errors = $this->get('Errors'))) { JLog::dd(implode('<br />', $errors), JLog::WARNING, 'jerror'); return false; } // Display the view parent::display($tpl); }
function display($tpl = null) { $this->reservables = $this->get('Reservables'); $jinput = JFactory::getApplication()->input; if ($jinput->get('cancel', null) == '1' || JFactory::getUser()->id == 0) { return $this->back(); } $model = $this->getModel(); if ($jinput->get('submit', null) == '1') { JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); if ($model->newReservation() == true) { return $this->back(); } } $this->input_data = $model->getInputData(); // check for errors if (count($errors = $this->get('Errors'))) { JLog::dd(implode('<br />', $errors), JLog::WARNING, 'jerror'); print_r($errors); return false; } // Display the view parent::display($tpl); }
function display($tpl = null) { $user = JFactory::getUser(); if ($user->id == 0) { $JFactory::getApplication()->redirect(JUri::current()); return; } $model = $this->getModel(); $this->cancel(JFactory::getApplication()->input->get('cancel')); $this->delete(JFactory::getApplication()->input->get('delete')); $this->msg = '<h1>' . JText::_(COM_EASYRESERVATION_RESERVATIONS) . "</h1>\n"; $this->msg .= "<table class='reservations'>\n<thead><tr>"; if ($user->authorise('core.admin')) { $this->msg .= '<th class="optional">' . JText::_(COM_EASYRESERVATION_RESERVATIONS_ID) . '</th>'; } $this->msg .= '<th>' . JText::_(COM_EASYRESERVATION_RESERVATIONS_RESERVABLE) . '</th>'; $this->msg .= '<th class="optional">' . JText::_(COM_EASYRESERVATION_RESERVATIONS_TYPE) . '</th>'; $this->msg .= '<th>' . JText::_(COM_EASYRESERVATION_RESERVATIONS_DATE) . '</th>'; $this->msg .= '<th>' . JText::_(COM_EASYRESERVATION_RESERVATIONS_TIME) . '</th>'; $this->msg .= '<th class="optional">' . JText::_(COM_EASYRESERVATION_RESERVATIONS_CREATED) . '</th>'; if ($user->authorise('core.admin')) { $this->msg .= '<th class="optional">' . JText::_(COM_EASYRESERVATION_RESERVATIONS_USER) . '</th>'; $this->msg .= '<th class="optional">' . JText::_(COM_EASYRESERVATION_RESERVATIONS_NAME) . '</th>'; } $this->msg .= '<th>' . JText::_(COM_EASYRESERVATION_RESERVATIONS_STATUS) . '</th>'; $this->msg .= '<th> </th>'; $this->msg .= '<th> </th>'; $this->msg .= "</tr></thead><tbody>\n"; foreach ($this->get('MyReservations') as $reservation) { $this->msg .= '<tr>'; if ($user->authorise('core.admin')) { $this->msg .= '<td class="optional">' . $reservation->id . '</td>'; } $this->msg .= '<td>' . $reservation->id_reservable . '</td>'; $this->msg .= '<td class="optional">' . JText::_('COM_EASYRESERVATION_NEW_RESERVATION_LABEL_TYPE' . $reservation->reservation_type) . '</td>'; $this->msg .= '<td>' . $this->date($reservation->start_time) . '</td>'; $this->msg .= '<td>' . $this->time($reservation->start_time) . ' - ' . $this->time($reservation->end_time) . '</td>'; $this->msg .= '<td class="optional">' . $reservation->created . '</td>'; if ($user->authorise('core.admin')) { $this->msg .= '<td class="optional">' . JFactory::getUser($reservation->user_id)->name . '</td>'; $this->msg .= '<td class="optional">' . $reservation->name . '</td>'; } if ($reservation->status == 1) { $this->msg .= '<td>' . JText::_(COM_EASYRESERVATION_RESERVATIONS_CANCELLED) . '</td>'; } else { $this->msg .= '<td>' . JText::_(COM_EASYRESERVATION_RESERVATIONS_RESERVED) . '</td>'; } if ($model->canCancel($reservation->id)) { $this->msg .= '<td>'; $this->showLinkCancel($reservation->id); $this->msg .= '</td>'; } else { $this->msg .= '<td> </td>'; } if ($user->authorise('core.admin')) { $this->msg .= '<td>'; $this->showLinkDelete($reservation->id); $this->msg .= '</td>'; } else { $this->msg .= '<td> </td>'; } $this->msg .= "</tr>\n"; } $this->msg .= "</tbody></table>\n"; $this->msg .= '<a href="' . JRoute::_('index.php') . '">'; $this->msg .= JText::_(COM_EASYRESERVATION_BACK); $this->msg .= "</a>\n"; // check for errors if (count($errors = $this->get('Errors'))) { JLog::dd(implode('<br />', $errors), JLog::WARNING, 'jerror'); return false; } // Display the view parent::display($tpl); }