本文整理汇总了PHP中can_this_user函数的典型用法代码示例。如果您正苦于以下问题:PHP can_this_user函数的具体用法?PHP can_this_user怎么用?PHP can_this_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了can_this_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
session_start();
//$this->output->enable_profiler(TRUE);
$this->config->load('aa_config');
$this->title = $this->config->item('site_name');
$this->load->set_theme($this->config->item('theme'));
$this->user = $this->users_model->load_user_data();
$this->theme_style = $this->config->item('theme_style');
$this->notifier = new user_notifier();
if ($this->users_model->is_admin() == false && $this->uri->segment('1') != 'login') {
redirect('login');
} else {
if (isset($this->user->meta['theme']) && $this->user->meta['theme'] != 'default') {
$this->theme_style = $this->user->meta['theme'];
}
$this->location['controller'] = $this->uri->rsegment(1);
// The Controller
if (!is_numeric($this->uri->rsegment(2))) {
$this->location['method'] = $this->uri->rsegment(2);
// The Function
}
if (preg_match('/([0-9]+)/', $this->uri->segment(1))) {
$location = '';
} elseif (strlen($this->location['method'])) {
$location = implode('/', $this->location);
} else {
$location = $this->location['controller'];
}
if (!can_this_user($location) && !can_this_user($location . '/all') && $this->uri->segment(1) != '') {
redirect('cheat');
}
}
}
示例2: add
public function add()
{
if ($this->input->post('do_action')) {
$save = $this->input->post();
$report_att = explode(',', $this->input->post('upload_names'));
$save['nine_nine_zero'] = $this->doUpload('nine_nine_zero');
$save['ggci_attachments'] = serialize($this->doUpload('ggci_attachments'));
$save['nce_attachments'] = serialize($this->doUpload('nce_attachments'));
$save['current_attachments'] = serialize($this->doUpload('current_attachments'));
$save['grand_guildlines'] = $this->doUpload('grand_guildlines');
if (is_array($report_att)) {
foreach ($report_att as $key => $file) {
if (isset($_FILES[$file])) {
$files = $this->doUpload($file);
$save['report_attachments'][$key] = $files;
}
}
}
$ID = $this->grants_model->addGrant($save);
$this->session->set_flashdata('grants', 'The grant has been saved.');
if (can_this_user('grants/edit')) {
redirect('grants/edit/' . $ID);
} else {
redirect('grants');
}
}
$data = array();
$data['grants'] = array();
$users = $this->users_model->get_all_users_meta();
foreach ($users as $user) {
$data['users'][$user->ID] = $user->meta['first_name'] . ' ' . $user->meta['last_name'];
}
asort($data['users']);
$this->load->view('grants/add', $data);
}
示例3: list_admin_menu
function list_admin_menu()
{
$CI =& get_instance();
$active = $CI->uri->segment(1);
$sub = $CI->uri->segment(2);
if ($sub == 'page') {
$sub = '';
}
$menu = array(array('name' => 'Dashboard', 'controllers' => array(''), 'link' => ''), array('name' => 'Admin', 'controllers' => array('admin'), 'link' => 'controller_admin', 'links' => array('General' => 'admin/general', 'Account Codes' => 'admin/account_codes', 'Discretionary Accounts' => 'admin/discretionary_accounts', 'Office Locations' => 'admin/locations', 'User Settings' => 'admin/user_settings', 'Calendar Settings' => 'admin/calendar_settings')), array('name' => 'Users', 'controllers' => array('users'), 'link' => 'controller_users', 'links' => array('My Profile' => 'users/my_profile', 'Users List' => 'users', 'Add User' => 'users/add', 'Manage Roles' => 'users/manage_roles')), array('name' => 'Chapter Financials', 'controllers' => array('projects', 'budget'), 'link' => 'controller_projects', 'links' => array('Budgets' => array('Budget Managers' => 'budget'), 'Projects' => array('General Fund Projects' => 'projects/general_fund', 'Grant Actuals' => 'projects/grant_actuals'))), array('name' => 'Chapter Procurement', 'controllers' => array('procurement'), 'link' => 'controller_procurement', 'links' => list_templates()), array('name' => 'Timesheet', 'controllers' => array('timesheet'), 'link' => 'controller_timesheet', 'links' => array('Timesheets' => 'timesheet', 'New Timesheet' => 'timesheet/new_timesheet', 'My Timesheets' => 'timesheet/my_timesheets', 'Templates' => 'timesheet/template_list', 'New Template' => 'timesheet/new_template', 'Manage Emails' => 'timesheet/emails')), array('name' => 'Time Off', 'controllers' => array('timeoff'), 'link' => 'controller_timeoff', 'links' => array('Time Off Requests' => 'timeoff', 'My Requests' => 'timeoff/my_timeoff_requests', 'Request Time Off' => 'timeoff/new_timeoff_request', 'Manage Emails' => 'timeoff/emails')), array('name' => 'Travel Reimbursement', 'controllers' => array('travel'), 'link' => 'controller_travel', 'links' => array('Recent Reimbursement' => 'travel', 'New Reimbursement Request' => 'travel/new_travel_request', 'My Travel Reimbursements' => 'travel/my_travel_requests', 'Manage Emails' => 'travel/emails')), array('name' => 'Labor Accounts', 'controllers' => array('labor'), 'link' => 'controller_labor', 'links' => array('Accounts' => 'labor', 'New Account' => 'labor/new_account')), array('name' => 'Volunteers', 'controllers' => array('volunteers'), 'link' => 'controller_volunteers', 'links' => array('List' => 'volunteers', 'New' => 'volunteers/add')), array('name' => 'Grants', 'controllers' => array('grants'), 'link' => 'controller_grants', 'links' => array('List' => 'grants', 'New' => 'grants/add')), array('name' => 'Resource Calendar', 'controllers' => array('calendar'), 'link' => 'controller_calendar', 'links' => array('View Calendar' => 'calendar', 'Reserve Resource' => 'calendar/reserve', 'My Reservations' => 'calendar/my_reservations')));
echo '<div class="menu ui-accordion ui-widget ui-helper-reset ui-accordion-icons">';
foreach ($menu as $m) {
if (can_this_user($m['link']) || $m['link'] == '') {
echo '<h3 class="ui-accordion-header ui-helper-reset ui-state-default' . (in_array($active, $m['controllers']) ? ' ui-state-active' : '') . '"><span class="ui-icon ui-icon-triangle-1-' . (in_array($active, $m['controllers']) ? 's' : 'e') . '"></span>' . anchor($m['link'], $m['name'], 'class="topLevel"') . '</h3>';
if (array_key_exists('links', $m)) {
echo '<div class="subMenu' . (in_array($active, $m['controllers']) ? ' ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active ui-state-hover' : ' ui-state-hover') . '">';
echo '<ul class="subMenuList">';
foreach ($m['links'] as $name => $link) {
if (@can_this_user($link) || is_array($link)) {
if (!is_array($link)) {
$class = $link == $active . ($sub != '' ? '/' . $sub : '') ? 'class="active"' : '';
echo '<li>' . anchor($link, ucwords($name), $class) . '</li>';
} else {
$class = $link == $active . ($sub != '' ? '/' . $sub : '') ? 'class="active"' : '';
echo '<li>' . $name;
echo '<ul>';
foreach ($link as $n => $l) {
if (can_this_user($l)) {
$class = $l == $active . ($sub != '' ? '/' . $sub : '') ? 'class="active"' : '';
echo '<li>' . anchor($l, ucwords($n), $class) . '</li>';
}
}
echo '</ul>';
echo '</li>';
}
}
}
echo '</ul>';
echo '</div>';
}
}
}
echo '</div>';
echo '<p>' . anchor('logout', 'LOGOUT', 'class="button"') . '</p>';
}
示例4: form_input
</td>
</tr>
<tr>
<td colspan="2"></td>
<th>Other</th>
<td><?php
echo form_input('summary[other]', $timesheet->other, 'style="width: auto;" size="4" class="summary-other" readonly="readonly"');
?>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<?php
if (can_this_user('approve_timesheet') && $timesheet->current_status == 'Submitted for Approval') {
?>
<p class="clear">
<?php
echo form_submit('submit_request', 'Approve');
?>
<?php
echo form_submit('submit_request', 'Send Back to User', 'class="submit-approval" id="timesheet_approval"');
?>
</p>
<?php
}
?>
<p class="clear">
<?php
示例5: form_hidden
<?php
} else {
?>
<td>In Process <?php
echo form_hidden('current_status', 'In Process');
?>
</td>
<?php
}
?>
</tr>
<tr class="ui-helper-reset">
<th style="width: 150px;">Manager</th>
<?php
if (!can_this_user('change_manager')) {
?>
<td>
<select name="manager">
<?php
foreach ($users as $u) {
?>
<option <?php
echo $u->ID == $user->user_manager ? 'selected' : '';
?>
value="<?php
echo $u->ID;
?>
"><?php
echo $u->meta['first_name'] . ' ' . $u->meta['last_name'];
?>
示例6: anchor
</td>
<td>
<?php
if (can_this_user('calendar/edit/all') || can_this_user('calendar/edit') && (in_array($list->person_in_charge, $manage) || in_array($list->created_by, $manage))) {
?>
<?php
echo anchor('calendar/edit/' . $list->ID, 'edit');
?>
<?php
}
?>
<?php
if (can_this_user('calendar/delete/all') || can_this_user('calendar/delete') && (in_array($list->person_in_charge, $manage) || in_array($list->created_by, $manage))) {
?>
<?php
echo anchor('calendar/delete/' . $list->ID, 'delete', array('class' => 'delete'));
?>
<?php
}
?>
</td>
</tr>
<?php
}
} else {
?>
<tr class="ui-helper-reset">
<td colspan="7">
示例7: anchor
</td>
<td>
<?php
if (can_this_user('calendar/edit/all') || can_this_user('calendar/edit')) {
?>
<?php
echo anchor('calendar/edit/' . $list->ID, 'edit');
?>
<?php
}
?>
<?php
if (can_this_user('calendar/delete/all') || can_this_user('calendar/delete')) {
?>
<?php
echo anchor('calendar/delete/' . $list->ID, 'delete', array('class' => 'delete'));
?>
<?php
}
?>
</td>
</tr>
<?php
}
} else {
?>
<tr class="ui-helper-reset">
<td colspan="7">
示例8:
?>
</td>
</tr>
<?php
}
?>
<?php
}
?>
</tbody>
</table>
</div>
</div>
<?php
if (can_this_user('handle_budget_admin_labor')) {
?>
<div class="ui-block wide">
<h3><a href="#">Administrative Labor</a></h3>
<div>
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td><?php
echo form_radio('meta[hours_month_use]', 1, '', 'class="hours-month" checked="checked"');
?>
Month1</td>
<td><?php
echo form_input('meta[hours_Month][]', 120);
?>
</td>
示例9: form_open
<?php
if ($this->session->flashdata('labor')) {
?>
<div class="notice ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span><?php
echo $this->session->flashdata('labor');
?>
</p>
</div>
<?php
}
?>
<h1>Labor Accounts <?php
if (can_this_user('labor/new_account')) {
echo anchor('labor/new_account', 'Add New', array('class' => 'button ui-helper-reset'));
}
?>
</h1>
<div class="ui-block wide">
<h3><a href="#">Accounts</a></h3>
<div>
<?php
echo form_open(site_url('labor/'), array('method' => 'get'));
?>
<table cellpadding="0" cellspacing="0" border="0" style="width: auto;" class="search-table">
<thead>
<tr>
<th>Account Search:</th>
示例10: form_submit
<p class="clear">
<?php
echo form_submit('submit_request', 'Send Back to User', 'class="submit-approval" id="timesheet_approval"');
?>
</p>
<?php
}
?>
<p>
<?php
echo form_hidden('update_timeoff_request', 'true');
?>
<?php
if ($timeoff_request->current_status == 'In Process' || can_this_user('approve_timesheet')) {
?>
<?php
echo form_submit('submit_request', 'Save');
?>
<?php
}
?>
<?php
if ($timeoff_request->current_status == 'In Process') {
?>
<?php
echo form_submit('submit_request', 'Submit for Approval', 'class="submit-approval" id="timeoff_approval"');
?>
<?php
示例11: delete
public function delete($id)
{
if (can_this_user('travel/delete')) {
$this->db->where('id', $id)->delete('travel_requests');
$this->db->where('travel_id', $id)->delete('travel_request_details');
$this->db->where('travel_id', $id)->delete('travel_out_of_town_details');
$this->session->set_flashdata('travel', 'Travel request has been deleted.');
} else {
$this->session->set_flashdata('travel', 'You cannot delete this document');
}
redirect($this->redirect);
}
示例12: __construct
function __construct()
{
parent::__construct();
set_title('Time Off');
$this->redirect = can_this_user('timeoff') ? 'timeoff' : 'timeoff/my_timeoff_requests';
}
示例13: anchor
</td>
<td>
<?php
if (can_this_user('timesheet/edit_template')) {
?>
<?php
echo anchor('timesheet/edit_template/' . $timesheet->ID, 'edit');
?>
<?php
}
?>
<?php
if (can_this_user('timesheet/delete_template')) {
?>
<?php
echo anchor('timesheet/delete_template/' . $timesheet->ID, 'delete', array('class' => 'delete'));
?>
<?php
}
?>
</td>
</tr>
<?php
}
} else {
?>
<tr class="ui-helper-reset">
示例14: anchor
echo anchor('budget/edit/' . $budget->ID, 'edit');
?>
<?php
} else {
?>
<?php
echo anchor('budget/view/' . $budget->ID, 'view');
?>
<?php
}
?>
<?php
if (can_this_user('budget/delete/all') || can_this_user('budget/delete') && ($budget->director == $this->user->ID || $budget->manager == $this->user->ID) && $budget->prep_status == 'In Process') {
?>
<?php
echo anchor('budget/delete/' . $budget->ID, 'delete', array('class' => 'delete'));
?>
<?php
}
?>
</td>
</tr>
<?php
}
} else {
?>
<tr class="ui-helper-reset">
<td colspan="8">
示例15: form_input
echo form_input('grand_total[]', $order->aprox_total, 'style="width: 75px;"');
?>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<?php
if (can_this_user('approve_orders') && $order->current_status == 'Submitted for Approval') {
?>
<p class="clear">
<?php
echo form_submit('submit_request', 'Approve');
?>
<?php
echo form_submit('submit_request', 'Send Back to User', 'class="submit-approval" id="order_approval"');
?>
</p>
<?php
}
?>
<p class="clear">
<?php