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

Survey per page view. More...

+ Collaboration diagram for ilSurveyPageGUI:

Public Member Functions

 __construct (ilObjSurvey $a_survey, ilSurveyEditorGUI $a_survey_editor_gui)
 Constructor. More...
 
 executeCommand ()
 Routing. More...
 
 determineCurrentPage ()
 determine current page More...
 
 insertNewQuestion ($a_new_id)
 Add new question to survey. More...
 
 insertQuestionBlock ($a_block_id)
 Copy and insert questions from block. More...
 
 getPageNodes (array $a_questions, $a_has_previous_page=false, $a_has_next_page=false, $a_readonly=false)
 Get Form HTML. More...
 
 renderPageNode (ilTemplate $a_tpl, $a_type, $a_id, $a_content=null, array $a_menu=null, $a_spacer=false, $a_subtitle=false, $a_status=false, $a_heading=false)
 Render single of dnd page view. More...
 
 getAutoBlockTitle ()
 Get name for newly created blocks. More...
 
 addPoolQuestion ($pos, $node)
 

Protected Member Functions

 appendNewQuestionToSurvey ($a_new_id, $a_duplicate=true, $a_force_duplicate=false)
 Add new question to survey (database part) More...
 
 addQuestion ($a_type, $a_use_pool, $a_pos, $a_special_position)
 Call add question to survey form. More...
 
 cutQuestion ($a_id)
 Add question to be cut to clipboard. More...
 
 copyQuestion ($a_id)
 Add question to be copied to clipboard. More...
 
 multiCut ($a_id)
 Add questions to be cut to clipboard. More...
 
 multiCopy ($a_id)
 Add questions to be copied to clipboard. More...
 
 clearClipboard ()
 Empty clipboard. More...
 
 paste ($a_id)
 Paste from clipboard. More...
 
 dnd ()
 Move questions in page. More...
 
 deleteBlock ()
 Confirm removing question block. More...
 
 deleteQuestion ($a_id)
 Confirm removing question(s) from survey. More...
 
 confirmRemoveQuestions ()
 Remove question(s) from survey. More...
 
 editBlock ($a_id)
 Edit question block. More...
 
 addHeading ($a_id)
 Add heading to question. More...
 
 editHeading ($a_id)
 Edit question heading. More...
 
 deleteHeading ($a_id)
 Delete question heading. More...
 
 callEditor ($a_cmd, $a_param, $a_value)
 
 splitPage ($a_id)
 Split current page in 2 pages. More...
 
 moveNext ($a_id)
 Move question to next page. More...
 
 movePrevious ($a_id)
 Move question to previous page. More...
 
 editQuestion ($a_id)
 Edit question. More...
 
 addQuestionToolbarForm ()
 Add question to survey form (used in toolbar) More...
 
 addQuestionToolbar ()
 Add question to survey action (used in toolbar) More...
 
 movePageForm ()
 Move current page. More...
 
 movePage ()
 Move current page to new position. More...
 
 renderToolbar ($a_pages)
 Render toolbar form. More...
 
 renderPage ()
 render questions per page More...
 

Protected Attributes

 $ctrl
 
 $rbacsystem
 
 $db
 
 $tabs
 
 $tpl
 
 $toolbar
 
 $user
 
 $ref_id
 
 $lng
 
 $object
 
 $editor_gui
 
 $current_page
 
 $has_previous_page
 
 $has_next_page
 
 $has_datasets
 
 $use_pool
 
 $log
 

Detailed Description

Survey per page view.

Author
Jörg Lützenkirchen <luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilObjSurveyGUI.php 26720 2010-11-25 17:06:26Z jluetzen

ilSurveyPageGUI:

Definition at line 14 of file class.ilSurveyPageGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyPageGUI::__construct ( ilObjSurvey  $a_survey,
ilSurveyEditorGUI  $a_survey_editor_gui 
)

Constructor.

Parameters
ilObjSurvey$a_survey
ilSurveyEditorGUI$a_survey_editor_gui

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

References $DIC, ilLoggerFactory\getLogger(), ilObject\getRefId(), and user().

73  {
74  global $DIC;
75 
76  $this->lng = $DIC->language();
77  $this->ctrl = $DIC->ctrl();
78  $this->rbacsystem = $DIC->rbac()->system();
79  $this->db = $DIC->database();
80  $this->tabs = $DIC->tabs();
81  $this->tpl = $DIC["tpl"];
82  $this->toolbar = $DIC->toolbar();
83  $this->user = $DIC->user();
84  $this->editor_gui = $a_survey_editor_gui;
85  $this->ref_id = $a_survey->getRefId();
86  $this->object = $a_survey;
87  $this->log = ilLoggerFactory::getLogger("svy");
88  }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
getRefId()
get reference id public
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Member Function Documentation

◆ addHeading()

ilSurveyPageGUI::addHeading (   $a_id)
protected

Add heading to question.

Parameters
int$a_id

Definition at line 823 of file class.ilSurveyPageGUI.php.

References callEditor().

824  {
825  $this->callEditor("addHeadingObject", "q_id", $a_id);
826  return true;
827  }
callEditor($a_cmd, $a_param, $a_value)
+ Here is the call graph for this function:

◆ addPoolQuestion()

ilSurveyPageGUI::addPoolQuestion (   $pos,
  $node 
)

Definition at line 1739 of file class.ilSurveyPageGUI.php.

References $ctrl, $ilUser, and $user.

1740  {
1741  $ilCtrl = $this->ctrl;
1742  $ilUser = $this->user;
1743 
1744  if ($node == "page_end") {
1745  $pos = $this->object->getSurveyPages();
1746  $pos = array_pop($pos[$this->current_page - 1]);
1747  $pos = $pos["question_id"] . "a";
1748  } else {
1749  $pos = $pos . "b";
1750  }
1751 
1752  $ilCtrl->setParameter($this->editor_gui, "pgov", $this->current_page);
1753  $ilCtrl->setParameter($this->editor_gui, "pgov_pos", $pos);
1754 
1755  $cmd = ($ilUser->getPref('svy_insert_type') == 1 || strlen($ilUser->getPref('svy_insert_type')) == 0) ? 'browseForQuestions' : 'browseForQuestionblocks';
1756  $ilCtrl->redirect($this->editor_gui, $cmd);
1757  }
$ilUser
Definition: imgupload.php:18

◆ addQuestion()

ilSurveyPageGUI::addQuestion (   $a_type,
  $a_use_pool,
  $a_pos,
  $a_special_position 
)
protected

Call add question to survey form.

Parameters
int$a_typequestion type
bool$a_use_pooladd question to pool
int$a_postarget position
string$a_special_positionspecial positions (toolbar | page_end)

Definition at line 383 of file class.ilSurveyPageGUI.php.

References $_GET, $_POST, $ctrl, $tabs, SurveyQuestionGUI\_getQuestionGUI(), and ilObjSurveyQuestionPool\_getQuestiontypes().

Referenced by addQuestionToolbar(), and executeCommand().

384  {
385  $ilCtrl = $this->ctrl;
386  $ilTabs = $this->tabs;
387 
388  // get translated type
390  foreach ($questiontypes as $item) {
391  if ($item["questiontype_id"] == $a_type) {
392  $type_trans = $item["type_tag"];
393  }
394  }
395 
396  $id = $a_pos;
397 
398  // new page behind current (from toolbar)
399  if ($a_special_position == "toolbar") {
400  $id = $this->object->getSurveyPages();
401  if ($a_pos && $a_pos != "fst") {
402  $id = $id[$a_pos - 1];
403  $id = array_pop($id);
404  $id = $id["question_id"] . "c";
405  } else {
406  $id = "0c";
407  }
408  }
409  // append current page
410  elseif ($a_special_position == "page_end") {
411  $id = $this->object->getSurveyPages();
412  $id = $id[$this->current_page - 1];
413  $id = array_pop($id);
414  $id = $id["question_id"] . "a";
415  } else {
416  $id .= "b";
417  }
418 
419  if ($a_use_pool) {
420  $_GET["sel_question_types"] = $type_trans;
421  $_REQUEST["pgov_pos"] = $id;
422  $ilCtrl->setParameter($this->editor_gui, "pgov_pos", $id);
423  if (!$_POST["usage"]) {
424  $ilTabs->clearSubTabs(); // #17193
425  $this->editor_gui->createQuestionObject();
426  } else {
427  $this->editor_gui->executeCreateQuestionObject();
428  }
429  return true;
430  } else {
431  // create question and redirect to question form
432 
433  $q_gui = SurveyQuestionGUI::_getQuestionGUI($type_trans);
434  $q_gui->object->setObjId($this->object->getId());
435  $q_gui->object->createNewQuestion();
436  $q_gui_class = get_class($q_gui);
437 
438  // #12531
439  $ilCtrl->setParameterByClass($q_gui_class, "pgov", $this->current_page);
440  $ilCtrl->setParameterByClass($q_gui_class, "pgov_pos", $id);
441  $ilCtrl->setParameterByClass($q_gui_class, "ref_id", $this->ref_id);
442  $ilCtrl->setParameterByClass($q_gui_class, "new_for_survey", $this->ref_id);
443  $ilCtrl->setParameterByClass($q_gui_class, "q_id", $q_gui->object->getId());
444  $ilCtrl->setParameterByClass($q_gui_class, "sel_question_types", $q_gui->getQuestionType());
445  $ilCtrl->redirectByClass($q_gui_class, "editQuestion");
446  }
447  }
$_GET["client_id"]
static _getQuestionGUI($questiontype, $question_id=-1)
Creates a question gui representation.
static _getQuestiontypes()
Creates a list of all available question types.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addQuestionToolbar()

