function page_access($role) { if (get_the_current_user('role') <= $role) { } else { redirect(site_url('user/no_access/' . $role)); } }
function get_account_balance($balance) { $options['who_can_see_account_balance'] = get_option(array('option_group' => 'account', 'option_key' => 'who_can_see_account_balance')); if (get_the_current_user('role') > $options['who_can_see_account_balance']['option_value']) { return get_money(0); } else { return get_money($balance); } }
function get_cost_price($cost_price) { $options['who_can_see_cost_price'] = get_option(array('option_group' => 'product', 'option_key' => 'who_can_see_cost_price')); if (get_the_current_user('role') > $options['who_can_see_cost_price']['option_value']) { return get_money('0'); } else { return get_money($cost_price); } }
function add_item($data) { $ci =& get_instance(); $invoice = get_invoice($data['invoice_id']); if (!isset($data['type'])) { $data['type'] = 'invoice'; } $data['date'] = date('Y-m-d H:i:s'); $data['account_id'] = $invoice['account_id']; $data['user_id'] = get_the_current_user('id'); $data['in_out'] = $invoice['in_out']; if (!isset($data['total'])) { $data['total'] = $data['quantity'] * $data['quantity_price']; } $ci->db->insert('invoice_items', $data); $insert_id = $ci->db->insert_id(); return $insert_id; }
<?php if (get_the_current_user('role') > 3) { ?> <?php alertbox('alert-danger', get_lang('Not authorized to access.') . ''); } else { if (isset($_GET['status'])) { $this->db->where('id', $user_id); $this->db->update('users', array('status' => $_GET['status'])); } ?> <?php $user = get_user(array('id' => $user_id)); ?> <legend id="page_title" class="ff-1 danger"><?php echo $user['display_name']; ?> </legend> <div class="row"> <div class="col-md-8"> <?php if ($user['status'] == 0) { ?> <?php alertbox('alert-warning', get_lang('This user has been deleted.') . ' <a href="?status=1" class="text-success pull-right">"' . get_lang('Activate') . '"</a>', '', false); } ?>
?> </th> </tr> </thead> <tbody> <?php $this->db->where('status', 1); $this->db->where_in('type', array('message')); $this->db->where('inbox_view', '1'); $this->db->where('sender_id', get_the_current_user('id')); $this->db->order_by('recent_activity', 'DESC'); $query = $this->db->get('user_mess')->result_array(); foreach ($query as $q) { ?> <tr class="<?php if (strstr($q['read'], '[' . get_the_current_user('id') . ']')) { echo 'active strong'; } ?> "> <td></td> <td><?php echo substr($q['date'], 0, 16); ?> </td> <td><?php echo $users[$q['sender_id']]['name'] . ' ' . $users[$q['sender_id']]['surname']; ?> </a></td> <td><a href="<?php echo site_url('user/inbox/' . $q['id']);
function control_page() { $ci =& get_instance(); $page_name = $ci->uri->segment(1) . '/' . $ci->uri->segment(2); $data['/'] = ''; $data['user/logout'] = ''; $data['user/profile'] = '1'; $data['user/new_message'] = ''; $data['user/inbox'] = ''; $data['user/outbox'] = ''; $data['user/new_task'] = ''; $data['user/task'] = ''; $data['user/outbound_tasks'] = ''; $data['general/about'] = ''; if (isset($data[$page_name])) { ?> <?php if (get_the_current_user('role') <= 2) { ?> <small class="pull-right"><?php echo get_lang('access privileges for this page is fixed.'); ?> </small> <?php } ?> <?php } else { $role = get_option(array('option_group' => 'page_access', 'option_key' => $page_name)); ?> <!-- Modal --> <div class="modal fade" id="modal_pageAccess" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title"><?php lang('Page Access'); ?> </h4> </div> <div class="modal-body"> <form name="form_page_access" id="form_page_access" action="" method="POST"> <label for="role" class="control-label ff-1 fs-16"><?php lang('Role'); ?> </label> <select name="role" id="role" class="form-control input-lg"> <option value="5" <?php if ($role['option_value'] == 5) { echo 'selected'; } ?> >Personel</option> <option value="4" <?php if ($role['option_value'] == 4) { echo 'selected'; } ?> >Yetikili Personel</option> <option value="3" <?php if ($role['option_value'] == 3) { echo 'selected'; } ?> >Birim Amiri</option> <option value="2" <?php if ($role['option_value'] == 2) { echo 'selected'; } ?> >Yönetici</option> <option value="1" <?php if ($role['option_value'] == 1) { echo 'selected'; } ?> >Süper Yönetici</option> </select> <input type="hidden" name="page_name" id="page_name" value="<?php echo $page_name; ?> " /> <input type="hidden" name="page_access_change" id="page_access_change" /> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"><?php lang('Close'); ?> </button> <button type="button" class="btn btn-primary" onclick="document.getElementById('form_page_access').submit();"><?php lang('Save'); ?> </button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <!-- Button trigger modal --> <?php if ($role) { if ($role['option_value'] < get_the_current_user('role')) { redirect(site_url('user/no_access/' . $role['option_value'])); } ?> <?php if (get_the_current_user('role') <= 2) { ?> <small class="pull-right"> <?php lang('this page'); ?> <strong><?php echo get_role_name($role['option_value']); ?> </strong> <?php lang('and greater access to users.'); ?> [<a data-toggle="modal" href="#modal_pageAccess">değiştir</a>] </small> <?php } ?> <?php } else { ?> <?php if (get_the_current_user('role') <= 2) { ?> <small class="pull-right"> <?php lang('anyone can access this page.'); ?> [<a data-toggle="modal" href="#modal_pageAccess">değiştir</a>] </small> <?php } ?> <?php } } }
if ($user['avatar'] == '') { ?> <span class="img-thumbnail"><span class="glyphicon glyphicon-user" style="font-size:150px;"></span></span> <?php } else { ?> <a href="javascript:;" class="img-thumbnail"><img src="<?php echo base_url($user['avatar']); ?> " width="150" height="100" class="img-responsive" /></a> <?php } ?> </div> <?php if ($user['id'] == get_the_current_user('id')) { ?> <label for="avatar"><?php lang('Upload a new photo'); ?> </label> <input type="file" name="avatar" id="avatar" value="" style="background-color:#fc0; padding:3px; width:100%;" /> <div style="height:9px;"></div> <button class="btn btn-success btn-lg pull-right"><?php lang('Upload a photo'); ?> »</button> <?php } ?>
?> </option> </select> </div> <!-- /.form-group --> </div> <!-- /.col-md- --> </div> <!-- /.row --> <div class="text-right"> <?php if ($product['status'] == 1) { ?> <?php $options['who_can_edit_product_card'] = get_option(array('option_group' => 'product', 'option_key' => 'who_can_edit_product_card')); ?> <?php if (get_the_current_user('role') <= $options['who_can_edit_product_card']['option_value']) { ?> <input type="hidden" name="log_time" value="<?php echo date("Y-m-d H:i:s"); ?> " /> <input type="hidden" name="update_product" /> <button class="btn btn-default btn-lg btn-success"><?php lang('Update'); ?> »</button> <?php } ?> <?php }
function calc_task() { $ci =& get_instance(); $ci->db->where('status', 1); $ci->db->where_in('type', array('task', 'reply_task')); $ci->db->where('inbox_view', '1'); $ci->db->where('receiver_id', get_the_current_user('id')); $ci->db->where('read', '[' . get_the_current_user('id') . ']'); $query = $ci->db->get('user_mess')->num_rows(); return $query; }
function add_work_order_item($data) { $ci =& get_instance(); $work_order = get_p_work_order($data['work_order_id']); if (!isset($data['type'])) { $data['type'] = 'invoice'; } $data['date'] = date('Y-m-d H:i:s'); $data['account_id'] = $work_order['account_id']; $data['location_id'] = $work_order['location_id']; $data['project_id'] = $work_order['project_id']; $data['user_id'] = get_the_current_user('id'); $ci->db->insert('p_p_order_items', $data); $insert_id = $ci->db->insert_id(); return $insert_id; }