/**
  * Configure screen
  */
 function configure()
 {
     global $tpl;
     $this->initConfigurationForm();
     $this->getValues();
     $tpl->setContent($this->form->getHTML());
 }
 public function editProperties()
 {
     $this->tabs->activateTab('properties');
     $this->initPropertiesForm();
     $this->getPropertiesValues();
     $this->tpl->setContent($this->form->getHTML());
 }
 /**
  * @param ilObjBibliographic $bibl_obj
  * @return void
  *
  */
 public function showDetails(ilObjBibliographic $bibl_obj)
 {
     global $tpl, $ilTabs, $ilCtrl, $lng;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget("back", $ilCtrl->getLinkTarget($this, 'showContent'));
     $form->setTitle($lng->txt('detail_view'));
     $entry = new ilBibliographicEntry($bibl_obj->getFiletype(), $_GET['entryId']);
     $attributes = $entry->getAttributes();
     //translate array key in order to sort by those keys
     foreach ($attributes as $key => $attribute) {
         //Check if there is a specific language entry
         if ($lng->exists($key)) {
             $strDescTranslated = $lng->txt($key);
         } else {
             $arrKey = explode("_", $key);
             $strDescTranslated = $lng->txt($arrKey[0] . "_default_" . $arrKey[2]);
         }
         unset($attributes[$key]);
         $attributes[$strDescTranslated] = $attribute;
     }
     // sort attributes alphabetically by their array-key
     ksort($attributes, SORT_STRING);
     // render attributes to html
     foreach ($attributes as $key => $attribute) {
         $ci = new ilCustomInputGUI($key);
         $ci->setHtml($attribute);
         $form->addItem($ci);
     }
     // set content and title
     $tpl->setContent($form->getHTML());
     //Permanent Link
     $tpl->setPermanentLink("bibl", $bibl_obj->getRefId(), "_" . $_GET['entryId']);
 }
 function asyncUploadFile()
 {
     global $ilTabs;
     $ilTabs->activateTab("content");
     $this->initUploadForm();
     echo $this->form->getHTML();
     $options = new stdClass();
     $options->dropZone = "#ilFileUploadDropZone_1";
     $options->fileInput = "#ilFileUploadInput_1";
     $options->submitButton = "uploadFiles";
     $options->cancelButton = "cancelAll";
     $options->dropArea = "#ilFileUploadDropArea_1";
     $options->fileList = "#ilFileUploadList_1";
     $options->fileSelectButton = "#ilFileUploadFileSelect_1";
     echo "<script language='javascript' type='text/javascript'>var fileUpload1 = new ilFileUpload(1, " . ilJsonUtil::encode($options) . ");</script>";
     $_SESSION["cld_folder_id"] = $_POST["folder_id"];
     exit;
 }
 /**
  * Configuration gui.
  */
 function configure()
 {
     global $tpl;
     $pl = $this->getPluginObject();
     $form = new ilPropertyFormGUI();
     $form->setTitle($pl->txt('roomsharing_plugin_configuration'));
     $form->setDescription($pl->txt('roomsharing_plugin_config_not_required'));
     $tpl->setContent($form->getHTML());
 }
 /**
  * save Field
  *
  * @param string $a_mode values: create | update
  */
 public function save($a_mode = "create")
 {
     global $ilCtrl, $lng, $tpl;
     //check access
     if (!$this->table->hasPermissionToFields($this->parent_obj->ref_id)) {
         $this->accessDenied();
         return;
     }
     $this->initForm($a_mode == "update" ? "edit" : "create");
     if ($this->checkInput($a_mode)) {
         $title = $this->form->getInput("title");
         if ($a_mode != "create" && $title != $this->field_obj->getTitle()) {
             ilUtil::sendInfo($lng->txt("dcl_field_title_change_warning"), true);
         }
         $this->field_obj->setTitle($title);
         $this->field_obj->setDescription($this->form->getInput("description"));
         $this->field_obj->setDatatypeId($this->form->getInput("datatype"));
         $this->field_obj->setRequired($this->form->getInput("required"));
         $this->field_obj->setUnique($this->form->getInput("unique"));
         if ($a_mode == "update") {
             $this->field_obj->doUpdate();
         } else {
             $this->field_obj->setVisible(true);
             $this->field_obj->setOrder($this->table->getNewOrder());
             $this->field_obj->doCreate();
         }
         // Get possible properties and save them
         include_once "./Modules/DataCollection/classes/class.ilDataCollectionFieldProp.php";
         foreach (ilDataCollectionDatatype::getProperties($this->field_obj->getDatatypeId()) as $property) {
             $fieldprop_obj = new ilDataCollectionFieldProp();
             $fieldprop_obj->setDatatypePropertyId($property['id']);
             $fieldprop_obj->setFieldId($this->field_obj->getId());
             $fieldprop_obj->setValue($this->form->getInput("prop_" . $property['id']));
             if ($a_mode == "update") {
                 $fieldprop_obj->doUpdate();
             } else {
                 $fieldprop_obj->doCreate();
             }
         }
         $ilCtrl->setParameter($this, "field_id", $this->field_obj->getId());
         if ($a_mode == "update") {
             ilUtil::sendSuccess($lng->txt("dcl_msg_field_modified"), true);
         } else {
             $this->table->addField($this->field_obj);
             $this->table->buildOrderFields();
             ilUtil::sendSuccess($lng->txt("msg_field_created"), false);
         }
         $ilCtrl->redirectByClass(strtolower("ilDataCollectionFieldListGUI"), "listFields");
     } else {
         $this->form->setValuesByPost();
         $tpl->setContent($this->form->getHTML());
     }
 }
 /**
  * @param $message
  */
 protected function sendFailure($message)
 {
     $keep = $this->ctrl->isAsynch() ? false : true;
     $this->form->setValuesByPost();
     if ($this->ctrl->isAsynch()) {
         echo $this->tpl->getMessageHTML($message, 'failure') . $this->form->getHTML();
         exit;
     } else {
         ilUtil::sendFailure($message, $keep);
         $this->tpl->setContent($this->form->getHTML());
     }
 }
Esempio n. 8
0
 public function showMembersObject()
 {
     /**
      * @var $tree ilTree
      * @var $tpl ilTemplate
      * @var $ilTabs ilTabsGUI
      * @var $ilAccess ilAccessHandler
      * @var $ilErr		ilErr
      */
     global $tree, $tpl, $ilTabs, $ilAccess, $ilErr;
     if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
         $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
     }
     $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_members_list.html', 'Modules/Forum');
     $ilTabs->setTabActive('settings');
     $this->settingsTabs();
     // instantiate the property form
     if (!$this->initNotificationSettingsForm()) {
         // if the form was just created set the values fetched from database
         $this->notificationSettingsForm->setValuesByArray(array('notification_type' => $this->objProperties->getNotificationType(), 'adm_force' => (bool) $this->objProperties->isAdminForceNoti(), 'usr_toggle' => (bool) $this->objProperties->isUserToggleNoti()));
     }
     // set form html into template
     $tpl->setVariable('NOTIFICATIONS_SETTINGS_FORM', $this->notificationSettingsForm->getHTML());
     include_once 'Modules/Forum/classes/class.ilForumNotification.php';
     include_once 'Modules/Forum/classes/class.ilObjForum.php';
     $frm_noti = new ilForumNotification($this->object->getRefId());
     $oParticipants = $this->getParticipantsObject();
     $moderator_ids = $frm_noti->_getModerators($this->object->getRefId());
     $admin_ids = $oParticipants->getAdmins();
     $member_ids = $oParticipants->getMembers();
     $tutor_ids = $oParticipants->getTutors();
     if ($this->objProperties->getNotificationType() == 'default') {
         // update forum_notification table
         include_once 'Modules/Forum/classes/class.ilForumNotification.php';
         $forum_noti = new ilForumNotification($this->object->getRefId());
         $forum_noti->setAdminForce($this->objProperties->isAdminForceNoti());
         $forum_noti->setUserToggle($this->objProperties->isUserToggleNoti());
         $forum_noti->setForumId($this->objProperties->getObjId());
     } else {
         if ($this->objProperties->getNotificationType() == 'per_user') {
             $moderators = $this->getUserNotificationTableData($moderator_ids, $frm_noti);
             $admins = $this->getUserNotificationTableData($admin_ids, $frm_noti);
             $members = $this->getUserNotificationTableData($member_ids, $frm_noti);
             $tutors = $this->getUserNotificationTableData($tutor_ids, $frm_noti);
             $this->__showMembersTable($moderators, $admins, $members, $tutors);
         }
     }
 }
 function owner()
 {
     $this->__initSubTabs("owner");
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this, "owner"));
     $form->setTitle($this->lng->txt("info_owner_of_object"));
     $login = new ilTextInputGUI($this->lng->txt("login"), "owner");
     $login->setDataSource($this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilRepositorySearchGUI'), 'doUserAutoComplete', '', true));
     $login->setRequired(true);
     $login->setSize(50);
     $login->setInfo($this->lng->txt("chown_warning"));
     $login->setValue(ilObjUser::_lookupLogin($this->gui_obj->object->getOwner()));
     $form->addItem($login);
     $form->addCommandButton("changeOwner", $this->lng->txt("change_owner"));
     $this->tpl->setContent($form->getHTML());
 }
 public function showTopicForm()
 {
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     if ($this->objCurrentTopic->getId()) {
         $this->ctrl->setParameter($this, 'topic_id', $this->objCurrentTopic->getId());
     }
     $form->setFormAction($this->ctrl->getFormAction($this, 'saveTopic'));
     $form->setTitle($this->lng->txt($this->objCurrentTopic->getId() ? 'edit_topic' : 'new_topic'));
     $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $title->setValue($this->objCurrentTopic->getTitle());
     $title->setRequired(true);
     $form->addItem($title);
     $sorting = new ilTextInputGUI($this->lng->txt('pay_sorting_value'), 'sorting');
     $sorting->setValue($this->objCurrentTopic->getSorting());
     $sorting->setMaxLength(11);
     $sorting->setSize(11);
     $form->addItem($sorting);
     $form->addCommandButton('saveTopic', $this->lng->txt('save'));
     $form->addCommandButton('showTopicsList', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $form->getHTML());
     return true;
 }
 /**
  * list files
  */
 function renameFileForm()
 {
     global $lng, $ilCtrl;
     if (!isset($_POST["file"])) {
         $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
     }
     if (count($_POST["file"]) > 1) {
         $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"), $this->ilias->error_obj->MESSAGE);
     }
     if (ilUtil::stripSlashes($_POST["file"][0]) == "..") {
         $this->ilias->raiseError($this->lng->txt("select_a_file"), $this->ilias->error_obj->MESSAGE);
     }
     $cur_subdir = str_replace(".", "", ilUtil::stripSlashes($_GET["cdir"]));
     $file = !empty($cur_subdir) ? $this->main_dir . "/" . $cur_subdir . "/" . ilUtil::stripSlashes($_POST["file"][0]) : $this->main_dir . "/" . ilUtil::stripSlashes($_POST["file"][0]);
     $this->ctrl->setParameter($this, "old_name", ilUtil::stripSlashes($_POST["file"][0]));
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     // file/dir name
     $ti = new ilTextInputGUI($this->lng->txt("name"), "new_name");
     $ti->setMaxLength(200);
     $ti->setSize(40);
     $ti->setValue(ilUtil::stripSlashes($_POST["file"][0]));
     $form->addItem($ti);
     // save and cancel commands
     $form->addCommandButton("renameFile", $lng->txt("rename"));
     $form->addCommandButton("cancelRename", $lng->txt("cancel"));
     $form->setFormAction($ilCtrl->getFormAction($this, "renameFile"));
     if (@is_dir($file)) {
         $form->setTitle($this->lng->txt("cont_rename_dir"));
     } else {
         $form->setTitle($this->lng->txt("rename_file"));
     }
     $this->tpl->setContent($form->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');
     //set Template
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.auth_soap.html', 'Services/Authentication');
     // compose role list
     $role_list = $rbacreview->getRolesByFilter(2, $this->object->getId());
     $roles = array();
     foreach ($role_list as $role) {
         $roles[$role['obj_id']] = $role['title'];
     }
     //set property form gui
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $soap_config = new ilPropertyFormGUI();
     $soap_config->setTitle($this->lng->txt("auth_soap_auth"));
     $soap_config->setDescription($this->lng->txt("auth_soap_auth_desc"));
     $soap_config->setFormAction($this->ctrl->getFormAction($this, "editSOAP"));
     $soap_config->addCommandButton("saveSOAP", $this->lng->txt("save"));
     $soap_config->addCommandButton("editSOAP", $this->lng->txt("cancel"));
     //set activ
     $active = new ilCheckboxInputGUI();
     $active->setTitle($this->lng->txt("active"));
     $active->setPostVar("soap[active]");
     //set server
     $server = new ilTextInputGUI();
     $server->setTitle($this->lng->txt("server"));
     $server->setInfo($this->lng->txt("auth_soap_server_desc"));
     $server->setPostVar("soap[server]");
     $server->setSize(50);
     $server->setMaxLength(256);
     $server->setRequired(true);
     //set port
     $port = new ilTextInputGUI();
     $port->setTitle($this->lng->txt("port"));
     $port->setInfo($this->lng->txt("auth_soap_port_desc"));
     $port->setPostVar("soap[port]");
     $port->setSize(7);
     $port->setMaxLength(5);
     //set https
     $https = new ilCheckboxInputGUI();
     $https->setTitle($this->lng->txt("auth_soap_use_https"));
     $https->setPostVar("soap[use_https]");
     //set uri
     $uri = new ilTextInputGUI();
     $uri->setTitle($this->lng->txt("uri"));
     $uri->setInfo($this->lng->txt("auth_soap_uri_desc"));
     $uri->setPostVar("soap[uri]");
     $uri->setSize(50);
     $uri->setMaxLength(256);
     //set namespace
     $namespace = new ilTextInputGUI();
     $namespace->setTitle($this->lng->txt("auth_soap_namespace"));
     $namespace->setInfo($this->lng->txt("auth_soap_namespace_desc"));
     $namespace->setPostVar("soap[namespace]");
     $namespace->setSize(50);
     $namespace->setMaxLength(256);
     //set dotnet
     $dotnet = new ilCheckboxInputGUI();
     $dotnet->setTitle($this->lng->txt("auth_soap_use_dotnet"));
     $dotnet->setPostVar("soap[use_dotnet]");
     //set create users
     $createuser = new ilCheckboxInputGUI();
     $createuser->setTitle($this->lng->txt("auth_create_users"));
     $createuser->setInfo($this->lng->txt("auth_soap_create_users_desc"));
     $createuser->setPostVar("soap[create_users]");
     //set account mail
     $sendmail = new ilCheckboxInputGUI();
     $sendmail->setTitle($this->lng->txt("user_send_new_account_mail"));
     $sendmail->setInfo($this->lng->txt("auth_new_account_mail_desc"));
     $sendmail->setPostVar("soap[account_mail]");
     //set user default role
     $defaultrole = new ilSelectInputGUI();
     $defaultrole->setTitle($this->lng->txt("auth_user_default_role"));
     $defaultrole->setInfo($this->lng->txt("auth_soap_user_default_role_desc"));
     $defaultrole->setPostVar("soap[user_default_role]");
     $defaultrole->setOptions($roles);
     //set allow local authentication
     $allowlocal = new ilCheckboxInputGUI();
     $allowlocal->setTitle($this->lng->txt("auth_allow_local"));
     $allowlocal->setInfo($this->lng->txt("auth_soap_allow_local_desc"));
     $allowlocal->setPostVar("soap[allow_local]");
     // get all settings
     $settings = $ilSetting->getAll();
     // get values in error case
     if ($_SESSION["error_post_vars"]) {
         $active->setChecked($_SESSION["error_post_vars"]["soap"]["active"]);
         $server->setValue($_SESSION["error_post_vars"]["soap"]["server"]);
         $port->setValue($_SESSION["error_post_vars"]["soap"]["port"]);
         $https->setChecked($_SESSION["error_post_vars"]["soap"]["use_https"]);
         $uri->setValue($_SESSION["error_post_vars"]["soap"]["uri"]);
         $namespace->setValue($_SESSION["error_post_vars"]["soap"]["namespace"]);
         $dotnet->setChecked($_SESSION["error_post_vars"]["soap"]["use_dotnet"]);
         $createuser->setChecked($_SESSION["error_post_vars"]["soap"]["create_users"]);
         $allowlocal->setChecked($_SESSION["error_post_vars"]["soap"]["allow_local"]);
         $defaultrole->setValue($_SESSION["error_post_vars"]["soap"]["user_default_role"]);
         $sendmail->setChecked($_SESSION["error_post_vars"]["soap"]["account_mail"]);
     } else {
         $active->setChecked($settings["soap_auth_active"]);
         $server->setValue($settings["soap_auth_server"]);
         $port->setValue($settings["soap_auth_port"]);
         $https->setChecked($settings["soap_auth_use_https"]);
         $uri->setValue($settings["soap_auth_uri"]);
         $namespace->setValue($settings["soap_auth_namespace"]);
         $dotnet->setChecked($settings["soap_auth_use_dotnet"]);
         $createuser->setChecked($settings["soap_auth_create_users"]);
         $allowlocal->setChecked($settings["soap_auth_allow_local"]);
         $defaultrole->setValue($settings["soap_auth_user_default_role"]);
         $sendmail->setChecked($settings["soap_auth_account_mail"]);
     }
     if (!$defaultrole->getValue()) {
         $defaultrole->setValue(4);
     }
     //add Items to property gui
     $soap_config->addItem($active);
     $soap_config->addItem($server);
     $soap_config->addItem($port);
     $soap_config->addItem($https);
     $soap_config->addItem($uri);
     $soap_config->addItem($namespace);
     $soap_config->addItem($dotnet);
     $soap_config->addItem($createuser);
     $soap_config->addItem($sendmail);
     $soap_config->addItem($defaultrole);
     $soap_config->addItem($allowlocal);
     $this->tpl->setVariable("CONFIG_FORM", $soap_config->getHTML());
     // test form
     $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"]);
     }
     $this->tpl->setVariable("TEST_FORM", $form->getHTML() . $ret);
 }
