Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function render($parameters = array()) {
- $this->template->setFile(dirname(__FILE__) . '/MiniCalendar.latte');
- $this->template->headings = array(
- $this->_translator->translate('UNIVERSAL__MONDAY_SHORT'),
- $this->_translator->translate('UNIVERSAL__TUESDAY_SHORT'),
- $this->_translator->translate('UNIVERSAL__WEDNESDAY_SHORT'),
- $this->_translator->translate('UNIVERSAL__THURSDAY_SHORT'),
- $this->_translator->translate('UNIVERSAL__FRIDAY_SHORT'),
- $this->_translator->translate('UNIVERSAL__SATURDAY_SHORT'),
- $this->_translator->translate('UNIVERSAL__SUNDAY_SHORT'));
- $this->template->days_in_this_week = 1;
- $this->template->day_counter = 0;
- $this->template->dates_array = array();
- $this->template->h = $this->_pom;
- $session = $this->_parent->getSession('myCalendar');
- if ($session->calData) {
- $this->template->running_day = date('w', mktime(0, 0, 0, $session->calData['month'], 0, $session->calData['year']));
- $this->template->days_in_month = date('t', mktime(0, 0, 0, $session->calData['month'], 1, $session->calData['year']));
- $dt = new \Nette\DateTime();
- $dt->setDate($session->calData['year'], $session->calData['month'], 1);
- $this->template->pizza = $this->_helper->getActionsByDatesForCalendar($dt); //CalendarModel::getData($session->calData['month'], $session->calData['year']);
- $this->template->year = $session->calData['year'];
- $this->template->month = intval($session->calData['month']); //($session->calData['month'] < 10) ? '0' . $session->calData['month'] : $session->calData['month'];
- } else {
- $this->template->running_day = date('w', mktime(0, 0, 0, date('n'), 0, date('Y')));
- $this->template->days_in_month = date('t', mktime(0, 0, 0, date('n'), 1, date('Y')));
- $dt = new \Nette\DateTime();
- $dt->setDate($dt->format('Y'), $dt->format('m'), 1);
- $this->template->pizza = $this->_helper->getActionsByDatesForCalendar($dt); // array(); //CalendarModel::getData(date('m'), date('Y'));
- $this->template->year = date('Y');
- $this->template->month = date('n');
- }
- $sessionActions = $this->_parent->getSession($this->_sessionKey);
- $this->template->showActions = array();
- if (isset($sessionActions->start) and isset($sessionActions->end)) {
- $this->template->showActions = $this->_helper->fetchAll(array(
- 'from <=' => $sessionActions->end,
- 'to >=' => $sessionActions->start
- ), 'from');
- unset($sessionActions->start);
- unset($sessionActions->end);
- }
- $this->template->translatedText = array(0 => $this->_translator->translate("F_OK"),
- 1 =>$this->_translator->translate("UNIVERSAL__ACTIONS_FOR_DAY"));
- $this->template->render();
- }
- public function handleActions($dt) {
- $start = new \Nette\DateTime($dt);$this->_pom = $start;
- $start->setTime(0, 0, 0);
- $end = clone $start;
- $end->setTime(23, 59, 59);
- $session = $this->_parent->getSession($this->_sessionKey);
- $session->start = $start;
- $session->end = $end;
- $this->invalidateControl('dialog');
- }
- public function handleBack() {
- $session = $this->_parent->getSession('myCalendar');
- if ($session->calData['month'] === 1) {
- $session->calData['year'] = ($session->calData['year'] - 1);
- $session->calData['month'] = ($session->calData['month'] + 11);
- }
- else {
- $session->calData['month'] = ($session->calData['month'] - 1);
- }
- $this->invalidateControl('miniCalendar');$this->invalidateControl('dialog');
- }
- public function handleNext() {
- $session = $this->_parent->getSession('myCalendar');
- if ($session->calData['month'] === 12) {
- $session->calData['year'] = ($session->calData['year'] + 1);
- $session->calData['month'] = ($session->calData['month'] - 11);
- }
- else {
- $session->calData['month'] = ($session->calData['month'] + 1);
- }
- $this->invalidateControl('miniCalendar');$this->invalidateControl('dialog');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment