示例#1
0
 public function run($id = false, $model = false, $forceDelete = false)
 {
     $modelName = $this->model && is_string($this->model) ? $this->model : (request()->getParam('model') ? request()->getParam('model') : $this->controller->model);
     if ($id) {
         //delete one model
         $result = $this->controller->loadModel($modelName, $id)->delete();
         if (!request()->isAjaxRequest && $result) {
             $this->controller->redirect(user()->gridIndex);
         }
         Common::jsonSuccess(true);
     } else {
         $items = Common::getChecked('items');
         if ($items) {
             if (!$forceDelete) {
                 foreach ($items as $id) {
                     $this->controller->loadModel($modelName, $id)->delete();
                 }
             } else {
                 $criteria = new SDbCriteria();
                 $criteria->compare('id', $items);
                 CActiveRecord::model($modelName)->deleteAll($criteria);
             }
             Common::jsonSuccess(true);
         }
     }
     Common::jsonError("Ошибка");
 }
function deleteHotelFetursList()
{
    $hotelfeatureslist = new HotelFetursList();
    $hotelfeatureslist->setHotelFeatureListId($_REQUEST['id']);
    if ($hotelfeatureslist->deleteHotelFeatureList()) {
        Common::jsonSuccess("Hotel Features List Deleted Successfully");
    } else {
        Common::jsonError("Error");
    }
}
function deleteRoomFeatures()
{
    $room_features = new RoomFeatures();
    $room_features->setRoomFeatureId($_REQUEST['id']);
    if ($room_features->deleteRoomFeatures()) {
        Common::jsonSuccess("Room Features Deleted Successfully");
    } else {
        Common::jsonError("Error");
    }
}
示例#4
0
function deleteCategory()
{
    $category = new Category();
    $category->setCategoryId($_REQUEST['id']);
    if ($category->deleteCategory()) {
        Common::jsonSuccess("Category Deleted Successfully");
    } else {
        Common::jsonError("Error");
    }
}
示例#5
0
function subscribe()
{
    $subscribe = new Subscribe();
    $subscribe->setValues($_REQUEST);
    if ($subscribe->newSubscribe()) {
        Common::jsonSuccess("Subscribe Successfully!");
    } else {
        Common::jsonError("Error");
    }
}
function deleteHotelFetursType()
{
    $hotelfeat_type = new HotelFetursType();
    $hotelfeat_type->setHotelFeatureTypeId($_REQUEST['id']);
    if ($hotelfeat_type->deleteHotelFeatureType()) {
        Common::jsonSuccess("Feturs Type Deleted Successfully");
    } else {
        Common::jsonError("Error");
    }
}
function deleteAdministrator()
{
    $admin = new Administrators();
    $admin->setId($_REQUEST['id']);
    if ($admin->deleteAdministrator()) {
        Common::jsonSuccess("Adminstrators Deleted Successfully");
    } else {
        Common::jsonError("Error");
    }
}
function deleteMemberBankDetail()
{
    $member_bank_details = new MemberBankDetails();
    $member_bank_details->setBankId($_REQUEST['id']);
    if ($member_bank_details->deleteMemberBankDetails()) {
        Common::jsonSuccess("Member Bank Details Deleted Successfully");
    } else {
        Common::jsonError("Error");
    }
}
示例#9
0
function deleteCurrency()
{
    $currency = new Currency();
    $currency->setCurrId($_REQUEST['id']);
    if ($currency->deleteCurrency()) {
        Common::jsonSuccess("Currency Deleted Successfully");
    } else {
        Common::jsonError("Error");
    }
}
示例#10
0
function deleteAccommodation()
{
    $accommodation = new Accommodation();
    $accommodation->setAccommodationId($_REQUEST['id']);
    if ($accommodation->deleteAccommodation()) {
        Common::jsonSuccess("Accommodation Deleted Successfully");
    } else {
        Common::jsonError("Error");
    }
}
示例#11
0
function updateSettings()
{
    $sysSettings = new systemSetting();
    $get_edited = array();
    foreach ($_REQUEST as $k => $v) {
        $get_edited[$k] = $v;
    }
    $sysSettings->setValues($get_edited);
    if ($sysSettings->editSetting()) {
        Common::jsonSuccess("Settings Update Successfully!");
    } else {
        Common::jsonError("Error");
    }
}
示例#12
0
function adminLoginNow()
{
    $username = $_REQUEST['login_user'];
    $password = $_REQUEST['login_password'];
    $admin = new administrator();
    $admin->setUsername($username);
    $data = $admin->getAdminFromUsername();
    if (count($data) > 0) {
        $admin->extractor($data);
        if ($admin->password() == md5($password)) {
            $session = new Sessions();
            $session->setAdminLoginSessions($admin->id(), $admin->name(), $admin->email());
            Common::jsonSuccess("Success");
        } else {
            Common::jsonError("Login Error");
        }
    } else {
        Common::jsonError("Login Error");
    }
}
示例#13
0
 /**
  * Добавить комментарий
  */
 public function actionAddComment()
 {
     $commentsModelName = request()->getParam('commentsModelName');
     $commentsForeignKey = request()->getParam('commentsForeignKey');
     $idOwner = request()->getParam('idOwner');
     $additionalFields = request()->getParam('additionalFields');
     $model = $this->owner->loadModel($commentsModelName);
     $this->owner->performAjaxValidation($model);
     $model->id_user = user()->id;
     $model->comment = request()->getParam('comment');
     $model->{$commentsForeignKey} = $idOwner;
     $model->date = date('y-m-d H:i:s');
     if ($additionalFields) {
         $additionalFields = CJSON::decode($additionalFields);
         foreach ($additionalFields as $field => $value) {
             $model->{$field} = $value;
         }
     }
     if ($model->save()) {
         Common::jsonSuccess(true, ['data' => $model->render()]);
     } else {
         Common::jsonError("Ошибка при сохранении");
     }
 }
