本文整理汇总了PHP中model::object方法的典型用法代码示例。如果您正苦于以下问题:PHP model::object方法的具体用法?PHP model::object怎么用?PHP model::object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model::object方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_list
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);
}
示例2: url
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;
}