本文整理汇总了PHP中Generic::IsNullOrEmptyString方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::IsNullOrEmptyString方法的具体用法?PHP Generic::IsNullOrEmptyString怎么用?PHP Generic::IsNullOrEmptyString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generic
的用法示例。
在下文中一共展示了Generic::IsNullOrEmptyString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: overwriteRead
public function overwriteRead($return)
{
$objs = $return['objs'];
// pr($objs);
foreach ($objs as $obj) {
if (isset($obj->status)) {
if ($obj->status == "1") {
$obj->status = "Free";
} else {
$obj->status = "Occupied";
}
}
if (isset($obj->availability)) {
if ($obj->availability == "1") {
$obj->availability = "Active";
} else {
$obj->availability = "Inactive";
}
}
if (isset($obj->id_restaurant)) {
$resto = new MasterRestaurantModel();
$resto->getByID($obj->id_restaurant);
if (Generic::IsNullOrEmptyString($resto->name)) {
$obj->id_restaurant = "Error";
} else {
$obj->id_restaurant = $resto->name;
}
}
}
return $return;
}
示例2: updateRestoMRFee
public function updateRestoMRFee()
{
$idsResto = Generic::mustCheck($_POST['id_restaurant'], "No Restaurant IDs Found");
$fee = Generic::mustCheck($_POST['fee'], "No Fee Found");
if (!is_numeric($fee)) {
Generic::errorMsg("Fee Must Numbers");
}
if (doubleval($fee) > 100) {
Generic::errorMsg("Fee Max 100%");
}
$ids = explode(',', $idsResto);
if (count($ids) <= 0) {
Generic::errorMsg("Empty Id");
}
$updateAll = in_array('0', $ids);
if ($updateAll) {
$r = new MasterRestaurantModel();
$arrR = $r->getAll();
foreach ($arrR as $singleR) {
unset($resto);
$resto = new MasterRestaurantModel();
$resto->getByID($singleR->id_restaurant);
$log = new LogDiscFeeModel();
$log->id_reference = $singleR->id_restaurant;
$log->change_type = "Fee MR";
$log->change_from = Generic::IsNullOrEmptyString($resto->mr_fee) ? "0" : $resto->mr_fee;
$log->change_to = $fee;
$log->change_date_time = leap_mysqldate();
$log->save();
$resto->mr_fee = $fee;
$resto->save();
}
} else {
foreach ($ids as $id) {
unset($resto);
$resto = new MasterRestaurantModel();
$resto->getByID($id);
$log = new LogDiscFeeModel();
$log->id_reference = $id;
$log->change_type = "Fee MR";
$log->change_from = Generic::IsNullOrEmptyString($resto->mr_fee) ? "0" : $resto->mr_fee;
$log->change_to = $fee;
$log->change_date_time = leap_mysqldate();
$log->save();
$resto->mr_fee = $fee;
$resto->save();
}
}
$json['status_code'] = 1;
$json['status_message'] = "success";
echo json_encode($json);
die;
}
示例3: saveDistrictCityFromLatLng
public static function saveDistrictCityFromLatLng($lat, $lng, $accId, $isCashier)
{
$lat = trim($lat);
$lng = trim($lng);
if (self::IsNullOrEmptyString($lat) || self::IsNullOrEmptyString($lng)) {
return;
}
$url = "https://maps.googleapis.com/maps/api/geocode/json?latlng={$lat},{$lng}&result_type=administrative_area_level_3&key=" . self::$geoCodingServerKey;
$json = json_decode(file_get_contents($url), true);
$addressComponents = $json['results'][0]['address_components'];
if (count($addressComponents) < 2) {
return;
}
$district = strtoupper($addressComponents[0]['long_name']);
$city = strtoupper($addressComponents[1]['long_name']);
$loc = new LocationModel();
$arrLoc = $loc->getWhere("district='{$district}' AND city='{$city}'");
if (count($arrLoc) == 0) {
$l = new LocationModel();
$l->district = $district;
$l->city = $city;
if ($isCashier) {
$l->cashier_visit_count = 1;
$l->user_visit_count = 0;
} else {
$l->cashier_visit_count = 0;
$l->user_visit_count = 1;
}
$l->visit_count = 1;
$l->save();
} else {
$l = new LocationModel();
$l->getByID($arrLoc[0]->id_location);
if ($isCashier) {
$l->cashier_visit_count = $l->cashier_visit_count + 1;
} else {
$l->user_visit_count = $l->user_visit_count + 1;
}
$l->save();
}
if ($accId != 0 && !$isCashier) {
$user = new UserModel();
$user->getByID($accId);
$user->last_lat = $lat;
$user->last_long = $lng;
$user->last_city = $city;
$user->last_district = $district;
if (Generic::IsNullOrEmptyString($user->latitude)) {
$user->latitude = $lat;
}
if (Generic::IsNullOrEmptyString($user->longitude)) {
$user->longitude = $lng;
}
if (Generic::IsNullOrEmptyString($user->district)) {
$user->district = $district;
}
if (Generic::IsNullOrEmptyString($user->city)) {
$user->city = $city;
}
$user->save();
}
}
示例4: userUpdateProfile
public function userUpdateProfile()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$idUser = Generic::mustCheck($_POST['id_user'], "ID user required");
$fullName = Generic::mustCheck($_POST['full_name'], "Empty Full Name");
$userName = Generic::mustCheck($_POST['user_name'], "Empty User Name");
$email = Generic::mustCheck($_POST['email'], "Empty Email");
$password = Generic::mustCheck($_POST['pwd'], "Empty Password");
$idCuisine = Generic::mustCheck($_POST['pref_cuisine'], "Cuisine Not Selected");
$birthday = Generic::mustCheck($_POST['birthday'], "Empty Birthday");
$phoneNo = Generic::mustCheck($_POST['phone_no'], "Empty Phone Number");
$fbId = Generic::IsNullOrEmptyString($_POST['fb_id']) ? "" : $_POST['fb_id'];
$latitude = Generic::IsNullOrEmptyString($_POST['lat']) ? "" : $_POST['lat'];
$longitude = Generic::IsNullOrEmptyString($_POST['long']) ? "" : $_POST['long'];
$district = Generic::IsNullOrEmptyString($_POST['district']) ? "" : $_POST['district'];
$city = Generic::IsNullOrEmptyString($_POST['city']) ? "" : $_POST['city'];
$pic = Generic::IsNullOrEmptyString($_POST['pic']) ? "" : MasterRestaurant::savePic($_POST['pic']);
///START OF LOVELY VALIDATION TIME
if (!Generic::isValidUserName($userName)) {
Generic::errorMsg("Username must only contains alphanumeric (and/or) \\'.\\', \\'-\\', \\'_\\'");
}
if (!Generic::isValidUserNameLength($userName)) {
Generic::errorMsg("Max username length is 20");
}
if (!Generic::isValidEmail($email)) {
Generic::errorMsg("Email format not valid");
}
if (!Generic::isValidPassword($password)) {
Generic::errorMsg("Password must contain minimum 5 character and no whitespace");
}
$user = new UserModel();
$user->getByID($idUser);
if ($birthday != $user->birthday) {
Generic::errorMsg("Birthday cannot be changed");
}
if ($userName != $user->user_name) {
Generic::errorMsg("Username cannot be changed");
}
if (!Generic::IsNullOrEmptyString($user->fb_id) && $fbId != $user->fb_id) {
Generic::errorMsg("Facebook cannot be changed");
} else {
$user->fb_id = $fbId;
}
///END OF LOVELY VALIDATION TIME, HOW SAD :(
$user->full_name = $fullName;
$user->email = $email;
$user->password = $password;
$user->id_cuisine = $idCuisine;
$user->phone_no = $phoneNo;
if (!Generic::IsNullOrEmptyString($pic)) {
$user->pic = $pic;
}
if (!Generic::IsNullOrEmptyString($latitude)) {
$user->latitude = $latitude;
$user->last_lat = $latitude;
}
if (!Generic::IsNullOrEmptyString($longitude)) {
$user->longitude = $longitude;
$user->last_long = $longitude;
}
if (!Generic::IsNullOrEmptyString($district)) {
$user->district = $district;
$user->last_district = $district;
}
if (!Generic::IsNullOrEmptyString($city)) {
$user->city = $city;
$user->last_city = $city;
}
$user->status = "1";
$uid = $user->save();
if (!$uid) {
Generic::errorMsg("Failed Creating User");
} else {
$json['status_code'] = 1;
$json['results']['fb_id'] = $user->fb_id;
$json['results']['id_user'] = $idUser;
$json['results']['user_name'] = $user->user_name;
$json['results']['full_name'] = $user->full_name;
$json['results']['email'] = $user->email;
$json['results']['pic'] = Generic::insertImageUrl($user->pic);
echo json_encode($json);
die;
}
}
示例5: createNewRestaurant
//.........这里部分代码省略.........
</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;
}
?>
示例6: setRestoCategories
public function setRestoCategories()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$json = array();
$json['status_code'] = 1;
$id_restaurant = isset($_POST['id_restaurant']) ? addslashes($_POST['id_restaurant']) : "";
if (!$id_restaurant) {
Generic::errorMsg("Restaurant ID not Found");
}
$category = isset($_POST['categories']) ? $_POST['categories'] : "";
if (!$category) {
Generic::errorMsg("Category ID not found!");
}
$resto = new MasterRestaurantModel();
$resto->getByID($id_restaurant);
$arrOldCategories = explode(",", $resto->id_categories);
$jsonCategories = json_decode($category);
$jsonCategorieshlp = array();
foreach ($jsonCategories as $cat) {
$jsonCategorieshlp[] = $cat->category_name;
}
if (!in_array("OTHERS", $jsonCategorieshlp)) {
$jsonCategorieshlp[] = "OTHERS";
}
$jsonCategorieshlp = array_unique($jsonCategorieshlp);
$objCategory = new MasterCategoryModel();
$idCategories = array();
foreach ($jsonCategorieshlp as $category) {
$arrCategory = $objCategory->getWhere("name = '{$category}'");
if (count($arrCategory) == 0 && !Generic::IsNullOrEmptyString($category)) {
$oc = new MasterCategoryModel();
$oc->name = strtoupper($category);
$oc->status = "1";
$oc->is_drink = "0";
$oc->save();
}
}
foreach ($jsonCategorieshlp as $category) {
$arrCategory = $objCategory->getWhere("name = '{$category}'");
foreach ($arrCategory as $val) {
$idCategories[] = $val->id_category;
}
}
//compare old categories to new categories
//cari yang dulu ada sekarang ga ada
//migrasi dish ke others
$missingCategories = array_diff($arrOldCategories, $idCategories);
foreach ($missingCategories as $category) {
$d = new MasterDishModel();
$arrDishes = $d->getWhere("id_category = '{$category}' AND id_restaurant = '{$id_restaurant}'");
foreach ($arrDishes as $dish) {
$dish->load = 1;
$dish->id_category = "0";
$dish->save();
}
}
$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;
}
$idCategories = implode(",", $idCategories);
$arrResto[0]->id_categories = $idCategories;
$arrResto[0]->load = 1;
$idSave = $arrResto[0]->save();
if (!$idSave) {
Generic::errorMsg(Lang::t('save failed'));
} else {
$json['status_code'] = 1;
$json['results'] = "Success";
}
echo json_encode($json);
die;
}
示例7: constraints
public function constraints()
{
$err = array();
if (!isset($this->name)) {
$err['name'] = Lang::t('Name cannot be empty');
}
if (!isset($this->address)) {
$err['address'] = Lang::t('address cannot be empty');
}
if (!isset($this->district)) {
$err['district'] = Lang::t('District cannot be empty');
}
if (!isset($this->city)) {
$err['city'] = Lang::t('City cannot be empty');
}
if (!isset($this->email)) {
$err['email'] = Lang::t('Email cannot be empty');
}
if (!isset($this->phone_no)) {
$err['phone_no'] = Lang::t('phone no cannot be empty');
}
if (!isset($this->time_open)) {
$err['time_open'] = Lang::t('Time open cannot be empty');
}
if (!isset($this->time_close)) {
$err['time_close'] = Lang::t('Time Close cannot be empty');
}
if (!isset($this->halal)) {
$err['halal'] = Lang::t('Halal cannot be empty');
}
//Set Default Values
if (count($err) <= 0) {
//SAVING NEW LOCATION TO Location DB
$ll = new LocationModel();
$arrLoc = $ll->getWhere("district='{$this->district}' AND city='{$this->city}'");
if (count($arrLoc) <= 0) {
$loc = new LocationModel();
$loc->district = $this->district;
$loc->city = $this->city;
$loc->user_visit_count = 0;
$loc->cashier_visit_count = 0;
if (!Generic::IsNullOrEmptyString($this->district) && !Generic::IsNullOrEmptyString($this->city)) {
$loc->save();
}
}
//MAKE id_categories always have 0
if (Generic::IsNullOrEmptyString($this->id_categories)) {
$this->id_categories;
} else {
$arrCats = explode(',', $this->id_categories);
if (!in_array("0", $arrCats)) {
$arrCats[] = "0";
$this->id_categories = implode(',', $arrCats);
}
}
}
return $err;
}
示例8: responseJoinTable
public function responseJoinTable()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$leaderId = $_POST["id_user"];
$guestId = $_POST["guest_id"];
$response = $_POST["response"];
//O = REJECTED --- 1 = ACCEPTED
switch ($response) {
case 0:
$msg = "Your request has been rejected by table leader";
$this->pushToUser($guestId, $msg, "", Push::$typeNormalPopUpNoAction);
break;
case 1:
//TODO GET LEADER ACTIVE ORDER + ALL THIS ORDER DETAIL ORDER then ENCODE put into $j
$order = MasterOrder::getOpenOrderbyUserID($leaderId);
if (Generic::IsNullOrEmptyString($order[0]->user_guest_id) || trim($order[0]->user_guest_id) == ',') {
$order[0]->user_guest_id = $guestId;
} else {
$gid = explode(",", $order[0]->user_guest_id);
array_push($gid, $guestId);
$order[0]->user_guest_id = implode(",", array_unique($gid));
}
$order[0]->user_count = $order[0]->user_count + 1;
$order[0]->load = 1;
$order[0]->save();
$j["id_restaurant"] = $order[0]->id_restaurant;
$j['datetime'] = date('Y-m-d H:i:s');
//TODO ADD $guestId TO THIS ORDER
$msg = "Your request has been accepted";
$this->pushToUser($guestId, $msg, $j, Push::$typeAcceptJoinTable);
break;
}
}
示例9: updateRestoMRDiscount
public function updateRestoMRDiscount()
{
$idsResto = Generic::mustCheck($_POST['id_restaurant'], "No Restaurant IDs Found");
$disc = Generic::mustCheck($_POST['discount'], "No Discount Found");
if (!is_numeric($disc)) {
Generic::errorMsg("Discount Must Numbers");
}
if (strlen(trim($disc)) > 2) {
Generic::errorMsg("Discount Max 2 Digits");
}
$ids = explode(',', $idsResto);
if (count($ids) <= 0) {
Generic::errorMsg("Empty Id");
}
$updateAll = in_array('0', $ids);
if ($updateAll) {
$r = new MasterRestaurantModel();
$arrR = $r->getAll();
foreach ($arrR as $singleR) {
unset($resto);
$resto = new MasterRestaurantModel();
$resto->getByID($singleR->id_restaurant);
unset($logdisc);
$logdisc = new LogDiscFeeModel();
$logdisc->id_reference = $resto->id_restaurant;
$logdisc->change_type = "Discount MR";
$logdisc->change_from = Generic::IsNullOrEmptyString($resto->disc_mr) ? "0" : $resto->disc_mr;
$logdisc->change_to = $disc;
$logdisc->change_date_time = leap_mysqldate();
$logdisc->save();
$resto->disc_mr = $disc;
$resto->save();
}
} else {
foreach ($ids as $id) {
unset($resto);
$resto = new MasterRestaurantModel();
$resto->getByID($id);
unset($logdisc);
$logdisc = new LogDiscFeeModel();
$logdisc->id_reference = $resto->id_restaurant;
$logdisc->change_type = "Discount MR";
$logdisc->change_from = Generic::IsNullOrEmptyString($resto->disc_mr) ? "0" : $resto->disc_mr;
$logdisc->change_to = $disc;
$logdisc->change_date_time = leap_mysqldate();
$logdisc->save();
$resto->disc_mr = $disc;
$resto->save();
}
}
$json['status_code'] = 1;
$json['status_message'] = "success";
echo json_encode($json);
die;
}
示例10: pushByLocation
public function pushByLocation()
{
$idUsers = Generic::mustCheck($_POST['id_users'], "IDs User not Found");
$title = Generic::mustCheck($_POST['title'], "Title not Found");
$message = Generic::mustCheck($_POST['message'], "Message not Found");
$image = Generic::IsNullOrEmptyString($_POST['image']) ? "" : $_POST['image'];
if (Generic::IsNullOrEmptyString($idUsers)) {
Generic::errorMsg("Empty IDs User");
}
$arrIdUser = explode(',', $idUsers);
$results['id_users'] = $idUsers;
$results['title'] = $title;
$results['message'] = $message;
$results['image'] = $image;
$trackerModel = Util::getTrackerModelByCode(Keys::$TRACKER_PUSH);
if (!$trackerModel) {
Generic::errorMsg("Failed To Fetch Tracker Model");
} else {
$trackerModel->title = $title;
$trackerModel->message = $message;
$trackerModel->image = $image;
$trackerModel->id_from = 0;
$trackerModel->id_reference = 0;
$trackerModel->id_to = $idUsers;
$trackerModel->readed = "0";
$trackerModel->answered = "1";
$trackerModel->canceled = "0";
$trackerModel->status = "1";
$trackerModel->type = Push::$typeMRPushByLocation;
$idTracker = $trackerModel->save();
}
foreach ($arrIdUser as $idUser) {
//saving log
$pLog = new MasterPushLoggerModel();
$pLog->from_id = 0;
$pLog->to_id = $idUser;
$pLog->title = $title;
$pLog->message = $message;
//type 3 : MR to User
$pLog->type = Push::$pushLogMRToUser;
$pLog->push_code = Push::$typeMRPushByLocation;
$pLog->datetime_notif = leap_mysqldate();
$pLog->id_reference = $image;
$pLog->status = "1";
$pLog->save();
}
$_POST["ids"] = implode(',', $arrIdUser);
$_POST["msg"] = $title;
$_POST["json"] = $idTracker;
//json_encode($j);
$_POST["type"] = Push::$typeMRPushByCuisine;
$push = new PushTo();
$results['user_count'] = count($arrIdUser);
$results['push'] = $push->usersMR();
Generic::finish($results);
}
示例11: loadPaymentToken
public function loadPaymentToken()
{
$idUser = Generic::mustCheck($_GET['id_user'], "ID User Required");
$user = new UserModel();
$user->getByID($idUser);
if (Generic::IsNullOrEmptyString($user->id_user)) {
Generic::errorMsg("User Not Found");
}
$results['payment_token'] = Generic::IsNullOrEmptyString($user->payment_token) ? "" : $user->payment_token;
$results['payment_id'] = Generic::IsNullOrEmptyString($user->payment_id) ? "" : $user->payment_id;
$results['payment_type'] = Generic::IsNullOrEmptyString($user->payment_type) ? "" : $user->payment_type;
$results['has_token'] = Generic::IsNullOrEmptyString($user->payment_token) ? false : true;
$results['default_cash'] = Generic::IsNullOrEmptyString($user->payment_type) || $user->payment_type == "0" ? true : false;
Generic::finish($results);
}
示例12: setupMenuRevolutionFees
public function setupMenuRevolutionFees()
{
$resto = new MasterRestaurantModel();
$arrResto = $resto->getWhere("id_restaurant!='0' ORDER BY name ASC");
?>
<div class="col-sm-12">
<h1>Setup Discount Credit Card</h1>
</div>
<div id="formgroup_restaurant" class="form-group">
<label for="restaurant_choices" class=" col-sm-2 control-label">restaurant</label>
<div class="col-sm-8">
<select class="form-control" name="restaurant_choices" id="restaurant_choices">
<option value="-1">Select Restaurant</option>
<option value="0">All Restaurant</option>
<?php
foreach ($arrResto as $r) {
if (Generic::IsNullOrEmptyString($r->name)) {
continue;
}
?>
<option value="<?php
echo $r->id_restaurant;
?>
"><?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_resto" class="btn btn-default" style="width: 100%;">Add</button>
</div>
<div class="clearfix"></div>
</div>
<div id="formgroup_selected_restaurant" class="form-group">
<label for="selected_restaurant" class=" col-sm-2 control-label">selected_resto</label>
<div class="col-sm-10">
<input type="text" name="selected_restaurant" id="selected_restaurant" class="form-control">
<span class="help-block" id="warning_id_user"></span>
</div>
<div class="clearfix"></div>
</div>
<div id="formgroup_discount" class="form-group">
<label for="discount_resto_cc" class=" col-sm-2 control-label">discount</label>
<div class="col-sm-10">
<div class="input-group">
<span class="input-group-addon"> Rp.</span>
<input type="text" name="discount_resto_cc" value="0" id="discount_resto_cc" class="form-control">
</div>
<span class="help-block" id="warning_id_user"></span>
</div>
<div class="clearfix"></div>
</div>
<div class="form-group">
<div class="col-sm-12">
<button id="submit_button_resto_cc_disc" class="btn btn-default">submit</button>
<button id="cancel_button_resto_cc_disc" class="btn btn-default">cancel</button>
</div>
</div>
<script>
$('#button_select_resto').click(
function () {
var restoChoice = $('select#restaurant_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;
} else if (selectedVal == '0') {
restoChoice.prop("disabled", true);
}
$("select#restaurant_choices option:selected").remove();
$('#selected_restaurant').tokenfield();
$('#selected_restaurant').tokenfield('createToken', {value: selectedVal, label: selectedText});
restoChoice.val('');
}
);
$('#selected_restaurant')
.on('tokenfield:removedtoken', function (e) {
var value = e.attrs.value;
var label = e.attrs.label;
var restoChoice = $('select#restaurant_choices');
//.........这里部分代码省略.........
示例13: getTodayDineInOrderByRestoId
public function getTodayDineInOrderByRestoId()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$idResto = $_GET["id_restaurant"];
$o = new MasterOrderModel();
$arrOrder = $o->getWhere("DATE(datetime_order) >= DATE(CONVERT_TZ(NOW(),@@session.time_zone,'+07:00')) AND status_progress>='4' AND status='1' AND (type_order='0' OR type_order='1') AND order_now='1' AND id_restaurant='{$idResto}' ORDER BY id_order DESC");
// pr($arrOrder);
$json["status_code"] = 1;
$json["results"] = array();
foreach ($arrOrder as $order) {
// $order = new MasterOrderModel();
$b["id_order"] = $order->id_order;
$b["status_progress"] = $order->status_progress;
$b["isOut"] = false;
if ($order->status_progress === "0") {
$b["progress"] = "Wait";
} elseif ($order->status_progress == "1") {
$b["progress"] = "Cook";
} elseif ($order->status_progress == "2" || $order->status_progress == "3") {
$b["progress"] = "Ready";
$b["isOut"] = true;
} elseif ($order->status_progress == "4") {
$b["progress"] = "Finish";
$b["isOut"] = true;
} elseif ($order->status_progress == "9") {
$b["progress"] = "Voided";
$b["isOut"] = true;
}
$b["status_payment"] = $order->status_payment;
if ($order->status_payment == "1") {
$b["isPaid"] = true;
} else {
$b["isPaid"] = false;
}
$b["type_order"] = $order->type_order;
if ($order->type_order == "3") {
$b["isAppOrder"] = true;
} else {
$b["isAppOrder"] = false;
}
$b["table_number"] = "0";
if (!Generic::IsNullOrEmptyString($order->id_table) || $order->id_table != 0) {
$table = new MasterTableModel();
$table->getByID($order->id_table);
$b["table_number"] = $table->table_number;
}
$b["datetime_order"] = $order->datetime_order;
$b["order_number"] = $order->order_number;
$json["results"][] = $b;
}
echo json_encode($json);
die;
}
示例14: getUserDWBalance
public function getUserDWBalance()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
if (Generic::IsNullOrEmptyString($_GET['id_user'])) {
$results['balance'] = doubleval(0);
Generic::finish($results);
}
$idUser = addslashes($_GET['id_user']);
$user = new UserModel();
$user->getByID($idUser);
$results["pic"] = Generic::insertImageUrl($user->pic);
$allowDokuWallet = Efiwebsetting::getData('App_Allow_Doku_Wallet') == 'yes';
if (Generic::IsNullOrEmptyString($user->payment_id) || $user->payment_id == 0) {
$results['balance'] = doubleval(0);
} else {
if ($allowDokuWallet) {
$doku = new PaymentDoku();
$results['balance'] = $doku->checkBalance($user->payment_id);
} else {
$results['balance'] = doubleval(0);
}
}
Generic::finish($results);
}
示例15: CalDistrictCityFromLatLng
public static function CalDistrictCityFromLatLng($lat, $lng)
{
$lat = trim($lat);
$lng = trim($lng);
if (Generic::IsNullOrEmptyString($lat) || Generic::IsNullOrEmptyString($lng)) {
return;
}
$url = "https://maps.googleapis.com/maps/api/geocode/json?latlng={$lat},{$lng}&result_type=administrative_area_level_3&key=" . Generic::$geoCodingServerKey;
$json = json_decode(file_get_contents($url), true);
$addressComponents = $json['results'][0]['address_components'];
if (count($addressComponents) < 2) {
return;
}
$district = strtoupper($addressComponents[0]['long_name']);
$city = strtoupper($addressComponents[1]['long_name']);
$result['district'] = $district;
$result['city'] = $city;
return $result;
}