function loginClient()
{
    $username = $_REQUEST['client_username_log'];
    $password = $_REQUEST['client_password_log'];
    $client = new Clients();
    $session = new Sessions();
    $client->setClientUsername($username);
    $data = $client->getClientFromUsername();
    if (count($data) > 0) {
        $client->extractor($data);
        if (strcmp($client->clientPassword(), md5($password)) == 0) {
            $session->setClientLoginSessions($client->clientId(), $client->clientTitle(), $client->clientFirstName(), $client->clientLastName());
            Common::jsonSuccess("Success");
        } else {
            Common::jsonError("Login Error");
        }
    } else {
        Common::jsonError("Login Error");
    }
}
示例#15
0
 public function actionChangePassword()
 {
     $model = $this->loadModel($this->model, user()->id);
     $model->scenario = 'changePassword';
     $model->password = null;
     $this->performAjaxValidation($model);
     if (isset($_POST[$this->model])) {
         $model->attributes = $_POST;
         //save new password and salt
         if ($model->validate()) {
             if ($model->save(array('password'))) {
                 Common::jsonSuccess(true);
             }
         } else {
             Common::jsonError('Ошибка авторизации');
         }
     }
 }
示例#16
0
function deleteHotel()
{
    $admin = new Hotels();
    $admin->setHotelId($_REQUEST['id']);
    if ($admin->deleteHotel()) {
        Common::jsonSuccess("Hotel Deleted Succesfully");
    } else {
        Common::jsonError("Error");
    }
}
示例#17
0
function deleteReservation()
{
    $reservation = new Reservations();
    $reservation->setReservationId($_REQUEST['id']);
    if ($reservation->deleteReservations()) {
        Common::jsonSuccess("Reservation Deleted Successfully");
    } else {
        Common::jsonError("Error");
    }
}
示例#18
0
function memberLogin()
{
    $member = new Members();
    $member->setMemberUsername($_REQUEST['member_username_login']);
    $data = $member->getMemberByUsername();
    if (count($data) > 0) {
        $member->extractor($data);
        if (strcmp($member->memberPassword(), md5($_REQUEST['member_password_login'])) == 0) {
            $session = new Sessions();
            $session->setMemberLoginSessions($member->memberId(), $member->memberTitle(), $member->memberFirstName(), $member->memberLastName());
            Common::jsonSuccess("Success");
        } else {
            Common::jsonError("Login Error");
        }
    } else {
        Common::jsonError("Login Error");
    }
}
示例#19
0
function removeOfferImage()
{
    $offerId = $_REQUEST['offerId'];
    $file = $_REQUEST['image'];
    $file_path = DOC_ROOT . 'uploads/special_offers/' . $file;
    $offers = new Offers();
    if (file_exists($file_path)) {
        if (unlink($file_path)) {
            $offers->setId($_REQUEST['offerId']);
            $offers->deleteImage();
            Common::jsonSuccess("Offer image deleted successfully");
        } else {
            Common::jsonError("Failed to delete");
        }
    } else {
        Common::jsonError("Error");
    }
}
示例#20
0
function deleteMainCityImage()
{
    $file = $_REQUEST['image'];
    $file_path = DOC_ROOT . 'uploads/main-city/' . $file;
    if (file_exists($file_path)) {
        if (unlink($file_path)) {
            $maincity = new MainCity();
            $maincity->setMainCityId($_REQUEST['id']);
            $data = $maincity->getMainCityFromId();
            $maincity->extractor($data);
            $imagelist = $maincity->mainCityImage();
            $imgs = explode(',', $imagelist);
            $key = array_search($file, $imgs);
            if (false !== $key) {
                unset($imgs[$key]);
            }
            for ($x = 0; $x <= count($imgs); $x++) {
                if (!empty($imgs[$x])) {
                    $update_img .= $imgs[$x] . ',';
                }
            }
            $maincity->setMainCityImage($update_img);
            $maincity->updateMainCityImages();
            Common::jsonSuccess("City Image Deleted Successfully");
        } else {
            Common::jsonError("Fail To Delete");
        }
    } else {
        Common::jsonError("Error");
    }
}
示例#21
0
function deactivateHotelRequestCancel()
{
    $hotel = new Hotels();
    $members = new Members();
    $mailClass = new mailClass();
    $hotel->setHotelId($_REQUEST['id']);
    $hotel->extractor($hotel->getHotelFromId());
    $members->setMemberId($hotel->hotelMemberId());
    $members->extractor($members->getMemberFromId());
    $hotel->setHotelActiveStatus(Libs::getKey("hotel_status_admin", "Active"));
    //INFO: Log
    //$temp_hotel1 = new Hotels();
    //$temp_hotel1->setHotelId($_REQUEST['id']);
    //$temp_hotel1=(array)$temp_hotel1->getHotelFromId();
    //$TransactionLog=new TransactionLog($hotel->hotelId(),Libs::getKey('hotel_sections','Property Details'),'Delete',Sessions::getMemberId(),'hotels',$temp_hotel1[0],'');
    //$TransactionLog->log();
    //$temp_hotel1=null;
    //INFO: Log//
    if ($hotel->changeHotelActiveStatus()) {
        $mailClass->HotelDeactivationRequestCancel($members->memberTitle(), $members->memberFirstName(), $members->memberLastName(), $hotel->hotelName());
        Common::jsonSuccess("Deactivation Cancel request successful");
    } else {
        Common::jsonError("Error");
    }
}
示例#22
0
function loginClient()
{
    $username = $_REQUEST['client_username_log'];
    $password = $_REQUEST['client_password_log'];
    $client = new Clients();
    $session = new Sessions();
    $client->setClientUsername($username);
    $data = $client->getClientFromUsername();
    //echo count($data);
    if (count($data) > 0) {
        $client->extractor($data);
        if (strcmp($client->clientPassword(), md5($password)) == 0) {
            $session->setClientLoginSessions($client->clientId(), $client->clientTitle(), $client->clientFirstName(), $client->clientLastName());
            if ($_SESSION['booked'] != '') {
                echo 'booked';
                //die('booked');
            } else {
                echo 2;
                //die('accounts');
            }
        } else {
            echo 3;
        }
    } else {
        Common::jsonError("Login Error");
    }
}
示例#23
0
function removeRoomImage()
{
    $file = $_REQUEST['image'];
    $file_path = DOC_ROOT . 'uploads/room-gal/' . $file;
    if (file_exists($file_path)) {
        if (unlink($file_path)) {
            Common::jsonSuccess("Room Image Deleted Successfully");
        } else {
            Common::jsonError("Failed To Delete");
        }
    } else {
        Common::jsonError("Error");
    }
}