Esempio n. 13
0
 /**
  * Allows to add suggested solutions for questions
  *
  * @access public
  */
 public function suggestedsolution()
 {
     global $ilUser;
     global $ilAccess;
     if ($_POST["deleteSuggestedSolution"] == 1) {
         $this->object->deleteSuggestedSolutions();
         ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
         $this->ctrl->redirect($this, "suggestedsolution");
     }
     $save = is_array($_POST["cmd"]) && array_key_exists("suggestedsolution", $_POST["cmd"]) ? TRUE : FALSE;
     $output = "";
     $solution_array = $this->object->getSuggestedSolution(0);
     $options = array("lm" => $this->lng->txt("obj_lm"), "st" => $this->lng->txt("obj_st"), "pg" => $this->lng->txt("obj_pg"), "git" => $this->lng->txt("glossary_term"), "file" => $this->lng->txt("fileDownload"), "text" => $this->lng->txt("solutionText"));
     if (strcmp($_POST["solutiontype"], "file") == 0 && strcmp($solution_array["type"], "file") != 0) {
         $solution_array = array("type" => "file");
     } elseif (strcmp($_POST["solutiontype"], "text") == 0 && strcmp($solution_array["type"], "text") != 0) {
         $solution_array = array("type" => "text", "value" => $this->getSolutionOutput(0, NULL, FALSE, FALSE, TRUE, FALSE, TRUE));
     }
     if ($save && strlen($_POST["filename"])) {
         $solution_array["value"]["filename"] = $_POST["filename"];
     }
     if ($save && strlen($_POST["solutiontext"])) {
         $solution_array["value"] = $_POST["solutiontext"];
     }
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     if (count($solution_array)) {
         $form = new ilPropertyFormGUI();
         $form->setFormAction($this->ctrl->getFormAction($this));
         $form->setTitle($this->lng->txt("solution_hint"));
         $form->setMultipart(TRUE);
         $form->setTableWidth("100%");
         $form->setId("suggestedsolutiondisplay");
         // suggested solution output
         include_once "./Modules/TestQuestionPool/classes/class.ilSolutionTitleInputGUI.php";
         $title = new ilSolutionTitleInputGUI($this->lng->txt("showSuggestedSolution"), "solutiontype");
         $template = new ilTemplate("tpl.il_as_qpl_suggested_solution_input_presentation.html", TRUE, TRUE, "Modules/TestQuestionPool");
         if (strlen($solution_array["internal_link"])) {
             $href = assQuestion::_getInternalLinkHref($solution_array["internal_link"]);
             $template->setCurrentBlock("preview");
             $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
             $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . $this->lng->txt("view") . "</a> ");
             $template->parseCurrentBlock();
         } elseif (strcmp($solution_array["type"], "file") == 0 && is_array($solution_array["value"])) {
             $href = $this->object->getSuggestedSolutionPathWeb() . $solution_array["value"]["name"];
             $template->setCurrentBlock("preview");
             $template->setVariable("TEXT_SOLUTION", $this->lng->txt("suggested_solution"));
             $template->setVariable("VALUE_SOLUTION", " <a href=\"{$href}\" target=\"content\">" . ilUtil::prepareFormOutput(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]) . "</a> ");
             $template->parseCurrentBlock();
         }
         $template->setVariable("TEXT_TYPE", $this->lng->txt("type"));
         $template->setVariable("VALUE_TYPE", $options[$solution_array["type"]]);
         $title->setHtml($template->get());
         $deletesolution = new ilCheckboxInputGUI("", "deleteSuggestedSolution");
         $deletesolution->setOptionTitle($this->lng->txt("deleteSuggestedSolution"));
         $title->addSubItem($deletesolution);
         $form->addItem($title);
         if (strcmp($solution_array["type"], "file") == 0) {
             // file
             $file = new ilFileInputGUI($this->lng->txt("fileDownload"), "file");
             $file->setRequired(TRUE);
             $file->enableFileNameSelection("filename");
             //$file->setSuffixes(array("doc","xls","png","jpg","gif","pdf"));
             if ($_FILES["file"]["tmp_name"] && $file->checkInput()) {
                 if (!file_exists($this->object->getSuggestedSolutionPath())) {
                     ilUtil::makeDirParents($this->object->getSuggestedSolutionPath());
                 }
                 $res = ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"], $this->object->getSuggestedSolutionPath() . $_FILES["file"]["name"]);
                 if ($res) {
                     ilUtil::renameExecutables($this->object->getSuggestedSolutionPath());
                     // remove an old file download
                     if (is_array($solution_array["value"])) {
                         @unlink($this->object->getSuggestedSolutionPath() . $solution_array["value"]["name"]);
                     }
                     $file->setValue($_FILES["file"]["name"]);
                     $this->object->saveSuggestedSolution("file", "", 0, array("name" => $_FILES["file"]["name"], "type" => $_FILES["file"]["type"], "size" => $_FILES["file"]["size"], "filename" => $_POST["filename"]));
                     $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
                     if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
                         return $this->originalSyncForm("suggestedsolution");
                     } else {
                         ilUtil::sendSuccess($this->lng->txt("suggested_solution_added_successfully"), TRUE);
                         $this->ctrl->redirect($this, "suggestedsolution");
                     }
                 } else {
                     // BH: $res as info string? wtf? it holds a bool or something else!!?
                     ilUtil::sendInfo($res);
                 }
             } else {
                 if (is_array($solution_array["value"])) {
                     $file->setValue($solution_array["value"]["name"]);
                     $file->setFilename(strlen($solution_array["value"]["filename"]) ? $solution_array["value"]["filename"] : $solution_array["value"]["name"]);
                 }
             }
             $form->addItem($file);
             $hidden = new ilHiddenInputGUI("solutiontype");
             $hidden->setValue("file");
             $form->addItem($hidden);
         } else {
             if (strcmp($solution_array["type"], "text") == 0) {
                 $question = new ilTextAreaInputGUI($this->lng->txt("solutionText"), "solutiontext");
                 $question->setValue($this->object->prepareTextareaOutput($solution_array["value"]));
                 $question->setRequired(TRUE);
                 $question->setRows(10);
                 $question->setCols(80);
                 $question->setUseRte(TRUE);
                 $question->addPlugin("latex");
                 $question->addButton("latex");
                 $question->setRTESupport($this->object->getId(), "qpl", "assessment");
                 $hidden = new ilHiddenInputGUI("solutiontype");
                 $hidden->setValue("text");
                 $form->addItem($hidden);
                 $form->addItem($question);
             }
         }
         if ($ilAccess->checkAccess("write", "", $_GET['ref_id'])) {
             $form->addCommandButton("suggestedsolution", $this->lng->txt("save"));
         }
         if ($save) {
             if ($form->checkInput()) {
                 switch ($solution_array["type"]) {
                     case "file":
                         $this->object->saveSuggestedSolution("file", "", 0, array("name" => $solution_array["value"]["name"], "type" => $solution_array["value"]["type"], "size" => $solution_array["value"]["size"], "filename" => $_POST["filename"]));
                         break;
                     case "text":
                         $this->object->saveSuggestedSolution("text", "", 0, $solution_array["value"]);
                         break;
                 }
                 $originalexists = $this->object->_questionExistsInPool($this->object->original_id);
                 if (($_GET["calling_test"] || isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) && $originalexists && assQuestion::_isWriteable($this->object->original_id, $ilUser->getId())) {
                     return $this->originalSyncForm("suggestedsolution");
                 } else {
                     ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
                     $this->ctrl->redirect($this, "suggestedsolution");
                 }
             }
         }
         $output = $form->getHTML();
     }
     $savechange = strcmp($this->ctrl->getCmd(), "saveSuggestedSolution") == 0 ? TRUE : FALSE;
     $changeoutput = "";
     if ($ilAccess->checkAccess("write", "", $_GET['ref_id'])) {
         $formchange = new ilPropertyFormGUI();
         $formchange->setFormAction($this->ctrl->getFormAction($this));
         $formchange->setTitle(count($solution_array) ? $this->lng->txt("changeSuggestedSolution") : $this->lng->txt("addSuggestedSolution"));
         $formchange->setMultipart(FALSE);
         $formchange->setTableWidth("100%");
         $formchange->setId("suggestedsolution");
         $solutiontype = new ilRadioGroupInputGUI($this->lng->txt("suggestedSolutionType"), "solutiontype");
         foreach ($options as $opt_value => $opt_caption) {
             $solutiontype->addOption(new ilRadioOption($opt_caption, $opt_value));
         }
         if (count($solution_array)) {
             $solutiontype->setValue($solution_array["type"]);
         }
         $solutiontype->setRequired(TRUE);
         $formchange->addItem($solutiontype);
         $formchange->addCommandButton("saveSuggestedSolution", $this->lng->txt("select"));
         if ($savechange) {
             $formchange->checkInput();
         }
         $changeoutput = $formchange->getHTML();
     }
     $this->tpl->setVariable("ADM_CONTENT", $changeoutput . $output);
 }
 /**
  * Edit disk quota settings.
  */
 public function editDiskQuotaSettings()
 {
     global $rbacsystem, $ilErr, $ilSetting, $tpl, $lng, $ilCtrl;
     if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
         $ilErr->raiseError($lng->txt("no_permission"), $ilErr->WARNING);
     }
     $this->tabs_gui->setTabActive('disk_quota');
     $this->addDiskQuotaSubtabs('settings');
     require_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     require_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
     require_once "./Services/Form/classes/class.ilRadioGroupInputGUI.php";
     require_once "./Services/Form/classes/class.ilRadioOption.php";
     require_once "./Services/Form/classes/class.ilTextAreaInputGUI.php";
     require_once "./Services/WebDAV/classes/class.ilDAVServer.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle($lng->txt("settings"));
     // Enable disk quota
     $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_disk_quota"), "enable_disk_quota");
     $cb_prop->setValue('1');
     $cb_prop->setChecked($this->disk_quota_obj->isDiskQuotaEnabled());
     $cb_prop->setInfo($lng->txt('enable_disk_quota_info'));
     $form->addItem($cb_prop);
     // Enable disk quota reminder mail
     $cb_prop_reminder = new ilCheckboxInputGUI($lng->txt("enable_disk_quota_reminder_mail"), "enable_disk_quota_reminder_mail");
     $cb_prop_reminder->setValue('1');
     $cb_prop_reminder->setChecked($this->disk_quota_obj->isDiskQuotaReminderMailEnabled());
     $cb_prop_reminder->setInfo($lng->txt('disk_quota_reminder_mail_desc'));
     $cb_prop->addSubItem($cb_prop_reminder);
     // Enable summary mail for certain users
     $cb_prop_summary = new ilCheckboxInputGUI($lng->txt("enable_disk_quota_summary_mail"), "enable_disk_quota_summary_mail");
     $cb_prop_summary->setValue(1);
     $cb_prop_summary->setChecked($this->disk_quota_obj->isDiskQuotaSummaryMailEnabled());
     $cb_prop_summary->setInfo($lng->txt('enable_disk_quota_summary_mail_desc'));
     $cb_prop->addSubItem($cb_prop_summary);
     // Edit disk quota recipients
     $summary_rcpt = new ilTextInputGUI($lng->txt("disk_quota_summary_rctp"), "disk_quota_summary_rctp");
     $summary_rcpt->setValue($this->disk_quota_obj->getSummaryRecipients());
     $summary_rcpt->setInfo($lng->txt('disk_quota_summary_rctp_desc'));
     $cb_prop_summary->addSubItem($summary_rcpt);
     // command buttons
     $form->addCommandButton('saveDiskQuotaSettings', $lng->txt('save'));
     $form->addCommandButton('editDiskQuotaSettings', $lng->txt('cancel'));
     $tpl->setContent($form->getHTML());
 }
