本文整理汇总了PHP中Breadcrumbs::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Breadcrumbs::instance方法的具体用法?PHP Breadcrumbs::instance怎么用?PHP Breadcrumbs::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Breadcrumbs
的用法示例。
在下文中一共展示了Breadcrumbs::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_edit
public function action_edit($id)
{
$term = ORM::factory('category', $id);
if (!$term->loaded()) {
Message::instance()->set('Invalid category.');
$this->request->redirect('admin/taxonomy');
}
if (strtolower(Request::$method) == 'post') {
$post = Validate::factory($_POST);
$post->rule('title', 'not_empty')->rule('name', 'not_empty');
if ($post->check()) {
$term->title = $post["title"];
$term->name = $post["name"];
$term->save();
Message::instance()->set('Category updated.', Message::INFO);
$this->request->redirect('admin/taxonomy');
} else {
Message::instance()->set('Try again.');
$this->request->redirect('admin/taxonomy/' . $id . '/edit');
}
} else {
$this->template = View::factory('admin/taxonomy/edit');
$term = ORM::factory('category', (int) $id);
$this->template->term = $term;
}
Breadcrumbs::instance()->add('Management', 'admin/')->add('Categories', 'admin/taxonomy')->add($term->title, 'admin/taxonomy/' . $term->id . '/edit');
}
示例2: action_index
public function action_index()
{
$supplychain_alias = ORM::factory('supplychain_alias');
$page = max($this->request->param('page'), 1);
$items = 20;
$offset = $items * ($page - 1);
$count = $supplychain_alias->count_all();
$pagination = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'page'), 'total_items' => $supplychain_alias->count_all(), 'items_per_page' => $items));
$this->template->supplychain_alias = $supplychain_alias->limit($pagination->items_per_page)->offset($pagination->offset)->find_all()->as_array(null, array('id', 'site', 'alias', 'supplychain_id'));
$this->template->page_links = $pagination->render();
$this->template->offset = $pagination->offset;
$supplychain_alias_count = $supplychain_alias->count_all();
$post = Validate::factory($_POST);
$post->rule('site', 'not_empty')->rule('alias', 'not_empty')->filter('site', 'strip_tags')->filter('alias', 'strip_tags')->rule('supplychain_id', 'not_empty')->filter(true, 'trim');
if (strtolower(Request::$method) === 'post' && $post->check()) {
$check = false;
$post = (object) $post->as_array();
$site_added = $post->site;
$alias_added = $post->alias;
$id = $post->supplychain_id;
// check if the alias already exists, if not add new alias
$supplychain_alias = ORM::factory('supplychain_alias');
$supplychain_alias->supplychain_id = $id;
$supplychain_alias->site = $site_added;
$supplychain_alias->alias = $alias_added;
try {
$supplychain_alias->save();
} catch (Exception $e) {
Message::instance()->set('Could not create alias. Violates the unique (site, alias)');
}
$this->request->redirect('admin/aliases');
}
Breadcrumbs::instance()->add('Management', 'admin/')->add('Aliases', 'admin/aliases');
}
示例3: action_index
public function action_index()
{
$supplychain = ORM::factory('supplychain');
$user = ORM::factory('user');
$usergroup = ORM::factory('usergroup');
$today = strtotime("now");
$last_week = strtotime("-7 day");
// last week's updates
$get_supplychain = $supplychain->where('created', 'BETWEEN', array($last_week, $today))->count_all();
$get_userlogins = $user->where('last_login', 'BETWEEN', array($last_week, $today))->count_all();
$get_adminlogins = $user->where('username', '=', 'administrator')->find()->as_array(null, 'last_login');
$admin_lastlogin = date("F j \\a\\t g:i a", $get_adminlogins['last_login']);
$total_count = $supplychain->count_all();
$supplychain_array = $supplychain->find_all()->as_array();
$get_usercreated = $user->where('created', 'BETWEEN', array($last_week, $today))->count_all();
//today's updates
$start_time = strtotime(strftime('%Y-%m-%d 00:00:00'));
$get_usercreated_today = $user->where('created', 'BETWEEN', array($start_time, $today))->count_all();
$get_supplychaincreated_today = $supplychain->where('created', 'BETWEEN', array($start_time, $today))->count_all();
$stop = null;
foreach ($supplychain_array as $supplychain_single) {
$stop_count = $supplychain_single->stops->count_all();
if ($stop_count > $stop) {
$stop = $stop_count;
$supplychain_id = $supplychain_single->id;
} else {
$stop = $stop;
}
}
$hop = null;
foreach ($supplychain_array as $supplychain_single) {
$hop_count = $supplychain_single->hops->count_all();
if ($hop_count > $hop) {
$hop = $stop_count;
$supplychain_hop_id = $supplychain_single->id;
} else {
$hop = $hop;
}
}
$this->template->supplychain_lastweek = $get_supplychain;
$this->template->user_lastlogin = $get_userlogins;
$this->template->admin_lastlogin = $admin_lastlogin;
$this->template->user_lastweek = $get_usercreated;
$this->template->supplychain_id = $supplychain_id;
$this->template->stop = $stop;
$this->template->supplychain_hop_id = $supplychain_id;
$this->template->hop = $hop;
$this->template->user_today = $get_usercreated_today;
$this->template->supplychain_today = $get_supplychaincreated_today;
$this->layout->page_title = 'Sourcemap Management';
Breadcrumbs::instance()->add('Management', 'admin/');
}
示例4: action_details
public function action_details($id)
{
$this->template = View::factory('admin/groups/details');
$group = ORM::factory('usergroup', $id);
$group_members = array();
foreach ($group->members->find_all()->as_array() as $i => $user) {
$group_members[] = $user->as_array();
}
$owner = $group->owner->username;
$this->template->group = $group;
$this->template->owner = $owner;
$this->template->members = $group_members;
Breadcrumbs::instance()->add('Management', 'admin/')->add('Groups', 'admin/groups')->add(ucwords($group->name), 'admin/groups/' . $id);
}
示例5: action_details
public function action_details($id)
{
$this->template = View::factory('admin/users/details');
$user = ORM::factory('user', $id);
$get_last_login = $user->last_login;
$last_login = date("F j, Y, g:i a", $get_last_login);
$roles = array();
foreach ($user->roles->find_all()->as_array() as $i => $role) {
$roles[] = $role->as_array();
}
$all_roles = ORM::factory('role')->find_all()->as_array('id', array('id', 'name'));
$members = array();
foreach ($user->groups->find_all()->as_array() as $i => $usergroup) {
$members[] = $usergroup->as_array();
}
$owners = array();
foreach ($user->owned_groups->find_all()->as_array() as $i => $usergroup) {
$owners[] = $usergroup->as_array();
}
$apikeys = $user->apikeys->find_all()->as_array('apikey', true);
$this->template->user = $user;
$this->template->roles = $roles;
$this->template->all_roles = $all_roles;
$this->template->members = $members;
$this->template->owners = $owners;
$this->template->last_login = $last_login;
$this->template->apikeys = $apikeys;
// this is to reset the password
// todo: move this.
$post = Validate::factory($_POST);
$post->rule('email', 'not_empty')->rule('password', 'not_empty')->rule('password', 'max_length', array(16))->rule('password', 'min_length', array(6))->rule('confirmpassword', 'not_empty')->rule('confirmpassword', 'max_length', array(16))->rule('confirmpassword', 'min_length', array(6))->rule('email', 'validate::email')->filter(true, 'trim');
if (strtolower(Request::$method) === 'post' && $post->check()) {
$post = (object) $post->as_array();
if ($post->password == $post->confirmpassword) {
$user_row = ORM::factory('user')->where('email', '=', $post->email)->find();
$user_row->password = $post->password;
try {
$user_row->save();
Message::instance()->set('Password changed successfully!');
} catch (Exception $e) {
Message::instance()->set('Password reset failed!');
}
} else {
Message::instance()->set('Please enter again - passwords did not match.', Message::ERROR);
}
} elseif (strtolower(Request::$method) === 'post') {
Message::instance()->set('Invalid Password Reset.', Message::ERROR);
}
Breadcrumbs::instance()->add('Management', 'admin/')->add('Users', 'admin/users')->add(ucwords($user->username), 'admin/users/' . $user->id);
}
示例6: action_index
public function action_index()
{
$role = ORM::factory('role');
$page = max($this->request->param('page'), 1);
$items = 20;
$offset = $items * ($page - 1);
$count = $role->count_all();
$pagination = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'page'), 'total_items' => $role->count_all(), 'items_per_page' => $items));
$this->template->roles = $role->order_by('name', 'ASC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all()->as_array(null, array('id', 'name', 'description'));
$this->template->page_links = $pagination->render();
$this->template->offset = $pagination->offset;
$role_count = $role->count_all();
Breadcrumbs::instance()->add('Management', 'admin/')->add('Roles', 'admin/roles');
}
示例7: action_index
public function action_index()
{
Breadcrumbs::instance()->add('Management', 'admin/')->add('Comments', 'admin/comments');
$default_params = array('p' => 1, 's' => 'date', 'or' => 'desc', 'l' => 20);
$params = $default_params;
foreach ($default_params as $k => $v) {
if (isset($_GET[$k])) {
$params[$k] = $_GET[$k];
}
}
$sort_order = strtolower($params['or']);
switch ($sort_order) {
case 'asc':
case 'desc':
break;
default:
throw new Exception('Invalid sort order.');
break;
}
$sort = strtolower($params['s']);
switch ($sort) {
case 'date':
$sort = 'timestamp';
break;
default:
throw new Exception('Invalid sort.');
break;
}
$limit = max(min($params['l'], 100), 1);
$page = max($params['p'], 1);
$offset = $limit * ($page - 1);
$comments = ORM::factory('supplychain_comment');
$comments->reset(false);
$count_all = $comments->count_all();
$comments = $comments->order_by($sort, $sort_order)->limit($limit, $offset)->find_all();
$comments_arr = array();
foreach ($comments as $i => $comment) {
$comment_arr = $comment->as_array();
$comment_arr['body'] = strlen($comment_arr['body']) > 32 ? substr($comment_arr['body'], 0, 32) . '...' : $comment_arr['body'];
$comment_arr['posted'] = date('H:i m/d/Y', $comment_arr['timestamp']);
$comment_arr['author'] = $comment->user->username;
$sc_attr = $comment->supplychain->attributes->find_all()->as_array('key', 'value');
$comment_arr['map_title'] = isset($sc_attr['title']) ? $sc_attr['title'] : 'An Unnamed Sourcemap';
$comments_arr[] = $comment_arr;
}
$pager = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'p'), 'total_items' => $count_all, 'items_per_page' => $limit, 'view' => 'pagination/basic', 'url_params' => $params));
$this->template->comments = $comments_arr;
$this->template->pager = $pager;
}
示例8: action_index
public function action_index()
{
$apikeys = ORM::factory('user_apikey');
$page = max($this->request->param('page'), 1);
$items = 20;
$offset = $items * ($page - 1);
$count = $apikeys->count_all();
$pagination = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'page'), 'total_items' => $apikeys->count_all(), 'items_per_page' => $items));
$apikeysa = $apikeys->order_by('created', 'desc')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all()->as_array('apikey', true);
$apikeyowners = $apikeys->user->find_all()->as_array('id', true);
foreach ($apikeysa as $i => $apikey) {
$apikeysa[$i]->owner = (object) $apikeyowners[$apikey->user_id];
}
$this->template->apikeys = $apikeysa;
$this->template->page_links = $pagination->render();
$this->template->offset = $pagination->offset;
Breadcrumbs::instance()->add('Management', 'admin/')->add('API Keys', 'admin/apikeys');
}
示例9: action_index
public function action_index()
{
$supplychain = ORM::factory('supplychain');
$page = max($this->request->param('page'), 1);
$items = 20;
$offset = $items * ($page - 1);
$supplychain = $supplychain->where(DB::expr('flags & ' . Sourcemap::FEATURED), '>', 0);
$supplychain = $supplychain->and_where(DB::expr('other_perms & ' . Sourcemap::READ), '>', 0);
$pagination = Pagination::factory(array('current_page' => array('source' => 'query_string', 'key' => 'page'), 'total_items' => $supplychain->reset(false)->count_all(), 'items_per_page' => $items));
$supplychains = $supplychain->order_by('modified', 'ASC')->limit($pagination->items_per_page)->offset($pagination->offset)->find_all();
$supplychains_array = $supplychains->as_array('id', array('id', 'created'));
$attributes = array();
foreach ($supplychains as $supplychain) {
$scid = $supplychain->id;
$supplychains_array[$scid] = (array) $supplychains_array[$scid];
$supplychains_array[$scid]['owner'] = $supplychain->owner->username;
$supplychains_array[$scid]['created'] = date("F j, Y, g:i a", $supplychains_array[$scid]['created']);
$supplychains_array[$scid]['attributes'] = $supplychain->attributes->find_all()->as_array('key', 'value');
}
$this->template->page_links = $pagination->render();
$this->template->offset = $pagination->offset;
$this->template->list = $supplychains_array;
Breadcrumbs::instance()->add('Management', 'admin/')->add('Featured Supply Chains', 'admin/featured');
}
示例10: array
</head>
<body class="main admin">
<?php
echo View::factory('partial/branding', array('page_title' => isset($page_title) ? $page_title : APPLONGNM));
?>
<div class="container">
<div class="messages">
<p><?php
echo Message::instance()->get() ? Message::instance()->render() : false;
?>
</p>
</div>
</div>
<div id="admin-head" class="container">
<p><?php
echo Breadcrumbs::instance()->get() ? Breadcrumbs::instance()->render() : false;
?>
</p>
</div>
</div>
<div id="wrapper">
<?php
echo isset($content) ? $content : '<h2>There\'s nothing here.</h2>';
?>
<div class="push"></div>
</div><!-- #wrapper -->
<div id="footer">
<?php
echo View::factory('partial/footer', array('page_title' => isset($page_title) ? $page_title : APPLONGNM));
?>
示例11: before
public function before()
{
parent::before();
Breadcrumbs::instance()->add('Management', 'admin')->add('Announcements', 'admin/announcements');
}
示例12: action_details
public function action_details($id)
{
$this->template = View::factory('admin/supplychains/details');
$supplychain = ORM::factory('supplychain', $id);
$stop_count = $supplychain->stops->count_all();
$hop_count = $supplychain->hops->count_all();
$supplychain_permissions = $supplychain->other_perms;
$supplychain_permissions == 1 ? $permissions = "public" : ($permissions = "private");
$permissions_array = array("public", "private");
$group_permissions_array = array("Nothing", "Read", "Write", "Read and Write");
// TODO: fix this (masks)
switch ($supplychain->usergroup_perms) {
case 0:
$usergroup_perms = "Nothing";
break;
case 1:
$usergroup_perms = "Read";
break;
case 2:
$usergroup_perms = "Write";
break;
case 3:
$usergroup_perms = "Read and Write";
break;
default:
}
$attributes = $supplychain->attributes->find_all()->as_array('key', 'value');
$alias = $supplychain->alias->find_all()->as_array(null, array('supplychain_id', 'site', 'alias'));
$owner_group = $supplychain->owner_group->find()->as_array(null, array('id', 'name'));
$owner = $supplychain->owner->as_array(null, 'username');
$this->template->stop_count = $stop_count;
$this->template->hop_count = $hop_count;
$this->template->attributes = $attributes;
$this->template->alias = $alias;
$this->template->permissions = $permissions;
$this->template->permissions_array = $permissions_array;
$this->template->id = $id;
$this->template->owner_group = $owner_group['name'];
$this->template->owner = $owner['username'];
$this->template->owner_id = $owner['id'];
$this->template->usergroup_perms = $usergroup_perms;
$this->template->group_permissions_array = $group_permissions_array;
$this->template->flags = $supplychain->flags;
//create an alias
$post = Validate::factory($_POST);
$post->rule('site', 'not_empty')->rule('alias', 'not_empty')->filter('site', 'strip_tags')->filter('alias', 'strip_tags')->filter(true, 'trim');
if (strtolower(Request::$method) === 'post' && $post->check()) {
$post = (object) $post->as_array();
$site_added = $post->site;
$alias_added = $post->alias;
$supplychain_alias = ORM::factory('supplychain_alias');
$supplychain_alias->supplychain_id = $id;
$supplychain_alias->site = $site_added;
$supplychain_alias->alias = $alias_added;
try {
$supplychain_alias->save();
} catch (Exception $e) {
Message::instance()->set('Could not create alias. Violates the unique (site, alias)');
}
$this->request->redirect("admin/supplychains/" . $id);
}
Breadcrumbs::instance()->add('Management', 'admin/')->add('Supply Chains', 'admin/supplychains')->add(ucwords($id), 'admin/supplychains/' . $id);
}
示例13: rssBreadcrumbsLink
/**
* prepares the RSS link found in breadcrumbs
*
* @param string $status - post status, e.g. new, top, etc.
* @param array $vars - array of key -> value pairs
* @return string
*/
public function rssBreadcrumbsLink($status = '', $vars = array())
{
$breadcrumbs = Breadcrumbs::instance();
return $breadcrumbs->rssBreadcrumbsLink($this, $status, $vars);
}
示例14: action_index
public function action_index()
{
$now = time();
$midnight = strtotime(strftime('%Y-%m-%d 00:00:00'));
$weekago = strtotime("-1 week");
$firstofmonth = strtotime(strftime('%Y-%m-1 00:00:00'));
$sixmosago = strtotime(strftime('-6 months'));
$supplychain = ORM::factory('supplychain');
$user = ORM::factory('user');
$usergroup = ORM::factory('usergroup');
// TODO: clean this up
$today = array();
$today['users'] = $user->where('created', 'BETWEEN', array($midnight, $now))->count_all();
$today['maps'] = $supplychain->where('created', 'BETWEEN', array($midnight, $now))->count_all();
$today['logins'] = $user->where('last_login', 'BETWEEN', array($midnight, $now))->count_all();
$this->template->today = (object) $today;
$lastweek = array();
$lastweek['users'] = $user->where('created', 'BETWEEN', array($weekago, $now))->count_all();
$lastweek['maps'] = $supplychain->where('created', 'BETWEEN', array($weekago, $now))->count_all();
$lastweek['logins'] = $user->where('last_login', 'BETWEEN', array($weekago, $now))->count_all();
$this->template->lastweek = (object) $lastweek;
$thismonth = array();
$thismonth['users'] = $user->where('created', 'BETWEEN', array($firstofmonth, $now))->count_all();
$thismonth['maps'] = $supplychain->where('created', 'BETWEEN', array($firstofmonth, $now))->count_all();
$thismonth['logins'] = $user->where('last_login', 'BETWEEN', array($firstofmonth, $now))->count_all();
$this->template->thismonth = (object) $thismonth;
$sixmos = array();
$sixmos['users'] = $user->where('created', 'BETWEEN', array($sixmosago, $now))->count_all();
$sixmos['maps'] = $supplychain->where('created', 'BETWEEN', array($sixmosago, $now))->count_all();
$sixmos['logins'] = $user->where('last_login', 'BETWEEN', array($sixmosago, $now))->count_all();
$this->template->sixmos = (object) $sixmos;
$stop = $now;
$week_maps = array();
for ($i = 7; $i; $i--) {
$start = strtotime(sprintf("-%d %s", $i, $i > 1 ? 'days' : 'day'));
$stop = strtotime(sprintf("-%d %s", $i - 1, $i > 1 ? 'days' : 'day'));
$week_maps[] = $supplychain->where('created', 'BETWEEN', array($start, $stop))->count_all();
}
$this->template->week_maps = $week_maps;
$fourweeks_maps = array();
for ($i = 4; $i; $i--) {
$start = strtotime(sprintf("-%d %s", $i, $i > 1 ? 'weeks' : 'week'));
$stop = strtotime(sprintf("-%d %s", $i - 1, $i > 1 ? 'weeks' : 'week'));
$fourweeks_maps[] = $supplychain->where('created', 'BETWEEN', array($start, $stop))->count_all();
}
$this->template->fourweeks_maps = $fourweeks_maps;
$sixmos_maps = array();
for ($i = 6; $i; $i--) {
$start = strtotime(sprintf("-%d %s", $i, $i > 1 ? 'months' : 'month'));
$stop = strtotime(sprintf("-%d %s", $i - 1, $i > 1 ? 'months' : 'month'));
$sixmos_maps[] = $supplychain->where('created', 'BETWEEN', array($start, $stop))->count_all();
}
$this->template->sixmos_maps = $sixmos_maps;
$week_users = array();
for ($i = 7; $i; $i--) {
$start = strtotime(sprintf("-%d %s", $i, $i > 1 ? 'days' : 'day'));
$stop = strtotime(sprintf("-%d %s", $i - 1, $i > 1 ? 'days' : 'day'));
$week_users[] = $user->where('created', 'BETWEEN', array($start, $stop))->count_all();
}
$this->template->week_users = $week_users;
$fourweeks_users = array();
for ($i = 4; $i; $i--) {
$start = strtotime(sprintf("-%d %s", $i, $i > 1 ? 'weeks' : 'week'));
$stop = strtotime(sprintf("-%d %s", $i - 1, $i > 1 ? 'weeks' : 'week'));
$fourweeks_users[] = $user->where('created', 'BETWEEN', array($start, $stop))->count_all();
}
$this->template->fourweeks_users = $fourweeks_users;
$sixmos_users = array();
for ($i = 6; $i; $i--) {
$start = strtotime(sprintf("-%d %s", $i, $i > 1 ? 'months' : 'month'));
$stop = strtotime(sprintf("-%d %s", $i - 1, $i > 1 ? 'months' : 'month'));
$sixmos_users[] = $user->where('created', 'BETWEEN', array($start, $stop))->count_all();
}
$this->template->sixmos_users = $sixmos_users;
$week_logins = array();
for ($i = 7; $i; $i--) {
$start = strtotime(sprintf("-%d %s", $i, $i > 1 ? 'days' : 'day'));
$stop = strtotime(sprintf("-%d %s", $i - 1, $i > 1 ? 'days' : 'day'));
$week_logins[] = $user->where('last_login', 'BETWEEN', array($start, $stop))->count_all();
}
$this->template->week_logins = $week_logins;
$fourweeks_logins = array();
for ($i = 4; $i; $i--) {
$start = strtotime(sprintf("-%d %s", $i, $i > 1 ? 'weeks' : 'week'));
$stop = strtotime(sprintf("-%d %s", $i - 1, $i > 1 ? 'weeks' : 'week'));
$fourweeks_logins[] = $user->where('last_login', 'BETWEEN', array($start, $stop))->count_all();
}
$this->template->fourweeks_logins = $fourweeks_logins;
$sixmos_logins = array();
for ($i = 6; $i; $i--) {
$start = strtotime(sprintf("-%d %s", $i, $i > 1 ? 'months' : 'month'));
$stop = strtotime(sprintf("-%d %s", $i - 1, $i > 1 ? 'months' : 'month'));
$sixmos_logins[] = $user->where('last_login', 'BETWEEN', array($start, $stop))->count_all();
}
$this->template->sixmos_logins = $sixmos_logins;
Breadcrumbs::instance()->add('Management', 'admin/')->add('Analytics', 'admin/analytics');
}
示例15:
" />
<title><?php
echo HTML::chars(isset($page_title) && $page_title ? $page_title : APPLONGNM);
?>
</title>
<link href="sites/default/assets/styles/error.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="masthead">
<h1><?php
echo HTML::chars(isset($page_title) && $page_title ? $page_title : APPLONGNM);
?>
</h1>
<?php
if (Breadcrumbs::instance()->get()) {
echo Breadcrumbs::instance()->render();
}
if (Message::instance()->get()) {
echo Message::instance()->render();
}
?>
</div>
<div id="main">
<?php
echo $content;
?>
</div>
<div id="footer">
</div>
</body>
</html>