/**
  * check whether goto script will succeed
  */
 function _checkGoto($a_target)
 {
     global $rbacsystem;
     require_once 'Services/Mail/classes/class.ilMail.php';
     $mail = new ilMail($_SESSION["AccountId"]);
     if ($rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
         return true;
     }
     return false;
 }
 public function getHTML()
 {
     global $ilUser, $rbacsystem;
     $umail = new ilMail($ilUser->getId());
     if (!$rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
         return '';
     }
     if ($this->getCurrentDetailLevel() == 0) {
         return '';
     } else {
         $html = parent::getHTML();
         return $html;
     }
 }
 public function __construct($wsp_access_handler = null, $wsp_node_id = null)
 {
     global $tpl, $ilCtrl, $lng, $ilUser, $rbacsystem;
     $this->tpl = $tpl;
     $this->ctrl = $ilCtrl;
     $this->lng = $lng;
     // personal workspace
     $this->wsp_access_handler = $wsp_access_handler;
     $this->wsp_node_id = $wsp_node_id;
     $this->ctrl->saveParameter($this, "mobj_id");
     $this->ctrl->saveParameter($this, "ref");
     // check if current user may send mails
     include_once "Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail($_SESSION["AccountId"]);
     $this->mailing_allowed = $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
     $this->umail = new ilFormatMail($ilUser->getId());
     $this->abook = new ilAddressbook($ilUser->getId());
 }
 public function showMailingLists()
 {
     global $rbacsystem;
     $this->tpl->setTitle($this->lng->txt('mail_addressbook'));
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
     // check if current user may send mails
     include_once "Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail($_SESSION["AccountId"]);
     $mailing_allowed = $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
     $tbl = new ilTable2GUI($this);
     $tbl->setId('show_mlng_lists_tbl');
     $tbl->setFormAction($this->ctrl->getFormAction($this), 'showForm');
     $tbl->setTitle($this->lng->txt('mail_mailing_lists'));
     $tbl->setRowTemplate('tpl.mail_mailing_lists_listrow.html', 'Services/Contact');
     $tbl->setDefaultOrderField('title');
     $result = array();
     $tbl->addColumn('', 'check', '10%', true);
     $tbl->addColumn($this->lng->txt('title'), 'title', '30%');
     $tbl->addColumn($this->lng->txt('description'), 'description', '30%');
     $tbl->addColumn($this->lng->txt('members'), 'members', '20%');
     $tbl->addColumn($this->lng->txt('actions'), '', '10%');
     $entries = $this->mlists->getAll();
     if (count($entries)) {
         $tbl->enable('select_all');
         $tbl->setSelectAllCheckbox('ml_id');
         $counter = 0;
         include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
         foreach ($entries as $entry) {
             if ($entry->getMode() == ilMailingList::MODE_TEMPORARY) {
                 continue;
             }
             $result[$counter]['check'] = ilUtil::formCheckbox(0, 'ml_id[]', $entry->getId());
             $result[$counter]['title'] = $entry->getTitle() . " [#il_ml_" . $entry->getId() . "]";
             $result[$counter]['description'] = $entry->getDescription();
             $result[$counter]['members'] = count($entry->getAssignedEntries());
             $this->ctrl->setParameter($this, 'ml_id', $entry->getId());
             //$result[$counter]['edit_text'] = $this->lng->txt("edit");
             //$result[$counter]['edit_url'] = $this->ctrl->getLinkTarget($this, "showForm");
             //$result[$counter]['members_text'] = $this->lng->txt("members");
             //$result[$counter]['members_url'] = $this->ctrl->getLinkTarget($this, "showMembersList");
             $current_selection_list = new ilAdvancedSelectionListGUI();
             $current_selection_list->setListTitle($this->lng->txt("actions"));
             $current_selection_list->setId("act_" . $counter);
             $current_selection_list->addItem($this->lng->txt("edit"), '', $this->ctrl->getLinkTarget($this, "showForm"));
             $current_selection_list->addItem($this->lng->txt("members"), '', $this->ctrl->getLinkTarget($this, "showMembersList"));
             if ($mailing_allowed) {
                 $current_selection_list->addItem($this->lng->txt("send_mail_to"), '', $this->ctrl->getLinkTarget($this, "mailToList"));
             }
             $current_selection_list->addItem($this->lng->txt("delete"), '', $this->ctrl->getLinkTarget($this, "confirmDelete"));
             $result[$counter]['COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
             ++$counter;
         }
         if ($mailing_allowed) {
             $tbl->addMultiCommand('mailToList', $this->lng->txt('send_mail_to'));
         }
         $tbl->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
     } else {
         $tbl->disable('header');
         $tbl->disable('footer');
         $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
     }
     $tbl->setData($result);
     $tbl->addCommandButton('showForm', $this->lng->txt('add'));
     if (isset($_GET['ref']) && $_GET['ref'] == 'mail') {
         $tbl->addCommandButton('cancel', $this->lng->txt('cancel'));
     }
     $this->tpl->setVariable('MAILING_LISTS', $tbl->getHTML());
     $this->tpl->show();
     return true;
 }
 public function getUserMultiCommands($a_search_form = false)
 {
     global $rbacsystem, $ilUser;
     // see searchResultHandler()
     if ($a_search_form) {
         $cmds = array('activate' => $this->lng->txt('activate'), 'deactivate' => $this->lng->txt('deactivate'), 'accessRestrict' => $this->lng->txt('accessRestrict'), 'accessFree' => $this->lng->txt('accessFree'));
         if ($rbacsystem->checkAccess('delete', $this->object->getRefId())) {
             $cmds["delete"] = $this->lng->txt("delete");
         }
     } else {
         $cmds = array('activateUsers' => $this->lng->txt('activate'), 'deactivateUsers' => $this->lng->txt('deactivate'), 'restrictAccess' => $this->lng->txt('accessRestrict'), 'freeAccess' => $this->lng->txt('accessFree'));
         if ($rbacsystem->checkAccess('delete', $this->object->getRefId())) {
             $cmds["deleteUsers"] = $this->lng->txt("delete");
         }
     }
     // no confirmation needed
     $export_types = array("userfolder_export_excel_x86", "userfolder_export_csv", "userfolder_export_xml");
     foreach ($export_types as $type) {
         $cmd = explode("_", $type);
         $cmd = array_pop($cmd);
         $cmds['usrExport' . ucfirst($cmd)] = $this->lng->txt('export') . ' - ' . $this->lng->txt($type);
     }
     // check if current user may send mails
     include_once "Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail($ilUser->getId());
     if ($rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
         $cmds["mail"] = $this->lng->txt("send_mail");
     }
     return $cmds;
 }
Example #6
0
 /**
  * goto target group
  */
 public static function _goto($a_target)
 {
     global $ilAccess, $ilErr, $lng, $rbacsystem;
     require_once 'Services/Mail/classes/class.ilMail.php';
     $mail = new ilMail($_SESSION["AccountId"]);
     if ($rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
         ilUtil::redirect("ilias.php?baseClass=ilMailGUI");
         exit;
     } else {
         if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
             $_GET["cmd"] = "frameset";
             $_GET["target"] = "";
             $_GET["ref_id"] = ROOT_FOLDER_ID;
             $_GET["baseClass"] = "ilRepositoryGUI";
             ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"), ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
             include "ilias.php";
             exit;
         }
     }
     $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
 }
 /**
  * Get Mail HTML for Personal Desktop Mail Display
  */
 public function getPDMailHTML($a_mail_id, $a_mobj_id)
 {
     global $lng, $rbacsystem, $ilias;
     $lng->loadLanguageModule('mail');
     //get the mail from user
     $umail = new ilMail($_SESSION['AccountId']);
     // catch hack attempts
     if (!$rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId())) {
         $ilias->raiseError($lng->txt('permission_denied'), $ilias->error_obj->WARNING);
     }
     $umail->markRead(array($a_mail_id));
     $mail_data = $umail->getMail($a_mail_id);
     $tpl = new ilTemplate('tpl.pd_mail.html', true, true, 'Services/Mail');
     // attachments
     if ($mail_data['attachments']) {
         foreach ($mail_data['attachments'] as $file) {
             $tpl->setCurrentBlock('a_row');
             $tpl->setVariable('HREF_DOWNLOAD', 'ilias.php?baseClass=ilMailGUI&type=deliverFile&mail_id=' . $_GET['mail_id'] . '&filename=' . md5($file));
             $tpl->setVariable('FILE_NAME', $file);
             $tpl->setVariable('TXT_DOWNLOAD', $lng->txt('download'));
             $tpl->parseCurrentBlock();
         }
         $tpl->setCurrentBlock('attachment');
         $tpl->setVariable('TXT_ATTACHMENT', $lng->txt('attachments'));
         $tpl->parseCurrentBlock();
     }
     $tpl->setVariable('TXT_FROM', $lng->txt('from'));
     /**
      * @var $sender ilObjUser
      */
     $sender = ilObjectFactory::getInstanceByObjId($mail_data['sender_id'], false);
     if ($sender && $sender->getId() != ANONYMOUS_USER_ID) {
         $tpl->setCurrentBlock('pers_image');
         $tpl->setVariable('IMG_SENDER', $sender->getPersonalPicturePath('xsmall'));
         $tpl->setVariable('ALT_SENDER', $sender->getPublicName());
         $tpl->parseCurrentBlock();
         $tpl->setVariable('PUBLIC_NAME', $sender->getPublicName());
     } else {
         if (!$sender) {
             $tpl->setVariable('PUBLIC_NAME', $mail_data['import_name'] . ' (' . $lng->txt('user_deleted') . ')');
         } else {
             $tpl->setCurrentBlock('pers_image');
             $tpl->setVariable('IMG_SENDER', ilUtil::getImagePath('HeaderIconAvatar.png'));
             $tpl->setVariable('ALT_SENDER', ilMail::_getIliasMailerName());
             $tpl->parseCurrentBlock();
             $tpl->setVariable('PUBLIC_NAME', ilMail::_getIliasMailerName());
         }
     }
     $tpl->setVariable('TXT_TO', $lng->txt('mail_to'));
     $tpl->setVariable('TO', $umail->formatNamesForOutput($mail_data['rcp_to']));
     if ($mail_data['rcp_cc']) {
         $tpl->setCurrentBlock('cc');
         $tpl->setVariable('TXT_CC', $lng->txt('cc'));
         $tpl->setVariable('CC', $umail->formatNamesForOutput($mail_data['rcp_cc']));
         $tpl->parseCurrentBlock();
     }
     $tpl->setVariable('TXT_SUBJECT', $lng->txt('subject'));
     $tpl->setVariable('SUBJECT', htmlspecialchars($mail_data['m_subject']));
     $tpl->setVariable('TXT_DATE', $lng->txt('date'));
     $tpl->setVariable('DATE', ilDatePresentation::formatDate(new ilDateTime($mail_data['send_time'], IL_CAL_DATETIME)));
     $tpl->setVariable('TXT_MESSAGE', $lng->txt('message'));
     // Note: For security reasons, ILIAS only allows Plain text strings in E-Mails.
     $tpl->setVariable('MAIL_MESSAGE', nl2br(ilUtil::makeClickable(htmlspecialchars(ilUtil::securePlainString($mail_data['m_message'])))));
     return $tpl->get();
 }
 /**
  * Constructor
  *
  * @access public
  * @param object	parent object
  * @param string	type; valid values are 'crs' for courses and
  *			'grp' for groups
  * @param string	context 
  */
 public function __construct($a_parent_obj, $type = 'crs', $context = 'mail')
 {
     global $lng, $ilCtrl, $ilUser, $lng, $rbacsystem;
     $lng->loadLanguageModule('crs');
     if ($context == "mail") {
         // check if current user may send mails
         include_once "Services/Mail/classes/class.ilMail.php";
         $mail = new ilMail($_SESSION["AccountId"]);
         $this->mailing_allowed = $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
     }
     $mode = array();
     if ($type == "crs") {
         $mode["short"] = "crs";
         $mode["long"] = "course";
         $mode["checkbox"] = "search_crs";
         $mode["tableprefix"] = "crstable";
         $mode["lng_mail"] = $lng->txt("mail_my_courses");
         $mode["view"] = "mycourses";
         $this->setTitle($mode["lng_mail"]);
     } else {
         if ($type == "grp") {
             $mode["short"] = "grp";
             $mode["long"] = "group";
             $mode["checkbox"] = "search_grp";
             $mode["tableprefix"] = "grptable";
             $mode["lng_mail"] = $lng->txt("mail_my_groups");
             $mode["view"] = "mygroups";
             $this->setTitle($mode["lng_mail"]);
         }
     }
     $this->setId('search_' . $mode["short"]);
     parent::__construct($a_parent_obj);
     //$this->courseIds = $crs_ids;
     $this->parentObject = $a_parent_obj;
     $this->mode = $mode;
     $this->context = $context;
     $ilCtrl->setParameter($a_parent_obj, 'view', $mode['view']);
     if ($_GET['ref'] != '') {
         $ilCtrl->setParameter($a_parent_obj, 'ref', $_GET['ref']);
     }
     if (is_array($_POST[$mode["checkbox"]])) {
         $ilCtrl->setParameter($a_parent_obj, $mode["checkbox"], implode(',', $_POST[$mode["checkbox"]]));
     }
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $ilCtrl->clearParameters($a_parent_obj);
     $this->setSelectAllCheckbox($mode["checkbox"] . '[]');
     $this->setRowTemplate('tpl.mail_search_courses_row.html', 'Services/Contact');
     $this->setShowRowsSelector(true);
     // setup columns
     $this->addColumn('', '', '1px', true);
     $this->addColumn($mode["lng_mail"], 'CRS_NAME', '30%');
     $this->addColumn($lng->txt('path'), 'CRS_PATH', '30%');
     $this->addColumn($lng->txt('crs_count_members'), 'CRS_NO_MEMBERS', '20%');
     $this->addColumn($lng->txt('actions'), '', '19%');
     if ($context == "mail") {
         if ($this->mailing_allowed) {
             $this->addMultiCommand('mail', $lng->txt('mail_members'));
         }
     } else {
         if ($context == "wsp") {
             $lng->loadLanguageModule("wsp");
             $this->addMultiCommand('share', $lng->txt('wsp_share_with_members'));
         }
     }
     $this->addMultiCommand('showMembers', $lng->txt('mail_list_members'));
     if ($_GET['ref'] == 'mail') {
         $this->addCommandButton('cancel', $lng->txt('cancel'));
     }
 }
 /**
  * Show user's addressbook
  */
 public function showAddressbook()
 {
     /**
      * @var $rbacsystem ilRbacSystem
      * @var $lng ilLanguage
      * @var $ilCtrl ilCtrl
      * @var $ilSetting ilSetting
      */
     global $rbacsystem, $lng, $ilCtrl, $ilSetting;
     $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_addressbook.html", "Services/Contact");
     // check if current user may send mails
     include_once "Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail($_SESSION["AccountId"]);
     $mailing_allowed = $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
     $chatSettings = new ilSetting('chatroom');
     $chat_active = $chatSettings->get("chat_enabled", false);
     // check if current user may send smtp mails
     $smtp_mailing_allowed = $rbacsystem->checkAccess("smtp_mail", $this->umail->getMailObjectReferenceId());
     $tbl = new ilAddressbookTableGUI($this, '', $mailing_allowed, $chat_active);
     $tbl->setSmtpMailingAllowed($smtp_mailing_allowed);
     $this->abook->setSearchQuery($tbl->getFilterQuery());
     $entries = $this->abook->getEntries();
     $tbl->setData($entries);
     $this->tpl->setVariable('TABLE', $tbl->getHTML());
     $this->tpl->show();
     unset($_SESSION['addr_search']);
     return true;
 }
