Exemplo n.º 1
0
 public function setAction()
 {
     $owner = $_POST['user'];
     $activities = $_POST['activities'];
     $object = $_POST['object'];
     $isValid = Website_P1GlobalFunction::checkValidation($_POST, array('user', 'activities', 'object'));
     if (count($isValid) > 0) {
         $arrayReturn = array("status" => "failed", "message" => "field not found", "data" => $isValid);
         $json_plans = $this->_helper->json($arrayReturn);
         Website_P1GlobalFunction::sendResponse($json_plans);
         exit;
     }
     $ownerId = Object_Abstract::getById($owner);
     $activitiesId = Object_Abstract::getById($activities);
     $key = str_replace(' ', '_', strtolower($ownerId->Name)) . "-" . str_replace(' ', '_', strtolower($activitiesId->Name) . "-" . rand());
     $now = date("Y-m-d,H-i");
     $getDateTime = new Pimcore_Date($now);
     if ($ownerId->o_className == "Customer") {
         $getId = Object_Abstract::getByPath('/log/customers');
         //get folder id
         $setLog = new Object\LogCustomers();
         $setLog->setCustomers($ownerId);
         $setLog->setActivities($activitiesId);
         $setLog->setObjectContent($object);
         $setLog->setDatetime($getDateTime);
         $setLog->setO_parentId($getId->o_id);
         $setLog->setKey($key);
         $setLog->setPublished(1);
         $setLog->save();
         $status = "Success";
         $message = "Success";
         $data = "Add Customer log Success";
     } else {
         if ($ownerId->o_className == "Agen") {
             $getId = Object_Abstract::getByPath('/log/agen');
             //get folder id
             $setLog = new Object\LogAgents();
             $setLog->setAgen($ownerId);
             $setLog->setActivities($activitiesId);
             $setLog->setObjectContent($object);
             $setLog->setDatetime($getDateTime);
             $setLog->setO_parentId($getId->o_id);
             $setLog->setKey($key);
             $setLog->setPublished(1);
             $setLog->save();
             $status = "Success";
             $message = "Success";
             $data = "Add Agen log Success";
         } else {
             $status = "Field";
             $message = "Log id not found";
             $data = "Null";
         }
     }
     $arrayReturn = array("status" => $status, "message" => $message, "data" => $data);
     $json_log = $this->_helper->json($arrayReturn);
     Website_P1GlobalFunction::sendResponse($json_log);
 }
Exemplo n.º 2
0
 public function cancelAction()
 {
     $id_order = $_POST['id_order'];
     $id_store = $_POST['id_store'];
     $return_array = array();
     //print_r($orders);
     //die();
     try {
         if ($id_order != "") {
             // get order
             $orders = Object::getById($id_order);
             // check order exist
             if (count($orders) > 0 && $orders->o_className == 'Orders') {
                 // check store which credential to canceling order
                 if ($orders->Stores->o_id == $id_store) {
                     $orders->setPublished(0);
                     $orders->save();
                     //Set log
                     $base_url = Website_P1GlobalFunction::getBaseUrl();
                     $url_api = $base_url . '/core/log/set';
                     $id_activity = Website_P1GlobalFunction::getActivities("agent_cancel_order");
                     $array_object = json_encode(array("id_order" => $orders->o_id, "isdn" => $orders->Customer->NRIC));
                     $data = array("user" => $orders->agen->o_id, "activities" => $id_activity, "object" => $array_object);
                     $setLog = json_decode(Website_P1GlobalFunction::CallAPI("post", $url_api, $data));
                     $return_array['status'] = 'success';
                     $return_array['message'] = 'success';
                     $return_array['data'] = $array_object;
                 } else {
                     $return_array['status'] = 'failed';
                     $return_array['message'] = 'User cannot allow to canceling order';
                     $return_array['data'] = '';
                 }
             } else {
                 $return_array['status'] = 'failed';
                 $return_array['message'] = 'Order not exsist';
                 $return_array['data'] = '';
             }
         } else {
             $return_array['status'] = 'failed';
             $return_array['message'] = 'Parameter invalid, id_order required';
             $return_array['data'] = '';
         }
     } catch (Exception $ex) {
         $return_array['status'] = 'failed';
         $return_array['message'] = 'Internal service error';
         $return_array['data'] = '';
     }
     $return_json = $this->_helper->json($return_array);
     $this->sendResponse($return_json);
 }
