ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjSurveyQuestionPoolGUI Class Reference

Class ilObjSurveyQuestionPoolGUI. More...

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

Public Member Functions

 __construct ()
 Constructor public. More...
 
 executeCommand ()
 execute command More...
 
 propertiesObject (ilPropertyFormGUI $a_form=null)
 Questionpool properties. More...
 
 savePropertiesObject ()
 Save questionpool properties. More...
 
 copyObject ()
 Copies checked questions in the questionpool to a clipboard. More...
 
 moveObject ()
 mark one or more question objects for moving More...
 
 exportQuestionObject ()
 export a question More...
 
 deleteQuestionsObject ()
 Creates a confirmation form to delete questions from the question pool. More...
 
 confirmDeleteQuestionsObject ()
 delete questions More...
 
 cancelDeleteQuestionsObject ()
 cancel delete questions More...
 
 pasteObject ()
 paste questios from the clipboard into the question pool More...
 
 importQuestionsObject ()
 display the import form to import questions into the questionpool More...
 
 uploadQuestionsObject ()
 imports question(s) into the questionpool More...
 
 filterQuestionBrowserObject ()
 
 resetfilterQuestionBrowserObject ()
 
 questionsObject ($arrFilter=null)
 list questions of question pool More...
 
 updateObject ()
 
 afterSave (ilObject $a_new_object)
 
 exportObject ()
 
 createExportFileObject ($questions=null)
 create export file More...
 
 downloadExportFileObject ()
 download export file More...
 
 confirmDeleteExportFileObject ()
 confirmation screen for export file deletion More...
 
 cancelDeleteExportFileObject ()
 cancel deletion of export files More...
 
 deleteExportFileObject ()
 delete export files More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 form for new survey object import More...
 
createQuestionObject ()
 create new question More...
 
previewObject ()
 create preview of object More...
 
 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 More...
 
 infoScreenForward ()
 show information screen More...
 
 addLocatorItems ()
 
 getTabs ()
 adds tabs to tab gui object More...
 
 saveObligatoryObject ()
 Save obligatory states. More...
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 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 More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

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

Data Fields

 $defaultscript
 
- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $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

 initEditForm ()
 
 initImportForm ($a_new_type)
 
 initCreationForms ($a_new_type)
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __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 More...
 
 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 More...
 
 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. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Protected Attributes

 $nav_history
 
 $error
 
 $help
 
 $log
 
- Protected Attributes inherited from ilObjectGUI
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjSurveyQuestionPoolGUI::__construct ( )

Constructor public.

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

References $_GET, $DIC, ilObjectGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ilLoggerFactory\getLogger(), help(), and user().

45  {
46  global $DIC;
47 
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"];
56  $lng = $DIC->language();
57  $ilCtrl = $DIC->ctrl();
58 
59  $this->type = "spl";
60  $lng->loadLanguageModule("survey");
61  $this->ctrl = $ilCtrl;
62  $this->ctrl->saveParameter($this, array("ref_id"));
63 
64  parent::__construct("", $_GET["ref_id"], true, false);
65 
66  $this->log = ilLoggerFactory::getLogger('svy');
67  }
$_GET["client_id"]
user()
Definition: user.php:4
help()
Definition: help.php:2
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

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 904 of file class.ilObjSurveyQuestionPoolGUI.php.

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

905  {
906  global $DIC;
907 
908  $ilAccess = $DIC->access();
909  $lng = $DIC->language();
910 
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");
917  exit;
918  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
919  ilUtil::sendFailure(sprintf(
920  $lng->txt("msg_no_perm_read_item"),
922  ), true);
924  }
925  }
exit
Definition: login.php:29
const ROOT_FOLDER_ID
Definition: constants.php:30
$_GET["client_id"]
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjSurveyQuestionPoolGUI::addLocatorItems ( )

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

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

740  {
741  $ilLocator = $this->locator;
742  switch ($this->ctrl->getCmd()) {
743  case "create":
744  case "importFile":
745  case "cancel":
746  break;
747  default:
748  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
749  break;
750  }
751  if ((int) $_GET["q_id"]) {
752  $q_id = (int) $_GET["q_id"];
753  $q_type = SurveyQuestion::_getQuestionType($q_id) . "GUI";
754  $q_title = SurveyQuestion::_getTitle($q_id);
755  if ($q_title) {
756  // not on create
757  $this->ctrl->setParameterByClass($q_type, "q_id", $q_id);
758  $ilLocator->addItem(
759  $q_title,
760  $this->ctrl->getLinkTargetByClass($q_type, "editQuestion")
761  );
762  }
763  }
764  }
$_GET["client_id"]
static _getTitle($question_id)
Returns the question title of a question with a given id.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
+ Here is the call graph for this function:

◆ afterSave()

ilObjSurveyQuestionPoolGUI::afterSave ( ilObject  $a_new_object)

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

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

488  {
489  // always send a message
490  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
491 
492  ilUtil::redirect("ilias.php?ref_id=" . $a_new_object->getRefId() .
493  "&baseClass=ilObjSurveyQuestionPoolGUI");
494  }
getRefId()
get reference id public
static redirect($a_script)
+ Here is the call graph for this function:

◆ cancelDeleteExportFileObject()

ilObjSurveyQuestionPoolGUI::cancelDeleteExportFileObject ( )

cancel deletion of export files

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

References ilSession\clear().

582  {
583  ilSession::clear("ilExportFiles");
584  $this->ctrl->redirect($this, "export");
585  }
static clear($a_var)
Unset a value.
+ Here is the call graph for this function:

◆ cancelDeleteQuestionsObject()

ilObjSurveyQuestionPoolGUI::cancelDeleteQuestionsObject ( )

cancel delete questions

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

342  {
343  // delete questions after confirmation
344  $this->ctrl->redirect($this, "questions");
345  }

◆ confirmDeleteExportFileObject()

ilObjSurveyQuestionPoolGUI::confirmDeleteExportFileObject ( )

confirmation screen for export file deletion

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

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

559  {
560  if (!isset($_POST["file"])) {
561  ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
562  $this->ctrl->redirect($this, "export");
563  }
564 
565  ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
566  $table_gui = new ilSurveyQuestionPoolExportTableGUI($this, 'export', true);
567  $export_dir = $this->object->getExportDirectory();
568  $data = array();
569  foreach ($_POST['file'] as $exp_file) {
570  $file_arr = explode("__", $exp_file);
571  array_push($data, array('file' => $exp_file, 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => filesize($export_dir . "/" . $exp_file)));
572  }
573  $table_gui->setData($data);
574  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
575  }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ confirmDeleteQuestionsObject()

ilObjSurveyQuestionPoolGUI::confirmDeleteQuestionsObject ( )

delete questions

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

References $_POST.

329  {
330  // delete questions after confirmation
331  ilUtil::sendSuccess($this->lng->txt("qpl_questions_deleted"), true);
332  foreach ($_POST['q_id'] as $q_id) {
333  $this->object->removeQuestion($q_id);
334  }
335  $this->ctrl->redirect($this, "questions");
336  }
$_POST["username"]

◆ copyObject()

ilObjSurveyQuestionPoolGUI::copyObject ( )

Copies checked questions in the questionpool to a clipboard.

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

References $_POST, and ilUtil\sendInfo().

248  {
249  if (count($_POST["q_id"]) > 0) {
250  foreach ($_POST["q_id"] as $key => $value) {
251  $this->object->copyToClipboard($value);
252  }
253  ilUtil::sendInfo($this->lng->txt("spl_copy_insert_clipboard"), true);
254  } else {
255  ilUtil::sendInfo($this->lng->txt("spl_copy_select_none"), true);
256  }
257  $this->ctrl->redirect($this, "questions");
258  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ createExportFileObject()

ilObjSurveyQuestionPoolGUI::createExportFileObject (   $questions = null)

create export file

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

References ilObjectGUI\checkPermission().

Referenced by exportQuestionObject().

524  {
525  $this->checkPermission("write");
526 
527  $survey_exp = new ilSurveyQuestionpoolExport($this->object);
528  $survey_exp->buildExportFile($questions);
529  $this->ctrl->redirect($this, "export");
530  }
Export class for survey questionpools.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createQuestionObject()

& ilObjSurveyQuestionPoolGUI::createQuestionObject ( )

create new question

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

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

684  {
686 
687  $ilUser->writePref("svy_lastquestiontype", $_POST["sel_question_types"]);
688 
689  $q_gui = &SurveyQuestionGUI::_getQuestionGUI($_POST["sel_question_types"]);
690  $q_gui->object->setObjId($this->object->getId());
691  $q_gui->object->createNewQuestion();
692 
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");
696  }
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ deleteExportFileObject()

ilObjSurveyQuestionPoolGUI::deleteExportFileObject ( )

delete export files

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

References $_POST, and ilUtil\delDir().

591  {
592  $export_dir = $this->object->getExportDirectory();
593  foreach ($_POST['file'] as $file) {
594  $file = basename($file);
595 
596  $exp_file = $export_dir . "/" . $file;
597  $exp_dir = $export_dir . "/" . substr($file, 0, strlen($file) - 4);
598  if (@is_file($exp_file)) {
599  unlink($exp_file);
600  }
601  if (@is_dir($exp_dir)) {
602  ilUtil::delDir($exp_dir);
603  }
604  }
605  $this->ctrl->redirect($this, "export");
606  }
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
$_POST["username"]
+ Here is the call graph for this function:

◆ deleteQuestionsObject()

ilObjSurveyQuestionPoolGUI::deleteQuestionsObject ( )

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

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

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

293  {
294  $this->checkPermission('write');
295 
296  // create an array of all checked checkboxes
297  $checked_questions = $_POST['q_id'];
298  if (count($checked_questions) == 0) {
299  ilUtil::sendInfo($this->lng->txt("qpl_delete_select_none"));
300  $this->questionsObject();
301  return;
302  }
303 
304  $cgui = new ilConfirmationGUI();
305  $cgui->setHeaderText($this->lng->txt("qpl_confirm_delete_questions"));
306 
307  $cgui->setFormAction($this->ctrl->getFormAction($this));
308  $cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteQuestions");
309  $cgui->setConfirm($this->lng->txt("confirm"), "confirmDeleteQuestions");
310 
311  $infos = $this->object->getQuestionInfos($checked_questions);
312  foreach ($infos as $data) {
313  $txt = $data["title"] . " (" .
314  SurveyQuestion::_getQuestionTypeName($data["type_tag"]) . ")";
315  if ($data["description"]) {
316  $txt .= "<div class=\"small\">" . $data["description"] . "</div>";
317  }
318 
319  $cgui->addItem("q_id[]", $data["id"], $txt);
320  }
321 
322  $this->tpl->setContent($cgui->getHTML());
323  }
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
questionsObject($arrFilter=null)
list questions of question pool
$txt
Definition: error.php:13
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ downloadExportFileObject()

ilObjSurveyQuestionPoolGUI::downloadExportFileObject ( )

download export file

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

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

536  {
537  if (!isset($_POST["file"])) {
538  ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
539  $this->ctrl->redirect($this, "export");
540  }
541 
542  if (count($_POST["file"]) > 1) {
543  ilUtil::sendInfo($this->lng->txt("select_max_one_item"), true);
544  $this->ctrl->redirect($this, "export");
545  }
546 
547 
548  $export_dir = $this->object->getExportDirectory();
549 
550  $file = basename($_POST["file"][0]);
551 
552  ilUtil::deliverFile($export_dir . "/" . $file, $file);
553  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
+ Here is the call graph for this function:

◆ executeCommand()

ilObjSurveyQuestionPoolGUI::executeCommand ( )

execute command

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

References $_GET, $_POST, $nav_history, $ret, SurveyQuestionGUI\_getQuestionGUI(), ilObjectGUI\checkPermission(), ilObjectGUI\checkPermissionBool(), ilObjectGUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), ilUtil\getStyleSheetLocation(), infoScreenForward(), and ilObjectGUI\prepareOutput().

73  {
74  $ilNavigationHistory = $this->nav_history;
75 
76  if (!$this->checkPermissionBool("visible") &&
77  !$this->checkPermissionBool("read")) {
78  $this->checkPermission("read");
79  }
80 
81  // add entry to navigation history
82  if (!$this->getCreationMode() &&
83  $this->checkPermissionBool("read")) {
84  $ilNavigationHistory->addItem(
85  $this->ref_id,
86  "ilias.php?baseClass=ilObjSurveyQuestionPoolGUI&cmd=questions&ref_id=" . $this->ref_id,
87  "spl"
88  );
89  }
90 
91  $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "survey.css", "Modules/Survey"), "screen");
92  $this->prepareOutput();
93 
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"];
101  }
102 
103  $this->log->debug("- cmd=" . $cmd . " next_class=" . $next_class);
104  switch ($next_class) {
105  case 'ilobjectmetadatagui':
106  $this->checkPermission('write');
107  $md_gui = new ilObjectMetaDataGUI($this->object);
108  $this->ctrl->forwardCommand($md_gui);
109  break;
110 
111  case 'ilpermissiongui':
112  $perm_gui = new ilPermissionGUI($this);
113  $ret = &$this->ctrl->forwardCommand($perm_gui);
114  break;
115 
116  case "ilsurveyphrasesgui":
117  $phrases_gui = new ilSurveyPhrasesGUI($this);
118  $ret = &$this->ctrl->forwardCommand($phrases_gui);
119  break;
120 
121  case 'ilobjectcopygui':
122  $cp = new ilObjectCopyGUI($this);
123  $cp->setType('spl');
124  $this->ctrl->forwardCommand($cp);
125  break;
126 
127  case 'ilinfoscreengui':
128  $this->infoScreenForward();
129  break;
130 
131  case "ilcommonactiondispatchergui":
133  $this->ctrl->forwardCommand($gui);
134  break;
135 
136  case "":
137  $cmd .= "Object";
138  $ret = &$this->$cmd();
139  break;
140 
141  default:
142  $q_gui = SurveyQuestionGUI::_getQuestionGUI($q_type, $_GET["q_id"]);
143  $this->log->debug("- This is the switch/case default, going to question id =" . $_GET["q_id"]);
144  // $q_gui->object->setObjId($this->object->getId());
145  $q_gui->setQuestionTabs();
146  $ret = &$this->ctrl->forwardCommand($q_gui);
147 
148  // not on create
149  if ($q_gui->object->isComplete()) {
150  $this->tpl->setTitle($this->lng->txt("question") . ": " . $q_gui->object->getTitle());
151  }
152  break;
153  }
154  if (strtolower($_GET["baseClass"]) != "iladministrationgui" &&
155  $this->getCreationMode() != true) {
156  $this->tpl->printToStdout();
157  }
158  }
Class ilObjectMetaDataGUI.
GUI class for the workflow of copying objects.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
Survey phrases GUI class.
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
prepareOutput($a_show_subobjects=true)
prepare output
$ret
Definition: parser.php:6
getCreationMode()
get creation mode
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
$_POST["username"]
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:

◆ exportObject()

ilObjSurveyQuestionPoolGUI::exportObject ( )

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

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

500  {
501  $ilToolbar = $this->toolbar;
502 
503  $ilToolbar->addButton(
504  $this->lng->txt('create_export_file'),
505  $this->ctrl->getLinkTarget($this, 'createExportFile')
506  );
507 
508  $table_gui = new ilSurveyQuestionPoolExportTableGUI($this, 'export');
509  $export_dir = $this->object->getExportDirectory();
510  $export_files = $this->object->getExportFiles($export_dir);
511  $data = array();
512  foreach ($export_files as $exp_file) {
513  $file_arr = explode("__", $exp_file);
514  array_push($data, array('file' => $exp_file, 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => filesize($export_dir . "/" . $exp_file)));
515  }
516  $table_gui->setData($data);
517  $this->tpl->setContent($table_gui->getHTML());
518  }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
+ Here is the call graph for this function:

◆ exportQuestionObject()

ilObjSurveyQuestionPoolGUI::exportQuestionObject ( )

export a question

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

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

280  {
281  if (is_array($_POST['q_id']) && count($_POST['q_id']) > 0) {
282  $this->createExportFileObject($_POST['q_id']);
283  } else {
284  ilUtil::sendInfo($this->lng->txt("qpl_export_select_none"));
285  $this->questionsObject();
286  }
287  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
questionsObject($arrFilter=null)
list questions of question pool
createExportFileObject($questions=null)
create export file
$_POST["username"]
+ Here is the call graph for this function:

◆ filterQuestionBrowserObject()

ilObjSurveyQuestionPoolGUI::filterQuestionBrowserObject ( )

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

418  {
419  $table_gui = new ilSurveyQuestionsTableGUI($this, 'questions');
420  $table_gui->writeFilterToSession();
421  $this->ctrl->redirect($this, 'questions');
422  }

◆ getTabs()

ilObjSurveyQuestionPoolGUI::getTabs ( )

adds tabs to tab gui object

Parameters
object$tabs_guiilTabsGUI object

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

References $_GET, $help, and ilObjectGUI\checkPermissionBool().

772  {
773  $ilHelp = $this->help;
774 
775  $ilHelp->setScreenIdComponent("spl");
776 
777  $next_class = $this->ctrl->getNextClass($this);
778  switch ($next_class) {
779  case "":
780  case "ilpermissiongui":
781  case "ilobjectmetadatagui":
782  case "ilsurveyphrasesgui":
783  break;
784  default:
785  return;
786  break;
787  }
788 
789  // questions
790  $force_active = (($this->ctrl->getCmdClass() == "" &&
791  $this->ctrl->getCmd() != "properties" && $this->ctrl->getCmd() != "infoScreen") ||
792  $this->ctrl->getCmd() == "")
793  ? true
794  : false;
795  if (!$force_active) {
796  if (is_array($_GET["sort"])) {
797  $force_active = true;
798  }
799  }
800 
801  if ($this->checkPermissionBool("read")) {
802  $this->tabs_gui->addTarget(
803  "survey_questions",
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"
816  ),
817  array("ilobjsurveyquestionpoolgui", "ilsurveyphrasesgui"),
818  "",
819  $force_active
820  );
821 
822  $this->tabs_gui->addTarget(
823  "info_short",
824  $this->ctrl->getLinkTarget($this, "infoScreen"),
825  array("infoScreen", "showSummary")
826  );
827  }
828 
829  if ($this->checkPermissionBool('write')) {
830  // properties
831  $this->tabs_gui->addTarget(
832  "settings",
833  $this->ctrl->getLinkTarget($this, 'properties'),
834  array("properties", "saveProperties"),
835  "",
836  ""
837  );
838 
839  // manage phrases
840  $this->tabs_gui->addTarget(
841  "manage_phrases",
842  $this->ctrl->getLinkTargetByClass("ilsurveyphrasesgui", "phrases"),
843  array("phrases", "deletePhrase", "confirmDeletePhrase", "cancelDeletePhrase", "editPhrase", "newPhrase", "saveEditPhrase", "phraseEditor"),
844  "ilsurveyphrasesgui",
845  ""
846  );
847 
848  // meta data
849  $mdgui = new ilObjectMetaDataGUI($this->object);
850  $mdtab = $mdgui->getTab();
851  if ($mdtab) {
852  $this->tabs_gui->addTarget(
853  "meta_data",
854  $mdtab,
855  "",
856  "ilmdeditorgui"
857  );
858  }
859 
860  // export
861  $this->tabs_gui->addTarget(
862  "export",
863  $this->ctrl->getLinkTarget($this, 'export'),
864  array("export", "createExportFile", "confirmDeleteExportFile",
865  "downloadExportFile", "cancelDeleteExportFile", "deleteExportFile"),
866  "",
867  ""
868  );
869  }
870 
871  if ($this->checkPermissionBool("edit_permission")) {
872  $this->tabs_gui->addTarget(
873  "perm_settings",
874  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
875  array("perm","info","owner"),
876  'ilpermissiongui'
877  );
878  }
879  }
Class ilObjectMetaDataGUI.
$_GET["client_id"]
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
+ Here is the call graph for this function:

◆ importFileObject()

ilObjSurveyQuestionPoolGUI::importFileObject (   $parent_id = null,
  $a_catch_errors = true 
)

form for new survey object import

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

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

630  {
631  $tpl = $this->tpl;
633 
634  if (!$parent_id) {
635  $parent_id = $_GET["ref_id"];
636  }
637  $new_type = $_REQUEST["new_type"];
638 
639  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
640  if (!$this->checkPermissionBool("create", "", $new_type)) {
641  $ilErr->raiseError($this->lng->txt("no_create_permission"));
642  }
643 
644  $this->lng->loadLanguageModule($new_type);
645  $this->ctrl->setParameter($this, "new_type", $new_type);
646 
647  $form = $this->initImportForm($new_type);
648  if ($form->checkInput()) {
649  $newObj = new ilObjSurveyQuestionPool();
650  $newObj->setType($new_type);
651  $newObj->setTitle("dummy");
652  $newObj->create(true);
653  $this->putObjectInTree($newObj);
654 
655  $newObj->createImportDirectory();
656 
657  // copy uploaded file to import directory
658  $upload = $_FILES["importfile"];
659  $file = pathinfo($upload["name"]);
660  $full_path = $newObj->getImportDirectory() . "/" . $upload["name"];
662  $upload["tmp_name"],
663  $upload["name"],
664  $full_path
665  );
666 
667  // import qti data
668  $qtiresult = $newObj->importObject($full_path);
669 
670  ilUtil::sendSuccess($this->lng->txt("object_imported"), true);
671  ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() .
672  "&baseClass=ilObjSurveyQuestionPoolGUI");
673  }
674 
675  // display form to correct errors
676  $form->setValuesByPost();
677  $tpl->setContent($form->getHtml());
678  }
Class ilObjSurveyQuestionPool.
$_GET["client_id"]
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
static redirect($a_script)
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
+ Here is the call graph for this function:

◆ importQuestionsObject()

ilObjSurveyQuestionPoolGUI::importQuestionsObject ( )

display the import form to import questions into the questionpool

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

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

364  {
365  $tpl = $this->tpl;
366 
367  $form = new ilPropertyFormGUI();
368  $form->setFormAction($this->ctrl->getFormAction($this, "uploadQuestions"));
369  $form->setTitle($this->lng->txt("import_question"));
370 
371  $fi = new ilFileInputGUI($this->lng->txt("select_file"), "qtidoc");
372  $fi->setSuffixes(array("xml", "zip"));
373  $fi->setRequired(true);
374  $form->addItem($fi);
375 
376  $form->addCommandButton("uploadQuestions", $this->lng->txt("import"));
377  $form->addCommandButton("questions", $this->lng->txt("cancel"));
378 
379  $tpl->setContent($form->getHTML());
380  }
This class represents a property form user interface.
This class represents a file property in a property form.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjSurveyQuestionPoolGUI::infoScreenForward ( )

show information screen

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

References ilObjectGUI\checkPermission(), and ilObjectGUI\checkPermissionBool().

Referenced by executeCommand(), and infoScreenObject().

725  {
726  if (!$this->checkPermissionBool("read")) {
727  $this->checkPermission("visible");
728  }
729 
730  $info = new ilInfoScreenGUI($this);
731  $info->enablePrivateNotes();
732 
733  // standard meta data
734  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
735 
736  $this->ctrl->forwardCommand($info);
737  }
Class ilInfoScreenGUI.
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreenObject()

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 714 of file class.ilObjSurveyQuestionPoolGUI.php.

References infoScreenForward().

715  {
716  $this->ctrl->setCmd("showSummary");
717  $this->ctrl->setCmdClass("ilinfoscreengui");
718  $this->infoScreenForward();
719  }
+ Here is the call graph for this function:

◆ initCreationForms()

ilObjSurveyQuestionPoolGUI::initCreationForms (   $a_new_type)
protected

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

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

617  {
618  $form = $this->initImportForm($a_new_type);
619 
620  $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
621  self::CFORM_IMPORT => $form);
622 
623  return $forms;
624  }
initCreateForm($a_new_type)
Init object creation form.
+ Here is the call graph for this function:

◆ initEditForm()

ilObjSurveyQuestionPoolGUI::initEditForm ( )
protected

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

References ilObjectGUI\$object_service, $section, ilFormPropertyGUI\setInfo(), ilTextAreaInputGUI\setValue(), and ilObject\TITLE_LENGTH.

Referenced by propertiesObject(), and savePropertiesObject().

161  {
162  $obj_service = $this->object_service;
163 
164  $form = new ilPropertyFormGUI();
165  $form->setFormAction($this->ctrl->getFormAction($this, 'properties'));
166  $form->setTitle($this->lng->txt("properties"));
167  $form->setMultipart(false);
168  $form->setId("properties");
169 
170  // title
171  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
172  $title->setSubmitFormOnEnter(true);
173  $title->setValue($this->object->getTitle());
174  $title->setSize(min(40, ilObject::TITLE_LENGTH));
175  $title->setMaxLength(ilObject::TITLE_LENGTH);
176  $title->setRequired(true);
177  $form->addItem($title);
178 
179  // desc
180  $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
181  $desc->setValue($this->object->getLongDescription());
182  $desc->setRows(2);
183  $desc->setCols(40);
184  $form->addItem($desc);
185 
186  // online
187  $online = new ilCheckboxInputGUI($this->lng->txt("spl_online_property"), "online");
188  $online->setInfo($this->lng->txt("spl_online_property_description"));
189  $online->setChecked($this->object->getOnline());
190  $form->addItem($online);
191 
193  $section->setTitle($this->lng->txt('obj_presentation'));
194  $form->addItem($section);
195 
196  // tile image
197  $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
198 
199 
200  $form->addCommandButton("saveProperties", $this->lng->txt("save"));
201 
202  return $form;
203  }
This class represents a property form user interface.
const TITLE_LENGTH
max length of object title
This class represents a section header in a property form.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
$section
Definition: Utf8Test.php:83
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initImportForm()

