ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjSurveyQuestionPoolGUI Class Reference

Class ilObjSurveyQuestionPoolGUI. More...

+ Inheritance diagram for ilObjSurveyQuestionPoolGUI:
+ Collaboration diagram for ilObjSurveyQuestionPoolGUI:

Public Member Functions

 ilObjSurveyQuestionPoolGUI ()
 Constructor public.
 executeCommand ()
 execute command
 propertiesObject ()
 Questionpool properties.
 savePropertiesObject ()
 Save questionpool properties.
 copyObject ()
 Copies checked questions in the questionpool to a clipboard.
 moveObject ()
 mark one or more question objects for moving
 exportQuestionObject ()
 export a question
 deleteQuestionsObject ()
 Creates a confirmation form to delete questions from the question pool.
 confirmDeleteQuestionsObject ()
 delete questions
 cancelDeleteQuestionsObject ()
 cancel delete questions
 pasteObject ()
 paste questios from the clipboard into the question pool
 importQuestionsObject ()
 display the import form to import questions into the questionpool
 uploadQuestionsObject ()
 imports question(s) into the questionpool
 filterQuestionBrowserObject ()
 resetfilterQuestionBrowserObject ()
 questionsObject ($arrFilter=null)
 list questions of question pool
 updateObject ()
 updates object entry in object_data
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook.
 exportObject ()
 createExportFileObject ($questions=null)
 create export file
 downloadExportFileObject ()
 download export file
 confirmDeleteExportFileObject ()
 confirmation screen for export file deletion
 cancelDeleteExportFileObject ()
 cancel deletion of export files
 deleteExportFileObject ()
 delete export files
 importFileObject ()
 form for new survey object import
createQuestionObject ()
 create new question
previewObject ()
 create preview of object
 infoScreenObject ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed
 infoScreenForward ()
 show information screen
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 getTabs (&$tabs_gui)
 adds tabs to tab gui object
 saveObligatoryObject ()
 Save obligatory states.
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public.
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not)
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui
 getCreationMode ()
 get creation mode
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder
 getHTML ()
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled
 cancelDeleteObject ()
 cancel deletion of object
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public
 createObject ()
 create new object form
 cancelCreation ()
 cancel create action and go back to repository parent
 saveObject ()
 save object
 editObject ()
 edit object
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g.
 isVisible ($a_ref_id, $a_type)
 viewObject ()
 list childs of current object
 deleteObject ($a_error=false)
 Display deletion confirmation screen.
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI.

Static Public Member Functions

static _goto ($a_target)
 Redirect script to call a survey question pool reference id.
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root.
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root.

Data Fields

 $defaultscript
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 $ilias
 $objDefinition
 $tpl
 $tree
 $lng
 $data
 $object
 $ref_id
 $obj_id
 $maxcount
 $formaction
 $return_location
 $target_frame
 $tab_target_script
 $actions
 $sub_objects
 $omit_locator = false
const CFORM_NEW = 1
const CFORM_IMPORT = 2
const CFORM_CLONE = 3

Protected Member Functions

 initImportForm ($a_new_type)
 Init object import form.
 initCreationForms ($a_new_type)
 Init creation froms.
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 prepareOutput ()
 prepare output
 setTitleAndDescription ()
 called by prepare output
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu.
 insertHeaderAction ($a_list_gui)
 Insert header action into main template.
 addHeaderAction ()
 Add header action menu.
 redrawHeaderActionObject ()
 Ajax call: redraw action header only.
 showMountWebfolderIcon ()
 setTabs ()
 set admin tabs public
 setAdminTabs ()
 set admin tabs public
 setLocator ()
 set Locator
 omitLocator ($a_omit=true)
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded)
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion)
 initCreateForm ($a_new_type)
 Init object creation form.
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types.
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates.
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen.
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position.
 initEditForm ()
 Init object edit form.
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form.
 getEditFormValues ()
 Get values for edit form.
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields.
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput())
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object.
 afterUpdate ()
 Post (successful) object update hook.
 importFileObject ($parent_id=null)
 Import.
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook.
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g.
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g.
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu)
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl.
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste
 __showButton ($a_cmd, $a_text, $a_target= '')
 hitsperpageObject ()
