/**
  * 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);
 }
 public function addCustomerObject()
 {
     global $ilToolbar;
     if ($_POST['sell_id'] != '') {
         $_GET['sell_id'] = $_POST['sell_id'];
     }
     if ($_GET['user_id'] != '') {
         $_POST['user_id'] = $_GET['user_id'];
     }
     if (!isset($_GET['sell_id'])) {
         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
         $this->showObjectSelectorObject();
         return true;
     }
     if (!isset($_POST['user_id'])) {
         ilUtil::sendInfo($this->lng->txt('paya_no_user_id_given'));
         $this->searchUserSPObject();
         return true;
     }
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $this->ctrl->setParameter($this, 'sell_id', $_GET['sell_id']);
     $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'searchUserSP'));
     $this->ctrl->setParameter($this, 'user_id', $_POST['user_id']);
     $pObjectId = ilPaymentObject::_lookupPobjectId($_GET['sell_id']);
     $obj = new ilPaymentObject($this->user_obj, $pObjectId);
     // get obj
     $tmp_obj = ilObjectFactory::getInstanceByRefId($_GET['sell_id'], false);
     if ($tmp_obj) {
         $tmp_object['title'] = $tmp_obj->getTitle();
     } else {
         $tmp_object['title'] = $this->lng->txt('object_not_found');
     }
     // get customer_obj
     $tmp_user = ilObjectFactory::getInstanceByObjId($_POST['user_id']);
     // get vendor_obj
     $tmp_vendor = ilObjectFactory::getInstanceByObjId($obj->getVendorId());
     /**/
     $oForm = new ilPropertyFormGUI();
     $oForm->setFormAction($this->ctrl->getFormAction($this, 'saveCustomer'));
     $oForm->setTitle($this->lng->txt($tmp_user->getFullname() . ' [' . $tmp_user->getLogin() . ']'));
     //transaction
     $oTransaction = new ilTextInputGUI();
     $oTransaction->setTitle($this->lng->txt('paya_transaction'));
     //$oTransaction->setValue(ilUtil::prepareFormOutut($_POST['transaction'], true));
     $oTransaction->setValue($_POST['transaction']);
     $oTransaction->setPostVar('transaction');
     $oForm->addItem($oTransaction);
     //object
     $oObject = new ilNonEditableValueGUI($this->lng->txt('title'));
     $oObject->setValue($tmp_obj->getTitle());
     $oForm->addItem($oObject);
     //vendor
     $oVendor = new ilNonEditableValueGUI($this->lng->txt('paya_vendor'));
     $oVendor->setValue($tmp_vendor->getFullname() . ' [' . $tmp_vendor->getLogin() . ']');
     $oForm->addItem($oVendor);
     // pay methods
     $oPayMethods = new ilSelectInputGUI($this->lng->txt('paya_pay_method'), 'pay_method');
     $payOptions = ilPaymethods::getPayMethodsOptions(false);
     $oPayMethods->setOptions($payOptions);
     $oPayMethods->setValue($_POST['pay_method']);
     $oPayMethods->setPostVar('pay_method');
     $oForm->addItem($oPayMethods);
     //duration
     $duration_options = array();
     $price_obj = new ilPaymentPrices($pObjectId);
     $standard_prices = array();
     $extension_prices = array();
     $standard_prices = $price_obj->getPrices();
     $extension_prices = $price_obj->getExtensionPrices();
     $prices = array_merge($standard_prices, $extension_prices);
     if (is_array($prices)) {
         $genSet = ilPaymentSettings::_getInstance();
         $currency_unit = $genSet->get('currency_unit');
         foreach ($prices as $price) {
             switch ($price['price_type']) {
                 case ilPaymentPrices::TYPE_DURATION_MONTH:
                     $txt_duration = $price['duration'] . ' ' . $this->lng->txt('paya_months') . ' -> ' . $price['price'] . ' ' . $currency_unit;
                     break;
                 case ilPaymentPrices::TYPE_DURATION_DATE:
                     include_once './Services/Calendar/classes/class.ilDatePresentation.php';
                     $txt_duration = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)) . " -> " . ilPaymentPrices::_getPriceString($price["price_id"]) . ' ' . $currency_unit;
                     break;
                 case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
                     $txt_duration = $this->lng->txt('unlimited_duration') . ' -> ' . $price['price'] . ' ' . $currency_unit;
                     break;
             }
             $txt_extension = '';
             if ($price['extension'] == 1) {
                 $txt_extension = ' (' . $this->lng->txt('extension_price') . ') ';
             }
             $duration_options[$price['price_id']] .= $txt_duration . '' . $txt_extension;
         }
     }
     $oDuration = new ilSelectInputGUI($this->lng->txt('duration'), 'price_id');
     $oDuration->setOptions($duration_options);
     $oDuration->setValue($_POST['price_id']);
     $oForm->addItem($oDuration);
     //payed
     $o_payed = new ilSelectInputGUI();
     $payed_option = array('1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no'));
     $o_payed->setTitle($this->lng->txt('paya_payed'));
     $o_payed->setOptions($payed_option);
     $o_payed->setValue($_POST['payed']);
     $o_payed->setPostVar('payed');
     $oForm->addItem($o_payed);
     $o_access = new ilSelectInputGUI();
     $access_option = array('1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no'));
     $o_access->setTitle($this->lng->txt('paya_access'));
     $o_access->setOptions($access_option);
     $o_access->setValue($_POST['access']);
     $o_access->setPostVar('access');
     $oForm->addItem($o_access);
     $oForm->addCommandButton('saveCustomer', $this->lng->txt('save'));
     $oForm->addCommandButton('bookings', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $oForm->getHTML());
     return true;
 }
 public function initFilter()
 {
     global $lng, $ilUser;
     $o_filter = new ilSelectInputGUI();
     $filter_option = array('title' => $lng->txt('title'), 'author' => $lng->txt('author'), 'metadata' => $lng->txt('meta_data'));
     $o_filter->setTitle($lng->txt('search_in'));
     $o_filter->setOptions($filter_option);
     $o_filter->setValue($_SESSION['content_filter']['sel_filter_type']);
     $o_filter->setPostVar('sel_filter_type');
     $this->addFilterItem($o_filter);
     $o_filter->readFromSession();
     $this->filter["sel_filter_type"] = $o_filter->getValue();
     $o_filter_by = new ilTextInputGUI($lng->txt('filter_by'));
     $o_filter_by->setValue($_SESSION['content_filter']['filter_text']);
     $o_filter_by->setPostVar('filter_text');
     $this->addFilterItem($o_filter_by);
     $o_filter_by->readFromSession();
     $this->filter["filter_text"] = $o_filter_by->getValue();
     if ($this->settings->get('enable_topics')) {
         ilShopTopics::_getInstance()->setIdFilter(false);
         ilShopTopics::_getInstance()->read();
         $topic_option = array();
         if (count(ilShopTopics::_getInstance()->getTopics())) {
             $topic_option[''] = $lng->txt('please_select');
             foreach (ilShopTopics::_getInstance()->getTopics() as $oTopic) {
                 $topic_option[$oTopic->getId()] = $oTopic->getTitle();
             }
         } else {
             $topic_option[''] = $lng->txt('no_topics_yet');
         }
         $o_topic = new ilSelectInputGUI();
         $o_topic->setTitle($lng->txt('topic'));
         $o_topic->setOptions($topic_option);
         $o_topic->setValue($_SESSION['content_filter']['filter_topic_id']);
         $o_topic->setPostVar('filter_topic_id');
         $this->addFilterItem($o_topic);
         $o_topic->readFromSession();
         $this->filter["filter_topic_id"] = $o_topic->getValue();
         if ((bool) $this->settings->get('objects_allow_custom_sorting')) {
             // sorting form
             $allow_objects_option = array('title' => $lng->txt('title'), 'author' => $lng->txt('author'), 'price' => $lng->txt('price_a'));
             $o_allow_objects = new ilSelectInputGUI();
             $o_allow_objects->setTitle($lng->txt('sort_by'));
             $o_allow_objects->setOptions($allow_objects_option);
             $o_allow_objects->setValue($this->getSortField());
             $o_allow_objects->setPostVar('order_field');
             //objects_sorting_type
             $this->addFilterItem($o_allow_objects);
             $o_allow_objects->readFromSession();
             $this->filter["order_field"] = $o_allow_objects->getValue();
             $direction_option = array('asc' => $lng->txt('sort_asc'), 'desc' => $lng->txt('sort_desc'));
             $o_object_direction = new ilSelectInputGUI();
             $o_object_direction->setOptions($direction_option);
             $o_object_direction->setValue($this->getSortDirection());
             $o_object_direction->setPostVar('order_direction');
             //objects_sorting_direction
             $this->addFilterItem($o_object_direction);
             $o_object_direction->readFromSession();
             $this->filter["order_direction"] = $o_object_direction->getValue();
         }
         if ((bool) $this->settings->get('topics_allow_custom_sorting')) {
             // sorting form
             $allow_topics_option = array(ilShopTopics::TOPICS_SORT_BY_TITLE => $lng->txt('sort_topics_by_title'), ilShopTopics::TOPICS_SORT_BY_CREATEDATE => $lng->txt('sort_topics_by_date'));
             if (ANONYMOUS_USER_ID != $ilUser->getId()) {
                 $allow_topics_option[ilShopTopics::TOPICS_SORT_MANUALLY] = $lng->txt('sort_topics_manually');
             }
             $o_allow_topics = new ilSelectInputGUI();
             $o_allow_topics->setTitle($lng->txt('sort_topics_by'));
             $o_allow_topics->setOptions($allow_topics_option);
             $o_allow_topics->setValue($this->getSortingTypeTopics());
             $o_allow_topics->setPostVar('topics_sorting_type');
             $this->addFilterItem($o_allow_topics);
             $o_allow_topics->readFromSession();
             $this->filter["topics_sorting_type"] = $o_allow_topics->getValue();
             $direction_option = array('asc' => $lng->txt('sort_asc'), 'desc' => $lng->txt('sort_desc'));
             $o_topics_direction = new ilSelectInputGUI();
             $o_topics_direction->setOptions($direction_option);
             $o_topics_direction->setValue($this->getSortingDirectionTopics());
             $o_topics_direction->setPostVar('topics_sorting_direction');
             //objects_sorting_type
             $this->addFilterItem($o_topics_direction);
             $o_topics_direction->readFromSession();
             $this->filter["topics_sorting_direction"] = $o_topics_direction->getValue();
         }
     }
 }
 /**
  * Init add cast item form.
  */
 function initAddCastItemForm($a_mode = "create")
 {
     global $lng, $ilCtrl, $ilTabs;
     $this->checkPermission("write");
     $ilTabs->activateTab("edit_content");
     $lng->loadLanguageModule("mcst");
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     include "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setMultipart(true);
     // Property Title
     $text_input = new ilTextInputGUI($lng->txt("title"), "title");
     $text_input->setMaxLength(200);
     $this->form_gui->addItem($text_input);
     // Property Content
     $text_area = new ilTextAreaInputGUI($lng->txt("description"), "description");
     $text_area->setRequired(false);
     $this->form_gui->addItem($text_area);
     // Property Visibility
     if ($enable_internal_rss) {
         $radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility");
         $radio_option = new ilRadioOption($lng->txt("access_users"), "users");
         $radio_group->addOption($radio_option);
         $radio_option = new ilRadioOption($lng->txt("access_public"), "public");
         $radio_group->addOption($radio_option);
         $radio_group->setInfo($lng->txt("mcst_visibility_info"));
         $radio_group->setRequired(true);
         $radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public");
         $this->form_gui->addItem($radio_group);
     }
     // Duration
     $dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration");
     $dur->setInfo($lng->txt("mcst_duration_info"));
     $dur->setShowDays(false);
     $dur->setShowHours(true);
     $dur->setShowSeconds(true);
     $this->form_gui->addItem($dur);
     foreach (ilObjMediaCast::$purposes as $purpose) {
         if ($purpose == "VideoAlternative" && $a_mode == "create") {
             continue;
         }
         $section = new ilFormSectionHeaderGUI();
         $section->setTitle($lng->txt("mcst_" . strtolower($purpose) . "_title"));
         $this->form_gui->addItem($section);
         if ($a_mode != "create") {
             $value = new ilHiddenInputGUI("value_" . $purpose);
             $label = new ilNonEditableValueGUI($lng->txt("value"));
             $label->setPostVar("label_value_" . $purpose);
             $label->setInfo($lng->txt("mcst_current_value_info"));
             $this->form_gui->addItem($label);
             $this->form_gui->addItem($value);
         }
         $file = new ilFileInputGUI($lng->txt("file"), "file_" . $purpose);
         $file->setSuffixes($this->purposeSuffixes[$purpose]);
         $this->form_gui->addItem($file);
         $text_input = new ilRegExpInputGUI($lng->txt("url"), "url_" . $purpose);
         $text_input->setPattern("/https?\\:\\/\\/.+/i");
         $text_input->setInfo($lng->txt("mcst_reference_info"));
         $this->form_gui->addItem($text_input);
         if ($purpose != "Standard") {
             $clearCheckBox = new ilCheckboxInputGUI();
             $clearCheckBox->setPostVar("delete_" . $purpose);
             $clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title"));
             $this->form_gui->addItem($clearCheckBox);
         } else {
             // mime type selection
             $mimeTypeSelection = new ilSelectInputGUI();
             $mimeTypeSelection->setPostVar("mimetype_" . $purpose);
             $mimeTypeSelection->setTitle($lng->txt("mcst_mimetype"));
             $mimeTypeSelection->setInfo($lng->txt("mcst_mimetype_info"));
             $options = array("" => $lng->txt("mcst_automatic_detection"));
             $options = array_merge($options, $this->mimeTypes);
             $mimeTypeSelection->setOptions($options);
             $this->form_gui->addItem($mimeTypeSelection);
             // preview picure
             $pp = new ilImageFileInputGUI($lng->txt("mcst_preview_picture"), "preview_pic");
             $pp->setSuffixes(array("png", "jpeg", "jpg"));
             $pp->setInfo($lng->txt("mcst_preview_picture_info") . " mp4, mp3, png, jp(e)g, gif");
             $this->form_gui->addItem($pp);
         }
     }
     // save/cancel button
     if ($a_mode == "create") {
         $this->form_gui->setTitle($lng->txt("mcst_add_new_item"));
         $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save"));
     } else {
         $this->form_gui->setTitle($lng->txt("mcst_edit_item"));
         $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save"));
     }
     $this->form_gui->addCommandButton("listItems", $lng->txt("cancel"));
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem"));
 }
 public function initFilter()
 {
     global $lng, $ilUser;
     // search term
     $search_term = new ilTextInputGUI($lng->txt('search_search_term'), 'search_string');
     $search_term->setValue($_SESSION['shop_advanced_search']['string']);
     $search_term->setPostVar('search_string');
     $this->addFilterItem($search_term);
     $search_term->readFromSession();
     $this->filter["search_string"] = $search_term->getValue();
     // search combination
     $radio_grp = new ilRadioGroupInputGUI('', 'search_combination');
     $radio_or = new ilRadioOption($lng->txt('search_any_word'), 'or');
     $radio_and = new ilRadioOption($lng->txt('search_all_words'), 'and');
     $radio_grp->addOption($radio_or);
     $radio_grp->addOption($radio_and);
     $radio_grp->setValue($_POST['search_combination']);
     $this->addFilterItem($radio_grp);
     $radio_grp->readFromSession();
     $this->filter['search_combination'] = $radio_grp->getValue();
     // search objects
     $object_types = new ilCheckboxGroupInputGUI($lng->txt('obj_type'), 'search_details');
     $cb_crs = new ilCheckboxInputGUI($lng->txt('courses'), 'search_details["crs"]');
     $cb_crs->setValue('crs');
     $cb_lms = new ilCheckboxInputGUI($lng->txt('learning_resources'), 'search_details["lms"]');
     $cb_lms->setValue('lms');
     $cb_tst = new ilCheckboxInputGUI($lng->txt('tests'), 'search_details["tst"]');
     $cb_tst->setValue('tst');
     $cb_fil = new ilCheckboxInputGUI($lng->txt('objs_file'), 'search_details["fil"]');
     $cb_fil->setValue('fil');
     $object_types->addOption($cb_crs);
     $object_types->addOption($cb_lms);
     $object_types->addOption($cb_tst);
     $object_types->addOption($cb_fil);
     $object_types->setValue($_SESSION['shop_advanced_search']['details']);
     $this->addFilterItem($object_types);
     $object_types->readFromSession();
     $this->filter['search_details'] = $object_types->getValue();
     // search topics
     ilShopTopics::_getInstance()->setIdFilter(false);
     ilShopTopics::_getInstance()->read();
     $topic_option = array();
     if (count(ilShopTopics::_getInstance()->getTopics())) {
         $topic_option[''] = $lng->txt('please_select');
         foreach (ilShopTopics::_getInstance()->getTopics() as $oTopic) {
             $topic_option[(string) $oTopic->getId()] = $oTopic->getTitle();
         }
     } else {
         $topic_option[''] = $lng->txt('no_topics_yet');
     }
     $o_topic = new ilSelectInputGUI();
     $o_topic->setTitle($lng->txt('topic'));
     $o_topic->setOptions($topic_option);
     $o_topic->setValue($_SESSION['shop_advanced_search']['topic']);
     $o_topic->setPostVar('search_topic');
     $this->addFilterItem($o_topic);
     $o_topic->readFromSession();
     $this->filter["search_topic"] = $o_topic->getValue();
     if ((bool) $this->settings->get('objects_allow_custom_sorting')) {
         // sorting form
         $allow_objects_option = array('title' => $lng->txt('title'), 'author' => $lng->txt('author'), 'price' => $lng->txt('price_a'));
         $o_allow_objects = new ilSelectInputGUI();
         $o_allow_objects->setTitle($lng->txt('sort_by'));
         $o_allow_objects->setOptions($allow_objects_option);
         $o_allow_objects->setValue($this->getSortField());
         $o_allow_objects->setPostVar('order_field');
         //objects_sorting_type
         $this->addFilterItem($o_allow_objects);
         $o_allow_objects->readFromSession();
         $this->filter["order_field"] = $o_allow_objects->getValue();
         $direction_option = array('asc' => $lng->txt('sort_asc'), 'desc' => $lng->txt('sort_desc'));
         $o_object_direction = new ilSelectInputGUI();
         $o_object_direction->setOptions($direction_option);
         $o_object_direction->setValue($this->getSortDirection());
         $o_object_direction->setPostVar('order_direction');
         //objects_sorting_direction
         $this->addFilterItem($o_object_direction);
         $o_object_direction->readFromSession();
         $this->filter["order_direction"] = $o_object_direction->getValue();
     }
     if ((bool) $this->settings->get('topics_allow_custom_sorting')) {
         // sorting form
         $allow_topics_option = array(ilShopTopics::TOPICS_SORT_BY_TITLE => $lng->txt('sort_topics_by_title'), ilShopTopics::TOPICS_SORT_BY_CREATEDATE => $lng->txt('sort_topics_by_date'));
         if (ANONYMOUS_USER_ID != $ilUser->getId()) {
             $allow_topics_option[ilShopTopics::TOPICS_SORT_MANUALLY] = $lng->txt('sort_topics_manually');
         }
         $o_allow_topics = new ilSelectInputGUI();
         $o_allow_topics->setTitle($lng->txt('sort_topics_by'));
         $o_allow_topics->setOptions($allow_topics_option);
         $o_allow_topics->setValue($this->getSortingTypeTopics());
         $o_allow_topics->setPostVar('topics_sorting_type');
         $this->addFilterItem($o_allow_topics);
         $o_allow_topics->readFromSession();
         $this->filter["topics_sorting_type"] = $o_allow_topics->getValue();
         $direction_option = array('asc' => $lng->txt('sort_asc'), 'desc' => $lng->txt('sort_desc'));
         $o_topics_direction = new ilSelectInputGUI();
         $o_topics_direction->setOptions($direction_option);
         $o_topics_direction->setValue($this->getSortingDirectionTopics());
         $o_topics_direction->setPostVar('topics_sorting_direction');
         //objects_sorting_type
         $this->addFilterItem($o_topics_direction);
         $o_topics_direction->readFromSession();
         $this->filter["topics_sorting_direction"] = $o_topics_direction->getValue();
     }
 }
 public function showGeneralFilter($a_count_result = 0)
 {
     global $ilUser;
     if (!$_POST['show_filter'] && $_POST['updateView'] == '1') {
         $this->resetFilter();
     } else {
         if ($_POST['updateView'] == 1) {
             $_SESSION['content_filter']['updateView'] = $_POST['updateView'];
             $_SESSION['content_filter']['show_filter'] = $_POST['show_filter'];
             $_SESSION['content_filter']['sel_filter_type'] = $_POST['sel_filter_type'];
             $_SESSION['content_filter']['filter_text'] = $_POST['filter_text'];
             $_SESSION['content_filter']['filter_topic_id'] = $_POST['filter_topic_id'];
             $_SESSION['content_filter']['order_field'] = $_POST['order_field'];
             $_SESSION['content_filter']['order_direction'] = $_POST['order_direction'];
             $_SESSION['content_filter']['topics_sorting_type'] = $_POST['topics_sorting_type'];
             $_SESSION['content_filter']['topics_sorting_direction'] = $_POST['topics_sorting_direction'];
         }
     }
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     // FILTER FORM
     $filter_form = new ilPropertyFormGUI();
     $filter_form->setFormAction($this->ctrl->getFormAction($this));
     $filter_form->setTitle($this->lng->txt('pay_filter'));
     $filter_form->setId('formular');
     $filter_form->setTableWidth('100 %');
     $o_hide_check = new ilCheckBoxInputGUI($this->lng->txt('show_filter'), 'show_filter');
     $o_hide_check->setValue(1);
     $o_hide_check->setChecked($_SESSION['content_filter']['show_filter'] ? 1 : 0);
     $o_hidden = new ilHiddenInputGUI('updateView');
     $o_hidden->setValue(1);
     $o_hidden->setPostVar('updateView');
     $o_hide_check->addSubItem($o_hidden);
     $o_filter = new ilSelectInputGUI();
     $filter_option = array('title' => $this->lng->txt('title'), 'author' => $this->lng->txt('author'), 'metadata' => $this->lng->txt('meta_data'));
     $o_filter->setTitle($this->lng->txt('search_in'));
     $o_filter->setOptions($filter_option);
     $o_filter->setValue($_SESSION['content_filter']['sel_filter_type']);
     $o_filter->setPostVar('sel_filter_type');
     $o_hide_check->addSubItem($o_filter);
     $o_filter_by = new ilTextInputGUI($this->lng->txt('filter_by'));
     $o_filter_by->setValue($_SESSION['content_filter']['filter_text']);
     $o_filter_by->setPostVar('filter_text');
     $o_hide_check->addSubItem($o_filter_by);
     ilShopTopics::_getInstance()->setIdFilter(false);
     ilShopTopics::_getInstance()->read();
     $topic_option = array();
     if (count(ilShopTopics::_getInstance()->getTopics())) {
         $topic_option[''] = $this->lng->txt('please_select');
         foreach (ilShopTopics::_getInstance()->getTopics() as $oTopic) {
             $topic_option[$oTopic->getId()] = $oTopic->getTitle();
         }
     } else {
         $topic_option[''] = $this->lng->txt('no_topics_yet');
     }
     $o_topic = new ilSelectInputGUI();
     $o_topic->setTitle($this->lng->txt('topic'));
     $o_topic->setOptions($topic_option);
     $o_topic->setValue($_SESSION['content_filter']['filter_topic_id']);
     $o_topic->setPostVar('filter_topic_id');
     $o_hide_check->addSubItem($o_topic);
     #if(count($oResult->getResults()))
     if ($a_count_result) {
         $objects = (bool) $this->oGeneralSettings->get('objects_allow_custom_sorting');
         if ($objects) {
             // sorting form
             $allow_objects_option = array('title' => $this->lng->txt('title'), 'author' => $this->lng->txt('author'), 'price' => $this->lng->txt('price_a'));
             $o_allow_objects = new ilSelectInputGUI();
             $o_allow_objects->setTitle($this->lng->txt('sort_by'));
             $o_allow_objects->setOptions($allow_objects_option);
             $o_allow_objects->setValue($this->getSortField());
             $o_allow_objects->setPostVar('order_field');
             //objects_sorting_type
             $o_hide_check->addSubItem($o_allow_objects);
             $direction_option = array('asc' => $this->lng->txt('sort_asc'), 'desc' => $this->lng->txt('sort_desc'));
             $o_object_direction = new ilSelectInputGUI();
             $o_object_direction->setOptions($direction_option);
             $o_object_direction->setValue($this->getSortDirection());
             $o_object_direction->setPostVar('order_direction');
             //objects_sorting_direction
             $o_hide_check->addSubItem($o_object_direction);
         }
         $topics = (bool) $this->oGeneralSettings->get('topics_allow_custom_sorting');
         if ($topics) {
             // sorting form
             $allow_topics_option = array(ilShopTopics::TOPICS_SORT_BY_TITLE => $this->lng->txt('sort_topics_by_title'), ilShopTopics::TOPICS_SORT_BY_CREATEDATE => $this->lng->txt('sort_topics_by_date'));
             if (ANONYMOUS_USER_ID != $ilUser->getId()) {
                 $allow_topics_option[ilShopTopics::TOPICS_SORT_MANUALLY] = $this->lng->txt('sort_topics_manually');
             }
             $o_allow_topics = new ilSelectInputGUI();
             $o_allow_topics->setTitle($this->lng->txt('sort_topics_by'));
             $o_allow_topics->setOptions($allow_topics_option);
             $o_allow_topics->setValue($this->getSortingTypeTopics());
             $o_allow_topics->setPostVar('topics_sorting_type');
             $o_hide_check->addSubItem($o_allow_topics);
             $direction_option = array('asc' => $this->lng->txt('sort_asc'), 'desc' => $this->lng->txt('sort_desc'));
             $o_topics_direction = new ilSelectInputGUI();
             $o_topics_direction->setOptions($direction_option);
             $o_topics_direction->setValue($this->getSortingDirectionTopics());
             $o_topics_direction->setPostVar('topics_sorting_direction');
             //objects_sorting_type
             $o_hide_check->addSubItem($o_topics_direction);
         }
     }
     $filter_form->addCommandButton('setFilter', $this->lng->txt('pay_update_view'));
     $filter_form->addCommandButton('resetFilter', $this->lng->txt('pay_reset_filter'));
     $filter_form->addItem($o_hide_check);
     return $filter_form->getHTML();
 }
 public function settings()
 {
     global $rbacreview;
     $this->tabs_gui->setSubTabActive('shib_settings');
     // set already saved data or default value for port
     $settings = $this->ilias->getAllSettings();
     // Compose role list
     $role_list = $rbacreview->getRolesByFilter(2);
     $role = array();
     if (!isset($settings["shib_user_default_role"])) {
         $settings["shib_user_default_role"] = 4;
     }
     if (!isset($settings["shib_idp_list"]) || $settings["shib_idp_list"] == '') {
         $settings["shib_idp_list"] = "urn:mace:organization1:providerID, Example Organization 1\nurn:mace:organization2:providerID, Example Organization 2, /Shibboleth.sso/WAYF/SWITCHaai";
     }
     if (!isset($settings["shib_login_button"]) || $settings["shib_login_button"] == '') {
         $settings["shib_login_button"] = "templates/default/images/shib_login_button.png";
     }
     if (!isset($settings["shib_hos_type"]) || $settings["shib_hos_type"] == '') {
         $settings["shib_hos_type"] = 'internal_wayf';
     }
     foreach ($role_list as $data) {
         $role[$data["obj_id"]] = $data["title"];
     }
     // Set text field content
     $shib_settings = array('shib_login', 'shib_title', 'shib_firstname', 'shib_lastname', 'shib_email', 'shib_gender', 'shib_institution', 'shib_department', 'shib_zipcode', 'shib_city', 'shib_country', 'shib_street', 'shib_phone_office', 'shib_phone_home', 'shib_phone_mobile', 'shib_language', 'shib_matriculation');
     //set PropertyFormGUI
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $propertys = new ilPropertyFormGUI();
     $propertys->setTitle($this->lng->txt("shib"));
     $propertys->setFormAction($this->ctrl->getFormAction($this, "save"));
     $propertys->addCommandButton("save", $this->lng->txt("save"));
     $propertys->addCommandButton("settings", $this->lng->txt("cancel"));
     //set enable shibboleth support
     $enable = new ilCheckboxInputGUI();
     $enable->setTitle($this->lng->txt("shib_active"));
     $read_me_link = "./Services/AuthShibboleth/README.SHIBBOLETH.txt";
     $info = "<a href='" . $read_me_link . "' target='_blank'>" . $this->lng->txt("auth_shib_instructions") . "</a>";
     $enable->setInfo($info);
     $enable->setPostVar("shib[active]");
     $enable->setChecked($settings["shib_active"]);
     //set allow local authentication
     $local = new ilCheckboxInputGUI();
     $local->setTitle($this->lng->txt("auth_allow_local"));
     $local->setPostVar("shib[auth_allow_local]");
     $local->setChecked($settings['shib_auth_allow_local']);
     //set user default role
     $defaultrole = new ilSelectInputGUI();
     $defaultrole->setTitle($this->lng->txt("shib_user_default_role"));
     $defaultrole->setPostVar("shib[user_default_role]");
     $defaultrole->setOptions($role);
     $defaultrole->setRequired(true);
     $defaultrole->setValue($settings["shib_user_default_role"]);
     //set name of federation
     $name = new ilTextInputGUI();
     $name->setTitle($this->lng->txt("shib_federation_name"));
     $name->setPostVar("shib[federation_name]");
     $name->setSize(40);
     $name->setMaxLength(50);
     $name->setRequired(true);
     $name->setValue(stripslashes($settings["shib_federation_name"]));
     //set Organize selection group
     include_once "./Services/Form/classes/class.ilRadioGroupInputGUI.php";
     include_once "./Services/Form/classes/class.ilRadioOption.php";
     $organize = new ilRadioGroupInputGUI();
     $organize->setTitle($this->lng->txt("shib_login_type"));
     $organize->setPostVar("shib[hos_type]");
     $organize->setRequired(true);
     $organize->setValue($settings["shib_hos_type"]);
     //set 1. option internalwayf
     $internalwayf = new ilRadioOption();
     $internalwayf->setTitle($this->lng->txt("shib_login_internal_wayf"));
     $internalwayf->setValue("internal_wayf");
     //set 1. option internalwayf textbox idplist
     $idplist = new ilTextAreaInputGUI();
     $idplist->setInfo($this->lng->txt("shib_idp_list"));
     $idplist->setPostVar("shib[idp_list]");
     $idplist->setRows(3);
     $idplist->setCols(50);
     $idplist->setValue($settings["shib_idp_list"]);
     //set 2. Option externalwayf
     $externalwayf = new ilRadioOption();
     $externalwayf->setTitle($this->lng->txt("shib_login_external_wayf"));
     $externalwayf->setValue("external_wayf");
     //set 2. Option externalwayf textfield path to login button image
     $loginbutton = new ilTextInputGUI();
     $loginbutton->setInfo($this->lng->txt("shib_login_button"));
     $loginbutton->setPostVar("shib[login_button]");
     $loginbutton->setSize(50);
     $loginbutton->setMaxLength(255);
     $loginbutton->setValue($settings["shib_login_button"]);
     //set 3. Option embeddedwayf
     $embeddedwayf = new ilRadioOption();
     $embeddedwayf->setTitle($this->lng->txt("shib_login_embedded_wayf"));
     $embeddedwayf->setInfo($this->lng->txt("shib_login_embedded_wayf_description"));
     $embeddedwayf->setValue("embedded_wayf");
     //set login instructions
     $logininstruction = new ilTextAreaInputGUI();
     $logininstruction->setTitle($this->lng->txt("auth_login_instructions"));
     $logininstruction->setPostVar("shib[login_instructions]");
     $logininstruction->setRows(3);
     $logininstruction->setCols(50);
     $logininstruction->setValue(stripslashes($settings["shib_login_instructions"]));
     //set path to data manipulation API
     $dataconv = new ilTextInputGUI();
     $dataconv->setTitle($this->lng->txt("shib_data_conv"));
     $dataconv->setPostVar("shib[data_conv]");
     $dataconv->setSize(80);
     $dataconv->setMaxLength(512);
     $dataconv->setValue($settings["shib_data_conv"]);
     //field mappings
     $fields = array();
     foreach ($shib_settings as $setting) {
         $field = ereg_replace('shib_', '', $setting);
         $textinput = new ilTextInputGUI();
         $textinput->setTitle($this->lng->txt($setting));
         $textinput->setPostVar("shib[" . $field . "]");
         $textinput->setValue($settings[$setting]);
         $textinput->setSize(40);
         $textinput->setMaxLength(50);
         $checkinput = new ilCheckboxInputGUI("");
         $checkinput->setOptionTitle($this->lng->txt("shib_update"));
         $checkinput->setPostVar("shib[update_" . $field . "]");
         $checkinput->setChecked($settings["shib_update_" . $field]);
         if ($setting == 'shib_login' || $setting == 'shib_title' || $setting == 'shib_firstname' || $setting == 'shib_lastname' || $setting == 'shib_email') {
             $textinput->setRequired(true);
         }
         $fields[$setting] = array("text" => $textinput, "check" => $checkinput);
     }
     $propertys->addItem($enable);
     $propertys->addItem($local);
     $propertys->addItem($defaultrole);
     $propertys->addItem($name);
     $internalwayf->addSubItem($idplist);
     $organize->addOption($internalwayf);
     $externalwayf->addSubItem($loginbutton);
     $organize->addOption($externalwayf);
     $organize->addOption($embeddedwayf);
     $propertys->addItem($organize);
     $propertys->addItem($logininstruction);
     $propertys->addItem($dataconv);
     foreach ($shib_settings as $setting) {
         $propertys->addItem($fields[$setting]["text"]);
         if ($setting != "shib_login") {
             $propertys->addItem($fields[$setting]["check"]);
         }
     }
     $this->tpl->setContent($propertys->getHTML());
 }
 public function showObjects()
 {
     /** 
      * @var $ilToolbar ilToolbarGUI */
     global $ilToolbar;
     include_once './Services/Payment/classes/class.ilPayMethods.php';
     $ilToolbar->addButton($this->lng->txt('paya_sell_object'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
     if (!$_POST['show_filter'] && $_POST['updateView'] == '1') {
         $this->resetObjectFilter();
     } else {
         if ($_POST['updateView'] == 1) {
             $_SESSION['pay_objects']['updateView'] = $_POST['updateView'];
             $_SESSION['pay_objects']['show_filter'] = $_POST['show_filter'];
             $_SESSION['pay_objects']['title_type'] = $_POST['title_type'];
             $_SESSION['pay_objects']['title_value'] = $_POST['title_value'];
             $_SESSION['pay_objects']['pay_method'] = $_POST['pay_method'];
             $_SESSION['pay_objects']['vendor'] = $_POST['vendor'];
         }
     }
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $this->__initPaymentObject();
     $this->lng->loadLanguageModule('search');
     $filter_form = new ilPropertyFormGUI();
     $filter_form->setFormAction($this->ctrl->getFormAction($this));
     $filter_form->setTitle($this->lng->txt('pay_filter'));
     $filter_form->setId('filter_form');
     $filter_form->setTableWidth('100 %');
     //hide_filter
     $o_hide_check = new ilCheckBoxInputGUI($this->lng->txt('show_filter'), 'show_filter');
     $o_hide_check->setValue(1);
     $o_hide_check->setChecked($_SESSION['pay_objects']['show_filter'] ? 1 : 0);
     $o_hidden = new ilHiddenInputGUI('updateView');
     $o_hidden->setValue(1);
     $o_hidden->setPostVar('updateView');
     $o_hide_check->addSubItem($o_hidden);
     //title
     $radio_group = new ilRadioGroupInputGUI($this->lng->txt('search_in_title'), 'title_type');
     $radio_option = new ilRadioOption($this->lng->txt('search_any_word'), 'or');
     $radio_group->addOption($radio_option);
     $radio_option = new ilRadioOption($this->lng->txt('search_all_words'), 'and');
     $radio_group->addOption($radio_option);
     $radio_group->setRequired(false);
     $radio_group->setValue('or');
     $radio_group->setPostVar('title_type');
     $o_title = new ilTextInputGUI();
     $o_title->setValue($_SESSION['pay_objects']['title_value']);
     $o_title->setPostVar('title_value');
     $o_title->setTitle($this->lng->txt('title'));
     $o_hide_check->addSubItem($radio_group);
     $o_hide_check->addSubItem($o_title);
     //vendor
     $o_vendor = new ilTextInputGUI();
     $o_vendor->setTitle($this->lng->txt('paya_vendor'));
     $o_vendor->setValue($_SESSION['pay_objects']['vendor']);
     $o_vendor->setPostVar('vendor');
     $o_hide_check->addSubItem($o_vendor);
     // paymethod
     $o_paymethod = new ilSelectInputGUI();
     $o_paymethod->setTitle($this->lng->txt('payment_system'));
     $o_paymethod->setOptions(ilPaymethods::getPayMethodsOptions('all'));
     $o_paymethod->setValue($_SESSION['pay_objects']['pay_method']);
     $o_paymethod->setPostVar('pay_method');
     $o_hide_check->addSubItem($o_paymethod);
     $filter_form->addCommandButton('showObjects', $this->lng->txt('pay_update_view'));
     $filter_form->addCommandButton('resetObjectFilter', $this->lng->txt('pay_reset_filter'));
     $filter_form->addItem($o_hide_check);
     if (!count($objects = ilPaymentObject::_getObjectsData($this->user_obj->getId()))) {
         ilUtil::sendInfo($this->lng->txt('paya_no_objects_assigned'));
         return true;
     }
     $this->tpl->setVariable('FORM', $filter_form->getHTML());
     $counter = 0;
     foreach ($objects as $data) {
         /** @var $tmp_obj ilObject */
         $tmp_obj = ilObjectFactory::getInstanceByRefId($data['ref_id'], false);
         if ($tmp_obj) {
             $f_result[$counter]['title'] = $tmp_obj->getTitle();
         } else {
             $f_result[$counter]['title'] = $this->lng->txt('object_not_found');
         }
         switch ($data['status']) {
             case $this->pobject->STATUS_BUYABLE:
                 $f_result[$counter]['status'] = $this->lng->txt('paya_buyable');
                 break;
             case $this->pobject->STATUS_NOT_BUYABLE:
                 $f_result[$counter]['status'] = $this->lng->txt('paya_not_buyable');
                 break;
             case $this->pobject->STATUS_EXPIRES:
                 $f_result[$counter]['status'] = $this->lng->txt('paya_expires');
                 break;
         }
         $str_paymethod = ilPayMethods::getStringByPaymethod($data['pay_method']);
         $f_result[$counter]['pay_method'] = $str_paymethod;
         if ($data['vat_id'] <= 0) {
             $vat_rate = $this->lng->txt('payment_vat_has_to_be_defined_by_administration_short');
         } else {
             try {
                 $oVAT = new ilShopVats((int) $data['vat_id']);
                 $vat_rate = ilShopUtils::_formatVAT((double) $oVAT->getRate());
             } catch (ilShopException $e) {
                 $vat_rate = $this->lng->txt('payment_vat_has_to_be_defined_by_administration_short');
             }
         }
         $f_result[$counter]['vat_rate'] = $vat_rate;
         /** @var $tmp_user ilObjUser */
         $tmp_user = ilObjectFactory::getInstanceByObjId($data['vendor_id']);
         $f_result[$counter]['vendor'] = $tmp_user->getFullname() . ' [' . $tmp_user->getLogin() . ']';
         // Get number of purchasers
         $f_result[$counter]['purchasers'] = ilPaymentBookings::_getCountBookingsByObject($data['pobject_id']);
         // edit link
         $this->ctrl->setParameter($this, 'pobject_id', $data['pobject_id']);
         $link_change = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "editDetails") . "\">" . $this->lng->txt("edit") . "</a></div>";
         $f_result[$counter]['options'] = $link_change;
         unset($tmp_user);
         unset($tmp_obj);
         ++$counter;
     }
     return $this->__showObjectsTable($f_result);
 }
 public function addCoupon()
 {
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     if (isset($_GET['coupon_id'])) {
         if ($this->error == '') {
             $this->coupon_obj->getCouponById($_GET['coupon_id']);
         }
         $this->ctrl->setParameter($this, 'coupon_id', $this->coupon_obj->getId());
         $this->__showButtons();
     }
     $oForm = new ilPropertyFormGUI();
     $oForm->setId('frm_add_coupon');
     $oForm->setFormAction($this->ctrl->getFormAction($this, 'saveCouponForm'));
     $oForm->setTitle($this->coupon_obj->getId() ? $this->lng->txt('paya_coupons_edit') : $this->lng->txt('paya_coupons_add'));
     // Title
     $oTitle = new ilTextInputGUI($this->lng->txt(paya_coupons_title), 'title');
     $oTitle->setValue($this->coupon_obj->getTitle());
     $oTitle->setRequired(true);
     $oForm->addItem($oTitle);
     // Description
     $oDescription = new ilTextAreaInputGUI($this->lng->txt(paya_coupons_description), 'description');
     $oDescription->setValue($this->coupon_obj->getDescription());
     $oForm->addItem($oDescription);
     // Type
     $o_coupon_type = new ilSelectInputGUI();
     $coupon_option = array('fix' => $this->lng->txt('paya_coupons_fix'), 'percent' => $this->lng->txt('paya_coupons_percentaged'));
     $o_coupon_type->setTitle($this->lng->txt('coupon_type'));
     $o_coupon_type->setOptions($coupon_option);
     $o_coupon_type->setValue($this->coupon_obj->getType());
     $o_coupon_type->setRequired(true);
     $o_coupon_type->setPostVar('coupon_type');
     $oForm->addItem($o_coupon_type);
     // Value
     $o_coupon_value = new ilNumberInputGUI($this->lng->txt('paya_coupons_value'), 'coupon_value');
     $o_coupon_value->setSize(5);
     $o_coupon_value->allowDecimals(true);
     $o_coupon_value->setValue($this->coupon_obj->getValue());
     $o_coupon_value->setRequired(true);
     $oForm->addItem($o_coupon_value);
     // Date Valid From
     $o_from_check = new ilCheckBoxInputGUI($this->lng->txt('paya_coupons_from'), 'from_check');
     $o_from_check->setValue(1);
     $o_from_check->setChecked($this->coupon_obj->getFromDateEnabled() ? 1 : 0);
     $o_date_from = new ilDateTimeInputGUI();
     $o_date_from->setPostVar('from');
     $from_date = explode('-', $this->coupon_obj->getFromDate());
     $date_f['from']['date']['d'] = $from_date[2] != '00' ? $from_date[2] : '';
     $date_f['from']['date']['m'] = $from_date[1] != '00' ? $from_date[1] : '';
     $date_f['from']['date']['y'] = $from_date[0] != '0000' ? $from_date[0] : '';
     $_POST['from'] = $date_f['from'];
     if ($this->coupon_obj->getFromDateEnabled() == '1') {
         $o_date_from->checkInput();
     }
     $o_from_check->addSubItem($o_date_from);
     $oForm->addItem($o_from_check);
     // Date Valid Until
     $o_until_check = new ilCheckBoxInputGUI($this->lng->txt('paya_coupons_till'), 'until_check');
     $o_until_check->setValue(1);
     $o_until_check->setChecked($this->coupon_obj->getTillDateEnabled() ? 1 : 0);
     $o_date_until = new ilDateTimeInputGUI();
     $o_date_until->setPostVar('til');
     $till_date = explode('-', $this->coupon_obj->getTillDate());
     $date_t['til']['date']['d'] = $till_date[2] != '00' ? $till_date[2] : '';
     $date_t['til']['date']['m'] = $till_date[1] != '00' ? $till_date[1] : '';
     $date_t['til']['date']['y'] = $till_date[0] != '0000' ? $till_date[0] : '';
     $_POST['til'] = $date_t['til'];
     if ($this->coupon_obj->getTillDateEnabled() == '1') {
         $o_date_until->checkInput();
     }
     $o_until_check->addSubItem($o_date_until);
     $oForm->addItem($o_until_check);
     $o_usage = new ilNumberInputGUI($this->lng->txt('paya_coupons_availability'), 'usage');
     $o_usage->setSize(5);
     $o_usage->setValue($this->coupon_obj->getUses());
     $oForm->addItem($o_usage);
     $oForm->addCommandButton('saveCouponForm', $this->lng->txt('save'));
     $oForm->addCommandButton('showCoupons', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $oForm->getHTML());
 }