public function make($items = array(), $html = '', $partial_path = null) { foreach ($items as $child) { $url = empty($child['url']) ? '#' : $child['url']; $has_partial = false; // if partial path is not null // lets try to load from there first if (!is_null($partial_path)) { $has_partial = $this->view_exists($partial_path); if ($has_partial) { $html .= View::make($has_partial)->with('child', $child)->with('theme', $this)->with('url', $url); continue; } } // look on themes partial $has_partial = $this->view_exists($this->theme->_theme_absolute_path . DS . 'views' . DS . 'partials' . DS . 'menu_li'); if ($has_partial) { $html .= View::make($has_partial)->with('child', $child)->with('theme', $this)->with('url', $url); continue; } // look on shared folder partials $has_partial = $this->view_exists(path('public') . 'shared' . DS . 'views' . DS . 'partials' . DS . 'menu_li'); if ($has_partial) { $html .= View::make($has_partial)->with('child', $child)->with('theme', $this)->with('url', $url); continue; } // we did not find the partial // load the default provided by // navigation module $html .= View::make('navigation::partials.menu_li')->with('child', $child)->with('theme', $this)->with('url', $url); } return $html; }
/** * Resolve a controller name to a controller instance. * * @param string $container * @param string $controller * @return Controller */ public static function resolve($controller) { if (!static::load($controller)) { return; } // If the controller is registered in the IoC container, we will resolve // it out of the container. Using constructor injection on controllers // via the container allows more flexible and testable applications. if (IoC::registered('controllers.' . $controller)) { return IoC::resolve('controllers.' . $controller); } $controller = str_replace(' ', '_', ucwords(str_replace('.', ' ', $controller))) . '_Controller'; $controller = new $controller(); // If the controller has specified a layout to be used when rendering // views, we will instantiate the layout instance and set it to the // layout property, replacing the string layout name. if (!is_null($controller->layout)) { $controller->layout = View::make($controller->layout); } return $controller; }
/** * Create a new error response instance. * * The response status code will be set using the specified code. * * The specified error should match a view in your views/error directory. * * <code> * // Create a 404 response * return Response::error('404'); * * // Create a 404 response with data * return Response::error('404', array('message' => 'Not Found')); * </code> * * @param int $code * @param array $data * @return Response */ public static function error($code, $data = array()) { return new static(View::make('error.' . $code, $data), $code); }
/** * Create the layout that is assigned to the controller. * * @return View */ public function layout() { if (starts_with($this->layout, 'name: ')) { return View::of(substr($this->layout, 6)); } return View::make($this->layout); }
/** * Method for displaying all notifications that have been added on the previous request. * * <code> * // Add a info notification that will show for 3 seconds with a close button * echo Notification::show(); * </code> * * @author Nick <*****@*****.**> */ public static function show() { $notifications = Session::get('notifications'); if (count($notifications) > 0) { return View::make('admin::layouts.notifications')->with('notifications', $notifications); } }
/** * Set the body of the email. * * @param string $message * @return Driver */ public function body($body) { if (strpos($body, 'view: ') === 0) { $body = substr($body, 6); $body = View::make($body, (array) $this->body); } $this->body = $body; return $this; }
public function render_admin_sub_menu_items($menuArray, $class = '', $path = null) { // the path will be used if passed in the method call // for a specific path in the themes folder if (is_array($menuArray) and !empty($menuArray)) { $theme_name = $this->_theme_name; $theme_path_relative = $this->_theme_path . DS . $theme_name; $theme_path_absolute = $this->_theme_base_path . $theme_path_relative; $theme_partials_absolute = $theme_path_absolute . DS . 'partials' . DS; // LOOK IN THE THEME FOLDERS FIRST if (file_exists($tpath = $theme_partials_absolute . 'admin_nav_sub_items' . EXT)) { return View::make("path: " . $tpath)->with('items', $menuArray)->with('class', $class)->with('theme', $this); } elseif (file_exists($tpath = $theme_partials_absolute . 'admin_nav_sub_items' . BLADE_EXT)) { return View::make("path: " . $tpath)->with('items', $menuArray)->with('class', $class)->with('theme', $this); } // IF NOT FOUND IN THE THEMES FOLDER RETURN FROM THEMES if (file_exists($tpath = \Bundle::path('themes') . 'views' . DS . 'backend' . DS . 'partials' . DS . 'admin_nav_sub_items' . EXT)) { return View::make('themes::backend.partials.admin_nav_sub_items')->with('items', $menuArray)->with('class', $class)->with('theme', $this); } elseif (file_exists($tpath = \Bundle::path('themes') . 'views' . DS . 'backend' . DS . 'partials' . DS . 'admin_nav_sub_items' . BLADE_EXT)) { return View::make('themes::backend.partials.admin_nav_sub_items')->with('items', $menuArray)->with('class', $class)->with('theme', $this); } } }
/** * Returns a string containing * all required module names * * @return string comma separated module names */ public function requirements_to_string() { $result = array(); if (!empty($this->required)) { foreach ($this->required as $key => $value) { if (!empty($value)) { foreach ($value as $k => $v) { $version = $value['version']; if ($k == 'name') { $m = static::make($v); if ($m->is_valid()) { if ($m->installed) { if ($m->enabled) { if ($this->installer->check_version($m->version, $version, '>=')) { $result[] = View::make('modules::backend.partials.module_requirements_popup')->with('module_rq', $this)->with('module', $m)->with('class', 'green')->with('message', $this->name . ' module requires ' . $m->name . ' module, and it passes all requirements.')->render(); } else { $result[] = View::make('modules::backend.partials.module_requirements_popup')->with('module_rq', $this)->with('module', $m)->with('class', 'orange')->with('message', $this->name . ' module requires ' . $m->name . ' module version ' . $version . ', and currently you have installed version ' . $m->version . '.')->render(); } } else { $result[] = View::make('modules::backend.partials.module_requirements_popup')->with('module_rq', $this)->with('module', $m)->with('class', 'orange')->with('message', $this->name . ' module requires ' . $m->name . ' module, and it must be enabled.')->render(); } } else { $result[] = View::make('modules::backend.partials.module_requirements_popup')->with('module_rq', $this)->with('module', $m)->with('class', 'orange')->with('message', $this->name . ' module requires ' . $m->name . ' module, and it must be installed.')->render(); } } else { $result[] = View::make('modules::backend.partials.module_requirements_popup')->with('module_rq', $this)->with('module_slug', $v)->with('class', 'red')->with('message', $this->name . ' module requires ' . $v . ' module, and it was not found in the modules folder.')->render(); } } } } } return '<small>Requirements: (' . implode(', ', $result) . ')</small>'; } else { return ''; } }
/** * Render the given view. * * @param string $view * @param array $data * @return Laravel\View */ protected function getView($view, $data) { return View::make($view, $data)->render(); }