Esempio n. 15
0
 public function showDetails()
 {
     global $ilMainMenu, $ilTabs, $ilToolbar, $ilUser;
     $this->__initPaymentObject();
     $this->__initPricesObject();
     $this->__initShoppingCartObject();
     $ilToolbar->addButton($this->lng->txt('payment_back_to_shop'), 'ilias.php?baseClass=ilShopController');
     $this->tpl->getStandardTemplate();
     $ilTabs->setTabActive('buy');
     $ilMainMenu->setActive('shop');
     if ($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES) {
         ilUtil::sendInfo($this->lng->txt('pay_expires_info'));
         return false;
     }
     $extension_prices = array();
     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
         include_once './Services/Payment/classes/class.ilPaymentBookings.php';
         $has_extension_price = ilPaymentBookings::_hasAccesstoExtensionPrice($ilUser->getId(), $this->pobject->getPobjectId());
         if ($has_extension_price) {
             $extension_prices = $this->price_obj->getExtensionPrices();
         }
     }
     $org_prices = $this->price_obj->getPrices();
     $tmp_prices = array_merge($org_prices, $extension_prices);
     $prices = array();
     foreach ($tmp_prices as $price) {
         // expired prices must be filtered out
         if ($price['price_type'] == ilPaymentPrices::TYPE_DURATION_DATE && $price['duration_until'] < date('Y-m-d')) {
             //do nothing
         } else {
             $prices[] = $price;
         }
     }
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $buyedObject = "";
     if ($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId())) {
         $buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
         if (is_array($prices) && count($prices) > 1) {
             ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc_choose_another'));
         } else {
             ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc'));
         }
     }
     $this->ctrl->setParameter($this, "ref_id", $this->pobject->getRefId());
     $subtype = '';
     if ($this->object) {
         if ($this->object->getType() == 'exc') {
             $subtype = ' (' . $this->lng->txt($this->pobject->getSubtype()) . ')';
         }
         $form->setTitle($this->object->getTitle() . ' ' . $subtype);
         $form->setTitleIcon(ilObject::_getIcon($this->object->getId()));
     } else {
         ilUtil::sendFailure($this->lng->txt('object_not_found'));
     }
     // payment infos
     $info = new ilNonEditableValueGUI($this->lng->txt('info'));
     $info->setValue($this->lng->txt('pay_info'));
     $form->addItem($info);
     if (is_array($buyedObject)) {
         if (is_array($prices) && count($prices) > 1) {
             $button_txt = $this->lng->txt('pay_change_price');
         } else {
             $button_txt = $this->lng->txt('pay_add_to_shopping_cart');
         }
     } else {
         $button_txt = $this->lng->txt('pay_add_to_shopping_cart');
     }
     $rg_prices = new ilRadioGroupInputGUI($this->lng->txt('prices'), 'price_id');
     if (is_array($prices)) {
         foreach ($prices as $price) {
             if (is_array($buyedObject) && $buyedObject["price_id"] == $price['price_id']) {
                 $rg_prices->setValue($price['price_id']);
             } else {
                 if (count($prices) == 1) {
                     $rg_prices->setValue($price['price_id']);
                 }
             }
             switch ($price['price_type']) {
                 case ilPaymentPrices::TYPE_DURATION_MONTH:
                     $txt_price = $price['duration'] . ' ' . $this->lng->txt('paya_months') . ': ';
                     break;
                 case ilPaymentPrices::TYPE_DURATION_DATE:
                     $txt_price = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)) . ':  ';
                     break;
                 case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
                     $txt_price = $this->lng->txt('unlimited_duration') . ': ';
                     break;
             }
             $tmp_price = $price['price'];
             $extension_txt = '';
             if ($price['extension'] == 1) {
                 $extension_txt = '(' . $this->lng->txt('extension_price') . ')';
             }
             $price_row = new ilRadioOption($txt_price . ' ' . ilPaymentPrices::_formatPriceToString((double) $tmp_price) . ' ' . $extension_txt, $price['price_id']);
             $price_row->setInfo($price['description']);
             $rg_prices->addOption($price_row);
         }
         $form->addItem($rg_prices);
     }
     $form->addCommandButton('addToShoppingCart', $button_txt);
     return $this->tpl->setContent($form->getHTML());
 }
 /**
  * In case the form input for the name of the class was empty an error message and the class
  * form with its non erroneous entries will be displayed.
  *
  * @param ilPropertyFormGUI $a_class_form the class for which the invalid input should be handled
  */
 private function handleInvalidAddClassForm($a_class_form)
 {
     $this->tabs->clearTargets();
     $a_class_form->setValuesByPost();
     $this->tpl->setContent($a_class_form->getHTML());
 }
 /**
  * Creates the output of the feedback page for a single choice question
  *
  * @access public
  */
 function feedback($checkonly = false)
 {
     $save = strcmp($this->ctrl->getCmd(), "saveFeedback") == 0 ? TRUE : FALSE;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('feedback_answers'));
     $form->setTableWidth("98%");
     $form->setId("feedback");
     $complete = new ilTextAreaInputGUI($this->lng->txt("feedback_complete_solution"), "feedback_complete");
     $complete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(1)));
     $complete->setRequired(false);
     $complete->setRows(10);
     $complete->setCols(80);
     if (!$this->getPreventRteUsage()) {
         $complete->setUseRte(true);
     }
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $complete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $complete->addPlugin("latex");
     $complete->addButton("latex");
     $complete->addButton("pastelatex");
     $complete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
     $form->addItem($complete);
     $incomplete = new ilTextAreaInputGUI($this->lng->txt("feedback_incomplete_solution"), "feedback_incomplete");
     $incomplete->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackGeneric(0)));
     $incomplete->setRequired(false);
     $incomplete->setRows(10);
     $incomplete->setCols(80);
     if (!$this->getPreventRteUsage()) {
         $incomplete->setUseRte(true);
     }
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $incomplete->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
     $incomplete->addPlugin("latex");
     $incomplete->addButton("latex");
     $incomplete->addButton("pastelatex");
     $incomplete->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
     $form->addItem($incomplete);
     if (!$this->getSelfAssessmentEditingMode()) {
         foreach ($this->object->getErrorData() as $index => $answer) {
             $caption = $ordinal = $index + 1;
             $caption .= '. <br />"' . $answer->text_wrong . '" =&gt; ';
             $caption .= '"' . $answer->text_correct . '"';
             $caption .= '</i>';
             $answerobj = new ilTextAreaInputGUI($this->object->prepareTextareaOutput($caption, true), "feedback_answer_{$index}");
             $answerobj->setValue($this->object->prepareTextareaOutput($this->object->getFeedbackSingleAnswer($index)));
             $answerobj->setRequired(false);
             $answerobj->setRows(10);
             $answerobj->setCols(80);
             $answerobj->setUseRte(true);
             include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
             $answerobj->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment"));
             $answerobj->addPlugin("latex");
             $answerobj->addButton("latex");
             $answerobj->addButton("pastelatex");
             $answerobj->setRTESupport($this->object->getId(), "qpl", "assessment", null, false, '3.4.7');
             $form->addItem($answerobj);
         }
     }
     global $ilAccess;
     if ($ilAccess->checkAccess("write", "", $_GET['ref_id']) || $this->getSelfAssessmentEditingMode()) {
         $form->addCommandButton("saveFeedback", $this->lng->txt("save"));
     }
     if ($save) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }
 /**
  * Move current page
  */
 protected function movePageForm()
 {
     global $lng, $ilCtrl, $tpl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this, "movePage"));
     $form->setTitle($lng->txt("survey_move_page"));
     $old_pos = new ilHiddenInputGUI("old_pos");
     $old_pos->setValue($this->current_page);
     $form->addItem($old_pos);
     $pages = $this->object->getSurveyPages();
     if ($pages) {
         $pages_drop = array();
         if ($this->current_page != 1) {
             $pages_drop["fst"] = $lng->txt("survey_at_beginning");
         }
         foreach ($pages as $idx => $questions) {
             if ($idx + 1 != $this->current_page && $idx + 2 != $this->current_page) {
                 $question = array_shift($questions);
                 if ($question["questionblock_id"]) {
                     $pages_drop[$idx + 1] = $lng->txt("survey_behind_page") . " " . $question["questionblock_title"];
                 } else {
                     $pages_drop[$idx + 1] = $lng->txt("survey_behind_page") . " " . strip_tags($question["title"]);
                 }
             }
         }
         $pos = new ilSelectInputGUI($lng->txt("position"), "pgov");
         $pos->setOptions($pages_drop);
         $form->addItem($pos);
     }
     $form->addCommandButton("movePage", $lng->txt("submit"));
     $form->addCommandButton("renderPage", $lng->txt("cancel"));
     return $tpl->setContent($form->getHTML());
 }
 /**
  * Edit resources form.
  */
 function edit($a_insert = false)
 {
     global $ilCtrl, $tpl, $lng, $objDefinition;
     $this->displayValidationError();
     // edit form
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     if ($a_insert) {
         $form->setTitle($this->lng->txt("cont_insert_resources"));
     } else {
         $form->setTitle($this->lng->txt("cont_update_resources"));
     }
     // count number of existing objects per type and collect item groups
     $ref_id = (int) $_GET["ref_id"];
     $childs = $this->rep_tree->getChilds($ref_id);
     $type_counts = array();
     $item_groups = array();
     foreach ($childs as $c) {
         $type_counts[$c["type"]] += 1;
         if ($c["type"] == "itgr") {
             $item_groups[$c["ref_id"]] = $c["title"];
         }
     }
     if (count($item_groups) > 0) {
         // radio group for type selection
         $radg = new ilRadioGroupInputGUI($lng->txt("cont_resources"), "res_type");
         if (!$a_insert && $this->content_obj->getMainType() == "ItemGroup") {
             $radg->setValue("itgr");
         } else {
             $radg->setValue("by_type");
         }
         $op_type = new ilRadioOption($lng->txt("cont_resources_of_type"), "by_type", "");
         $radg->addOption($op_type);
         $op_itemgroup = new ilRadioOption($lng->txt("obj_itgr"), "itgr", "");
         $radg->addOption($op_itemgroup);
         $form->addItem($radg);
     }
     // type selection
     $type_prop = new ilSelectInputGUI($this->lng->txt("cont_type"), "type");
     $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
     $obj_type = ilObject::_lookupType($obj_id);
     $sub_objs = $objDefinition->getGroupedRepositoryObjectTypes($obj_type);
     $types = array();
     foreach ($sub_objs as $k => $so) {
         if ($k != "itgr") {
             $types[$k] = $this->lng->txt("objs_" . $k) . " (" . (int) $type_counts[$k] . ")";
         }
     }
     $type_prop->setOptions($types);
     $selected = $a_insert ? "" : $this->content_obj->getResourceListType();
     $type_prop->setValue($selected);
     if (count($item_groups) > 0) {
         $op_type->addSubItem($type_prop);
     } else {
         $form->addItem($type_prop);
     }
     if (count($item_groups) > 0) {
         // item groups
         $options = $item_groups;
         $si = new ilSelectInputGUI($this->lng->txt("obj_itgr"), "itgr");
         $si->setOptions($options);
         $selected = $a_insert ? "" : $this->content_obj->getItemGroupRefId();
         $op_itemgroup->addSubItem($si);
     }
     // save/cancel buttons
     if ($a_insert) {
         $form->addCommandButton("create_resources", $lng->txt("save"));
         $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
     } else {
         $form->addCommandButton("update_resources", $lng->txt("save"));
         $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
     }
     $html = $form->getHTML();
     $tpl->setContent($html);
     return $ret;
 }
