Exemplo n.º 1
0
 /**
  * check condition
  * @param type $a_svy_id
  * @param type $a_operator
  * @param type $a_value
  * @param type $a_usr_id
  * @return boolean
  */
 public static function checkCondition($a_svy_id, $a_operator, $a_value, $a_usr_id)
 {
     switch ($a_operator) {
         case ilConditionHandler::OPERATOR_FINISHED:
             //if (ilExerciseMembers::_lookupStatus($a_exc_id, $ilias->account->getId()) == "passed")
             include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
             if (ilObjSurveyAccess::_lookupFinished($a_svy_id, $a_usr_id)) {
                 return true;
             } else {
                 return false;
             }
             break;
         default:
             return true;
     }
     return true;
 }
Exemplo n.º 2
0
 function isFullfilled($user_id, $item_id)
 {
     global $ilObjDataCache;
     include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
     $lm_continue =& new ilCourseLMHistory($this->getRefId(), $user_id);
     $continue_data = $lm_continue->getLMHistory();
     $obj_id = $ilObjDataCache->lookupObjId($item_id);
     $type = $ilObjDataCache->lookupType($obj_id);
     switch ($type) {
         case 'tst':
             include_once './Modules/Test/classes/class.ilObjTestAccess.php';
             include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
             if (!ilObjTestAccess::checkCondition($obj_id, ilConditionHandler::OPERATOR_FINISHED, '', $user_id)) {
                 return false;
             }
             break;
         case 'svy':
             include_once './Modules/Survey/classes/class.ilObjSurveyAccess.php';
             if (!ilObjSurveyAccess::_lookupFinished($obj_id, $user_id)) {
                 return false;
             }
             break;
         case 'sahs':
             include_once 'Services/Tracking/classes/class.ilLPStatus.php';
             if (!ilLPStatus::_hasUserCompleted($obj_id, $user_id)) {
                 return false;
             }
             break;
         default:
             if (!isset($continue_data[$item_id])) {
                 return false;
             }
     }
     return true;
 }
Exemplo n.º 3
0
 function _checkCondition($a_svy_id, $a_operator, $a_value, $a_usr_id = 0)
 {
     global $ilUser;
     $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
     switch ($a_operator) {
         case 'finished':
             //if (ilExerciseMembers::_lookupStatus($a_exc_id, $ilias->account->getId()) == "passed")
             include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
             if (ilObjSurveyAccess::_lookupFinished($a_svy_id, $a_usr_id)) {
                 return true;
             } else {
                 return false;
             }
             break;
         default:
             return true;
     }
     return true;
 }
 /**
  * Get item properties
  *
  * @return	array		array of property arrays:
  *						"alert" (boolean) => display as an alert property (usually in red)
  *						"property" (string) => property name
  *						"value" (string) => property value
  */
 function getProperties()
 {
     global $lng, $ilUser, $rbacsystem;
     $props = array();
     if (!$rbacsystem->checkAccess("visible,read", $this->ref_id)) {
         return $props;
     }
     include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
     if (!ilObjSurveyAccess::_lookupOnline($this->obj_id)) {
         $props[] = array("alert" => true, "property" => $lng->txt("status"), "value" => $lng->txt("offline"));
     } else {
         // BEGIN Usability Distinguish between status and participation
         if (!ilObjSurveyAccess::_lookupCreationComplete($this->obj_id)) {
             // no completion
             $props[] = array("alert" => true, "property" => $lng->txt("svy_participation"), "value" => $lng->txt("svy_warning_survey_not_complete"), 'propertyNameVisible' => false);
         } else {
             if ($ilUser->getId() != ANONYMOUS_USER_ID) {
                 $finished = ilObjSurveyAccess::_lookupFinished($this->obj_id, $ilUser->id);
                 // finished
                 if ($finished === 1) {
                     $stat = $this->lng->txt("svy_finished");
                 } else {
                     if ($finished === 0) {
                         $stat = $this->lng->txt("svy_not_finished");
                     } else {
                         $stat = $this->lng->txt("svy_not_started");
                     }
                 }
                 $props[] = array("alert" => false, "property" => $lng->txt("participation"), "value" => $stat, 'propertyNameVisible' => false);
             }
         }
         // END Usability Distinguish between status and participation
     }
     return $props;
 }
 function isFullfilled($user_id, $item_id)
 {
     global $ilObjDataCache;
     include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
     $lm_continue =& new ilCourseLMHistory($this->getRefId(), $user_id);
     $continue_data = $lm_continue->getLMHistory();
     $obj_id = $ilObjDataCache->lookupObjId($item_id);
     $type = $ilObjDataCache->lookupType($obj_id);
     switch ($type) {
         case 'tst':
             include_once './Modules/Test/classes/class.ilObjTestAccess.php';
             if (!ilObjTestAccess::_checkCondition($obj_id, 'finished', '')) {
                 return false;
             }
             break;
         case 'svy':
             include_once './Modules/Survey/classes/class.ilObjSurveyAccess.php';
             if (!ilObjSurveyAccess::_lookupFinished($obj_id, $user_id)) {
                 return false;
             }
             break;
         case 'sahs':
             include_once 'Services/Tracking/classes/class.ilLPStatus.php';
             $completed = ilLPStatus::_lookupStatus($obj_id, $user_id);
             if ($completed == LP_STATUS_COMPLETED_NUM) {
                 return false;
             }
             break;
         default:
             if (!isset($continue_data[$item_id])) {
                 return false;
             }
     }
     return true;
 }