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";
39 $this->mlists->setCurrentMailingList(
$_GET[
'ml_id']);
41 $this->ctrl->saveParameter($this,
'mobj_id');
42 $this->ctrl->saveParameter($this,
'ref');
47 $forward_class = $this->ctrl->getNextClass($this);
48 switch ($forward_class)
51 if (!(
$cmd = $this->ctrl->getCmd()))
53 $cmd =
'showMailingLists';
72 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
75 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDelete'));
76 $c_gui->setHeaderText($this->lng->txt(
'mail_sure_delete_entry'));
77 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showMailingLists');
78 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDelete');
80 $entries = $this->mlists->getSelected($ml_ids);
81 foreach($entries as $entry)
83 $c_gui->addItem(
'ml_id[]', $entry->getId(), $entry->getTitle());
86 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
87 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_list.html',
'Services/Contact');
88 $this->tpl->setVariable(
'DELETE_CONFIRMATION', $c_gui->getHTML());
99 if (is_array(
$_POST[
'ml_id']))
102 foreach (
$_POST[
'ml_id'] as $id)
128 include_once
"Services/Mail/classes/class.ilMail.php";
130 $mailing_allowed = $rbacsystem->checkAccess(
'internal_mail',$mail->getMailObjectReferenceId());
132 if (!$mailing_allowed)
146 $mail_data = $this->umail->getSavedData();
147 if(!is_array($mail_data))
149 $this->umail->savePostData($ilUser->getId(), array(),
'',
'',
'',
'',
'',
'',
'',
'');
153 foreach($ml_ids as $id)
156 !$this->umail->doesRecipientStillExists(
'#il_ml_'.$id, $mail_data[
'rcp_to']))
158 $lists[] =
'#il_ml_'.$id;
164 $mail_data = $this->umail->appendSearchResult($lists,
'to');
165 $this->umail->savePostData(
166 $mail_data[
'user_id'],
167 $mail_data[
'attachments'],
168 $mail_data[
'rcp_to'],
169 $mail_data[
'rcp_cc'],
170 $mail_data[
'rcp_bcc'],
171 $mail_data[
'm_type'],
172 $mail_data[
'm_email'],
173 $mail_data[
'm_subject'],
174 $mail_data[
'm_message'],
175 $mail_data[
'use_placeholders'],
176 $mail_data[
'tpl_ctx_id'],
177 $mail_data[
'tpl_ctx_params']
190 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
191 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_list.html',
'Services/Contact');
194 include_once
"Services/Mail/classes/class.ilMail.php";
196 $mailing_allowed = $rbacsystem->checkAccess(
'internal_mail',$mail->getMailObjectReferenceId());
198 require_once
'Services/Contact/classes/class.ilMailingListsTableGUI.php';
202 $entries = $this->mlists->getAll();
205 $tbl->enable(
'select_all');
207 require_once
'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
209 foreach($entries as $entry)
217 $result[$counter][
'title'] = $entry->getTitle() .
" [#il_ml_" . $entry->getId() .
"]";
218 $result[$counter][
'description'] = $entry->getDescription();
219 $result[$counter][
'members'] = count($entry->getAssignedEntries());
221 $this->ctrl->setParameter($this,
'ml_id', $entry->getId());
224 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
225 $current_selection_list->setId(
"act_".$counter);
227 $current_selection_list->addItem($this->lng->txt(
"edit"),
'', $this->ctrl->getLinkTarget($this,
"showForm"));
228 $current_selection_list->addItem($this->lng->txt(
"members"),
'', $this->ctrl->getLinkTarget($this,
"showMembersList"));
231 $current_selection_list->addItem($this->lng->txt(
"send_mail_to"),
'', $this->ctrl->getLinkTarget($this,
"mailToList"));
233 $current_selection_list->addItem($this->lng->txt(
"delete"),
'', $this->ctrl->getLinkTarget($this,
"confirmDelete"));
235 $result[$counter][
'COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
241 $tbl->addMultiCommand(
'mailToList', $this->lng->txt(
'send_mail_to'));
243 $tbl->addMultiCommand(
'confirmDelete', $this->lng->txt(
'delete'));
247 $tbl->disable(
'header');
248 $tbl->disable(
'footer');
253 if(isset(
$_GET[
'ref']) &&
$_GET[
'ref'] ==
'mail')
255 $tbl->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
258 $this->tpl->setVariable(
'MAILING_LISTS',
$tbl->getHTML());
268 if(isset(
$_GET[
'ref']) &&
$_GET[
'ref'] ==
'mail')
270 $this->ctrl->returnToParent($this);
280 if($this->mlists->getCurrentMailingList()->getId())
286 $ilErr->raiseError($this->lng->txt(
'permission_denied'), $ilErr->MESSAGE);
289 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
297 if($this->form_gui->checkInput())
299 $this->mlists->getCurrentMailingList()->setTitle(
$_POST[
'title']);
300 $this->mlists->getCurrentMailingList()->setDescription(
$_POST[
'description']);
301 if($this->mlists->getCurrentMailingList()->getId())
303 $this->mlists->getCurrentMailingList()->setChangedate(date(
'Y-m-d H:i:s', time()));
304 $this->mlists->getCurrentMailingList()->update();
309 $this->mlists->getCurrentMailingList()->setCreatedate(date(
'Y-m-d H:i:s', time()));
310 $this->mlists->getCurrentMailingList()->insert();
311 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
312 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'saveForm'));
314 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
315 $this->ctrl->redirect($this,
'showMembersList');
321 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
322 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_form.html',
'Services/Contact');
324 $this->form_gui->setValuesByPost();
326 $this->tpl->setVariable(
'FORM', $this->form_gui->getHTML());
327 return $this->tpl->show();
332 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
335 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'saveForm'));
336 $this->form_gui->setTitle($this->lng->txt(
'mail_mailing_list'));
338 $titleGui =
new ilTextInputGUI($this->lng->txt(
'title'),
'title');
340 $this->form_gui->addItem($titleGui);
342 $descriptionGui =
new ilTextAreaInputGUI($this->lng->txt(
'description'),
'description');
344 $descriptionGui->setRows(8);
345 $this->form_gui->addItem($descriptionGui);
347 $this->form_gui->addCommandButton(
'saveForm',$this->lng->txt(
'save'));
348 $this->form_gui->addCommandButton(
'showMailingLists',$this->lng->txt(
'cancel'));
353 $this->form_gui->setValuesByArray(array(
354 'title' => $this->mlists->getCurrentMailingList()->getTitle(),
355 'description' => $this->mlists->getCurrentMailingList()->getDescription()
361 $this->form_gui->setValuesByArray(array(
371 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
372 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_form.html',
'Services/Contact');
374 if($this->mlists->getCurrentMailingList()->getId())
378 $ilErr->raiseError($this->lng->txt(
'permission_denied'), $ilErr->MESSAGE);
381 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
391 $this->tpl->setVariable(
'FORM', $this->form_gui->getHTML());
392 return $this->tpl->show();
397 if(!$this->mlists->getCurrentMailingList()->getId())
403 $this->ctrl->setParameter($this,
'cmd',
'post');
404 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
406 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
407 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_members.html',
'Services/Contact');
409 require_once
'Services/Contact/classes/class.ilMailingListsMembersTableGUI.php';
413 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
414 if(count($assigned_entries))
416 $tbl->enable(
'select_all');
417 $tbl->setSelectAllCheckbox(
'a_id');
420 foreach($assigned_entries as $entry)
422 $usr_ids[] = $entry[
'usr_id'];
425 require_once
'Services/User/classes/class.ilUserUtil.php';
429 foreach($assigned_entries as $entry)
432 $result[$counter][
'user'] = $names[$entry[
'usr_id']];
436 $tbl->addMultiCommand(
'confirmDeleteMembers', $this->lng->txt(
'delete'));
440 $tbl->disable(
'header');
441 $tbl->disable(
'footer');
443 $tbl->setNoEntriesText($this->lng->txt(
'mail_search_no'));
446 $tbl->setData($result);
448 $this->tpl->setVariable(
'MEMBERS_LIST',
$tbl->getHTML());
455 if(!isset(
$_POST[
'a_id']))
462 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
464 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
465 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDeleteMembers'));
466 $c_gui->setHeaderText($this->lng->txt(
'mail_sure_delete_entry'));
467 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showMembersList');
468 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteMembers');
470 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
473 foreach($assigned_entries as $entry)
475 $usr_ids[] = $entry[
'usr_id'];
478 require_once
'Services/User/classes/class.ilUserUtil.php';
481 foreach($assigned_entries as $entry)
483 if(in_array($entry[
'a_id'],
$_POST[
'a_id']))
485 $c_gui->addItem(
'a_id[]', $entry[
'a_id'], $names[$entry[
'usr_id']]);
489 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
490 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_members.html',
'Services/Contact');
491 $this->tpl->setVariable(
'DELETE_CONFIRMATION', $c_gui->getHTML());
503 $ilErr->raiseError($this->lng->txt(
'permission_denied'), $ilErr->MESSAGE);
506 if(is_array(
$_POST[
'a_id']))
508 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
509 foreach(
$_POST[
'a_id'] as $id)
511 if(isset($assigned_entries[$id]))
513 $this->mlists->getCurrentMailingList()->deleteEntry((
int)$id);
530 protected function getAssignmentForm()
532 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
534 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
535 $form->setFormAction($this->ctrl->getFormAction($this,
'saveAssignmentForm'));
536 $form->setTitle($this->lng->txt(
'mail_assign_entry_to_mailing_list') .
' ' . $this->mlists->getCurrentMailingList()->getTitle());
539 $options[
''] = $this->lng->txt(
'please_select');
541 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
542 require_once
'Services/User/classes/class.ilUserUtil.php';
543 $relations = ilBuddyList::getInstanceByGlobalUser()->getLinkedRelations();
545 foreach($relations as $relation)
550 $options[$relation->getBuddyUserId()] = $names[$relation->getBuddyUserId()];
553 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
554 if(count($assigned_entries))
556 foreach($assigned_entries as $assigned_entry)
558 if(is_array(
$options) && array_key_exists($assigned_entry[
'usr_id'],
$options))
560 unset(
$options[$assigned_entry[
'usr_id']]);
567 $formItem =
new ilSelectInputGUI($this->lng->txt(
'mail_entry_of_contacts'),
'usr_id');
570 $form->addItem($formItem);
572 $form->addCommandButton(
'saveAssignmentForm', $this->lng->txt(
'assign'));
574 else if(count(
$options) == 1 && count($relations))
576 ilUtil::sendInfo($this->lng->txt(
'mail_mailing_lists_all_contact_entries_assigned'));
578 else if(count($relations) == 0)
582 $form->addCommandButton(
'showMembersList', $this->lng->txt(
'cancel'));
596 $ilErr->raiseError($this->lng->txt(
'permission_denied'), $ilErr->MESSAGE);
599 $form = $this->getAssignmentForm();
600 if(!$form->checkInput())
602 $form->setValuesByPost();
607 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
608 if(ilBuddyList::getInstanceByGlobalUser()->getRelationByUserId((
int)
$_POST[
'usr_id'])->isLinked())
610 $this->mlists->getCurrentMailingList()->assignUser((
int)$_POST[
'usr_id']);
628 if(!$this->mlists->getCurrentMailingList()->getId())
636 $ilErr->raiseError($this->lng->txt(
'permission_denied'), $ilErr->MESSAGE);
639 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
640 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_members_form.html',
'Services/Contact');
644 $form = $this->getAssignmentForm();
647 $this->tpl->setVariable(
'FORM', $form->getHTML());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _isOwner($a_ml_id, $a_usr_id)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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)
Default behaviour is:
if(!is_array($argv)) $options
Class Mail this class handles base functions for mail handling.
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 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.
static redirect($a_script)
http redirect to other script
initForm($a_type='create')
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
Confirmation screen class.