48        $this->lng = 
$DIC->language();
 
   49        $this->nav_history = 
$DIC[
"ilNavigationHistory"];
 
   50        $this->tpl = 
$DIC[
"tpl"];
 
   51        $this->
user = $DIC->user();
 
   52        $this->toolbar = 
$DIC->toolbar();
 
   53        $this->
error = $DIC[
"ilErr"];
 
   54        $this->locator = 
$DIC[
"ilLocator"];
 
   55        $this->
help = $DIC[
"ilHelp"];
 
   57        $ilCtrl = 
$DIC->ctrl();
 
   60        $lng->loadLanguageModule(
"survey");
 
   61        $this->ctrl = $ilCtrl;
 
   62        $this->ctrl->saveParameter($this, array(
"ref_id"));
 
   84            $ilNavigationHistory->addItem(
 
   86                "ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=" . $this->ref_id,
 
   94        $cmd = $this->ctrl->getCmd(
"questions");
 
   95        $next_class = $this->ctrl->getNextClass($this);
 
   96        $this->ctrl->setReturn($this, 
"questions");
 
   97        if (
$_GET[
"q_id"] < 1) {
 
   98            $q_type = (
$_POST[
"sel_question_types"] != 
"")
 
   99                ? 
$_POST[
"sel_question_types"]
 
  100                : 
$_GET[
"sel_question_types"];
 
  103        $this->log->debug(
"- cmd=" . $cmd . 
" next_class=" . $next_class);
 
  104        switch ($next_class) {
 
  105            case 'ilobjectmetadatagui':
 
  108                $this->ctrl->forwardCommand($md_gui);
 
  111            case 'ilpermissiongui':
 
  113                $ret = &$this->ctrl->forwardCommand($perm_gui);
 
  116            case "ilsurveyphrasesgui":
 
  118                $ret = &$this->ctrl->forwardCommand($phrases_gui);
 
  121            case 'ilobjectcopygui':
 
  124                $this->ctrl->forwardCommand($cp);
 
  127            case 'ilinfoscreengui':
 
  131            case "ilcommonactiondispatchergui":
 
  133                $this->ctrl->forwardCommand($gui);
 
  138                $ret = &$this->$cmd();
 
  143                $this->log->debug(
"- This is the switch/case default, going to question id =" . 
$_GET[
"q_id"]);
 
  145                $q_gui->setQuestionTabs();
 
  146                $ret = &$this->ctrl->forwardCommand($q_gui);
 
  149                if ($q_gui->object->isComplete()) {
 
  150                    $this->tpl->setTitle($this->lng->txt(
"question") . 
": " . $q_gui->object->getTitle());
 
  154        if (strtolower(
$_GET[
"baseClass"]) != 
"iladministrationgui" &&
 
  156            $this->tpl->printToStdout();
 
  165        $form->setFormAction($this->ctrl->getFormAction($this, 
'properties'));
 
  166        $form->setTitle($this->lng->txt(
"properties"));
 
  167        $form->setMultipart(
false);
 
  168        $form->setId(
"properties");
 
  172        $title->setSubmitFormOnEnter(
true);
 
  173        $title->setValue($this->object->getTitle());
 
  176        $title->setRequired(
true);
 
  177        $form->addItem($title);
 
  181        $desc->setValue($this->object->getLongDescription());
 
  184        $form->addItem($desc);
 
  188        $online->setInfo($this->lng->txt(
"spl_online_property_description"));
 
  189        $online->setChecked($this->object->getOnline());
 
  190        $form->addItem($online);
 
  193        $section->setTitle($this->lng->txt(
'obj_presentation'));
 
  197        $obj_service->commonSettings()->legacyForm($form, $this->
object)->addTileImage();
 
  200        $form->addCommandButton(
"saveProperties", $this->lng->txt(
"save"));
 
  214        $this->tpl->setVariable(
"ADM_CONTENT", $a_form->getHTML());
 
  224        if ($form->checkInput()) {
 
  225            $this->
object->setTitle($form->getInput(
"title"));
 
  226            $this->
object->setDescription($form->getInput(
"desc"));
 
  227            $this->
object->setOnline((
int) $form->getInput(
"online"));
 
  229            $this->
object->saveToDb();
 
  232            $obj_service->commonSettings()->legacyForm($form, $this->
object)->saveTileImage();
 
  235            ilUtil::sendSuccess($this->lng->txt(
"saved_successfully"), 
true);
 
  236            $this->ctrl->redirect($this, 
"properties");
 
  239        $form->setValuesByPost();
 
  249        if (count(
$_POST[
"q_id"]) > 0) {
 
  250            foreach (
$_POST[
"q_id"] as $key => $value) {
 
  251                $this->
object->copyToClipboard($value);
 
  257        $this->ctrl->redirect($this, 
"questions");
 
  265        if (count(
$_POST[
"q_id"]) > 0) {
 
  266            foreach (
$_POST[
"q_id"] as $key => $value) {
 
  267                $this->
object->moveToClipboard($value);
 
  273        $this->ctrl->redirect($this, 
"questions");
 
  281        if (is_array(
$_POST[
'q_id']) && count(
$_POST[
'q_id']) > 0) {
 
  297        $checked_questions = 
$_POST[
'q_id'];
 
  298        if (count($checked_questions) == 0) {
 
  305        $cgui->setHeaderText($this->lng->txt(
"qpl_confirm_delete_questions"));
 
  307        $cgui->setFormAction($this->ctrl->getFormAction($this));
 
  308        $cgui->setCancel($this->lng->txt(
"cancel"), 
"cancelDeleteQuestions");
 
  309        $cgui->setConfirm($this->lng->txt(
"confirm"), 
"confirmDeleteQuestions");
 
  311        $infos = $this->
object->getQuestionInfos($checked_questions);
 
  312        foreach ($infos as 
$data) {
 
  315            if (
$data[
"description"]) {
 
  316                $txt .= 
"<div class=\"small\">" . 
$data[
"description"] . 
"</div>";
 
  319            $cgui->addItem(
"q_id[]", 
$data[
"id"], 
$txt);
 
  322        $this->tpl->setContent($cgui->getHTML());
 
  331        ilUtil::sendSuccess($this->lng->txt(
"qpl_questions_deleted"), 
true);
 
  332        foreach (
$_POST[
'q_id'] as $q_id) {
 
  333            $this->
object->removeQuestion($q_id);
 
  335        $this->ctrl->redirect($this, 
"questions");
 
  344        $this->ctrl->redirect($this, 
"questions");
 
  352        if (array_key_exists(
"spl_clipboard", 
$_SESSION)) {
 
  353            $this->
object->pasteFromClipboard();
 
  357        $this->ctrl->redirect($this, 
"questions");
 
  368        $form->setFormAction($this->ctrl->getFormAction($this, 
"uploadQuestions"));
 
  369        $form->setTitle($this->lng->txt(
"import_question"));
 
  371        $fi = 
new ilFileInputGUI($this->lng->txt(
"select_file"), 
"qtidoc");
 
  372        $fi->setSuffixes(array(
"xml", 
"zip"));
 
  373        $fi->setRequired(
true);
 
  376        $form->addCommandButton(
"uploadQuestions", $this->lng->txt(
"import"));
 
  377        $form->addCommandButton(
"questions", $this->lng->txt(
"cancel"));
 
  379        $tpl->setContent($form->getHTML());
 
  388        $source = $_FILES[
"qtidoc"][
"tmp_name"];
 
  390        if ((
$source == 
'none') || (!
$source) || $_FILES[
"qtidoc"][
"error"] > UPLOAD_ERR_OK) {
 
  394        if (!
$error && strpos(
"xml", $_FILES[
"qtidoc"][
"type"]) !== 
false) {
 
  400            $this->
object->createImportDirectory();
 
  403            $full_path = $this->
object->getImportDirectory() . 
"/" . $_FILES[
"qtidoc"][
"name"];
 
  406                $_FILES[
"qtidoc"][
"tmp_name"],
 
  407                $_FILES[
"qtidoc"][
"name"],
 
  411            $this->
object->importObject(
$source, 
true);
 
  414        $this->ctrl->redirect($this, 
"questions");
 
  420        $table_gui->writeFilterToSession();
 
  421        $this->ctrl->redirect($this, 
'questions');
 
  427        $table_gui->resetFilter();
 
  428        $this->ctrl->redirect($this, 
'questions');
 
  439        $this->
object->purgeQuestions();
 
  445            $qtypes->setValue(
$ilUser->getPref(
"svy_lastquestiontype"));
 
  446            $ilToolbar->addInputItem($qtypes);
 
  449            foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation => 
$data) {
 
  450                $options[
$data[
"type_tag"]] = $translation;
 
  452            $qtypes->setOptions($options);
 
  454            $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
 
  457            $button->setCaption(
"svy_create_question");
 
  458            $button->setCommand(
"createQuestion");
 
  459            $ilToolbar->addButtonInstance($button);
 
  461            $ilToolbar->addSeparator();
 
  464            $button->setCaption(
"import");
 
  465            $button->setCommand(
"importQuestions");
 
  466            $ilToolbar->addButtonInstance($button);
 
  471        $arrFilter = array();
 
  472        foreach ($table_gui->getFilterItems() as $item) {
 
  473            if ($item->getValue() !== 
false) {
 
  474                $arrFilter[$item->getPostVar()] = $item->getValue();
 
  477        $table_gui->setData($this->object->getQuestionsData($arrFilter));
 
  478        $this->tpl->setContent($table_gui->getHTML());
 
  483        $this->update = $this->
object->update();
 
  484        ilUtil::sendSuccess($this->lng->txt(
"msg_obj_modified"), 
true);
 
  490        ilUtil::sendSuccess($this->lng->txt(
"object_added"), 
true);
 
  493            "&baseClass=ilObjSurveyQuestionPoolGUI");
 
  503        $ilToolbar->addButton(
 
  504            $this->lng->txt(
'create_export_file'),
 
  505            $this->ctrl->getLinkTarget($this, 
'createExportFile')
 
  509        $export_dir = $this->
object->getExportDirectory();
 
  510        $export_files = $this->
object->getExportFiles($export_dir);
 
  512        foreach ($export_files as $exp_file) {
 
  513            $file_arr = explode(
"__", $exp_file);
 
  516        $table_gui->setData(
$data);
 
  517        $this->tpl->setContent($table_gui->getHTML());
 
  528        $survey_exp->buildExportFile($questions);
 
  529        $this->ctrl->redirect($this, 
"export");
 
  537        if (!isset(
$_POST[
"file"])) {
 
  539            $this->ctrl->redirect($this, 
"export");
 
  542        if (count(
$_POST[
"file"]) > 1) {
 
  544            $this->ctrl->redirect($this, 
"export");
 
  548        $export_dir = $this->
object->getExportDirectory();
 
  550        $file = basename(
$_POST[
"file"][0]);
 
  560        if (!isset(
$_POST[
"file"])) {
 
  562            $this->ctrl->redirect($this, 
"export");
 
  567        $export_dir = $this->
object->getExportDirectory();
 
  569        foreach (
$_POST[
'file'] as $exp_file) {
 
  570            $file_arr = explode(
"__", $exp_file);
 
  573        $table_gui->setData(
$data);
 
  574        $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
 
  584        $this->ctrl->redirect($this, 
"export");
 
  592        $export_dir = $this->
object->getExportDirectory();
 
  593        foreach (
$_POST[
'file'] as $file) {
 
  594            $file = basename($file);
 
  596            $exp_file = $export_dir . 
"/" . $file;
 
  597            $exp_dir = $export_dir . 
"/" . substr($file, 0, strlen($file) - 4);
 
  598            if (@is_file($exp_file)) {
 
  601            if (@is_dir($exp_dir)) {
 
  605        $this->ctrl->redirect($this, 
"export");
 
  610        $form = parent::initImportForm($a_new_type);
 
  611        $form->getItemByPostVar(
'importfile')->setSuffixes(array(
"zip", 
"xml"));
 
  620        $forms = array(self::CFORM_NEW => $this->
initCreateForm($a_new_type),
 
  621            self::CFORM_IMPORT => $form);
 
  635            $parent_id = 
$_GET[
"ref_id"];
 
  637        $new_type = $_REQUEST[
"new_type"];
 
  641            $ilErr->raiseError($this->lng->txt(
"no_create_permission"));
 
  644        $this->lng->loadLanguageModule($new_type);
 
  645        $this->ctrl->setParameter($this, 
"new_type", $new_type);
 
  648        if ($form->checkInput()) {
 
  650            $newObj->setType($new_type);
 
  651            $newObj->setTitle(
"dummy");
 
  652            $newObj->create(
true);
 
  655            $newObj->createImportDirectory();
 
  658            $upload = $_FILES[
"importfile"];
 
  659            $file = pathinfo($upload[
"name"]);
 
  660            $full_path = $newObj->getImportDirectory() . 
"/" . $upload[
"name"];
 
  668            $qtiresult = $newObj->importObject($full_path);
 
  670            ilUtil::sendSuccess($this->lng->txt(
"object_imported"), 
true);
 
  672                "&baseClass=ilObjSurveyQuestionPoolGUI");
 
  676        $form->setValuesByPost();
 
  677        $tpl->setContent($form->getHtml());
 
  687        $ilUser->writePref(
"svy_lastquestiontype", 
$_POST[
"sel_question_types"]);
 
  690        $q_gui->object->setObjId($this->object->getId());
 
  691        $q_gui->object->createNewQuestion();
 
  693        $this->ctrl->setParameterByClass(get_class($q_gui), 
"q_id", $q_gui->object->getId());
 
  694        $this->ctrl->setParameterByClass(get_class($q_gui), 
"sel_question_types", 
$_POST[
"sel_question_types"]);
 
  695        $this->ctrl->redirectByClass(get_class($q_gui), 
"editQuestion");
 
  704        $this->ctrl->setParameterByClass(get_class($q_gui), 
"sel_question_types", $q_gui->getQuestionType());
 
  705        $this->ctrl->setParameterByClass(get_class($q_gui), 
"q_id", 
$_GET[
"preview"]);
 
  706        $this->ctrl->redirectByClass(get_class($q_gui), 
"preview");
 
  716        $this->ctrl->setCmd(
"showSummary");
 
  717        $this->ctrl->setCmdClass(
"ilinfoscreengui");
 
  731        $info->enablePrivateNotes();
 
  734        $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
 
  736        $this->ctrl->forwardCommand($info);
 
  742        switch ($this->ctrl->getCmd()) {
 
  748            $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, 
""), 
"", 
$_GET[
"ref_id"]);
 
  751        if ((
int) 
$_GET[
"q_id"]) {
 
  752            $q_id = (int) 
$_GET[
"q_id"];
 
  757                $this->ctrl->setParameterByClass($q_type, 
"q_id", $q_id);
 
  760                    $this->ctrl->getLinkTargetByClass($q_type, 
"editQuestion")
 
  775        $ilHelp->setScreenIdComponent(
"spl");
 
  777        $next_class = $this->ctrl->getNextClass($this);
 
  778        switch ($next_class) {
 
  780            case "ilpermissiongui":
 
  781            case "ilobjectmetadatagui":
 
  782            case "ilsurveyphrasesgui":
 
  790        $force_active = (($this->ctrl->getCmdClass() == 
"" &&
 
  791            $this->ctrl->getCmd() != 
"properties" && $this->ctrl->getCmd() != 
"infoScreen") ||
 
  792            $this->ctrl->getCmd() == 
"")
 
  795        if (!$force_active) {
 
  796            if (is_array(
$_GET[
"sort"])) {
 
  797                $force_active = 
true;
 
  802            $this->tabs_gui->addTarget(
 
  804                $this->ctrl->getLinkTarget($this, 
'questions'),
 
  805                array(
"questions", 
"filterQuestionBrowser", 
"filter", 
"reset", 
"createQuestion",
 
  806                 "importQuestions", 
"deleteQuestions", 
"copy", 
"paste",
 
  807                 "exportQuestions", 
"confirmDeleteQuestions", 
"cancelDeleteQuestions",
 
  808                 "confirmPasteQuestions", 
"cancelPasteQuestions", 
"uploadQuestions",
 
  809                 "editQuestion", 
"addMaterial", 
"removeMaterial", 
"save", 
"cancel",
 
  810                 "cancelExplorer", 
"linkChilds", 
"addGIT", 
"addST", 
"addPG", 
"preview",
 
  811                 "moveCategory", 
"deleteCategory", 
"addPhrase", 
"addCategory", 
"savePhrase",
 
  812                 "addSelectedPhrase", 
"cancelViewPhrase", 
"confirmSavePhrase", 
"cancelSavePhrase",
 
  813                 "insertBeforeCategory", 
"insertAfterCategory", 
"confirmDeleteCategory",
 
  814                 "cancelDeleteCategory", 
"categories", 
"saveCategories",
 
  815                 "savePhrase", 
"addPhrase" 
  817                array(
"ilobjsurveyquestionpoolgui", 
"ilsurveyphrasesgui"),
 
  822            $this->tabs_gui->addTarget(
 
  824                $this->ctrl->getLinkTarget($this, 
"infoScreen"),
 
  825                array(
"infoScreen", 
"showSummary")
 
  831            $this->tabs_gui->addTarget(
 
  833                $this->ctrl->getLinkTarget($this, 
'properties'),
 
  834                array(
"properties", 
"saveProperties"),
 
  840            $this->tabs_gui->addTarget(
 
  842                $this->ctrl->getLinkTargetByClass(
"ilsurveyphrasesgui", 
"phrases"),
 
  843                array(
"phrases", 
"deletePhrase", 
"confirmDeletePhrase", 
"cancelDeletePhrase", 
"editPhrase", 
"newPhrase", 
"saveEditPhrase", 
"phraseEditor"),
 
  844                "ilsurveyphrasesgui",
 
  850            $mdtab = $mdgui->getTab();
 
  852                $this->tabs_gui->addTarget(
 
  861            $this->tabs_gui->addTarget(
 
  863                $this->ctrl->getLinkTarget($this, 
'export'),
 
  864                array(
"export", 
"createExportFile", 
"confirmDeleteExportFile",
 
  865                 "downloadExportFile", 
"cancelDeleteExportFile", 
"deleteExportFile"),
 
  872            $this->tabs_gui->addTarget(
 
  874                $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'), 
"perm"),
 
  875                array(
"perm",
"info",
"owner"),
 
  886        $obligatory = array();
 
  887        foreach (
$_POST as $key => $value) {
 
  888            if (preg_match(
"/obligatory_(\d+)/", $key, $matches)) {
 
  889                $obligatory[] = $matches[1];
 
  892        $this->
object->setObligatoryStates($obligatory);
 
  894        ilUtil::sendSuccess($this->lng->txt(
'msg_obj_modified'), 
true);
 
  895        $this->ctrl->redirect($this, 
"questions");
 
  904    public static function _goto($a_target)
 
  908        $ilAccess = 
$DIC->access();
 
  911        if ($ilAccess->checkAccess(
"visible", 
"", $a_target) ||
 
  912            $ilAccess->checkAccess(
"read", 
"", $a_target)) {
 
  913            $_GET[
"baseClass"] = 
"ilObjSurveyQuestionPoolGUI";
 
  914            $_GET[
"cmd"] = 
"infoScreen";
 
  915            $_GET[
"ref_id"] = $a_target;
 
  916            include_once(
"ilias.php");
 
  920                $lng->txt(
"msg_no_perm_read_item"),
 
An exception for terminatinating execution or to throw for unit testing.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
static _getTitle($question_id)
Returns the question title of a question with a given id.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
error($a_errmsg)
set error message @access public
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static getLogger($a_component_id)
Get component logger.
Class ilObjSurveyQuestionPoolGUI.
uploadQuestionsObject()
imports question(s) into the questionpool
saveObligatoryObject()
Save obligatory states.
deleteExportFileObject()
delete export files
copyObject()
Copies checked questions in the questionpool to a clipboard.
createExportFileObject($questions=null)
create export file
initEditForm()
Init object edit form.
__construct()
Constructor @access public.
resetfilterQuestionBrowserObject()
savePropertiesObject()
Save questionpool properties.
downloadExportFileObject()
download export file
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
propertiesObject(ilPropertyFormGUI $a_form=null)
Questionpool properties.
cancelDeleteExportFileObject()
cancel deletion of export files
infoScreenForward()
show information screen
getTabs()
adds tabs to tab gui object
pasteObject()
paste questios from the clipboard into the question pool
questionsObject($arrFilter=null)
list questions of question pool
initCreationForms($a_new_type)
Init creation froms.
filterQuestionBrowserObject()
executeCommand()
execute command
& previewObject()
create preview of object
& createQuestionObject()
create new question
importQuestionsObject()
display the import form to import questions into the questionpool
deleteQuestionsObject()
Creates a confirmation form to delete questions from the question pool.
cancelDeleteQuestionsObject()
cancel delete questions
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
exportQuestionObject()
export a question
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
moveObject()
mark one or more question objects for moving
confirmDeleteExportFileObject()
confirmation screen for export file deletion
static _goto($a_target)
Redirect script to call a survey question pool reference id.
importFileObject($parent_id=null, $a_catch_errors=true)
form for new survey object import
initImportForm($a_new_type)
Init object import form.
confirmDeleteQuestionsObject()
delete questions
updateObject()
updates object entry in object_data
Class ilObjSurveyQuestionPool.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
prepareOutput($a_show_subobjects=true)
prepare output
initCreateForm($a_new_type)
Init object creation form.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getCreationMode()
get creation mode
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static clear($a_var)
Unset a value.
Survey phrases GUI class.
Export class for survey questionpools.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc