public function render_list(&$models = array())
 {
     if ($this->event_load) {
         \Routerunner\Helper::loader($this, $this->event_load, $output);
         $this->event_load = false;
     }
     //$view = $this->path . $this->route . $this->versionroute . DIRECTORY_SEPARATOR . str_replace('.php', '.before.php', $this->view);
     $file = str_replace('.php', '.before.php', $this->view);
     $path = "";
     $model_created = false;
     if (isset($this->model->created) && $this->model->created || isset($this->override["create"]) && $this->override["create"] < 0) {
         $model_created = true;
     }
     $this->html_before = '';
     $view = \Routerunner\Helper::prepareLoader($this->path . $this->route, false, $this->versionroute, $path, $file, true, $model_created, $this->router);
     if ($view && file_exists($this->scaffold_root . $view)) {
         $html_path = $this->router->get_route();
         if (!\runner::config('silent')) {
             $this->html_before .= '<!--Routerunner::Route(' . $html_path . '.before)//-->' . PHP_EOL;
         }
         $this->html_before .= \Routerunner\Routerunner::$slim->render($view, array('runner' => $this));
         if ($this->i18n) {
             $this->html_before = str_replace(array_keys($this->i18n), array_values($this->i18n), $this->html_before);
         }
         \Routerunner\Routerunner::process($this);
     }
     $i = 0;
     foreach ($models as $index => $model) {
         if (!$model->readable()) {
             $debug = 1;
         }
         if ($model->readable()) {
             $this->model = $model;
             $explode = explode('\\', get_class($this->model));
             if ($explode[0] != "backend") {
                 \model::object($this->model);
             }
             if (!$this->render_eq($i)) {
                 $this->render($i + 1);
             }
             $i++;
         }
     }
     //$view = $this->path . $this->route . $this->versionroute . DIRECTORY_SEPARATOR . str_replace('.php', '.after.php', $this->view);
     $file = str_replace('.php', '.after.php', $this->view);
     $path = "";
     $model_created = false;
     if (isset($this->model->created) && $this->model->created || isset($this->override["create"]) && $this->override["create"] < 0) {
         $model_created = true;
     }
     $this->html_after = '';
     $view = \Routerunner\Helper::prepareLoader($this->path . $this->route, false, $this->versionroute, $path, $file, true, $model_created, $this->router);
     if ($view && file_exists($this->scaffold_root . $view)) {
         $html_path = $this->router->get_route();
         if (!\runner::config('silent')) {
             $this->html_after .= '<!--Routerunner::Route(' . $html_path . '.after)//-->' . PHP_EOL;
         }
         $this->html_after .= \Routerunner\Routerunner::$slim->render($view, array('runner' => $this));
         if ($this->i18n) {
             $this->html_after = str_replace(array_keys($this->i18n), array_values($this->i18n), $this->html_after);
         }
         \Routerunner\Routerunner::process($this);
     }
     if ($this->script) {
         \runner::stack_js($this->script);
     }
     $this->html = $this->backend_container($this->html_before . $this->html . $this->html_after);
 }
Exemplo n.º 2
0
 public static function url($force_class = false, $model = null)
 {
     $tmp_object = false;
     if (!is_null($model)) {
         if (is_array($model) && count($model) == 1) {
             $model = array_shift($model);
         }
         if (is_numeric($model)) {
             $model = \model::load(array("direct" => $model));
         } elseif (is_string($model) && strpos($model, "/") !== false) {
             $model_resource = explode("/", $model);
             $model = \model::load(array("resource" => $model_resource));
         }
         if ($model && is_object($model) && get_parent_class($model) == "Routerunner\\BaseModel") {
             $tmp_object = model::$object;
             model::$object = $model;
         } elseif ($model) {
             throw new \Exception('Invalid model passed to \\model::url function!');
         }
     }
     $return = "javascript:;";
     if (isset(model::$object) && is_object(model::$object)) {
         $return = model::$object->url($force_class);
     }
     if ($tmp_object) {
         model::$object = $tmp_object;
     }
     return $return;
 }