/** * 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); }