Exemple #1
0
 public static function createDefaultView($view = null)
 {
     ///N:create a default template and prints its content on commit
     ///P:$view:An optional string with a view's name or an instance of rea_view or rea_template, if non is given the 'default_page' will be loaded.
     global $app_controller, $ui_default_view, $rea_views_path;
     if ($ui_default_view == null) {
         if ($view == null) {
             $ui_default_view = ui_view::createWithSource('default_page', file_get_contents(REASG_ENGINE_PATH . 'views/default.view.html'));
         } elseif (is_object($view) && is_a($view, 'rea_template')) {
             $ui_default_view = $view;
         } else {
             $ui_default_view = ui_view::create($view);
         }
         $m = function () {
             global $ui_default_view;
             global $app_controller;
             error_log("@ui_default_view handler for app_send_output");
             $app_controller->dispatchEvent("default_view_commit", [$ui_default_view]);
             $app_controller->write($ui_default_view);
         };
         $app_controller->on('app_send_output', $m);
         //rea_app_controller::on('default_view_commit', 'rea_views::attachJSBToView');
     }
     return $ui_default_view;
 }