public function holidaysAction() { try { $sessionNamespace = new Zend_Session_Namespace(); if ($sessionNamespace->loginAuth == true) { $mapper = new Gyuser_Model_HolidaysDataMapper(); $cList = $mapper->fetchAll(); $this->view->clist = $cList; } else { $this->_helper->redirector('login', 'index', 'gyuser'); } } catch (Exception $e) { echo $e; } }
public function isHoliday($dateTemp) { $isHoliday = false; if (!isset($this->_holidays)) { $mapper = new Gyuser_Model_HolidaysDataMapper(); $this->_holidays = $mapper->fetchAll(); //returns all dates from db format 'Y-m-d' } $date = date('Y-m-d', $dateTemp); if (in_array($date, $this->_holidays) || date('N', strtotime($date)) >= 6) { //is in holidays array or is a weekend day ( 6 & 7 = saturday and sunday respectively) $isHoliday = true; } return $isHoliday; }