コード例 #1
0
 /**
  * list fields
  */
 public function listFields()
 {
     // Show tables
     require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php";
     $tables = $this->parent_obj->object->getTables();
     foreach ($tables as $table) {
         $options[$table->getId()] = $table->getTitle();
     }
     include_once './Services/Form/classes/class.ilSelectInputGUI.php';
     $table_selection = new ilSelectInputGUI('', 'table_id');
     $table_selection->setOptions($options);
     $table_selection->setValue($this->table_id);
     $this->toolbar->setFormAction($this->ctrl->getFormActionByClass("ilDataCollectionFieldListGUI", "doTableSwitch"));
     $this->toolbar->addText($this->lng->txt("dcl_table"));
     $this->toolbar->addInputItem($table_selection);
     $this->toolbar->addFormButton($this->lng->txt('change'), 'doTableSwitch');
     $this->toolbar->addSeparator();
     $this->toolbar->addButton($this->lng->txt("dcl_add_new_table"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "create"));
     $this->toolbar->addSeparator();
     $this->ctrl->setParameterByClass("ildatacollectiontableeditgui", "table_id", $this->table_id);
     $this->toolbar->addButton($this->lng->txt("dcl_table_settings"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "edit"));
     $this->toolbar->addButton($this->lng->txt("dcl_delete_table"), $this->ctrl->getLinkTargetByClass("ildatacollectiontableeditgui", "confirmDelete"));
     $this->toolbar->addButton($this->lng->txt("dcl_add_new_field"), $this->ctrl->getLinkTargetByClass("ildatacollectionfieldeditgui", "create"));
     // requested not to implement this way...
     //        $tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js");
     require_once './Modules/DataCollection/classes/class.ilDataCollectionFieldListTableGUI.php';
     $list = new ilDataCollectionFieldListTableGUI($this, $this->ctrl->getCmd(), $this->table_id);
     $this->tpl->setContent($list->getHTML());
 }
コード例 #2
0
 public function appendToolbarSwitch(ilToolbarGUI $toolbar, $a_obj_type, $a_ref_id)
 {
     include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSettings.php';
     $tpls = ilDidacticTemplateSettings::getInstanceByObjectType($a_obj_type)->getTemplates();
     if (!count($tpls)) {
         return false;
     }
     // Add template switch
     $toolbar->addText($this->lng->txt('didactic_selected_tpl_option'));
     // Show template options
     $options = array(0 => $this->lng->txt('didactic_default_type'));
     foreach ($tpls as $tpl) {
         $options[$tpl->getId()] = $tpl->getTitle();
     }
     include_once './Services/Form/classes/class.ilSelectInputGUI.php';
     include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
     $tpl_selection = new ilSelectInputGUI('', 'tplid');
     $tpl_selection->setOptions($options);
     $tpl_selection->setValue(ilDidacticTemplateObjSettings::lookupTemplateId($this->getParentObject()->object->getRefId()));
     $toolbar->addInputItem($tpl_selection);
     // Apply templates switch
     $toolbar->addFormButton($this->lng->txt('change'), 'confirmTemplateSwitch');
     return true;
 }