5 require_once
"Services/Table/classes/class.ilTable2GUI.php";
6 require_once
"Services/Contact/classes/class.ilMailingLists.php";
7 require_once
"Services/Mail/classes/class.ilFormatMail.php";
65 $this->tpl = $DIC[
'tpl'];
66 $this->ctrl = $DIC[
'ilCtrl'];
67 $this->lng = $DIC[
'lng'];
68 $this->rbacsystem = $DIC[
'rbacsystem'];
69 $this->
user = $DIC[
'ilUser'];
70 $this->error = $DIC[
'ilErr'];
71 $this->toolbar = $DIC[
'ilToolbar'];
72 $this->tabs = $DIC[
'ilTabs'];
76 $this->mlists->setCurrentMailingList(
$_GET[
'ml_id']);
78 $this->ctrl->saveParameter($this,
'mobj_id');
79 $this->ctrl->saveParameter($this,
'ref');
84 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
89 $this->error->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->error->MESSAGE);
92 $forward_class = $this->ctrl->getNextClass($this);
93 switch ($forward_class) {
95 if (!($cmd = $this->ctrl->getCmd())) {
96 $cmd =
'showMailingLists';
114 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
117 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDelete'));
118 $c_gui->setHeaderText($this->lng->txt(
'mail_sure_delete_entry'));
119 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showMailingLists');
120 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDelete');
122 $entries = $this->mlists->getSelected($ml_ids);
123 foreach ($entries as $entry) {
124 $c_gui->addItem(
'ml_id[]', $entry->getId(), $entry->getTitle());
127 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
128 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_list.html',
'Services/Contact');
129 $this->tpl->setVariable(
'DELETE_CONFIRMATION', $c_gui->getHTML());
138 if (is_array(
$_POST[
'ml_id'])) {
141 if (ilMailingList::_isOwner($id, $this->
user->getId())) {
162 include_once
"Services/Mail/classes/class.ilMail.php";
164 $mailing_allowed = $this->rbacsystem->checkAccess(
'internal_mail', $mail->getMailObjectReferenceId());
166 if (!$mailing_allowed) {
178 $mail_data = $this->umail->getSavedData();
179 if (!is_array($mail_data)) {
180 $this->umail->savePostData($this->
user->getId(),
array(),
'',
'',
'',
'',
'',
'',
'',
'');
184 foreach ($ml_ids as
$id) {
185 if (ilMailingList::_isOwner($id, $this->
user->getId()) &&
186 !$this->umail->existsRecipient(
'#il_ml_' . $id, $mail_data[
'rcp_to'])) {
187 $lists[] =
'#il_ml_' .
$id;
192 $mail_data = $this->umail->appendSearchResult($lists,
'to');
193 $this->umail->savePostData(
194 $mail_data[
'user_id'],
195 $mail_data[
'attachments'],
196 $mail_data[
'rcp_to'],
197 $mail_data[
'rcp_cc'],
198 $mail_data[
'rcp_bcc'],
199 $mail_data[
'm_type'],
200 $mail_data[
'm_email'],
201 $mail_data[
'm_subject'],
202 $mail_data[
'm_message'],
203 $mail_data[
'use_placeholders'],
204 $mail_data[
'tpl_ctx_id'],
205 $mail_data[
'tpl_ctx_params']
216 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
217 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_list.html',
'Services/Contact');
220 include_once
"Services/Mail/classes/class.ilMail.php";
222 $mailing_allowed = $this->rbacsystem->checkAccess(
'internal_mail', $mail->getMailObjectReferenceId());
224 require_once
'Services/Contact/classes/class.ilMailingListsTableGUI.php';
227 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
229 $create_btn->setCaption(
'create');
230 $create_btn->setUrl($this->ctrl->getLinkTarget($this,
'showForm'));
231 $this->toolbar->addButtonInstance($create_btn);
234 $entries = $this->mlists->getAll();
235 if (count($entries)) {
236 $tbl->enable(
'select_all');
238 require_once
'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
240 foreach ($entries as $entry) {
246 $result[
$counter][
'title'] = $entry->getTitle() .
" [#il_ml_" . $entry->getId() .
"]";
247 $result[
$counter][
'description'] = $entry->getDescription();
248 $result[
$counter][
'members'] = count($entry->getAssignedEntries());
250 $this->ctrl->setParameter($this,
'ml_id', $entry->getId());
253 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
254 $current_selection_list->setId(
"act_" .
$counter);
256 $current_selection_list->addItem($this->lng->txt(
"edit"),
'', $this->ctrl->getLinkTarget($this,
"showForm"));
257 $current_selection_list->addItem($this->lng->txt(
"members"),
'', $this->ctrl->getLinkTarget($this,
"showMembersList"));
258 if ($mailing_allowed) {
259 $current_selection_list->addItem($this->lng->txt(
"send_mail_to"),
'', $this->ctrl->getLinkTarget($this,
"mailToList"));
261 $current_selection_list->addItem($this->lng->txt(
"delete"),
'', $this->ctrl->getLinkTarget($this,
"confirmDelete"));
263 $result[
$counter][
'COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
267 if ($mailing_allowed) {
268 $tbl->addMultiCommand(
'mailToList', $this->lng->txt(
'send_mail_to'));
270 $tbl->addMultiCommand(
'confirmDelete', $this->lng->txt(
'delete'));
272 $tbl->disable(
'header');
273 $tbl->disable(
'footer');
278 if (isset(
$_GET[
'ref']) &&
$_GET[
'ref'] ==
'mail') {
279 $tbl->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
282 $this->tpl->setVariable(
'MAILING_LISTS',
$tbl->getHTML());
292 if (isset(
$_GET[
'ref']) &&
$_GET[
'ref'] ==
'mail') {
293 $this->ctrl->returnToParent($this);
301 if ($this->mlists->getCurrentMailingList()->getId()) {
302 if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId())) {
303 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
306 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
312 if ($this->form_gui->checkInput()) {
313 $this->mlists->getCurrentMailingList()->setTitle(
$_POST[
'title']);
314 $this->mlists->getCurrentMailingList()->setDescription(
$_POST[
'description']);
315 if ($this->mlists->getCurrentMailingList()->getId()) {
316 $this->mlists->getCurrentMailingList()->setChangedate(
date(
'Y-m-d H:i:s',
time()));
317 $this->mlists->getCurrentMailingList()->update();
320 $this->mlists->getCurrentMailingList()->setCreatedate(
date(
'Y-m-d H:i:s',
time()));
321 $this->mlists->getCurrentMailingList()->insert();
322 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
323 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'saveForm'));
325 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
326 $this->ctrl->redirect($this,
'showMembersList');
332 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
333 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_form.html',
'Services/Contact');
335 $this->form_gui->setValuesByPost();
337 $this->tpl->setVariable(
'FORM', $this->form_gui->getHTML());
338 return $this->tpl->show();
343 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
346 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'saveForm'));
347 $this->form_gui->setTitle($this->lng->txt(
'mail_mailing_list'));
349 $titleGui =
new ilTextInputGUI($this->lng->txt(
'title'),
'title');
351 $this->form_gui->addItem($titleGui);
353 $descriptionGui =
new ilTextAreaInputGUI($this->lng->txt(
'description'),
'description');
355 $descriptionGui->setRows(8);
356 $this->form_gui->addItem($descriptionGui);
358 $this->form_gui->addCommandButton(
'saveForm', $this->lng->txt(
'save'));
359 $this->form_gui->addCommandButton(
'showMailingLists', $this->lng->txt(
'cancel'));
364 $this->form_gui->setValuesByArray(
array(
365 'title' => $this->mlists->getCurrentMailingList()->getTitle(),
366 'description' => $this->mlists->getCurrentMailingList()->getDescription()
372 $this->form_gui->setValuesByArray(
array(
380 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
381 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_form.html',
'Services/Contact');
383 if ($this->mlists->getCurrentMailingList()->getId()) {
384 if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId())) {
385 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
388 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
396 $this->tpl->setVariable(
'FORM', $this->form_gui->getHTML());
397 return $this->tpl->show();
402 if (!$this->mlists->getCurrentMailingList()->getId()) {
407 $this->ctrl->setParameter($this,
'cmd',
'post');
408 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
410 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
411 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_members.html',
'Services/Contact');
413 require_once
'Services/Contact/classes/class.ilMailingListsMembersTableGUI.php';
417 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
419 $create_btn->setCaption(
'add');
420 $create_btn->setUrl($this->ctrl->getLinkTarget($this,
'showAssignmentForm'));
421 $this->toolbar->addButtonInstance($create_btn);
423 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
424 if (count($assigned_entries)) {
425 $tbl->enable(
'select_all');
426 $tbl->setSelectAllCheckbox(
'a_id');
429 foreach ($assigned_entries as $entry) {
430 $usr_ids[] = $entry[
'usr_id'];
433 require_once
'Services/User/classes/class.ilUserUtil.php';
437 foreach ($assigned_entries as $entry) {
443 $tbl->addMultiCommand(
'confirmDeleteMembers', $this->lng->txt(
'delete'));
445 $tbl->disable(
'header');
446 $tbl->disable(
'footer');
448 $tbl->setNoEntriesText($this->lng->txt(
'mail_search_no'));
451 $tbl->setData($result);
453 $this->tpl->setVariable(
'MEMBERS_LIST',
$tbl->getHTML());
460 if (!isset(
$_POST[
'a_id'])) {
466 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
468 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
469 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDeleteMembers'));
470 $c_gui->setHeaderText($this->lng->txt(
'mail_sure_delete_entry'));
471 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showMembersList');
472 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteMembers');
474 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
477 foreach ($assigned_entries as $entry) {
478 $usr_ids[] = $entry[
'usr_id'];
481 require_once
'Services/User/classes/class.ilUserUtil.php';
484 foreach ($assigned_entries as $entry) {
485 if (in_array($entry[
'a_id'],
$_POST[
'a_id'])) {
486 $c_gui->addItem(
'a_id[]', $entry[
'a_id'],
$names[$entry[
'usr_id']]);
490 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
491 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_members.html',
'Services/Contact');
492 $this->tpl->setVariable(
'DELETE_CONFIRMATION', $c_gui->getHTML());
500 if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId())) {
501 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
504 if (is_array(
$_POST[
'a_id'])) {
505 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
507 if (isset($assigned_entries[$id])) {
508 $this->mlists->getCurrentMailingList()->deleteEntry((
int) $id);
524 protected function getAssignmentForm()
526 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
528 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
529 $form->setFormAction($this->ctrl->getFormAction($this,
'saveAssignmentForm'));
530 $form->setTitle($this->lng->txt(
'mail_assign_entry_to_mailing_list') .
' ' . $this->mlists->getCurrentMailingList()->getTitle());
533 $options[
''] = $this->lng->txt(
'please_select');
535 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
536 require_once
'Services/User/classes/class.ilUserUtil.php';
539 foreach ($relations as $relation) {
543 $options[$relation->getBuddyUserId()] =
$names[$relation->getBuddyUserId()];
546 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
547 if (count($assigned_entries)) {
548 foreach ($assigned_entries as $assigned_entry) {
549 if (is_array(
$options) && array_key_exists($assigned_entry[
'usr_id'],
$options)) {
550 unset(
$options[$assigned_entry[
'usr_id']]);
556 $formItem =
new ilSelectInputGUI($this->lng->txt(
'mail_entry_of_contacts'),
'usr_id');
559 $form->addItem($formItem);
561 $form->addCommandButton(
'saveAssignmentForm', $this->lng->txt(
'assign'));
562 } elseif (count(
$options) == 1 && count($relations)) {
563 ilUtil::sendInfo($this->lng->txt(
'mail_mailing_lists_all_contact_entries_assigned'));
564 } elseif (count($relations) == 0) {
567 $form->addCommandButton(
'showMembersList', $this->lng->txt(
'cancel'));
577 if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId())) {
578 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
581 $form = $this->getAssignmentForm();
582 if (!
$form->checkInput()) {
583 $form->setValuesByPost();
588 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
590 $this->mlists->getCurrentMailingList()->assignUser((
int) $_POST[
'usr_id']);
606 if (!$this->mlists->getCurrentMailingList()->getId()) {
611 if (!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId())) {
612 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
615 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
616 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_members_form.html',
'Services/Contact');
619 $form = $this->getAssignmentForm();
622 $this->tpl->setVariable(
'FORM',
$form->getHTML());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getInstanceByGlobalUser()
if(!array_key_exists('StateId', $_REQUEST)) $id
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_POST['submit'])) $form
This class handles base functions for mail handling.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
This class represents a text property in a property form.
setCols($a_cols)
Set Cols.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
showAssignmentForm(ilPropertyFormGUI $form=null)
User interface class for advanced drop-down selection lists.
This class represents a text area property in a property form.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static redirect($a_script)
initForm($a_type='create')
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Confirmation screen class.