ilSurveyPageGUI::addQuestionToolbar ( )
protected

Add question to survey action (used in toolbar)

Definition at line 1095 of file class.ilSurveyPageGUI.php.

References $_POST, $ctrl, $lng, addQuestion(), addQuestionToolbarForm(), renderPage(), and ilUtil\sendFailure().

1096  {
1097  $ilCtrl = $this->ctrl;
1098  $lng = $this->lng;
1099 
1100  $pool_active = $this->object->isPoolActive();
1101 
1102  if (!$_POST["usage"] && $pool_active) {
1103  ilUtil::sendFailure($lng->txt("select_one"), true);
1104  return $this->addQuestionToolbarForm();
1105  }
1106 
1107  // make sure that it is set for current and next requests
1108  $ilCtrl->setParameter($this->editor_gui, "pgov", $this->current_page);
1109 
1110  if (!$this->addQuestion($_POST["qtype"], $pool_active, $_POST["pgov"], "toolbar")) {
1111  $this->renderPage();
1112  }
1113  }
addQuestion($a_type, $a_use_pool, $a_pos, $a_special_position)
Call add question to survey form.
addQuestionToolbarForm()
Add question to survey form (used in toolbar)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
renderPage()
render questions per page
$_POST["username"]
+ Here is the call graph for this function:

◆ addQuestionToolbarForm()

ilSurveyPageGUI::addQuestionToolbarForm ( )
protected

Add question to survey form (used in toolbar)

Definition at line 1039 of file class.ilSurveyPageGUI.php.

References $ctrl, $lng, $si, $tpl, and ilObjSurveyQuestionPool\_getQuestiontypes().

Referenced by addQuestionToolbar().

1040  {
1041  $lng = $this->lng;
1042  $ilCtrl = $this->ctrl;
1043  $tpl = $this->tpl;
1044 
1045  $form = new ilPropertyFormGUI();
1046  $form->setFormAction($ilCtrl->getFormAction($this, "addQuestionToolbar"));
1047  $form->setTitle($lng->txt("survey_add_new_question"));
1048 
1049  // question types
1050  $questiontypes = ilObjSurveyQuestionPool::_getQuestiontypes();
1051  $type_map = array();
1052  foreach ($questiontypes as $trans => $item) {
1053  $type_map[$item["questiontype_id"]] = $trans;
1054  }
1055  $si = new ilSelectInputGUI($lng->txt("question_type"), "qtype");
1056  $si->setOptions($type_map);
1057  $form->addItem($si);
1058 
1059  $pages = $this->object->getSurveyPages();
1060  if ($pages) {
1061  $pages_drop = array("fst" => $lng->txt("survey_at_beginning"));
1062  foreach ($pages as $idx => $questions) {
1063  $question = array_shift($questions);
1064  if ($question["questionblock_id"]) {
1065  $pages_drop[$idx + 1] = $lng->txt("survey_behind_page") . " " . $question["questionblock_title"];
1066  } else {
1067  $pages_drop[$idx + 1] = $lng->txt("survey_behind_page") . " " . strip_tags($question["title"]);
1068  }
1069  }
1070  $pos = new ilSelectInputGUI($lng->txt("position"), "pgov");
1071  $pos->setOptions($pages_drop);
1072  $form->addItem($pos);
1073 
1074  $pos->setValue($this->current_page);
1075  } else {
1076  // #9089: 1st page
1077  $pos = new ilHiddenInputGUI("pgov");
1078  $pos->setValue("fst");
1079  $form->addItem($pos);
1080  }
1081 
1082  if ($this->object->isPoolActive()) {
1083  $this->editor_gui->createQuestionObject($form);
1084  }
1085 
1086  $form->addCommandButton("addQuestionToolbar", $lng->txt("create"));
1087  $form->addCommandButton("renderPage", $lng->txt("cancel"));
1088 
1089  return $tpl->setContent($form->getHTML());
1090  }
This class represents a property form user interface.
This class represents a hidden form property in a property form.
static _getQuestiontypes()
Creates a list of all available question types.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendNewQuestionToSurvey()

ilSurveyPageGUI::appendNewQuestionToSurvey (   $a_new_id,
  $a_duplicate = true,
  $a_force_duplicate = false 
)
protected

Add new question to survey (database part)

Parameters
int$a_new_id
bool$a_duplicate
Todo:
: move out of GUI class, see also ilObjSurvey->insertQuestion

Definition at line 190 of file class.ilSurveyPageGUI.php.

References $db, $ilDB, and $result.

Referenced by insertNewQuestion(), insertQuestionBlock(), and paste().

191  {
192  $ilDB = $this->db;
193 
194  $this->log->debug("append question, id: " . $a_new_id . ", duplicate: " . $a_duplicate . ", force: " . $a_force_duplicate);
195 
196  // get maximum sequence index in test
197  $result = $ilDB->queryF(
198  "SELECT survey_question_id FROM svy_svy_qst WHERE survey_fi = %s",
199  array('integer'),
200  array($this->object->getSurveyId())
201  );
202  $sequence = $result->numRows();
203 
204  // create duplicate if pool question (or forced for question blocks copy)
205  if ($a_duplicate) {
206  // this does nothing if this is not a pool question and $a_force_duplicate is false
207  $survey_question_id = $this->object->duplicateQuestionForSurvey($a_new_id, $a_force_duplicate);
208  }
209  // used by copy & paste
210  else {
211  $survey_question_id = $a_new_id;
212  }
213 
214  // check if question is not already in the survey, see #22018
215  if ($this->object->isQuestionInSurvey($survey_question_id)) {
216  return $survey_question_id;
217  }
218 
219  // append to survey
220  $next_id = $ilDB->nextId('svy_svy_qst');
221  $affectedRows = $ilDB->manipulateF(
222  "INSERT INTO svy_svy_qst (survey_question_id, survey_fi," .
223  "question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
224  array('integer', 'integer', 'integer', 'integer', 'integer'),
225  array($next_id, $this->object->getSurveyId(), $survey_question_id, $sequence, time())
226  );
227 
228  $this->log->debug("appendNewQuestionToSurvey svy_svy_qst, id: " . $next_id . ", qfi: " . $survey_question_id . ", seq: " . $sequence);
229  return $survey_question_id;
230  }
$result
global $ilDB
+ Here is the caller graph for this function:

◆ callEditor()

ilSurveyPageGUI::callEditor (   $a_cmd,
  $a_param,
  $a_value 
)
protected

Definition at line 851 of file class.ilSurveyPageGUI.php.

References $tabs.

Referenced by addHeading(), deleteHeading(), editBlock(), and editHeading().

852  {
853  $ilTabs = $this->tabs;
854 
855  $ilTabs->clearSubTabs();
856  $_REQUEST[$a_param] = $a_value;
857 
858  call_user_func(array($this->editor_gui, $a_cmd));
859  }
+ Here is the caller graph for this function:

◆ clearClipboard()

ilSurveyPageGUI::clearClipboard ( )
protected

Empty clipboard.

Definition at line 528 of file class.ilSurveyPageGUI.php.

References $_SESSION, and $ref_id.

Referenced by paste().

