Esempio n. 1
0
 /**
  * Default 404 adapter method
  * 
  * @param  array $params Contains any URL parameters. As this is a 404 handler, it will be empty as no routes were matched
  * @return void
  */
 public function index($params)
 {
     $model = new HomeModel();
     $model->test();
     // create a new view object and fire a method
     $view = (new HomeView())->index();
 }
 public function renderJson()
 {
     $this->offset = $this->limit * ($this->getCurrentPageNumber() - 1);
     $model = new HomeModel();
     $data = array('pagination' => array('current_page' => $this->getCurrentPageNumber(), 'next_page' => $model->countAllItems() - $this->limit * $this->getCurrentPageNumber() > 0 ? true : false), 'items' => $model->getAllItems($this->limit, $this->offset));
     $this->returnJsonResponse($data);
 }
Esempio n. 3
0
 protected function Index()
 {
     $model = new HomeModel("Index");
     $model->setPageTitle('Home');
     if (isset($_SESSION['LoggedIn']) && $_SESSION['LoggedIn'] == 1) {
         $model->GetAccountInfo();
     }
     $this->ReturnView($model->view);
 }
Esempio n. 4
0
File: Home.php Progetto: hopdq/ecom
 public function loadData()
 {
     $model = new FrontMasterModel();
     $body = new HomeModel();
     $body->init();
     $model->init($body);
     $result = json_encode($model);
     echo $result;
 }
Esempio n. 5
0
 public function index()
 {
     $this->view = 'home/index';
     $this->header['title'] = 'Home';
     $this->header['keywords'] = 'home, homepage, news';
     $this->header['description'] = 'Default site with news...';
     require_once APP . 'models/HomeModel.php';
     $home = new HomeModel();
     $this->data['name'] = $home->getName();
     $this->printView();
 }
Esempio n. 6
0
 public function start()
 {
     $pessoaModel = new PessoaFisicaModel();
     $ultimasPessoasCadastradas = $this->homeModel->getUltimasPessoas($pessoaModel, 'dt_usuario_criacao', 4);
     $aniversariantesDoDia = $this->homeModel->getAniversariantesDoDia($pessoaModel);
     $ultimasOcorrencias = $this->homeModel->getUltimasOcorrencias(new OcorrenciaModel(), 'dt_ocorrencia', 5);
     $ultimasOrdensServico = $this->homeModel->getUltimasOrdensServico(new OrdemServicoModel(), 'dt_inicio', 5);
     $dados = ['pagesubtitle' => Session::get('usuario'), 'pagetitle' => 'Home', 'utimas_pessoas_cadastradas' => $ultimasPessoasCadastradas, 'utimas_ocorrencias' => $ultimasOcorrencias, 'utimas_ordens_servico' => $ultimasOrdensServico, 'aniversariantes_do_dia' => $aniversariantesDoDia];
     /** O parâmetros 'Home' define o Controller e 'start' define o método que será executado*/
     $this->view = new View('Home', 'start');
     $this->view->output($dados);
 }
 public function homeWS()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $objHS = new HomeSettingModel();
     $json = array();
     $json['status_code'] = 1;
     $arrHS = $objHS->getWhere("aktiv = 1");
     $expHS = explode(",", str_replace(" ", "", $objHS->crud_webservice_allowed));
     $arrPicsToAddPhotoUrl = $objHS->crud_add_photourl;
     $sem = array();
     foreach ($arrHS as $o) {
         foreach ($expHS as $attr) {
             if (in_array($attr, $arrPicsToAddPhotoUrl)) {
                 $json["results"]["main_menu"][$o->settingType] = _BPATH . _PHOTOURL . $o->{$attr};
             }
             //$sem[$attr] = stripslashes($o->$attr);
         }
         //$json["results"]["main_menu"][$o->settingType][] = $sem;
     }
     $obj = new HomeModel();
     //        $arr = $obj->getWhere("aktiv = 1 AND id_restaurant = " . $id_restaurant );
     $arr = $obj->getWhere("aktiv = 1");
     $exp = explode(",", str_replace(" ", "", $obj->crud_webservice_allowed));
     //tmbh untuk add photo url
     $arrPicsToAddPhotoUrl = $obj->crud_add_photourl;
     foreach ($arr as $o) {
         $sem = array();
         foreach ($exp as $attr) {
             if (in_array($attr, $arrPicsToAddPhotoUrl)) {
                 $sem[$attr] = _BPATH . _PHOTOURL . $o->{$attr};
             } else {
                 $sem[$attr] = stripslashes($o->{$attr});
             }
         }
         //            pr($sem);
         $json["results"]["extra_menu"][] = $sem;
     }
     echo json_encode($json);
     die;
 }
Esempio n. 8
0
 public function actionDisplay()
 {
     global $classSuffix, $db, $user, $mainframe;
     $model = HomeModel::getInstance();
     $data["items_videos"] = $model->getVideos(5);
     $data["items_news"] = $model->getLastNews(5);
     // $data['news'] = $list_category;
     setSysConfig("seopage.title", "wapsite - trang tổng hợp video, tin tức mới nhất");
     setSysConfig("seopage.keyword", "wapsite, tổng hợp video, tin tức mới nhất");
     setSysConfig("seopage.description", "wapsite - trang tổng hợp video, tin tức mới nhất");
     $this->render('default', $data);
 }
Esempio n. 9
0
 protected function index()
 {
     $viewmodel = new HomeModel();
     $this->getView($viewmodel->index(), true);
 }
 public function getHomeView()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $lat = $_POST['lat'];
     $lng = $_POST['lng'];
     $district = $_POST['district'];
     $city = $_POST['city'];
     //        Generic::saveDistrictCity($district, $city);
     $results['home'] = array();
     $mainHomeModel = new HomeSettingModel();
     $arrMainHome = $mainHomeModel->getAll();
     foreach ($arrMainHome as $mainHome) {
         unset($b);
         $b["id_home"] = $mainHome->setting_type;
         $b['name'] = $mainHome->setting_type;
         $b['status'] = true;
         $b['image'] = _BPATH . _PHOTOURL . $mainHome->img_home;
         $b['search_type'] = $mainHome->setting_type;
         $b['search_term'] = $mainHome->setting_type;
         $b['query'] = $mainHome->setting_type;
         $b['is_restaurant'] = true;
         $results['home'][] = $b;
     }
     $extraHomeModel = new HomeModel();
     $arrExtraHome = $extraHomeModel->getWhere("status='1' AND search_type!='0' ORDER BY home_order DESC");
     foreach ($arrExtraHome as $extraHome) {
         unset($b);
         $b["id_home"] = $extraHome->id_home;
         $b['name'] = $extraHome->name;
         $b['status'] = $extraHome->status == true;
         $b['image'] = _BPATH . _PHOTOURL . $extraHome->image;
         $b['search_type'] = $extraHome->search_type;
         $b['search_term'] = $extraHome->search_term;
         $b['query'] = $extraHome->query;
         $b['is_restaurant'] = !($extraHome->search_type == "5" || $extraHome->search_type == "6");
         $results['home'][] = $b;
     }
     $locPromoModel = new LocationPromoModel();
     $results['location_promo'] = array();
     $q = "status='1' AND (type='2') ";
     if (!Generic::IsNullOrEmptyString($city)) {
         $q .= " OR (type='1' AND city='{$city}')";
     }
     if (!Generic::IsNullOrEmptyString($city) && !Generic::IsNullOrEmptyString($district)) {
         $q .= " OR (type='0' AND district='{$district}' AND city='{$city}')";
     }
     $now = leap_mysqldate();
     $arrLocPromo = $locPromoModel->getWhere("( " . $q . " ) AND (promo_start <= '{$now}' AND promo_end >= '{$now}') ORDER BY promo_order DESC");
     //        echo $q;
     //        echo "<br>";
     //        echo $q . " AND (promo_start <= '$now' AND promo_end >= '$now') ORDER BY promo_order DESC";
     //        echo count($arrLocPromo);
     foreach ($arrLocPromo as $alp) {
         unset($lp);
         $lp['id_promo'] = $alp->id_promo;
         $lp['title'] = $alp->title;
         $lp['image'] = _BPATH . _PHOTOURL . $alp->image;
         $lp['district'] = $alp->district;
         $lp['city'] = $alp->city;
         $lp['type'] = $alp->type;
         $results['location_promo'][] = $lp;
     }
     //        pr($results['location_promo']);
     $this->finish($results);
 }