Example #10
0
 private function initTopicCreateForm()
 {
     /**
      * @var $ilUser ilObjUser
      * @var $rbacsystem ilRbacSystem
      * @var $ilias ILIAS
      * @var $ilSetting ilSetting
      */
     global $ilUser, $rbacsystem, $ilias, $ilSetting;
     $this->create_topic_form_gui = new ilPropertyFormGUI();
     $this->create_topic_form_gui->setTitle($this->lng->txt('forums_new_thread'));
     $this->create_topic_form_gui->setTitleIcon(ilUtil::getImagePath('icon_frm.svg'));
     $this->create_topic_form_gui->setTableWidth('100%');
     // form action
     $this->create_topic_form_gui->setFormAction($this->ctrl->getFormAction($this, 'addThread'));
     if ($this->objProperties->isAnonymized() == 1) {
         $alias_gui = new ilTextInputGUI($this->lng->txt('forums_your_name'), 'alias');
         $alias_gui->setInfo($this->lng->txt('forums_use_alias'));
         $alias_gui->setMaxLength(255);
         $alias_gui->setSize(50);
         $this->create_topic_form_gui->addItem($alias_gui);
     } else {
         $alias_gui = new ilNonEditableValueGUI($this->lng->txt('forums_your_name'), 'alias');
         $alias_gui->setValue($ilUser->getLogin());
         $this->create_topic_form_gui->addItem($alias_gui);
     }
     // topic
     $subject_gui = new ilTextInputGUI($this->lng->txt('forums_thread'), 'subject');
     $subject_gui->setMaxLength(255);
     $subject_gui->setSize(50);
     $subject_gui->setRequired(true);
     $this->create_topic_form_gui->addItem($subject_gui);
     // message
     $post_gui = new ilTextAreaInputGUI($this->lng->txt('forums_the_post'), 'message');
     $post_gui->setCols(50);
     $post_gui->setRows(15);
     $post_gui->setRequired(true);
     $post_gui->setUseRte(true);
     $post_gui->addPlugin('latex');
     $post_gui->addButton('latex');
     $post_gui->addButton('pastelatex');
     $post_gui->addPlugin('ilfrmquote');
     //$post_gui->addPlugin('code');
     $post_gui->removePlugin('advlink');
     $post_gui->usePurifier(true);
     $post_gui->setRTERootBlockElement('');
     $post_gui->setRTESupport($ilUser->getId(), 'frm~', 'frm_post', 'tpl.tinymce_frm_post.html', false, '3.4.7');
     $post_gui->disableButtons(array('charmap', 'undo', 'redo', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'anchor', 'fullscreen', 'cut', 'copy', 'paste', 'pastetext', 'formatselect'));
     // purifier
     require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
     $post_gui->setPurifier(ilHtmlPurifierFactory::_getInstanceByType('frm_post'));
     $this->create_topic_form_gui->addItem($post_gui);
     // file
     $fi = new ilFileWizardInputGUI($this->lng->txt('forums_attachments_add'), 'userfile');
     $fi->setFilenames(array(0 => ''));
     $this->create_topic_form_gui->addItem($fi);
     include_once 'Services/Mail/classes/class.ilMail.php';
     $umail = new ilMail($ilUser->getId());
     // catch hack attempts
     if ($rbacsystem->checkAccess('internal_mail', $umail->getMailObjectReferenceId()) && !$this->objProperties->isAnonymized()) {
         // direct notification
         $dir_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_direct_notification'), 'notify');
         $dir_notification_gui->setInfo($this->lng->txt('forum_notify_me_directly'));
         $dir_notification_gui->setValue(1);
         $this->create_topic_form_gui->addItem($dir_notification_gui);
         if ($ilias->getSetting('forum_notification') != 0) {
             // gen. notification
             $gen_notification_gui = new ilCheckboxInputGUI($this->lng->txt('forum_general_notification'), 'notify_posts');
             $gen_notification_gui->setInfo($this->lng->txt('forum_notify_me_generally'));
             $gen_notification_gui->setValue(1);
             $this->create_topic_form_gui->addItem($gen_notification_gui);
         }
     }
     require_once 'Services/Captcha/classes/class.ilCaptchaUtil.php';
     if ($ilUser->isAnonymous() && !$ilUser->isCaptchaVerified() && ilCaptchaUtil::isActiveForForum()) {
         require_once 'Services/Captcha/classes/class.ilCaptchaInputGUI.php';
         $captcha = new ilCaptchaInputGUI($this->lng->txt('cont_captcha_code'), 'captcha_code');
         $captcha->setRequired(true);
         $this->create_topic_form_gui->addItem($captcha);
     }
     $this->create_topic_form_gui->addCommandButton('addThread', $this->lng->txt('create'));
     $this->create_topic_form_gui->addCommandButton('showThreads', $this->lng->txt('cancel'));
 }
 /**
  * Show user's addressbook
  */
 public function showAddressbook()
 {
     global $rbacsystem, $lng, $ilUser, $ilCtrl, $ilias;
     $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_addressbook.html", "Services/Contact");
     // check if current user may send mails
     include_once "Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail($_SESSION["AccountId"]);
     $mailing_allowed = $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
     // searchbox
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $searchform = new ilPropertyFormGUI();
     $searchform->setFormAction($this->ctrl->getFormAction($this, "saveEntry"));
     $dsDataLink = $ilCtrl->getLinkTarget($this, 'lookupAddressbookAsync', '', true, false);
     $inp = new ilTextInputGUI($this->lng->txt('search_for'), 'search_qry');
     $inp->setDataSource($dsDataLink);
     $searchform->addItem($inp);
     $searchform->addCommandButton('search', $this->lng->txt("send"));
     $this->tpl->setVariable('SEARCHFORM', $searchform->getHtml());
     $this->tpl->setVariable('ACTION', $this->ctrl->getFormAction($this, "saveEntry"));
     $this->tpl->setVariable("TXT_SEARCH_FOR", $this->lng->txt("search_for"));
     $this->tpl->setVariable("BUTTON_SEARCH", $this->lng->txt("send"));
     if (strlen(trim($_SESSION["addr_search"])) > 0) {
         $this->tpl->setVariable("VALUE_SEARCH_FOR", ilUtil::prepareFormOutput(trim($_SESSION["addr_search"]), true));
     }
     $tbl = new ilAddressbookTableGUI($this);
     $tbl->setTitle($lng->txt("mail_addr_entries"));
     $tbl->setRowTemplate("tpl.mail_addressbook_row.html", "Services/Contact");
     $tbl->setDefaultOrderField('login');
     $result = array();
     $this->abook->setSearchQuery($_SESSION['addr_search']);
     $entries = $this->abook->getEntries();
     $tbl->addColumn('', 'check', '10%', true);
     $tbl->addColumn($this->lng->txt('login'), 'login', '20%');
     $tbl->addColumn($this->lng->txt('firstname'), 'firstname', '20%');
     $tbl->addColumn($this->lng->txt('lastname'), 'lastname', '20%');
     $tbl->addColumn($this->lng->txt('email'), 'email', '20%');
     $tbl->addColumn($this->lng->txt('actions'), '', '10%');
     include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     if (count($entries)) {
         $tbl->enable('select_all');
         $tbl->setSelectAllCheckbox('addr_id');
         $chatSettings = new ilSetting('chatroom');
         $chat_active = $chatSettings->get("chat_enabled", false);
         $counter = 0;
         foreach ($entries as $entry) {
             $result[$counter]['check'] = ilUtil::formCheckbox(0, 'addr_id[]', $entry["addr_id"]);
             $this->ctrl->setParameter($this, 'addr_id', $entry['addr_id']);
             $result[$counter]['login'] = '';
             if ($entry["login"] != "") {
                 if ($mailing_allowed) {
                     $result[$counter]['login_linked_link'] = $this->ctrl->getLinkTarget($this, 'mailToUsers');
                     $result[$counter]['login'] = $result[$counter]['login_linked_login'] = $entry["login"];
                 } else {
                     $result[$counter]['login'] = $result[$counter]['login_unliked'] = $entry["login"];
                 }
             }
             $result[$counter]['firstname'] = $entry["firstname"];
             $result[$counter]['lastname'] = $entry["lastname"];
             if ($_GET["baseClass"] == "ilMailGUI" && $rbacsystem->checkAccess("smtp_mail", $this->umail->getMailObjectReferenceId())) {
                 $result[$counter]['email'] = $result[$counter]['email_linked_email'] = $entry["email"];
                 $result[$counter]['email_linked_link'] = $this->ctrl->getLinkTarget($this, "mailToUsers");
             } else {
                 $result[$counter]['email'] = $result[$counter]['email_unlinked'] = $entry["email"];
             }
             $current_selection_list = new ilAdvancedSelectionListGUI();
             $current_selection_list->setListTitle($this->lng->txt("actions"));
             $current_selection_list->setId("act_" . $counter);
             $current_selection_list->addItem($this->lng->txt("edit"), '', $this->ctrl->getLinkTarget($this, "showAddressForm"));
             if ($mailing_allowed) {
                 $current_selection_list->addItem($this->lng->txt("send_mail_to"), '', $this->ctrl->getLinkTarget($this, "mailToUsers"));
             }
             $current_selection_list->addItem($this->lng->txt("delete"), '', $this->ctrl->getLinkTarget($this, "confirmDelete"));
             if ($chat_active) {
                 $current_selection_list->addItem($this->lng->txt("invite_to_chat"), '', $this->ctrl->getLinkTarget($this, "inviteToChat"));
             }
             $this->ctrl->clearParameters($this);
             $result[$counter]['COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
             ++$counter;
         }
         if ($mailing_allowed) {
             $tbl->addMultiCommand('mailToUsers', $this->lng->txt('send_mail_to'));
         }
         $tbl->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
         if ($chat_active) {
             $tbl->addMultiCommand('inviteToChat', $this->lng->txt('invite_to_chat'));
         }
     } else {
         $tbl->disable('header');
         $tbl->disable('footer');
         $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
     }
     $tbl->setData($result);
     $tbl->addCommandButton('showAddressForm', $this->lng->txt('add'));
     $this->tpl->setVariable('TABLE', $tbl->getHTML());
     $this->tpl->show();
     unset($_SESSION['addr_search']);
     return true;
 }
Example #12
0
 /**
  * Get tabs
  */
 function getTabs(&$tabs_gui)
 {
     global $rbacsystem, $ilAccess, $ilUser, $lng, $ilHelp;
     $ilHelp->setScreenIdComponent("crs");
     $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
     if ($ilAccess->checkAccess('read', '', $this->ref_id)) {
         $tabs_gui->addTab('view_content', $lng->txt("content"), $this->ctrl->getLinkTarget($this, ''));
     }
     // learning objectives
     if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
         include_once './Modules/Course/classes/class.ilCourseObjective.php';
         if ($this->object->getViewMode() == IL_CRS_VIEW_OBJECTIVE or ilCourseObjective::_getCountObjectives($this->object->getId())) {
             $tabs_gui->addTarget('crs_objectives', $this->ctrl->getLinkTargetByClass('illoeditorgui', ''), 'illoeditorgui');
         }
     }
     if ($ilAccess->checkAccess('visible', '', $this->ref_id)) {
         //$next_class = $this->ctrl->getNextClass($this);
         // this is not nice. tabs should be displayed in ilcoursegui
         // not via ilrepositorygui, then next_class == ilinfoscreengui
         // could be checked
         $force_active = strtolower($_GET["cmdClass"]) == "ilinfoscreengui" || strtolower($_GET["cmdClass"]) == "ilnotegui" ? true : false;
         $tabs_gui->addTarget("info_short", $this->ctrl->getLinkTargetByClass(array("ilobjcoursegui", "ilinfoscreengui"), "showSummary"), "infoScreen", "", "", $force_active);
     }
     if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
         $force_active = strtolower($_GET["cmdClass"]) == "ilconditionhandlergui" && $_GET["item_id"] == "" ? true : false;
         $tabs_gui->addTarget("settings", $this->ctrl->getLinkTarget($this, "edit"), array("edit", "editMapSettings", "editCourseIcons", "listStructure"), "", "", $force_active);
     }
     $is_participant = ilCourseParticipants::_isParticipant($this->ref_id, $ilUser->getId());
     include_once './Services/Mail/classes/class.ilMail.php';
     $mail = new ilMail($GLOBALS['ilUser']->getId());
     // member list
     if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
         $tabs_gui->addTarget("members", $this->ctrl->getLinkTarget($this, "members"), "members", get_class($this));
     } elseif ($this->object->getShowMembers() == $this->object->SHOW_MEMBERS_ENABLED and $is_participant) {
         $tabs_gui->addTarget("members", $this->ctrl->getLinkTarget($this, "membersGallery"), "members", get_class($this));
     } elseif ($this->object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL and $GLOBALS['rbacsystem']->checkAccess('internal_mail', $mail->getMailObjectReferenceId()) and $is_participant) {
         $tabs_gui->addTarget("members", $this->ctrl->getLinkTarget($this, "mailMembers"), "members", get_class($this));
     }
     // learning progress
     include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
     if (ilLearningProgressAccess::checkAccess($this->object->getRefId(), $is_participant)) {
         $tabs_gui->addTarget('learning_progress', $this->ctrl->getLinkTargetByClass(array('ilobjcoursegui', 'illearningprogressgui'), ''), '', array('illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui'));
     }
     // license overview
     include_once "Services/License/classes/class.ilLicenseAccess.php";
     if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id) and ilLicenseAccess::_isEnabled()) {
         $tabs_gui->addTarget("licenses", $this->ctrl->getLinkTargetByClass('illicenseoverviewgui', ''), "", "illicenseoverviewgui");
     }
     // lom meta data
     if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
         $tabs_gui->addTarget("meta_data", $this->ctrl->getLinkTargetByClass(array('ilobjcoursegui', 'ilmdeditorgui'), 'listSection'), "", "ilmdeditorgui");
     }
     if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
         $tabs_gui->addTarget('export', $this->ctrl->getLinkTargetByClass('ilexportgui', ''), 'export', 'ilexportgui');
     }
     if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id)) {
         $tabs_gui->addTarget("perm_settings", $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), "perm"), array("perm", "info", "owner"), 'ilpermissiongui');
     }
     if ($this->ctrl->getTargetScript() == "adm_object.php") {
         $tabs_gui->addTarget("show_owner", $this->ctrl->getLinkTarget($this, "owner"), "owner", get_class($this));
         if ($this->tree->getSavedNodeData($this->ref_id)) {
             $tabs_gui->addTarget("trash", $this->ctrl->getLinkTarget($this, "trash"), "trash", get_class($this));
         }
     }
     // Join/Leave
     if ($ilAccess->checkAccess('join', '', $this->ref_id) and !$this->object->getMemberObject()->isAssigned()) {
         include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
         if (ilCourseWaitingList::_isOnList($ilUser->getId(), $this->object->getId())) {
             $tabs_gui->addTab('leave', $this->lng->txt('membership_leave'), $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', 'show', ''));
         } else {
             $tabs_gui->addTarget("join", $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', "show"), 'show', "");
         }
     }
     if ($ilAccess->checkAccess('leave', '', $this->object->getRefId()) and $this->object->getMemberObject()->isMember()) {
         $tabs_gui->addTarget("crs_unsubscribe", $this->ctrl->getLinkTarget($this, "unsubscribe"), 'leave', "");
     }
 }
 /**
  * Constructor
  *
  * @access public
  * @param object	parent object
  * @param string	type; valid values are 'crs' for courses and
  *			and 'grp' for groups
  * 
  */
 public function __construct($a_parent_obj, $type = 'crs', $context = 'mail')
 {
     global $lng, $ilCtrl, $ilUser, $lng, $rbacsystem;
     $this->context = $context;
     if ($this->context == "mail") {
         // check if current user may send mails
         include_once "Services/Mail/classes/class.ilMail.php";
         $mail = new ilMail($_SESSION["AccountId"]);
         $this->mailing_allowed = $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId());
     }
     parent::__construct($a_parent_obj, 'showMembers');
     $lng->loadLanguageModule('crs');
     $this->parentObject = $a_parent_obj;
     $mode = array();
     if ($type == 'crs') {
         $mode["checkbox"] = 'search_crs';
         $mode["short"] = 'crs';
         $mode["long"] = 'course';
         $mode["lng_type"] = $lng->txt('course');
         $mode["view"] = "crs_members";
         $mode["tableprefix"] = "crstable_members";
     } else {
         if ($type == 'grp') {
             $mode["checkbox"] = 'search_grp';
             $mode["short"] = 'grp';
             $mode["long"] = 'group';
             $mode["lng_type"] = $lng->txt('group');
             $mode["view"] = "grp_members";
             $mode["tableprefix"] = "grptable_members";
         }
     }
     $this->setTitle($lng->txt('members'));
     $this->mode = $mode;
     $ilCtrl->setParameter($a_parent_obj, 'view', $mode['view']);
     if ($_GET['ref'] != '') {
         $ilCtrl->setParameter($a_parent_obj, 'ref', $_GET['ref']);
     }
     if (is_array($_POST[$mode["checkbox"]])) {
         $ilCtrl->setParameter($a_parent_obj, $mode["checkbox"], implode(',', $_POST[$mode["checkbox"]]));
     }
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $ilCtrl->clearParameters($a_parent_obj);
     $this->setPrefix($mode['tableprefix']);
     $this->setSelectAllCheckbox('search_members[]');
     $this->setRowTemplate('tpl.mail_search_courses_members_row.html', 'Services/Contact');
     // setup columns
     $this->addColumn('', '', '1%', true);
     $this->addColumn($lng->txt('login'), 'members_login', '22%');
     $this->addColumn($lng->txt('name'), 'members_name', '22%');
     $this->addColumn($lng->txt($mode['long']), 'members_crs_grp', '22%');
     $this->addColumn($lng->txt('mail_in_addressbook'), 'members_in_addressbook', '23%');
     $this->addColumn($lng->txt('actions'), '', '10%');
     if ($this->context == "mail") {
         if ($this->mailing_allowed) {
             $this->addMultiCommand('mail', $lng->txt('mail_members'));
         }
         $this->addMultiCommand('adoptMembers', $lng->txt("mail_into_addressbook"));
     } else {
         $lng->loadLanguageModule("wsp");
         $this->addMultiCommand('share', $lng->txt("wsp_share_with_members"));
     }
     $this->addCommandButton('cancel', $lng->txt('cancel'));
 }
Example #14
0
 /**
  * add Mail to Member button to toolbar
  *
  * @param ilToolbarGUI $ilToolbar
  * @param string $back_cmd
  * @param bool $a_separator
  */
 protected function addMailToMemberButton($ilToolbar, $back_cmd = null, $a_separator = false)
 {
     global $ilAccess, $ilUser, $rbacsystem;
     include_once 'Services/Mail/classes/class.ilMail.php';
     $mail = new ilMail($ilUser->getId());
     if (($ilAccess->checkAccess('write', '', $this->object->getRefId()) or $this->object->getMailToMembersType() == ilObjGroup::MAIL_ALLOWED_ALL) and $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
         if ($a_separator) {
             $ilToolbar->addSeparator();
         }
         if ($back_cmd) {
             $this->ctrl->setParameter($this, "back_cmd", $back_cmd);
         }
         $ilToolbar->addButton($this->lng->txt("mail_members"), $this->ctrl->getLinkTarget($this, 'mailMembers'));
     }
 }