Exemplo n.º 3
0
 public function getAction()
 {
     $idstore = $_POST['idstore'];
     $orderby = $_POST['orderby'];
     $store = array();
     $stores = array();
     $return = array();
     $isValid = Website_P1GlobalFunction::checkValidation($_POST, array('idstore', 'orderby'));
     if (count($isValid) > 0) {
         $arrayReturn = array("status" => "failed", "message" => "field not found", "data" => $isValid);
         $json_plans = $this->_helper->json($arrayReturn);
         Website_P1GlobalFunction::sendResponse($json_plans);
         exit;
     }
     if ($orderby != "" or $idstore != "") {
         $field = array("o_id", "name", "address", "longitude", "latitude");
         //default paramter
         if (!in_array($orderby, $field)) {
             //field is true check in array or not
             $orderby = "name";
         }
         $setOrderKey = $orderby;
         $getStore = new Object\Stores\Listing();
         if (isset($idstore)) {
             $getStore->setCondition("o_id='" . $idstore . "'");
         }
         $getStore->setOrderKey($setOrderKey);
         $i = 0;
         foreach ($getStore as $key) {
             $store[$i] = array("o_id" => $key->o_id, "name" => $key->name, "address" => $key->address, "longitude" => $key->addressPoints->longitude, "latitude" => $key->addressPoints->latitude);
             $i++;
         }
         if (isset($i) and $i < 0) {
         }
         $stores["status"] = "success";
         $stores["message"] = "success";
         $stores["data"] = $store;
         array_push($return, $stores);
     } else {
         $return = array("status" => "failed", "message" => "Paramter invalid, parameter orderby can't empty (is requred) !", "date" => "");
     }
     $json_store = $this->_helper->json($return);
     Website_P1GlobalFunction::sendResponse($json_store);
 }
Exemplo n.º 4
0
 public function logoutAction()
 {
     $username = $_POST['username'];
     $return_array = array();
     $data;
     if (!empty($username)) {
         $customer = new Object\Customer\Listing();
         $customer->setCondition("username = ?", array($username));
         foreach ($customer as $value) {
             session_start();
             session_destroy();
             $data = array("username" => $value->username);
             $return_array['status'] = 'success';
             $return_array['message'] = 'Logout success';
             $return_array['data'] = $data;
         }
     } else {
         $return_array['status'] = 'failed';
         $return_array['message'] = 'This user has been logout';
         $return_array['data'] = '';
     }
     $json_customer = $this->_helper->json($return_array);
     Website_P1GlobalFunction::sendResponse($json_customer);
     $this->sendResponse($json_customer);
 }
Exemplo n.º 5
0
 public function indexAction()
 {
     $aass = Website_P1GlobalFunction::CallAPI("POST", "http://p1.local/core/product/getproduct", array('a' => "A"));
     print_r(json_decode($aass));
 }
Exemplo n.º 6
0
?>
<section class="black-title-bar header-no-menu">
    <div class="container">
        <div class="row">
            <div class="col-xs-12">
                <a href="/" id="back"><i class="fa fa-arrow-circle-left"></i>&nbsp; View all phones</a>
            </div><!--/ .col-xs-12 -->
        </div><!--/ .row -->
    </div><!--/ .container -->
</section><!--/ . -->
        <?php 
$product_id1 = $this->_getParam('id1');
$product_id2 = $this->_getParam('id2');
$product1 = Website_P1GlobalFunction::CallAPI("POST", "alphaone.imkepo.com/core/product/getproduct", array('id' => $product_id1));
$getproducts1 = json_decode($product1);
$product2 = Website_P1GlobalFunction::CallAPI("POST", "alphaone.imkepo.com/core/product/getproduct", array('id' => $product_id2));
$getproducts2 = json_decode($product2);
?>
<div class="container-fluid">
    <ul class="breadcrumb">
        <li><a href="#"><h3>Store</h3></a></li>
        <li><h3>&gt;</h3></li>
        <li class="active"><h3>Compare Phones</h3></li>
    </ul><!--/ .breadcrumb -->
</div><!--/ .container -->

<section class="page-compare">
    <div class="container">
        <div class="row">
            <div class="col-xs-6" id="pro1">
                <div class="compare-item text-center">
