• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilObjAdvancedEditingGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00035 include_once "class.ilObjectGUI.php";
00036 
00037 class ilObjAdvancedEditingGUI extends ilObjectGUI
00038 {
00043         var $conditions;
00044 
00045         function ilObjAdvancedEditingGUI($a_data,$a_id,$a_call_by_reference)
00046         {
00047                 global $rbacsystem;
00048 
00049                 $this->type = "adve";
00050                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
00051                 $this->lng->loadLanguageModule('meta');
00052 
00053                 if (!$rbacsystem->checkAccess('read',$this->object->getRefId()))
00054                 {
00055                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read_adve"),$this->ilias->error_obj->WARNING);
00056                 }
00057         }
00058         
00059         function &executeCommand()
00060         {
00061                 $next_class = $this->ctrl->getNextClass($this);
00062                 $cmd = $this->ctrl->getCmd();
00063                 $this->prepareOutput();
00064 
00065                 switch($next_class)
00066                 {
00067                         
00068                         case 'ilpermissiongui':
00069                                 include_once("./classes/class.ilPermissionGUI.php");
00070                                 $perm_gui =& new ilPermissionGUI($this);
00071                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
00072                                 break;
00073 
00074                         default:
00075                                 if($cmd == "" || $cmd == "view")
00076                                 {
00077                                         $cmd = "settings";
00078                                 }
00079                                 $cmd .= "Object";
00080                                 $this->$cmd();
00081 
00082                                 break;
00083                 }
00084                 return true;
00085         }
00086 
00087 
00092         function saveObject()
00093         {
00094                 global $rbacadmin;
00095 
00096                 // create and insert forum in objecttree
00097                 $newObj = parent::saveObject();
00098 
00099                 // setup rolefolder & default local roles
00100                 //$roles = $newObj->initDefaultRoles();
00101 
00102                 // put here object specific stuff
00103 
00104                 // always send a message
00105                 ilUtil::sendInfo($this->lng->txt("object_added"),true);
00106 
00107                 $this->ctrl->redirect($this);
00108                 //header("Location:".$this->getReturnLocation("save","adm_object.php?".$this->link_params));
00109                 //exit();
00110         }
00111 
00112 
00116         function settingsObject()
00117         {
00118                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.advanced_editing.html");
00119                 
00120                 $this->tpl->setCurrentBlock("adm_content");
00121                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00122                 $this->tpl->setVariable("TXT_ADVANCED_EDITING_SETTINGS", $this->lng->txt("advanced_editing_settings"));
00123                 $this->tpl->setVariable("TXT_ALLOW_JAVASCRIPT_EDITOR", $this->lng->txt("advanced_editing_allow_javascript_editor"));
00124                 $this->tpl->setVariable("NO_RTE_EDITOR", $this->lng->txt("advanced_editing_no_rte"));
00125                 $this->tpl->setVariable("TINY_MCE_EDITOR", $this->lng->txt("advanced_editing_tinymce"));
00126                 $editor = $this->object->_getRichTextEditor();
00127                 switch ($editor)
00128                 {
00129                         case "tinymce":
00130                                 $this->tpl->setVariable("SELECTED_TINY_MCE_EDITOR", " selected=\"selected\"");
00131                                 break;
00132                 }
00133                 
00134                 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00135 
00136                 $this->tpl->parseCurrentBlock();
00137         }
00138         
00142         function assessmentObject()
00143         {
00144                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.advanced_editing_assessment.html");
00145                 
00146                 $alltags =& $this->object->getHTMLTags();
00147                 $usedtags =& $this->object->_getUsedHTMLTags("assessment");
00148                 foreach ($alltags as $tag)
00149                 {
00150                         $this->tpl->setCurrentBlock("html_tag_row");
00151                         $this->tpl->setVariable("HTML_TAG", $tag);
00152                         if (is_array($usedtags))
00153                         {
00154                                 if (in_array($tag, $usedtags))
00155                                 {
00156                                         $this->tpl->setVariable("HTML_TAG_SELECTED", " selected=\"selected\"");
00157                                 }
00158                         }
00159                         $this->tpl->parseCurrentBlock();
00160                 }
00161                 
00162                 $this->tpl->setCurrentBlock("adm_content");
00163                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00164                 $this->tpl->setVariable("TXT_ASSESSMENT_SETTINGS", $this->lng->txt("advanced_editing_assessment_settings"));
00165                 $this->tpl->setVariable("TXT_ALLOW_HTML_TAGS", $this->lng->txt("advanced_editing_allow_html_tags"));
00166                 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00167 
00168                 $this->tpl->parseCurrentBlock();
00169         }
00170         
00171         
00175         function surveyObject()
00176         {
00177                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.advanced_editing_survey.html");
00178                 
00179                 $alltags =& $this->object->getHTMLTags();
00180                 $usedtags =& $this->object->_getUsedHTMLTags("survey");
00181                 foreach ($alltags as $tag)
00182                 {
00183                         $this->tpl->setCurrentBlock("html_tag_row");
00184                         $this->tpl->setVariable("HTML_TAG", $tag);
00185                         if (is_array($usedtags))
00186                         {
00187                                 if (in_array($tag, $usedtags))
00188                                 {
00189                                         $this->tpl->setVariable("HTML_TAG_SELECTED", " selected=\"selected\"");
00190                                 }
00191                         }
00192                         $this->tpl->parseCurrentBlock();
00193                 }
00194                 
00195                 $this->tpl->setCurrentBlock("adm_content");
00196                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00197                 $this->tpl->setVariable("TXT_SURVEY_SETTINGS", $this->lng->txt("advanced_editing_survey_settings"));
00198                 $this->tpl->setVariable("TXT_ALLOW_HTML_TAGS", $this->lng->txt("advanced_editing_allow_html_tags"));
00199                 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00200 
00201                 $this->tpl->parseCurrentBlock();
00202         }
00203         
00207         function learningModuleObject()
00208         {
00209                 global $ilSetting;
00210 
00211                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.advanced_editing_learning_module.html");
00212                                 
00213                 $this->tpl->setCurrentBlock("adm_content");
00214                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00215                 $this->tpl->setVariable("TXT_LM_SETTINGS", $this->lng->txt("advanced_editing_lm_settings"));
00216                 $this->tpl->setVariable("TXT_LM_JS_EDITING", $this->lng->txt("advanced_editing_lm_js_editing"));
00217                 $this->tpl->setVariable("TXT_LM_JS_EDITING_DESC", $this->lng->txt("advanced_editing_lm_js_editing_desc"));
00218                 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00219 
00220                 if ($ilSetting->get("enable_js_edit"))
00221                 {
00222                         $this->tpl->setVariable("JS_EDIT", "checked=\"checked\"");
00223                 }
00224 
00225                 $this->tpl->parseCurrentBlock();
00226         }
00227 
00231         function saveLearningModuleSettingsObject()
00232         {
00233                 global $ilSetting;
00234 
00235                 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"),true);
00236                 $ilSetting->set("enable_js_edit", $_POST["js_edit"]);
00237                 $this->ctrl->redirect($this, 'learningmodule');
00238         }
00239 
00243         function categoryObject()
00244         {
00245                 global $ilSetting, $tree;
00246 
00247                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.advanced_editing_category.html");
00248                                 
00249                 $this->tpl->setCurrentBlock("adm_content");
00250                 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00251                 $this->tpl->setVariable("TXT_CAT_SETTINGS", $this->lng->txt("adve_cat_settings"));
00252                 $this->tpl->setVariable("TXT_CAT_PAGE_EDITING", $this->lng->txt("advanced_editing_cat_page_editing"));
00253                 $this->tpl->setVariable("TXT_CAT_PAGE_EDITING_DESC", $this->lng->txt("advanced_editing_cat_page_editing_desc"));
00254                 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00255                 
00256                 $this->tpl->setVariable("TXT_CAT_PAGES",
00257                         $this->lng->txt("cat_pages"));
00258                 $this->tpl->setVariable("TXT_UNDO_LAST_CAT_CHANGES",
00259                         $this->lng->txt("cat_undo_last_page_changes"));
00260                 $this->tpl->setVariable("TXT_CLEAR_CAT_PAGE",
00261                         $this->lng->txt("cat_clear_page"));
00262                         
00263                 $root_node = $tree->getNodeData(ROOT_FOLDER_ID);
00264                 $nodes = $tree->getSubTree($root_node, true, "cat");
00265                 $cats[0] = $this->lng->txt("please_select");
00266                 $cats[$root_node["ref_id"]] = "- ".$this->lng->txt("repository");
00267                 foreach($nodes as $node)
00268                 {
00269                         $cats[$node["ref_id"]] = str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;",($node["depth"]-1))."- ".$node["title"];
00270                 }
00271                 $this->tpl->setVariable("SELECT_CATEGORY",
00272                         ilUtil::formSelect("", "cat_id", $cats, false, true));
00273 
00274                 if ($ilSetting->get("enable_cat_page_edit"))
00275                 {
00276                         $this->tpl->setVariable("CAT_PAGE_EDIT", "checked=\"checked\"");
00277                 }
00278 
00279                 $this->tpl->parseCurrentBlock();
00280         }
00281 
00285         function saveCategorySettingsObject()
00286         {
00287                 global $ilSetting;
00288 
00289                 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"), true);
00290                 $ilSetting->set("enable_cat_page_edit", $_POST["cat_page_edit"]);
00291                 $this->ctrl->redirect($this, 'category');
00292         }
00293 
00297         function undoLastCategoryChangeObject()
00298         {
00299                 global $ilSetting;
00300 
00301                 include_once("classes/class.ilContainer.php");
00302                 $xpage_id = ilContainer::_lookupContainerSetting(
00303                         ilObject::_lookupObjId($_POST["cat_id"]),
00304                         "xhtml_page");
00305                 if ($xpage_id > 0)
00306                 {
00307                         ilUtil::sendInfo($this->lng->txt("cat_pages_undone"), true);
00308                         include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
00309                         $xpage = new ilXHTMLPage($xpage_id);
00310                         $xpage->undo();
00311                 }
00312                 else
00313                 {
00314                         ilUtil::sendInfo($this->lng->txt("cat_pages_not_created"), true);
00315                 }
00316 
00317                 $this->ctrl->redirect($this, 'category');
00318         }
00319 
00323         function clearCategoryPageObject()
00324         {
00325                 global $ilSetting;
00326 
00327                 include_once("classes/class.ilContainer.php");
00328                 $xpage_id = ilContainer::_lookupContainerSetting(
00329                         ilObject::_lookupObjId($_POST["cat_id"]),
00330                         "xhtml_page");
00331                 if ($xpage_id > 0)
00332                 {
00333                         ilUtil::sendInfo($this->lng->txt("cat_pages_clear"), true);
00334                         include_once("Services/XHTMLPage/classes/class.ilXHTMLPage.php");
00335                         $xpage = new ilXHTMLPage($xpage_id);
00336                         $xpage->clear();
00337                 }
00338                 else
00339                 {
00340                         ilUtil::sendInfo($this->lng->txt("cat_pages_not_created"), true);
00341                 }
00342 
00343                 $this->ctrl->redirect($this, 'category');
00344         }
00345 
00349         function saveSettingsObject()
00350         {
00351                 $this->object->_setRichTextEditor($_POST["rte"]);
00352                 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"),true);
00353 
00354                 $this->ctrl->redirect($this,'settings');
00355         }
00356         
00357         function saveAssessmentSettingsObject()
00358         {
00359                 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"),true);
00360 
00361                 $this->object->_setUsedHTMLTags($_POST["html_tags"], "assessment");
00362                 $this->ctrl->redirect($this,'assessment');
00363         }
00364         
00365         function saveSurveySettingsObject()
00366         {
00367                 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"),true);
00368 
00369                 $this->object->_setUsedHTMLTags($_POST["html_tags"], "survey");
00370                 $this->ctrl->redirect($this,'survey');
00371         }
00372         
00373         function getAdminTabs(&$tabs_gui)
00374         {
00375                 $this->getTabs($tabs_gui);
00376         }
00377         
00378         function addSubtabs(&$tabs_gui)
00379         {
00380                 global $ilCtrl;
00381                 
00382                 if ($ilCtrl->getNextClass() != "ilpermissiongui")
00383                 {
00384                         $tabs_gui->addSubTabTarget("adve_general_settings",
00385                                                                                          $this->ctrl->getLinkTarget($this, "settings"),
00386                                                                                          array("", "view", "settings", "saveSettings"),
00387                                                                                          "", "");
00388                         $tabs_gui->addSubTabTarget("adve_assessment_settings",
00389                                                                                          $this->ctrl->getLinkTarget($this, "assessment"),
00390                                                                                          array("assessment", "saveAssessmentSettings"),
00391                                                                                          "", "");
00392                         $tabs_gui->addSubTabTarget("adve_survey_settings",
00393                                                                                          $this->ctrl->getLinkTarget($this, "survey"),
00394                                                                                          array("survey", "saveSurveySettings"),
00395                                                                                          "", "");
00396                         $tabs_gui->addSubTabTarget("adve_cat_settings",
00397                                                                                          $this->ctrl->getLinkTarget($this, "category"),
00398                                                                                          array("category", "saveCategorySettings"),
00399                                                                                          "", "");
00400                         $tabs_gui->addSubTabTarget("adve_lm_settings",
00401                                                                                          $this->ctrl->getLinkTarget($this, "learningModule"),
00402                                                                                          array("learningModule", "saveLearningModuleSettings"),
00403                                                                                          "", "");
00404                 }
00405         }
00406         
00412         function getTabs(&$tabs_gui)
00413         {
00414                 global $rbacsystem;
00415 
00416                 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00417                 {
00418                         $tabs_gui->addTarget("settings",
00419                                 $this->ctrl->getLinkTarget($this, "settings"),
00420                                         array("settings","","view", "assessment", "survey", "learningModule",
00421                                         "category"), "", "");
00422                         
00423                 }
00424 
00425                 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
00426                 {
00427                         $tabs_gui->addTarget("perm_settings",
00428                                 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
00429                 }
00430                 $this->addSubtabs($tabs_gui);
00431         }
00432 } // END class.ilObjAdvancedEditingGUI
00433 ?>

Generated on Fri Dec 13 2013 17:56:47 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1