public static function RetrieveWidgetsTypes() { $response = new simpleResponse(); try { $account_id = 0; // include './inc/incWebServiceSessionValidation.php'; $widgettypes = da_widgets::GetWidgetsTypes(); $response->status = "OK"; $response->message = "SUCCESS"; $response->data = $widgettypes; } catch (Exception $ex) { $response->status = "EXCEPTION"; $response->message = $ex->getMessage(); } return $response; }
public static function GetWidgets() { $response = new simpleResponse(); include './inc/incWebServiceSessionValidation.php'; try { $parameters = GetWidgetsWebService::collectParameters(); $widgets = da_widgets::GetWidgetsOfPage($parameters->page_id); $response->status = "OK"; $response->message = ""; $response->data = $widgets; } catch (Exception $ex) { $response->status = "EXCEPTION"; $response->message = $ex->getMessage(); $response->data = $widgets; } return $response; }
public static function RetrieveWidgetsByPage($pageId) { $widgets = da_widgets::GetWidgetsOfPage($pageId); $array = array(); $i = 0; foreach ($widgets as $widget) { $i++; $widget_ui = new be_widget_ui(); $widget_ui->title = $widget->title; $widget_ui->widget_id = $widget->widget_id; $widget_ui->page_id = $widget->page_id; $widget_ui->description = $widget->description; $widget_ui->widget_type_id = $widget->widget_type_id; $widget_ui->order = $widget->order; $widget_ui->refresh_frequency_sec = $widget->refresh_frequency_sec; array_push($array, $widget_ui); } return $array; }
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; }
public static function RetrieveFullPage() { $response = new simpleResponse(); $parameters = GetPageWebService::collectParameters(); try { $account_id = $parameters->account_id; //TODO: Restore login-based security by uncommenting line 42 //include './inc/incWebServiceSessionValidation.php'; if ($account_id > 0) { $fullPage = da_apps_registry::GetPage($parameters->page_id); $fullPage->widgets = da_widgets::GetWidgetsOfPage($parameters->page_id); $response->status = "OK"; $response->message = "SUCCESS"; $response->data = $fullPage; } else { $response->status = "ERROR HERE"; } } catch (Exception $ex) { $response->status = "EXCEPTION"; $response->message = $ex->getMessage(); } return $response; }
/** * * @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; }
private static function saveWidget($parameters) { return da_widgets::AddWidget($parameters); }