Exemplo n.º 7
0
                    <div class="loginOption">
                        <a href="javascript:void(0);" class="email" id="loginEmail"><i class="fa fa-envelope-o fa-2x"></i> Login with Email</a>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="loginOption last">
                        <a href="javascript:void(0);" class="signin" id="loginNow"><i class="fa fa-pencil-square-o fa-2x"></i> Sign up</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php 
$getCustomer = Website_P1GlobalFunction::CallAPI("POST", "alphaone.imkepo.com/core/customer/login", array('' => ""));
$getcustomers = json_decode($getCustomer);
?>
   
<div class="modal fade" id="LoginNow">
    <form id="form-login" method="POST" action="">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <div class="modal-title left">
                            <ul class="title-login">
                                <li><i class="fa fa-sign-in fa-3x"></i></li>
                                <li><p style="font-size: xx-large;">Login</p></li>
                            </ul>
                        </div>
Exemplo n.º 8
0
 public function getAction()
 {
     $id_review = $_POST['id_review'];
     $id_product = $_POST['id_product'];
     $return_array = array();
     $data;
     // $isValid=Website_P1GlobalFunction::checkValidation($_POST,array('id_review'));
     // if(count($isValid)>0){
     //     $return_array = array(
     //             "status" => "failed",
     //             "message" => "field not found",
     //             "data" => $isValid
     //     );
     //     $json_review = $this->_helper->json($return_array);
     //     Website_P1GlobalFunction::sendResponse($json_review);
     //     exit();
     // }
     //     $return_array['data']       = '';
     // if( $id_review == "")
     // {
     //     $return_array['status']     = 'failed';
     //     $return_array['message']    = 'Review ID is required';
     // }
     // else
     // {
     $review = new Object\Review\Listing();
     $review->setCondition("oo_id = '{$id_review}' ");
     $i = 0;
     foreach ($review as $value) {
         // print_r($value);
         $data[$i++] = array("rating" => $value->rating, "creationDate" => $value->o_creationDate, "description" => $value->description, "productID" => $value->product->o_id, "customerID" => $value->customer->o_id, "customerName" => $value->customer->name, "customerUsername" => $value->customer->username);
         // print_r($value);
     }
     // }
     $return_array['status'] = 'Success';
     $return_array['message'] = 'Success';
     $return_array['data'] = $data;
     // die();
     $json_review = $this->_helper->json($return_array);
     Website_P1GlobalFunction::sendResponse($json_review);
     // $this->sendResponse($json_review);
 }
Exemplo n.º 9
0
                                </a><!--/ .compare-item -->
                                <a href="#" class="compare-item" id="compareItemB">
                                    <div class="close-button"><i class="fa fa-times"></i></div>
                                    <img src="http://placehold.it/256x256" alt="Compare Product" class="img-responsive">
                                    <i class="fa fa-2x fa-mobile-phone"></i>
                                    <input type="hidden" name="compareProductB" value="0">
                                </a><!--/ .compare-item -->
                            </div><!--/ .compare-items -->
                        </div><!--/ .compare-box -->
                    </div>
                </div><!--/ .row -->
                <div class="row">
                    <div class="col-xs-12 scroll-mobile">
                        <?php 
