コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
 public function editCurrencyObject()
 {
     $currency_id = $_POST['currency_id'];
     $obj_currency = ilPaymentCurrency::_getCurrency($currency_id);
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('paya_edit_currency'));
     $o_Unit = new ilTextInputGUI($this->lng->txt('paya_currency_unit'), 'currency_unit');
     $o_Unit->setValue($obj_currency[$currency_id]['unit']);
     $o_Unit->setPostVar('currency_unit');
     $o_Unit->setRequired(true);
     $o_Isocode = new ilTextInputGUI($this->lng->txt('iso_code'), 'iso_code');
     $o_Isocode->setValue($obj_currency[$currency_id]['iso_code']);
     $o_Isocode->setPostVar('iso_code');
     $o_Isocode->setRequired(true);
     $o_Symbol = new ilTextInputGUI($this->lng->txt('symbol'), 'symbol');
     $o_Symbol->setValue($obj_currency[$currency_id]['symbol']);
     $o_Symbol->setPostVar('symbol');
     $o_Symbol->setRequired(true);
     $o_Conversionrate = new IlTextInputGUI($this->lng->txt('conversion_rate'), 'conversion_rate');
     $o_Conversionrate->setValue($obj_currency[$currency_id]['conversion_rate']);
     $o_Conversionrate->setPostVar('conversion_rate');
     $o_Conversionrate->setRequired(true);
     $o_hidden = new ilHiddenInputGUI('currency_id');
     $o_hidden->setValue($obj_currency[$currency_id]['currency_id']);
     $o_hidden->setPostVar('currency_id');
     $form->addItem($o_hidden);
     $form->addItem($o_Unit);
     $form->addItem($o_Isocode);
     $form->addItem($o_Symbol);
     $form->addItem($o_Conversionrate);
     $form->addCommandButton('updateCurrency', $this->lng->txt('save'));
     $form->addCommandButton('currencies', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $form->getHTML());
 }
コード例 #3
0
 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();
         }
     }
 }
コード例 #4
0
 /**
  * init propertyformgui for Assignment of LDAP Attributes to ILIAS User Profile
  * @param string $command command methode
  * @return \ilPropertyFormGUI 
  */
 private function initRoleMappingForm($command)
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->setSubTabs();
     $this->tabs_gui->setSubTabActive('ldap_role_mapping');
     if (isset($_GET["mapping_id"])) {
         $this->ctrl->setParameter($this, 'mapping_id', $_GET["mapping_id"]);
     }
     $propertie_form = new ilPropertyFormGUI();
     $propertie_form->setFormAction($this->ctrl->getFormAction($this, $command));
     $propertie_form->addCommandButton($command, $this->lng->txt('save'));
     $propertie_form->addCommandButton("roleMapping", $this->lng->txt('cancel'));
     $url = new ilTextInputGUI($this->lng->txt('ldap_server'));
     $url->setPostVar("url");
     $url->setSize(50);
     $url->setMaxLength(255);
     $url->setRequired(true);
     $group_dn = new ilTextInputGUI($this->lng->txt('ldap_group_dn'));
     $group_dn->setPostVar("dn");
     $group_dn->setSize(50);
     $group_dn->setMaxLength(255);
     $group_dn->setInfo($this->lng->txt('ldap_dn_info'));
     $group_dn->setRequired(true);
     $member = new ilTextInputGUI($this->lng->txt('ldap_group_member'));
     $member->setPostVar("member");
     $member->setSize(32);
     $member->setMaxLength(255);
     $member->setInfo($this->lng->txt('ldap_member_info'));
     $member->setRequired(true);
     $member_isdn = new ilCheckboxInputGUI("");
     $member_isdn->setPostVar("memberisdn");
     $member_isdn->setOptionTitle($this->lng->txt('ldap_memberisdn'));
     $role = new ilTextInputGUI($this->lng->txt('ldap_ilias_role'));
     $role->setPostVar("role");
     $role->setSize(32);
     $role->setMaxLength(255);
     $role->setInfo($this->lng->txt('ldap_role_info'));
     $role->setRequired(true);
     $info = new ilTextAreaInputGUI($this->lng->txt('ldap_info_text'));
     $info->setPostVar("info");
     $info->setCols(50);
     $info->setRows(3);
     $info->setInfo($this->lng->txt('ldap_info_text_info'));
     $info_type = new ilCheckboxInputGUI("");
     $info_type->setPostVar("info_type");
     $info_type->setOptionTitle($this->lng->txt('ldap_mapping_info_type'));
     $propertie_form->addItem($url);
     $propertie_form->addItem($group_dn);
     $propertie_form->addItem($member);
     $propertie_form->addItem($member_isdn);
     $propertie_form->addItem($role);
     $propertie_form->addItem($info);
     $propertie_form->addItem($info_type);
     return $propertie_form;
 }