__initTableGUI ()
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning.
 getCenterColumnHTML ()
 Get center column.
 getRightColumnHTML ()
 Display right column.
 setColumnSettings ($column_gui)
 May be overwritten in subclasses.
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error.
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission.
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files.
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting.

Detailed Description

Member Function Documentation

static ilObjSurveyQuestionPoolGUI::_goto (   $a_target)
static

Redirect script to call a survey question pool reference id.

Parameters
integer$a_targetThe reference id of the question pool public

Definition at line 916 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_GET, $ilErr, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), exit, and ilUtil\sendFailure().

{
global $ilAccess, $ilErr, $lng;
if ($ilAccess->checkAccess("write", "", $a_target))
{
$_GET["baseClass"] = "ilObjSurveyQuestionPoolGUI";
$_GET["cmd"] = "questions";
$_GET["ref_id"] = $a_target;
include_once("ilias.php");
}
else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
{
ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
}
$ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::addLocatorItems ( )

should be overwritten to add object specific items (repository items are preloaded)

Reimplemented from ilObjectGUI.

Definition at line 768 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_GET, SurveyQuestion\_getQuestionType(), and SurveyQuestion\_getTitle().

{
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 ((int)$_GET["q_id"])
{
$q_id = (int)$_GET["q_id"];
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$q_type = SurveyQuestion::_getQuestionType($q_id) . "GUI";
$q_title = SurveyQuestion::_getTitle($q_id);
if($q_title)
{
// not on create
$this->ctrl->setParameterByClass($q_type, "q_id", $q_id);
$ilLocator->addItem($q_title,
$this->ctrl->getLinkTargetByClass($q_type, "editQuestion"));
}
}
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::afterSave ( ilObject  $a_new_object)

Post (successful) object creation hook.

Parameters
ilObject$a_new_object

Reimplemented from ilObjectGUI.

Definition at line 494 of file class.ilObjSurveyQuestionPoolGUI.php.

References ilObject\getRefId(), ilUtil\redirect(), and ilUtil\sendSuccess().

{
// always send a message
ilUtil::sendSuccess($this->lng->txt("object_added"),true);
ilUtil::redirect("ilias.php?ref_id=".$a_new_object->getRefId().
"&baseClass=ilObjSurveyQuestionPoolGUI");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::cancelDeleteExportFileObject ( )

cancel deletion of export files

Definition at line 602 of file class.ilObjSurveyQuestionPoolGUI.php.

References ilSession\clear().

{
ilSession::clear("ilExportFiles");
$this->ctrl->redirect($this, "export");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::cancelDeleteQuestionsObject ( )

cancel delete questions

Definition at line 332 of file class.ilObjSurveyQuestionPoolGUI.php.

{
// delete questions after confirmation
$this->ctrl->redirect($this, "questions");
}
ilObjSurveyQuestionPoolGUI::confirmDeleteExportFileObject ( )

confirmation screen for export file deletion

Definition at line 576 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, ilObjectGUI\$data, ilDatePresentation\formatDate(), IL_CAL_UNIX, ilUtil\sendInfo(), and ilUtil\sendQuestion().

{
if(!isset($_POST["file"]))
{
ilUtil::sendInfo($this->lng->txt("no_checkbox"),true);
$this->ctrl->redirect($this, "export");
}
ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
$table_gui = new ilSurveyQuestionPoolExportTableGUI($this, 'export', true);
$export_dir = $this->object->getExportDirectory();
$data = array();
foreach ($_POST['file'] as $exp_file)
{
$file_arr = explode("__", $exp_file);
array_push($data, array('file' => $exp_file, 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => filesize($export_dir."/".$exp_file)));
}
$table_gui->setData($data);
$this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::confirmDeleteQuestionsObject ( )

delete questions

Definition at line 318 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, and ilUtil\sendSuccess().

{
// delete questions after confirmation
ilUtil::sendSuccess($this->lng->txt("qpl_questions_deleted"), true);
foreach ($_POST['q_id'] as $q_id)
{
$this->object->removeQuestion($q_id);
}
$this->ctrl->redirect($this, "questions");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::copyObject ( )

Copies checked questions in the questionpool to a clipboard.

Definition at line 212 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, and ilUtil\sendInfo().

{
if (count($_POST["q_id"]) > 0)
{
foreach ($_POST["q_id"] as $key => $value)
{
$this->object->copyToClipboard($value);
}
ilUtil::sendInfo($this->lng->txt("spl_copy_insert_clipboard"), true);
}
else
{
ilUtil::sendInfo($this->lng->txt("spl_copy_select_none"), true);
}
$this->ctrl->redirect($this, "questions");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::createExportFileObject (   $questions = null)

create export file

Definition at line 530 of file class.ilObjSurveyQuestionPoolGUI.php.

References ilUtil\sendInfo().

Referenced by exportQuestionObject().

{
global $rbacsystem;
if ($rbacsystem->checkAccess("write", $this->ref_id))
{
include_once("./Modules/SurveyQuestionPool/classes/class.ilSurveyQuestionpoolExport.php");
$survey_exp = new ilSurveyQuestionpoolExport($this->object);
$survey_exp->buildExportFile($questions);
$this->ctrl->redirect($this, "export");
}
else
{
ilUtil::sendInfo("cannot_export_questionpool");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilObjSurveyQuestionPoolGUI::createQuestionObject ( )

create new question

Definition at line 706 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, $ilUser, and SurveyQuestionGUI\_getQuestionGUI().

{
global $ilUser;
$ilUser->writePref("svy_lastquestiontype", $_POST["sel_question_types"]);
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
$q_gui =& SurveyQuestionGUI::_getQuestionGUI($_POST["sel_question_types"]);
$q_gui->object->setObjId($this->object->getId());
$q_gui->object->createNewQuestion();
$this->ctrl->setParameterByClass(get_class($q_gui), "q_id", $q_gui->object->getId());
$this->ctrl->setParameterByClass(get_class($q_gui), "sel_question_types", $_POST["sel_question_types"]);
$this->ctrl->redirectByClass(get_class($q_gui), "editQuestion");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::deleteExportFileObject ( )

delete export files

Definition at line 611 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, $file, and ilUtil\delDir().

{
$export_dir = $this->object->getExportDirectory();
foreach($_POST['file'] as $file)
{
$file = basename($file);
$exp_file = $export_dir."/".$file;
$exp_dir = $export_dir."/".substr($file, 0, strlen($file) - 4);
if (@is_file($exp_file))
{
unlink($exp_file);
}
if (@is_dir($exp_dir))
{
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::delDir($exp_dir);
}
}
$this->ctrl->redirect($this, "export");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::deleteQuestionsObject ( )

Creates a confirmation form to delete questions from the question pool.

Definition at line 268 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, ilObjectGUI\$data, $txt, SurveyQuestion\_getQuestionTypeName(), questionsObject(), ilUtil\sendFailure(), and ilUtil\sendInfo().

{
global $rbacsystem;
// create an array of all checked checkboxes
$checked_questions = $_POST['q_id'];
if (count($checked_questions) > 0)
{
if (!$rbacsystem->checkAccess('write', $this->ref_id))
{
ilUtil::sendFailure($this->lng->txt("qpl_delete_rbac_error"));
$this->questionsObject();
return;
}
}
elseif (count($checked_questions) == 0)
{
ilUtil::sendInfo($this->lng->txt("qpl_delete_select_none"));
$this->questionsObject();
return;
}
include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
$cgui = new ilConfirmationGUI();
$cgui->setHeaderText($this->lng->txt("qpl_confirm_delete_questions"));
$cgui->setFormAction($this->ctrl->getFormAction($this));
$cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteQuestions");
$cgui->setConfirm($this->lng->txt("confirm"), "confirmDeleteQuestions");
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
$infos = $this->object->getQuestionInfos($checked_questions);
foreach ($infos as $data)
{
$txt = $data["title"]." (".
SurveyQuestion::_getQuestionTypeName($data["type_tag"]).")";
if($data["description"])
{
$txt .= "<div class=\"small\">".$data["description"]."</div>";
}
$cgui->addItem("q_id[]", $data["id"], $txt);
}
$this->tpl->setContent($cgui->getHTML());
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::downloadExportFileObject ( )

download export file

Definition at line 550 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, $file, ilUtil\deliverFile(), and ilUtil\sendInfo().

{
if(!isset($_POST["file"]))
{
ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
$this->ctrl->redirect($this, "export");
}
if (count($_POST["file"]) > 1)
{
ilUtil::sendInfo($this->lng->txt("select_max_one_item"),true);
$this->ctrl->redirect($this, "export");
}
$export_dir = $this->object->getExportDirectory();
include_once "./Services/Utilities/classes/class.ilUtil.php";
$file = basename($_POST["file"][0]);
ilUtil::deliverFile($export_dir."/".$file, $file);
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

Definition at line 65 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_GET, $_POST, $cmd, $ilErr, ilObjectGUI\$ilias, $ret, SurveyQuestionGUI\_getQuestionGUI(), ilMDEditorGUI\addObserver(), ilObjectGUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), ilUtil\getStyleSheetLocation(), infoScreenForward(), and ilObjectGUI\prepareOutput().

{
global $ilAccess, $ilNavigationHistory, $ilErr;
if (!$ilAccess->checkAccess("read", "", $this->ref_id) &&
!$ilAccess->checkAccess("visible", "", $this->ref_id))
{
global $ilias;
$ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
}
// add entry to navigation history
if (!$this->getCreationMode() &&
$ilAccess->checkAccess("read", "", $this->ref_id))
{
$ilNavigationHistory->addItem($this->ref_id,
"ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=".$this->ref_id, "spl");
}
$this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "survey.css", "Modules/Survey"), "screen");
$this->prepareOutput();
$cmd = $this->ctrl->getCmd("questions");
$next_class = $this->ctrl->getNextClass($this);
$this->ctrl->setReturn($this, "questions");
if ($_GET["q_id"] < 1)
{
$q_type = ($_POST["sel_question_types"] != "")
? $_POST["sel_question_types"]
: $_GET["sel_question_types"];
}
switch($next_class)
{
case 'ilmdeditorgui':
if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
{
$ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
}
include_once "./Services/MetaData/classes/class.ilMDEditorGUI.php";
$md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
$md_gui->addObserver($this->object,'MDUpdateListener','General');
$this->ctrl->forwardCommand($md_gui);
break;
case 'ilpermissiongui':
include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
$perm_gui =& new ilPermissionGUI($this);
$ret =& $this->ctrl->forwardCommand($perm_gui);
break;
case "ilsurveyphrasesgui":
include_once("./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrasesGUI.php");
$phrases_gui =& new ilSurveyPhrasesGUI($this);
$ret =& $this->ctrl->forwardCommand($phrases_gui);
break;
case 'ilobjectcopygui':
include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
$cp = new ilObjectCopyGUI($this);
$cp->setType('spl');
$this->ctrl->forwardCommand($cp);
break;
case 'ilinfoscreengui':
break;
case "ilcommonactiondispatchergui":
include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
$this->ctrl->forwardCommand($gui);
break;
case "":
$cmd.= "Object";
$ret =& $this->$cmd();
break;
default:
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
$q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type, $_GET["q_id"]);
// $q_gui->object->setObjId($this->object->getId());
$q_gui->setQuestionTabs();
$ret =& $this->ctrl->forwardCommand($q_gui);
// not on create
if($q_gui->object->isComplete())
{
$this->tpl->setTitle($this->lng->txt("question").": ".$q_gui->object->getTitle());
}
break;
}
if (strtolower($_GET["baseClass"]) != "iladministrationgui" &&
$this->getCreationMode() != true)
{
$this->tpl->show();
}
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::exportObject ( )

Definition at line 506 of file class.ilObjSurveyQuestionPoolGUI.php.

References ilObjectGUI\$data, ilDatePresentation\formatDate(), and IL_CAL_UNIX.

{
global $ilToolbar;
$ilToolbar->addButton($this->lng->txt('create_export_file'),
$this->ctrl->getLinkTarget($this, 'createExportFile'));
include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionPoolExportTableGUI.php";
$table_gui = new ilSurveyQuestionPoolExportTableGUI($this, 'export');
$export_dir = $this->object->getExportDirectory();
$export_files = $this->object->getExportFiles($export_dir);
$data = array();
foreach ($export_files as $exp_file)
{
$file_arr = explode("__", $exp_file);
array_push($data, array('file' => $exp_file, 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => filesize($export_dir."/".$exp_file)));
}
$table_gui->setData($data);
$this->tpl->setContent($table_gui->getHTML());
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::exportQuestionObject ( )

export a question

Definition at line 252 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, createExportFileObject(), questionsObject(), and ilUtil\sendInfo().

{
if (is_array($_POST['q_id']) && count($_POST['q_id']) > 0)
{
$this->createExportFileObject($_POST['q_id']);
}
else
{
ilUtil::sendInfo($this->lng->txt("qpl_export_select_none"));
$this->questionsObject();
}
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::filterQuestionBrowserObject ( )

Definition at line 414 of file class.ilObjSurveyQuestionPoolGUI.php.

{
include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
$table_gui = new ilSurveyQuestionsTableGUI($this, 'questions');
$table_gui->writeFilterToSession();
$this->ctrl->redirect($this, 'questions');
}
ilObjSurveyQuestionPoolGUI::getTabs ( $tabs_gui)

adds tabs to tab gui object

Parameters
object$tabs_guiilTabsGUI object

Reimplemented from ilObjectGUI.

Definition at line 802 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_GET.

{
global $ilAccess, $ilHelp;
$ilHelp->setScreenIdComponent("spl");
$next_class = $this->ctrl->getNextClass($this);
switch ($next_class)
{
case "":
case "ilpermissiongui":
case "ilmdeditorgui":
case "ilsurveyphrasesgui":
break;
default:
return;
break;
}
// questions
$force_active = (($this->ctrl->getCmdClass() == "" &&
$this->ctrl->getCmd() != "properties") ||
$this->ctrl->getCmd() == "")
? true
: false;
if (!$force_active)
{
if (is_array($_GET["sort"]))
{
$force_active = true;
}
}
$tabs_gui->addTarget("survey_questions",
$this->ctrl->getLinkTarget($this,'questions'),
array("questions", "filterQuestionBrowser", "filter", "reset", "createQuestion",
"importQuestions", "deleteQuestions", "copy", "paste",
"exportQuestions", "confirmDeleteQuestions", "cancelDeleteQuestions",
"confirmPasteQuestions", "cancelPasteQuestions", "uploadQuestions",
"editQuestion", "addMaterial", "removeMaterial", "save", "cancel",
"cancelExplorer", "linkChilds", "addGIT", "addST", "addPG", "preview",
"moveCategory", "deleteCategory", "addPhrase", "addCategory", "savePhrase",
"addSelectedPhrase", "cancelViewPhrase", "confirmSavePhrase", "cancelSavePhrase",
"insertBeforeCategory", "insertAfterCategory", "confirmDeleteCategory",
"cancelDeleteCategory", "categories", "saveCategories",
"savePhrase", "addPhrase"
),
array("ilobjsurveyquestionpoolgui", "ilsurveyphrasesgui"), "", $force_active);
if ($ilAccess->checkAccess("visible", "", $this->ref_id))
{
$tabs_gui->addTarget("info_short",
$this->ctrl->getLinkTarget($this, "infoScreen"),
array("infoScreen", "showSummary"));
}
if ($ilAccess->checkAccess('write', '', $this->ref_id))
{
// properties
$tabs_gui->addTarget("settings",
$this->ctrl->getLinkTarget($this,'properties'),
"properties",
"", "");
// manage phrases
$tabs_gui->addTarget("manage_phrases",
$this->ctrl->getLinkTargetByClass("ilsurveyphrasesgui", "phrases"),
array("phrases", "deletePhrase", "confirmDeletePhrase", "cancelDeletePhrase", "editPhrase", "newPhrase", "saveEditPhrase", "phraseEditor"),
"ilsurveyphrasesgui", "");
// meta data
$tabs_gui->addTarget("meta_data",
$this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'),
"", "ilmdeditorgui");
// export
$tabs_gui->addTarget("export",
$this->ctrl->getLinkTarget($this,'export'),
array("export", "createExportFile", "confirmDeleteExportFile",
"downloadExportFile", "cancelDeleteExportFile", "deleteExportFile"),
"", "");
}
if ($ilAccess->checkAccess("edit_permission", "", $this->ref_id))
{
$tabs_gui->addTarget("perm_settings",
$this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
}
}
ilObjSurveyQuestionPoolGUI::ilObjSurveyQuestionPoolGUI ( )

Constructor public.

Definition at line 50 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_GET, $ilCtrl, ilObjectGUI\$lng, and ilObjectGUI\ilObjectGUI().

{
global $lng, $ilCtrl;
$this->type = "spl";
$lng->loadLanguageModule("survey");
$this->ctrl =& $ilCtrl;
$this->ctrl->saveParameter($this, array("ref_id"));
$this->ilObjectGUI("",$_GET["ref_id"], true, false);
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::importFileObject ( )

form for new survey object import

Definition at line 654 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_GET, $_REQUEST, $file, $ilErr, ilObjectGUI\$tpl, ilObjectGUI\checkPermissionBool(), initImportForm(), ilUtil\moveUploadedFile(), ilObjectGUI\putObjectInTree(), ilUtil\redirect(), and ilUtil\sendSuccess().

{
global $tpl, $ilErr;
$parent_id = $_GET["ref_id"];
$new_type = $_REQUEST["new_type"];
// create permission is already checked in createObject. This check here is done to prevent hacking attempts
if (!$this->checkPermissionBool("create", "", $new_type))
{
$ilErr->raiseError($this->lng->txt("no_create_permission"));
}
$this->lng->loadLanguageModule($new_type);
$this->ctrl->setParameter($this, "new_type", $new_type);
$form = $this->initImportForm($new_type);
if ($form->checkInput())
{
include_once "./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
$newObj = new ilObjSurveyQuestionPool();
$newObj->setType($new_type);
$newObj->setTitle("dummy");
$newObj->create(true);
$this->putObjectInTree($newObj);
$newObj->createImportDirectory();
// copy uploaded file to import directory
$upload = $_FILES["importfile"];
$file = pathinfo($upload["name"]);
$full_path = $newObj->getImportDirectory()."/".$upload["name"];
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::moveUploadedFile($upload["tmp_name"], $upload["name"],
$full_path);
// import qti data
$qtiresult = $newObj->importObject($full_path);
ilUtil::sendSuccess($this->lng->txt("object_imported"),true);
ilUtil::redirect("ilias.php?ref_id=".$newObj->getRefId().
"&baseClass=ilObjSurveyQuestionPoolGUI");
}
// display form to correct errors
$form->setValuesByPost();
$tpl->setContent($form->getHtml());
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::importQuestionsObject ( )

display the import form to import questions into the questionpool

Definition at line 357 of file class.ilObjSurveyQuestionPoolGUI.php.

References ilObjectGUI\$tpl, and ilFileInputGUI\setSuffixes().

{
global $tpl;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this, "uploadQuestions"));
$form->setTitle($this->lng->txt("import_question"));
include_once("./Services/Form/classes/class.ilFileInputGUI.php");
$fi = new ilFileInputGUI($this->lng->txt("select_file"), "qtidoc");
$fi->setSuffixes(array("xml", "zip"));
$fi->setRequired(true);
$form->addItem($fi);
$form->addCommandButton("uploadQuestions", $this->lng->txt("import"));
$form->addCommandButton("questions", $this->lng->txt("cancel"));
$tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::infoScreenForward ( )

show information screen

Definition at line 749 of file class.ilObjSurveyQuestionPoolGUI.php.

References $ilErr.

Referenced by executeCommand(), and infoScreenObject().

{
global $ilErr, $ilAccess;
if(!$ilAccess->checkAccess("visible", "", $this->ref_id))
{
$ilErr->raiseError($this->lng->txt("msg_no_perm_read"));
}
include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
$info = new ilInfoScreenGUI($this);
$info->enablePrivateNotes();
// standard meta data
$info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
$this->ctrl->forwardCommand($info);
}

+ Here is the caller graph for this function:

ilObjSurveyQuestionPoolGUI::infoScreenObject ( )

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

Definition at line 739 of file class.ilObjSurveyQuestionPoolGUI.php.

References infoScreenForward().

{
$this->ctrl->setCmd("showSummary");
$this->ctrl->setCmdClass("ilinfoscreengui");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::initCreationForms (   $a_new_type)
protected

Init creation froms.

this will create the default creation forms: new, import, clone

Parameters
string$a_new_type
Returns
array

Reimplemented from ilObjectGUI.

Definition at line 641 of file class.ilObjSurveyQuestionPoolGUI.php.

References ilObjectGUI\initCreateForm(), and initImportForm().

{
$form = $this->initImportForm($a_new_type);
$forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
self::CFORM_IMPORT => $form);
return $forms;
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::initImportForm (   $a_new_type)
protected

Init object import form.

Parameters
stringnew type
Returns
ilPropertyFormGUI

Reimplemented from ilObjectGUI.

Definition at line 633 of file class.ilObjSurveyQuestionPoolGUI.php.

Referenced by importFileObject(), and initCreationForms().

{
$form = parent::initImportForm($a_new_type);
$form->getItemByPostVar('importfile')->setSuffixes(array("zip", "xml"));
return $form;
}

+ Here is the caller graph for this function:

ilObjSurveyQuestionPoolGUI::moveObject ( )

mark one or more question objects for moving

Definition at line 232 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, and ilUtil\sendInfo().

{
if (count($_POST["q_id"]) > 0)
{
foreach ($_POST["q_id"] as $key => $value)
{
$this->object->moveToClipboard($value);
}
ilUtil::sendInfo($this->lng->txt("spl_move_insert_clipboard"), true);
}
else
{
ilUtil::sendInfo($this->lng->txt("spl_move_select_none"), true);
}
$this->ctrl->redirect($this, "questions");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::pasteObject ( )

paste questios from the clipboard into the question pool

Definition at line 341 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_SESSION, and ilUtil\sendInfo().

{
if (array_key_exists("spl_clipboard", $_SESSION))
{
$this->object->pasteFromClipboard();
}
else
{
ilUtil::sendInfo($this->lng->txt("spl_paste_no_objects"), true);
}
$this->ctrl->redirect($this, "questions");
}

+ Here is the call graph for this function:

& ilObjSurveyQuestionPoolGUI::previewObject ( )

create preview of object

Definition at line 725 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_GET, and SurveyQuestionGUI\_getQuestionGUI().

{
include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
$q_gui =& SurveyQuestionGUI::_getQuestionGUI("", $_GET["preview"]);
$this->ctrl->setParameterByClass(get_class($q_gui), "sel_question_types", $q_gui->getQuestionType());
$this->ctrl->setParameterByClass(get_class($q_gui), "q_id", $_GET["preview"]);
$this->ctrl->redirectByClass(get_class($q_gui), "preview");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::propertiesObject ( )

Questionpool properties.

Definition at line 169 of file class.ilObjSurveyQuestionPoolGUI.php.

References ilFormPropertyGUI\setInfo().

{
$save = ((strcmp($this->ctrl->getCmd(), "save") == 0)) ? true : false;
include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this, 'properties'));
$form->setTitle($this->lng->txt("properties"));
$form->setMultipart(false);
$form->setId("properties");
// online
$online = new ilCheckboxInputGUI($this->lng->txt("spl_online_property"), "online");
$online->setInfo($this->lng->txt("spl_online_property_description"));
$online->setChecked($this->object->getOnline());
$form->addItem($online);
$form->addCommandButton("saveProperties", $this->lng->txt("save"));
if ($save)
{
$form->checkInput();
}
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::questionsObject (   $arrFilter = null)

list questions of question pool

Definition at line 433 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_GET, $_SESSION, ilObjectGUI\$data, $ilUser, $options, ilSubmitButton\getInstance(), and ilSurveyQuestionsTableGUI\setEditable().

Referenced by deleteQuestionsObject(), and exportQuestionObject().

{
global $rbacsystem;
global $ilUser;
global $ilToolbar;
$this->object->purgeQuestions();
$_SESSION['q_id_table_nav'] = $_GET['q_id_table_nav'];
if ($rbacsystem->checkAccess('write', $_GET['ref_id']))
{
include_once "Services/Form/classes/class.ilSelectInputGUI.php";
$qtypes = new ilSelectInputGUI("", "sel_question_types");
$qtypes->setValue($ilUser->getPref("svy_lastquestiontype"));
$ilToolbar->addInputItem($qtypes);
$options = array();
foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation => $data)
{
$options[$data["type_tag"]] = $translation;
}
$qtypes->setOptions($options);
$ilToolbar->setFormAction($this->ctrl->getFormAction($this));
include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
$button->setCaption("svy_create_question");
$button->setCommand("createQuestion");
$ilToolbar->addButtonInstance($button);
$ilToolbar->addSeparator();
$button->setCaption("import");
$button->setCommand("importQuestions");
$ilToolbar->addButtonInstance($button);
}
include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
$table_gui = new ilSurveyQuestionsTableGUI($this, 'questions', (($rbacsystem->checkAccess('write', $_GET['ref_id']) ? true : false)));
$table_gui->setEditable($rbacsystem->checkAccess('write', $_GET['ref_id']));
$arrFilter = array();
foreach ($table_gui->getFilterItems() as $item)
{
if ($item->getValue() !== false)
{
$arrFilter[$item->getPostVar()] = $item->getValue();
}
}
$table_gui->setData($this->object->getQuestionsData($arrFilter));
$this->tpl->setContent($table_gui->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjSurveyQuestionPoolGUI::resetfilterQuestionBrowserObject ( )

Definition at line 422 of file class.ilObjSurveyQuestionPoolGUI.php.

{
include_once "./Modules/SurveyQuestionPool/classes/tables/class.ilSurveyQuestionsTableGUI.php";
$table_gui = new ilSurveyQuestionsTableGUI($this, 'questions');
$table_gui->resetFilter();
$this->ctrl->redirect($this, 'questions');
}
ilObjSurveyQuestionPoolGUI::saveObligatoryObject ( )

Save obligatory states.

Definition at line 894 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, and ilUtil\sendSuccess().

{
$obligatory = array();
foreach ($_POST as $key => $value)
{
if (preg_match("/obligatory_(\d+)/", $key, $matches))
{
$obligatory[]= $matches[1];
}
}
$this->object->setObligatoryStates($obligatory);
ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
$this->ctrl->redirect($this, "questions");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::savePropertiesObject ( )

Save questionpool properties.

Definition at line 198 of file class.ilObjSurveyQuestionPoolGUI.php.

References $_POST, and ilUtil\sendSuccess().

{
$qpl_online = $_POST["online"];
if (strlen($qpl_online) == 0) $qpl_online = "0";
$this->object->setOnline($qpl_online);
$this->object->saveToDb();
ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
$this->ctrl->redirect($this, "properties");
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::updateObject ( )

updates object entry in object_data

Reimplemented from ilObjectGUI.

Definition at line 488 of file class.ilObjSurveyQuestionPoolGUI.php.

References ilUtil\sendSuccess().

{
$this->update = $this->object->update();
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
}

+ Here is the call graph for this function:

ilObjSurveyQuestionPoolGUI::uploadQuestionsObject ( )

imports question(s) into the questionpool

Definition at line 381 of file class.ilObjSurveyQuestionPoolGUI.php.

References ilUtil\moveUploadedFile().

{
// check if file was uploaded
$source = $_FILES["qtidoc"]["tmp_name"];
$error = 0;
if (($source == 'none') || (!$source) || $_FILES["qtidoc"]["error"] > UPLOAD_ERR_OK)
{
$error = 1;
}
// check correct file type
if (!$error && strpos("xml", $_FILES["qtidoc"]["type"]) !== FALSE)
{
$error = 1;
}
if (!$error)
{
// import file into questionpool
// create import directory
$this->object->createImportDirectory();
// copy uploaded file to import directory
$full_path = $this->object->getImportDirectory()."/".$_FILES["qtidoc"]["name"];
include_once "./Services/Utilities/classes/class.ilUtil.php";
ilUtil::moveUploadedFile($_FILES["qtidoc"]["tmp_name"],
$_FILES["qtidoc"]["name"], $full_path);
$source = $full_path;
$this->object->importObject($source, TRUE);
unlink($source);
}
$this->ctrl->redirect($this, "questions");
}

+ Here is the call graph for this function:

Field Documentation

ilObjSurveyQuestionPoolGUI::$defaultscript

Definition at line 44 of file class.ilObjSurveyQuestionPoolGUI.php.


The documentation for this class was generated from the following file: