public function getRestoInitData() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $rid = $_GET['id_restaurant']; if (!isset($rid) || $rid == null) { Generic::errorMsg("Restaurant ID Not Found"); } $resto = new MasterRestaurantModel(); $resto->getByID($rid); $r["id_restaurant"] = $resto->id_restaurant; $r["name"] = $resto->name; $r["address"] = $resto->address; $r["district"] = $resto->district; $r["city"] = $resto->city; $r["email"] = $resto->email; $r["phone_no"] = $resto->phone_no; $r["time_open"] = date("H:i", strtotime($resto->time_open)); $r["time_close"] = date("H:i", strtotime($resto->time_close)); $r["image_logo"] = trim($resto->image_logo) != "" ? _BPATH . "uploads/" . $resto->image_logo : ""; $r["restaurant_type"] = $resto->restaurant_type; $r["id_cuisine"] = $resto->id_cuisine; $r["halal"] = $resto->halal; $r["latitude"] = $resto->latitude; $r["longitude"] = $resto->longitude; $rawTags = array(); $tagsIds = explode(",", $resto->restaurant_tags); if (count($tagsIds) != 0) { foreach ($tagsIds as $tagsId) { if ($tagsId == null || $tagsId == "") { continue; } $restoTag = new MasterRestaurantTagModel(); $restoTag->getByID($tagsId); $b["id_tag"] = $restoTag->id_tag; $b["name"] = $restoTag->tag_name; $rawTags[] = $b; } } $r["raw_tags"] = $rawTags; $this->jsonResults["restaurant"] = $r; $cuisine = new CuisineModel(); $cs = array(); foreach ($cuisine->getAll() as $cu) { $c["id_cuisine"] = $cu->id_cuisine; $c["name_cuisine"] = $cu->name_cuisine; $cs[] = $c; } if (count($cs) > 0) { $this->jsonResults["cuisine"] = $cs; } $rType = new MasterRestaurantTypeModel(); $rts = array(); foreach ($rType->getAll() as $ty) { $rt["id_restaurant_type"] = $ty->id_restaurant_type; $rt["name"] = $ty->name; $rts[] = $rt; } if (count($rts) > 0) { $this->jsonResults["restaurant_type"] = $rts; } $this->finish(); die; }
public function createNewRestaurant() { ?> <style> .controls { margin-top: 10px; border: 1px solid transparent; border-radius: 2px 0 0 2px; box-sizing: border-box; -moz-box-sizing: border-box; height: 32px; outline: none; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); } #pac-input { background-color: #fff; font-family: Roboto; font-size: 15px; font-weight: 300; margin-left: 12px; margin-right: 12px; padding: 0 11px 0 13px; text-overflow: ellipsis; width: 80%; } #pac-input:focus { border-color: #4d90fe; } .pac-container { font-family: Roboto; } #type-selector { color: #fff; background-color: #4d90fe; padding: 5px 11px 0px 11px; } #type-selector label { font-family: Roboto; font-size: 13px; font-weight: 300; } </style> <div class="col-sm-12"> <h1>Create New Restaurant</h1> </div> <div id="formgroup_name" class="form-group"> <label for="name" class=" col-sm-2 control-label">Name</label> <div class="col-sm-10"><input type="text" name="name" value="" id="name" class="form-control"> <span class="help-block" id="warning_name"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_email" class="form-group"> <label for="email" class=" col-sm-2 control-label">Email</label> <div class="col-sm-10"><input type="text" name="email" value="" id="email" class="form-control"> <span class="help-block" id="warning_email"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_phone_no" class="form-group"> <label for="phone_no" class=" col-sm-2 control-label">Phone</label> <div class="col-sm-10"><input type="text" name="phone_no" value="" id="phone_no" class="form-control"> <span class="help-block" id="warning_phone_no"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_time_open" class="form-group"> <label for="time_open" class=" col-sm-2 control-label">time_open</label> <div class="col-sm-10"><input type="time" name="time_open" value="" id="time_open" class="form-control"> <span class="help-block" id="warning_time_open"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_time_close" class="form-group"> <label for="time_close" class=" col-sm-2 control-label">time_close</label> <div class="col-sm-10"><input type="time" name="time_close" value="" id="time_close" class="form-control"> <span class="help-block" id="warning_time_close"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_halal" class="form-group"> <label for="halal" class=" col-sm-2 control-label">Halal</label> <div class="col-sm-10"><select class="form-control" name="halal" id="halal"> <option value="1">Yes</option> <option value="0" selected="">No</option> </select> <span class="help-block" id="warning_halal"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_foto" class="form-group"> <label for="image_logo" class=" col-sm-2 control-label">image_logo</label> <div class="col-sm-10"> <div id="loaderholder_foto_old_1465962690" style="position: absolute; margin-top: 30px; margin-left: 40px; display: none;" class="inputfotoloader">Loading... </div> <span id="foto_1465962690"> <div class="foto100"> <img src="/images/noimage.jpg" id="holder_foto_old_1465962690" onload="OnImageLoadMR(event,72,30);"> </div> <input type="file" name="file_image_logo" id="file_foto" value="noimage.jpg"> <input type="hidden" name="image_logo" id="foto" value="noimage.jpg"> </span> <style> .inputfotoloader, .inputfotoloader:before, .inputfotoloader:after { background: #888; -webkit-animation: load1 1s infinite ease-in-out; animation: load1 1s infinite ease-in-out; width: 1em; height: 4em; } .inputfotoloader:before, .inputfotoloader:after { position: absolute; top: 0; content: ''; } .inputfotoloader:before { left: -1.5em; } .inputfotoloader { text-indent: -9999em; margin: 8em auto; position: relative; font-size: 11px; -webkit-animation-delay: -0.16s; animation-delay: -0.16s; } .inputfotoloader:after { left: 1.5em; -webkit-animation-delay: -0.32s; animation-delay: -0.32s; } @-webkit-keyframes load1 { 0%, 80%, 100% { box-shadow: 0 0 #888; height: 4em; } 40% { box-shadow: 0 -2em #888; height: 5em; } } @keyframes load1 { 0%, 80%, 100% { box-shadow: 0 0 #888; height: 4em; } 40% { box-shadow: 0 -2em #888; height: 5em; } } </style> <script type="text/javascript"> var fileTypes = ['jpg', 'jpeg', 'png', 'gif', 'bmp']; //acceptable file types document.querySelector('#foto_1465962690 input[type=file]').addEventListener('change', function (event) { // Read files var files = event.target.files; for (var i = 0; i < files.length; i++) { if (files[i].type.match(/image.*/)) { var reader = new FileReader(); var extension = files[i].name.split('.').pop().toLowerCase(); var isSuccess = fileTypes.indexOf(extension) > -1; console.log(extension); console.log(reader); console.log(isSuccess); if (isSuccess) { //check size if (extension == "png" || extension == "gif") { //kalau png atau gif, tidak di resize, krn we want to preserve the transparency and animations if (typeof FileReader !== "undefined") { var sizess = files[i].size; // check file size console.log(sizess); } inputFotoFiles_1465962690(event); } else { reader.onload = function (readerEvent) { var image = new Image(); image.onload = function (imageEvent) { // Resize image var canvas = document.createElement('canvas'), max_size = 1200, width = image.width, height = image.height; if (width > height) { if (width > max_size) { height *= max_size / width; width = max_size; } } else { if (height > max_size) { width *= max_size / height; height = max_size; } } canvas.width = width; canvas.height = height; canvas.getContext('2d').drawImage(image, 0, 0, width, height); var xhr = new XMLHttpRequest(); if (xhr.upload) { // Update progress xhr.upload.addEventListener('progress', function (event) { var percent = parseInt(event.loaded / event.total * 100); $("#loaderholder_foto_old_1465962690").show(); }, false); xhr.onreadystatechange = function (event) { if (xhr.readyState == 4) { if (xhr.status == 200) { $("#loaderholder_foto_old_1465962690").hide(); var imageHtml = document.getElementById("holder_foto_old_1465962690"); imageHtml.removeAttribute("style"); imageHtml.removeAttribute("width"); imageHtml.removeAttribute("height"); imageHtml.src = '/' + 'uploads/' + xhr.responseText; $('#foto_1465962690 #foto').val(xhr.responseText); console.log('Image uploaded: ' + xhr.responseText); } else { //imageElement.parentNode.removeChild(imageElement); } } } // Start upload xhr.open('post', '/uploader/uploadres?adafile=noimage.jpg&ext=' + extension, true); xhr.send(canvas.toDataURL('image/' + extension)); } } image.src = readerEvent.target.result; } reader.readAsDataURL(files[i]); }//else png or gif }//success else { alert("Please only upload image files"); console.log("err type"); } } else { alert("Please only upload image files"); console.log("err type"); } } }); // Catch the form submit and upload the files function inputFotoFiles_1465962690(event) { files = event.target.files; event.stopPropagation(); // Stop stuff happening event.preventDefault(); // Totally stop stuff happening // START A LOADING SPINNER HERE // Create a formdata object and add the files var data = new FormData(); $.each(files, function (key, value) { data.append(key, value); }); //console.log(data); $.ajax({ url: '/Uploader/uploadres_ext?t=1465962690&files=1&adafile=noimage.jpg', type: 'POST', data: data, cache: false, dataType: 'json', processData: false, // Don't process the files contentType: false, // Set content type to false as jQuery will tell the server its a query string request success: function (data, textStatus, jqXHR) { // console.log(data); if (data.bool) { var imageHtml = document.getElementById("holder_foto_old_1465962690"); imageHtml.removeAttribute("style"); imageHtml.removeAttribute("width"); imageHtml.removeAttribute("height"); imageHtml.src = '/' + 'uploads/' + data.filename; $('#foto_1465962690 #foto').val(data.filename); imageHtml.src = '/uploads/' + data.filename; console.log('Image uploaded: ' + data.filename); } else { // Handle errors here console.log('ERRORS: ' + data.error); $("#file_repeat_foto_1465962690").show(); } }, error: function (jqXHR, textStatus, errorThrown) { // Handle errors here console.log('ERRORS: ' + textStatus); // STOP LOADING SPINNER } }); } </script> <span class="help-block" id="warning_foto"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_map" class="form-group"> <label for="map" class=" col-sm-2 control-label">Map</label> <div class="col-sm-10"> <input id="pac-input" class="controls" type="text" placeholder="Search"> <div class="col-sm-12" id="map" style="width: 100%;height: 450px;background-color: #CCC;"></div> <script> function setLatLong(lat, lng) { var marker = new google.maps.Marker({ position: {lat: lat, lng: lng}, map: map, title: $("#name").val }); $("#latitude").val(lat); $("#longitude").val(lng); var url = "https://maps.googleapis.com/maps/api/geocode/json?latlng=" + lat + "," + lng + "&language=en&key=AIzaSyAjTYhXjHK4MgwGPK8UlveENUMCjgZcSZA"; console.log(url); $.ajax({ method: "GET", url: url }) .done(function (msg) { if (msg.results[3] == null) { $("#district").val(""); $("#city").val(""); $("#latitude").val(""); $("#longitude").val(""); alert("Cannot get exact location\nPlease zoom in and select again"); return; } var arrComponents = msg.results[3].address_components; // console.log(arrComponents); $.each(arrComponents, function (jObj) { console.log(arrComponents[jObj].types[0]); if (arrComponents[jObj].types[0] == "administrative_area_level_3") { $("#district").val(arrComponents[jObj].long_name.toUpperCase()); } else if (arrComponents[jObj].types[0] == "administrative_area_level_2") { $("#city").val(arrComponents[jObj].long_name.toUpperCase()); } }); }); } </script> <script> function initAutocomplete() { var map = new google.maps.Map(document.getElementById("map"), { center: {lat: -6.175883636877263, lng: 106.82710647583008}, zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP }); // Create the search box and link it to the UI element. var input = document.getElementById("pac-input"); var searchBox = new google.maps.places.SearchBox(input); map.controls[google.maps.ControlPosition.TOP_LEFT].push(input); // Bias the SearchBox results towards current map's viewport. map.addListener("bounds_changed", function () { searchBox.setBounds(map.getBounds()); }); var markers = []; google.maps.event.addListener(map, "click", function (event) { markers.forEach(function (marker) { marker.setMap(null); }); markers = []; var icon = { size: new google.maps.Size(71, 71), origin: new google.maps.Point(0, 0), anchor: new google.maps.Point(17, 34), scaledSize: new google.maps.Size(25, 25) }; markers.push(new google.maps.Marker({ map: map, icon: icon, position: {lat: event.latLng.lat(), lng: event.latLng.lng()} })); setLatLong(event.latLng.lat(), event.latLng.lng()); }); // [START region_getplaces] // Listen for the event fired when the user selects a prediction and retrieve // more details for that place. searchBox.addListener("places_changed", function () { var places = searchBox.getPlaces(); if (places.length == 0) { return; } // Clear out the old markers. markers.forEach(function (marker) { marker.setMap(null); }); markers = []; // For each place, get the icon, name and location. var bounds = new google.maps.LatLngBounds(); places.forEach(function (place) { // var icon = { // size: new google.maps.Size(71, 71), // origin: new google.maps.Point(0, 0), // anchor: new google.maps.Point(17, 34), // scaledSize: new google.maps.Size(25, 25) // }; // // // Create a marker for each place. // markers.push(new google.maps.Marker({ // map: map, // icon: icon, // title: place.name, // position: place.geometry.location // })); if (place.geometry.viewport) { // Only geocodes have viewport. bounds.union(place.geometry.viewport); } else { bounds.extend(place.geometry.location); } }); map.fitBounds(bounds); }); // [END region_getplaces] } </script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAjTYhXjHK4MgwGPK8UlveENUMCjgZcSZA&libraries=places&callback=initAutocomplete" async defer></script> <span class="help-block" id="warning_map"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_address" class="form-group"> <label for="address" class=" col-sm-2 control-label">address</label> <div class="col-sm-10"><input type="text" name="address" value="" id="address" class="form-control"> <span class="help-block" id="warning_address"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_district" class="form-group"> <label for="district" class=" col-sm-2 control-label">District</label> <div class="col-sm-10"> <input type="text" name="district" value="" id="district" class="form-control" disabled> <span class="help-block" id="warning_district"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_city" class="form-group"> <label for="city" class=" col-sm-2 control-label">City</label> <div class="col-sm-10"> <input type="text" name="city" value="" id="city" class="form-control" disabled> <span class="help-block" id="warning_city"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_latitude" class="form-group"> <label for="latitude" class=" col-sm-2 control-label">Latitude</label> <div class="col-sm-10"> <input type="text" name="latitude" value="" id="latitude" class="form-control" disabled> <span class="help-block" id="warning_latitude"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_longitude" class="form-group"> <label for="longitude" class=" col-sm-2 control-label">Longitude</label> <div class="col-sm-10"> <input type="text" name="longitude" value="" id="longitude" class="form-control" disabled> <span class="help-block" id="warning_longitude"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_restaurant_type" class="form-group"> <label for="restaurant_type" class=" col-sm-2 control-label">Restaurant Type</label> <div class="col-sm-10"><select class="form-control" name="restaurant_type" id="restaurant_type"> <option value="0">Select Restaurant Type</option> <?php $rType = new MasterRestaurantTypeModel(); $arrRType = $rType->getAll(); foreach ($arrRType as $r) { if (Generic::IsNullOrEmptyString($r->name)) { continue; } ?> <option value="<?php echo $r->id_restaurant_type; ?> "><?php echo $r->name; ?> </option> <?php } ?> </select> <span class="help-block" id="warning_restaurant_type"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_id_cuisine" class="form-group"> <label for="id_cuisine" class=" col-sm-2 control-label">ID Cuisine</label> <div class="col-sm-10"><select class="form-control" name="id_cuisine" id="id_cuisine"> <option value="0">Select Cuisine</option> <?php $rType = new CuisineModel(); $arrRType = $rType->getWhere("status='1'"); foreach ($arrRType as $r) { if (Generic::IsNullOrEmptyString($r->name_cuisine)) { continue; } ?> <option value="<?php echo $r->id_cuisine; ?> "><?php echo $r->name_cuisine; ?> </option> <?php } ?> </select> <span class="help-block" id="warning_id_cuisine"></span> </div> <div class="clearfix"></div> </div> <div id="formgroup_cat_choices" class="form-group"> <label for="cat_choices" class=" col-sm-2 control-label">Categories</label> <div class="col-sm-8"> <select class="form-control" name="cat_choices" id="cat_choices"> <option value="-1">Select Category</option> <?php $c = new MasterCategoryModel(); $arrCats = $c->getWhere("status='1'"); foreach ($arrCats as $r) { if (Generic::IsNullOrEmptyString($r->name)) { continue; } ?> <option value="<?php echo $r->id_category; ?> "><?php echo $r->name; ?> </option> <?php } ?> </select> <span class="help-block" id="warning_voided"></span> </div> <div class="col-sm-2"> <button type="button" id="button_select_cat" class="btn btn-default" style="width: 100%;">Add</button> </div> <div class="clearfix"></div> </div> <div id="formgroup_selected_cat" class="form-group"> <label for="selected_cat" class=" col-sm-2 control-label">Selected Category</label> <div class="col-sm-10"> <input type="text" name="selected_cat" id="selected_cat" class="form-control"> <span class="help-block" id="warning_selected_cat"></span> </div> <div class="clearfix"></div> </div> <script> $('#button_select_cat').click( function () { var restoChoice = $('select#cat_choices'); var selectedVal = restoChoice.val(); var selectedText = restoChoice.find('option:selected').text(); if (restoChoice.prop('disabled')) { alert("All Restaurant Selected"); return; } if (selectedVal == '-1' || selectedVal == null || selectedVal == '') { alert("Please Select Restaurant"); return; } $("select#cat_choices option:selected").remove(); $('#selected_cat').tokenfield(); $('#selected_cat').tokenfield('createToken', {value: selectedVal, label: selectedText}); restoChoice.val(''); } ); $('#selected_cat') .on('tokenfield:removedtoken', function (e) { var value = e.attrs.value; var label = e.attrs.label; var restoChoice = $('select#cat_choices'); restoChoice .append($("<option></option>") .attr("value", value) .text(label)); if (value == '0') { restoChoice.prop("disabled", false); } var selectList = $('select#cat_choices option'); selectList.sort(function (a, b) { a = a.value; b = b.value; return a - b; }); restoChoice.html(selectList); restoChoice.val(value); }); function clearFields() { lwrefresh('DiscCreditCard'); } </script> <div class="form-group"> <div class="col-sm-12"> <button id="submit_create_new_resto" class="btn btn-default">submit</button> <button id="cancel_create_new_resto" class="btn btn-default">cancel</button> <script> $("#cancel_create_new_resto").click(function (event) { event.preventDefault(); lwclose(window.selected_page); }); </script> </div> </div> <?php }
private function viewSearchTerm($searchType, $searchTerm) { switch ($searchType) { case "1": $rt = new MasterRestaurantTypeModel(); $rt->getByID($searchTerm); return $rt->name; case "2": $r = new MasterCategoryModel(); $r->getByID($searchTerm); return $r->name; case "3": $r = new CuisineModel(); $r->getByID($searchTerm); return $r->name_cuisine; // case "4": { // return new Leap\View\InputText("text", "search_term", "search_term", $this->search_term); // } // case "5": { // $r = new MasterDishTagModel(); // $r->getByID($searchTerm); // return $r->name; // } // case "6": { // return new Leap\View\InputText("text", "search_term", "search_term", $this->search_term); // } // case "4": { // return new Leap\View\InputText("text", "search_term", "search_term", $this->search_term); // } // case "5": { // $r = new MasterDishTagModel(); // $r->getByID($searchTerm); // return $r->name; // } // case "6": { // return new Leap\View\InputText("text", "search_term", "search_term", $this->search_term); // } case "7": $r = new MasterRestaurantModel(); $r->getByID($searchTerm); return $r->name; case "8888": return "Not Available"; default: return "Not Available"; } }
public function getRestoDetail() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $json = array(); $json['status_code'] = 1; $id_restaurant = isset($_GET['id_restaurant']) ? addslashes($_GET['id_restaurant']) : ""; if (!$id_restaurant) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $objRestaurant = new MasterRestaurantModel(); $arrResto = $objRestaurant->getWhere("id_restaurant = {$id_restaurant}"); if (count($arrResto) == 0) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $objCuisine = new CuisineModel(); $arrCuisine = $objCuisine->getAll(); $objRestaurantType = new MasterRestaurantTypeModel(); $arrObjRestaurantTyp = $objRestaurantType->getAll(); // pr($arrObjRestaurantTyp); $exp = explode(",", str_replace(" ", "", $objRestaurant->crud_webservice_allowed)); //tmbh untuk add photo url $arrPicsToAddPhotoUrl = $objRestaurant->crud_add_photourl; foreach ($arrResto as $restobyId) { $sem = array(); foreach ($exp as $attr) { if (in_array($attr, $arrPicsToAddPhotoUrl)) { $sem[$attr] = _BPATH . _PHOTOURL . $restobyId->{$attr}; } else { $sem[$attr] = $restobyId->{$attr}; } } $json['results']['restaurant'] = $sem; } $expCuisine = explode(",", str_replace(" ", "", $objCuisine->crud_webservice_allowed)); //tmbh untuk add photo url $arrPicsCuisineToAddPhotoUrl = $objCuisine->crud_add_photourl; foreach ($arrCuisine as $cuisinebyId) { $sem = array(); foreach ($expCuisine as $attr) { if (in_array($attr, $arrPicsCuisineToAddPhotoUrl)) { $sem[$attr] = _BPATH . _PHOTOURL . $cuisinebyId->{$attr}; } else { $sem[$attr] = $cuisinebyId->{$attr}; } } $json['results']['Cuisine'][] = $sem; } $expRestoType = explode(",", str_replace(" ", "", $objRestaurantType->crud_webservice_allowed)); //tmbh untuk add photo url $arrPicsRestoTypeToAddPhotoUrl = $objRestaurantType->crud_add_photourl; foreach ($arrObjRestaurantTyp as $restoType) { $sem = array(); foreach ($expRestoType as $attr) { if (in_array($attr, $arrPicsRestoTypeToAddPhotoUrl)) { $sem[$attr] = _BPATH . _PHOTOURL . $restoType->{$attr}; } else { $sem[$attr] = $restoType->{$attr}; } } $json['results']['RestoType'][] = $sem; } echo json_encode($json); die; }
public function searchTypeDataSet() { $searchType = $_GET['search_type']; $json = array(); switch ($searchType) { case "1": $rt = new MasterRestaurantTypeModel(); $arr = $rt->getWhere("name!=''"); foreach ($arr as $restoType) { $b['value'] = $restoType->id_restaurant_type; $b['text'] = $restoType->name; $json[] = $b; } break; case "2": $r = new MasterCategoryModel(); $arr = $r->getWhere("name!=''"); foreach ($arr as $tag) { $b['value'] = $tag->id_category; $b['text'] = $tag->name; $json[] = $b; } break; case "3": $r = new CuisineModel(); $arrRC = $r->getWhere("name_cuisine!=''"); foreach ($arrRC as $cuisine) { $b['value'] = $cuisine->id_cuisine; $b['text'] = $cuisine->name_cuisine; $json[] = $b; } break; // case "5": { // $r = new MasterDishTagModel(); // $arr = $r->getWhere("name!=''"); // foreach ($arr as $tag) { // $b['value'] = $tag->id_tag; // $b['text'] = $tag->name; // $json[] = $b; // } // break; // } // case "5": { // $r = new MasterDishTagModel(); // $arr = $r->getWhere("name!=''"); // foreach ($arr as $tag) { // $b['value'] = $tag->id_tag; // $b['text'] = $tag->name; // $json[] = $b; // } // break; // } case "7": $rt = new MasterRestaurantModel(); $arr = $rt->getWhere("name!=''"); foreach ($arr as $resto) { $b['value'] = $resto->id_restaurant; $b['text'] = $resto->name; $json[] = $b; } break; default: $b['value'] = 8888; $b['text'] = "Not Available"; $json[] = $b; break; } echo json_encode($json); die; }
public static function isRestoTypeByIDAvailable($id_restaurant_type) { $objRestoType = new MasterRestaurantTypeModel(); $arrRestoType = $objRestoType->getWhere("id_restaurant_type='{$id_restaurant_type}'"); return count($arrRestoType); }