コード例 #1
0
 public function getholidaysAction()
 {
     try {
         $request = $this->getRequest();
         if ($this->getRequest()->isPost()) {
             $mapper = new Gyuser_Model_HolidaysDataMapper();
             $Obj = new Gyuser_Model_Holidays();
             $this->_helper->layout->disableLayout();
             $this->_helper->viewRenderer->setNoRender();
             $result = json_encode($mapper->fetchAllJson());
             if ($result) {
                 echo $result;
             } else {
                 echo "f";
             }
         }
     } catch (Exception $e) {
         echo $e;
     }
 }
コード例 #2
0
 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;
 }