コード例 #1
0
 public function weeklystatsAction()
 {
     $this->disableLayout();
     $this->disableViewAutoRender();
     $type = $this->getParam('type');
     $end = new Zend_Date();
     $end->setTime('23:59:59');
     $date = new Zend_Date();
     $date->sub(6, Zend_Date::DAY);
     $date->setTime('00:00:01');
     //Build reference array
     $i = 0;
     //echo $end->getTimestamp(); echo "<br>";
     while ($i <= 6) {
         $referencearray[$date->get('dd-MM-YYYY')] = 0;
         $date->add(1, Zend_Date::DAY);
         $i++;
     }
     //Get the results array
     $start = new Zend_date();
     $start->sub(6, Zend_Date::DAY);
     $start->setTime('00:00:01');
     $stat = new \Object\Stats();
     $results = $stat->getStatistics($this->selectedLocation->getId(), $start, $end);
     $startoftheweek = $start->get('dd-MM-YYYY');
     //echo $start->getTimestamp(); echo "<br>";exit;
     foreach ($this->selectedLocation->getServings() as $serving) {
         //initiate orderarray and seatsarray
         $orderarray = $referencearray;
         $seatsarray = $referencearray;
         foreach ($results as $result) {
             $datein = date("d-m-Y", $result["date_start"]);
             if ($serving->getId() == $result['serving_id']) {
                 $servingid = $result['serving_id'];
                 if (array_key_exists($datein, $referencearray)) {
                     $orderarray[$datein] = $result["nbre"];
                     $seatsarray[$datein] = $result["couverts"];
                 }
             }
         }
         if ($type == 'seats') {
             $servingarray[$serving->getTitle()] = $seatsarray;
         } else {
             $servingarray[$serving->getTitle()] = $orderarray;
         }
     }
     $reponse = new Reponse();
     $reponse->data = $servingarray;
     $reponse->message = "TXT_STATS_SENT";
     $reponse->success = true;
     $this->render($reponse);
 }
コード例 #2
0
    public function listreservationAction()
    {
        $this->layout()->setLayout('portal');
        // listreservation_layout
        $this->view->cancelled = $this->getParam('cancelled');
        $this->view->arrived = $this->getParam('arrived');
        $guestid = $this->getParam('guestid');
        $this->view->servings = $this->selectedLocation->getServings();
        if ($guestid != '') {
            $guest = Object\Guest::getById($guestid, 1);
            if ($guest instanceof Object\Guest) {
                $this->view->guestname = $guest->getLastname();
                $this->view->guesttel = $guest->getTel();
            }
            $array = array(2, 3, 4, 6, 8, 9, 10);
            $this->view->viewcol = $array;
        } else {
            $array = array(3, 4, 5, 6, 8, 9, 10);
            $this->view->viewcol = $array;
        }
        $calendar = $this->getParam('calendar');
        if ($calendar == '') {
            $date = new Zend_date();
            $calendar = $date->get('dd-MM-YYYY');
        }
        $dayafter = new Zend_date($calendar, "dd-MM-YYYY");
        $dayafter->add('24:00:00', Zend_Date::TIMES);
        $daybefore = new Zend_date($calendar, "dd-MM-YYYY");
        $daybefore->sub('24:00:00', Zend_Date::TIMES);
        $this->view->dayafter = $dayafter->get('dd-MM-YYYY');
        $this->view->daybefore = $daybefore->get('dd-MM-YYYY');
        $this->view->calendar = $calendar;
        $myservingid = $this->getParam('servingid');
        if ($myservingid != '') {
            $servingsearch = Object\Serving::getById($myservingid, 1);
            if ($servingsearch instanceof Object\Serving) {
                $servingname = $servingsearch->getTitle();
                $this->view->servingname = $servingname;
            }
        } else {
            if ($this->language == "fr") {
                $servingname = "Tous services";
            } else {
                $servingname = "All services";
            }
            $this->view->servingname = $servingname;
        }
        if ($myservingid == '' || $calendar == "") {
            $this->view->warning = "search";
        } else {
            $this->view->warning = "nosearch";
        }
        $this->reservationsArray();
        $this->view->headScript()->appendFile(PIMCORE_WEBSITE_LAYOUTS . '/assets/js/timepicker-form-elements.js');
        $this->view->headLink()->appendStylesheet(PIMCORE_WEBSITE_LAYOUTS . '/assets/plugins/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.css');
        $this->view->headScript()->appendFile(PIMCORE_WEBSITE_LAYOUTS . '/assets/plugins/select2/select2.min.js');
        $this->view->headScript()->appendFile(PIMCORE_WEBSITE_LAYOUTS . '/assets/js/table-reservation-list.js');
        $this->view->headScript()->appendFile(PIMCORE_WEBSITE_LAYOUTS . '/assets/plugins/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.js');
        $this->view->headScript()->appendFile(PIMCORE_WEBSITE_LAYOUTS . '/assets/plugins/jquery-inputlimiter/jquery.inputlimiter.1.3.1.min.js');
        $this->view->inlineScript()->appendScript('jQuery(document).ready(function() {
					Main.init();
					TableReservationList.init();
        			SVExamples.init();
        			PagesUserProfile.init();
				});', 'text/javascript', array('noescape' => true));
    }