ilObjSurveyQuestionPoolGUI::initImportForm (   $a_new_type)
protected

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

Referenced by importFileObject(), and initCreationForms().

609  {
610  $form = parent::initImportForm($a_new_type);
611  $form->getItemByPostVar('importfile')->setSuffixes(array("zip", "xml"));
612 
613  return $form;
614  }
+ Here is the caller graph for this function:

◆ moveObject()

ilObjSurveyQuestionPoolGUI::moveObject ( )

mark one or more question objects for moving

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

References $_POST, and ilUtil\sendInfo().

264  {
265  if (count($_POST["q_id"]) > 0) {
266  foreach ($_POST["q_id"] as $key => $value) {
267  $this->object->moveToClipboard($value);
268  }
269  ilUtil::sendInfo($this->lng->txt("spl_move_insert_clipboard"), true);
270  } else {
271  ilUtil::sendInfo($this->lng->txt("spl_move_select_none"), true);
272  }
273  $this->ctrl->redirect($this, "questions");
274  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ pasteObject()

ilObjSurveyQuestionPoolGUI::pasteObject ( )

paste questios from the clipboard into the question pool

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

References $_SESSION, and ilUtil\sendInfo().

351  {
352  if (array_key_exists("spl_clipboard", $_SESSION)) {
353  $this->object->pasteFromClipboard();
354  } else {
355  ilUtil::sendInfo($this->lng->txt("spl_paste_no_objects"), true);
356  }
357  $this->ctrl->redirect($this, "questions");
358  }
$_SESSION["AccountId"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ previewObject()

& ilObjSurveyQuestionPoolGUI::previewObject ( )

create preview of object

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

References $_GET, and SurveyQuestionGUI\_getQuestionGUI().

702  {
703  $q_gui = &SurveyQuestionGUI::_getQuestionGUI("", $_GET["preview"]);
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");
707  }
$_GET["client_id"]
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
+ Here is the call graph for this function:

◆ propertiesObject()

ilObjSurveyQuestionPoolGUI::propertiesObject ( ilPropertyFormGUI  $a_form = null)

Questionpool properties.

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

References initEditForm().

Referenced by savePropertiesObject().

209  {
210  if (!$a_form) {
211  $a_form = $this->initEditForm();
212  }
213 
214  $this->tpl->setVariable("ADM_CONTENT", $a_form->getHTML());
215  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ questionsObject()

ilObjSurveyQuestionPoolGUI::questionsObject (   $arrFilter = null)

list questions of question pool

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

References $_GET, $_SESSION, ilObjectGUI\$data, $ilUser, ilObjectGUI\$toolbar, ilObjectGUI\$user, ilObjectGUI\checkPermissionBool(), and ilSubmitButton\getInstance().

Referenced by deleteQuestionsObject(), and exportQuestionObject().

435  {
437  $ilToolbar = $this->toolbar;
438 
439  $this->object->purgeQuestions();
440 
441  $_SESSION['q_id_table_nav'] = $_GET['q_id_table_nav'];
442 
443  if ($this->checkPermissionBool('write')) {
444  $qtypes = new ilSelectInputGUI("", "sel_question_types");
445  $qtypes->setValue($ilUser->getPref("svy_lastquestiontype"));
446  $ilToolbar->addInputItem($qtypes);
447 
448  $options = array();
449  foreach (ilObjSurveyQuestionPool::_getQuestionTypes() as $translation => $data) {
450  $options[$data["type_tag"]] = $translation;
451  }
452  $qtypes->setOptions($options);
453 
454  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
455 
456  $button = ilSubmitButton::getInstance();
457  $button->setCaption("svy_create_question");
458  $button->setCommand("createQuestion");
459  $ilToolbar->addButtonInstance($button);
460 
461  $ilToolbar->addSeparator();
462 
463  $button = ilSubmitButton::getInstance();
464  $button->setCaption("import");
465  $button->setCommand("importQuestions");
466  $ilToolbar->addButtonInstance($button);
467  }
468 
469  $table_gui = new ilSurveyQuestionsTableGUI($this, 'questions', (($this->checkPermissionBool('write') ? true : false)));
470  $table_gui->setEditable($this->checkPermissionBool('write'));
471  $arrFilter = array();
472  foreach ($table_gui->getFilterItems() as $item) {
473  if ($item->getValue() !== false) {
474  $arrFilter[$item->getPostVar()] = $item->getValue();
475  }
476  }
477  $table_gui->setData($this->object->getQuestionsData($arrFilter));
478  $this->tpl->setContent($table_gui->getHTML());
479  }
$_SESSION["AccountId"]
$_GET["client_id"]
$ilUser
Definition: imgupload.php:18
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetfilterQuestionBrowserObject()

ilObjSurveyQuestionPoolGUI::resetfilterQuestionBrowserObject ( )

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

425  {
426  $table_gui = new ilSurveyQuestionsTableGUI($this, 'questions');
427  $table_gui->resetFilter();
428  $this->ctrl->redirect($this, 'questions');
429  }

◆ saveObligatoryObject()

ilObjSurveyQuestionPoolGUI::saveObligatoryObject ( )

Save obligatory states.

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

References $_POST.

885  {
886  $obligatory = array();
887  foreach ($_POST as $key => $value) {
888  if (preg_match("/obligatory_(\d+)/", $key, $matches)) {
889  $obligatory[] = $matches[1];
890  }
891  }
892  $this->object->setObligatoryStates($obligatory);
893 
894  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
895  $this->ctrl->redirect($this, "questions");
896  }
$_POST["username"]

◆ savePropertiesObject()

ilObjSurveyQuestionPoolGUI::savePropertiesObject ( )

Save questionpool properties.

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

References ilObjectGUI\$object_service, initEditForm(), and propertiesObject().

221  {
222  $obj_service = $this->object_service;
223  $form = $this->initEditForm();
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"));
228 
229  $this->object->saveToDb();
230 
231  // tile image
232  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
233 
234 
235  ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
236  $this->ctrl->redirect($this, "properties");
237  }
238 
239  $form->setValuesByPost();
240  $this->propertiesObject($form);
241  }
propertiesObject(ilPropertyFormGUI $a_form=null)
Questionpool properties.
+ Here is the call graph for this function:

◆ updateObject()

ilObjSurveyQuestionPoolGUI::updateObject ( )

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

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

◆ uploadQuestionsObject()

ilObjSurveyQuestionPoolGUI::uploadQuestionsObject ( )

imports question(s) into the questionpool

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

References $error, $source, and ilUtil\moveUploadedFile().

386  {
387  // check if file was uploaded
388  $source = $_FILES["qtidoc"]["tmp_name"];
389  $error = 0;
390  if (($source == 'none') || (!$source) || $_FILES["qtidoc"]["error"] > UPLOAD_ERR_OK) {
391  $error = 1;
392  }
393  // check correct file type
394  if (!$error && strpos("xml", $_FILES["qtidoc"]["type"]) !== false) {
395  $error = 1;
396  }
397  if (!$error) {
398  // import file into questionpool
399  // create import directory
400  $this->object->createImportDirectory();
401 
402  // copy uploaded file to import directory
403  $full_path = $this->object->getImportDirectory() . "/" . $_FILES["qtidoc"]["name"];
404 
406  $_FILES["qtidoc"]["tmp_name"],
407  $_FILES["qtidoc"]["name"],
408  $full_path
409  );
410  $source = $full_path;
411  $this->object->importObject($source, true);
412  unlink($source);
413  }
414  $this->ctrl->redirect($this, "questions");
415  }
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
$source
Definition: metadata.php:76
+ Here is the call graph for this function:

Field Documentation

◆ $defaultscript

ilObjSurveyQuestionPoolGUI::$defaultscript

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

◆ $error

ilObjSurveyQuestionPoolGUI::$error
protected

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

Referenced by importFileObject(), and uploadQuestionsObject().

◆ $help

ilObjSurveyQuestionPoolGUI::$help
protected

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

Referenced by getTabs().

◆ $log

ilObjSurveyQuestionPoolGUI::$log
protected

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

◆ $nav_history

ilObjSurveyQuestionPoolGUI::$nav_history
protected

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

Referenced by executeCommand().


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