/** * * @param be_widget_config $widgetConfigEntry * @return \be_widget_config */ public static function UpdateWidgetConfig($widgetConfigEntry) { $sqlCommand = "UPDATE widget_config " . " SET widget_id = ?," . " vse_label = ?," . " simple_object_property = ?," . " friendly_label = ?," . " options_json = ?" . " WHERE widget_config_id = ? "; $paramTypeSpec = "issssi"; $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, $widgetConfigEntry->widget_id, $widgetConfigEntry->vse_label, $widgetConfigEntry->simple_object_property, $widgetConfigEntry->friendly_label, $widgetConfigEntry->options_json, $widgetConfigEntry->widget_config_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(); $savedWidgetConfig = da_widget_config::GetWidgetConfigByID($widgetConfigEntry->widget_config_id); return $savedWidgetConfig; }
public static function updatewGetWidgetConfig() { $response = new simpleResponse(); //include './inc/incWebServiceSessionValidation.php'; try { $parameters = Post::collectParameters(); $widgetConfig = da_widget_config::UpdateWidgetConfig($parameters->widget); $response->status = "OK"; $response->message = ""; $response->data = $widgetConfig; } catch (Exception $ex) { $response->status = "EXCEPTION"; $response->message = $ex->getMessage(); $response->data = $widgetConfig; } return $response; }
public static function GetWidgetConfigs() { $response = new simpleResponse(); //include './inc/incWebServiceSessionValidation.php'; //$response = '{"name": "aa"}'; try { $parameters = GetWidgetsConfigWebService::collectParameters(); $widgetConfigs = da_widget_config::GetWidgetConfigListByID($parameters->widget_id); $response->status = "OK"; $response->message = ""; $response->data = $widgetConfigs; } catch (Exception $ex) { $response->status = "EXCEPTION"; $response->message = $ex->getMessage(); $response->data = $widgetConfigs; } return $response; }
public static function RetrieveWidgetConfigsByWidget($widgets) { // $widgets = da_widgets::GetWidgetsOfPage($pageId); // return $widgets; foreach ($widgets as $widget) { $widgetConfigs = da_widget_config::GetWidgetConfigListByID($widget->widget_id); //$widgetConfigs = da_widget_config::GetWidgetConfigListByID($widget->widget_id); $widget->widget_configs = $widgetConfigs; } }
public static function test() { ReportInfo("Testing DAWidgetConfig"); ReportInfo("Creating a new widget config"); $newWidgetConfig = new be_widget_config(); $newWidgetConfig->widget_id = 1; $newWidgetConfig->vse_label = "TEST"; $newWidgetConfig->simple_object_property = ""; $newWidgetConfig->friendly_label = "PRUEBA"; $newWidgetConfig->options_json = ""; ReportInfo("Widget to create:"); print_r($newWidgetConfig); $savedWidgetConfig = da_widget_config::InsertWidgetConfig($newWidgetConfig); if (is_numeric($savedWidgetConfig->widget_config_id) && $savedWidgetConfig->widget_config_id != $newWidgetConfig->widget_config_id && $savedWidgetConfig->widget_config_id > 0) { ReportSuccess("Widget Config Created Successfully"); print_r($savedWidgetConfig); $savedWidgetConfig->vse_label = "MODIFIED"; $savedWidgetConfig->options_json = "{'color':'red'}"; //sleep(2); ReportInfo("Widget Config Modification:"); print_r($savedWidgetConfig); $modifiedWidgetConfig = da_widget_config::UpdateWidgetConfig($savedWidgetConfig); if ($modifiedWidgetConfig->vse_label == "MODIFIED" && $modifiedWidgetConfig->options_json == "{'color':'red'}") { ReportSuccess("Widget Modified Sucessfully"); $deletedResult = da_widget_config::DeleteWidgetConfig($modifiedWidgetConfig->widget_config_id); print_r($deletedResult); } else { ReportError("Modification failed :("); } ReportInfo("Modification Result:"); print_r($modifiedWidgetConfig); } else { ReportError("Insertion failed :("); } }