4include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
 
   29        $this->ctrl = 
$DIC->ctrl();
 
   30        $this->lng = 
$DIC->language();
 
   34        $this->
object = $a_survey_obj;
 
   35        $this->read_only = (bool) $a_read_only;
 
   37        parent::__construct($a_parent_obj, $a_parent_cmd);
 
   39        $this->
setId(
"il_svy_qst");
 
   44        if (!$this->read_only) {
 
   46            if (!array_key_exists(
"move_questions", 
$_SESSION)) {
 
   72        if (!$this->read_only) {
 
   80        $this->
setRowTemplate(
"tpl.il_svy_svy_question_table.html", 
"Modules/Survey");
 
   95        $survey_questions = $this->
object->getSurveyQuestions();
 
   96        if (count($survey_questions) > 0) {
 
   97            include_once 
"./Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php";
 
  100            $questionpools = $this->
object->getQuestionpoolTitles(
true);
 
  102            $table_data = array();
 
  103            $last_questionblock_id = $position = $block_position = 0;
 
  104            foreach ($survey_questions as $question_id => 
$data) {
 
  106                if (
$data[
"questionblock_id"] > 0 &&
 
  107                    $data[
"questionblock_id"] != $last_questionblock_id) {
 
  108                    $id = 
"qb_" . 
$data[
"questionblock_id"];
 
  110                    $table_data[
$id] = array(
"id" => 
$id,
 
  112                        "title" => 
$data[
"questionblock_title"]);
 
  114                    if (!$this->read_only) {
 
  116                        if (
sizeof($survey_questions) > 1) {
 
  118                            $table_data[
$id][
"position"] = $position;
 
  121                        $ilCtrl->setParameter($this->parent_obj, 
"bl_id", 
$data[
"questionblock_id"]);
 
  122                        $table_data[
$id][
"url"] = 
$ilCtrl->getLinkTarget($this->parent_obj, 
"editQuestionblock");
 
  123                        $ilCtrl->setParameter($this->parent_obj, 
"bl_id", 
"");
 
  133                $table_data[
$id] = array(
"id" => 
$id,
 
  134                    "type" => 
"question",
 
  135                    "heading" => 
$data[
"heading"],
 
  136                    "title" => 
$data[
"title"],
 
  137                    "description" => 
$data[
"description"],
 
  138                    "author" => 
$data[
"author"],
 
  139                    "block_id" => 
$data[
"questionblock_id"],
 
  140                    "obligatory" => (
bool) 
$data[
"obligatory"]);
 
  143                foreach ($questiontypes as $trans => $typedata) {
 
  144                    if (strcmp($typedata[
"type_tag"], 
$data[
"type_tag"]) == 0) {
 
  145                        $table_data[
$id][
"question_type"] = $trans;
 
  150                if (
$data[
"original_id"]) {
 
  152                    if (isset($questionpools[$original_fi])) {
 
  153                        $table_data[
$id][
"pool"] = $questionpools[$original_fi];
 
  156                        $table_data[
$id][
"pool"] = $this->lng->txt(
"status_no_permission");
 
  160                if (!$this->read_only) {
 
  161                    if (
$data[
"obj_fi"] > 0) {
 
  163                        $q_gui = 
$data[
"type_tag"] . 
"GUI";
 
  164                        $ilCtrl->setParameterByClass($q_gui, 
"q_id", 
$id);
 
  165                        $table_data[
$id][
"url"] = 
$ilCtrl->getLinkTargetByClass($q_gui, 
"editQuestion") .
 
  166                        $ilCtrl->setParameterByClass($q_gui, 
"q_id", 
"");
 
  170                    if (
sizeof($survey_questions) > 1) {
 
  171                        if (!
$data[
"questionblock_id"]) {
 
  173                            $table_data[
$id][
"position"] = $position;
 
  175                            $block_position += 10;
 
  176                            $table_data[
$id][
"position"] = $block_position;
 
  181                $last_questionblock_id = 
$data[
"questionblock_id"];
 
  198        switch ($a_set[
"type"]) {
 
  200                if (!$this->read_only) {
 
  202                    $this->tpl->setCurrentBlock(
"checkable");
 
  203                    $this->tpl->setVariable(
"QUESTION_ID", $a_set[
"id"]);
 
  204                    $this->tpl->parseCurrentBlock();
 
  207                    if ($a_set[
"position"]) {
 
  208                        $this->tpl->setCurrentBlock(
"order");
 
  209                        $this->tpl->setVariable(
"ORDER_NAME", 
"order[" . $a_set[
"id"] . 
"]");
 
  210                        $this->tpl->setVariable(
"ORDER_VALUE", $a_set[
"position"]);
 
  211                        $this->tpl->parseCurrentBlock();
 
  215                $this->tpl->setVariable(
"TYPE", 
$lng->txt(
"questionblock"));
 
  219                $this->tpl->setVariable(
"DESCRIPTION", $a_set[
"description"]);
 
  220                $this->tpl->setVariable(
"TYPE", $a_set[
"question_type"]);
 
  221                $this->tpl->setVariable(
"AUTHOR", $a_set[
"author"]);
 
  222                $this->tpl->setVariable(
"POOL", $a_set[
"pool"]);
 
  224                if ($a_set[
"heading"]) {
 
  225                    $this->tpl->setCurrentBlock(
"heading");
 
  226                    $this->tpl->setVariable(
"TXT_HEADING", $a_set[
"heading"]);
 
  227                    $this->tpl->parseCurrentBlock();
 
  230                if ($a_set[
"block_id"]) {
 
  231                    $this->tpl->setVariable(
"TITLE_INDENT", 
" style=\"padding-left:30px\"");
 
  234                if (!$this->read_only) {
 
  236                    $this->tpl->setCurrentBlock(
"checkable");
 
  237                    $this->tpl->setVariable(
"QUESTION_ID", $a_set[
"id"]);
 
  238                    $this->tpl->parseCurrentBlock();
 
  240                    if ($a_set[
"block_id"]) {
 
  241                        $this->tpl->setVariable(
"CHECKABLE_INDENT", 
" style=\"padding-left:30px\"");
 
  245                    if ($a_set[
"position"]) {
 
  246                        $this->tpl->setCurrentBlock(
"order");
 
  247                        if (!$a_set[
"block_id"]) {
 
  248                            $this->tpl->setVariable(
"ORDER_NAME", 
"order[q_" . $a_set[
"id"] . 
"]");
 
  250                            $this->tpl->setVariable(
"ORDER_NAME", 
"block_order[" . $a_set[
"block_id"] . 
"][" . $a_set[
"id"] . 
"]");
 
  252                        $this->tpl->setVariable(
"ORDER_VALUE", $a_set[
"position"]);
 
  253                        $this->tpl->parseCurrentBlock();
 
  254                        if ($a_set[
"block_id"]) {
 
  255                            $this->tpl->setVariable(
"ORDER_INDENT", 
" style=\"padding-left:30px\"");
 
  260                    $checked = $a_set[
"obligatory"] ? 
" checked=\"checked\"" : 
"";
 
  261                    $obligatory = 
"<input type=\"checkbox\" name=\"obligatory_" .
 
  262                        $a_set[
"id"] . 
"\" value=\"1\"" . $checked . 
" />";
 
  263                } elseif ($a_set[
"obligatory"]) {
 
  265                        "\" alt=\"" . 
$lng->txt(
"question_obligatory") .
 
  266                        "\" title=\"" . 
$lng->txt(
"question_obligatory") . 
"\" />";
 
  268                $this->tpl->setVariable(
"OBLIGATORY", $obligatory);
 
  272                if (!$this->read_only) {
 
  274                    $this->tpl->setCurrentBlock(
"checkable");
 
  275                    $this->tpl->setVariable(
"QUESTION_ID", $a_set[
"id"]);
 
  276                    $this->tpl->parseCurrentBlock();
 
  277                    if ($a_set[
"in_block"]) {
 
  278                        $this->tpl->setVariable(
"CHECKABLE_INDENT", 
" style=\"padding-left:30px\"");
 
  279                        $this->tpl->setVariable(
"TITLE_INDENT", 
" style=\"padding-left:30px\"");
 
  283                $this->tpl->setVariable(
"TYPE", 
$lng->txt(
"heading"));
 
  287        if (!$this->read_only) {
 
  288            $this->tpl->setCurrentBlock(
"actions");
 
  290            $ilCtrl->setParameter($this->parent_obj, 
"q_id", $a_set[
"id"]);
 
  292            include_once 
"Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
 
  294            $list->setId($a_set[
"id"]);
 
  295            $list->setListTitle(
$lng->txt(
"actions"));
 
  297                $list->addItem(
$lng->txt(
"edit"), 
"", $a_set[
"url"]);
 
  300            if ($a_set[
"heading"]) {
 
  302                    $lng->txt(
"survey_edit_heading"),
 
  304                    $ilCtrl->getLinkTarget($this->parent_obj, 
"editheading")
 
  308                    $lng->txt(
"survey_delete_heading"),
 
  310                    $ilCtrl->getLinkTarget($this->parent_obj, 
"removeheading")
 
  312            } elseif ($a_set[
"type"] == 
"question") {
 
  314                    $lng->txt(
"add_heading"),
 
  316                    $ilCtrl->getLinkTarget($this->parent_obj, 
"addHeading")
 
  320            $this->tpl->setVariable(
"ACTION", 
$list->getHTML());
 
  322            $ilCtrl->setParameter($this->parent_obj, 
"q_id", 
"");
 
  324            $this->tpl->parseCurrentBlock();
 
  328                $this->tpl->setCurrentBlock(
"title_edit");
 
  329                $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
 
  330                $this->tpl->setVariable(
"URL_TITLE", $a_set[
"url"]);
 
  331                $this->tpl->parseCurrentBlock();
 
  333                $this->tpl->setCurrentBlock(
"title_static");
 
  334                $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
 
  335                $this->tpl->parseCurrentBlock();
 
  338            $this->tpl->setCurrentBlock(
"title_static");
 
  339            $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
 
  340            $this->tpl->parseCurrentBlock();
 
An exception for terminatinating execution or to throw for unit testing.
static lookupObjFi($a_qid)
Lookip obj fi.
User interface class for advanced drop-down selection lists.
static _getQuestiontypes()
Creates a list of all available question types.
Survey question table GUI class.
fillRow($a_set)
Fill table row.
importData()
Import data from DB.
__construct($a_parent_obj, $a_parent_cmd, ilObjSurvey $a_survey_obj, $a_read_only=false)
Constructor.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!array_key_exists('StateId', $_REQUEST)) $id
if(isset($_REQUEST['delete'])) $list