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'); } } }
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); }
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>'; }
</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
<?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']; ?>
</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">
</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">
?> </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>
<?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>
<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
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); }
function __construct() { parent::__construct(); set_title('Time Off'); $this->redirect = can_this_user('timeoff') ? 'timeoff' : 'timeoff/my_timeoff_requests'; }
</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">
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">
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
<?php echo form_hidden('first_name', $user->meta['first_name']); ?> <?php echo form_hidden('last_name', $user->meta['last_name']); ?> <?php echo form_hidden('user_id', $user->ID); ?> </td> </tr> <tr class="ui-helper-reset"> <th>Current Status</th> <?php if (can_this_user('change_status')) { ?> <td><?php echo form_dropdown('current_status', array('In Process' => 'In Process', 'Submitted for Approval' => 'Submitted for Approval', 'Approved' => 'Approved')); ?> </td> <?php } else { ?> <td>In Process <?php echo form_hidden('current_status', 'In Process'); ?> </td> <?php } ?>
<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> <p class="clear"> <?php echo form_submit('submit_request', 'Save'); ?> <?php if (can_this_user('new_from_tempalte')) { ?> <?php echo form_submit('submit_request', 'Create New Timesheet for the Current Pay Period from this Template', 'class="submit-approval" id="timesheet_approval"'); ?> <?php } ?> </p> <?php echo form_hidden('update_timesheet', 'true'); echo form_close(); load_footer();
} else { ?> <td><?php echo $timesheet->current_status; echo form_hidden('current_status', $timesheet->current_status); ?> </td> <?php } ?> </tr> <tr> <th style="width: 150px;">Manager</th> <td> <?php if (can_this_user('set_timesheet_manager')) { ?> <?php echo form_dropdown('manager', $users, $user->user_manager); ?> <?php } else { ?> <?php echo $manager->meta['first_name'] . ' ' . $manager->meta['last_name']; ?> <?php } ?> </td> </tr>
function edit($id) { if ($this->input->post('save_reservation')) { $this->calendar_model->update_reservation($id, $this->input->post()); $this->session->set_flashdata('calendar', 'Your reservation has been updated.'); redirect('calendar/edit/' . $id); } $users = $this->users_model->get_all_users(); foreach ($users as $user) { $data['users'][$user->ID] = $user->user_name; } $data['event'] = $this->calendar_model->get_reservation($id); $data['resources'] = get_option_for_dropdown('calendar_resources'); $data['manage'] = array_merge(array($this->user->ID), $this->user->subs); if (!in_array($data['event']->created_by, $data['manage'])) { if (!in_array($data['event']->person_in_charge, $data['manage'])) { if (!can_this_user('calendar/edit/all')) { redirect('cheat'); } } } $this->load->view('calendar/edit', $data); }
echo number_format($procurement->aprox_total, 2, '.', ''); ?> </td> <td> <?php if (can_this_user('procurement/edit_order/all') || in_array($procurement->created_by, $this->user->subs) && $procurement->current_status == 'Submitted to Supervisor' || can_this_user('procurement/edit_order') && ($procurement->created_by == $this->user->ID || in_array($procurement->created_by, $this->user->subs)) && $procurement->current_status == 'In Process') { ?> <?php echo anchor('procurement/edit_order/' . $procurement->template_id . '/' . $procurement->ID, 'edit'); ?> <?php } ?> <?php if (can_this_user('procurement/delete_order/all') || can_this_user('procurement/delete_order') && ($procurement->created_by == $this->user->ID || in_array($procurement->created_by, $this->user->subs)) && $procurement->current_status == 'In Process') { ?> <?php echo anchor('procurement/delete_order/' . $procurement->template_id . '/' . $procurement->ID, 'delete', array('class' => 'delete')); ?> <?php } ?> </td> </tr> <?php } } else { ?> <tr class="ui-helper-reset"> <td colspan="8">
echo anchor('uploads/' . $att, $att, ''); ?> <?php } } ?> </div> </td> </tr> </table> </div> </div> <?php if ($status == 'Funded' && can_this_user('manage_funding_history')) { ?> <div class="ui-block wide"> <h3><a href="#">Funding History</a></h3> <div> <table cellspacing="0" border="0"> <tr> <th>FY</th> <th>Req $</th> <th>Refund $</th> <th>Program</th> <th>Result</th> <th>Notes</th> <th></th> </tr> <?php
function get_user($id) { if (can_this_user('handle_budget_admin_labor')) { echo json_encode($this->users_model->get_user_meta($id)); die; } redirect('cheat'); }
public function view($id) { $data['timesheet'] = $this->timesheet_model->get_timesheet($id); $accounts = unserialize(base64_decode($data['timesheet']->accounts)); if (!isset($accounts) || !is_array($accounts)) { $accounts = $this->users_model->get_labor_accounts($this->user->ID, 'timesheet'); } $data['account_code'] = $this->config->item('timesheet_account'); foreach ($accounts as $key => $value) { if ($value != 'Select Account') { $t = explode('-', $value); $key = str_replace($t[2], $data['account_code'], $key); $t[2] = $data['account_code']; $data['accounts'][$key] = implode('-', $t); } else { $data['accounts'][$key] = $accounts[$key]; } } $data['user'] = $this->users_model->get_user($data['timesheet']->user_id); $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']); $data['grant_matching'] = array('week1' => unserialize(base64_decode($data['timesheet']->gweek1)), 'week2' => unserialize(base64_decode($data['timesheet']->gweek2))); $data['week1'] = unserialize(base64_decode($data['timesheet']->week1)); $data['week2'] = unserialize(base64_decode($data['timesheet']->week2)); $data['manager'] = $this->users_model->get_user($data['timesheet']->manager); if ($data['timesheet']->user_id != $this->user->ID) { if ($data['timesheet']->manager != $this->user->ID) { if (!can_this_user('timesheet/edit/all')) { redirect('cheat'); } } } $this->load->view('timesheets/view', $data); }
<?php if (can_this_user('users_set_salary')) { ?> <tr class="ui-helper-reset"> <th>User Salary</th> <td><?php echo form_input('meta[salary]', '0.00', ' rel="num_only"'); ?> </td> </tr> <?php } ?> <?php if (can_this_user('users_set_fulltime')) { ?> <tr class="ui-helper-reset"> <th>Full Time</th> <td><?php echo form_input('meta[fulltime]', '0.00', ' rel="num_only"'); ?> </td> </tr> <?php } ?> <tr class="ui-helper-reset"> <th>User Password</th> <td><?php
echo form_submit('submit_request', 'Send Back to User', 'class="submit-approval" id="traval_approval"'); ?> </p> <?php } ?> <p> <?php echo form_hidden('update_travel_request', 'true'); ?> <?php echo form_hidden('mileage_rate', $travel_request['details']->mileage_rate); ?> <?php if ($travel_request['details']->current_status == 'In Process' || can_this_user('approve_travel')) { ?> <?php echo form_submit('submit_request', 'Save'); ?> <?php } ?> <?php if ($travel_request['details']->current_status == 'In Process') { ?> <?php echo form_submit('submit_request', 'Submit for Approval', 'class="submit-approval" id="traval_approval"'); ?> <?php
public function edit_order($id, $order, $product = false) { if ($this->input->post('update_order')) { $order_id = $this->procurement_model->update_order($order, $this->input->post()); $this->session->set_flashdata('procurement', 'The order has been updated.'); redirect($this->redirect); } if ($product) { $info = $this->procurement_model->get_product($id, $product); echo json_encode($info); die; } $data['template'] = $this->procurement_model->get_template($id); $data['order'] = $this->procurement_model->get_order($id, $order); $data['products'][''] = 'Select Product'; $data['locations'] = get_option('office_locations'); foreach ($data['template']->products as $product) { $data['products'][$product->ID] = $product->item_name; } $data['user'] = $this->user; $accounts = $this->labor_model->get_account_list('procurement'); $data['account_code'] = $this->config->item('produrement_account'); foreach ($accounts as $key => $value) { if ($value != 'Select Account') { $t = explode('-', $value); $key = str_replace($t[2], $data['account_code'], $key); $t[2] = $data['account_code']; $data['accounts'][$key] = implode('-', $t); } else { $data['accounts'][$key] = $accounts[$key]; } } if ($data['order']->created_by != $this->user->ID) { if (!in_array($data['order']->created_by, $this->user->subs)) { if (!can_this_user('procurement/edit_order/all')) { redirect('cheat'); } } } $this->load->view('procurement/order_template', $data); }
</td> <td> <?php if (can_this_user('grants/edit')) { ?> <?php echo anchor('grants/edit/' . $grant->ID, 'edit'); ?> <?php } ?> <?php if (can_this_user('grants/delete')) { ?> <?php echo anchor('grants/delete/' . $grant->ID, 'delete', array('class' => 'delete')); ?> <?php } ?> </td> </tr> <?php } } else { ?> <tr class="ui-helper-reset"> <td colspan="6">
echo anchor('timeoff/edit/' . $timeoff_request->ID, 'edit'); ?> <?php } else { ?> <?php echo anchor('timeoff/view/' . $timeoff_request->ID, 'view'); ?> <?php } ?> <?php if (can_this_user('timeoff/delete/all') || can_this_user('timeoff/delete') && ($timeoff_request->user_id == $this->user->ID || $timeoff_request->manager == $this->user->ID) && $timeoff_request->current_status == 'In Process') { ?> <?php echo anchor('timeoff/delete/' . $timeoff_request->ID, 'delete', array('class' => 'delete')); ?> <?php } ?> </td> </tr> <?php } } else { ?> <tr class="ui-helper-reset"> <td colspan="6">
</td> <td> <?php if (can_this_user('procurement/edit_template')) { ?> <?php echo anchor('procurement/edit_template/' . $template->ID, 'edit'); ?> <?php } ?> <?php if (can_this_user('procurement/delete_template')) { ?> <?php echo anchor('procurement/delete_template/' . $template->ID, 'delete', array('class' => 'delete')); ?> <?php } ?> </td> </tr> <?php } } else { ?> <tr class="ui-helper-reset"> <td colspan="8">