Beispiel #1
0
 /**
  * Function checks if the Report is editable
  * @return boolean
  */
 function isEditable()
 {
     //$ogReport = $this->getITS4YouReport();
     //return $ogReport->is_editable;
     $reporttype = ITS4YouReports_Record_Model::getRecordReportType($this->getId());
     $is_editable = false;
     global $current_user;
     if (is_admin($current_user) !== true) {
         $user_privileges_path = 'user_privileges/user_privileges_' . $this->current_user->id . '.php';
         $edit_all = 1;
         if (file_exists($user_privileges_path)) {
             require $user_privileges_path;
             $edit_all = $profileGlobalPermission[1];
         }
         $owner = $this->getRecordOwner($this->getId());
         $subordinate_users = ITS4YouReports::getSubOrdinateUsersArray(true);
     }
     if ($current_user->id == "5") {
         $edit_all = 1;
     }
     if ($reporttype == "custom_report" && is_admin($current_user) !== true) {
         return $is_editable;
     } elseif (is_admin($current_user) === true || $owner == $current_user->id || $edit_all == 0) {
         $is_editable = true;
     }
     return $is_editable;
 }