I need a function that hides some parts of Perfex CRM for User Roles. Example: Discount area.
I tried with this code:
function hide_fields_nonusers()
{
if ($role != '4') {
<style type="text/css">
#sconto {
display: none !important;
}
#discount_area {display: none !important;}
</style>
}
But nothing works, it hides that part for everyone, admin included.
EDIT
This one is working, but just for get employee role by ID.
/**
* Get employee role by id
* @param mixed $id Optional role id
* @return mixed array if not id passed else object
*/
public function get($id = '')
{
if (is_numeric($id)) {
$role = $this->app_object_cache->get('role-' . $id);
if ($role) {
return $role;
}
$this->db->where('roleid', $id);
$role = $this->db->get(db_prefix() . 'roles')->row();
$role->permissions = !empty($role->permissions) ? unserialize($role->permissions) : [];
$this->app_object_cache->add('role-' . $id, $role);
return $role;
}
return $this->db->get(db_prefix() . 'roles')->result_array();
}