Ejemplo n.º 1
0
<?php

require '../header_rest.php';
$controllerRest = new ControllerRest();
$controllerDeal = new ControllerDeal();
$controllerCategory = new ControllerCategory();
$controllerCatDealAssoc = new ControllerCatDealAssoc();
$controllerUser = new ControllerUser();
$deal_id = 0;
if (!empty($_POST['deal_id'])) {
    $deal_id = $_POST['deal_id'];
}
$user_id = 0;
if (!empty($_POST['user_id'])) {
    $user_id = $_POST['user_id'];
}
$login_hash = "";
if (!empty($_POST['login_hash'])) {
    $login_hash = $_POST['login_hash'];
}
$api_key = "";
if (!empty($_POST['api_key'])) {
    $api_key = $_POST['api_key'];
}
if (!$controllerUser->isUserIdExistAndHash($user_id, $login_hash) || Constants::API_KEY != $api_key) {
    $jsonArray = array();
    $jsonArray['status'] = array('status_code' => "3", 'status_text' => "Invalid Access. Please relogin.");
    echo json_encode($jsonArray);
} else {
    if ($deal_id > 0) {
        $controllerDeal->deleteDeal($deal_id, 1);
Ejemplo n.º 2
0
function deleteDeal($deal_id, $landing_page)
{
    $ControllerDeal = new ControllerDeal();
    $ControllerDeal->deleteDeal($deal_id, 1);
    echo "<script type='text/javascript'>location.href='{$landing_page}';</script>";
}
Ejemplo n.º 3
0
function getApprovedDeals()
{
    $controllerDeal = new ControllerDeal();
    $array = $controllerDeal->getApprovedDeals();
    return $array;
}
Ejemplo n.º 4
0
		                    </tr>
		                </thead>
			            <tbody>
			                <?php 
if ($deals != null) {
    $ind = 1;
    foreach ($deals as $deal) {
        $extras = new Extras();
        $params = array();
        $params[0] = array('deal_id', $deal->deal_id);
        $updateUrl = $extras->encryptParams(KEY_SALT, $params, 'deal_update.php');
        $params = array();
        $params[0] = array('deal_id', $deal->deal_id);
        $params[1] = array('action_delete', 1);
        $deleteUrl = $extras->encryptParams(KEY_SALT, $params, 'approved_deals.php');
        $controllerDeal = new ControllerDeal();
        $isExpired = $controllerDeal->checkIfDealIsExpired($deal->deal_id);
        $val = "<span class='label label-danger'>Expired</span>";
        if (!$isExpired) {
            $val = "<span class='label label-success'>&nbsp;Active&nbsp;</span>";
        }
        echo "<tr>";
        echo "<td>{$ind}</td>";
        echo "<td>{$deal->title}</td>";
        echo "<td>{$val}</td>";
        echo "<td>\n\t\t\t\t\t                            <a class='btn btn-primary btn-xs' href='{$updateUrl}'><span class='glyphicon glyphicon-pencil'></span></a>\n\t\t                                    \t<button class='btn btn-primary btn-xs' data-toggle='modal' data-target='#modal_{$deal->deal_id}'><span class='glyphicon glyphicon-remove'></span></button>\n\t\t\t                            \t</td>";
        echo "</tr>";
        ++$ind;
        echo "<div class='modal fade' id='modal_{$deal->deal_id}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>\n\t\t                                    \t<div class='modal-dialog'>\n\t\t                                          \t<div class='modal-content'>\n\t\t                                              \t<div class='modal-header'>\n\t\t                                                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n\t\t                                                    <h4 class='modal-title' id='myModalLabel'>Deleting Deal</h4>\n\t\t                                              \t</div>\n\t\t                                              \t<div class='modal-body'>\n\t\t                                                \t<p>Deleting this is not irreversible. Do you wish to continue?\n\t\t                                              \t</div>\n\t\t                                              \t<div class='modal-footer'>\n\t\t                                                \t<button type='button' class='btn btn-default' data-dismiss='modal'>Close</button>\n\t\t                                                \t<a type='button' class='btn btn-primary' href='{$deleteUrl}'>Delete</a>\n\t\t                                              \t</div>\n\t\t                                          \t</div>\n\t\t                                      </div>\n\t\t                                </div>";
    }
}
Ejemplo n.º 5
0
<?php

require '../header_rest.php';
$controllerRest = new ControllerRest();
$controllerDeal = new ControllerDeal();
$controllerCategory = new ControllerCategory();
$controllerCatDealAssoc = new ControllerCatDealAssoc();
$controllerUser = new ControllerUser();
$categories = array();
if (!empty($_POST['category_ids'])) {
    $categories = explode(",", $_POST['category_ids']);
}
$deal_id = 0;
if (!empty($_POST['deal_id'])) {
    $deal_id = $_POST['deal_id'];
}
$desc = "";
if (!empty($_POST['desc'])) {
    $desc = $_POST['desc'];
}
$no_of_days_expire = "";
if (!empty($_POST['no_of_days_expire'])) {
    $no_of_days_expire = $_POST['no_of_days_expire'];
}
$photo_url = "";
if (!empty($_POST['photo_url'])) {
    $photo_url = $_POST['photo_url'];
}
$price = "";
if (!empty($_POST['price'])) {
    $price = $_POST['price'];