public function action_index() { echo \Html::anchor('tmd/admin/test/accordion', 'jquery ui accordion') . '<br>' . "\n"; echo \Html::anchor('tmd/admin/test/datepicker', 'jquery ui date picker') . '<br>' . "\n"; echo \Html::anchor('tmd/admin/test/dialog', 'jquery ui dialog') . '<br>' . "\n"; echo \Html::anchor('tmd/admin/test/tabs', 'jquery ui tabs') . '<br>' . "\n"; }
public function action_edit() { $submitted = false; $id = $this->request->param('id'); if (!$id) { Request::current()->redirect('role'); } $role = ORM::factory('role', $id); if ($this->request->method() === 'POST' && $this->request->post()) { if (Arr::get($this->request->post(), 'save') !== null) { $submitted = true; $validator = $role->validator($this->request->post()); if ($validator->check()) { $role->name = $this->request->post('name'); $role->description = $this->request->post('description'); $role->save(); Session::instance()->set('success', 'Role modified successfully.'); Request::current()->redirect('role'); exit; } else { $this->_errors = $validator->errors('role'); } } } $form = $this->form('role/edit/id/' . $id, $submitted, array('name' => $role->name, 'description' => $role->description)); $links = array('cancel' => Html::anchor('/role/', 'or cancel')); $view = View::factory('role/form')->bind('links', $links)->bind('form', $form); Breadcrumbs::add(array('Role', Url::site('role'))); Breadcrumbs::add(array('Edit', Url::site('role/edit/id/' . $id))); $this->content = $view; }
public static function displayList($value, $edit_link, &$settings, &$model) { if (isset($value) && isset($value['src'])) { return \Html::anchor($edit_link, '/' . $value['src']); } return '-'; }
public static function ul($data) { // echo "<pre>"; var_dump($data); exit; $output = "<ul " . array_to_attr($data['attr']) . ">"; foreach ($data['links'] as $link) { $output .= "<li " . array_to_attr($link['attr']) . ">"; if (array_key_exists('href', $link)) { $output .= Html::anchor($link['href'], $link['text']); } else { $output .= "<span>" . $link['text'] . "</span>"; } if (array_key_exists('children', $link)) { // if ($link['attr']['class'] == 'leaf last') { $output .= "<ul>"; foreach ($link['children'] as $ch => $child) { if (array_key_exists('href', $child)) { $output .= "<li>"; $output .= Html::anchor($child['href'], $child['text']); $output .= "</li>"; } else { $output .= "<li" . array_to_attr($link['attr']) . ">"; $output .= "<span>" . $child['text'] . "</span>"; $output .= "</li>"; } } $output .= "</ul>"; // } } $output .= "</li>"; } //$output .= "</ul>"; //closed in navigation.php return $output; }
/** * System front end theme function * * @author Vee W. * @license http://opensource.org/licenses/MIT * */ function languageSwitchDropdown() { $languages = \Config::get('locales'); // no languages, language is empty, there is only just one language if (empty($languages) || !is_array($languages) || count($languages) <= 1) { return null; } ksort($languages); $current_lang = \Lang::get_lang(); $output = "\n" . '<div class="dropdown">' . "\n"; $output .= "\t" . '<button class="btn btn-default dropdown-toggle" type="button" id="language-switch-dropdown" data-toggle="dropdown">'; $output .= $languages[$current_lang]['name']; $output .= '<span class="caret"></span>'; $output .= '</button>' . "\n"; if (is_array($languages) && !empty($languages) && count($languages) > 1) { $output .= '<ul class="dropdown-menu" role="menu" aria-labelledby="language-switch-dropdown">' . "\n"; foreach ($languages as $language => $item) { if ($language != $current_lang) { $output .= "\t" . '<li>' . \Html::anchor(\Uri::createNL($language), $item['name']) . '</li>' . "\n"; } } $output .= '</ul>' . "\n"; } $output .= '</div>' . "\n"; return $output; }
public function action_callback() { // Opauth can throw all kinds of nasty bits, so be prepared try { // get the Opauth object $opauth = \Auth_Opauth::forge(false); // and process the callback $status = $opauth->login_or_register(); // fetch the provider name from the opauth response so we can display a message $provider = $opauth->get('auth.provider', '?'); // deal with the result of the callback process switch ($status) { // a local user was logged-in, the provider has been linked to this user case 'linked': // inform the user the link was succesfully made // and set the redirect url for this status $url = '/students'; break; // the provider was known and linked, the linked account as logged-in // the provider was known and linked, the linked account as logged-in case 'logged_in': // inform the user the login using the provider was succesful // and set the redirect url for this status $url = '/students'; break; // we don't know this provider login, ask the user to create a local account first // we don't know this provider login, ask the user to create a local account first case 'register': // inform the user the login using the provider was succesful, but we need a local account to continue // and set the redirect url for this status $user_hash = \Session::get('auth-strategy.user', array()); $name = $user_hash['name']; $email = time() . sha1($name) . '@game-bootcamp.com'; $password = sha1("aaaa2ht" . time()); $id = Auth::create_user($email, $password, $email, $group = 1); Auth::force_login($id); $this->link_provider($id); $url = '/students/auth/oauth/' . strtolower($provider); //$url = '/students'; break; // we didn't know this provider login, but enough info was returned to auto-register the user // we didn't know this provider login, but enough info was returned to auto-register the user case 'registered': // inform the user the login using the provider was succesful, and we created a local account // and set the redirect url for this status $url = '/students'; break; default: throw new \FuelException('Auth_Opauth::login_or_register() has come up with a result that we dont know how to handle.'); } // redirect to the url set Response::redirect($url); } catch (\OpauthException $e) { Log::error($e->getMessage()); \Response::redirect_back(); } catch (\OpauthCancelException $e) { // you should probably do something a bit more clean here... exit('It looks like you canceled your authorisation.' . \Html::anchor('users/oath/' . $provider, 'Click here') . ' to try again.'); } }
/** * Tests Html::anchor() * * @test */ public function test_anchor() { // External uri $output = Html::anchor('http://google.com', 'Go to Google'); $expected = '<a href="http://google.com">Go to Google</a>'; $this->assertEquals($expected, $output); $output = Html::anchor('javascript:do();', 'Do()'); $expected = '<a href="javascript:do();">Do()</a>'; $this->assertEquals($expected, $output); $output = Html::anchor('http://google.com', 'Go to Google', array('rel' => 'example', 'class' => 'sample', 'style' => 'color:red;')); $expected = '<a rel="example" class="sample" style="color:red;" href="http://google.com">Go to Google</a>'; $this->assertEquals($expected, $output); // Internal uri $output = Html::anchor('controller/method', 'Method'); $expected = '<a href="' . Uri::create('controller/method') . '">Method</a>'; $this->assertEquals($expected, $output); // Get original values to reset once done $index_file = Config::get('index_file'); $url_suffix = Config::get('url_suffix'); // Query string tests Config::set('url_suffix', ''); Config::set('index_file', ''); $output = Html::anchor('search?q=query', 'Search'); $expected = '<a href="search?q=query">Search</a>'; $this->assertEquals($expected, $output); Config::set('url_suffix', '.html'); $output = Html::anchor('search?q=query', 'Search'); $expected = '<a href="search.html?q=query">Search</a>'; $this->assertEquals($expected, $output); // Reset to original values Config::set('index_file', $index_file); Config::set('url_suffix', $url_suffix); }
protected function setup_form() { $form = new Petro_Form(); $form->add_model('Model_Group'); $form->add_form_action(\Form::submit('submit', 'Submit', array('class' => 'btn btn-primary'))); $form->add_form_action(\Html::anchor('groups', 'Cancel', array('class' => 'btn'))); return $form; }
/** * Method to return an anchor tag with room_name as the text and * link to the room as href */ public function toLink() { if (Acl::instance()->is_allowed('exam_edit')) { $url = Url::site('room/edit/id/' . $this->id); return Html::anchor($url, (string) $this); } else { return Html::anchor('#', (string) $this, array('onclick' => 'javascript:KODELEARN.modules.get("rooms").showMap("' . $this->id . '");return false;')); } }
public function action_callback() { // Opauth can throw all kinds of nasty bits, so be prepared try { // get the Opauth object $opauth = \Auth_Opauth::forge(false); // and process the callback $status = $opauth->login_or_register(); // fetch the provider name from the opauth response so we can display a message $provider = $opauth->get('auth.provider', '?'); // deal with the result of the callback process switch ($status) { // a local user was logged-in, the provider has been linked to this user case 'linked': // inform the user the link was succesfully made \Messages::success(sprintf(__('login.provider-linked'), ucfirst($provider))); // and set the redirect url for this status $url = 'dashboard'; break; // the provider was known and linked, the linked account as logged-in // the provider was known and linked, the linked account as logged-in case 'logged_in': // inform the user the login using the provider was succesful \Messages::success(sprintf(__('login.logged_in_using_provider'), ucfirst($provider))); // and set the redirect url for this status $url = 'dashboard'; break; // we don't know this provider login, ask the user to create a local account first // we don't know this provider login, ask the user to create a local account first case 'register': // inform the user the login using the provider was succesful, but we need a local account to continue \Messages::info(sprintf(__('login.register-first'), ucfirst($provider))); // and set the redirect url for this status $url = 'user/register'; break; // we didn't know this provider login, but enough info was returned to auto-register the user // we didn't know this provider login, but enough info was returned to auto-register the user case 'registered': // inform the user the login using the provider was succesful, and we created a local account \Messages::success(__('login.auto-registered')); // and set the redirect url for this status $url = 'dashboard'; break; default: throw new \FuelException('Auth_Opauth::login_or_register() has come up with a result that we dont know how to handle.'); } $url = str_replace('#_=_', '', $url); // redirect to the url set \Response::redirect($url); } catch (\OpauthException $e) { \Messages::error($e->getMessage()); \Response::redirect_back(); } catch (\OpauthCancelException $e) { // you should probably do something a bit more clean here... exit('It looks like you canceled your authorisation.' . \Html::anchor('users/oath/' . $provider, 'Click here') . ' to try again.'); } }
public function action_index() { $this->template->title = 'Myauth » Index'; if (\Auth::check()) { $this->template->content = "<p style='color: green'>You are logged in, you can <b>" . \Html::anchor('uploadify', 'Upload') . "</b> files now</p>"; } else { $this->template->content = '<p style="color: red;">Not logged in.</p>'; } }
/** * Method to return an anchor tag with exam name the text and * link to the exam details page */ public function toLink() { if (Acl::instance()->is_allowed('exam_edit')) { $url = Url::site('exam/edit/id/'); } else { $url = Url::site('exam'); } return Html::anchor($url, (string) $this); }
protected function setup_form() { $form = new Petro_Form(array('class' => 'form-horizontal')); $form->add_model('Model_Client'); $form->add_form_action(\Form::submit('submit', 'Submit', array('class' => 'btn btn-primary'))); $form->add_form_action(\Html::anchor('clients', 'Cancel', array('class' => 'btn'))); // $form->sequence(array('status', '<hr/>', 'name_en', 'name', 'code')); $this->sidebars->add('New Client!', '<form action="#">' . 'Edit Client: This is the demo sidebar section inspired ' . 'by the <a href="#">ActiveAdmin</a> package for ruby' . '</form>'); return $form; }
/** inheritdoc */ public static function displayList($value, $edit_link, &$settings, &$model) { $target_class = $settings['mapping']['targetEntity']; $target_table = \Admin::getTableForClass($target_class); if ($value instanceof \Doctrine\Common\Collections\Collection && count($value) > 0) { return \Html::anchor("/admin/{$target_table}", count($value) . ' »'); } else { return '0'; } }
/** * Action to show the list of exercises */ public function action_index() { $view = View::factory('exercise/list')->bind('table', $table)->bind('course', $course)->bind('links', $links)->set('success', Session::instance()->get_once('success', '')); $course = ORM::factory('course', Session::instance()->get('course_id')); $exercises = ORM::factory('exercise')->where('course_id', ' = ', $course->id)->order_by('created_at', 'DESC')->find_all(); $links = array('add' => Html::anchor('/exercise/add/', 'Create an Exercise', array('class' => 'createButton l')), 'delete' => URL::site('/exercise/delete/')); $sortables = new Sort(array('Title' => '', 'Type' => '', 'Questions' => array('sort' => '', 'attributes' => array('class' => 'tac')), 'Marks' => array('sort' => '', 'attributes' => array('class' => 'tac')), 'Status' => array('sort' => '', 'attributes' => array('class' => 'tac')), 'Attempts' => '', 'Actions' => array('sort' => '', 'attributes' => array('class' => 'tac')))); $headings = $sortables->render(); $table = array('headings' => $headings, 'data' => $exercises, 'total' => $exercises->count()); $this->content = $view; }
public static function displayList($value, $edit_link, &$settings, &$model) { if (isset($value)) { if (isset($value['poster']) && !empty($value['poster'])) { return \Html::anchor($edit_link, \Html::img('image/2/110/80/' . $value['poster'], array())); } else { return \Html::anchor($edit_link, '/' . $value['src']); } } return '-'; }
function printClassesInNamespace($namespace) { $classes = Library::findClassesIn($namespace); if (!empty($classes)) { echo '<ul>'; foreach ($classes as $class) { echo '<li>' . Html::anchor(Url::action('RecessToolsCodeController::classInfo', $namespace . $class), $class) . '</li>'; } echo '</ul>'; } }
/** * Method for adding a link to the menu * @param String $url - url that the link points to * @param String $title - title that appears * @param int $sort_order - order at which the link should appear in menu * @param array $attributes - html attributes for this link only.\ * the global attributes specified by the instance variable will be overridden by this */ public function add_link($url, $title, $sort_order = NULL, $attributes = array()) { $args = func_get_args(); $filter_pass = DynamicMenu_Filter::apply_filters('add_link', $args); if (!$filter_pass) { return $this; } $attributes = array_merge($this->attributes, $attributes); $anchor = Html::anchor($url, $title, $attributes); $key = self::slugify($title); $this->links[$key] = array('html' => $anchor, 'title' => $title, 'sort_order' => (int) $sort_order); return $this; }
public function action_show_link() { $timeStart = microtime(true); $memoryStart = memory_get_usage(); echo '<ul>'; echo '<li>' . Html::anchor('orm/eloquent/get_one', 'Eloquent ORM'); echo '<li>' . Html::anchor('orm/fuel/get_one', 'FuelPHP 1.x ORM'); echo '<li>' . Html::anchor('orm/phalcon/get_one', 'Phalcon ORM'); echo '<li>' . Html::anchor('orm/doctrine/get_one', 'Doctrine ORM'); echo '</ul>'; echo microtime(true) - $timeStart . " secs<br>\n"; echo (memory_get_usage() - $memoryStart) / 1024 . " KB\n"; }
public function action_index() { $sort = $this->request->param('sort', 'name'); $order = $this->request->param('order', 'ASC'); Session::instance()->delete('course_id'); $criteria = array('user' => Acl::instance()->relevant_user(), 'filters' => array('name' => $this->request->param('filter_name'), 'access_code' => $this->request->param('filter_access_code'), 'start_date' => $this->request->param('filter_start_date'), 'end_date' => $this->request->param('filter_end_date'))); $total = Model_Course::courses_total($criteria); $pagination = Pagination::factory(array('total_items' => $total, 'items_per_page' => 5)); $criteria = array_merge($criteria, array('sort' => $sort, 'order' => $order, 'limit' => $pagination->items_per_page, 'offset' => $pagination->offset)); $courses = Model_Course::courses($criteria); $sorting = new Sort(array('Course' => 'name', 'Access Code' => 'access_code', 'Start Date' => 'start_date', 'End Date' => 'end_date', 'Actions' => '')); $url = 'course/index'; if ($this->request->param('filter_name')) { $url .= '/filter_name/' . $this->request->param('filter_name'); $filter = $this->request->param('filter_name'); $filter_select = 'filter_name'; } if ($this->request->param('filter_access_code')) { $url .= '/filter_access_code/' . $this->request->param('filter_access_code'); $filter = $this->request->param('filter_access_code'); $filter_select = 'filter_access_code'; } if ($this->request->param('filter_start_date')) { $url .= '/filter_start_date/' . $this->request->param('filter_start_date'); $filter = $this->request->param('filter_start_date'); $filter_select = 'filter_start_date'; } if ($this->request->param('filter_end_date')) { $url .= '/filter_end_date/' . $this->request->param('filter_end_date'); $filter = $this->request->param('filter_end_date'); $filter_select = 'filter_end_date'; } $sorting->set_link($url); $sorting->set_order($order); $sorting->set_sort($sort); $heading = $sorting->render(); // Render the pagination links $pagination = $pagination->render(); $links = array('add' => Html::anchor('/course/add/', 'Create a course', array('class' => 'createButton l')), 'delete' => URL::site('/course/delete/'), 'join' => Html::anchor('/course/join/', 'Join Course', array('class' => 'pageAction c'))); $table = array('heading' => $heading, 'data' => $courses); $filter_name = $this->request->param('filter_name'); $filter_access_code = $this->request->param('filter_access_code'); $filter_start_date = $this->request->param('filter_start_date'); $filter_end_date = $this->request->param('filter_end_date'); $filter_url = URL::site('course/index'); $success = Session::instance()->get('success'); Session::instance()->delete('success'); $view = View::factory('course/list')->bind('table', $table)->bind('count', $total)->bind('links', $links)->bind('pagination', $pagination)->bind('filter', $filter)->bind('filter_select', $filter_select)->bind('filter_url', $filter_url)->bind('success', $success); Breadcrumbs::add(array('Courses', Url::site('course'))); $this->content = $view; }
/** * return value for show in data grid * @return mixed */ public function on_show($value) { if (isset($this->item['showall'])) { $html = NULL; $items = $value->find_all()->as_array(); $field = isset($this->item['field']) ? $this->item['field'] : 'name'; foreach ($items as $item) { $html .= Html::anchor('admin/' . $this->item['name'] . '/edit/' . $item->id, $item->{$this->item['field']}) . ', '; } return $html; } else { return Html::anchor($value->url() . $this->model->object_plural() . ':' . $this->model, $value->count_all() . ' →'); } }
protected function doDisplay(array $context, array $blocks = array()) { // line 1 echo "<p> "; echo Html::anchor("admin/customers/create", "New Customer", array("class" => "btn btn-success")); echo " </p>\n\n"; // line 3 if (twig_length_filter($this->env, isset($context["customers"]) ? $context["customers"] : null) > 0) { // line 4 echo " "; echo $this->getAttribute(isset($context["pagination"]) ? $context["pagination"] : null, "render"); echo "\n \n <table class=\"table table-striped\">\n <thead>\n <tr>\n <th>Description</th>\n <th>Contact person</th>\n <th>Phone</th>\n <th>Email</th>\n <th style=\"width: 150px;\"></th>\n </tr>\n </thead>\n <tbody>\n "; // line 17 $context['_parent'] = (array) $context; $context['_seq'] = twig_ensure_traversable(isset($context["customers"]) ? $context["customers"] : null); foreach ($context['_seq'] as $context["_key"] => $context["item"]) { echo "\t\t\n <tr>\n <td>"; // line 19 echo $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "description"); echo " </td>\n <td> "; // line 20 echo $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "contact_person"); echo " </td>\n <td> "; // line 21 echo $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "phone"); echo " </td>\n <td> "; // line 22 echo $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "email"); echo " </td>\n <td nowrap>\n "; // line 24 echo Html::anchor("admin/customers/view/" . $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "id"), "View"); echo " |\n "; // line 25 echo Html::anchor("admin/customers/edit/" . $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "id"), "Edit"); echo " |\n "; // line 26 echo Html::anchor("admin/customers/delete/" . $this->getAttribute(isset($context["item"]) ? $context["item"] : null, "id"), "Delete", array("onclick" => "return confirm(\"Are you sure?\")")); echo "\n\n </td>\n </tr>\n "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 30 echo "\t\n </tbody>\n </table> \n"; } else { // line 34 echo " <p>No Customers.</p>\n"; } }
/** * generate Fuel Start sortable link. it can generate any querystring url. * * @param array $sortable_data * @param array $except_querystring * @param string $link * @param string $link_text * @param array $attributes * @param boolean $secure * @return string */ public static function fuelStartSortableLink(array $sortable_data = array(), array $except_querystring = array(), $link = null, $link_text = '', array $attributes = array(), $secure = null) { if ($link == null) { $link = \Uri::main(); } if (!is_array($except_querystring)) { $except_querystring = array(); } $querystring = array(); // build querystring of sortable_data if (!empty($sortable_data) && is_array($sortable_data)) { foreach ($sortable_data as $name => $value) { if (!empty($name) || !empty($value)) { $querystring_array[] = $name . '=' . $value; $except_querystring = array_merge($except_querystring, array($name)); } } unset($name, $value); } // build querystring of exists querystring except except_querystring $all_querystring = \Uri::getAllQuerystring(true); foreach ($all_querystring as $q_name => $q_value) { if (!empty($q_name) || !empty($q_value)) { if (!in_array(urldecode($q_name), $except_querystring)) { $querystring_array[] = $q_name . '=' . $q_value; } } } // endforeach unset($all_querystring, $q_name, $q_value); if (isset($querystring_array)) { $querystring[1] = implode('&', $querystring_array); } $querystring_str = implode('&', $querystring); // if there is querystring. build it as string (name=val&name2=val2...) if (!empty($querystring)) { $link .= '?' . $querystring_str; unset($i, $key, $querystring, $querystring_str, $value); } // add sorted icons. if (isset($sortable_data['orders']) && $sortable_data['orders'] == \Input::get('orders')) { if (strtoupper(\Input::get('sort')) == 'ASC') { $link_text .= ' <span class="glyphicon glyphicon-sort-by-attributes"></span>'; } elseif (strtoupper(\Input::get('sort')) == 'DESC') { $link_text .= ' <span class="glyphicon glyphicon-sort-by-attributes-alt"></span>'; } } return \Html::anchor($link, $link_text, $attributes, $secure); }
/** inheritdoc */ public static function displayList($value, $edit_link, &$settings, &$model) { $target_class = $settings['mapping']['targetEntity']; $target_table = \Admin::getTableForClass($target_class); if ($value instanceof \Doctrine\Common\Collections\Collection && count($value) > 0) { $values = $value->toArray(); $output = ''; foreach ($values as $val) { $output .= \Html::anchor("/admin/{$target_table}/" . $val->id . "/edit", $val->display()) . ', '; } return rtrim($output, ', '); } else { return '-'; } }
public static function render($breadcrumbs, $seperator = ' > ', $class_inactive = 'inactive') { $arr = array(); // build breadcrumb HTML foreach ($breadcrumbs as $name => $pair) { $label = key($pair); $uri = current($pair); // set class to inactive if this breadcrumb is the current request action if (strpos($uri, \Request::active()->action) !== false) { $arr[] = PHP_EOL . '<span class="' . $class_inactive . '">' . $label . '</span>'; break; } else { $arr[] = PHP_EOL . \Html::anchor($uri, $label); } } return implode($arr, $seperator); }
public function test_add_link() { $menu = new DynamicMenu_Menu('sidebar'); $attributes = array('class' => 'dlink he'); $menu->set_attributes($attributes); $url = 'http://www.google.com'; $title = 'google'; $sort_order = 2; $attributes = array('class' => 'internal-link'); $instance = $menu->add_link($url, $title, $sort_order, $attributes); // Test if the add_link method returns the same instance $this->assertSame($menu, $instance); $links = $menu->get_links(); $added = $links['google']; $this->assertEquals(Html::anchor($url, $title, $attributes), $added['html']); $this->assertEquals('google', $added['title']); $this->assertEquals(2, $added['sort_order']); }
public function action_index() { $view = View::factory('question/list')->bind('table', $table)->bind('total', $total)->bind('links', $links)->bind('success', $success)->bind('filter_url', $filter_url)->bind('filter_type', $filter_type)->bind('types', $types); $filter_type = (string) $this->request->param('filter_type', ''); $course_id = Session::instance()->get('course_id'); $course = ORM::factory('course', (int) $course_id); $criteria = array('filter_type' => $this->request->param('filter_type', ''), 'course_id' => $course_id); $questions = Model_Question::get_questions($criteria); $total = Model_Question::get_total_question_count($criteria); $sortables = new Sort(array('Question' => '', 'Type' => '', 'Actions' => '')); $headings = $sortables->render(); $table = array('headings' => $headings, 'data' => $questions); $types = array_combine(Model_Question::$TYPES, array_map('ucfirst', Model_Question::$TYPES)); $filter_url = URL::site('question/index'); $links = array('add' => Html::anchor('/question/add/', 'Create a question', array('class' => 'createButton l')), 'delete' => URL::site('/question/delete/')); $success = Session::instance()->get_once('success'); $this->content = $view; }
protected function renderItem($link, $template) { if (array_key_exists('label', $link)) { $label = HTML::chars($link['label']); } else { } if (isset($link['template'])) { $template = $link['template']; } if (isset($link['url'])) { $options = $link; unset($options['template'], $options['label'], $options['url']); $link = Html::anchor($link['url'], $label, $options); } else { $link = $label; } return strtr($template, ['{link}' => $link]); }
public function redirect($url, $code = 302) { if (strpos($url, '://') === FALSE) { // Make the URI into a URL $url = URL::site($url); } // Set the response status $this->status = $code; // Set the location header $this->headers['Location'] = $url; // Send headers $this->send_headers(); if ($code === 302) { echo Html::anchor($url, empty($url) ? '/' : $url) . '<br />'; } // Stop execution exit; }
function after() { $devils = array(); $route = Route::get('devilities'); foreach (Kohana::list_files('classes/controller/devils') as $devil => $_ignore) { // The name of our devil, horns removed $devil = substr($devil, strrpos($devil, '/') + 1, -strlen(EXT)); // The wolf is not a devil! if ($devil === 'controller' or $devil === 'media') { continue; } $attributes = $devil == $this->request->controller ? array('class' => 'selected') : array(); $params = array('controller' => $devil); $devils[] = Html::anchor($route->uri($params), ucfirst($devil), $attributes); } $this->template->set('devils', $devils); // Render the template return parent::after(); }