Пример #1
0
 /**
  * check condition 
  * @param type $a_exc_id
  * @param type $a_operator
  * @param type $a_value
  * @param type $a_usr_id
  * @return boolean
  */
 public static function checkCondition($a_exc_id, $a_operator, $a_value, $a_usr_id)
 {
     include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
     include_once './Modules/Exercise/classes/class.ilExerciseMembers.php';
     switch ($a_operator) {
         case ilConditionHandler::OPERATOR_PASSED:
             if (ilExerciseMembers::_lookupStatus($a_exc_id, $a_usr_id) == "passed") {
                 return true;
             } else {
                 return false;
             }
             break;
         case ilConditionHandler::OPERATOR_FAILED:
             return ilExerciseMembers::_lookupStatus($a_exc_id, $a_usr_id) == 'failed';
         default:
             return true;
     }
     return true;
 }
 /**
  * Determine status
  *
  * @param	integer		object id
  * @param	integer		user id
  * @param	object		object (optional depends on object type)
  * @return	integer		status
  */
 function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
 {
     global $ilObjDataCache;
     $status = LP_STATUS_NOT_ATTEMPTED_NUM;
     switch ($ilObjDataCache->lookupType($a_obj_id)) {
         case 'exc':
             include_once './Services/Tracking/classes/class.ilChangeEvent.php';
             include_once './Modules/Exercise/classes/class.ilExerciseMembers.php';
             if (ilChangeEvent::hasAccessed($a_obj_id, $a_user_id) || ilExerciseMembers::_hasReturned($a_obj_id, $a_user_id)) {
                 $status = LP_STATUS_IN_PROGRESS_NUM;
             }
             $ex_stat = ilExerciseMembers::_lookupStatus($a_obj_id, $a_user_id);
             if ($ex_stat == "passed") {
                 $status = LP_STATUS_COMPLETED_NUM;
             }
             if ($ex_stat == "failed") {
                 $status = LP_STATUS_FAILED_NUM;
             }
             break;
     }
     return $status;
 }
 /**
  * Returns an array containing all variables and values which can be exchanged in the certificate
  * The values should be calculated from real data. The $params parameter array should contain all
  * necessary information to calculate the values.
  *
  * @param array $params An array of parameters to calculate the certificate parameter values
  * @return array The certificate variables
  */
 public function getCertificateVariablesForPresentation($params = array())
 {
     global $lng;
     $user_id = $params["user_id"];
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $mark = ilLPMarks::_lookupMark($user_id, $this->object->getId());
     include_once 'Modules/Exercise/classes/class.ilExerciseMembers.php';
     $status = ilExerciseMembers::_lookupStatus($this->object->getId(), $user_id);
     $user_data = ilObjUser::_lookupFields($user_id);
     $completion_date = $this->getUserCompletionDate($user_id);
     $vars = $this->getBaseVariablesForPresentation($user_data, null, $completion_date);
     $vars["RESULT_PASSED"] = ilUtil::prepareFormOutput($lng->txt("exc_" . $status));
     $vars["RESULT_MARK"] = ilUtil::prepareFormOutput($mark);
     $vars["EXERCISE_TITLE"] = ilUtil::prepareFormOutput($this->object->getTitle());
     foreach ($vars as $id => $caption) {
         $insert_tags["[" . $id . "]"] = $caption;
     }
     return $insert_tags;
 }
 /**
  * Check if given user has certificate to show/download
  * 
  * @param int $a_user_id
  * @return bool 
  */
 function hasUserCertificate($a_user_id)
 {
     // show certificate?
     include_once "Services/Certificate/classes/class.ilCertificate.php";
     if (ilCertificate::isActive() && ilCertificate::isObjectActive($this->getId())) {
         $certificate_visible = $this->getCertificateVisibility();
         // if not never
         if ($certificate_visible != 2) {
             // if passed only
             include_once 'Modules/Exercise/classes/class.ilExerciseMembers.php';
             $status = ilExerciseMembers::_lookupStatus($this->getId(), $a_user_id);
             if ($certificate_visible == 1 && $status == "passed") {
                 return true;
             } else {
                 if ($certificate_visible == 0 && $status != "notgraded") {
                     return true;
                 }
             }
         }
     }
     return false;
 }
Пример #5
0
 /**
  * Fill table row
  */
 protected function fillRow($d)
 {
     global $lng, $ilCtrl;
     $user_id = $d["user_id"];
     foreach ($this->ass_data as $ass) {
         // grade
         $this->tpl->setCurrentBlock("grade");
         $status = ilExAssignment::lookupStatusOfUser($ass["id"], $user_id);
         $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
         $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded"));
         $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed"));
         $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed"));
         switch ($status) {
             case "passed":
                 $pic = "scorm/passed.svg";
                 break;
             case "failed":
                 $pic = "scorm/failed.svg";
                 break;
             default:
                 $pic = "scorm/not_attempted.svg";
                 break;
         }
         $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
         $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
         // mark
         $mark = ilExAssignment::lookupMarkOfUser($ass["id"], $user_id);
         $this->tpl->setVariable("VAL_ONLY_MARK", $mark);
         $this->tpl->parseCurrentBlock();
     }
     // exercise total
     // mark input
     $this->tpl->setCurrentBlock("mark_input");
     $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
     $this->tpl->setVariable("NAME_MARK", "mark[" . $user_id . "]");
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $mark = ilLPMarks::_lookupMark($user_id, $this->exc_id);
     $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("grade");
     $status = ilExerciseMembers::_lookupStatus($this->exc_id, $user_id);
     $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
     switch ($status) {
         case "passed":
             $pic = "scorm/passed.svg";
             break;
         case "failed":
             $pic = "scorm/failed.svg";
             break;
         default:
             $pic = "scorm/not_attempted.svg";
             break;
     }
     $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
     $this->tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $status));
     // mark
     /*$this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark"));
     		$this->tpl->setVariable("NAME_MARK",
     			"mark[".$d["id"]."]");
     		$mark = ilExAssignment::lookupMarkOfUser($ass["id"], $user_id);
     		$this->tpl->setVariable("VAL_MARK",
     			ilUtil::prepareFormOutput($mark));*/
     $this->tpl->parseCurrentBlock();
     // name
     $this->tpl->setVariable("TXT_NAME", $d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]");
     $this->tpl->setVariable("VAL_ID", $user_id);
     $ilCtrl->setParameter($this->parent_obj, "part_id", $user_id);
     $this->tpl->setVariable("LINK_NAME", $ilCtrl->getLinkTarget($this->parent_obj, "showParticipant"));
     // comment
     $this->tpl->setVariable("ID_COMMENT", $user_id);
     $c = ilLPMarks::_lookupComment($user_id, $this->exc_id);
     $this->tpl->setVariable("VAL_COMMENT", ilUtil::prepareFormOutput($c));
 }