/** * */ protected function showUnitCategoryModificationForm() { if (!$this->isCRUDContext()) { $this->{$this->getDefaultCommand()}(); return; } $category = $this->getCategoryById((int) $_GET['category_id']); $this->initUnitCategoryForm($category); $this->unit_cat_form->setValuesByArray(array('category_name' => $category->getCategory())); $this->tpl->setContent($this->unit_cat_form->getHtml()); }
public function updateProperties() { $this->initPropertiesForm(); if ($this->form->checkInput()) { $this->object->setTitle($this->form->getInput('title')); $this->object->setDescription($this->form->getInput('desc')); $this->object->update(); ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true); $this->ctrl->redirect($this, 'editProperties'); } $this->form->setValuesByPost(); $this->tpl->setContent($this->form->getHtml()); }
/** * @param bool $init_from_database */ protected function settings($init_from_database = true) { /** * @var $rbacsystem ilRbacSystem * @var $ilErr ilErrorHandling * @var $tpl ilTemplate */ global $rbacsystem, $ilErr, $tpl; if (!$rbacsystem->checkAccess('read', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE); } $this->initSettingsForm(); if ($init_from_database) { $this->form->setValuesByArray(array('tos_status' => $this->object->getStatus())); } else { $this->form->setValuesByPost(); } $tpl->setContent($this->form->getHtml()); }
/** * Save form input */ public function save() { /** @var ilCtrl $ilCtrl */ global $tpl, $ilCtrl; $this->initConfigurationForm(); if ($this->form->checkInput()) { // Save Checkbox Values foreach ($this->checkboxes as $key => $cb) { if (!is_array($cb)) { $this->setValue($cb, $this->form->getInput($cb)); } else { $this->setValue($key, $this->form->getInput($key)); foreach ($cb as $field => $gui) { $this->setValue($key . '_' . $field, $this->form->getInput($key . '_' . $field)); } } } $ilCtrl->redirect($this, 'configure'); } else { $this->form->setValuesByPost(); $tpl->setContent($this->form->getHtml()); } }
public function searchUsers($save = true) { global $ilUser, $ilCtrl; $this->tpl->setTitle($this->lng->txt("mail")); if ($save) { // decode post values $files = array(); if (is_array($_POST['attachments'])) { foreach ($_POST['attachments'] as $value) { $files[] = urldecode($value); } } // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails. $this->umail->savePostData($ilUser->getId(), $files, ilUtil::securePlainString($_POST["rcp_to"]), ilUtil::securePlainString($_POST["rcp_cc"]), ilUtil::securePlainString($_POST["rcp_bcc"]), $_POST["m_type"], ilUtil::securePlainString($_POST["m_email"]), ilUtil::securePlainString($_POST["m_subject"]), ilUtil::securePlainString($_POST["m_message"]), ilUtil::securePlainString($_POST['use_placeholders'])); } include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setId('search_rcp'); $form->setTitle($this->lng->txt('search_recipients')); $form->setFormAction($ilCtrl->getFormAction($this, 'search')); $inp = new ilTextInputGUI($this->lng->txt("search_for"), 'search'); $inp->setSize(30); $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupRecipientAsync', '', true, false); $inp->setDataSource($dsDataLink); if (strlen(trim($_SESSION["mail_search_search"])) > 0) { $inp->setValue(ilUtil::prepareFormOutput(trim($_SESSION["mail_search_search"]), true)); } $form->addItem($inp); $form->addCommandButton('search', $this->lng->txt("search")); $form->addCommandButton('cancelSearch', $this->lng->txt("cancel")); $this->tpl->setContent($form->getHtml()); $this->tpl->show(); }
/** * Send chat invitations to selected Users */ public function inviteToChat() { /** * @var $ilUser ilObjUser * @var $lng ilLanguage * @var $ilCtrl ilCtrl * @var $tpl ilTemplate */ global $ilUser, $lng, $ilCtrl, $tpl; $lng->loadLanguageModule('chatroom'); $addr_ids = (int) $_GET['addr_id'] ? array((int) $_GET['addr_id']) : $_POST['addr_id']; if (!$addr_ids) { ilUtil::sendFailure($lng->txt('select_one'), true); $ilCtrl->redirect($this, 'showAddressbook'); } $no_login = array(); foreach ($addr_ids as $id) { $entry = $this->abook->getEntry($id); if (!$entry['login']) { $no_login[] = $id; } } if (count($no_login)) { $message = $lng->txt('chat_users_without_login') . ':<br>'; $list = ''; foreach ($no_login as $e) { $list .= '<li>' . $this->abook->entryToString($e) . '</li>'; } $message .= '<ul>'; $message .= $list; $message .= '</ul>'; ilUtil::sendFailure($message, true); $ilCtrl->redirect($this, 'showAddressbook'); } include_once 'Modules/Chatroom/classes/class.ilChatroom.php'; $ilChatroom = new ilChatroom(); $chat_rooms = $ilChatroom->getAllRooms($ilUser->getId()); $subrooms = array(); foreach ($chat_rooms as $room_id => $title) { $subrooms[] = $ilChatroom->getPrivateSubRooms($room_id, $ilUser->getId()); } include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setTitle($lng->txt('mail_invite_users_to_chat')); $psel = new ilSelectInputGUI($lng->txt('chat_select_room'), 'room_id'); $options = array(); foreach ($chat_rooms as $room_id => $room) { $ref_id = $room_id; if ($ilChatroom->isUserBanned($ilUser->getId())) { continue; } $options[$ref_id] = $room; foreach ($subrooms as $subroom) { foreach ($subroom as $sub_id => $parent_id) { if ($parent_id == $ref_id) { $title = ilChatroom::lookupPrivateRoomTitle($sub_id); $options[$ref_id . ',' . $sub_id] = '+ ' . $title; } } } } $psel->setOptions($options); $form->addItem($psel); $phidden = new ilHiddenInputGUI('addr_ids'); $phidden->setValue(implode(',', $addr_ids)); $form->addItem($phidden); $form->addCommandButton('submitInvitation', $this->lng->txt('submit')); $form->addCommandButton('cancel', $this->lng->txt('cancel')); $form->setFormAction($ilCtrl->getFormAction($this)); $tpl->setTitle($lng->txt('mail_invite_users_to_chat')); $tpl->setContent($form->getHtml()); $tpl->show(); }
private function showCreationForm(ilPropertyFormGUI $form) { global $tpl; require_once dirname(__FILE__) . '/class.ilObjAdobeConnect.php'; require_once dirname(__FILE__) . '/class.ilAdobeConnectServer.php'; $num_max_ac_obj = ilAdobeConnectServer::getSetting('ac_interface_objects'); if ((int) $num_max_ac_obj <= 0) { $tpl->setContent($form->getHtml()); return 0; } $fromtime = strtotime(date('Y-m-d H:00', time())); $totime = strtotime(date('Y-m-d', time() + 60 * 60 * 24 * 15)) - 1; $meetings = ilObjAdobeConnect::getMeetingsInRange($fromtime, $totime); $meetingsByDay = $this->getFreeMeetingSlotTable($meetings); $ranges = array(); $t0 = $fromtime; $t1 = $fromtime; /* * 2 * 30 minutes for starting and ending buffer * 10 minutes as minimum meeting length */ $bufferingTime = 30 * 60 * 2 + 10 * 60; $prev_dayinmonth = date('d', $t1); for (; $t1 < $totime; $t1 += 60 * 15) { $day = date('Y-m-d', $t1); $hour = date('H', $t1) * 60 + floor(date('i', $t1) / 15) * 15; $dayinmonth = date('d', $t1); if ($meetingsByDay[$day] && $meetingsByDay[$day][$hour] && $meetingsByDay[$day][$hour] >= $num_max_ac_obj || $dayinmonth != $prev_dayinmonth) { if ($t0 != $t1 && $t1 - $t0 > $bufferingTime) { $ranges[] = array($t0, $t1 - 1, $t1 - $t0); } if ($dayinmonth != $prev_dayinmonth) { $prev_dayinmonth = $dayinmonth; $t0 = $t1; } else { $t0 = $t1 + 60 * 15; } } } if ($t0 != $t1) { $ranges[] = array($t0, $t1 - 1, $t1 - $t0); } $data = array(); foreach ($ranges as $r) { $size_hours = floor($r[2] / 60 / 60); $size_minutes = ($r[2] - $size_hours * 60 * 60) / 60; $data[] = array('sched_from' => ilDatePresentation::formatDate(new ilDateTime($r[0], IL_CAL_UNIX)), 'sched_to' => ilDatePresentation::formatDate(new ilDateTime($r[1], IL_CAL_UNIX)), 'sched_size' => str_pad($size_hours, 2, '0', STR_PAD_LEFT) . ':' . str_pad($size_minutes, 2, '0', STR_PAD_LEFT)); } require_once 'Services/Table/classes/class.ilTable2GUI.php'; $tgui = new ilTable2GUI($this); $tgui->addColumn($this->txt('sched_from')); $tgui->addColumn($this->txt('sched_to')); $tgui->addColumn($this->txt('sched_size')); $tgui->setExternalSegmentation(true); $tgui->enabled['footer'] = false; // $tgui->setRowTemplate('tpl.schedule_row.html', 'Customizing/global/plugins/Services/Repository/RepositoryObject/AdobeConnect'); $tgui->setRowTemplate('tpl.schedule_row.html', $this->pluginObj->getDirectory()); $tgui->setData($data); $tgui->setTitle(sprintf($this->txt('schedule_free_slots'), date('z', $totime - $fromtime))); $tpl->setContent($form->getHtml() . '<br />' . $tgui->getHTML()); }
public function showSettingsObject() { global $tpl, $ilCtrl, $ilUser, $lng; require_once 'Services/Notifications/classes/class.ilNotificationSettingsTable.php'; require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php'; $userTypes = ilNotificationDatabaseHandler::loadUserConfig($ilUser->getId()); $lng->loadLanguageModule('notification'); require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $chk = new ilCheckboxInputGUI($lng->txt('enable_custom_notification_configuration'), 'enable_custom_notification_configuration'); $chk->setValue('1'); $chk->setChecked($ilUser->getPref('use_custom_notification_setting') == 1); $form->addItem($chk); $form->setFormAction($ilCtrl->getFormAction($this, 'showSettingsObject')); $form->addCommandButton('saveCustomizingOption', $lng->txt('save')); $form->addCommandButton('showSettings', $lng->txt('cancel')); $table = new ilNotificationSettingsTable($this, 'a title', $this->getAvailableChannels(array('set_by_user')), $userTypes); $table->setFormAction($ilCtrl->getFormAction($this, 'saveSettings')); $table->setData($this->getAvailableTypes(array('set_by_user'))); if ($ilUser->getPref('use_custom_notification_setting') == 1) { $table->addCommandButton('saveSettings', $lng->txt('save')); $table->addCommandButton('showSettings', $lng->txt('cancel')); $table->setEditable(true); } else { $table->setEditable(false); } $tpl->setContent($form->getHtml() . $table->getHTML()); }
/** * Configure soap settings * * @access public */ function editSOAPObject() { global $rbacsystem, $rbacreview, $ilSetting, $ilCtrl, $lng; if (!$rbacsystem->checkAccess("read", $this->object->getRefId())) { $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE); } $this->tabs_gui->setTabActive('auth_soap'); // get template $stpl = new ilTemplate("tpl.auth_soap.html", true, true, "Services/Authentication"); // get all settings $settings = $ilSetting->getAll(); // get values in error case if ($_SESSION["error_post_vars"]) { if ($_SESSION["error_post_vars"]["soap"]["active"] == "1") { $stpl->setVariable("CHK_SOAP_ACTIVE", "checked=\"checked\""); } if ($_SESSION["error_post_vars"]["soap"]["use_https"] == "1") { $stpl->setVariable("CHK_USE_HTTPS", "checked=\"checked\""); } if ($_SESSION["error_post_vars"]["soap"]["create_users"] == "1") { $stpl->setVariable("CHK_CREATE_USERS", "checked=\"checked\""); } if ($_SESSION["error_post_vars"]["soap"]["allow_local"] == "1") { $stpl->setVariable("CHK_ALLOW_LOCAL", "checked=\"checked\""); } if ($_SESSION["error_post_vars"]["soap"]["account_mail"] == "1") { $stpl->setVariable("CHK_ACCOUNT_MAIL", "checked=\"checked\""); } if ($_SESSION["error_post_vars"]["soap"]["use_dotnet"] == "1") { $stpl->setVariable("CHK_USEDOTNET", "checked=\"checked\""); } $stpl->setVariable("SOAP_SERVER", $_SESSION["error_post_vars"]["soap"]["server"]); $stpl->setVariable("SOAP_PORT", $_SESSION["error_post_vars"]["soap"]["port"]); $stpl->setVariable("SOAP_URI", $_SESSION["error_post_vars"]["soap"]["uri"]); $stpl->setVariable("SOAP_NAMESPACE", $_SESSION["error_post_vars"]["soap"]["namespace"]); $current_default_role = $_SESSION["error_post_vars"]["soap"]["user_default_role"]; } else { if ($settings["soap_auth_active"] == "1") { $stpl->setVariable("CHK_SOAP_ACTIVE", "checked=\"checked\""); } if ($settings["soap_auth_use_https"] == "1") { $stpl->setVariable("CHK_USE_HTTPS", "checked=\"checked\""); } if ($settings["soap_auth_create_users"] == "1") { $stpl->setVariable("CHK_CREATE_USERS", "checked=\"checked\""); } if ($settings["soap_auth_allow_local"] == "1") { $stpl->setVariable("CHK_ALLOW_LOCAL", "checked=\"checked\""); } if ($settings["soap_auth_account_mail"] == "1") { $stpl->setVariable("CHK_ACCOUNT_MAIL", "checked=\"checked\""); } if ($settings["soap_auth_use_dotnet"] == "1") { $stpl->setVariable("CHK_USE_DOTNET", "checked=\"checked\""); } $stpl->setVariable("SOAP_SERVER", $settings["soap_auth_server"]); $stpl->setVariable("SOAP_PORT", $settings["soap_auth_port"]); $stpl->setVariable("SOAP_URI", $settings["soap_auth_uri"]); $stpl->setVariable("SOAP_NAMESPACE", $settings["soap_auth_namespace"]); $current_default_role = $settings["soap_auth_user_default_role"]; } // compose role list $role_list = $rbacreview->getRolesByFilter(2, $this->object->getId()); if (!$current_default_role) { $current_default_role = 4; } $roles = array(); foreach ($role_list as $role) { $roles[$role['obj_id']] = $role['title']; } $selectElement = ilUtil::formSelect($current_default_role, "soap[user_default_role]", $roles, false, true); $stpl->setVariable("SOAP_USER_DEFAULT_ROLE", $selectElement); $stpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $stpl->setVariable("COLSPAN", 3); $stpl->setVariable("TXT_SOAP_TITLE", $this->lng->txt("auth_soap_auth")); $stpl->setVariable("TXT_SOAP_DESC", $this->lng->txt("auth_soap_auth_desc")); $stpl->setVariable("TXT_OPTIONS", $this->lng->txt("options")); $stpl->setVariable("TXT_SOAP_ACTIVE", $this->lng->txt("active")); $stpl->setVariable("TXT_SOAP_SERVER", $this->lng->txt("server")); $stpl->setVariable("TXT_SOAP_SERVER_DESC", $this->lng->txt("auth_soap_server_desc")); $stpl->setVariable("TXT_SOAP_PORT", $this->lng->txt("port")); $stpl->setVariable("TXT_SOAP_PORT_DESC", $this->lng->txt("auth_soap_port_desc")); $stpl->setVariable("TXT_SOAP_URI", $this->lng->txt("uri")); $stpl->setVariable("TXT_SOAP_URI_DESC", $this->lng->txt("auth_soap_uri_desc")); $stpl->setVariable("TXT_SOAP_NAMESPACE", $this->lng->txt("auth_soap_namespace")); $stpl->setVariable("TXT_SOAP_NAMESPACE_DESC", $this->lng->txt("auth_soap_namespace_desc")); $stpl->setVariable("TXT_USE_DOTNET", $this->lng->txt("auth_soap_use_dotnet")); $stpl->setVariable("TXT_USE_HTTPS", $this->lng->txt("auth_soap_use_https")); $stpl->setVariable("TXT_CREATE_USERS", $this->lng->txt("auth_create_users")); $stpl->setVariable("TXT_CREATE_USERS_DESC", $this->lng->txt("auth_soap_create_users_desc")); $stpl->setVariable("TXT_ACCOUNT_MAIL", $this->lng->txt("user_send_new_account_mail")); $stpl->setVariable("TXT_ACCOUNT_MAIL_DESC", $this->lng->txt("auth_new_account_mail_desc")); $stpl->setVariable("TXT_SOAP_USER_DEFAULT_ROLE", $this->lng->txt("auth_user_default_role")); $stpl->setVariable("TXT_SOAP_USER_DEFAULT_ROLE_DESC", $this->lng->txt("auth_soap_user_default_role_desc")); $stpl->setVariable("TXT_ALLOW_LOCAL", $this->lng->txt("auth_allow_local")); $stpl->setVariable("TXT_ALLOW_LOCAL_DESC", $this->lng->txt("auth_soap_allow_local_desc")); $stpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field")); $stpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel")); $stpl->setVariable("TXT_SUBMIT", $this->lng->txt("save")); $stpl->setVariable("CMD_SUBMIT", "saveSOAP"); // test form include_once "./Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($ilCtrl->getFormAction($this)); $form->setTitle("Test Request"); $text_prop = new ilTextInputGUI("ext_uid", "ext_uid"); $form->addItem($text_prop); $text_prop2 = new ilTextInputGUI("soap_pw", "soap_pw"); $form->addItem($text_prop2); $cb = new ilCheckboxInputGUI("new_user", "new_user"); $form->addItem($cb); $form->addCommandButton("testSoapAuthConnection", "Send"); if ($ilCtrl->getCmd() == "testSoapAuthConnection") { include_once "./Services/SOAPAuth/classes/class.ilSOAPAuth.php"; $ret = "<br />" . ilSOAPAuth::testConnection(ilUtil::stripSlashes($_POST["ext_uid"]), ilUtil::stripSlashes($_POST["soap_pw"]), (bool) $_POST["new_user"]); } $stpl->setVariable("TEST_FORM", $form->getHtml() . $ret); $this->tpl->setContent($stpl->get()); }