public function renderView()
    {
        $badges_feature = new Collection('badge', $this->context->language->id);
        $badges_feature->where('type', '=', 'feature');
        $badges_feature->orderBy('id_group');
        $badges_feature->orderBy('group_position');
        $badges_achievement = new Collection('badge', $this->context->language->id);
        $badges_achievement->where('type', '=', 'achievement');
        $badges_achievement->orderBy('id_group');
        $badges_achievement->orderBy('group_position');
        $badges_international = new Collection('badge', $this->context->language->id);
        $badges_international->where('type', '=', 'international');
        $badges_international->orderBy('id_group');
        $badges_international->orderBy('group_position');
        $groups = array();
        $query = new DbQuery();
        $query->select('DISTINCT(b.`id_group`), bl.group_name, b.type');
        $query->from('badge', 'b');
        $query->join('
			LEFT JOIN `' . _DB_PREFIX_ . 'badge_lang` bl ON bl.`id_badge` = b.`id_badge`');
        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
        foreach ($result as $res) {
            $groups['badges_' . $res['type']][$res['id_group']] = $res['group_name'];
        }
        $badges_type = array('badges_feature' => array('name' => $this->l('Features'), 'badges' => $badges_feature), 'badges_achievement' => array('name' => $this->l('Achievements'), 'badges' => $badges_achievement), 'badges_international' => array('name' => $this->l('International'), 'badges' => $badges_international));
        $levels = array(1 => $this->l('1. Beginner'), 2 => $this->l('2. Pro'), 3 => $this->l('3. Expert'), 4 => $this->l('4. Wizard'), 5 => $this->l('5. Guru'), 6 => $this->l('6. Legend'));
        $this->tpl_view_vars = array('badges_type' => $badges_type, 'current_level_percent' => (int) Configuration::get('GF_CURRENT_LEVEL_PERCENT'), 'current_level' => (int) Configuration::get('GF_CURRENT_LEVEL'), 'groups' => $groups, 'levels' => $levels);
        return parent::renderView();
    }
 public function renderView()
 {
     return parent::renderView();
 }
Esempio n. 3
0
 public function renderView()
 {
     $wucsbhfmgn = "attachments";
     global $cookie;
     ${"GLOBALS"}["jhgmum"] = "product";
     ${"GLOBALS"}["zzymivhfx"] = "token_customer";
     if (!(${${"GLOBALS"}["ptwoeyrfnrc"]} = $this->loadObject())) {
         return;
     }
     ${${"GLOBALS"}["rfvzmfktr"]} = AgileSellerMessenger::prepareAttFolder(intval($obj->id_seller));
     $kmosrdjmm = "obj";
     ${"GLOBALS"}["fxbwhkf"] = "customer";
     ${${"GLOBALS"}["dmlrlbkzxy"]} = "";
     $zuonusz = "folder";
     if (!empty($obj->attpsname1) and file_exists(${${"GLOBALS"}["rfvzmfktr"]} . $obj->attpsname1)) {
         ${$wucsbhfmgn} .= "<a href=\"index.php?controller=AgileSellerMessages&id_agile_sellermessage=" . $obj->id . "&viewagile_sellermessage" . "&token=" . $this->token . "&filename=" . $obj->attpsname1 . "&id_seller=" . $obj->id_seller . "\" title=\"" . $this->l('View file') . "\">" . $obj->attshname1 . "</a> &nbsp&nbsp";
     }
     ${"GLOBALS"}["wfbwnbuigg"] = "attachments";
     $ifbpmef = "product";
     if (!empty($obj->attpsname2) and file_exists(${${"GLOBALS"}["rfvzmfktr"]} . $obj->attpsname2)) {
         ${${"GLOBALS"}["wfbwnbuigg"]} .= "<a href=\"index.php?controller=AgileSellerMessages&id_agile_sellermessage=" . $obj->id . "&viewagile_sellermessage" . "&token=" . $this->token . "&filename=" . $obj->attpsname2 . "&id_seller=" . $obj->id_seller . "\" title=\"" . $this->l('View file') . "\">" . $obj->attshname2 . "</a> &nbsp&nbsp";
     }
     $uouvtcjcp = "token_customer";
     if (!empty($obj->attpsname3) and file_exists(${$zuonusz} . $obj->attpsname3)) {
         ${${"GLOBALS"}["dmlrlbkzxy"]} .= "<a href=\"index.php?controller=AgileSellerMessages&id_agile_sellermessage=" . $obj->id . "&viewagile_sellermessage" . "&token=" . $this->token . "&filename=" . $obj->attpsname3 . "&id_seller=" . $obj->id_seller . "\" title=\"" . $this->l('View file') . "\">" . $obj->attshname3 . "</a> &nbsp&nbsp";
     }
     ${${"GLOBALS"}["jhgmum"]} = new Product($obj->id_product, false, $cookie->id_lang);
     ${${"GLOBALS"}["unijnuf"]} = Tools::getAdminToken("AdminProducts" . (int) Tab::getIdFromClassName("AdminProducts") . (int) $this->context->employee->id);
     if ($obj->id_customer > 0) {
         $nqjepkbzgqw = "customer";
         ${$nqjepkbzgqw} = new Customer($obj->id_customer);
         ${"GLOBALS"}["wathklt"] = "token_customer";
         ${${"GLOBALS"}["wathklt"]} = Tools::getAdminToken("AdminCustomers" . (int) Tab::getIdFromClassName("AdminCustomers") . (int) $this->context->employee->id);
     }
     $this->tpl_view_vars = array("is_seller" => $this->is_seller, "the_message" => ${$kmosrdjmm}, "customer" => isset(${${"GLOBALS"}["bcfmhhzd"]}) ? ${${"GLOBALS"}["fxbwhkf"]} : null, "product" => ${$ifbpmef}, "tokenCustomer" => isset(${$uouvtcjcp}) ? ${${"GLOBALS"}["zzymivhfx"]} : null, "tokenProduct" => isset(${${"GLOBALS"}["unijnuf"]}) ? ${${"GLOBALS"}["unijnuf"]} : null, "hide_email" => intval(Configuration::get("ASMGER_HIDE_EMAIL")), "attachments" => ${${"GLOBALS"}["dmlrlbkzxy"]});
     return parent::renderView();
 }
 /**
  * render main view
  * @return mixed
  */
 public function renderView()
 {
     $action = Tools::getValue('action');
     // set main settings
     $this->setSettings();
     if (!empty($this->apikey)) {
         switch ($action) {
             case 'api':
                 $this->apiView();
                 break;
             case 'exportcustomers':
                 $this->exportView();
                 break;
             case 'viapage':
                 $this->viapageView();
                 break;
             case 'viawebform':
                 $this->viawebformView();
                 break;
             case 'automation':
                 $this->automationView();
                 break;
             default:
                 $this->apiView();
         }
     } else {
         $this->apiView();
     }
     return parent::renderView();
 }
 public function renderView()
 {
     $check_calender_var = 0;
     $obj_booking_dtl = new HotelBookingDetail();
     $obj_htl_info = new HotelBranchInformation();
     $obj_rm_type = new HotelRoomType();
     $obj_cart_book_data = new HotelCartBookingData();
     $id_cart = $this->context->cart->id;
     $id_guest = $this->context->cookie->id_guest;
     $this->context->smarty->assign(array('id_cart' => $id_cart, 'id_guest' => $id_guest));
     $cart_bdata = $obj_cart_book_data->getCartBookingDetailsByIdCartIdGuest($id_cart, $id_guest);
     if ($cart_bdata) {
         $cart_tamount = $this->context->cart->getOrderTotal();
         $this->context->smarty->assign(array('cart_bdata' => $cart_bdata, 'cart_tamount' => $cart_tamount));
     }
     // No use of adult, child, num_rooms
     $adult = 0;
     $children = 0;
     $num_rooms = 1;
     if (Tools::isSubmit('search_hotel_list')) {
         $date_from = Tools::getValue('from_date');
         $date_to = Tools::getValue('to_date');
         $hotel_id = Tools::getValue('hotel_id');
         $room_type = Tools::getValue('room_type');
         if ($date_from == '') {
             $this->errors[] = Tools::displayError('Date From is required field.');
         }
         if ($date_to == '') {
             $this->errors[] = Tools::displayError('Date To is required field.');
         }
         if ($date_to <= $date_from) {
             $this->errors[] = Tools::displayError('Date To should be greater than Date From.');
         }
         if ($hotel_id == '') {
             $this->errors[] = Tools::displayError('Hotel name is required field.');
         }
         $booking_data = array();
         $booking_calendar_data = array();
         $check_css_condition_var = '';
         if (!count($this->errors)) {
             $booking_data = $obj_booking_dtl->getBookingData($date_from, $date_to, $hotel_id, $room_type, $adult, $children, $num_rooms, 0, 1, 1, 1, 1, $id_cart, $id_guest, 1);
             if ($booking_data) {
                 foreach ($booking_data['rm_data'] as $key => $value) {
                     if ($value['data']['partially_available']) {
                         foreach ($value['data']['partially_available'] as $key1 => $value1) {
                             if ($value1['avai_dates']) {
                                 foreach ($value1['avai_dates'] as $key2 => $value2) {
                                     $explode_date = explode(' ', $value2);
                                     $date_start = date('Y-m-d', strtotime($explode_date[0]));
                                     $date_end = date('Y-m-d', strtotime($explode_date[2]));
                                     $result = $obj_cart_book_data->checkExistanceOfRoomInCurrentCart($value1['id_room'], $date_start, $date_end, $id_cart, $id_guest);
                                     if ($result) {
                                         $room_in_cart = true;
                                     } else {
                                         $room_in_cart = false;
                                     }
                                     $booking_data['rm_data'][$key]['data']['partially_available'][$key1]['check_cart'][$key2]['in_current_cart'] = $room_in_cart;
                                     $booking_data['rm_data'][$key]['data']['partially_available'][$key1]['check_cart'][$key2]['id_cart'] = $this->context->cart->id;
                                     $booking_data['rm_data'][$key]['data']['partially_available'][$key1]['check_cart'][$key2]['cart_booking_data_id'] = $result;
                                 }
                             }
                         }
                     }
                 }
                 foreach ($booking_data['rm_data'] as $avil_k => $avail_v) {
                     if ($avail_v['data']['available']) {
                         foreach ($avail_v['data']['available'] as $avil_k1 => $avail_v1) {
                             $result = $obj_cart_book_data->checkExistanceOfRoomInCurrentCart($avail_v1['id_room'], $date_from, $date_to, $id_cart, $id_guest);
                             if ($result) {
                                 $room_in_cart = true;
                             } else {
                                 $room_in_cart = false;
                             }
                             $booking_data['rm_data'][$avil_k]['data']['available'][$avil_k1]['in_current_cart'] = $room_in_cart;
                             $booking_data['rm_data'][$avil_k]['data']['available'][$avil_k1]['id_cart'] = $this->context->cart->id;
                             $booking_data['rm_data'][$avil_k]['data']['available'][$avil_k1]['cart_booking_data_id'] = $result;
                         }
                     }
                 }
                 foreach ($booking_data['rm_data'] as $booked_k => $booked_v) {
                     if ($booked_v['data']['booked']) {
                         foreach ($booked_v['data']['booked'] as $booked_k1 => $booked_v1) {
                             $cust_obj = new Customer($booked_v1['id_customer']);
                             $booking_data['rm_data'][$booked_k]['data']['booked'][$booked_k1]['alloted_cust_name'] = $cust_obj->firstname . ' ' . $cust_obj->lastname;
                             $booking_data['rm_data'][$booked_k]['data']['booked'][$booked_k1]['alloted_cust_email'] = $cust_obj->email;
                             $booking_data['rm_data'][$booked_k]['data']['booked'][$booked_k1]['avail_rooms_to_swap'] = $obj_booking_dtl->getAvailableRoomsForSwaping($booked_v1['date_from'], $booked_v1['date_to'], $booked_v1['id_product'], $booked_v1['id_hotel']);
                         }
                     }
                 }
             }
             //sumit to show info of every date
             $start_date = $date_from;
             // hard-coded '01' for first day
             $last_day_this_month = $date_to;
             while ($start_date <= $last_day_this_month) {
                 $cal_date_from = $start_date;
                 $cal_date_to = date('Y-m-d', strtotime($cal_date_from) + 86400);
                 $booking_calendar_data[$cal_date_from] = $obj_booking_dtl->getBookingData($cal_date_from, $cal_date_to, $hotel_id, $room_type, $adult, $children, $num_rooms, 1, 1, 1, 1, 1, $id_cart, $id_guest, 1);
                 $start_date = date('Y-m-d', strtotime($start_date) + 86400);
             }
             if ($num_rooms <= $booking_data['stats']['num_avail']) {
                 $check_css_condition_var = 'available';
             } else {
                 if ($num_rooms <= $booking_data['stats']['num_part_avai']) {
                     $check_css_condition_var = 'part_available';
                 } else {
                     $check_css_condition_var = 'unavailable';
                 }
             }
         }
     } else {
         $check_calender_var = 1;
         $date_from = date('Y-m-d');
         $date_to = date('Y-m-d', strtotime($date_from) + 86400);
         $hotel_id = 1;
         $room_type = 0;
         $booking_data = $obj_booking_dtl->getBookingData($date_from, $date_to, $hotel_id, $room_type, $adult, $children, $num_rooms, 0, 1, 1, 1, 1, $id_cart, $id_guest, 1);
         // ddd($booking_data);
         if ($booking_data) {
             foreach ($booking_data['rm_data'] as $key => $value) {
                 if ($value['data']['partially_available']) {
                     foreach ($value['data']['partially_available'] as $key1 => $value1) {
                         if ($value1['avai_dates']) {
                             foreach ($value1['avai_dates'] as $key2 => $value2) {
                                 $explode_date = explode(' ', $value2);
                                 $date_start = date('Y-m-d', strtotime($explode_date[0]));
                                 $date_end = date('Y-m-d', strtotime($explode_date[2]));
                                 $result = $obj_cart_book_data->checkExistanceOfRoomInCurrentCart($value1['id_room'], $date_start, $date_end, $id_cart, $id_guest);
                                 if ($result) {
                                     $room_in_cart = true;
                                 } else {
                                     $room_in_cart = false;
                                 }
                                 $booking_data['rm_data'][$key]['data']['partially_available'][$key1]['check_cart'][$key2]['in_current_cart'] = $room_in_cart;
                                 $booking_data['rm_data'][$key]['data']['partially_available'][$key1]['check_cart'][$key2]['id_cart'] = $this->context->cart->id;
                                 $booking_data['rm_data'][$key]['data']['partially_available'][$key1]['check_cart'][$key2]['cart_booking_data_id'] = $result;
                             }
                         }
                     }
                 }
             }
             foreach ($booking_data['rm_data'] as $avil_k => $avail_v) {
                 if ($avail_v['data']['available']) {
                     foreach ($avail_v['data']['available'] as $avil_k1 => $avail_v1) {
                         $result = $obj_cart_book_data->checkExistanceOfRoomInCurrentCart($avail_v1['id_room'], $date_from, $date_to, $id_cart, $id_guest);
                         if ($result) {
                             $room_in_cart = true;
                         } else {
                             $room_in_cart = false;
                         }
                         $booking_data['rm_data'][$avil_k]['data']['available'][$avil_k1]['in_current_cart'] = $room_in_cart;
                         $booking_data['rm_data'][$avil_k]['data']['available'][$avil_k1]['id_cart'] = $this->context->cart->id;
                         $booking_data['rm_data'][$avil_k]['data']['available'][$avil_k1]['cart_booking_data_id'] = $result;
                     }
                 }
             }
             foreach ($booking_data['rm_data'] as $booked_k => $booked_v) {
                 if ($booked_v['data']['booked']) {
                     foreach ($booked_v['data']['booked'] as $booked_k1 => $booked_v1) {
                         $cust_obj = new Customer($booked_v1['id_customer']);
                         $booking_data['rm_data'][$booked_k]['data']['booked'][$booked_k1]['alloted_cust_name'] = $cust_obj->firstname . ' ' . $cust_obj->lastname;
                         $booking_data['rm_data'][$booked_k]['data']['booked'][$booked_k1]['alloted_cust_email'] = $cust_obj->email;
                         $booking_data['rm_data'][$booked_k]['data']['booked'][$booked_k1]['avail_rooms_to_swap'] = $obj_booking_dtl->getAvailableRoomsForSwaping($booked_v1['date_from'], $booked_v1['date_to'], $booked_v1['id_product'], $booked_v1['id_hotel']);
                     }
                 }
             }
         }
         //sumit to show info of every date
         $start_date = date('Y-m-01');
         // hard-coded '01' for first day
         $last_day_this_month = date('Y-m-t');
         while ($start_date <= $last_day_this_month) {
             $cal_date_from = $start_date;
             $cal_date_to = date('Y-m-d', strtotime($cal_date_from) + 86400);
             $booking_calendar_data[$cal_date_from] = $obj_booking_dtl->getBookingData($cal_date_from, $cal_date_to, $hotel_id, $room_type, $adult, $children, $num_rooms, 1, 1, 1, 1, 1, $id_cart, $id_guest, 1);
             $start_date = date('Y-m-d', strtotime($start_date) + 86400);
         }
         if ($num_rooms <= $booking_data['stats']['num_avail']) {
             $check_css_condition_var = 'default_available';
         } else {
             if ($num_rooms <= $booking_data['stats']['num_part_avai']) {
                 $check_css_condition_var = 'default_part_available';
             } else {
                 $check_css_condition_var = 'default_unavailable';
             }
         }
     }
     $currency = new Currency((int) Configuration::get('PS_CURRENCY_DEFAULT'));
     $hotel_name = $obj_htl_info->hotelsNameAndId();
     $all_room_type = $obj_rm_type->getRoomTypeByHotelId($hotel_id);
     $rms_in_cart = $obj_cart_book_data->getCountRoomsInCart($id_cart, $id_guest);
     $this->tpl_view_vars = array('check_calender_var' => $check_calender_var, 'date_from' => $date_from, 'date_to' => $date_to, 'hotel_id' => $hotel_id, 'room_type' => $room_type, 'adult' => $adult, 'children' => $children, 'num_rooms' => $num_rooms, 'booking_data' => $booking_data, 'booking_calendar_data' => $booking_calendar_data, 'check_css_condition_var' => $check_css_condition_var, 'hotel_name' => $hotel_name, 'all_room_type' => $all_room_type, 'currency' => $currency, 'rms_in_cart' => $rms_in_cart);
     return parent::renderView();
 }