/**
  * Import data from DB
  */
 protected function importData()
 {
     global $ilAccess, $lng;
     include_once "Modules/Survey/classes/class.ilObjSurvey.php";
     $table_data = array();
     foreach ($this->question->getCopyIds(true) as $survey_obj_id => $questions) {
         $survey_id = new ilObjSurvey($survey_obj_id, false);
         $survey_id->loadFromDB();
         $survey_id = $survey_id->getSurveyId();
         $ref_ids = ilObject::_getAllReferences($survey_obj_id);
         $message = "";
         // check permissions for "parent" survey
         $can_write = false;
         if (!ilObjSurvey::_hasDatasets($survey_id)) {
             foreach ($ref_ids as $ref_id) {
                 if ($ilAccess->checkAccess("edit", "", $ref_id)) {
                     $can_write = true;
                     break;
                 }
             }
             if (!$can_write) {
                 $message = $lng->txt("survey_sync_insufficient_permissions");
             }
         } else {
             $message = $lng->txt("survey_has_datasets_warning");
         }
         $survey_title = ilObject::_lookupTitle($survey_obj_id);
         $survey_path = $this->buildPath($ref_ids);
         foreach ($questions as $question_id) {
             $title = SurveyQuestion::_getTitle($question_id);
             if (!$can_write) {
                 $question_id = null;
             }
             $table_data[] = array("id" => $question_id, "title" => $title, "path" => $survey_path, "message" => $message);
         }
     }
     $this->setData($table_data);
 }
