/**
  * render questions per page
  */
 protected function renderPage()
 {
     global $ilCtrl, $lng, $tpl, $rbacsystem;
     $pages = $this->object->getSurveyPages();
     $this->has_next_page = $this->current_page < sizeof($pages);
     $this->has_previous_page = $this->current_page > 1;
     $this->has_datasets = $this->object->_hasDatasets($this->object->getSurveyId());
     if ($this->has_datasets) {
         $link = $ilCtrl->getLinkTargetByClass(array("ilobjsurveygui", "ilsurveyparticipantsgui"), "maintenance");
         $link = "<a href=\"" . $link . "\">" . $lng->txt("survey_has_datasets_warning_page_view_link") . "</a>";
         ilUtil::sendInfo($lng->txt("survey_has_datasets_warning_page_view") . " " . $link);
     }
     $ilCtrl->setParameter($this, "pg", $this->current_page);
     $ilCtrl->setParameter($this, "pgov", "");
     $this->renderToolbar($pages);
     if ($pages) {
         $ttpl = new ilTemplate("tpl.il_svy_svy_page_view.html", true, true, "Modules/Survey");
         $ttpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this));
         $ttpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormAction($this));
         $lng->loadLanguageModule("form");
         $read_only = $this->has_datasets || !$rbacsystem->checkAccess("write", $this->ref_id);
         $commands = $multi_commands = array();
         if (!$read_only) {
             // clipboard is empty
             if (!$_SESSION["survey_page_view"][$this->ref_id]["clipboard"]) {
                 $multi_commands[] = array("cmd" => "multiDelete", "text" => $lng->txt("delete"));
                 $multi_commands[] = array("cmd" => "multiCut", "text" => $lng->txt("cut"));
                 $multi_commands[] = array("cmd" => "multiCopy", "text" => $lng->txt("copy"));
             } else {
                 if (!$this->suppress_clipboard_msg) {
                     ilUtil::sendInfo($lng->txt("survey_clipboard_notice"));
                 }
                 $multi_commands[] = array("cmd" => "clearClipboard", "text" => $lng->txt("survey_dnd_clear_clipboard"));
             }
             // help
             $ttpl->setCurrentBlock("help_img");
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("streaked_area.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_section");
             $ttpl->setVariable("TXT_HELP", $lng->txt("form_hierarchy_add_elements"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_img");
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("drop_streaked_area.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_section");
             $ttpl->setVariable("TXT_HELP", $lng->txt("form_hierarchy_drag_drop_help"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_img");
             $ttpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_cont_el_s.png"));
             $ttpl->parseCurrentBlock();
             $ttpl->setCurrentBlock("help_section");
             $ttpl->setVariable("TXT_HELP", $lng->txt("survey_dnd_double_click_to_delete"));
             $ttpl->parseCurrentBlock();
             $ttpl->setVariable("DND_INIT_JS", "initDragElements();");
             // tiny mce
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $tags = ilObjAdvancedEditing::_getUsedHTMLTags("survey");
             include_once "./Services/RTE/classes/class.ilTinyMCE.php";
             $tiny = new ilTinyMCE("3.3.9.2");
             $ttpl->setVariable("WYSIWYG_BLOCKFORMATS", $tiny->_buildAdvancedBlockformatsFromHTMLTags($tags));
             $ttpl->setVariable("WYSIWYG_VALID_ELEMENTS", $tiny->_getValidElementsFromHTMLTags($tags));
             $buttons_1 = $tiny->_buildAdvancedButtonsFromHTMLTags(1, $tags);
             $buttons_2 = $tiny->_buildAdvancedButtonsFromHTMLTags(2, $tags) . ',' . $tiny->_buildAdvancedTableButtonsFromHTMLTags($tags) . ($tiny->getStyleSelect() ? ',styleselect' : '');
             $buttons_3 = $tiny->_buildAdvancedButtonsFromHTMLTags(3, $tags);
             $ttpl->setVariable('WYSIWYG_BUTTONS_1', $tiny->_removeRedundantSeparators($buttons_1));
             $ttpl->setVariable('WYSIWYG_BUTTONS_2', $tiny->_removeRedundantSeparators($buttons_2));
             $ttpl->setVariable('WYSIWYG_BUTTONS_3', $tiny->_removeRedundantSeparators($buttons_3));
         }
         // commands
         if (count($multi_commands) > 0 || count($commands) > 0) {
             $single = false;
             foreach ($commands as $cmd) {
                 $ttpl->setCurrentBlock("cmd");
                 $ttpl->setVariable("ORG_CMD", "renderPage");
                 $ttpl->setVariable("CMD", $cmd["cmd"]);
                 $ttpl->setVariable("CMD_TXT", $cmd["text"]);
                 $ttpl->parseCurrentBlock();
                 $single = true;
             }
             $multi = false;
             foreach ($multi_commands as $cmd) {
                 $ttpl->setCurrentBlock("multi_cmd");
                 $ttpl->setVariable("ORG_CMD_MULTI", "renderPage");
                 $ttpl->setVariable("MULTI_CMD", $cmd["cmd"]);
                 $ttpl->setVariable("MULTI_CMD_TXT", $cmd["text"]);
                 $ttpl->parseCurrentBlock();
                 $multi = true;
             }
             if ($multi) {
                 $ttpl->setCurrentBlock("multi_cmds");
                 $ttpl->setVariable("MCMD_ALT", $lng->txt("commands"));
                 $ttpl->setVariable("MCMD_IMG", ilUtil::getImagePath("arrow_downright.png"));
                 $ttpl->parseCurrentBlock();
             }
             if ($single || $multi) {
                 $ttpl->setCurrentBlock("commands");
                 $ttpl->parseCurrentBlock();
             }
         }
         // nodes
         $ttpl->setVariable("NODES", $this->getPageNodes($pages[$this->current_page - 1], $this->has_previous_page, $this->has_next_page, $read_only));
         $tpl->setContent($ttpl->get());
         // add js to template
         include_once "./Services/YUI/classes/class.ilYuiUtil.php";
         ilYuiUtil::initDragDrop();
         $tpl->addJavascript("./Modules/Survey/js/SurveyPageView.js");
         $tpl->addJavascript("./Services/RTE/tiny_mce_3_3_9_2/tiny_mce_src.js");
     }
 }