コード例 #1
0
 function _hasEvaluationAccess($a_obj_id, $user_id)
 {
     $evaluation_access = ilObjSurveyAccess::_lookupEvaluationAccess($a_obj_id);
     switch ($evaluation_access) {
         case 0:
             // no evaluation access
             return false;
             break;
         case 1:
             // evaluation access for all registered users
             if ($user_id > 0 && $user_id != ANONYMOUS_USER_ID) {
                 return true;
             } else {
                 return false;
             }
             break;
         case 2:
             if (!self::_lookup360Mode($a_obj_id)) {
                 // evaluation access for participants
                 // check if the user with the given id is a survey participant
                 // show the evaluation button for anonymized surveys for all users
                 // access is only granted with the survey access code
                 if (ilObjSurveyAccess::_lookupAnonymize($a_obj_id) == 1) {
                     return true;
                 }
                 global $ilDB;
                 $result = $ilDB->queryF("SELECT survey_id FROM svy_svy WHERE obj_fi = %s", array('integer'), array($a_obj_id));
                 if ($result->numRows() == 1) {
                     $row = $ilDB->fetchAssoc($result);
                     if (ilObjSurveyAccess::_isSurveyParticipant($user_id, $row["survey_id"])) {
                         return true;
                     }
                 }
                 return false;
             } else {
                 include_once "Modules/Survey/classes/class.ilObjSurvey.php";
                 $svy = new ilObjSurvey($a_obj_id, false);
                 $svy->read();
                 switch ($svy->get360Results()) {
                     case ilObjSurvey::RESULTS_360_NONE:
                         return false;
                     case ilObjSurvey::RESULTS_360_OWN:
                         return $svy->isAppraiseeClosed($user_id);
                     case ilObjSurvey::RESULTS_360_ALL:
                         return $svy->isAppraisee($user_id);
                 }
             }
             break;
     }
 }
コード例 #2
0
 function _hasEvaluationAccess($a_obj_id, $user_id)
 {
     $evaluation_access = ilObjSurveyAccess::_lookupEvaluationAccess($a_obj_id);
     switch ($evaluation_access) {
         case 0:
             // no evaluation access
             return false;
             break;
         case 1:
             // evaluation access for all registered users
             if ($user_id > 0 && $user_id != ANONYMOUS_USER_ID) {
                 return true;
             } else {
                 return false;
             }
             break;
         case 2:
             // evaluation access for participants
             // check if the user with the given id is a survey participant
             // show the evaluation button for anonymized surveys for all users
             // access is only granted with the survey access code
             if (ilObjSurveyAccess::_lookupAnonymize($a_obj_id) == 1) {
                 return true;
             }
             global $ilDB;
             $result = $ilDB->queryF("SELECT survey_id FROM svy_svy WHERE obj_fi = %s", array('integer'), array($a_obj_id));
             if ($result->numRows() == 1) {
                 $row = $ilDB->fetchAssoc($result);
                 if (ilObjSurveyAccess::_isSurveyParticipant($user_id, $row["survey_id"])) {
                     return true;
                 }
             }
             return false;
             break;
     }
 }