Esempio n. 20
0
 /**
  * Edit section form.
  */
 function edit($a_insert = false)
 {
     global $ilCtrl, $tpl, $lng;
     $this->displayValidationError();
     // edit form
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     if ($a_insert) {
         $form->setTitle($this->lng->txt("cont_insert_section"));
     } else {
         $form->setTitle($this->lng->txt("cont_update_section"));
     }
     // characteristic selection
     require_once "./Services/Form/classes/class.ilAdvSelectInputGUI.php";
     $char_prop = new ilAdvSelectInputGUI($this->lng->txt("cont_characteristic"), "characteristic");
     $chars = $this->getCharacteristics();
     if (is_object($this->content_obj)) {
         if ($chars[$a_seleted_value] == "" && $this->content_obj->getCharacteristic() != "") {
             $chars = array_merge(array($this->content_obj->getCharacteristic() => $this->content_obj->getCharacteristic()), $chars);
         }
     }
     $selected = $a_insert ? "Block" : $this->content_obj->getCharacteristic();
     foreach ($chars as $k => $char) {
         $html = '<div class="ilCOPgEditStyleSelectionItem"><div class="ilc_section_' . $k . '" style="' . self::$style_selector_reset . '">' . $char . '</div></div>';
         $char_prop->addOption($k, $char, $html);
     }
     $char_prop->setValue($selected);
     $form->addItem($char_prop);
     // save/cancel buttons
     if ($a_insert) {
         $form->addCommandButton("create_section", $lng->txt("save"));
         $form->addCommandButton("cancelCreate", $lng->txt("cancel"));
     } else {
         $form->addCommandButton("update", $lng->txt("save"));
         $form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
     }
     $html = $form->getHTML();
     $tpl->setContent($html);
     return $ret;
 }
 public function showAssignmentForm()
 {
     global $ilUser, $ilErr;
     if (!$this->mlists->getCurrentMailingList()->getId()) {
         $this->showMembersList();
         return true;
     }
     if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId())) {
         $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
     }
     $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members_form.html', 'Services/Contact');
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
     $form->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
     $form->setTitle($this->lng->txt('mail_assign_entry_to_mailing_list') . ' ' . $this->mlists->getCurrentMailingList()->getTitle());
     $options = array();
     $options[''] = $this->lng->txt('please_select');
     $all_entries = $this->abook->getEntries();
     if ((int) count($all_entries)) {
         foreach ($all_entries as $entry) {
             $options[$entry['addr_id']] = $entry['login'] != '' ? $entry['login'] : $entry['email'];
         }
     }
     $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
     if ((int) count($assigned_entries)) {
         foreach ($assigned_entries as $assigned_entry) {
             if (is_array($options) && array_key_exists($assigned_entry['addr_id'], $options)) {
                 unset($options[$assigned_entry['addr_id']]);
             }
         }
     }
     if (count($options) > 1) {
         $formItem = new ilSelectInputGUI($this->lng->txt('mail_entry_of_addressbook'), 'addr_id');
         $formItem->setOptions($options);
         $formItem->setValue($this->mlists->getCurrentMailingList()->getTitle());
         $form->addItem($formItem);
         $form->addCommandButton('saveAssignmentForm', $this->lng->txt('assign'));
     } else {
         if (count($options) == 1 && (int) count($all_entries)) {
             ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_all_addressbook_entries_assigned'));
         } else {
             if (!(int) count($all_entries)) {
                 ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_no_addressbook_entries'));
             }
         }
     }
     $form->addCommandButton('showMembersList', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $form->getHTML());
     $this->tpl->show();
     return true;
 }
 public function addQuestion()
 {
     global $lng, $ilCtrl, $tpl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $ilCtrl->setParameter($this, 'qtype', $_REQUEST['qtype']);
     $form = new ilPropertyFormGUI();
     $ilCtrl->setParameter($this, 'test_express_mode', 1);
     $form->setFormAction($ilCtrl->getFormAction($this, "handleToolbarCommand"));
     $form->setTitle($lng->txt("ass_create_question"));
     include_once 'Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
     $pool = new ilObjQuestionPool();
     $questionTypes = $pool->getQuestionTypes(false, true);
     $options = array();
     // question type
     foreach ($questionTypes as $label => $data) {
         $options[$data['question_type_id']] = $label;
     }
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     $si = new ilSelectInputGUI($lng->txt("question_type"), "qtype");
     $si->setOptions($options);
     $form->addItem($si, true);
     // position
     $questions = $this->test_object->getQuestionTitlesAndIndexes();
     if ($questions) {
         $si = new ilSelectInputGUI($lng->txt("position"), "position");
         $options = array('0' => $lng->txt('first'));
         foreach ($questions as $key => $title) {
             $options[$key] = $lng->txt('behind') . ' ' . $title . ' [' . $this->lng->txt('question_id_short') . ': ' . $key . ']';
         }
         $si->setOptions($options);
         $si->setValue($_REQUEST['q_id']);
         $form->addItem($si, true);
     }
     // content editing mode
     if (ilObjAssessmentFolder::isAdditionalQuestionContentEditingModePageObjectEnabled()) {
         $ri = new ilRadioGroupInputGUI($lng->txt("tst_add_quest_cont_edit_mode"), "add_quest_cont_edit_mode");
         $ri->addOption(new ilRadioOption($lng->txt('tst_add_quest_cont_edit_mode_default'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT));
         $ri->addOption(new ilRadioOption($lng->txt('tst_add_quest_cont_edit_mode_page_object'), assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT));
         $ri->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT);
         $form->addItem($ri, true);
     } else {
         $hi = new ilHiddenInputGUI("question_content_editing_type");
         $hi->setValue(assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT);
         $form->addItem($hi, true);
     }
     if ($this->test_object->getPoolUsage()) {
         // use pool
         $usage = new ilRadioGroupInputGUI($this->lng->txt("assessment_pool_selection"), "usage");
         $usage->setRequired(true);
         $no_pool = new ilRadioOption($this->lng->txt("assessment_no_pool"), 1);
         $usage->addOption($no_pool);
         $existing_pool = new ilRadioOption($this->lng->txt("assessment_existing_pool"), 3);
         $usage->addOption($existing_pool);
         $new_pool = new ilRadioOption($this->lng->txt("assessment_new_pool"), 2);
         $usage->addOption($new_pool);
         $form->addItem($usage);
         $usage->setValue(1);
         $questionpools = ilObjQuestionPool::_getAvailableQuestionpools(FALSE, FALSE, TRUE, FALSE, FALSE, "write");
         $pools_data = array();
         foreach ($questionpools as $key => $p) {
             $pools_data[$key] = $p['title'];
         }
         $pools = new ilSelectInputGUI($this->lng->txt("select_questionpool"), "sel_qpl");
         $pools->setOptions($pools_data);
         $existing_pool->addSubItem($pools);
         $name = new ilTextInputGUI($this->lng->txt("name"), "txt_qpl");
         $name->setSize(50);
         $name->setMaxLength(50);
         $new_pool->addSubItem($name);
     }
     $form->addCommandButton("handleToolbarCommand", $lng->txt("submit"));
     $form->addCommandButton("questions", $lng->txt("cancel"));
     return $tpl->setContent($form->getHTML());
 }
 /**
  * Set the language settings
  */
 function settingsObject()
 {
     global $ilSetting;
     $translate_key = "lang_translate_" . $this->object->key;
     // save and get the page translation setting
     if (!empty($_POST)) {
         $ilSetting->set($translate_key, (bool) $_POST["translation"]);
         ilUtil::sendSuccess($this->lng->txt("settings_saved"));
     }
     $translate = $ilSetting->get($translate_key, false);
     require_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt("language_settings"));
     $form->setPreventDoubleSubmission(false);
     $form->addCommandButton('settings', $this->lng->txt("language_change_settings"));
     $ci = new ilCheckboxInputGUI($this->lng->txt("language_translation_enabled"), "translation");
     $ci->setChecked((bool) $translate);
     $ci->setInfo($this->lng->txt("language_note_translation"));
     $form->addItem($ci);
     $this->tpl->setContent($form->getHTML());
 }
 /**
  * Edit personal desktop settings.
  */
 public function editSettings()
 {
     global $ilCtrl, $lng, $ilSetting;
     $pd_set = new ilSetting("pd");
     $enable_calendar = ilCalendarSettings::_getInstance()->isEnabled();
     #$enable_calendar = $ilSetting->get("enable_calendar");
     $enable_block_moving = $pd_set->get("enable_block_moving");
     $enable_active_users = $ilSetting->get("block_activated_pdusers");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle($lng->txt("pd_settings"));
     // Enable calendar
     $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_calendar"), "enable_calendar");
     $cb_prop->setValue("1");
     //$cb_prop->setInfo($lng->txt("pd_enable_block_moving_info"));
     $cb_prop->setChecked($enable_calendar);
     $form->addItem($cb_prop);
     // Enable bookmarks
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_bookmarks"), "enable_bookmarks");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("disable_bookmarks") ? "0" : "1");
     $form->addItem($cb_prop);
     // Enable contacts
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_contacts"), "enable_contacts");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("disable_contacts") ? "0" : "1");
     $cb_prop_requires_mail = new ilCheckboxInputGUI($lng->txt('pd_enable_contacts_requires_mail'), 'enable_contacts_require_mail');
     $cb_prop_requires_mail->setValue("1");
     $cb_prop_requires_mail->setChecked($ilSetting->get("disable_contacts_require_mail") ? "0" : "1");
     $cb_prop->addSubItem($cb_prop_requires_mail);
     $form->addItem($cb_prop);
     // Enable notes
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_notes"), "enable_notes");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("disable_notes") ? "0" : "1");
     $form->addItem($cb_prop);
     // Enable notes
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_comments"), "enable_comments");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("disable_comments") ? "0" : "1");
     $form->addItem($cb_prop);
     $comm_del_user = new ilCheckboxInputGUI($lng->txt("pd_enable_comments_del_user"), "comm_del_user");
     $comm_del_user->setChecked($ilSetting->get("comments_del_user", 0));
     $cb_prop->addSubItem($comm_del_user);
     $comm_del_tutor = new ilCheckboxInputGUI($lng->txt("pd_enable_comments_del_tutor"), "comm_del_tutor");
     $comm_del_tutor->setChecked($ilSetting->get("comments_del_tutor", 1));
     $cb_prop->addSubItem($comm_del_tutor);
     // Enable Chatviewer
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_chatviewer"), "block_activated_chatviewer");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($ilSetting->get("block_activated_chatviewer"));
     $form->addItem($cb_prop);
     // Enable block moving
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_block_moving"), "enable_block_moving");
     $cb_prop->setValue("1");
     $cb_prop->setInfo($lng->txt("pd_enable_block_moving_info"));
     $cb_prop->setChecked($enable_block_moving);
     $form->addItem($cb_prop);
     // Enable active users block
     $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_active_users"), "block_activated_pdusers");
     $cb_prop->setValue("1");
     $cb_prop->setChecked($enable_active_users);
     // maximum inactivity time
     $ti_prop = new ilNumberInputGUI($lng->txt("pd_time_before_removal"), "time_removal");
     $ti_prop->setValue($pd_set->get("user_activity_time"));
     $ti_prop->setInfo($lng->txt("pd_time_before_removal_info"));
     $ti_prop->setMaxLength(3);
     $ti_prop->setSize(3);
     $cb_prop->addSubItem($ti_prop);
     // osi host
     // see http://www.onlinestatus.org
     $ti_prop = new ilTextInputGUI($lng->txt("pd_osi_host"), "osi_host");
     $ti_prop->setValue($pd_set->get("osi_host"));
     $ti_prop->setInfo($lng->txt("pd_osi_host_info") . ' <a href="http://www.onlinestatus.org" target="_blank">http://www.onlinestatus.org</a>');
     $cb_prop->addSubItem($ti_prop);
     $form->addItem($cb_prop);
     // Enable 'My Offers' (default personal items)
     $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_my_offers'), 'enable_my_offers');
     $cb_prop->setValue('1');
     $cb_prop->setInfo($lng->txt('pd_enable_my_offers_info'));
     $cb_prop->setChecked($ilSetting->get('disable_my_offers') ? '0' : '1');
     $form->addItem($cb_prop);
     // Enable 'My Memberships'
     $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_my_memberships'), 'enable_my_memberships');
     $cb_prop->setValue('1');
     $cb_prop->setInfo($lng->txt('pd_enable_my_memberships_info'));
     $cb_prop->setChecked($ilSetting->get('disable_my_memberships') ? '0' : '1');
     $form->addItem($cb_prop);
     if ($ilSetting->get('disable_my_offers') == 0 && $ilSetting->get('disable_my_memberships') == 0) {
         // Default view of personal items
         $sb_prop = new ilSelectInputGUI($lng->txt('pd_personal_items_default_view'), 'personal_items_default_view');
         $sb_prop->setInfo($lng->txt('pd_personal_items_default_view_info'));
         $option = array();
         $option[0] = $lng->txt('pd_my_offers');
         $option[1] = $lng->txt('my_courses_groups');
         $sb_prop->setOptions($option);
         $sb_prop->setValue((int) $ilSetting->get('personal_items_default_view'));
         $form->addItem($sb_prop);
     }
     // command buttons
     $form->addCommandButton("saveSettings", $lng->txt("save"));
     $form->addCommandButton("view", $lng->txt("cancel"));
     $this->tpl->setContent($form->getHTML());
 }
 public function editPriceObject()
 {
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $price_id = $_GET['price_id'] ? $_GET['price_id'] : $_POST['price_id'];
     $price = ilPaymentPrices::_getPrice($price_id);
     $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']);
     $tmp_pobject = ilPaymentObject::_getObjectData($_GET['pobject_id']);
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject['ref_id'], false);
     if ($tmp_obj) {
         $form->setTitle($tmp_obj->getTitle());
     } else {
         $form->setTitle($this->lng->txt('object_not_found'));
     }
     //price_type
     $radio_group = new ilRadioGroupInputGUI('', 'price_type');
     $radio_group->setTitle($this->lng->txt('duration'));
     $radio_group->setRequired(true);
     $radio_group->setValue($price['price_type']);
     $radio_group->setPostVar('price_type');
     $radio_option_1 = new ilRadioOption($this->lng->txt('duration_month'), ilPaymentPrices::TYPE_DURATION_MONTH);
     // duration month
     $oDuration = new ilNumberInputGUI();
     $oDuration->setTitle($this->lng->txt('paya_months'));
     $oDuration->setSize('20%');
     $oDuration->setValue($price['duration']);
     $oDuration->setPostVar('duration_month');
     $radio_option_1->addSubItem($oDuration);
     $radio_group->addOption($radio_option_1);
     $radio_option_3 = new ilRadioOption($this->lng->txt('duration_date'), ilPaymentPrices::TYPE_DURATION_DATE);
     // duration_date from
     $o_date_from = new ilDateTimeInputGUI();
     $o_date_from->setTitle($this->lng->txt('cal_from'));
     $o_date_from->setDate(new ilDate($price['duration_from'], IL_CAL_DATE));
     $o_date_from->setPostVar('duration_date_from');
     $radio_option_3->addSubItem($o_date_from);
     // duration_date until
     $o_date_until = new ilDateTimeInputGUI();
     $o_date_until->setTitle($this->lng->txt('cal_until'));
     $o_date_until->setDate(new ilDate($price['duration_until'], IL_CAL_DATE));
     $o_date_until->setPostVar('duration_date_until');
     $radio_option_3->addSubItem($o_date_until);
     $radio_group->addOption($radio_option_3);
     $radio_option_2 = new ilRadioOption($this->lng->txt('unlimited_duration'), ilPaymentPrices::TYPE_UNLIMITED_DURATION);
     $radio_group->addOption($radio_option_2);
     $form->addItem($radio_group);
     // description
     $oDescription = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $oDescription->setRows(4);
     $oDescription->setCols(35);
     $oDescription->setValue($price['description']);
     $form->addItem($oDescription);
     // price
     $oPrice = new ilNumberInputGUI();
     $oPrice->setTitle($this->lng->txt('price_a'));
     $oPrice->setSize('20%');
     $oPrice->setRequired(true);
     $oPrice->setValue($price['price']);
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     $genSet = ilPaymentSettings::_getInstance();
     $oPrice->setInfo($genSet->get('currency_unit'));
     $oPrice->setPostVar('price');
     $oPrice->allowDecimals(true);
     $form->addItem($oPrice);
     //extension
     $oExtension = new ilCheckboxInputGUI($this->lng->txt('extension_price'), 'extension');
     $oExtension->setChecked($price['extension']);
     $form->addItem($oExtension);
     $o_hidden_1 = new ilHiddenInputGUI('pobject_id');
     $o_hidden_1->setValue((int) $_GET['pobject_id']);
     $o_hidden_1->setPostVar('pobject_id');
     $o_hidden_2 = new ilHiddenInputGUI('price_id');
     $o_hidden_2->setValue((int) $_GET['price_id']);
     $o_hidden_2->setPostVar('price_id');
     $form->addItem($o_hidden_1);
     $form->addItem($o_hidden_2);
     $form->addCommandButton('updatePrice', $this->lng->txt('save'));
     $form->addCommandButton('editPrices', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $form->getHTML());
 }
 /**
  * Role Mapping Tab
  * @global ilToolbarGUI $ilToolbar 
  */
 public function roleMapping()
 {
     global $ilToolbar;
     $this->setSubTabs();
     $this->tabs_gui->setSubTabActive('ldap_role_mapping');
     $ilToolbar->addButton($this->lng->txt("ldap_new_role_assignment"), $this->ctrl->getLinkTarget($this, 'addRoleMapping'));
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     //Set propertyform for synchronization settings
     include_once "./Services/Form/classes/class.ilCombinationInputGUI.php";
     $propertie_form = new ilPropertyFormGUI();
     $propertie_form->setTitle($this->lng->txt('ldap_role_settings'));
     $propertie_form->setFormAction($this->ctrl->getFormAction($this, "saveSyncronizationSettings"));
     $propertie_form->addCommandButton("saveSyncronizationSettings", $this->lng->txt('save'));
     $role_active = new ilCheckboxInputGUI($this->lng->txt('ldap_role_active'));
     $role_active->setPostVar('role_sync_active');
     $role_active->setChecked($this->server->enabledRoleSynchronization() ? true : false);
     $propertie_form->addItem($role_active);
     $binding = new ilCombinationInputGUI($this->lng->txt('ldap_server_binding'));
     $binding->setInfo($this->lng->txt('ldap_role_bind_user_info'));
     $user = new ilTextInputGUI("");
     $user->setPostVar("role_bind_user");
     $user->setValue($this->server->getRoleBindDN());
     $user->setSize(50);
     $user->setMaxLength(255);
     $binding->addCombinationItem(0, $user, $this->lng->txt('ldap_role_bind_user'));
     $pass = new ilPasswordInputGUI("");
     $pass->setPostVar("role_bind_pass");
     $pass->setValue($this->server->getRoleBindPassword());
     $pass->setSize(12);
     $pass->setMaxLength(36);
     $pass->setRetype(false);
     $binding->addCombinationItem(1, $pass, $this->lng->txt('ldap_role_bind_pass'));
     $propertie_form->addItem($binding);
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.ldap_role_mappings.html', 'Services/LDAP');
     $this->tpl->setVariable("NEW_ASSIGNMENT_TBL", $propertie_form->getHTML());
     //Set Group Assignments Table if mappings exist
     include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMappingSettings.php';
     $mapping_instance = ilLDAPRoleGroupMappingSettings::_getInstanceByServerId($this->server->getServerId());
     $mappings = $mapping_instance->getMappings();
     if (count($mappings)) {
         include_once "./Services/LDAP/classes/class.ilLDAPRoleMappingTableGUI.php";
         $table_gui = new ilLDAPRoleMappingTableGUI($this, $this->server->getServerId(), "roleMapping");
         $table_gui->setTitle($this->lng->txt('ldap_role_group_assignments'));
         $table_gui->setData($mappings);
         $this->tpl->setVariable("RULES_TBL", $table_gui->getHTML());
     }
 }
 /**
  * Prepares history table and displays it.
  *
  * @global ilTemplate $tpl
  * @global ilLanguage $lng
  * @param array $messages
  * @param ilPropertyFormGUI $durationForm
  */
 private function showMessages($messages, $durationForm, $export = false, $psessions = array(), $from, $to)
 {
     //global $tpl, $ilUser, $ilCtrl, $lng;
     global $tpl, $lng, $ilCtrl;
     include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
     if (!ilChatroom::checkUserPermissions('read', $this->gui->ref_id)) {
         $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
         $ilCtrl->redirectByClass("ilrepositorygui", "");
     }
     $this->gui->switchToVisibleMode();
     $tpl->addCSS('Modules/Chatroom/templates/default/style.css');
     // should be able to grep templates
     if ($export) {
         $roomTpl = new ilTemplate('tpl.history_export.html', true, true, 'Modules/Chatroom');
     } else {
         $roomTpl = new ilTemplate('tpl.history.html', true, true, 'Modules/Chatroom');
     }
     $scopes = array();
     if ($export) {
         ilDatePresentation::setUseRelativeDates(false);
     }
     global $ilUser;
     $time_format = $ilUser->getTimeFormat();
     $prevDate = '';
     $messagesShown = 0;
     $lastDateTime = null;
     foreach ($messages as $message) {
         $message['message']->message = json_decode($message['message']->message);
         switch ($message['message']->type) {
             case 'message':
                 if ($_REQUEST['scope'] && $message['message']->sub == $_REQUEST['scope'] || !$_REQUEST['scope'] && !$message['message']->sub) {
                     $date = new ilDate($message['timestamp'], IL_CAL_UNIX);
                     $dateTime = new ilDateTime($message['timestamp'], IL_CAL_UNIX);
                     $currentDate = ilDatePresentation::formatDate($dateTime);
                     $roomTpl->setCurrentBlock('MESSAGELINE');
                     $roomTpl->setVariable('MESSAGECONTENT', $message['message']->message->content);
                     // oops... it is a message? ^^
                     $roomTpl->setVariable('MESSAGESENDER', $message['message']->user->username);
                     if (null == $lastDateTime || date('d', $lastDateTime->get(IL_CAL_UNIX)) != date('d', $dateTime->get(IL_CAL_UNIX)) || date('m', $lastDateTime->get(IL_CAL_UNIX)) != date('m', $dateTime->get(IL_CAL_UNIX)) || date('Y', $lastDateTime->get(IL_CAL_UNIX)) != date('Y', $dateTime->get(IL_CAL_UNIX))) {
                         $roomTpl->setVariable('MESSAGEDATE', ilDatePresentation::formatDate($date));
                     }
                     if ($prevDate != $currentDate) {
                         switch ($time_format) {
                             case ilCalendarSettings::TIME_FORMAT_24:
                                 $date_string = $dateTime->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone());
                                 break;
                             case ilCalendarSettings::TIME_FORMAT_12:
                                 $date_string = $dateTime->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone());
                                 break;
                         }
                         $roomTpl->setVariable('MESSAGETIME', $date_string);
                         $prevDate = $currentDate;
                     }
                     $roomTpl->parseCurrentBlock();
                     $lastDateTime = $dateTime;
                     ++$messagesShown;
                 }
                 break;
         }
     }
     foreach ($psessions as $session) {
         $scopes[$session['proom_id']] = $session['title'];
     }
     if (isset($scopes[''])) {
         unset($scopes['']);
     }
     if (!$messagesShown) {
         //$roomTpl->touchBlock('NO_MESSAGES');
         $roomTpl->setVariable('LBL_NO_MESSAGES', $lng->txt('no_messages'));
     }
     asort($scopes, SORT_STRING);
     $scopes = array($lng->txt('main')) + $scopes;
     if (count($scopes) > 1) {
         $select = new ilSelectInputGUI($lng->txt('scope'), 'scope');
         $select->setOptions($scopes);
         if (isset($_REQUEST['scope'])) {
             $select->setValue($_REQUEST['scope']);
         }
         $durationForm->addItem($select);
     }
     $room = ilChatroom::byObjectId($this->gui->object->getId());
     //if ($room->getSetting('private_rooms_enabled')) {
     $prevUseRelDates = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     $unixFrom = $from->getUnixTime();
     $unixTo = $to->getUnixTime();
     if ($unixFrom == $unixTo) {
         $date = new ilDate($unixFrom, IL_CAL_UNIX);
         $date_sub = ilDatePresentation::formatDate($date);
     } else {
         $date1 = new ilDate($unixFrom, IL_CAL_UNIX);
         $date2 = new ilDate($unixTo, IL_CAL_UNIX);
         $date_sub = ilDatePresentation::formatPeriod($date1, $date2);
     }
     ilDatePresentation::setUseRelativeDates($prevUseRelDates);
     $isPrivateRoom = (bool) (int) $_REQUEST['scope'];
     if ($isPrivateRoom) {
         $roomTpl->setVariable('ROOM_TITLE', sprintf($lng->txt('history_title_private_room'), $scopes[(int) $_REQUEST['scope']]) . ' (' . $date_sub . ')');
     } else {
         $roomTpl->setVariable('ROOM_TITLE', sprintf($lng->txt('history_title_general'), $this->gui->object->getTitle()) . ' (' . $date_sub . ')');
     }
     //}
     if ($export) {
         header("Content-Type: text/html");
         header("Content-Disposition: attachment; filename=\"" . urlencode($scopes[(int) $_REQUEST['scope']] . '.html') . "\"");
         echo $roomTpl->get();
         exit;
     }
     $roomTpl->setVariable('PERIOD_FORM', $durationForm->getHTML());
     $tpl->setVariable('ADM_CONTENT', $roomTpl->get());
 }
 /**
  * display survey settings form
  * 
  * Default settings tab for Survey settings
  *
  * @access	public
  */
 function settingsObject()
 {
     global $ilAccess, $rbacreview, $lng, $ilCtrl, $tpl, $ilTabs;
     $ilTabs->activateTab("settings");
     $surveySetting = new ilSetting("survey");
     $unlimited_invitation = array_key_exists("unlimited_invitation", $_GET) ? $_GET["unlimited_invitation"] : $surveySetting->get("unlimited_invitation");
     $use_anonymous_id = array_key_exists("use_anonymous_id", $_GET) ? $_GET["use_anonymous_id"] : $surveySetting->get("use_anonymous_id");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle($lng->txt("survey_defaults"));
     // unlimited invitation
     $enable = new ilCheckboxInputGUI($lng->txt("survey_unlimited_invitation"), "unlimited_invitation");
     $enable->setChecked($unlimited_invitation);
     $enable->setInfo($lng->txt("survey_unlimited_invitation_desc"));
     $form->addItem($enable);
     // Survey Code
     $code = new ilCheckboxInputGUI($lng->txt("use_anonymous_id"), "use_anonymous_id");
     $code->setChecked($use_anonymous_id);
     $code->setInfo($lng->txt("use_anonymous_id_desc"));
     $form->addItem($code);
     if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
         $form->addCommandButton("saveSettings", $lng->txt("save"));
     }
     $tpl->setVariable("ADM_CONTENT", $form->getHTML());
 }
