public function vatsObject()
 {
     global $ilAccess;
     if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
         $this->ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $this->ilErr->MESSAGE);
     }
     include_once 'Services/Table/classes/class.ilTable2GUI.php';
     $tbl = new ilTable2GUI($this, 'vats');
     $tbl->setId('pay_vats_tbl');
     $tbl->setFormAction($this->ctrl->getFormAction($this), 'createVat');
     $tbl->setTitle($this->lng->txt('payment_tax_rates'));
     $tbl->setRowTemplate('tpl.shop_vats_list_row.html', 'Services/Payment');
     $tbl->setDefaultOrderField('title');
     $tbl->addColumn('', 'check', '1%');
     $tbl->addColumn($this->lng->txt('vat_title'), 'vat_title', '33%');
     $tbl->addColumn($this->lng->txt('vat_rate'), 'vat_rate', '33%');
     $tbl->addColumn('', 'commands', '33%');
     $oShopVatsList = new ilShopVatsList();
     $oShopVatsList->read();
     $result = array();
     $_SESSION['count_vats'] = $oShopVatsList->getNumItems();
     if ($oShopVatsList->hasItems()) {
         $tbl->enable('select_all');
         $tbl->setSelectAllCheckbox('vat_id');
         $counter = 0;
         foreach ($oShopVatsList as $oVAT) {
             $result[$counter]['check'] = ilUtil::formCheckbox(0, 'vat_id[]', $oVAT->getId());
             $result[$counter]['vat_title'] = $oVAT->getTitle();
             $result[$counter]['vat_rate'] = ilShopUtils::_formatVAT((double) $oVAT->getRate());
             $this->ctrl->setParameter($this, 'vat_id', $oVAT->getId());
             $result[$counter]['edit_text'] = $this->lng->txt('edit');
             $result[$counter]['edit_url'] = $this->ctrl->getLinkTarget($this, 'editVat');
             $result[$counter]['delete_text'] = $this->lng->txt('delete');
             $result[$counter]['delete_url'] = $this->ctrl->getLinkTarget($this, 'confirmDeleteVat');
             $this->ctrl->clearParameters($this);
             ++$counter;
         }
         $tbl->addMultiCommand('confirmDeleteVat', $this->lng->txt('delete'));
     } else {
         $tbl->disable('header');
         $tbl->disable('footer');
         $tbl->setNoEntriesText($this->lng->txt('paya_no_vats_assigned'));
     }
     $tbl->setData($result);
     $tbl->addCommandButton('createVat', $this->lng->txt('paya_insert_vats'));
     $this->tpl->setContent($tbl->getHTML());
     return true;
 }
 public function showMembersList()
 {
     if (!$this->mlists->getCurrentMailingList()->getId()) {
         $this->showMailingLists();
         return true;
     }
     $this->ctrl->setParameter($this, 'cmd', 'post');
     $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
     $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
     $tbl = new ilTable2GUI($this);
     $tbl->setId('show_mlng_mmbrs_list_tbl');
     $tbl->setFormAction($this->ctrl->getFormAction($this), 'showMemberForm');
     $tbl->setTitle($this->lng->txt('mail_members_of_mailing_list') . ' ' . $this->mlists->getCurrentMailingList()->getTitle());
     $tbl->setRowTemplate('tpl.mail_mailing_lists_membersrow.html', 'Services/Contact');
     $this->ctrl->setParameter($this, 'cmd', 'showMembersList');
     $tbl->setDefaultOrderField('title');
     $result = array();
     $tbl->addColumn('', 'check', '10%');
     $tbl->addColumn($this->lng->txt('title'), 'title', '90%');
     $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
     if (count($assigned_entries)) {
         $tbl->enable('select_all');
         $tbl->setSelectAllCheckbox('a_id');
         $counter = 0;
         foreach ($assigned_entries as $entry) {
             $result[$counter]['check'] = ilUtil::formCheckbox(0, 'a_id[]', $entry['a_id']);
             $result[$counter]['title'] = $entry['login'] != '' ? $entry['login'] : $entry['email'];
             ++$counter;
         }
         $tbl->addMultiCommand('confirmDeleteMembers', $this->lng->txt('delete'));
     } else {
         $tbl->disable('header');
         $tbl->disable('footer');
         $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
     }
     $tbl->setData($result);
     $tbl->addCommandButton('showAssignmentForm', $this->lng->txt('add'));
     $tbl->addCommandButton('showMailingLists', $this->lng->txt('back'));
     $this->tpl->setVariable('MEMBERS_LIST', $tbl->getHTML());
     $this->tpl->show();
     return true;
 }