529  {
530  $_SESSION["survey_page_view"][$this->ref_id]["clipboard"] = null;
531  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ confirmRemoveQuestions()

ilSurveyPageGUI::confirmRemoveQuestions ( )
protected

Remove question(s) from survey.

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

References $_POST, $ctrl, and $source.

750  {
751  $ilCtrl = $this->ctrl;
752 
753  // gather ids
754  $ids = array();
755  foreach ($_POST as $key => $value) {
756  if (preg_match("/id_(\d+)/", $key, $matches)) {
757  array_push($ids, $matches[1]);
758  }
759  }
760 
761 
762  $pages = $this->object->getSurveyPages();
763  $source = $pages[$this->current_page - 1];
764 
765  $block_id = $source;
766  $block_id = array_shift($block_id);
767  $block_id = $block_id["questionblock_id"];
768 
769  if (sizeof($ids) && sizeof($source) > sizeof($ids)) {
770  // block is obsolete
771  if (sizeof($source) - sizeof($ids) == 1) {
772  $this->object->unfoldQuestionblocks(array($block_id));
773  }
774  // block will remain, remove question(s) from block
775  else {
776  foreach ($ids as $qid) {
777  $this->object->removeQuestionFromBlock($qid, $block_id);
778  }
779  }
780 
781  $this->object->removeQuestions($ids, array());
782  }
783  // all items on page
784  else {
785  // remove complete block
786  if ($block_id) {
787  $this->object->removeQuestions(array(), array($block_id));
788  }
789  // remove single question
790  else {
791  $this->object->removeQuestions($ids, array());
792  }
793 
794  // render previous page
795  if ($this->current_page > 1) {
796  $this->current_page--;
797  }
798  }
799 
800  $this->object->saveCompletionStatus();
801 
802  // #10567
803  $ilCtrl->setParameter($this, "pgov", $this->current_page);
804  $ilCtrl->redirect($this, "renderPage");
805  }
$source
Definition: metadata.php:76
$_POST["username"]

◆ copyQuestion()

ilSurveyPageGUI::copyQuestion (   $a_id)
protected

Add question to be copied to clipboard.

Parameters
int$a_idquestion id

Definition at line 472 of file class.ilSurveyPageGUI.php.

References $_SESSION, $lng, and $ref_id.

473  {
474  $lng = $this->lng;
475 
476  ilUtil::sendSuccess($lng->txt("survey_questions_to_clipboard_copy"));
477  $this->suppress_clipboard_msg = true;
478 
479  $_SESSION["survey_page_view"][$this->ref_id]["clipboard"] = array(
480  "source" => $this->current_page,
481  "nodes" => array($a_id),
482  "mode" => "copy");
483  }
$_SESSION["AccountId"]

◆ cutQuestion()

ilSurveyPageGUI::cutQuestion (   $a_id)
protected

Add question to be cut to clipboard.

Parameters
int$a_idquestion id

Definition at line 454 of file class.ilSurveyPageGUI.php.

References $_SESSION, $lng, and $ref_id.

455  {
456  $lng = $this->lng;
457 
458  ilUtil::sendSuccess($lng->txt("survey_questions_to_clipboard_cut"));
459  $this->suppress_clipboard_msg = true;
460 
461  $_SESSION["survey_page_view"][$this->ref_id]["clipboard"] = array(
462  "source" => $this->current_page,
463  "nodes" => array($a_id),
464  "mode" => "cut");
465  }
$_SESSION["AccountId"]

◆ deleteBlock()

ilSurveyPageGUI::deleteBlock ( )
protected

Confirm removing question block.

Parameters
int$a_id

Definition at line 703 of file class.ilSurveyPageGUI.php.

References $ctrl, $lng, and ilUtil\sendQuestion().

704  {
705  $lng = $this->lng;
706  $ilCtrl = $this->ctrl;
707 
708  $ilCtrl->setParameter($this->editor_gui, "pgov", $this->current_page);
709  ilUtil::sendQuestion($lng->txt("remove_questions"));
710 
711  $page = $this->object->getSurveyPages();
712  $page = $page[$this->current_page - 1];
713 
714  // #10567
715  if ($_REQUEST["csum"] != md5(print_r($page, true))) {
716  $ilCtrl->redirect($this, "renderPage");
717  }
718 
719  $page = array_shift($page);
720  $block_id = $page["questionblock_id"];
721  if ($block_id) {
722  $this->editor_gui->removeQuestionsForm(array($block_id), array(), array());
723  } else {
724  $this->editor_gui->removeQuestionsForm(array(), array($page["question_id"]), array());
725  }
726  }
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
+ Here is the call graph for this function:

◆ deleteHeading()

ilSurveyPageGUI::deleteHeading (   $a_id)
protected

Delete question heading.

Parameters
int$a_id

Definition at line 845 of file class.ilSurveyPageGUI.php.

References callEditor().

846  {
847  $this->callEditor("removeHeadingObject", "q_id", $a_id);
848  return true;
849  }
callEditor($a_cmd, $a_param, $a_value)
+ Here is the call graph for this function:

◆ deleteQuestion()

ilSurveyPageGUI::deleteQuestion (   $a_id)
protected

Confirm removing question(s) from survey.

Parameters
int | array$a_id

Definition at line 733 of file class.ilSurveyPageGUI.php.

References $ctrl.

734  {
735  $ilCtrl = $this->ctrl;
736 
737  if (!is_array($a_id)) {
738  $a_id = array($a_id);
739  }
740 
741  $ilCtrl->setParameter($this->editor_gui, "pgov", $this->current_page);
742  $this->editor_gui->removeQuestionsForm(array(), $a_id, array());
743  return true;
744  }

◆ determineCurrentPage()

ilSurveyPageGUI::determineCurrentPage ( )

determine current page

Definition at line 168 of file class.ilSurveyPageGUI.php.

References $current_page.

Referenced by executeCommand().

169  {
170  $current_page = (int) $_REQUEST["jump"];
171  if (!$current_page) {
172  $current_page = (int) $_REQUEST["pgov"];
173  }
174  if (!$current_page) {
175  $current_page = (int) $_REQUEST["pg"];
176  }
177  if (!$current_page) {
178  $current_page = 1;
179  }
180  $this->current_page = $current_page;
181  }
+ Here is the caller graph for this function:

◆ dnd()

ilSurveyPageGUI::dnd ( )
protected

Move questions in page.

Definition at line 681 of file class.ilSurveyPageGUI.php.

References $target_id.

682  {
683  $source_id = (int) array_pop(explode("_", $_REQUEST["il_hform_source"]));
684  if ($_REQUEST["il_hform_target"] != "droparea_end") {
685  $target_id = (int) array_pop(explode("_", $_REQUEST["il_hform_target"]));
686  $pos = 0;
687  } else {
688  $page = $this->object->getSurveyPages();
689  $page = $page[$this->current_page - 1];
690  $last = array_pop($page);
691  $target_id = (int) $last["question_id"];
692  $pos = 1;
693  }
694  if ($source_id != $target_id) {
695  $this->object->moveQuestions(array($source_id), $target_id, $pos);
696  }
697  }
$target_id
Definition: goto.php:51

◆ editBlock()

ilSurveyPageGUI::editBlock (   $a_id)
protected

Edit question block.

Parameters
int$a_id

Definition at line 812 of file class.ilSurveyPageGUI.php.

References callEditor().

813  {
814  $this->callEditor("editQuestionblockObject", "bl_id", $a_id);
815  return true;
816  }
callEditor($a_cmd, $a_param, $a_value)
+ Here is the call graph for this function:

◆ editHeading()

ilSurveyPageGUI::editHeading (   $a_id)
protected

Edit question heading.

Parameters
int$a_id

Definition at line 834 of file class.ilSurveyPageGUI.php.

References callEditor().

835  {
836  $this->callEditor("editHeadingObject", "q_id", $a_id);
837  return true;
838  }
callEditor($a_cmd, $a_param, $a_value)
+ Here is the call graph for this function:

◆ editQuestion()

ilSurveyPageGUI::editQuestion (   $a_id)
protected

Edit question.

Parameters
int$a_id

Definition at line 1022 of file class.ilSurveyPageGUI.php.

References $ctrl, and $data.

1023  {
1024  $ilCtrl = $this->ctrl;
1025 
1026  $data = $this->object->getSurveyQuestions();
1027  $data = $data[$a_id];
1028 
1029  $q_gui = $data["type_tag"] . "GUI";
1030  $ilCtrl->setParameterByClass($q_gui, "pgov", $this->current_page);
1031  $ilCtrl->setParameterByClass($q_gui, "q_id", $a_id);
1032 
1033  $ilCtrl->redirectByClass($q_gui, "editQuestion");
1034  }
$data
Definition: storeScorm.php:23

◆ executeCommand()

ilSurveyPageGUI::executeCommand ( )

Routing.

Definition at line 93 of file class.ilSurveyPageGUI.php.

References $ctrl, $current_page, $lng, $rbacsystem, $type, addQuestion(), determineCurrentPage(), insertNewQuestion(), and ilUtil\sendFailure().

94  {
95  $lng = $this->lng;
96  $ilCtrl = $this->ctrl;
98 
99  $cmd = $ilCtrl->getCmd("renderPage");
100  $next_class = $ilCtrl->getNextClass($this);
101 
102  switch ($next_class) {
103  default:
104  $this->determineCurrentPage();
105 
106  $has_content = false;
107 
108  if ($rbacsystem->checkAccess("write", $this->ref_id)) {
109  // add page?
110  if ($_REQUEST["new_id"]) {
111  $this->insertNewQuestion($_REQUEST["new_id"]);
112  }
113 
114  // subcommands
115  if ($_REQUEST["il_hform_subcmd"]) {
116  $subcmd = $_REQUEST["il_hform_subcmd"];
117 
118  // make sure that it is set for current and next requests
119  $ilCtrl->setParameter($this->editor_gui, "pgov", $this->current_page);
120  $_REQUEST["pgov"] = $this->current_page;
121 
122  $id = explode("_", $_REQUEST["il_hform_node"]);
123  $id = (int) $id[1];
124 
125  // multi operation
126  if (substr($_REQUEST["il_hform_subcmd"], 0, 5) == "multi") {
127  if ($_REQUEST["il_hform_multi"]) {
128  // removing types as we only allow questions anyway
129  $id = array();
130  foreach (explode(";", $_REQUEST["il_hform_multi"]) as $item) {
131  $id[] = (int) array_pop(explode("_", $item));
132  }
133 
134  if ($subcmd == "multiDelete") {
135  $subcmd = "deleteQuestion";
136  }
137  } else {
138  // #9525
139  if ($subcmd == "multiDelete") {
140  ilUtil::sendFailure($lng->txt("no_checkbox"), true);
141  $ilCtrl->redirect($this, "renderPage");
142  } else {
143  ilUtil::sendFailure($lng->txt("no_checkbox"));
144  }
145  }
146  }
147 
148  if (substr($subcmd, 0, 11) == "addQuestion") {
149  $type = explode("_", $subcmd);
150  $type = (int) $type[1];
151  $has_content = $this->addQuestion($type, $this->object->isPoolActive(), $id, $_REQUEST["il_hform_node"]);
152  } else {
153  $has_content = $this->$subcmd($id, $_REQUEST["il_hform_node"]);
154  }
155  }
156  }
157 
158  if (!$has_content) {
159  $this->$cmd();
160  }
161  break;
162  }
163  }
$type
addQuestion($a_type, $a_use_pool, $a_pos, $a_special_position)
Call add question to survey form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
insertNewQuestion($a_new_id)
Add new question to survey.
determineCurrentPage()
determine current page
+ Here is the call graph for this function:

◆ getAutoBlockTitle()

ilSurveyPageGUI::getAutoBlockTitle ( )

Get name for newly created blocks.

Returns
string

Definition at line 1732 of file class.ilSurveyPageGUI.php.

References $lng.

Referenced by insertNewQuestion(), insertQuestionBlock(), moveNext(), movePrevious(), paste(), and splitPage().

1733  {
1734  $lng = $this->lng;
1735 
1736  return $lng->txt("survey_auto_block_title");
1737  }
+ Here is the caller graph for this function:

◆ getPageNodes()

ilSurveyPageGUI::getPageNodes ( array  $a_questions,
  $a_has_previous_page = false,
  $a_has_next_page = false,
  $a_readonly = false 
)

Get Form HTML.

Parameters
array$questions
bool$a_has_previous_page
bool$a_has_next_page
bool$a_readonly
Returns
string

Definition at line 1457 of file class.ilSurveyPageGUI.php.

References $_SESSION, $ctrl, $lng, ilObjSurveyQuestionPool\_getQuestiontypes(), and renderPageNode().

Referenced by renderPage().

1458  {
1459  $ilCtrl = $this->ctrl;
1460  $lng = $this->lng;
1461 
1462  $ttpl = new ilTemplate("tpl.il_svy_svy_page_view_nodes.html", true, true, "Modules/Survey");
1463 
1464  $has_clipboard = (bool) $_SESSION["survey_page_view"][$this->ref_id]["clipboard"];
1465 
1466  // question block ?
1467 
1468  $first_question = $a_questions;
1469  $first_question = array_shift($first_question);
1470 
1471  $compress_view = false;
1472  if ($first_question["questionblock_id"]) {
1473  $menu = array();
1474 
1475  if (!$a_readonly && !$has_clipboard) {
1476  $menu[] = array("cmd" => "editBlock", "text" => $lng->txt("edit"));
1477  }
1478 
1479  if ($first_question["questionblock_show_blocktitle"]) {
1480  $block_status = $lng->txt("survey_block_visible");
1481  } else {
1482  $block_status = $lng->txt("survey_block_hidden");
1483  }
1484 
1485  $this->renderPageNode(
1486  $ttpl,
1487  "block",
1488  $first_question["questionblock_id"],
1489  $first_question["questionblock_title"] . " (" . $block_status . ")",
1490  $menu,
1491  false,
1492  false,
1493  $block_status
1494  );
1495 
1496  if (count($a_questions) > 1) {
1497  $compress_view = $first_question["questionblock_compress_view"];
1498  }
1499  }
1500 
1501 
1502  // questions/headings
1503 
1504  $questiontypes = ilObjSurveyQuestionPool::_getQuestiontypes();
1505  $questionpools = array_keys($this->object->getQuestionpoolTitles(true));
1506 
1507  $counter = $question_count;
1508  $block_done = null;
1509  foreach ($a_questions as $idx => $question) {
1510  // drop area
1511 
1512  $menu = array();
1513 
1514  if (!$a_readonly) {
1515  if (!$has_clipboard) {
1516  foreach ($questiontypes as $trans => $item) {
1517  $menu[] = array("cmd" => "addQuestion_" . $item["questiontype_id"],
1518  "text" => sprintf($lng->txt("svy_page_add_question"), $trans));
1519  }
1520 
1521  if ($this->object->isPoolActive()) {
1522  $menu[] = array("cmd" => "addPoolQuestion",
1523  "text" => $lng->txt("browse_for_questions"));
1524  }
1525  } else {
1526  $menu[] = array("cmd" => "paste", "text" => $lng->txt("survey_dnd_paste"));
1527  }
1528  }
1529 
1530  $this->renderPageNode($ttpl, "droparea", $question["question_id"], null, $menu, true);
1531 
1532  // question
1533  $question_gui = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
1534  $question_form = $question_gui->getWorkingForm(
1535  array(),
1536  $this->object->getShowQuestionTitles(),
1537  $question["questionblock_show_questiontext"],
1538  null,
1539  $this->object->getSurveyId(),
1540  $compress_view
1541  );
1542 
1543  $menu = array();
1544 
1545  if (!$a_readonly && !$has_clipboard) {
1546  $menu[] = array("cmd" => "editQuestion", "text" => $lng->txt("edit"));
1547  $menu[] = array("cmd" => "cutQuestion", "text" => $lng->txt("cut"));
1548  $menu[] = array("cmd" => "copyQuestion", "text" => $lng->txt("copy"));
1549 
1550  if (sizeof($a_questions) > 1 && $idx > 0) {
1551  $menu[] = array("cmd" => "splitPage", "text" => $lng->txt("survey_dnd_split_page"));
1552  }
1553  if ($a_has_next_page) {
1554  $menu[] = array("cmd" => "moveNext", "text" => $lng->txt("survey_dnd_move_next"));
1555  }
1556  if ($a_has_previous_page) {
1557  $menu[] = array("cmd" => "movePrevious", "text" => $lng->txt("survey_dnd_move_previous"));
1558  }
1559 
1560  $menu[] = array("cmd" => "deleteQuestion", "text" => $lng->txt("delete"));
1561 
1562  // heading
1563  if ($question["heading"]) {
1564  $menu[] = array("cmd" => "editHeading", "text" => $lng->txt("survey_edit_heading"));
1565  $menu[] = array("cmd" => "deleteHeading", "text" => $lng->txt("survey_delete_heading"));
1566  } else {
1567  $menu[] = array("cmd" => "addHeading", "text" => $lng->txt("add_heading"));
1568  }
1569  }
1570 
1571  if ($first_question["questionblock_show_questiontext"]) {
1572  $question_title_status = $lng->txt("survey_question_text_visible");
1573  } else {
1574  $question_title_status = $lng->txt("survey_question_text_hidden");
1575  }
1576 
1577  $this->renderPageNode(
1578  $ttpl,
1579  "question",
1580  $question["question_id"],
1581  $question_form,
1582  $menu,
1583  false,
1584  $question["title"],
1585  $question_title_status,
1586  $question["heading"]
1587  );
1588 
1589  $ilCtrl->setParameter($this, "eqid", "");
1590  }
1591 
1592 
1593  // last position (no question id)
1594 
1595  $menu = array();
1596 
1597  if (!$a_readonly) {
1598  if (!$has_clipboard) {
1599  foreach ($questiontypes as $trans => $item) {
1600  $menu[] = array("cmd" => "addQuestion_" . $item["questiontype_id"],
1601  "text" => sprintf($lng->txt("svy_page_add_question"), $trans));
1602  }
1603 
1604  if ($this->object->isPoolActive()) {
1605  $menu[] = array("cmd" => "addPoolQuestion",
1606  "text" => $lng->txt("browse_for_questions"));
1607  }
1608  } else {
1609  $menu[] = array("cmd" => "paste", "text" => $lng->txt("survey_dnd_paste"));
1610  }
1611  }
1612 
1613  $this->renderPageNode($ttpl, "page", "end", null, $menu, true);
1614 
1615  return $ttpl->get();
1616  }
$_SESSION["AccountId"]
static _getQuestiontypes()
Creates a list of all available question types.
renderPageNode(ilTemplate $a_tpl, $a_type, $a_id, $a_content=null, array $a_menu=null, $a_spacer=false, $a_subtitle=false, $a_status=false, $a_heading=false)
Render single of dnd page view.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertNewQuestion()

ilSurveyPageGUI::insertNewQuestion (   $a_new_id)

Add new question to survey.

Parameters
int$a_new_id

Definition at line 237 of file class.ilSurveyPageGUI.php.

References $db, $ilDB, $lng, $rbacsystem, SurveyQuestion\_isComplete(), appendNewQuestionToSurvey(), getAutoBlockTitle(), and ilUtil\sendFailure().

Referenced by executeCommand().

238  {
240  $ilDB = $this->db;
241  $lng = $this->lng;
242 
243  if (!SurveyQuestion::_isComplete($a_new_id)) {
244  ilUtil::sendFailure($lng->txt("survey_error_insert_incomplete_question"));
245  } else {
246  $a_new_id = $this->appendNewQuestionToSurvey($a_new_id);
247  $this->object->loadQuestionsFromDb();
248 
249  $pos = $_REQUEST["pgov_pos"];
250 
251  // a[fter]/b[efore] on same page
252  if (substr($pos, -1) != "c") {
253  // block handling
254  $current = $this->object->getSurveyPages();
255  $current = $current[$this->current_page - 1];
256  if (sizeof($current) == 1) {
257  // as questions are moved to first block question
258  // always use existing as first
259  // the new question is moved later on (see below)
260  $this->object->createQuestionblock(
261  $this->getAutoBlockTitle(),
262  true,
263  false,
264  array((int) $pos, $a_new_id)
265  );
266  } else {
267  $block_id = array_pop($current);
268  $block_id = $block_id["questionblock_id"];
269 
270  $this->object->addQuestionToBlock($a_new_id, $block_id);
271  }
272  }
273  // c: as new page (from toolbar/pool)
274  else {
275  // after given question
276  if ((int) $pos) {
277  $pos = (int) $pos . "a";
278  $this->current_page++;
279  }
280  // at the beginning
281  else {
282  $first = $this->object->getSurveyPages();
283  $first = $first[0];
284  $first = array_shift($first);
285  $pos = $first["question_id"] . "b";
286  $this->current_page = 1;
287  }
288  }
289 
290  // move to target position
291  $this->object->moveQuestions(
292  array($a_new_id),
293  (int) $pos,
294  ((substr($pos, -1) == "a") ? 1 : 0)
295  );
296 
297  $this->object->fixSequenceStructure();
298  }
299  }
static _isComplete($question_id)
Checks whether the question is complete or not.
getAutoBlockTitle()
Get name for newly created blocks.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
appendNewQuestionToSurvey($a_new_id, $a_duplicate=true, $a_force_duplicate=false)
Add new question to survey (database part)
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertQuestionBlock()

ilSurveyPageGUI::insertQuestionBlock (   $a_block_id)

Copy and insert questions from block.

Parameters
int$a_block_id

Definition at line 306 of file class.ilSurveyPageGUI.php.

References appendNewQuestionToSurvey(), and getAutoBlockTitle().

307  {
308  $new_ids = array();
309  $question_ids = $this->object->getQuestionblockQuestionIds($a_block_id);
310  foreach ($question_ids as $qid) {
311  $new_ids[] = $this->appendNewQuestionToSurvey($qid, true, true);
312  }
313 
314  if (sizeof($new_ids)) {
315  $this->object->loadQuestionsFromDb();
316 
317  $pos = $_REQUEST["pgov_pos"];
318 
319  // a[fter]/b[efore] on same page
320  if (substr($pos, -1) != "c") {
321  // block handling
322  $current = $this->object->getSurveyPages();
323  $current = $current[$this->current_page - 1];
324  if (sizeof($current) == 1) {
325  // as questions are moved to first block question
326  // always use existing as first
327  // the new question is moved later on (see below)
328  $this->object->createQuestionblock(
329  $this->getAutoBlockTitle(),
330  true,
331  false,
332  array((int) $pos) + $new_ids
333  );
334  } else {
335  $block_id = array_pop($current);
336  $block_id = $block_id["questionblock_id"];
337 
338  foreach ($new_ids as $qid) {
339  $this->object->addQuestionToBlock($qid, $block_id);
340  }
341  }
342  }
343  // c: as new page (from toolbar/pool)
344  else {
345  // re-create block
346  $this->object->createQuestionblock(
347  $this->getAutoBlockTitle(),
348  true,
349  false,
350  $new_ids
351  );
352 
353  // after given question
354  if ((int) $pos) {
355  $pos = (int) $pos . "a";
356  }
357  // at the beginning
358  else {
359  $first = $this->object->getSurveyPages();
360  $first = $first[0];
361  $first = array_shift($first);
362  $pos = $first["question_id"] . "b";
363  }
364  }
365 
366  // move to target position
367  $this->object->moveQuestions(
368  $new_ids,
369  (int) $pos,
370  ((substr($pos, -1) == "a") ? 1 : 0)
371  );
372  }
373  }
getAutoBlockTitle()
Get name for newly created blocks.
appendNewQuestionToSurvey($a_new_id, $a_duplicate=true, $a_force_duplicate=false)
Add new question to survey (database part)
+ Here is the call graph for this function:

◆ moveNext()

ilSurveyPageGUI::moveNext (   $a_id)
protected

Move question to next page.

Parameters
int$a_id

Definition at line 913 of file class.ilSurveyPageGUI.php.

References $current_page, $source, $target_id, and getAutoBlockTitle().

914  {
915  $pages = $this->object->getSurveyPages();
916  $source = $pages[$this->current_page - 1];
917  $target = $pages[$this->current_page];
918  if (sizeof($target)) {
919  $target_id = $target;
920  $target_id = array_shift($target_id);
921  $target_block_id = $target_id["questionblock_id"];
922  $target_id = $target_id["question_id"];
923 
924  // nothing to do if no block
925  if (sizeof($source) > 1) {
926  $block_id = $source;
927  $block_id = array_shift($block_id);
928  $block_id = $block_id["questionblock_id"];
929 
930  // source pages block is obsolete
931  if (sizeof($source) == 2) {
932  // delete block
933  $this->object->unfoldQuestionblocks(array($block_id));
934  } else {
935  // remove question from block
936  $this->object->removeQuestionFromBlock($a_id, $block_id);
937  }
938  }
939 
940  // move source question to target
941  $this->object->moveQuestions(array($a_id), $target_id, 0);
942 
943  // new page has no block yet
944  if (sizeof($target) < 2) {
945  // create block and move target question and source into block
946  $this->object->createQuestionblock(
947  $this->getAutoBlockTitle(),
948  true,
949  false,
950  array($a_id, $target_id)
951  );
952  } else {
953  // add source question to block
954  $this->object->addQuestionToBlock($a_id, $target_block_id);
955  }
956 
957  // only if current page is not "deleted"
958  if (sizeof($source) > 1) {
959  $this->current_page++;
960  }
961  }
962  }
$target_id
Definition: goto.php:51
getAutoBlockTitle()
Get name for newly created blocks.
$source
Definition: metadata.php:76
+ Here is the call graph for this function:

◆ movePage()

ilSurveyPageGUI::movePage ( )
protected

Move current page to new position.

Todo:
this needs to be refactored outside of a GUI class, same with ilSurveyEditorGUI->insertQuestions

Definition at line 1163 of file class.ilSurveyPageGUI.php.

References $ctrl, and $lng.

1164  {
1165  $lng = $this->lng;
1166  $ilCtrl = $this->ctrl;
1167 
1168  // current_page is already set to new position
1169  $target_page = $this->current_page - 1;
1170  $source_page = $_REQUEST["old_pos"] - 1;
1171 
1172  $pages = $this->object->getSurveyPages();
1173  foreach ($pages[$source_page] as $question) {
1174  $questions[] = $question["question_id"];
1175  }
1176 
1177  // move to first position
1178  $position = 0;
1179  if ($_REQUEST["pgov"] != "fst") {
1180  $position = 1;
1181  }
1182 
1183  $target = $pages[$target_page];
1184  if ($position == 0) { // before
1185  $target = array_shift($target); // ... use always the first question of the page
1186  } else { // after
1187  $target = array_pop($target); // ... use always the last question of the page
1188  }
1189  $this->object->moveQuestions($questions, $target["question_id"], $position);
1190 
1191  if ($target_page < $source_page && $position) {
1192  $this->current_page++;
1193  }
1194 
1195  ilUtil::sendSuccess($lng->txt("survey_page_moved"), true);
1196  $ilCtrl->setParameter($this, "pgov", $this->current_page);
1197  $ilCtrl->redirect($this, "renderPage");
1198  }

◆ movePageForm()

ilSurveyPageGUI::movePageForm ( )
protected

Move current page.

Definition at line 1118 of file class.ilSurveyPageGUI.php.

References $ctrl, $lng, and $tpl.

1119  {
1120  $lng = $this->lng;
1121  $ilCtrl = $this->ctrl;
1122  $tpl = $this->tpl;
1123 
1124  $form = new ilPropertyFormGUI();
1125  $form->setFormAction($ilCtrl->getFormAction($this, "movePage"));
1126  $form->setTitle($lng->txt("survey_move_page"));
1127 
1128  $old_pos = new ilHiddenInputGUI("old_pos");
1129  $old_pos->setValue($this->current_page);
1130  $form->addItem($old_pos);
1131 
1132  $pages = $this->object->getSurveyPages();
1133  if ($pages) {
1134  $pages_drop = array();
1135  if ($this->current_page != 1) {
1136  $pages_drop["fst"] = $lng->txt("survey_at_beginning");
1137  }
1138  foreach ($pages as $idx => $questions) {
1139  if (($idx + 1) != $this->current_page && ($idx + 2) != $this->current_page) {
1140  $question = array_shift($questions);
1141  if ($question["questionblock_id"]) {
1142  $pages_drop[$idx + 1] = $lng->txt("survey_behind_page") . " " . $question["questionblock_title"];
1143  } else {
1144  $pages_drop[$idx + 1] = $lng->txt("survey_behind_page") . " " . strip_tags($question["title"]);
1145  }
1146  }
1147  }
1148  $pos = new ilSelectInputGUI($lng->txt("position"), "pgov");
1149  $pos->setOptions($pages_drop);
1150  $form->addItem($pos);
1151  }
1152 
1153  $form->addCommandButton("movePage", $lng->txt("submit"));
1154  $form->addCommandButton("renderPage", $lng->txt("cancel"));
1155 
1156  return $tpl->setContent($form->getHTML());
1157  }
This class represents a property form user interface.
This class represents a hidden form property in a property form.

◆ movePrevious()

ilSurveyPageGUI::movePrevious (   $a_id)
protected

Move question to previous page.

Parameters
int$a_id

Definition at line 969 of file class.ilSurveyPageGUI.php.

References $source, $target_id, and getAutoBlockTitle().

970  {
971  $pages = $this->object->getSurveyPages();
972  $source = $pages[$this->current_page - 1];
973  $target = $pages[$this->current_page - 2];
974  if (sizeof($target)) {
975  $target_id = $target;
976  $target_id = array_pop($target_id);
977  $target_block_id = $target_id["questionblock_id"];
978  $target_id = $target_id["question_id"];
979 
980  // nothing to do if no block
981  if (sizeof($source) > 1) {
982  $block_id = $source;
983  $block_id = array_shift($block_id);
984  $block_id = $block_id["questionblock_id"];
985 
986  // source pages block is obsolete
987  if (sizeof($source) == 2) {
988  // delete block
989  $this->object->unfoldQuestionblocks(array($block_id));
990  } else {
991  // remove question from block
992  $this->object->removeQuestionFromBlock($a_id, $block_id);
993  }
994  }
995 
996  // move source question to target
997  $this->object->moveQuestions(array($a_id), $target_id, 1);
998 
999  // new page has no block yet
1000  if (sizeof($target) < 2) {
1001  // create block and move target question and source into block
1002  $this->object->createQuestionblock(
1003  $this->getAutoBlockTitle(),
1004  true,
1005  false,
1006  array($target_id, $a_id)
1007  );
1008  } else {
1009  // add source question to block
1010  $this->object->addQuestionToBlock($a_id, $target_block_id);
1011  }
1012 
1013  $this->current_page--;
1014  }
1015  }
$target_id
Definition: goto.php:51
getAutoBlockTitle()
Get name for newly created blocks.
$source
Definition: metadata.php:76
+ Here is the call graph for this function:

◆ multiCopy()

ilSurveyPageGUI::multiCopy (   $a_id)
protected

Add questions to be copied to clipboard.

Parameters
array$a_idquestion ids

Definition at line 510 of file class.ilSurveyPageGUI.php.

References $_SESSION, $lng, and $ref_id.

511  {
512  $lng = $this->lng;
513 
514  if (is_array($a_id)) {
515  ilUtil::sendSuccess($lng->txt("survey_questions_to_clipboard_copy"));
516  $this->suppress_clipboard_msg = true;
517 
518  $_SESSION["survey_page_view"][$this->ref_id]["clipboard"] = array(
519  "source" => $this->current_page,
520  "nodes" => $a_id,
521  "mode" => "copy");
522  }
523  }
$_SESSION["AccountId"]

◆ multiCut()

ilSurveyPageGUI::multiCut (   $a_id)
protected

Add questions to be cut to clipboard.

Parameters
array$a_idquestion ids

Definition at line 490 of file class.ilSurveyPageGUI.php.

References $_SESSION, $lng, and $ref_id.

491  {
492  $lng = $this->lng;
493 
494  if (is_array($a_id)) {
495  ilUtil::sendSuccess($lng->txt("survey_questions_to_clipboard_cut"));
496  $this->suppress_clipboard_msg = true;
497 
498  $_SESSION["survey_page_view"][$this->ref_id]["clipboard"] = array(
499  "source" => $this->current_page,
500  "nodes" => $a_id,
501  "mode" => "cut");
502  }
503  }
$_SESSION["AccountId"]

◆ paste()

ilSurveyPageGUI::paste (   $a_id)
protected

Paste from clipboard.

Parameters
int$a_idtarget position

Definition at line 538 of file class.ilSurveyPageGUI.php.

References $_SESSION, $data, $ref_id, $source, ilObjSurvey\_instanciateQuestion(), appendNewQuestionToSurvey(), clearClipboard(), and getAutoBlockTitle().

539  {
540  $data = $_SESSION["survey_page_view"][$this->ref_id]["clipboard"];
541  $pages = $this->object->getSurveyPages();
542  $source = $pages[$data["source"] - 1];
543  $target = $pages[$this->current_page - 1];
544 
545  // #12558 - use order of source page
546  $nodes = array();
547  foreach ($source as $src_qst) {
548  if (in_array($src_qst["question_id"], $data["nodes"])) {
549  $nodes[] = $src_qst["question_id"];
550  }
551  }
552 
553  // append to last position?
554  $pos = 0;
555  if ($_REQUEST["il_hform_node"] == "page_end") {
556  $a_id = $target;
557  $a_id = array_pop($a_id);
558  $a_id = $a_id["question_id"];
559  $pos = 1;
560  }
561 
562  // cut
563  if ($data["mode"] == "cut") {
564  // special case: paste cut on same page (no block handling needed)
565  if ($data["source"] == $this->current_page) {
566  // re-order nodes in page
567  if (sizeof($nodes) <= sizeof($source)) {
568  $this->object->moveQuestions($nodes, $a_id, $pos);
569  }
570  $this->clearClipboard();
571  return;
572  } else {
573  // only if source has block
574  $source_block_id = false;
575  if (sizeof($source) > 1) {
576  $source_block_id = $source;
577  $source_block_id = array_shift($source_block_id);
578  $source_block_id = $source_block_id["questionblock_id"];
579 
580  // remove from block
581  if (sizeof($source) > sizeof($nodes)) {
582  foreach ($nodes as $qid) {
583  $this->object->removeQuestionFromBlock($qid, $source_block_id);
584  }
585  }
586  // remove complete block
587  else {
588  $this->object->unfoldQuestionblocks(array($source_block_id));
589  }
590  }
591 
592  // page will be "deleted" by operation
593  if (sizeof($source) == sizeof($nodes) && $data["source"] < $this->current_page) {
594  $this->current_page--;
595  }
596  }
597  }
598 
599  // copy
600  elseif ($data["mode"] == "copy") {
601  $titles = array();
602  foreach ($this->object->getSurveyPages() as $page) {
603  foreach ($page as $question) {
604  $titles[] = $question["title"];
605  }
606  }
607 
608  // copy questions
609  $question_pointer = array();
610  foreach ($nodes as $qid) {
611  // create new questions
612  $question = ilObjSurvey::_instanciateQuestion($qid);
613 
614  // handle exisiting copies
615  $title = $question->getTitle();
616  $max = 0;
617  foreach ($titles as $existing_title) {
618  #21278 preg_quote with delimiter
619  if (preg_match("/" . preg_quote($title, "/") . " \(([0-9]+)\)$/", $existing_title, $match)) {
620  $max = max($match[1], $max);
621  }
622  }
623  if ($max) {
624  $title .= " (" . ($max + 1) . ")";
625  } else {
626  $title .= " (2)";
627  }
628  $titles[] = $title;
629  $question->setTitle($title);
630 
631  $question->id = -1;
632  $question->saveToDb();
633 
634  $question_pointer[$qid] = $question->getId();
635  $this->appendNewQuestionToSurvey($question->getId(), false);
636  }
637 
638  // copy textblocks
639  $this->object->cloneTextblocks($question_pointer);
640 
641  $this->object->loadQuestionsFromDb();
642 
643  $nodes = array_values($question_pointer);
644  }
645 
646 
647  // paste
648 
649  // create new block
650  if (sizeof($target) == 1) {
651  $nodes = array_merge(array($a_id), $nodes);
652 
653  // moveQuestions() is called within
654  $this->object->createQuestionblock(
655  $this->getAutoBlockTitle(),
656  true,
657  false,
658  $nodes
659  );
660  }
661  // add to existing block
662  else {
663  $target_block_id = $target;
664  $target_block_id = array_shift($target_block_id);
665  $target_block_id = $target_block_id["questionblock_id"];
666 
667  foreach ($nodes as $qid) {
668  $this->object->addQuestionToBlock($qid, $target_block_id);
669  }
670 
671  // move to new position
672  $this->object->moveQuestions($nodes, $a_id, $pos);
673  }
674 
675  $this->clearClipboard();
676  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
$data
Definition: storeScorm.php:23
$_SESSION["AccountId"]
clearClipboard()
Empty clipboard.
getAutoBlockTitle()
Get name for newly created blocks.
appendNewQuestionToSurvey($a_new_id, $a_duplicate=true, $a_force_duplicate=false)
Add new question to survey (database part)
$source
Definition: metadata.php:76
+ Here is the call graph for this function:

◆ renderPage()

ilSurveyPageGUI::renderPage ( )
protected

render questions per page

Alex Killing, 27 July 2018 I removed a line $tpl->addJavascript("./Services/RTE/tiny_mce_.../tiny_mce_src.js"); at the end of this function. Currently I have no idea when this tiny will be presented... Maybe a bug will come out of this during 5.4 testing

Definition at line 1334 of file class.ilSurveyPageGUI.php.

References $_SESSION, $ctrl, $lng, $rbacsystem, $tpl, ilObjAdvancedEditing\_getUsedHTMLTags(), ilObjSurvey\_hasDatasets(), ilGlyphGUI\ADD, ilGlyphGUI\DRAG, ilGlyphGUI\get(), ilUtil\getImagePath(), getPageNodes(), ilYuiUtil\initDragDrop(), ilTinyMCE\removeRedundantSeparators(), renderToolbar(), and ilUtil\sendInfo().

Referenced by addQuestionToolbar().

1335  {
1336  $ilCtrl = $this->ctrl;
1337  $lng = $this->lng;
1338  $tpl = $this->tpl;
1340 
1341  $pages = $this->object->getSurveyPages();
1342  $this->has_next_page = ($this->current_page < sizeof($pages));
1343  $this->has_previous_page = ($this->current_page > 1);
1344  $this->has_datasets = ilObjSurvey::_hasDatasets($this->object->getSurveyId());
1345 
1346  $mess = "";
1347  if ($this->has_datasets) {
1348  $mbox = new ilSurveyContainsDataMessageBoxGUI();
1349  $mess = $mbox->getHTML();
1350  }
1351 
1352  $ilCtrl->setParameter($this, "pg", $this->current_page);
1353  $ilCtrl->setParameter($this, "pgov", "");
1354 
1355  $this->renderToolbar($pages);
1356  if ($pages) {
1357  $ttpl = new ilTemplate("tpl.il_svy_svy_page_view.html", true, true, "Modules/Survey");
1358  $ttpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this));
1359  $lng->loadLanguageModule("form");
1360 
1361  $read_only = ($this->has_datasets || !$rbacsystem->checkAccess("write", $this->ref_id));
1362 
1363  $commands = $multi_commands = array();
1364 
1365  if (!$read_only) {
1366  // clipboard is empty
1367  if (!$_SESSION["survey_page_view"][$this->ref_id]["clipboard"]) {
1368  $multi_commands[] = array("cmd" => "multiDelete", "text" => $lng->txt("delete"));
1369  $multi_commands[] = array("cmd" => "multiCut", "text" => $lng->txt("cut"));
1370  $multi_commands[] = array("cmd" => "multiCopy", "text" => $lng->txt("copy"));
1371  $multi_commands[] = array("cmd" => "selectAll", "text" => $lng->txt("select_all"));
1372  } else {
1373  if (!$this->suppress_clipboard_msg) {
1374  ilUtil::sendInfo($lng->txt("survey_clipboard_notice"));
1375  }
1376  $multi_commands[] = array("cmd" => "clearClipboard", "text" => $lng->txt("survey_dnd_clear_clipboard"));
1377  }
1378 
1379  // help - see ilPageObjectGUI::insertHelp()
1380  $lng->loadLanguageModule("content");
1381  $ttpl->setCurrentBlock("help_section");
1382  $ttpl->setVariable("TXT_ADD_EL", $lng->txt("cont_add_elements"));
1383  $ttpl->setVariable("PLUS", ilGlyphGUI::get(ilGlyphGUI::ADD));
1384  $ttpl->setVariable("DRAG_ARROW", ilGlyphGUI::get(ilGlyphGUI::DRAG));
1385  $ttpl->setVariable("TXT_DRAG", $lng->txt("cont_drag_and_drop_elements"));
1386  $ttpl->setVariable("TXT_SEL", $lng->txt("cont_double_click_to_delete"));
1387  $ttpl->parseCurrentBlock();
1388 
1389  $ttpl->setVariable("DND_INIT_JS", "initDragElements();");
1390 
1391 
1392  // tiny mce
1393 
1394  $tags = ilObjAdvancedEditing::_getUsedHTMLTags("survey");
1395 
1402  $tiny = new ilTinyMCE();
1403  $ttpl->setVariable("WYSIWYG_BLOCKFORMATS", $tiny->_buildAdvancedBlockformatsFromHTMLTags($tags));
1404  $ttpl->setVariable("WYSIWYG_VALID_ELEMENTS", $tiny->_getValidElementsFromHTMLTags($tags));
1405 
1406  $buttons_1 = $tiny->_buildAdvancedButtonsFromHTMLTags(1, $tags);
1407  $buttons_2 = $tiny->_buildAdvancedButtonsFromHTMLTags(2, $tags) . ',' .
1408  $tiny->_buildAdvancedTableButtonsFromHTMLTags($tags) .
1409  ($tiny->getStyleSelect() ? ',styleselect' : '');
1410  $buttons_3 = $tiny->_buildAdvancedButtonsFromHTMLTags(3, $tags);
1411  $ttpl->setVariable('WYSIWYG_BUTTONS_1', ilTinyMCE::removeRedundantSeparators($buttons_1));
1412  $ttpl->setVariable('WYSIWYG_BUTTONS_2', ilTinyMCE::removeRedundantSeparators($buttons_2));
1413  $ttpl->setVariable('WYSIWYG_BUTTONS_3', ilTinyMCE::removeRedundantSeparators($buttons_3));
1414  }
1415 
1416  // commands
1417  if (count($multi_commands) > 0) {
1418  foreach ($multi_commands as $cmd) {
1419  $ttpl->setCurrentBlock("multi_cmd");
1420  $ttpl->setVariable("ORG_CMD_MULTI", "renderPage");
1421  $ttpl->setVariable("MULTI_CMD", $cmd["cmd"]);
1422  $ttpl->setVariable("MULTI_CMD_TXT", $cmd["text"]);
1423  $ttpl->parseCurrentBlock();
1424  }
1425 
1426  $ttpl->setCurrentBlock("multi_cmds");
1427  $ttpl->setVariable("MCMD_ALT", $lng->txt("commands"));
1428  $ttpl->setVariable("MCMD_IMG", ilUtil::getImagePath("arrow_downright.svg"));
1429  $ttpl->parseCurrentBlock();
1430  }
1431 
1432  // nodes
1433  $ttpl->setVariable("NODES", $this->getPageNodes(
1434  $pages[$this->current_page - 1],
1435  $this->has_previous_page,
1436  $this->has_next_page,
1437  $read_only
1438  ));
1439 
1440  $tpl->setContent($mess . $ttpl->get());
1441 
1442  // add js to template
1444  $tpl->addJavascript("./Modules/Survey/js/SurveyPageView.js");
1445  }
1446  }
$_SESSION["AccountId"]
static _hasDatasets($survey_id)
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
static get($a_glyph, $a_text="")
Get glyph html.
getPageNodes(array $a_questions, $a_has_previous_page=false, $a_has_next_page=false, $a_readonly=false)
Get Form HTML.
static removeRedundantSeparators($a_string)
Removes redundant seperators and removes ,, and , at the first or last position of the string...
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Tiny MCE editor class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Message box for survey, when data is alrady available.
static initDragDrop(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Drag and Drop.
renderToolbar($a_pages)
Render toolbar form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderPageNode()

ilSurveyPageGUI::renderPageNode ( ilTemplate  $a_tpl,
  $a_type,
  $a_id,
  $a_content = null,
array  $a_menu = null,
  $a_spacer = false,
  $a_subtitle = false,
  $a_status = false,
  $a_heading = false 
)

Render single of dnd page view.

Parameters
ilTemplate$a_tpl
string$a_type
int$a_id
string$a_content
array$a_menu
bool$a_spacer
string$a_subtitle
string$a_heading

Definition at line 1630 of file class.ilSurveyPageGUI.php.

References $ctrl, $lng, $url, ilGlyphGUI\ADD, ilGlyphGUI\get(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), HTML_Template_IT\setVariable(), and ilTemplate\touchBlock().

Referenced by getPageNodes().

1631  {
1632  $ilCtrl = $this->ctrl;
1633  $lng = $this->lng;
1634 
1635  $node_id = $a_type . "_" . $a_id;
1636 
1637  if ($a_spacer) {
1638  if ($a_menu) {
1639  // drop area menu
1640  foreach ($a_menu as $mcnt => $menu_item) {
1641  $ilCtrl->setParameter($this, "il_hform_node", $node_id);
1642  $ilCtrl->setParameter($this, "il_hform_subcmd", $menu_item["cmd"]);
1643  $url = $ilCtrl->getLinkTarget($this, "renderPage");
1644  $ilCtrl->setParameter($this, "il_hform_subcmd", "");
1645  $ilCtrl->setParameter($this, "il_hform_node", "");
1646 
1647  $a_tpl->setCurrentBlock("menu_cmd");
1648  $a_tpl->setVariable("TXT_MENU_CMD", $menu_item["text"]);
1649  $a_tpl->setVariable("URL_MENU_CMD", $url);
1650  $a_tpl->parseCurrentBlock();
1651  }
1652  }
1653 
1654  $a_tpl->setCurrentBlock("drop_area");
1655  $a_tpl->setVariable("ICON_ADD", ilGlyphGUI::get(ilGlyphGUI::ADD));
1656  $a_tpl->setVariable("DROP_ID", $a_id);
1657  $a_tpl->parseCurrentBlock();
1658  } elseif ($a_menu) {
1659  // question action menu
1660  foreach ($a_menu as $mcnt => $menu_item) {
1661  $ilCtrl->setParameter($this, "il_hform_node", $node_id);
1662  $ilCtrl->setParameter($this, "il_hform_subcmd", $menu_item["cmd"]);
1663  $url = $ilCtrl->getLinkTarget($this, "renderPage");
1664  $ilCtrl->setParameter($this, "il_hform_subcmd", "");
1665  $ilCtrl->setParameter($this, "il_hform_node", "");
1666 
1667  $a_tpl->setCurrentBlock("action_cmd");
1668  $a_tpl->setVariable("TXT_ACTION_CMD", $menu_item["text"]);
1669  $a_tpl->setVariable("URL_ACTION_CMD", $url);
1670  $a_tpl->parseCurrentBlock();
1671  }
1672  }
1673 
1674  // add heading to content
1675  if ($a_content !== null &&
1676  $a_type == "question" &&
1677  $a_heading) {
1678  $a_content = "<div class=\"questionheading\">" . $a_heading . "</div>" .
1679  $a_content;
1680  }
1681 
1682  if ($a_menu) {
1683  $a_tpl->setVariable("TXT_NODE_CONTENT_ACTIONS", $a_content);
1684  } else {
1685  $a_tpl->setVariable("TXT_NODE_CONTENT_NO_ACTIONS", $a_content);
1686  }
1687 
1688  if ($a_content !== null) {
1689  $drag = "";
1690  $selectable = false;
1691  switch ($a_type) {
1692  case "block":
1693  $caption = $lng->txt("questionblock");
1694  break;
1695 
1696  case "question":
1697  $caption = $lng->txt("question") . ": " . $a_subtitle;
1698  $drag = "_drag";
1699  $selectable = true;
1700  break;
1701 
1702  case "heading":
1703  $caption = $lng->txt("heading");
1704  break;
1705 
1706  default:
1707  return;
1708  }
1709 
1710  if ($a_status) {
1711  $caption .= " (" . $a_status . ")";
1712  }
1713 
1714  $a_tpl->setCurrentBlock("list_item");
1715  $a_tpl->setVariable("NODE_ID", $node_id);
1716  $a_tpl->setVariable("NODE_DRAG", $drag);
1717  $a_tpl->setVariable("TXT_NODE_TYPE", $caption);
1718  if ($selectable) {
1719  $a_tpl->setVariable("SELECTABLE", " selectable");
1720  }
1721  $a_tpl->parseCurrentBlock();
1722  }
1723 
1724  $a_tpl->touchBlock("element");
1725  }
static get($a_glyph, $a_text="")
Get glyph html.
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:615
touchBlock($block)
overwrites ITX::touchBlock.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
$url
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderToolbar()

ilSurveyPageGUI::renderToolbar (   $a_pages)
protected

Render toolbar form.

Parameters
array$a_pages

Definition at line 1205 of file class.ilSurveyPageGUI.php.

References $ctrl, $ilUser, $lng, $si, $toolbar, $url, $user, and ilLinkButton\getInstance().

Referenced by renderPage().

1206  {
1207  $ilToolbar = $this->toolbar;
1208  $ilCtrl = $this->ctrl;
1209  $lng = $this->lng;
1210  $ilUser = $this->user;
1211 
1212  if (!$this->has_datasets) {
1213  $button = ilLinkButton::getInstance();
1214  $button->setCaption("survey_add_new_question");
1215  $button->setUrl($ilCtrl->getLinkTarget($this, "addQuestionToolbarForm"));
1216  $ilToolbar->addStickyItem($button);
1217 
1218  if ($this->object->isPoolActive()) {
1219  //$ilToolbar->addSeparator();
1220 
1221  $last_on_page = 0;
1222  if ($a_pages &&
1223  is_array($a_pages[$this->current_page - 1])) {
1224  $last_on_page = $a_pages[$this->current_page - 1];
1225  $last_on_page = array_pop($last_on_page);
1226  $last_on_page = $last_on_page["question_id"];
1227  }
1228 
1229  $ilCtrl->setParameter($this->editor_gui, "pgov", $this->current_page);
1230  $ilCtrl->setParameter($this->editor_gui, "pgov_pos", $last_on_page . "c");
1231 
1232  $cmd = ($ilUser->getPref('svy_insert_type') == 1 ||
1233  strlen($ilUser->getPref('svy_insert_type')) == 0)
1234  ? 'browseForQuestions'
1235  : 'browseForQuestionblocks';
1236 
1237  $button = ilLinkButton::getInstance();
1238  $button->setCaption("browse_for_questions");
1239  $button->setUrl($ilCtrl->getLinkTarget($this->editor_gui, $cmd));
1240  $ilToolbar->addStickyItem($button);
1241 
1242  $ilCtrl->setParameter($this->editor_gui, "pgov", "");
1243  $ilCtrl->setParameter($this->editor_gui, "pgov_pos", "");
1244  }
1245 
1246  if ($a_pages) {
1247  $ilToolbar->addSeparator();
1248  }
1249  }
1250 
1251  // parse data for pages drop-down
1252  if ($a_pages) {
1253  // previous/next
1254 
1255  $ilCtrl->setParameter($this, "pg", $this->current_page - 1);
1256  $button = ilLinkButton::getInstance();
1257  $button->setCaption("survey_prev_question");
1258  if ($this->has_previous_page) {
1259  $button->setUrl($ilCtrl->getLinkTarget($this, "renderPage"));
1260  }
1261  $button->setDisabled(!$this->has_previous_page);
1262  $ilToolbar->addStickyItem($button);
1263 
1264  $ilCtrl->setParameter($this, "pg", $this->current_page + 1);
1265  $button = ilLinkButton::getInstance();
1266  $button->setCaption("survey_next_question");
1267  if ($this->has_next_page) {
1268  $button->setUrl($ilCtrl->getLinkTarget($this, "renderPage"));
1269  }
1270  $button->setDisabled(!$this->has_next_page);
1271  $ilToolbar->addStickyItem($button);
1272 
1273  $ilCtrl->setParameter($this, "pg", $this->current_page); // #14615
1274 
1275  foreach ($a_pages as $idx => $questions) {
1276  $page = $questions;
1277  $page = array_shift($page);
1278  if ($page["questionblock_id"]) {
1279  $pages_drop[$idx + 1] = $page["questionblock_title"];
1280 
1281  if (sizeof($questions) > 1) {
1282  foreach ($questions as $question) {
1283  $pages_drop[($idx + 1) . "__" . $question["question_id"]] = "- " . $question["title"];
1284  }
1285  }
1286  } else {
1287  $pages_drop[$idx + 1] = strip_tags($page["title"]);
1288  }
1289  }
1290  }
1291 
1292  // jump to page
1293  if (is_array($pages_drop) && count($pages_drop) > 1) {
1294  //$ilToolbar->addSeparator();
1295 
1296  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1297 
1298  $si = new ilSelectInputGUI($lng->txt("survey_jump_to"), "jump");
1299  $si->addCustomAttribute("onChange=\"forms['ilToolbar'].submit();\"");
1300  $si->setOptions($pages_drop);
1301  $si->setValue($this->current_page);
1302  $ilToolbar->addInputItem($si, true);
1303 
1304  // we need this to have to right cmd
1305  $cmd = new ilHiddenInputGUI("cmd[renderPage]");
1306  $cmd->setValue("1");
1307  $ilToolbar->addInputItem($cmd);
1308 
1309  if (!$this->has_datasets) {
1310  $ilToolbar->addSeparator();
1311 
1312  $ilCtrl->setParameter($this, "csum", md5(print_r($a_pages[$this->current_page - 1], true)));
1313  $url = $ilCtrl->getLinkTarget($this, "deleteBlock");
1314  $ilCtrl->setParameter($this, "csum", "");
1315 
1316  $button = ilLinkButton::getInstance();
1317  $button->setCaption("survey_delete_page");
1318  $button->setUrl($url);
1319  $ilToolbar->addButtonInstance($button);
1320 
1321  $ilToolbar->addSeparator();
1322 
1323  $button = ilLinkButton::getInstance();
1324  $button->setCaption("survey_move_page");
1325  $button->setUrl($ilCtrl->getLinkTarget($this, "movePageForm"));
1326  $ilToolbar->addButtonInstance($button);
1327  }
1328  }
1329  }
This class represents a hidden form property in a property form.
$url
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ splitPage()

ilSurveyPageGUI::splitPage (   $a_id)
protected

Split current page in 2 pages.

Parameters
int$a_id

Definition at line 866 of file class.ilSurveyPageGUI.php.

References $source, and getAutoBlockTitle().

867  {
868  $pages = $this->object->getSurveyPages();
869  $source = $pages[$this->current_page - 1];
870 
871  $block_questions = array();
872  $add = $block_id = false;
873  foreach ($source as $idx => $item) {
874  if ($item["question_id"] == $a_id) {
875  $block_id = $item["questionblock_id"];
876  $add = $idx;
877  }
878  if ($add) {
879  $block_questions[] = $item["question_id"];
880  }
881  }
882 
883  // just 1 question left: block is obsolete
884  if ($add == 1) {
885  $this->object->unfoldQuestionblocks(array($block_id));
886  }
887  // remove questions from block
888  else {
889  foreach ($block_questions as $qid) {
890  $this->object->removeQuestionFromBlock($qid, $block_id);
891  }
892  }
893 
894  // more than 1 moved?
895  if (sizeof($block_questions) > 1) {
896  // create new block and move target questions
897  $this->object->createQuestionblock(
898  $this->getAutoBlockTitle(),
899  true,
900  false,
901  $block_questions
902  );
903  }
904 
905  $this->current_page++;
906  }
getAutoBlockTitle()
Get name for newly created blocks.
$source
Definition: metadata.php:76
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

◆ $current_page

ilSurveyPageGUI::$current_page
protected

Definition at line 55 of file class.ilSurveyPageGUI.php.

Referenced by determineCurrentPage(), executeCommand(), and moveNext().

◆ $db

ilSurveyPageGUI::$db
protected

Definition at line 29 of file class.ilSurveyPageGUI.php.

Referenced by appendNewQuestionToSurvey(), and insertNewQuestion().

◆ $editor_gui

ilSurveyPageGUI::$editor_gui
protected

Definition at line 54 of file class.ilSurveyPageGUI.php.

◆ $has_datasets

ilSurveyPageGUI::$has_datasets
protected

Definition at line 58 of file class.ilSurveyPageGUI.php.

◆ $has_next_page

ilSurveyPageGUI::$has_next_page
protected

Definition at line 57 of file class.ilSurveyPageGUI.php.

◆ $has_previous_page

ilSurveyPageGUI::$has_previous_page
protected

Definition at line 56 of file class.ilSurveyPageGUI.php.

◆ $lng

◆ $log

ilSurveyPageGUI::$log
protected

Definition at line 64 of file class.ilSurveyPageGUI.php.

◆ $object

ilSurveyPageGUI::$object
protected

Definition at line 53 of file class.ilSurveyPageGUI.php.

◆ $rbacsystem

ilSurveyPageGUI::$rbacsystem
protected

Definition at line 24 of file class.ilSurveyPageGUI.php.

Referenced by executeCommand(), insertNewQuestion(), and renderPage().

◆ $ref_id

ilSurveyPageGUI::$ref_id
protected

◆ $tabs

ilSurveyPageGUI::$tabs
protected

Definition at line 34 of file class.ilSurveyPageGUI.php.

Referenced by addQuestion(), and callEditor().

◆ $toolbar

ilSurveyPageGUI::$toolbar
protected

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

Referenced by renderToolbar().

◆ $tpl

ilSurveyPageGUI::$tpl
protected

Definition at line 39 of file class.ilSurveyPageGUI.php.

Referenced by addQuestionToolbarForm(), movePageForm(), and renderPage().

◆ $use_pool

ilSurveyPageGUI::$use_pool
protected

Definition at line 59 of file class.ilSurveyPageGUI.php.

◆ $user

ilSurveyPageGUI::$user
protected

Definition at line 49 of file class.ilSurveyPageGUI.php.

Referenced by addPoolQuestion(), and renderToolbar().


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