Exemplo n.º 2
0
 function addLocatorItems()
 {
     global $ilLocator;
     switch ($this->ctrl->getCmd()) {
         case "next":
         case "previous":
         case "start":
         case "resume":
         case "redirectQuestion":
             $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
             break;
         case "evaluation":
         case "checkEvaluationAccess":
         case "evaluationdetails":
         case "evaluationuser":
             $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTargetByClass("ilsurveyevaluationgui", "evaluation"), "", $_GET["ref_id"]);
             break;
         case "create":
         case "save":
         case "cancel":
         case "importFile":
         case "cloneAll":
             break;
         case "infoScreen":
             $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
             break;
         default:
             $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
             // this has to be done here because ilSurveyEditorGUI is called after finalizing the locator
             if ((int) $_GET["q_id"] && !(int) $_REQUEST["new_for_survey"]) {
                 // not on create
                 // see ilObjSurveyQuestionPool::addLocatorItems
                 $q_id = (int) $_GET["q_id"];
                 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
                 $q_type = SurveyQuestion::_getQuestionType($q_id) . "GUI";
                 $this->ctrl->setParameterByClass($q_type, "q_id", $q_id);
                 $ilLocator->addItem(SurveyQuestion::_getTitle($q_id), $this->ctrl->getLinkTargetByClass(array("ilSurveyEditorGUI", $q_type), "editQuestion"));
             }
             break;
     }
 }
 public function addLocatorItems()
 {
     global $ilLocator;
     switch ($this->ctrl->getCmd()) {
         case "create":
         case "importFile":
         case "cancel":
             break;
         default:
             $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
             break;
     }
     if ($_GET["q_id"] > 0) {
         include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
         $q_type = SurveyQuestion::_getQuestionType($_GET["q_id"]) . "GUI";
         $this->ctrl->setParameterByClass($q_type, "q_id", $_GET["q_id"]);
         $ilLocator->addItem(SurveyQuestion::_getTitle($_GET["q_id"]), $this->ctrl->getLinkTargetByClass($q_type, "editQuestion"));
     }
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $usage = $a_set;
     if (is_int(strpos($usage["type"], ":"))) {
         $us_arr = explode(":", $usage["type"]);
         $usage["type"] = $us_arr[1];
         $cont_type = $us_arr[0];
     }
     include_once './Services/Link/classes/class.ilLink.php';
     switch ($usage["type"]) {
         case "pg":
             $item = array();
             //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
             switch ($cont_type) {
                 case "sahs":
                     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
                     $page_obj = new ilSCORM2004Page($usage["id"]);
                     require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
                     require_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
                     $lm_obj = new ilObjSAHSLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilSCORM2004PageNode::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "sahs");
                     }
                     break;
                 case "lm":
                     require_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                     $page_obj = new ilLMPage($usage["id"]);
                     require_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
                     require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
                     require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                     $lm_obj =& new ilObjLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "lm");
                     }
                     break;
                 case "wpg":
                     require_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                     $page_obj = new ilWikiPage($usage["id"]);
                     $item["obj_type_txt"] = $this->lng->txt("obj_wiki");
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getParentId());
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilWikiPage::lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "wiki");
                     }
                     break;
                 case "gdf":
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php";
                     $page_obj = new ilGlossaryDefPage($usage["id"]);
                     require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
                     $term_id = ilGlossaryDefinition::_lookupTermId($page_obj->getId());
                     $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
                     $item["obj_type_txt"] = $this->lng->txt("obj_glo");
                     $item["obj_title"] = ilObject::_lookupTitle($glo_id);
                     $item["sub_txt"] = $this->lng->txt("cont_term");
                     $item["sub_title"] = ilGlossaryTerm::_lookGlossaryTerm($term_id);
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "glo");
                     }
                     break;
                 case "fold":
                 case "root":
                 case "crs":
                 case "grp":
                 case "cat":
                 case "cont":
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
                     $ref_id = $this->getFirstWritableRefId($usage["id"]);
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, $cont_type);
                     }
                     break;
                 default:
                     $item["obj_title"] = "Page " . $cont_type . ", " . $usage["id"];
                     break;
             }
             break;
         case "mep":
             $item["obj_type_txt"] = $this->lng->txt("obj_mep");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($usage["id"]);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id, "mep");
             }
             break;
         case "map":
             $item["obj_type_txt"] = $this->lng->txt("obj_mob");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $item["sub_txt"] = $this->lng->txt("cont_link_area");
             break;
         case "sqst":
             $item["obj_type_txt"] = $this->lng->txt("cont_sqst");
             include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
             $obj_id = SurveyQuestion::lookupObjFi($usage["id"]);
             $item["obj_title"] = ilObject::_lookupTitle($obj_id);
             $item["sub_txt"] = $this->lng->txt("question");
             $item["sub_title"] = SurveyQuestion::_getTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($obj_id);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id);
             }
             break;
         default:
             $item["obj_title"] = "Type " . $usage["type"] . ", " . $usage["id"];
             break;
     }
     // show versions
     if (is_array($usage["hist_nr"]) && (count($usage["hist_nr"]) > 1 || $usage["hist_nr"][0] > 0)) {
         asort($usage["hist_nr"]);
         $ver = $sep = "";
         if ($usage["hist_nr"][0] == 0) {
             array_shift($usage["hist_nr"]);
             $usage["hist_nr"][] = 0;
         }
         foreach ($usage["hist_nr"] as $nr) {
             if ($nr > 0) {
                 $ver .= $sep . $nr;
             } else {
                 $ver .= $sep . $this->lng->txt("cont_current_version");
             }
             $sep = ", ";
         }
         $this->tpl->setCurrentBlock("versions");
         $this->tpl->setVariable("TXT_VERSIONS", $this->lng->txt("cont_versions"));
         $this->tpl->setVariable("VAL_VERSIONS", $ver);
         $this->tpl->parseCurrentBlock();
     }
     if ($item["obj_type_txt"] != "") {
         $this->tpl->setCurrentBlock("type");
         $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("type"));
         $this->tpl->setVariable("VAL_TYPE", $item["obj_type_txt"]);
         $this->tpl->parseCurrentBlock();
     }
     if ($usage["type"] != "clip") {
         if ($item["obj_link"]) {
             $this->tpl->setCurrentBlock("linked_item");
             $this->tpl->setVariable("TXT_OBJECT", $item["obj_title"]);
             $this->tpl->setVariable("HREF_LINK", $item["obj_link"]);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $item["obj_title"]);
         }
         if ($item["sub_txt"] != "") {
             $this->tpl->setVariable("SEP", ", ");
             $this->tpl->setVariable("SUB_TXT", $item["sub_txt"]);
             if ($item["sub_title"] != "") {
                 $this->tpl->setVariable("SEP2", ": ");
                 $this->tpl->setVariable("SUB_TITLE", $item["sub_title"]);
             }
         }
     } else {
         $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $this->lng->txt("cont_users_have_mob_in_clip1") . " " . $usage["cnt"] . " " . $this->lng->txt("cont_users_have_mob_in_clip2"));
     }
 }