Esempio n. 3
0
 public function showResults()
 {
     global $lng, $ilUser, $rbacreview, $ilObjDataCache;
     $form = $this->initSearchForm();
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_search.html", "Services/Contact");
     $this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setTitle($this->lng->txt("mail"));
     $this->tpl->setVariable('SEARCHFORM', $form->getHtml());
     // #14109
     if (strlen($_SESSION['mail_search_search']) < 3) {
         if ($_GET["ref"] != "wsp") {
             $this->tpl->show();
         }
         return;
     }
     $abook = new ilAddressbook($ilUser->getId());
     $entries = $abook->searchUsers(addslashes(urldecode($_SESSION['mail_search_search'])));
     // remove all contacts who are not registered users for personal workspace
     if ($_GET["ref"] == "wsp") {
         foreach ($entries as $idx => $entry) {
             if (!$entry["login"]) {
                 unset($entries[$idx]);
             }
         }
     }
     if (count($entries)) {
         $tbl_addr = new ilTable2GUI($this);
         $tbl_addr->setTitle($lng->txt('mail_addressbook'));
         $tbl_addr->setRowTemplate('tpl.mail_search_addr_row.html', 'Services/Contact');
         $result = array();
         $counter = 0;
         foreach ($entries as $entry) {
             if ($_GET["ref"] != "wsp") {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_addr[]', $entry['login'] ? $entry['login'] : $entry['email']) . ilUtil::formCheckbox(0, 'search_name_cc[]', $entry['login'] ? $entry['login'] : $entry['email']) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $entry['login'] ? $entry['login'] : $entry['email']);
             } else {
                 $user_id = ilObjUser::_loginExists($entry["login"]);
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_addr[]', $user_id);
             }
             $result[$counter]['login'] = $entry['login'];
             $result[$counter]['firstname'] = $entry['firstname'];
             $result[$counter]['lastname'] = $entry['lastname'];
             $id = ilObjUser::_lookupId($entry['login']);
             if (ilObjUser::_lookupPref($id, 'public_email') == 'y' || !$entry['login']) {
                 $has_mail_addr = true;
                 $result[$counter]['email'] = $entry['email'];
             }
             ++$counter;
         }
         if ($_GET["ref"] != "wsp") {
             $tbl_addr->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
         } else {
             $tbl_addr->addColumn("", "", "1%");
         }
         $tbl_addr->addColumn($this->lng->txt('login'), 'login', "15%");
         $tbl_addr->addColumn($this->lng->txt('firstname'), 'firstname', "15%");
         $tbl_addr->addColumn($this->lng->txt('lastname'), 'lastname', "15%");
         if ($has_mail_addr) {
             foreach ($result as $key => $val) {
                 if ($val['email'] == '') {
                     $result[$key]['email'] = '&nbsp;';
                 }
             }
             $tbl_addr->addColumn($this->lng->txt('email'), 'email', "15%");
         }
         $tbl_addr->setData($result);
         $tbl_addr->setDefaultOrderField('login');
         $tbl_addr->setPrefix('addr_');
         $tbl_addr->enable('select_all');
         $tbl_addr->setSelectAllCheckbox('search_name_to_addr');
         $tbl_addr->setFormName('recipients');
         $this->tpl->setVariable('TABLE_ADDR', $tbl_addr->getHTML());
     }
     include_once 'Services/Search/classes/class.ilQueryParser.php';
     include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
     include_once 'Services/Search/classes/class.ilSearchResult.php';
     $all_results = new ilSearchResult();
     $query_parser = new ilQueryParser(addcslashes($_SESSION['mail_search_search'], '%_'));
     $query_parser->setCombination(QP_COMBINATION_AND);
     $query_parser->setMinWordLength(3);
     $query_parser->parse();
     $user_search =& ilObjectSearchFactory::_getUserSearchInstance($query_parser);
     $user_search->enableActiveCheck(true);
     $user_search->setFields(array('login'));
     $result_obj = $user_search->performSearch();
     $all_results->mergeEntries($result_obj);
     $user_search->setFields(array('firstname'));
     $result_obj = $user_search->performSearch();
     $all_results->mergeEntries($result_obj);
     $user_search->setFields(array('lastname'));
     $result_obj = $user_search->performSearch();
     $all_results->mergeEntries($result_obj);
     $all_results->setMaxHits(100000);
     $all_results->preventOverwritingMaxhits(true);
     $all_results->filter(ROOT_FOLDER_ID, true);
     // Filter users (depends on setting in user accounts)
     include_once 'Services/User/classes/class.ilUserFilter.php';
     $users = ilUserFilter::getInstance()->filter($all_results->getResultIds());
     if (count($users)) {
         $tbl_users = new ilTable2GUI($this);
         $tbl_users->setTitle($lng->txt('system') . ': ' . $lng->txt('persons'));
         $tbl_users->setRowTemplate('tpl.mail_search_users_row.html', 'Services/Contact');
         $result = array();
         $counter = 0;
         foreach ($users as $user) {
             $login = ilObjUser::_lookupLogin($user);
             if ($_GET["ref"] != "wsp") {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_usr[]', $login) . ilUtil::formCheckbox(0, 'search_name_cc[]', $login) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $login);
             } else {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_usr[]', $user);
             }
             $result[$counter]['login'] = $login;
             if (in_array(ilObjUser::_lookupPref($user, 'public_profile'), array('y', "g"))) {
                 $name = ilObjUser::_lookupName($user);
                 $result[$counter]['firstname'] = $name['firstname'];
                 $result[$counter]['lastname'] = $name['lastname'];
             } else {
                 $result[$counter]['firstname'] = '';
                 $result[$counter]['lastname'] = '';
             }
             if (ilObjUser::_lookupPref($user, 'public_email') == 'y') {
                 $has_mail_usr = true;
                 $result[$counter]['email'] = ilObjUser::_lookupEmail($user);
             }
             ++$counter;
         }
         if ($_GET["ref"] != "wsp") {
             $tbl_users->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
         } else {
             $tbl_users->addColumn("", "", "1%");
         }
         $tbl_users->addColumn($this->lng->txt('login'), 'login', '15%');
         $tbl_users->addColumn($this->lng->txt('firstname'), 'firstname', '15%');
         $tbl_users->addColumn($this->lng->txt('lastname'), 'lastname', '15%');
         if ($has_mail_usr == true) {
             foreach ($result as $key => $val) {
                 if ($val['email'] == '') {
                     $result[$key]['email'] = '&nbsp;';
                 }
             }
             $tbl_users->addColumn($this->lng->txt('email'), 'email', '15%');
         }
         $tbl_users->setData($result);
         $tbl_users->setDefaultOrderField('login');
         $tbl_users->setPrefix('usr_');
         $tbl_users->enable('select_all');
         $tbl_users->setSelectAllCheckbox('search_name_to_usr');
         $tbl_users->setFormName('recipients');
         $this->tpl->setVariable('TABLE_USERS', $tbl_users->getHTML());
     }
     include_once 'Services/Search/classes/class.ilQueryParser.php';
     include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
     include_once 'Services/Search/classes/class.ilSearchResult.php';
     include_once 'Services/Membership/classes/class.ilParticipants.php';
     $group_results = new ilSearchResult();
     $query_parser = new ilQueryParser(addcslashes($_SESSION['mail_search_search'], '%_'));
     $query_parser->setCombination(QP_COMBINATION_AND);
     $query_parser->setMinWordLength(3);
     $query_parser->parse();
     $search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
     $search->setFilter(array('grp'));
     $result = $search->performSearch();
     $group_results->mergeEntries($result);
     $group_results->setMaxHits(PHP_INT_MAX);
     $group_results->preventOverwritingMaxhits(true);
     $group_results->setRequiredPermission('read');
     $group_results->filter(ROOT_FOLDER_ID, true);
     $visible_groups = array();
     if ($group_results->getResults()) {
         $tbl_grp = new ilTable2GUI($this);
         $tbl_grp->setTitle($lng->txt('system') . ': ' . $lng->txt('groups'));
         $tbl_grp->setRowTemplate('tpl.mail_search_groups_row.html', 'Services/Contact');
         $result = array();
         $counter = 0;
         $ilObjDataCache->preloadReferenceCache(array_keys($group_results->getResults()));
         $groups = $group_results->getResults();
         foreach ($groups as $grp) {
             if (!ilParticipants::hasParticipantListAccess($grp['obj_id'])) {
                 continue;
             }
             if ($_GET["ref"] != "wsp") {
                 $members = array();
                 $roles = $rbacreview->getAssignableChildRoles($grp['ref_id']);
                 foreach ($roles as $role) {
                     if (substr($role['title'], 0, 14) == 'il_grp_member_' || substr($role['title'], 0, 13) == 'il_grp_admin_') {
                         // does not work if Pear is enabled and Mailbox Address contain special chars!!
                         //array_push($members, $rbacreview->getRoleMailboxAddress($role['obj_id']));
                         // FIX for Mantis: 7523
                         array_push($members, '#' . $role['title']);
                     }
                 }
                 $str_members = implode(',', $members);
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_grp[]', $str_members) . ilUtil::formCheckbox(0, 'search_name_cc[]', $str_members) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $str_members);
             } else {
                 $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_grp[]', $grp['obj_id']);
             }
             $result[$counter]['title'] = $ilObjDataCache->lookupTitle($grp['obj_id']);
             $result[$counter]['description'] = $ilObjDataCache->lookupDescription($grp['obj_id']);
             ++$counter;
             $visible_groups[] = $grp;
         }
         if ($visible_groups) {
             $tbl_grp->setData($result);
             if ($_GET["ref"] != "wsp") {
                 $tbl_grp->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
             } else {
                 $tbl_grp->addColumn("", "", "1%");
             }
             $tbl_grp->addColumn($this->lng->txt('title'), 'title', '15%');
             $tbl_grp->addColumn($this->lng->txt('description'), 'description', '15%');
             $tbl_grp->setDefaultOrderField('title');
             $tbl_grp->setPrefix('grp_');
             $tbl_grp->enable('select_all');
             $tbl_grp->setSelectAllCheckbox('search_name_to_grp');
             $tbl_grp->setFormName('recipients');
             $this->tpl->setVariable('TABLE_GRP', $tbl_grp->getHTML());
         }
     }
     if (count($users) || count($visible_groups) || count($entries)) {
         $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
         $this->tpl->setVariable("ALT_ARROW", '');
         if ($_GET["ref"] != "wsp") {
             $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('adopt'));
         } else {
             $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('wsp_share_with_users'));
         }
     } else {
         $this->lng->loadLanguageModule('search');
         ilUtil::sendInfo($this->lng->txt('search_no_match'));
     }
     if ($_GET["ref"] != "wsp") {
         $this->tpl->show();
     }
 }
 public function showModerators()
 {
     /** 
      * @var $ilToolbar ilToolbarGUI */
     global $ilToolbar;
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forum_moderators.html', 'Modules/Forum');
     // search button
     $ilToolbar->addButton($this->lng->txt("search_users"), $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', 'start'));
     $tbl = new ilTable2GUI($this);
     $tbl->setId('frm_show_mods_tbl_' . $_GET['ref_id']);
     $tbl->setFormAction($this->ctrl->getFormAction($this, 'detachModeratorRole'));
     $tbl->setTitle($this->lng->txt('frm_moderators'));
     $tbl->setRowTemplate('tpl.forum_moderators_table_row.html', 'Modules/Forum');
     $tbl->addColumn('', 'check', '1%');
     $tbl->addColumn($this->lng->txt('login'), 'login', '30%');
     $tbl->addColumn($this->lng->txt('firstname'), 'firstname', '30%');
     $tbl->addColumn($this->lng->txt('lastname'), 'lastname', '30%');
     $tbl->setDefaultOrderField('login');
     $entries = $this->oForumModerators->getCurrentModerators();
     $result = array();
     if (count($entries)) {
         $counter = 0;
         foreach ($entries as $usr_id) {
             $oUser = ilObjectFactory::getInstanceByObjId($usr_id, false);
             if (is_object($oUser)) {
                 if (count($entries) > 1) {
                     $result[$counter]['check'] = ilUtil::formCheckbox(0, 'usr_id[]', $oUser->getId());
                 }
                 $result[$counter]['login'] = $oUser->getLogin();
                 $result[$counter]['firstname'] = $oUser->getFirstname();
                 $result[$counter]['lastname'] = $oUser->getLastname();
                 ++$counter;
             }
         }
         if (count($entries) > 1) {
             $tbl->enable('select_all');
             $tbl->setSelectAllCheckbox('usr_id');
             $tbl->addMultiCommand('detachModeratorRole', $this->lng->txt('frm_detach_moderator_role'));
         }
     } else {
         $tbl->disable('header');
         $tbl->disable('footer');
         $tbl->setNoEntriesText($this->lng->txt('frm_moderators_not_exist_yet'));
     }
     $tbl->setData($result);
     $this->tpl->setVariable('TXT_FORUM_MODERATORS', $tbl->getHTML());
 }