$url_request = Website_P1GlobalFunction::getBaseUrl() . "/core/product/getproduct";
$getProduct = Website_P1GlobalFunction::CallAPI("POST", $url_request, array('' => ""));
$getproducts = json_decode($getProduct);
// print_r($getProduct);
// die();
$i = 0;
foreach ($getproducts as $productlist) {
    $i++;
    foreach ($productlist->data as $product) {
        //   print_r($product);
        //     die();
        ?>
                            
                                    <div class="product" data-product-id="<?php 
        echo $i;
        ?>
" data-product-name="<?php 
Exemplo n.º 10
0
 public function logoutAction()
 {
     $username = $_POST['username'];
     if (isset($username) != "" and count($_POST) == 1) {
         $this->getAgen($username, "", "logout");
     } else {
         $arrayReturn = array("status" => "failed", "message" => "invalid parameter !", "data" => "");
         $json_agen = $this->_helper->json($arrayReturn);
         Website_P1GlobalFunction::sendResponse($json_agen);
     }
 }
Exemplo n.º 11
0
 public function checkoutAction()
 {
     $id_customer = $_POST['id_customer'];
     $return_array = array();
     try {
         // get cart open
         $carts = new Object\Carts\Listing();
         $carts->setCondition("Customer__id = " . $id_customer . " and Status = 'open'");
         $carts->setLimit(1);
         $cart = array();
         if ($carts->Count() > 0) {
             foreach ($carts as $c) {
                 $cart = $c;
             }
             // count detail on cart
             $carts_detail = new Object\CartsDetail\Listing();
             $carts_detail->setCondition("Carts__id = " . $cart->o_id);
             $n_detail = $carts_detail->count();
             if ($n_detail > 0) {
                 // get object customer
                 $customer = Object::getById($id_customer);
                 $now = date("Y-m-d,H-i");
                 $get_time_now = new Pimcore_Date($now);
                 $newOrder = Object\Orders::create();
                 $newOrder->setKey(\Pimcore\File::getValidFilename('order_' . $id_customer . '_' . $now));
                 //to get and set ID PARENT FOLDER
                 $id_folder = new Object_List();
                 $id_folder->setCondition("o_key='orders-management'");
                 $o_Pid = 0;
                 foreach ($id_folder as $parent) {
                     $oidParent = $parent->getO_id();
                 }
                 $newOrder->setParentId($oidParent);
                 $newOrder->setCarts($cart);
                 $newOrder->setCustomer($customer);
                 $newOrder->setOrderDate($get_time_now);
                 $newOrder->setPublished(1);
                 $newOrder->save();
                 //Set log checkout cart
                 $base_url = Website_P1GlobalFunction::getBaseUrl();
                 $url_api = $base_url . '/core/log/set';
                 $id_activity = Website_P1GlobalFunction::getActivities("customer_checkout_cart");
                 $array_object = json_encode(array("id_order" => $newOrder->o_id));
                 $data = array("user" => $id_customer, "activities" => $id_activity, "object" => $array_object);
                 $setLogCheckout = json_decode(Website_P1GlobalFunction::CallAPI("post", $url_api, $data));
                 $cart->setstatus("close");
                 $cart->save();
                 //Set log close cart
                 $id_activity = Website_P1GlobalFunction::getActivities("customer_close_cart");
                 $array_object = json_encode(array("id_cart" => $cart->o_id));
                 $data = array("user" => $id_customer, "activities" => $id_activity, "object" => $array_object);
                 $setLogClose = json_decode(Website_P1GlobalFunction::CallAPI("post", $url_api, $data));
                 if ($setLogClose->status == "Success" && $setLogCheckout->status == "Success") {
                     $return_data = json_encode(array("id_cart" => $cart->o_id, "id_order" => $newOrder->o_id));
                     $return_array['status'] = 'success';
                     $return_array['message'] = 'success';
                     $return_array['data'] = $return_data;
                 } else {
                     $return_array['status'] = 'Failed';
                     $return_array['message'] = 'Failed checkout cart';
                     $return_array['data'] = '';
                 }
             } else {
                 $return_array['status'] = 'failed';
                 $return_array['message'] = 'Cart is empty';
                 $return_array['data'] = '';
             }
         } else {
             $return_array['status'] = 'failed';
             $return_array['message'] = 'Customer not have cart open';
             $return_array['data'] = '';
         }
     } catch (Exception $ex) {
         $return_array['status'] = 'failed';
         $return_array['message'] = 'Internal service error';
         $return_array['data'] = '';
     }
     $return_json = $this->_helper->json($return_array);
     $this->sendResponse($return_json);
 }
Exemplo n.º 12
0
 public function getAction()
 {
     $ipAddress = $_POST['ipaddress'];
     $arrayReturn = array();
     if (count($_POST) == 1 and isset($_POST['ipaddress'])) {
         if (isset($ipAddress)) {
             $is_exist = $this->checkVaalidate($ipAddress);
             $json_session = $this->_helper->json($is_exist);
             Website_P1GlobalFunction::sendResponse($json_session);
         } else {
             $arrayReturn['status'] = "failed";
             $arrayReturn['message'] = "ip address cannot empty";
             $rrayReturn['data'] = "";
         }
     } else {
         $arrayReturn['status'] = "failed";
         $arrayReturn['message'] = "Wrong parameter";
         $arrayReturn['data'] = "";
     }
     $json_session = $this->_helper->json($arrayReturn);
     Website_P1GlobalFunction::sendResponse($json_session);
 }