Example #1
0
 public static function get_staff_members()
 {
     if (is_array(self::$_staff_members_cache)) {
         return self::$_staff_members_cache;
     }
     // todo: a different kinda perimssion outlines staff members maybe?
     if (module_config::c('staff_by_flag', 0)) {
         $label = 'Staff Member';
         // seed security permission:
         module_security::can_user(module_security::get_loggedin_id(), $label);
         // find any that exist.
         $staff = self::get_users_by_permission(array('category' => _LABEL_USER_SPECIFIC, 'name' => 'Staff Member', 'module' => 'config', 'view' => 1, 'description' => 'checkbox'));
     } else {
         $staff = self::get_users_by_permission(array('category' => 'Job', 'name' => 'Job Tasks', 'module' => 'job', 'edit' => 1));
     }
     foreach ($staff as $staff_id => $s) {
         if (isset($s['is_staff']) && $s['is_staff'] == 0) {
             // user has staff option manually disabled override the role settings.
             unset($staff[$staff_id]);
         }
     }
     // add any staff members that have the new is_staff flag set
     $staff_users = self::get_users(array('is_staff' => 1));
     if (!is_array($staff_users)) {
         $staff_users = array();
     }
     $staff_contacts = self::get_contacts(array('is_staff' => 1));
     if (!is_array($staff_contacts)) {
         $staff_contacts = array();
     }
     $staff = $staff + $staff_users + $staff_contacts;
     if (module_config::c('staff_remove_admin', 0) && isset($staff[module_config::c('staff_remove_admin', 0)])) {
         unset($staff[module_config::c('staff_remove_admin', 0)]);
     }
     self::$_staff_members_cache = $staff;
     return self::$_staff_members_cache;
 }