/**
  * Returns the available question pools for the active user
  *
  * @return array The available question pools
  * @access public
  */
 function _getAvailableQuestionpools($use_object_id = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $permission = "read")
 {
     global $ilUser;
     global $ilDB;
     $result_array = array();
     $qpls = ilUtil::_getObjectsByOperations("spl", $permission, $ilUser->getId(), -1);
     $titles = ilObject::_prepareCloneSelection($qpls, "spl", $showPath);
     $allqpls = array();
     $result = $ilDB->query("SELECT obj_fi, isonline FROM svy_qpl");
     while ($row = $ilDB->fetchAssoc($result)) {
         $allqpls[$row['obj_fi']] = $row['isonline'];
     }
     foreach ($qpls as $ref_id) {
         $obj_id = ilObject::_lookupObjectId($ref_id);
         if ($could_be_offline || $allqpls[$obj_id] == 1) {
             if ($use_object_id) {
                 $result_array[$obj_id] = $titles[$ref_id];
             } else {
                 $result_array[$ref_id] = $titles[$ref_id];
             }
         }
     }
     return $result_array;
 }
Ejemplo n.º 2
0
 /**
 * Returns the available tests for the active user
 *
 * @return array The available tests
 * @access public
 */
 function &_getAvailableTests($use_object_id = FALSE)
 {
     global $ilUser;
     global $ilDB;
     $result_array = array();
     $tests = ilUtil::_getObjectsByOperations("tst", "write", $ilUser->getId(), -1);
     if (count($tests)) {
         $titles = ilObject::_prepareCloneSelection($tests, "tst");
         foreach ($tests as $ref_id) {
             if ($use_object_id) {
                 $obj_id = ilObject::_lookupObjId($ref_id);
                 $result_array[$obj_id] = $titles[$ref_id];
             } else {
                 $result_array[$ref_id] = $titles[$ref_id];
             }
         }
     }
     return $result_array;
 }
 /**
 * Returns the available question pools for the active user
 *
 * @return array The available question pools
 * @access public
 */
 function &_getAvailableQuestionpools($use_object_id = FALSE, $equal_points = FALSE, $could_be_offline = FALSE, $showPath = FALSE, $with_questioncount = FALSE, $permission = "read", $usr_id = "")
 {
     global $ilUser;
     global $ilDB;
     $result_array = array();
     $permission = strlen($permission) == 0 ? "read" : $permission;
     $qpls = ilUtil::_getObjectsByOperations("qpl", $permission, strlen($usr_id) ? $usr_id : $ilUser->getId(), -1);
     $obj_ids = array();
     foreach ($qpls as $ref_id) {
         $obj_id = ilObject::_lookupObjId($ref_id);
         $obj_ids[$ref_id] = $obj_id;
     }
     $titles = ilObject::_prepareCloneSelection($qpls, "qpl");
     if (count($obj_ids)) {
         $in = $ilDB->in('object_data.obj_id', $obj_ids, false, 'integer');
         if ($could_be_offline) {
             $result = $ilDB->query("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " . "qpl_questionpool.obj_fi = object_data.obj_id AND {$in} ORDER BY object_data.title");
         } else {
             $result = $ilDB->queryF("SELECT qpl_questionpool.*, object_data.title FROM qpl_questionpool, object_data WHERE " . "qpl_questionpool.obj_fi = object_data.obj_id AND {$in} AND qpl_questionpool.isonline = %s " . "ORDER BY object_data.title", array('text'), array(1));
         }
         while ($row = $ilDB->fetchAssoc($result)) {
             $add = TRUE;
             if ($equal_points) {
                 if (!ilObjQuestionPool::_hasEqualPoints($row["obj_fi"])) {
                     $add = FALSE;
                 }
             }
             if ($add) {
                 $ref_id = array_search($row["obj_fi"], $obj_ids);
                 $title = $showPath ? $titles[$ref_id] : $row["title"];
                 if ($with_questioncount) {
                     $title .= " [" . $row["questioncount"] . " " . ($row["questioncount"] == 1 ? $this->lng->txt("ass_question") : $this->lng->txt("assQuestions")) . "]";
                 }
                 if ($use_object_id) {
                     $result_array[$row["obj_fi"]] = array('qpl_id' => $row['obj_fi'], 'qpl_title' => $row['title'], "title" => $title, "count" => $row["questioncount"]);
                 } else {
                     $result_array[$ref_id] = array('qpl_id' => $row['obj_fi'], 'qpl_title' => $row['title'], "title" => $title, "count" => $row["questioncount"]);
                 }
             }
         }
     }
     return $result_array;
 }
Ejemplo n.º 4
0
 static final function _prepareCloneSelection($a_ref_ids, $new_type)
 {
     return parent::_prepareCloneSelection($a_ref_ids, $new_type);
 }