$winfo = array(); //Array that contains the info about the widget's representation, this is: chart info, tag cloud info, etc. $chart_info = array(); //If the ID is empty it means that we are in the wizard previsualization. We get all the info from the GET parameters. if (!isset($id) || empty($id)) { $winfo['height'] = GET("height"); //Height of the widget $winfo['wtype'] = GET("wtype"); //Type of widget: chart, tag_cloud, etc. $winfo['asset'] = GET("asset"); //Assets implicated in the widget $chart_info = unserialize(GET("value")); //Params of the widget representation, this is: type of chart, legend params, etc. } else { //Getting the widget's info from DB $winfo = get_widget_data($conn, $id); //Check it out in widget_common.php $chart_info = $winfo['params']; //Params of the widget representation, this is: type of chart, legend params, etc. } //Validation ossim_valid($winfo['wtype'], OSS_TEXT, 'illegal:' . _("Type")); ossim_valid($winfo['height'], OSS_DIGIT, 'illegal:' . _("Widget ID")); ossim_valid($winfo['asset'], OSS_HEX, OSS_SCORE, OSS_ALPHA, OSS_USER, 'illegal:' . _("Asset/User/Entity")); if (is_array($chart_info) && !empty($chart_info)) { $validation = get_array_validation(); foreach ($chart_info as $key => $val) { if ($validation[$key] == '') { continue; } eval("ossim_valid(\"\$val\", " . $validation[$key] . ", 'illegal:" . _($key) . "');");
/** * Update widget info */ protected final function updateInfoAllWidget() { $allWidget = get_child_folder(APP_DIR . '/widgets/frontend/'); ZTranslate::getInstance()->addWidgetLang($allWidget, 'frontend'); $this->deleteOldWidget($allWidget); foreach ($allWidget as $w) { $widgetPath = APP_DIR . '/widgets/frontend/' . $w . '/' . $w . '.php'; $infoWidget = get_widget_data($widgetPath); $infoWidget['title'] = $infoWidget['name']; $widget = CoreWidgets::findFirst(['conditions' => 'base_name = ?0', 'bind' => [0 => $w]]); if (!$widget) { $widget = new CoreWidgets(); $widget->base_name = $w; $widget->published = 0; $widget->is_core = 0; } $keys = ['title', 'description', 'version', 'author', 'uri', 'authorUri', 'location']; foreach ($keys as $key) { $widget->{$key} = $infoWidget[$key]; } if (isset($widget->location) && (strtolower($widget->location) == 'frontend' || strtolower($widget->location) == 'backend')) { $widget->location = strtolower($widget->location); } else { $widget->location = 'frontend'; } $widget->save(); } }