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); }
public static function form($formname, $runner, $repost_form_after_submit = false) { $repost = $repost_form_after_submit; \Routerunner\Helper::loader($runner, trim($runner->route, '\\') . '.' . $formname . '.input', $output); if (isset($runner->form_override)) { $output = array_merge($output, $runner->form_override); if (isset($runner->form_override['input'])) { $runner->form_context[$formname]['input'] = $runner->form_override['input']; } } $html = ''; if (isset($output['form'], $output['input'])) { $form = new \Routerunner\Form($runner, $formname, $output, $repost_form_after_submit); $html = $form->render($runner); $form_addon = $form->field($form->id_field) . $form->field('_routerunner_form_nonce'); $html = str_replace('</form>', $form_addon . '</form>', $html); if (\runner::stack("form_failed:" . $formname) === true) { $repost = true; \runner::stack("form_failed:" . $formname, false); } if ($repost && $repost_form_after_submit == 'submit') { $repost_form_after_submit = 'get'; $form = new \Routerunner\Form($runner, $formname, $output, $repost_form_after_submit); $html .= $form->render($runner); } } return $html; }