コード例 #5
0
 public function renameSubFolder()
 {
     /**
      * @var $ilCtrl ilCtrl
      * @var $tpl    ilTemplate
      */
     global $ilCtrl, $tpl;
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail.html', 'Services/Mail');
     $tpl->setTitle($this->lng->txt('mail'));
     $oForm = new ilPropertyFormGUI();
     $oForm->setFormAction($ilCtrl->getFormAction($this, 'performRenameSubFolder'));
     $oForm->setTitle($this->lng->txt('mail_rename_folder'));
     //title
     $oTitle = new ilTextInputGUI();
     $oTitle->setTitle($this->lng->txt('title'));
     $tmp_data = $this->mbox->getFolderData($_GET["mobj_id"]);
     $oTitle->setValue($tmp_data["title"]);
     $oTitle->setPostVar('subfolder_title');
     $oForm->addItem($oTitle);
     $oForm->addCommandButton('performRenameSubFolder', $this->lng->txt('save'));
     $oForm->addCommandButton('showFolder', $this->lng->txt('cancel'));
     $tpl->setVariable('FORM', $oForm->getHTML());
     $tpl->show();
     return true;
 }
コード例 #6
0
 public function addCustomer()
 {
     global $ilToolbar, $ilCtrl;
     isset($_POST['sell_id']) ? $sell_id = $_POST['sell_id'] : ($sell_id = $_GET['sell_id']);
     isset($_POST['user_id']) ? $user_id = $_POST['user_id'] : ($user_id = $_GET['user_id']);
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.main_view.html", 'Services/Payment');
     $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'searchUser'));
     $ilCtrl->setParameter($this, "sell_id", $sell_id);
     $ilCtrl->setParameter($this, "user_id", $user_id);
     $pObjectId = ilPaymentObject::_lookupPobjectId($sell_id);
     $obj = new ilPaymentObject($this->user_obj, $pObjectId);
     // get obj
     $tmp_obj = ilObjectFactory::getInstanceByRefId($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($user_id);
     // get vendor_obj
     $tmp_vendor = ilObjectFactory::getInstanceByObjId($obj->getVendorId());
     $oForm = new ilPropertyFormGUI();
     $oForm->setFormAction($ilCtrl->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::prepareFormOutput($_POST['transaction'], true));
     $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'), 'duration');
     $oDuration->setOptions($duration_options);
     $oDuration->setValue($_POST['duration']);
     $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('showStatistics', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $oForm->getHTML());
 }
コード例 #7
0
 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();
     }
 }
コード例 #8
0
 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();
 }
コード例 #9
0
 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());
 }
コード例 #10
0
 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);
 }