Esempio n. 29
0
 public function adoptTeamAssignmentsFormObject()
 {
     global $ilCtrl, $ilTabs, $lng, $tpl;
     $this->checkPermission("write");
     if (!$this->ass) {
         $ilCtrl->redirect($this, "listAssignments");
     }
     $ilTabs->activateTab("content");
     $this->addContentSubTabs("list_assignments");
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setTitle($lng->txt("exc_team_assignment_adopt"));
     $form->setFormAction($ilCtrl->getFormAction($this, "adoptTeamAssignments"));
     $options = ilExAssignment::getAdoptableTeamAssignments($this->ass->getExerciseId());
     // we must not have existing teams in assignment
     if (array_key_exists($this->ass->getId(), $options)) {
         $ilCtrl->redirect($this, "listAssignments");
     }
     $teams = new ilRadioGroupInputGUI($lng->txt("exc_assignment"), "ass_adpt");
     $teams->setValue(-1);
     $teams->addOption(new ilRadioOption($lng->txt("exc_team_assignment_adopt_none"), -1));
     foreach ($options as $id => $item) {
         $option = new ilRadioOption($item["title"], $id);
         $option->setInfo($lng->txt("exc_team_assignment_adopt_teams") . ": " . $item["teams"]);
         $teams->addOption($option);
     }
     $form->addItem($teams);
     $form->addCommandButton("adoptTeamAssignments", $lng->txt("save"));
     $form->addCommandButton("listAssignments", $lng->txt("cancel"));
     $tpl->setContent($form->getHTML());
 }
 /**
  * displays system check menu
  *
  * @access	public
  */
 function checkObject()
 {
     global $rbacsystem, $ilias, $objDefinition, $ilSetting;
     $this->setSystemCheckSubTabs("system_check_sub");
     if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     //echo "1";
     if ($_POST['count_limit'] !== null || $_POST['age_limit'] !== null || $_POST['type_limit'] !== null) {
         $ilias->account->writePref('systemcheck_count_limit', is_numeric($_POST['count_limit']) && $_POST['count_limit'] > 0 ? $_POST['count_limit'] : '');
         $ilias->account->writePref('systemcheck_age_limit', is_numeric($_POST['age_limit']) && $_POST['age_limit'] > 0 ? $_POST['age_limit'] : '');
         $ilias->account->writePref('systemcheck_type_limit', trim($_POST['type_limit']));
     }
     if ($_POST["mode"]) {
         //echo "3";
         $this->writeCheckParams();
         $this->startValidator($_POST["mode"], $_POST["log_scan"]);
     } else {
         //echo "4";
         include_once "./Services/Repository/classes/class.ilValidator.php";
         $validator = new ilValidator();
         $hasScanLog = $validator->hasScanLog();
         $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.adm_check.html", "Modules/SystemFolder");
         if ($hasScanLog) {
             $this->tpl->setVariable("TXT_VIEW_LOG", $this->lng->txt("view_last_log"));
         }
         $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
         $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("systemcheck"));
         $this->tpl->setVariable("COLSPAN", 3);
         $this->tpl->setVariable("TXT_ANALYZE_TITLE", $this->lng->txt("analyze_data"));
         $this->tpl->setVariable("TXT_ANALYSIS_OPTIONS", $this->lng->txt("analysis_options"));
         $this->tpl->setVariable("TXT_REPAIR_OPTIONS", $this->lng->txt("repair_options"));
         $this->tpl->setVariable("TXT_OUTPUT_OPTIONS", $this->lng->txt("output_options"));
         $this->tpl->setVariable("TXT_SCAN", $this->lng->txt("scan"));
         $this->tpl->setVariable("TXT_SCAN_DESC", $this->lng->txt("scan_desc"));
         $this->tpl->setVariable("TXT_DUMP_TREE", $this->lng->txt("dump_tree"));
         $this->tpl->setVariable("TXT_DUMP_TREE_DESC", $this->lng->txt("dump_tree_desc"));
         $this->tpl->setVariable("TXT_CLEAN", $this->lng->txt("clean"));
         $this->tpl->setVariable("TXT_CLEAN_DESC", $this->lng->txt("clean_desc"));
         $this->tpl->setVariable("TXT_RESTORE", $this->lng->txt("restore_missing"));
         $this->tpl->setVariable("TXT_RESTORE_DESC", $this->lng->txt("restore_missing_desc"));
         $this->tpl->setVariable("TXT_PURGE", $this->lng->txt("purge_missing"));
         $this->tpl->setVariable("TXT_PURGE_DESC", $this->lng->txt("purge_missing_desc"));
         $this->tpl->setVariable("TXT_RESTORE_TRASH", $this->lng->txt("restore_trash"));
         $this->tpl->setVariable("TXT_RESTORE_TRASH_DESC", $this->lng->txt("restore_trash_desc"));
         $this->tpl->setVariable("TXT_PURGE_TRASH", $this->lng->txt("purge_trash"));
         $this->tpl->setVariable("TXT_PURGE_TRASH_DESC", $this->lng->txt("purge_trash_desc"));
         $this->tpl->setVariable("TXT_COUNT_LIMIT", $this->lng->txt("purge_count_limit"));
         $this->tpl->setVariable("TXT_COUNT_LIMIT_DESC", $this->lng->txt("purge_count_limit_desc"));
         $this->tpl->setVariable("COUNT_LIMIT_VALUE", $ilias->account->getPref("systemcheck_count_limit"));
         $this->tpl->setVariable("TXT_AGE_LIMIT", $this->lng->txt("purge_age_limit"));
         $this->tpl->setVariable("TXT_AGE_LIMIT_DESC", $this->lng->txt("purge_age_limit_desc"));
         $this->tpl->setVariable("AGE_LIMIT_VALUE", $ilias->account->getPref("systemcheck_age_limit"));
         $this->tpl->setVariable("TXT_TYPE_LIMIT", $this->lng->txt("purge_type_limit"));
         $this->tpl->setVariable("TXT_TYPE_LIMIT_DESC", $this->lng->txt("purge_type_limit_desc"));
         if ($ilias->account->getPref('systemcheck_mode_scan')) {
             $this->tpl->touchBlock('mode_scan_checked');
         }
         if ($ilias->account->getPref('systemcheck_mode_dump_tree')) {
             $this->tpl->touchBlock('mode_dump_tree_checked');
         }
         if ($ilias->account->getPref('systemcheck_mode_clean')) {
             $this->tpl->touchBlock('mode_clean_checked');
         }
         if ($ilias->account->getPref('systemcheck_mode_restore')) {
             $this->tpl->touchBlock('mode_restore_checked');
             $this->tpl->touchBlock('mode_purge_disabled');
         } elseif ($ilias->account->getPref('systemcheck_mode_purge')) {
             $this->tpl->touchBlock('mode_purge_checked');
             $this->tpl->touchBlock('mode_restore_disabled');
         }
         if ($ilias->account->getPref('systemcheck_mode_restore_trash')) {
             $this->tpl->touchBlock('mode_restore_trash_checked');
             $this->tpl->touchBlock('mode_purge_trash_disabled');
         } elseif ($ilias->account->getPref('systemcheck_mode_purge_trash')) {
             $this->tpl->touchBlock('mode_purge_trash_checked');
             $this->tpl->touchBlock('mode_restore_trash_disabled');
         }
         if ($ilias->account->getPref('systemcheck_log_scan')) {
             $this->tpl->touchBlock('log_scan_checked');
         }
         // #9520 - restrict to types which can be found in tree
         $obj_types_in_tree = array();
         global $ilDB;
         $set = $ilDB->query('SELECT type FROM object_data od' . ' JOIN object_reference ref ON (od.obj_id = ref.obj_id)' . ' JOIN tree ON (tree.child = ref.ref_id)' . ' WHERE tree.tree < 1' . ' GROUP BY type');
         while ($row = $ilDB->fetchAssoc($set)) {
             $obj_types_in_tree[] = $row['type'];
         }
         $types = $objDefinition->getAllObjects();
         $ts = array("" => "");
         foreach ($types as $t) {
             if ($t != "" && !$objDefinition->isSystemObject($t) && $t != "root" && in_array($t, $obj_types_in_tree)) {
                 if ($objDefinition->isPlugin($t)) {
                     $ts[$t] = ilPlugin::lookupTxt("rep_robj", $t, "obj_" . $t);
                 } else {
                     $ts[$t] = $this->lng->txt("obj_" . $t);
                 }
             }
         }
         asort($ts);
         $this->tpl->setVariable("TYPE_LIMIT_CHOICE", ilUtil::formSelect($ilias->account->getPref("systemcheck_type_limit"), 'type_limit', $ts, false, true));
         $this->tpl->setVariable("TXT_LOG_SCAN", $this->lng->txt("log_scan"));
         $this->tpl->setVariable("TXT_LOG_SCAN_DESC", $this->lng->txt("log_scan_desc"));
         $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("start_scan"));
         $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save_params_for_cron"));
         include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
         $cron_form = new ilPropertyFormGUI();
         $cron_form->setFormAction($this->ctrl->getFormAction($this));
         $cron_form->setTitle($this->lng->txt('systemcheck_cronform'));
         $radio_group = new ilRadioGroupInputGUI($this->lng->txt('systemcheck_cron'), 'cronjob');
         $radio_group->setValue($ilSetting->get('systemcheck_cron'));
         $radio_opt = new ilRadioOption($this->lng->txt('disabled'), 0);
         $radio_group->addOption($radio_opt);
         $radio_opt = new ilRadioOption($this->lng->txt('enabled'), 1);
         $radio_group->addOption($radio_opt);
         $cron_form->addItem($radio_group);
         $cron_form->addCommandButton('saveCheckCron', $this->lng->txt('save'));
         $this->tpl->setVariable('CRON_FORM', $cron_form->getHTML());
     }
 }