/**
  * List all meal follow restaurant
  */
 public function indexAction()
 {
     $this->view->headTitle('Cart information');
     $order_id = session_id();
     if (!isset($_SESSION['cart'][$order_id])) {
         $this->_redirect('');
     }
     /**
      * Get restaurant
      */
     $objRes = new Models_Restaurant();
     $res = $objRes->find($_SESSION['cart'][$order_id]['restaurant_id'])->toArray();
     $res = current($res);
     //        echo '<pre>';print_r($_SESSION);//die;
     //        echo '<pre>';print_r($res);die;
     if (false == $res) {
         $this->_redirect('');
     }
     $this->view->session_cart = $_SESSION['cart'][$order_id];
     $this->view->subtotal = $_SESSION['cart'][$order_id]['subtotal'];
     $this->view->tax = $_SESSION['cart'][$order_id]['tax'];
     $this->view->shipping = $_SESSION['cart'][$order_id]['shipping'];
     $this->view->ordertotal = $_SESSION['cart'][$order_id]['ordertotal'];
     $this->view->mark = strtoupper($_SESSION['cart'][$order_id]['order_service']);
     $this->view->date = $_SESSION['cart'][$order_id]['date'];
     $this->view->time = $_SESSION['cart'][$order_id]['time'];
     $data_info = $this->_getParam('data', false);
     $confirm = $this->_getParam('confirm', false);
     /**
      * Remember customer's infomation
      */
     if (false !== $data_info) {
         $_SESSION['cart_customer'] = $data_info;
     }
     $data_info = $_SESSION['cart_customer'];
     $this->view->full_name = $data_info['full_name'];
     $this->view->address = $data_info['address'];
     $this->view->zip_code = $data_info['zip_code'];
     $this->view->phone = $data_info['phone1'] . "." . $data_info['phone2'] . "." . $data_info['phone3'];
     $this->view->cardType = $_SESSION['cart_customer']['card_type'];
     $cardNumber = $_SESSION['cart_customer']['card_number'];
     $cardNumber[4] = 'X';
     $cardNumber[5] = 'X';
     $cardNumber[6] = 'X';
     $cardNumber[7] = 'X';
     $cardNumber[8] = 'X';
     $cardNumber[9] = 'X';
     $cardNumber[10] = 'X';
     $cardNumber[11] = 'X';
     $this->view->cardNumber = $cardNumber;
     $error = '';
     /**
      * Store to DB and redirect
      */
     if (false != $confirm) {
         /**************************************************************************
          * Make payment
          */
         require_once 'libs/paypal/CallerService.php';
         /**
          * Fist name, last name
          */
         $firstName = trim(substr($data_info['full_name'], 0, strpos($data_info['full_name'] . ' ', ' ') + 1));
         $lastName = trim(substr($data_info['full_name'], strlen($firstName)));
         /**
          * Get required parameters from the web form for the request
          */
         $paymentType = urlencode('Sale');
         $firstName = urlencode($firstName);
         $lastName = urlencode($lastName);
         $creditCardType = urlencode($data_info['card_type']);
         $creditCardNumber = urlencode($data_info['card_number']);
         $expDateMonth = urlencode($data_info['card_month']);
         // Month must be padded with leading zero
         $padDateMonth = str_pad($expDateMonth, 2, '0', STR_PAD_LEFT);
         $expDateYear = urlencode($data_info['card_year']);
         $cvv2Number = urlencode($data_info['card_cvv']);
         $address1 = urlencode($data_info['address']);
         $address2 = urlencode('');
         $city = urlencode($data_info['city']);
         $state = urlencode($data_info['state']);
         $zip = urlencode($data_info['zip_code']);
         $amount = urlencode(number_format($_SESSION['cart'][$order_id]['ordertotal'], 2, '.', ''));
         $currencyCode = "CAD";
         //            $state = 'NL';
         $country = 'CA';
         /* Construct the request string that will be sent to PayPal.
            The variable $nvpstr contains all the variables and is a
            name value pair string with & as a delimiter */
         $nvpstr = "&PAYMENTACTION={$paymentType}&AMT={$amount}&CREDITCARDTYPE={$creditCardType}&ACCT={$creditCardNumber}&EXPDATE=" . $padDateMonth . $expDateYear . "&CVV2={$cvv2Number}&FIRSTNAME={$firstName}&LASTNAME={$lastName}&STREET={$address1}&CITY={$city}&STATE={$state}" . "&ZIP={$zip}&COUNTRYCODE={$country}&CURRENCYCODE={$currencyCode}";
         //            echo $nvpstr;die;
         /* Make the API call to PayPal, using API signature.
            The API response is stored in an associative array called $resArray */
         $resArray = hash_call("doDirectPayment", $nvpstr);
         //            echo '<pre>';print_r($resArray);die;
         /* Display the API response back to the browser.
            If the response from PayPal was a success, display the response parameters'
            If the response was an error, display the errors received using APIError.php.
            */
         $ack = strtoupper($resArray["ACK"]);
         if ($ack != "SUCCESS") {
             $_SESSION['card_error_msg'] = @$resArray['L_LONGMESSAGE0'];
             $this->_redirect('restaurant/ship');
         }
         /**
          * End payment
          **************************************************************************/
         //-- begin save into db: vi_order and vi_order_detail
         $arr_order = array('sub_total' => $_SESSION['cart'][$order_id]['subtotal'], 'sales_tax' => $_SESSION['cart'][$order_id]['tax'], 'shipping_fee' => $_SESSION['cart'][$order_id]['shipping'], 'order_total' => $_SESSION['cart'][$order_id]['ordertotal'], 'date' => $_SESSION['cart'][$order_id]['date'], 'time' => $_SESSION['cart'][$order_id]['time'], 'order_service' => $_SESSION['cart'][$order_id]['order_service'], 'full_name' => $data_info['full_name'], 'address' => $data_info['address'], 'suite' => $data_info['note'], 'city' => $data_info['city'], 'state' => $data_info['state'], 'zip_code' => $data_info['zip_code'], 'phone' => $data_info['phone1'] . "." . $data_info['phone2'] . "." . $data_info['phone3'], 'email' => $data_info['email'], 'created_date' => time(), 'restaurant_id' => $_SESSION['cart'][$order_id]['restaurant_id']);
         $objOrder = new Models_Order();
         $bResultOrder = $objOrder->insert($arr_order);
         foreach ($_SESSION['cart'][$order_id] as $key => $value) {
             $arr_order_detail = array('order_id' => $bResultOrder, 'meal_id' => $value['meal_id'], 'name' => $value['name'], 'description' => $value['description'], 'price' => $value['price'], 'quantity' => $value['quantity'], 'total' => $value['total_money']);
             if (!empty($value['name'])) {
                 $objOrderDetail = new Models_OrderDetail();
                 $objOrderDetail->insert($arr_order_detail);
             }
         }
         //-- end save into db: vi_order and vi_order_detail
         /**
          * Send email to admin and user
          */
         $objUser = new Models_User();
         $objMail = new Models_Mail();
         $data = $arr_order;
         $config = Vi_Registry::getConfig();
         $data['created_date'] = date($config['dateFormat'], $data['created_date']);
         $data['card_type'] = $this->view->cardType;
         $data['card_number'] = $this->view->cardNumber;
         //            echo '<pre>';print_r($data);die;
         $cartDetail = "\n            <table width='90%'>\n                <tr>\n                    <td width='55%'></td>\n                    <td width='15%'></td>\n                    <td width='15%'></td>\n                    <td width='15%'></td>\n                </tr>\n                <tr>\n                    <td style='color: #442006; font-weight: bold;'>SHIPPING ADDRESS</td>\n                    <td colspan='3'  style='color: #442006; font-weight: bold;'>PAYMENT METHOD</td>\n                </tr> \n                <tr>\n                   <td valign='top'>\n                       <br/>\n                       <table width='400px;'>\n\n                           <tr>\n                               <td width='30%' align='right' style='background-color: #EEEEEE;'>Full Name:</td>\n                               <td width='70%' style='color: #442006;'>{$data['full_name']}</td>\n                           </tr>\n                           <tr>\n                               <td align='right' style='background-color: #EEEEEE;'>Address:</td>\n                               <td style='color: #442006;'>{$data['address']}</td>\n\n                           </tr>\n                           <tr>\n                               <td align='right' style='background-color: #EEEEEE;'>Postal Code:</td>\n                               <td style='color: #442006;'>{$data['zip_code']}</td>\n                           </tr>\n                           <tr>\n                               <td align='right' style='background-color: #EEEEEE;'>Phone:</td>\n\n                               <td style='color: #442006;'>{$data['phone']}</td>\n                           </tr>\n                       </table>\n                       <br/>\n                       \n                   </td>\n                   <td valign='top'>\n                       <br/>\n                       <table width='400px;'>\n\n                           <tr>\n                               <td width='30%' align='right' style='background-color: #EEEEEE;'>Name:</td>\n                               <td width='70%' style='color: #442006;'>{$res['name']}</td>\n                           </tr>\n                           <tr>\n                               <td align='right' style='background-color: #EEEEEE;'>Address:</td>\n                               <td style='color: #442006;'>{$res['street']}, {$res['city']}, {$res['state']}</td>\n                           </tr>\n                           <tr>\n                               <td width='30%' align='right' style='background-color: #EEEEEE;'>Phone:</td>\n                               <td width='70%' style='color: #442006;'>{$res['phone']}</td>\n                           </tr>\n                           \n                           <tr>\n                               <td colspan='2' style='color: #442006; font-weight: bold;'><br/>PAYMENT METHOD</td>\n                           </tr>\n                           <tr>\n                               <td  align='right' colspan='2'>{$data['card_type']}: {$data['card_number']}</td>\n                           </tr>\n                           \n                       </table>\n                       <br/>\n                   </td>\n\n                </tr>\n                \n                </table>\n                <table>\n                \n                <tr style='background-color: #DDDDDD;'>\n                    <td style='color: #AD5B21; font-weight: bold;'> Meal</td>\n                    <td style='color: #AD5B21; font-weight: bold;'> </td>\n                    <td style='color: #AD5B21; font-weight: bold;'> Quanlity</td>\n                    <td style='color: #AD5B21; font-weight: bold;'> Price</td>\n                    <td style='color: #AD5B21; font-weight: bold;'> Total</td>\n                </tr> ";
         foreach ($_SESSION['cart'][$order_id] as $key => $meal) {
             if (null == $meal['meal_id']) {
                 continue;
             }
             $mealImage = Vi_Registry::getConfig('liveSite') . '/' . $meal['image'];
             if (null != $meal['image']) {
                 $mealImage = '<img src="' . $mealImage . '" style="max-width: 100px;">';
             } else {
                 $mealImage = '';
             }
             if (is_numeric($key)) {
                 $cartDetail .= "\n\t                 <tr>\n\t                    <td style='border-bottom: 1px solid #DDDDDD;'>\n\t                        {$mealImage}\n\t                    </td>\n\t                    <td style='border-bottom: 1px solid #DDDDDD;'>\n\t                        <b>{$meal['name']}</b>\n\t\n\t                        <br/>\n\t                        <p>{$meal['description']}</p>\n\t                    </td>\n\t                    <td style='border-bottom: 1px solid #DDDDDD;'>{$meal['quantity']}</td>\n\t                    <td style='border-bottom: 1px solid #DDDDDD;'>\$" . number_format($meal['price'] * 1.0, 2) . "</td>\n\t                    <td style='border-bottom: 1px solid #DDDDDD;'>\$" . number_format($meal['total_money'] * 1.0, 2) . "</td>\n\t                </tr>";
             }
         }
         $cartDetail .= "   \n                <tr>\n                    <td colspan='2'> </td>\n                    <td> Subtotal </td>\n                    <td>\$" . number_format($data['sub_total'], 2) . "</td>\n\n                </tr>\n                <tr>\n                    <td colspan='2'> </td>\n                    <td> Tax </td>\n                    <td>\$" . number_format($data['sales_tax'], 2) . "</td>\n                </tr>\n                <tr>\n                    <td colspan='2'> </td>\n                    <td> Shipping fee </td>\n\n                    <td>\$" . number_format($data['shipping_fee'], 2) . "</td>\n                </tr>\n                <tr>\n                    <td colspan='2'> </td>\n                    <td> Order total </td>\n                    <td  style='color: #AD5B21; font-weight: bold;'>\$" . number_format($data['order_total'], 2) . "</td>\n                </tr>\n            </table>\n            ";
         $data['card_detail'] = $cartDetail;
         //            echo '<pre>';print_r($data);die;
         $admin = $objUser->getByUserName('admin');
         $objMail->sendHtmlMail('meal_order', $data, array($admin['email'], $data['email'], $res['owner_email']));
         /**
          * Clear session
          */
         unset($_SESSION['cart']);
         unset($_SESSION['cart_customer']);
         /**
          * Redirec to success page
          */
         $objContent = new Models_ScontentLang();
         $this->_redirect($objContent->getUrlWithoutAppBaseUrl(21));
         return;
     }
 }
 public function disableLangContentAction()
 {
     $id = $this->_getParam('id', false);
     if (false == $id) {
         $this->_redirect('scontent/admin/manager');
     }
     $ids = explode('_', trim($id, '_'));
     $objScontentLang = new Models_ScontentLang();
     try {
         foreach ($ids as $id) {
             /**
              * Check permission
              */
             $scontentLang = $objScontentLang->find($id)->toArray();
             $scontentLang = current($scontentLang);
             if (false == $this->checkPermission('edit_scontent', null, $scontentLang['lang_id'])) {
                 continue;
             }
             /**
              * Update data
              */
             $objScontentLang->update(array('enabled' => 0), array('scontent_lang_id=?' => $id));
         }
         $this->session->scontentMessage = array('success' => true, 'message' => Vi_Language::translate('Disable content successfully'));
     } catch (Exception $e) {
         $this->session->scontentMessage = array('success' => false, 'message' => Vi_Language::translate('Can NOT disable this content. Please try again'));
     }
     $this->_redirect('scontent/admin/manager');
 }
 public function finishAction()
 {
     $order_id = session_id();
     $this->view->headTitle('Reservation');
     $objReser = new Models_Reservation();
     $resId = $this->_getParam('rid', false);
     if (false === $resId) {
         $this->_redirect('');
     }
     /**
      * Get restaurant
      */
     $objRes = new Models_Restaurant();
     $res = $objRes->find($resId)->toArray();
     $res = current($res);
     if (false == $res || '0' == $res['reser_onoff']) {
         $this->_redirect('');
     }
     /**
      * Check active restaurant
      */
     $this->_checkReservationOfRestaurant($res);
     /**
      * Get search condition
      */
     $t = $this->_getParam('t', false);
     $search = $this->session->reserSearch;
     if (null == $search || false == $t || 0 >= $search['quantity']) {
         $this->_redirect('restaurant/reservation/index/rid/' . $resId);
     }
     $t = base64_decode($t);
     /**
      * Update search
      */
     $search['date'] = date('m/d/Y', $t);
     $search['time'] = date('G', $t) * 3600 + ceil(date('i', $t) / 30) * 1800;
     $search['unixTime'] = $t;
     $this->session->reserSearch = $search;
     //        echo '<pre>';print_r($search);die;
     /**
      * Check availabe at current time
      */
     $exitResers = $objReser->searchExistRerservation($t, $t, $res['reser_quantity'] - $search['quantity']);
     if (0 < count($exitResers)) {
         /**
          * Some users are faster :)
          */
         $this->_redirect('restaurant/reservation/index/rid/' . $resId);
     }
     /**
      * Submit?
      */
     $error = '';
     $data = $this->_getParam('data', false);
     //        echo '<pre>';print_r($data);die;
     if (false != $data) {
         //            echo '<pre>';print_r($data);die;
         /**
          * Insert reservation
          */
         $newData = array('restaurant_id' => $resId, 'time' => $search['unixTime'], 'quantity' => $search['quantity'], 'created_date' => time(), 'deposit' => '1' == $res['reser_deposit_onoff'] ? $res['reser_deposit'] : 0, 'full_name' => $data['full_name'], 'address' => $data['address'], 'note' => $data['note'], 'city' => $data['city'], 'state' => $data['state'], 'zip_code' => $data['zip_code'], 'phone' => $data['phone1'] . "." . $data['phone2'] . "." . $data['phone3'], 'email' => $data['email'], 'special_request' => $data['special_request']);
         $newReserId = $objReser->insert($newData);
         if ('1' == $res['reser_deposit_onoff']) {
             /**************************************************************************
              * Make payment
              */
             require_once 'libs/paypal/CallerService.php';
             /**
              * Fist name, last name
              */
             $firstName = trim(substr($data['full_name'], 0, strpos($data['full_name'] . ' ', ' ') + 1));
             $lastName = trim(substr($data['full_name'], strlen($firstName)));
             /**
              * Get required parameters from the web form for the request
              */
             $paymentType = urlencode('Sale');
             $firstName = urlencode($firstName);
             $lastName = urlencode($lastName);
             $creditCardType = urlencode($data['card_type']);
             $creditCardNumber = urlencode($data['card_number']);
             $expDateMonth = urlencode($data['card_month']);
             // Month must be padded with leading zero
             $padDateMonth = str_pad($expDateMonth, 2, '0', STR_PAD_LEFT);
             $expDateYear = urlencode($data['card_year']);
             $cvv2Number = urlencode($data['card_cvv']);
             $address1 = urlencode($data['address']);
             $address2 = urlencode('');
             $city = urlencode($data['city']);
             $state = urlencode($data['state']);
             $zip = urlencode($data['zip_code']);
             $amount = urlencode(number_format($res['reser_deposit'], 2, '.', ''));
             $currencyCode = "CAD";
             //            $state = 'NL';
             $country = 'CA';
             /* Construct the request string that will be sent to PayPal.
                The variable $nvpstr contains all the variables and is a
                name value pair string with & as a delimiter */
             $nvpstr = "&PAYMENTACTION={$paymentType}&AMT={$amount}&CREDITCARDTYPE={$creditCardType}&ACCT={$creditCardNumber}&EXPDATE=" . $padDateMonth . $expDateYear . "&CVV2={$cvv2Number}&FIRSTNAME={$firstName}&LASTNAME={$lastName}&STREET={$address1}&CITY={$city}&STATE={$state}" . "&ZIP={$zip}&COUNTRYCODE={$country}&CURRENCYCODE={$currencyCode}";
             //            echo $nvpstr;die;
             /* Make the API call to PayPal, using API signature.
                The API response is stored in an associative array called $resArray */
             $resArray = hash_call("doDirectPayment", $nvpstr);
             //            echo '<pre>';print_r($resArray);die;
             /* Display the API response back to the browser.
                If the response from PayPal was a success, display the response parameters'
                If the response was an error, display the errors received using APIError.php.
                */
             $ack = strtoupper($resArray["ACK"]);
             /**
              * End payment
              **************************************************************************/
         }
         if ('1' == $res['reser_deposit_onoff'] && $ack != "SUCCESS") {
             $error = @$resArray['L_LONGMESSAGE0'];
             /**
              * Delete reservation
              */
             $objReser->delete(array('reservation_id=?' => $newReserId));
         } else {
             /**
              * Success
              */
             /**
              * Send email to admin and user
              */
             $objUser = new Models_User();
             $objMail = new Models_Mail();
             $config = Vi_Registry::getConfig();
             $cardNumber = @$data['card_number'];
             $cardNumber[4] = 'X';
             $cardNumber[5] = 'X';
             $cardNumber[6] = 'X';
             $cardNumber[7] = 'X';
             $cardNumber[8] = 'X';
             $cardNumber[9] = 'X';
             $cardNumber[10] = 'X';
             $cardNumber[11] = 'X';
             $data['card_number'] = $cardNumber;
             $cartDetail = "\n                     <table width='90%'>\n                            <tr>\n                                <td width='55%'></td>\n                                <td width='15%'></td>\n                                <td width='15%'></td>\n                                <td width='15%'></td>\n                            </tr>\n                            <tr>\n                                <td style='color: #442006; font-weight: bold;'>SHIPPING ADDRESS</td>\n                                <td colspan='3'  style='color: #442006; font-weight: bold;'>RESTAURANT</td>\n                            </tr> \n                            <tr>\n                               <td valign='top'>\n                                   <br/>\n                                   <table width='400px;'>\n            \n                                       <tr>\n                                           <td width='30%' align='right' style='background-color: #EEEEEE;'>Full Name:</td>\n                                           <td width='70%' style='color: #442006;'>{$data['full_name']}</td>\n                                       </tr>\n                                       <tr>\n                                           <td align='right' style='background-color: #EEEEEE;'>Address:</td>\n                                           <td style='color: #442006;'>{$data['address']}</td>\n            \n                                       </tr>\n                                       <tr>\n                                           <td align='right' style='background-color: #EEEEEE;'>Postal Code:</td>\n                                           <td style='color: #442006;'>{$data['zip_code']}</td>\n                                       </tr>\n                                       <tr>\n                                           <td align='right' style='background-color: #EEEEEE;'>Phone:</td>\n            \n                                           <td style='color: #442006;'>{$data['phone1']}.{$data['phone2']}.{$data['phone3']}</td>\n                                       </tr>\n                                       <tr>\n                                           <td align='right' style='background-color: #EEEEEE;'>Special Requests:</td>\n            \n                                           <td style='color: #442006;'>{$data['special_request']}</td>\n                                       </tr>\n                                   </table>\n                                   <br/>\n                                   \n                               </td>\n                               <td valign='top'>\n                                   <br/>\n                                   <table width='400px;'>\n            \n                                       <tr>\n                                           <td width='30%' align='right' style='background-color: #EEEEEE;'>Name:</td>\n                                           <td width='70%' style='color: #442006;'>{$res['name']}</td>\n                                       </tr>\n                                       <tr>\n                                           <td align='right' style='background-color: #EEEEEE;'>Address:</td>\n                                           <td style='color: #442006;'>{$res['street']}, {$res['city']}, {$res['state']}</td>\n                                       </tr>\n                                       <tr>\n                                           <td width='30%' align='right' style='background-color: #EEEEEE;'>Phone:</td>\n                                           <td width='70%' style='color: #442006;'>{$res['phone']}</td>\n                                       </tr>" . ('1' == $res['reser_deposit_onoff'] ? "\n                                       <tr>\n                                           <td colspan='2' style='color: #442006; font-weight: bold;'><br/>PAYMENT METHOD</td>\n                                       </tr>\n                                       <tr>\n                                           <td  align='right' colspan='2'>{$data['card_type']}: {$data['card_number']}</td>\n                                       </tr>" : "") . "\n                                   </table>\n                                   <br/>\n                               </td>\n            \n                            </tr>\n                         </table>   \n                         \n                         <table width='90%'>   \n                            <tr style='background-color: #DDDDDD;'>\n                                <td width='25%' style='color: #AD5B21; font-weight: bold;'> Date</td>\n                                <td width='25%' style='color: #AD5B21; font-weight: bold;'> Time</td>\n                                <td width='25%' style='color: #AD5B21; font-weight: bold;'> Party Size</td>\n                                <td width='25%' style='color: #AD5B21; font-weight: bold;'> Deposit</td>\n                            </tr>\n                             <tr>\n                                <td style='border-bottom: 1px solid #DDDDDD;'> " . date('m/d/Y', $t) . " </td>\n                                <td style='border-bottom: 1px solid #DDDDDD;'>  " . date('g:i A', $t) . "</td>\n                                <td style='border-bottom: 1px solid #DDDDDD;'> {$search['quantity']} " . (1 == $search['quantity'] ? 'person' : 'people') . " </td>\n                                <td style='border-bottom: 1px solid #DDDDDD;'>\$ " . ('1' == $res['reser_deposit_onoff'] ? number_format($res['reser_deposit'] * 1.0, 2) : 0) . "</td>\n                            </tr>\n                            \n                        </table>\n                ";
             $data['card_detail'] = $cartDetail;
             //            echo '<pre>';print_r($data);die;
             $admin = $objUser->getByUserName('admin');
             $objMail->sendHtmlMail('reservation_order', $data, array($admin['email'], $data['email'], $res['owner_email']));
             /**
              * Redirec to success page
              */
             $objContent = new Models_ScontentLang();
             $this->_redirect($objContent->getUrlWithoutAppBaseUrl(22));
             return;
         }
     }
     /**
      * Data for view
      */
     $this->view->res = $res;
     $this->view->arr_restaurant = $res;
     $this->view->resId = $resId;
     $this->view->search = $search;
     $this->view->data = $data;
     $this->view->error = $error;
     $this->view->address_restaurant = $res['street'] . " " . $res['city'] . " " . $res['state'];
     /**
      * Expired year
      */
     $years = array();
     for ($i = date('Y'); $i <= date('Y') + 7; $i++) {
         $years[] = $i;
     }
     $this->view->years = $years;
     /**
      * All province
      */
     $obj_country = new Models_Country();
     $arr_province = $obj_country->getAllProvincesWithCode();
     $this->view->arr_province = $arr_province;
 }
 public function indexAction()
 {
     /**
      * Display tempalte
      */
     $this->view->headTitle('Find a restaurant');
     $this->view->menuId = 'home';
     /**
      * Get data
      */
     include_once 'libs/Shared/Models/User.php';
     $objUser = new Models_User();
     $objCat = new Models_Category();
     $cuisines = $objCat->getAllValues('cuisine');
     //	    $cuisines = $objUser->getAll()->toArray();
     //	    $cuisines = $objUser->getByColumnName(array(
     //	    	"username LIKE ?" => '%admin%',
     //	    	'group_id=?' => 1
     //	    ))->toArray();
     //	    echo "<pre>";print_r($cuisines);die;
     //	    $arr_time = array();
     //	    $arr_time[] = "5:30 AM";
     //	    $arr_time[] = "5:45 AM";
     //	    for( $i=6; $i<12; $i++){
     //	    	for( $j=1;$j<5;$j++ ){
     //				if ( $j==1 )
     //					$format = '00';
     //				else if ( $j==2 )
     //					$format = '15';
     //				else if ( $j==3 )
     //					$format = '30';
     //				else if ( $j==4 )
     //					$format = '45';
     //				$arr_time[] = $i.":".$format." AM";
     //			}
     //	    }
     //
     //		for( $i=1; $i<12; $i++){
     //	    	for( $j=1;$j<5;$j++ ){
     //				if ( $j==1 )
     //					$format = '00';
     //				else if ( $j==2 )
     //					$format = '15';
     //				else if ( $j==3 )
     //					$format = '30';
     //				else if ( $j==4 )
     //					$format = '45';
     //				$arr_time[] = $i.":".$format." PM";
     //			}
     //	    }
     for ($i = 5; $i < 24; $i++) {
         for ($j = 1; $j < 5; $j++) {
             if ($j == 1) {
                 $format = '00';
             } else {
                 if ($j == 2) {
                     $format = '15';
                 } else {
                     if ($j == 3) {
                         $format = '30';
                     } else {
                         if ($j == 4) {
                             $format = '45';
                         }
                     }
                 }
             }
             $arr_time[] = $i . ":" . $format;
         }
     }
     /**
      * Begin get date and month
      */
     $date_month[] = date("M jS - D");
     for ($i = 1; $i < 14; $i++) {
         $date_month[] = date("M jS - D", time() + $i * 24 * 60 * 60);
     }
     $this->view->date_month = $date_month;
     /**
      * Set variables for template
      */
     $this->view->cuisines = $cuisines;
     $this->view->arr_time = $arr_time;
     /**
      * Get content for TESTIMONIAL
      */
     $objContent = new Models_ScontentLang();
     $this->view->article = $objContent->getContent(17);
 }
Example #5
0
 public static function getContentUrl($id)
 {
     require_once 'Shared/Models/ScontentLang.php';
     $objContent = new Models_ScontentLang();
     return $objContent->getUrl($id);
 }
 public function restaurantRegister2Action()
 {
     $this->view->headTitle('Restaurant Owner Register');
     $this->setLayout('front2');
     /**
      * Article - Term of Use of Restaurant
      */
     $objContent = new Models_ScontentLang();
     $this->view->article = $objContent->getContent(19);
 }