Esempio n. 11
0
 protected function Test()
 {
     $model = new HomeModel("Test");
     $model->setPageTitle('Test');
     $this->ReturnView($model->view);
 }
Esempio n. 12
0
<?php

error_reporting(E_PARSE);
//session_start();
require 'model/homeModel.php';
$model = new HomeModel('home');
$model->renderPage('home.tpl');
/*

    // Inclusiones necesarias en el proyecto //
require '../_config/database/Conexion.php';
$conn = new Conexion();

require ("../_config/mvc/configMVC.php");
$smarty = new configMVC();

require 'model/model.php';
$model = new Model($conn->db);        
        
    

    // Codigo Smarty para Back-End //
$smarty->setModule("_includes");
$content = $smarty->fetch("contentAdminDenominations.tpl");
$smarty->assign("content",$content);
$smarty->display("masterPage.tpl");
    // Codigo Smarty para Front-End //

{section loop=$var name=c}
    
    {var[c].value}
 public function getHomeResults()
 {
     $idHome = Generic::mustCheck($_GET['id_home'], "ID Not Found");
     $currentLat = !Generic::IsNullOrEmptyString($_GET['latitude']) ? $_GET['latitude'] : "";
     $currentLong = !Generic::IsNullOrEmptyString($_GET['longitude']) ? $_GET['longitude'] : "";
     $home = new HomeModel();
     $home->getByID($idHome);
     if ($home->status != "1") {
         Generic::errorMsg("Not Active Home");
     }
     $page = addslashes($_GET['page']);
     if ($page == "" || $page < 1) {
         Generic::errorMsg("No Page Found");
     }
     $limit = addslashes($_GET['limit']);
     if ($limit == "" || $limit < 1) {
         Generic::errorMsg("Limit Error");
     }
     $begin = ($page - 1) * $limit;
     $extraQ = " LIMIT {$begin},{$limit}";
     $key = "key";
     $results = array();
     $searchType = $home->search_type;
     $searchTerm = $home->search_term;
     $query = $home->query;
     switch ($searchType) {
         case "0":
             break;
         case "1":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("restaurant_type='{$searchTerm}' AND show_in_apps='1' ORDER BY fav DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "2":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("FIND_IN_SET('{$searchTerm}', id_categories) AND show_in_apps='1' ORDER BY fav DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "3":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("id_cuisine='{$searchTerm}' AND show_in_apps='1' ORDER BY fav DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "4":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("name LIKE '%{$query}%' AND show_in_apps='1' ORDER BY fav DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "5":
             $dish = new MasterDishModel();
             $results = $dish->getWhere("'{$searchTerm}' IN (dish_tags) ORDER BY id_dish DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $dish->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $dish->crud_add_photourl;
             $key = "Dish";
             break;
         case "6":
             $dish = new MasterDishModel();
             $results = $dish->getWhere("name LIKE '%{$query}%' ORDER BY id_dish DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $dish->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $dish->crud_add_photourl;
             $key = "Dish";
             break;
         case "8888":
             break;
         default:
             break;
     }
     $json["results"]["latitude"] = $currentLat;
     $json["results"]["longitude"] = $currentLong;
     $json["results"][$key] = array();
     foreach ($results as $o) {
         $sem = array();
         foreach ($exp as $attr) {
             if (in_array($attr, $arrPicsToAddPhotoUrl)) {
                 $sem[$attr] = Generic::insertImageUrl($o->{$attr});
             } else {
                 $sem[$attr] = stripslashes($o->{$attr});
             }
         }
         if ($searchType == "5" || $searchType == "6") {
             $sem['nama_restaurant'] = MasterRestaurant::getRestoNameByIDResto($o->id_restaurant);
         }
         if ($currentLat != "" && $currentLong != "") {
             $sem["distance"] = sqrt(pow(69.09999999999999 * ($o->latitude - $currentLat), 2) + pow(69.09999999999999 * ($currentLong - $o->longitude) * cos($o->latitude / 57.3), 2));
         } else {
             $sem["distance"] = 0;
         }
         //            $json["results"]["search_type"] = Generic::homeSearchType($searchType);
         $json["results"][$key][] = $sem;
     }
     $json['status_code'] = 1;
     echo json_encode($json);
     die;
 }
 public function getHomeView()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $lat = $_POST['lat'];
     $lng = $_POST['lng'];
     $district = "";
     $city = "";
     $arrDistrict = self::CalDistrictCityFromLatLng($lat, $lng);
     if (count($arrDistrict) > 0) {
         $district = $arrDistrict['district'];
         $city = $arrDistrict['city'];
     }
     //        Generic::saveDistrictCity($district, $city);
     $results['home'] = array();
     $mainHomeModel = new HomeSettingModel();
     $arrMainHome = $mainHomeModel->getAll();
     foreach ($arrMainHome as $mainHome) {
         unset($b);
         $b["id_home"] = $mainHome->setting_type;
         $b['name'] = $mainHome->setting_type;
         $b['status'] = true;
         $b['image'] = _BPATH . _PHOTOURL . $mainHome->img_home;
         $b['search_type'] = $mainHome->setting_type;
         $b['search_term'] = $mainHome->setting_type;
         $b['query'] = $mainHome->setting_type;
         $b['is_restaurant'] = true;
         $results['home'][] = $b;
     }
     $extraHomeModel = new HomeModel();
     $arrExtraHome = $extraHomeModel->getWhere("status='1' AND search_type!='0' ORDER BY id_home DESC");
     foreach ($arrExtraHome as $extraHome) {
         unset($b);
         $b["id_home"] = $extraHome->id_home;
         $b['name'] = $extraHome->name;
         $b['status'] = $extraHome->status == true;
         $b['image'] = _BPATH . _PHOTOURL . $extraHome->image;
         $b['search_type'] = $extraHome->search_type;
         $b['search_term'] = $extraHome->search_term;
         $b['query'] = $extraHome->query;
         $b['is_restaurant'] = !($extraHome->search_type == "5" || $extraHome->search_type == "6");
         $results['home'][] = $b;
     }
     $locPromoModel = new LocationPromoModel();
     $results['location_promo'] = array();
     $q = "status='1' AND (type='2') ";
     if (!Generic::IsNullOrEmptyString($city)) {
         $q .= " OR (type='1' AND city='{$city}')";
     }
     if (!Generic::IsNullOrEmptyString($city) && !Generic::IsNullOrEmptyString($district)) {
         $q .= " OR (type='0' AND district='{$district}' AND city='{$city}')";
     }
     $arrLocPromo = $locPromoModel->getWhere($q . " ORDER BY id_promo DESC");
     foreach ($arrLocPromo as $alp) {
         unset($lp);
         $lp['id_promo'] = $alp->id_promo;
         $lp['title'] = $alp->title;
         $lp['image'] = _BPATH . _PHOTOURL . $alp->image;
         $lp['district'] = $alp->district;
         $lp['city'] = $alp->city;
         $lp['type'] = $alp->type;
         $results['location_promo'][] = $lp;
     }
     $this->finish($results);
 }