Ejemplo n.º 1
0
 public function getDeviceInfo($request)
 {
     $json = json_encode($request->parameters);
     $device = new DeviceInfo();
     $jsonObj = json_decode($json);
     $jsonMessage = $device->validateJson($jsonObj);
     if ($jsonMessage != Message::SUCCESS) {
         $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => $jsonMessage);
         $this->outputError($response);
         return;
     }
     if (!$device->setValuesFromJsonObj($jsonObj)) {
         $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_INVAID_REQUEST_BODY);
         $this->outputError($response);
         return;
     }
     if (empty($device->dc_device_id) || 0 == strlen($device->dc_device_id)) {
         $response = array("status" => "ERROR-BUSINESS", "status_code" => '400', 'msgs' => Message::ERROR_EMPTY_DEVICE_ID);
         $this->outputError($response);
         return;
     } else {
         $deviceObject = $device->getDeviceDetailsByDeviceId($device->dc_device_id);
         if (!empty($deviceObject)) {
             $deviceObject->unsetValues(array('created_on', 'updated_on', 'created_by', 'updated_by'));
             $response = array("status" => "SUCCESS-BUSINESS", "status_code" => '200', 'DeviceDetails' => $deviceObject);
             $this->output($response);
         } else {
             $response = array("status" => "ERROR-BUSINESS", "status_code" => '404', 'message' => 'Failed to load device details !.');
             $this->output($response);
         }
     }
 }
Ejemplo n.º 2
0
     require "forgotpassword.php";
     if (isset($_GET['username'])) {
         $user = $_GET['username'];
         $fpUser = new ForgotPassword($user);
         $fpUser->submit();
     } else {
         $fpPage = new ForgotPasswordPage();
         $fpPage->loadForgotPasswordPage();
     }
 } else {
     if ($login == 1) {
         require "login.php";
     } else {
         if ($deviceinfo == 1) {
             require "deviceinfo.php";
             $deviceInfo = new DeviceInfo();
             $deviceInfo->getDeviceInfo();
         } else {
             if ($view) {
                 // main page for iframe
                 require "view.php";
                 // view the streams
                 $view = $_GET['view'];
                 $page = $_GET['page'];
                 $username = $_GET['username'];
                 $viewer = new View();
                 if ($view == "all") {
                     if (isset($page)) {
                         $viewer->loadAllPage($page);
                     } else {
                         $viewer->loadAllPage(1);
Ejemplo n.º 3
0
 public function getPageDetails($request)
 {
     $json = json_encode($request->parameters);
     $page = new Page();
     $jsonObj = json_decode($json);
     $jsonMessage = $page->validateJson($jsonObj);
     if ($jsonMessage != Message::SUCCESS) {
         $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => $jsonMessage);
         $this->outputError($response);
         return;
     }
     if (!$page->setValuesFromJsonObj($jsonObj)) {
         $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_INVAID_REQUEST_BODY);
         $this->outputError($response);
         return;
     }
     if (trim($page->pageName == '')) {
         $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_PAGENAME);
         $this->outputError($response);
         return;
     }
     if (trim($page->storeId == '')) {
         $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_STORE_ID);
         $this->outputError($response);
         return;
     }
     if (trim($page->deviceHeight == '')) {
         $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_DEVICE_HEIGHT);
         $this->outputError($response);
         return;
     }
     if (trim($page->deviceWidth == '')) {
         $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_BLANK_DEVICE_WIDTH);
         $this->outputError($response);
         return;
     }
     $device = new DeviceInfo();
     //$device->dc_height = $page->deviceHeight;
     //$device->dc_width = $page->deviceWidth;
     $templateObj = $device->getTemplateDetailsByDeviceHeightAndWidth($page->deviceHeight, $page->deviceWidth);
     $pageDetails = $page->getPackageIdsByPageName($page->pageName, $page->storeId);
     if (empty($pageDetails)) {
         $response = array("status" => "ERROR", "status_code" => '400', 'msgs' => Message::ERROR_PACKAGE_LOAD);
         $this->outputError($response);
         return;
     } else {
         $portletArray = array();
         $package = new Package();
         $pack = new Pack();
         $vendorsArray = $package->getVendorIdsByStoreId($page->storeId);
         $vendorIds = array();
         if (!empty($vendorsArray)) {
             foreach ($vendorsArray as $vendor) {
                 $vendorIds[] = $vendor['vendor_id'];
             }
             if (!empty($vendorIds)) {
                 $vendorIds = implode(",", $vendorIds);
             }
         }
         foreach ($pageDetails as $pageDetail) {
             if ($pageDetail->packageId > 0 && $pageDetail->portletId > 0) {
                 $portletArray[$pageDetail->portletId]['packageDetails'] = $package->getPortletsWithContentsByPackageIds($pageDetail->packageId, $pageDetail->portletId, $vendorIds);
                 $portletArray[$pageDetail->portletId]['packDetails'] = $pack->getAllPacksByPackageIds($pageDetail->packageId, $pageDetail->portletId, $page->storeId, $templateObj['ct_group_id']);
             }
         }
         $response = array("status" => "SUCCESS-BUSINESS", "status_code" => '200', 'potletMapDetails' => $pageDetails, 'portletDetails' => $portletArray);
         $this->outputSuccess($response);
         return;
     }
 }