Esempio n. 1
0
 public static function GetWidget()
 {
     $response = new simpleResponse();
     include './inc/incWebServiceSessionValidation.php';
     try {
         $parameters = GetWidgetsWebService::collectParameters();
         $widget = da_widgets::GetWidget($parameters->widget_id);
         //$widget = da_widgets::GetWidgetsOfPage($parameters->widget_id);
         $response->status = "OK";
         $response->message = "";
         //$response->data = $widget;
         $response->data = $widget;
     } catch (Exception $ex) {
         $response->status = "EXCEPTION";
         $response->message = $ex->getMessage();
         $response->data = $widget;
     }
     return $response;
 }
 public static function GetData()
 {
     $response = new simpleResponse();
     include './inc/incWebServiceSessionValidation.php';
     try {
         $parameters = WebService::collectParameters();
         $widget = da_widgets::GetWidget($parameters->widget_id);
         $page = da_apps_registry::GetPage($widget->page_id);
         $response->status = "OK";
         $response->message = "";
         $response->data = new stdClass();
         $response->data->widget = $widget;
         $response->data->page = $page;
     } catch (Exception $ex) {
         $response->status = "EXCEPTION";
         $response->message = $ex->getMessage();
         $response->data = new stdClass();
         $response->data->widget = $widget;
         $response->data->page = $page;
     }
     return $response;
 }
Esempio n. 3
0
 /**
  * 
  * @param int $widget_id
  * @return \be_widget
  */
 public static function RemoveWidget($widget_id)
 {
     $sqlCommand = "UPDATE widgets " . " SET deleted_datetime = NOW() " . " WHERE widget_id = ? ";
     $paramTypeSpec = "i";
     $mysqli = DA_Helper::mysqli_connect();
     if ($mysqli->connect_errno) {
         $msg = "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
         throw new Exception($msg, $mysqli->connect_errno);
     }
     if (!($stmt = $mysqli->prepare($sqlCommand))) {
         $msg = "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->bind_param($paramTypeSpec, widget_id)) {
         $msg = "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     if (!$stmt->execute()) {
         $msg = "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
         throw new Exception($msg, $stmt->errno);
     }
     $stmt->close();
     $retrievedWidget = da_widgets::GetWidget($widget_id);
     return $retrievedWidget;
 }