本文整理汇总了PHP中Html::anchor方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::anchor方法的具体用法?PHP Html::anchor怎么用?PHP Html::anchor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::anchor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_index
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";
}
示例2: action_edit
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;
}
示例3: displayList
public static function displayList($value, $edit_link, &$settings, &$model)
{
if (isset($value) && isset($value['src'])) {
return \Html::anchor($edit_link, '/' . $value['src']);
}
return '-';
}
示例4: ul
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;
}
示例5: languageSwitchDropdown
/**
* 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;
}
示例6: action_callback
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.');
}
}
示例7: test_anchor
/**
* 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);
}
示例8: setup_form
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;
}
示例9: toLink
/**
* 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;'));
}
}
示例10: action_callback
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.');
}
}
示例11: action_index
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>';
}
}
示例12: toLink
/**
* 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);
}
示例13: setup_form
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;
}
示例14: displayList
/** 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';
}
}
示例15: action_index
/**
* 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;
}