public static function generate_html_content()
 {
     global $nelioab_admin_controller;
     if (isset($nelioab_admin_controller->data)) {
         $exp = $nelioab_admin_controller->data;
         $exp_id = $exp->get_id();
     } else {
         $exp_id = -time();
         if (isset($_REQUEST['exp_id'])) {
             $exp_id = $_REQUEST['exp_id'];
         }
         $exp_type = -1;
         if (isset($_POST['exp_type'])) {
             $exp_type = $_POST['exp_type'];
         }
         $exp = null;
         try {
             $exp = NelioABExperimentsManager::get_experiment_by_id($exp_id, $exp_type);
         } catch (Exception $e) {
             require_once NELIOAB_ADMIN_DIR . '/error-controller.php';
             NelioABErrorController::build($e);
         }
     }
     $title = __('Results of the Experiment', 'nelioab');
     $view = new NelioABWidgetAltExpProgressPage($title);
     $view->set_experiment($exp);
     require_once NELIOAB_EXP_CONTROLLERS_DIR . '/widget-experiment-controller.php';
     $widgets_in_experiments = NelioABWidgetExpAdminController::get_widgets_in_experiments();
     $are_there_alternatives_to_apply = false;
     foreach ($widgets_in_experiments as $info) {
         if ($info['exp'] == $exp->get_id()) {
             $are_there_alternatives_to_apply = true;
         }
     }
     $view->set_there_are_alternatives_to_apply($are_there_alternatives_to_apply);
     $goals = $exp->get_goals();
     $view->set_goals($goals);
     $goal_id = -1;
     if (isset($_REQUEST['goal'])) {
         $goal_id = $_REQUEST['goal'];
     }
     $view->set_current_selected_goal($goal_id);
     $view->render_content();
     die;
 }
 public function start()
 {
     parent::start();
     // This fake widget is inserted to make the system believe that there is
     // at least one alternative with a widget that can be "applied" (and, thus,
     // the Apply and Clean buttons in the progress of the experiment make
     // sense).
     $aux = NelioABWidgetExpAdminController::get_widgets_in_experiments();
     NelioABWidgetExpAdminController::link_widget_to_experiment('nelioab-fake-' . $this->get_id(), $this->get_id(), 'no-alternative', $aux);
     NelioABWidgetExpAdminController::set_widgets_in_experiments($aux);
 }
 /**
  * PHPDOC
  *
  * @param array $all_widgets PHPDOC
  *
  * @return array PHPDOC
  *
  * @since PHPDOC
  */
 public function filter_original_widgets($all_widgets)
 {
     require_once NELIOAB_EXP_CONTROLLERS_DIR . '/widget-experiment-controller.php';
     $widgets_in_experiments = NelioABWidgetExpAdminController::get_widgets_in_experiments();
     $res = array();
     foreach ($all_widgets as $sidebar => $widgets) {
         $res[$sidebar] = array();
         if (!is_array($widgets)) {
             continue;
         }
         foreach ($widgets as $widget) {
             if ($this->is_widget_original($widget, $widgets_in_experiments)) {
                 array_push($res[$sidebar], $widget);
             }
         }
     }
     return $res;
 }