/** * Constructor */ function __construct($a_parent_obj, $a_parent_cmd, $a_type) { global $ilCtrl, $lng, $ilAccess, $lng; $this->setId("admsettemp" . $a_type); parent::__construct($a_parent_obj, $a_parent_cmd); include_once "./Services/Administration/classes/class.ilSettingsTemplate.php"; $this->setData(ilSettingsTemplate::getAllSettingsTemplates($a_type)); $this->setTitle($lng->txt("adm_settings_templates") . " - " . $lng->txt("obj_" . $a_type)); $this->addColumn("", "", "1", true); $this->addColumn($this->lng->txt("title"), "title"); $this->addColumn($this->lng->txt("description")); $this->addColumn($this->lng->txt("actions")); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj)); $this->setRowTemplate("tpl.settings_template_row.html", "Services/Administration"); $this->addMultiCommand("confirmSettingsTemplateDeletion", $lng->txt("delete")); //$this->addCommandButton("", $lng->txt("")); }
/** * form for new survey object import */ function importFileObject() { global $tpl, $ilErr; $parent_id = $_GET["ref_id"]; $new_type = $_REQUEST["new_type"]; // create permission is already checked in createObject. This check here is done to prevent hacking attempts if (!$this->checkPermissionBool("create", "", $new_type)) { $ilErr->raiseError($this->lng->txt("no_create_permission")); } $this->lng->loadLanguageModule($new_type); $this->ctrl->setParameter($this, "new_type", $new_type); $form = $this->initImportForm($new_type); if ($form->checkInput()) { include_once "./Modules/Survey/classes/class.ilObjSurvey.php"; $newObj = new ilObjSurvey(); $newObj->setType($new_type); $newObj->setTitle("dummy"); $newObj->setDescription("dummy"); $newObj->create(true); $this->putObjectInTree($newObj); // copy uploaded file to import directory $error = $newObj->importObject($_FILES["importfile"], $form->getInput("spl")); if (strlen($error)) { $newObj->delete(); $this->ilias->raiseError($error, $this->ilias->error_obj->MESSAGE); return; } ilUtil::sendSuccess($this->lng->txt("object_imported"), true); ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() . "&baseClass=ilObjSurveyGUI"); // using template? include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("svy"); if ($templates) { global $tpl; $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery.js"); // $tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery-ui-min.js"); $this->tpl->setCurrentBlock("template_option"); $this->tpl->setVariable("VAL_TEMPLATE_OPTION", ""); $this->tpl->setVariable("TXT_TEMPLATE_OPTION", $this->lng->txt("none")); $this->tpl->parseCurrentBlock(); foreach ($templates as $item) { $this->tpl->setCurrentBlock("template_option"); $this->tpl->setVariable("VAL_TEMPLATE_OPTION", $item["id"]); $this->tpl->setVariable("TXT_TEMPLATE_OPTION", $item["title"]); $this->tpl->parseCurrentBlock(); $desc = str_replace("\n", "", nl2br($item["description"])); $desc = str_replace("\r", "", $desc); $this->tpl->setCurrentBlock("js_data"); $this->tpl->setVariable("JS_DATA_ID", $item["id"]); $this->tpl->setVariable("JS_DATA_TEXT", $desc); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("templates"); $this->tpl->setVariable("TXT_TEMPLATE", $this->lng->txt("svy_settings_template")); $this->tpl->parseCurrentBlock(); } } // display form to correct errors $form->setValuesByPost(); $tpl->setContent($form->getHtml()); }
function addDidacticTemplateOptions(array &$a_options) { include_once "./Modules/Test/classes/class.ilObjTest.php"; $tst = new ilObjTest(); $defaults = $tst->getAvailableDefaults(); if (count($defaults)) { foreach ($defaults as $row) { $a_options["tstdef_" . $row["test_defaults_id"]] = array($row["name"], $this->lng->txt("tst_default_settings")); } } // using template? include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("tst"); if ($templates) { foreach ($templates as $item) { $a_options["tsttpl_" . $item["id"]] = array($item["title"], nl2br(trim($item["description"]))); } } }
/** * Create plugin specific data * @access public */ public function doCreate() { /** * @var $ilCtrl ilCtrl */ global $ilCtrl; $cmdClass = $ilCtrl->getCmdClass(); if (isset($_POST['tpl_id']) && (int) $_POST['tpl_id'] > 0) { $tpl_id = (int) $_POST['tpl_id']; } else { throw new ilException('no_template_id_given'); } include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("xavc"); foreach ($templates as $template) { if ((int) $template['id'] == $tpl_id) { $template_settings = array(); if ($template['id']) { $objTemplate = new ilSettingsTemplate($template['id']); $template_settings = $objTemplate->getSettings(); } } } // reuse existing ac-room if (isset($_POST['creation_type']) && $_POST['creation_type'] == 'existing_vc' && $template_settings['reuse_existing_rooms']['hide'] == '0') { // 1. the sco-id will be assigned to this new ilias object $sco_id = (int) $_POST['available_rooms']; try { $this->useExistingVC($this->getId(), $sco_id); } catch (ilException $e) { $this->creationRollback(); throw new ilException($this->txt($e->getMessage())); } return; } if (strlen($_POST['instructions']) > 0) { $post_instructions = (string) $_POST['instructions']; } else { if (strlen($_POST['instructions_2']) > 0) { $post_instructions = (string) $_POST['instructions_2']; } else { if (strlen($_POST['instructions_3']) > 0) { $post_instructions = (string) $_POST['instructions_3']; } } } if (strlen($_POST['contact_info']) > 0) { $post_contact = (string) $_POST['contact_info']; } else { if (strlen($_POST['contact_info_2']) > 0) { $post_contact = (string) $_POST['contact_info_2']; } else { if (strlen($_POST['contact_info_3']) > 0) { $post_contact = (string) $_POST['contact_info_3']; } } } $this->setInstructions($post_instructions); $this->setContactInfo($post_contact); if (isset($_POST['time_type_selection']) && $_POST['time_type_selection'] == 'permanent_room') { $this->setPermanentRoom(1); } else { if (!isset($_POST['time_type_selection']) && ilAdobeConnectServer::getSetting('default_perm_room') == 1) { $this->setPermanentRoom(1); } else { $this->setPermanentRoom(0); } } if (isset($_POST['access_level'])) { $this->setPermission($_POST['access_level']); } else { $this->setPermission(ilObjAdobeConnect::ACCESS_LEVEL_PROTECTED); } $this->pluginObj->includeClass('class.ilXAVCPermissions.php'); $this->setReadContents(ilXAVCPermissions::lookupPermission(AdobeConnectPermissions::PERM_READ_CONTENTS, 'view')); $this->setReadRecords(ilXAVCPermissions::lookupPermission(AdobeConnectPermissions::PERM_READ_RECORDS, 'view')); $this->externalLogin = $this->checkExternalUser(); $folder_id = $this->getFolderIdByLogin($this->externalLogin); $this->setFolderId($folder_id); if ($cmdClass == 'ilobjectcopygui') { $now = new ilDateTime(time(), IL_CAL_UNIX); $this->start_date = new ilDateTime($now->getUnixTime() - 7200, IL_CAL_UNIX); $this->duration = array('hours' => 1, 'minutes' => 0); $this->publishCreationAC($this->getId(), $this->getTitle(), $this->getDescription(), $this->getStartDate(), $this->getEnddate(), $this->getInstructions(), $this->getContactInfo(), $this->getPermanentRoom(), $this->getPermission(), $this->getReadContents(), $this->getReadRecords(), $this->getFolderId()); return; } try { if (isset($_POST['start_date']) && $template_settings['start_date']['hide'] == '0') { //start_date $this->start_date = new ilDateTime($_POST['start_date']['date'] . ' ' . $_POST['start_date']['time'], IL_CAL_DATETIME); } else { $this->start_date = new ilDateTime(time() + 120, IL_CAL_UNIX); } // duration if (isset($_POST['duration']['hh']) && isset($_POST['duration']['mm']) && ($_POST['duration']['hh'] > 0 || $_POST['duration']['mm'] > 0) && $template_settings['duration']['hide'] == '0') { $this->duration = array('hours' => $_POST['duration']['hh'], 'minutes' => $_POST['duration']['mm']); } else { $this->duration = array('hours' => (int) $template_settings['duration']['value'], 'minutes' => 0); } //end_date $this->end_date = $this->getEnddate(); $concurrent_vc = count($this->checkConcurrentMeetingDates()); $max_rep_obj_vc = ilAdobeConnectServer::getSetting('ac_interface_objects'); if ((int) $max_rep_obj_vc > 0 && $concurrent_vc >= $max_rep_obj_vc) { throw new ilException('xavc_reached_number_of_connections'); } $this->publishCreationAC($this->getId(), $this->getTitle(), $this->getDescription(), $this->getStartDate(), $this->getEnddate(), $this->getInstructions(), $this->getContactInfo(), $this->getPermanentRoom(), $this->getPermission(), $this->getReadContents(), $this->getReadRecords(), $this->getFolderId()); } catch (ilException $e) { $this->creationRollback(); throw new ilException($this->txt($e->getMessage())); } }
/** * Save object * @access public */ public function save() { /** * @var $rbacsystem $rbacsystem * @var $lng $lng * @var $objDefinition ilObjectDefinition */ global $rbacsystem, $objDefinition, $lng; $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"]; // create permission is already checked in createObject. This check here is done to prevent hacking attempts if (!$rbacsystem->checkAccess("create", (int) $_GET["ref_id"], $new_type)) { $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE); } $this->ctrl->setParameter($this, "new_type", $new_type); if (isset($_POST['tpl_id']) && (int) $_POST['tpl_id'] > 0) { $tpl_id = (int) $_POST['tpl_id']; } else { $this->ilias->raiseError($this->lng->txt("no_template_id_given"), $this->ilias->error_obj->MESSAGE); } include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("xavc"); foreach ($templates as $template) { if ($template['id'] == $tpl_id) { $form = $this->initCreateForm($template); $selected_template = $template; $template_settings = array(); if ($template['id']) { $objTemplate = new ilSettingsTemplate($template['id']); $template_settings = $objTemplate->getSettings(); } } } if ($form->checkInput()) { if ($form->getInput('creation_type') == 'existing_vc' && $template_settings['reuse_existing_rooms']['hide'] == '0') { try { $location = $objDefinition->getLocation($new_type); $this->pluginObj->includeClass('class.ilAdobeConnectUserUtil.php'); $ilAdobeConnectUser = new ilAdobeConnectUserUtil($this->user->getId()); $xavc_login = $ilAdobeConnectUser->getXAVCLogin(); $folder_id = $ilAdobeConnectUser->ensureUserFolderExistance($xavc_login); $sco_ids = ilObjAdobeConnect::getScosByFolderId($folder_id); $title = $sco_ids[$form->getInput('available_rooms')]['sco_name']; $description = $sco_ids[$form->getInput('available_rooms')]['description']; // create and insert object in objecttree $class_name = "ilObj" . $objDefinition->getClassName($new_type); include_once $location . "/class." . $class_name . ".php"; /** @var $newObj ilObjAdobeConnect */ $newObj = new $class_name(); $newObj->setType($new_type); $newObj->setTitle(ilUtil::stripSlashes($title)); $newObj->setDescription(ilUtil::stripSlashes($description)); $newObj->create(); $newObj->createReference(); $newObj->putInTree($_GET["ref_id"]); $newObj->setPermissions($_GET["ref_id"]); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); $this->afterSave($newObj); return; } catch (Exception $e) { ilUtil::sendFailure($e->getMessage(), true); } } else { global $ilUser; $owner = $ilUser->getId(); if (strlen($form->getInput('owner')) > 1) { if (ilObjUser::_lookupId($form->getInput('owner')) > 0) { $owner = ilObjUser::_lookupId($form->getInput('owner')); } else { ilUtil::sendFailure($this->lng->txt('user_not_found')); $owner = 0; } } if ($template_settings['duration']['hide'] == '1') { $durationValid = true; } else { if ($form->getInput('time_type_selection') == 'permanent_room' && ilAdobeConnectServer::getSetting('enable_perm_room', '1')) { $duration['hh'] = 2; $duration['mm'] = 0; } else { $duration = $form->getInput("duration"); } if ($duration['hh'] * 60 + $duration['mm'] < 10) { $form->getItemByPostVar('duration')->setAlert($this->pluginObj->txt('min_duration_error')); $durationValid = false; } else { $durationValid = true; } } if ($template_settings['start_date']['hide'] == '1') { $time_mismatch = false; } else { if ($durationValid) { require_once dirname(__FILE__) . '/class.ilAdobeConnectServer.php'; $serverConfig = ilAdobeConnectServer::_getInstance(); $minTime = new ilDateTime(time() + $serverConfig->getScheduleLeadTime() * 60 * 60, IL_CAL_UNIX); $newStartDate = $form->getItemByPostVar("start_date")->getDate(); $time_mismatch = false; if (ilDateTime::_before($newStartDate, $minTime) && $form->getInput('time_type_selection') != 'permanent_room') { ilUtil::sendFailure(sprintf($this->pluginObj->txt('xavc_lead_time_mismatch_create'), ilDatePresentation::formatDate($minTime)), true); $time_mismatch = true; } } } if (!$time_mismatch && $owner > 0) { try { if ($durationValid) { $location = $objDefinition->getLocation($new_type); // create and insert object in objecttree $class_name = "ilObj" . $objDefinition->getClassName($new_type); include_once $location . "/class." . $class_name . ".php"; /** @var $newObj ilObjAdobeConnect */ $newObj = new $class_name(); $newObj->setType($new_type); $newObj->setTitle(ilUtil::stripSlashes($_POST["title"])); $newObj->setDescription(ilUtil::stripSlashes($_POST["desc"])); $newObj->setOwner($owner); $newObj->create(); $newObj->createReference(); $newObj->putInTree($_GET["ref_id"]); $newObj->setPermissions($_GET["ref_id"]); ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true); $this->afterSave($newObj); return; } } catch (Exception $e) { ilUtil::sendFailure($e->getMessage(), true); } } } $form->setValuesByPost(); if (ilAdobeConnectServer::getSetting('show_free_slots')) { $this->showCreationForm($form); } else { $this->tpl->setContent($form->getHtml()); } } else { $form->setValuesByPost(); $this->tpl->setContent($form->getHTML()); return; } }
/** * Apply auto generated setttings template * @param ilObjTest $tst */ protected function applySettingsTemplate(ilObjTest $tst) { include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; include_once './Modules/Test/classes/class.ilObjAssessmentFolderGUI.php'; $tpl_id = 0; foreach (ilSettingsTemplate::getAllSettingsTemplates('tst', true) as $nr => $template) { switch ($this->getTestType()) { case self::TEST_TYPE_IT: if ($template['title'] == self::SETTINGS_TEMPLATE_IT) { $tpl_id = $template['id']; } break; case self::TEST_TYPE_QT: if ($template['title'] == self::SETTINGS_TEMPLATE_QT) { $tpl_id = $template['id']; } break; } if ($tpl_id) { break; } } if (!$tpl_id) { return false; } include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; include_once './Modules/Test/classes/class.ilObjAssessmentFolderGUI.php'; $template = new ilSettingsTemplate($tpl_id, ilObjAssessmentFolderGUI::getSettingsTemplateConfig()); $template_settings = $template->getSettings(); if ($template_settings) { include_once './Modules/Test/classes/class.ilObjTestGUI.php'; $tst_gui = new ilObjTestGUI(); $tst_gui->applyTemplate($template_settings, $tst); } $tst->setTemplate($tpl_id); return true; }
public function initIliasSettingsForm() { /** * @var $ilCtrl ilCtrl */ global $lng, $ilCtrl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveIliasSettings')); $this->form->setTitle($this->getPluginObject()->txt('general_settings')); $this->form->addCommandButton('saveIliasSettings', $lng->txt('save')); $this->form->addCommandButton('cancelIliasSettings', $lng->txt('cancel')); $cb_group = new ilCheckboxGroupInputGUI($this->pluginObj->txt('object_creation_settings'), 'obj_creation_settings'); include_once "Services/Administration/classes/class.ilSettingsTemplate.php"; $templates = ilSettingsTemplate::getAllSettingsTemplates("xavc"); if ($templates) { foreach ($templates as $item) { $cb_simple = new ilCheckboxOption($this->pluginObj->txt($item["title"]), $item["id"]); $cb_group->addOption($cb_simple); } } $cb_group->setInfo($this->pluginObj->txt('template_info')); $this->form->addItem($cb_group); $obj_title_suffix = new ilCheckboxInputGUI($this->pluginObj->txt('obj_title_suffix'), 'obj_title_suffix'); $obj_title_suffix->setInfo($this->pluginObj->txt('obj_title_suffix_info')); $this->form->addItem($obj_title_suffix); $crs_grp_trigger = new ilCheckboxInputGUI($this->pluginObj->txt('allow_crs_grp_trigger'), 'allow_crs_grp_trigger'); $crs_grp_trigger->setInfo($this->pluginObj->txt('allow_crs_grp_trigger_info')); $this->form->addItem($crs_grp_trigger); $show_free_slots = new ilCheckboxInputGUI($this->pluginObj->txt('show_free_slots'), 'show_free_slots'); $show_free_slots->setInfo($this->pluginObj->txt('show_free_slots_info')); $this->form->addItem($show_free_slots); $enable_perm_room = new ilCheckboxInputGUI($this->pluginObj->txt('enable_perm_room'), 'enable_perm_room'); $enable_perm_room->setInfo($this->pluginObj->txt('enable_perm_room_info')); $default_perm_room = new ilCheckboxInputGUI($this->pluginObj->txt('default_perm_room'), 'default_perm_room'); $default_perm_room->setInfo($this->pluginObj->txt('default_perm_room_info')); $enable_perm_room->addSubItem($default_perm_room); $this->form->addItem($enable_perm_room); $add_to_desktop = new ilCheckboxInputGUI($this->pluginObj->txt('add_to_desktop'), 'add_to_desktop'); $add_to_desktop->setInfo($this->pluginObj->txt('add_to_desktop_info')); $this->form->addItem($add_to_desktop); $content_file_types = new ilTextInputGUI($this->pluginObj->txt('content_file_types'), 'content_file_types'); $content_file_types->setRequired(true); $content_file_types->setInfo($this->pluginObj->txt('content_file_types_info')); $this->form->addItem($content_file_types); $user_folders = new ilCheckboxInputGUI($this->pluginObj->txt('use_user_folders'), 'use_user_folders'); $user_folders->setInfo($this->pluginObj->txt('use_user_folders_info')); if (ilAdobeConnectServer::getSetting('user_assignment_mode') == ilAdobeConnectServer::ASSIGN_USER_DFN_EMAIL) { $user_folders->setDisabled(true); } $this->form->addItem($user_folders); $xavc_options = array("host" => $this->pluginObj->txt("presenter"), "mini-host" => $this->pluginObj->txt("moderator"), "view" => $this->pluginObj->txt("participant"), "denied" => $this->pluginObj->txt('denied')); $mapping_crs = new ilNonEditableValueGUI($this->pluginObj->txt('default_crs_mapping'), 'default_crs_mapping'); // $crs_owner = new ilSelectInputGUI($lng->txt('owner'), 'crs_owner'); // $crs_owner->setOptions($xavc_options); // $mapping_crs->addSubItem($crs_owner); $crs_admin = new ilSelectInputGUI($lng->txt('il_crs_admin'), 'crs_admin'); $crs_admin->setOptions($xavc_options); $mapping_crs->addSubItem($crs_admin); $crs_tutor = new ilSelectInputGUI($lng->txt('il_crs_tutor'), 'crs_tutor'); $crs_tutor->setOptions($xavc_options); $mapping_crs->addSubItem($crs_tutor); $crs_member = new ilSelectInputGUI($lng->txt('il_crs_member'), 'crs_member'); $crs_member->setOptions($xavc_options); $mapping_crs->addSubItem($crs_member); $this->form->addItem($mapping_crs); $mapping_grp = new ilNonEditableValueGUI($this->pluginObj->txt('default_grp_mapping'), 'default_grp_mapping'); // $grp_owner = new ilSelectInputGUI($lng->txt('owner'), 'grp_owner'); // $grp_owner->setOptions($xavc_options); // $mapping_grp->addSubItem($grp_owner); $grp_admin = new ilSelectInputGUI($lng->txt('il_grp_admin'), 'grp_admin'); $grp_admin->setOptions($xavc_options); $mapping_grp->addSubItem($grp_admin); $grp_member = new ilSelectInputGUI($lng->txt('il_grp_member'), 'grp_member'); $grp_member->setOptions($xavc_options); $mapping_grp->addSubItem($grp_member); $this->form->addItem($mapping_grp); $ac_permissions = ilXAVCPermissions::getPermissionsArray(); //@todo nahmad: in Template auslagern! $tbl = "<table width='100%' >\n\t\t<tr>\n\t\t<td> </td> \n\t\t<td>" . $this->pluginObj->txt('presenter') . "</td>\n\t\t<td>" . $this->pluginObj->txt('moderator') . "</td>\n\t\t<td>" . $this->pluginObj->txt('participant') . "</td>\n\t\t<td>" . $this->pluginObj->txt('denied') . "</td>\n\t\t\n\t\t</tr>"; foreach ($ac_permissions as $ac_permission => $ac_roles) { $tbl .= "<tr> <td>" . $this->pluginObj->txt($ac_permission) . "</td>"; foreach ($ac_roles as $ac_role => $ac_access) { $tbl .= "<td>"; $tbl .= ilUtil::formCheckbox((bool) $ac_access, 'permissions[' . $ac_permission . '][' . $ac_role . ']', $ac_role, false); $tbl .= "</td>"; } $tbl .= "</tr>"; } $tbl .= "</table>"; $matrix = new ilCustomInputGUI($this->pluginObj->txt('ac_permissions'), ''); $matrix->setHtml($tbl); $this->form->addItem($matrix); }