コード例 #11
0
 public function showCoupons()
 {
     global $ilToolbar;
     include_once "Services/User/classes/class.ilObjUser.php";
     $ilToolbar->addButton($this->lng->txt('paya_coupons_add'), $this->ctrl->getLinkTarget($this, 'addCoupon'));
     if (!$_POST['show_filter'] && $_POST['updateView'] == '1') {
         $this->resetFilter();
     } else {
         if ($_POST['updateView'] == 1) {
             $_SESSION['pay_coupons']['show_filter'] = $_POST['show_filter'];
             $_SESSION['pay_coupons']['updateView'] = true;
             $_SESSION['pay_coupons']['until_check'] = $_POST['until_check'];
             $_SESSION['pay_coupons']['from_check'] = $_POST['from_check'];
             $_SESSION['pay_coupons']['title_type'] = isset($_POST['title_type']) ? $_POST['title_type'] : '';
             $_SESSION['pay_coupons']['title_value'] = isset($_POST['title_value']) ? $_POST['title_value'] : '';
             if ($_SESSION['pay_coupons']['from_check'] == '1') {
                 $_SESSION['pay_coupons']['from']['date']['d'] = $_POST['from']['date']['d'];
                 $_SESSION['pay_coupons']['from']['date']['m'] = $_POST['from']['date']['m'];
                 $_SESSION['pay_coupons']['from']['date']['y'] = $_POST['from']['date']['y'];
             } else {
                 $_SESSION['pay_coupons']['from']['date']['d'] = '';
                 $_SESSION['pay_coupons']['from']['date']['m'] = '';
                 $_SESSION['pay_coupons']['from']['date']['y'] = '';
             }
             if ($_SESSION['pay_coupons']['until_check'] == '1') {
                 $_SESSION['pay_coupons']['til']['date']['d'] = $_POST['til']['date']['d'];
                 $_SESSION['pay_coupons']['til']['date']['m'] = $_POST['til']['date']['m'];
                 $_SESSION['pay_coupons']['til']['date']['y'] = $_POST['til']['date']['y'];
             } else {
                 $_SESSION['pay_coupons']['til']['date']['d'] = '';
                 $_SESSION['pay_coupons']['til']['date']['m'] = '';
                 $_SESSION['pay_coupons']['til']['date']['y'] = '';
             }
             $_SESSION['pay_coupons']['coupon_type'] = $_POST['coupon_type'];
         }
     }
     $this->coupon_obj->setSearchTitleType(ilUtil::stripSlashes($_SESSION['pay_coupons']['title_type']));
     $this->coupon_obj->setSearchTitleValue(ilUtil::stripSlashes($_SESSION['pay_coupons']['title_value']));
     $this->coupon_obj->setSearchType(ilUtil::stripSlashes($_SESSION['pay_coupons']['coupon_type']));
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $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['pay_coupons']['show_filter'] ? 1 : 0);
     $o_hidden = new ilHiddenInputGUI('updateView');
     $o_hidden->setValue(1);
     $o_hidden->setPostVar('updateView');
     $o_hide_check->addSubItem($o_hidden);
     // Title type
     $o_title_type = new ilSelectInputGUI();
     $title_option = array($this->lng->txt('pay_starting'), $this->lng->txt('pay_ending'));
     $title_value = array('0', '1');
     $o_title_type->setTitle($this->lng->txt('title'));
     $o_title_type->setOptions($title_option);
     $o_title_type->setValue($_SESSION['pay_coupons']['title_type']);
     $o_title_type->setPostVar('title_type');
     $o_hide_check->addSubItem($o_title_type);
     // Title value
     $o_title_val = new ilTextInputGUI();
     $o_title_val->setValue($_SESSION['pay_coupons']['title_value']);
     $o_title_val->setPostVar('title_value');
     $o_hide_check->addSubItem($o_title_val);
     //coupon 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($_SESSION['pay_coupons']['coupon_type']);
     $o_coupon_type->setPostVar('coupon_type');
     $o_hide_check->addSubItem($o_coupon_type);
     // date from
     $o_from_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_from'), 'from_check');
     $o_from_check->setValue(1);
     $o_from_check->setChecked($_SESSION['pay_coupons']['from_check'] ? 1 : 0);
     $o_date_from = new ilDateTimeInputGUI();
     $o_date_from->setPostVar('from');
     $_POST['from'] = $_SESSION['pay_coupons']['from'];
     if ($_SESSION['pay_coupons']['from_check'] == '1') {
         $o_date_from->checkInput();
     }
     $o_from_check->addSubItem($o_date_from);
     $o_hide_check->addSubItem($o_from_check);
     // date until
     $o_until_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_til'), 'until_check');
     $o_until_check->setValue(1);
     $o_until_check->setChecked($_SESSION['pay_coupons']['until_check'] ? 1 : 0);
     $o_date_until = new ilDateTimeInputGUI();
     $o_date_until->setPostVar('til');
     $_POST['til'] = $_SESSION['pay_coupons']['til'];
     if ($_SESSION['pay_coupons']['until_check'] == '1') {
         $o_date_until->checkInput();
     }
     $o_until_check->addSubItem($o_date_until);
     $o_hide_check->addSubItem($o_until_check);
     $filter_form->addCommandButton('showCoupons', $this->lng->txt('pay_update_view'));
     $filter_form->addCommandButton('resetFilter', $this->lng->txt('pay_reset_filter'));
     $filter_form->addItem($o_hide_check);
     $this->tpl->setVariable('FORM', $filter_form->getHTML());
     if (!count($coupons = $this->coupon_obj->getCoupons())) {
         ilUtil::sendInfo($this->lng->txt('paya_coupons_not_found'));
         //if ($_POST['updateView'] == '1') ilUtil::sendInfo($this->lng->txt('paya_coupons_not_found'));
         //else ilUtil::sendInfo($this->lng->txt('paya_coupons_not_available'));
         return true;
     }
     $counter = 0;
     foreach ($coupons as $coupon) {
         $f_result[$counter]['pc_title'] = $coupon['pc_title'];
         $f_result[$counter]['number_of_codes'] = $coupon['number_of_codes'];
         $f_result[$counter]['usage_of_codes'] = $coupon['usage_of_codes'];
         if (!empty($coupon['objects'])) {
             $objects = "";
             for ($i = 0; $i < count($coupon['objects']); $i++) {
                 $tmp_obj = ilObjectFactory::getInstanceByRefId($coupon['objects'][$i], false);
                 if ($tmp_obj) {
                     $objects .= $tmp_obj->getTitle();
                 } else {
                     $objects .= $this->lng->txt('object_not_found');
                 }
                 if ($i < count($coupon['objects']) - 1) {
                     $objects .= "<br />";
                 }
                 unset($tmp_obj);
             }
         } else {
             $objects = "";
         }
         $f_result[$counter]['objects'] = $objects;
         $f_result[$counter]['pc_from'] = $coupon['pc_from'] != NULL && $coupon['pc_from_enabled'] == '1' ? $coupon['pc_from'] : '';
         $f_result[$counter]['pc_till'] = $coupon['pc_till'] != NULL && $coupon['pc_till_enabled'] == '1' ? $coupon['pc_till'] : '';
         $f_result[$counter]['pc_last_changed'] = $coupon['pc_last_changed'] != NULL ? $coupon['pc_last_changed'] : '';
         $f_result[$counter]['pc_last_changed_author'] = $coupon['pc_last_change_usr_id'] > 0 ? ilObjUser::_lookupLogin($coupon['pc_last_change_usr_id']) : ilObjUser::_lookupLogin($coupon['usr_id']);
         $this->ctrl->setParameter($this, 'coupon_id', $coupon['pc_pk']);
         $f_result[$counter]['options'] = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "addCoupon") . "\">" . $this->lng->txt("edit") . "</a>";
         $f_result[$counter]['options'] .= " <a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "deleteCoupon") . "\">" . $this->lng->txt("delete") . "</a></div>";
         ++$counter;
     }
     return $this->__showCouponsTable($f_result);
 }