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 $forward_class = $this->ctrl->getNextClass($this);
85 switch ($forward_class)
88 if (!(
$cmd = $this->ctrl->getCmd()))
90 $cmd =
'showMailingLists';
109 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
112 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDelete'));
113 $c_gui->setHeaderText($this->lng->txt(
'mail_sure_delete_entry'));
114 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showMailingLists');
115 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDelete');
117 $entries = $this->mlists->getSelected($ml_ids);
118 foreach($entries as $entry)
120 $c_gui->addItem(
'ml_id[]', $entry->getId(), $entry->getTitle());
123 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
124 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_list.html',
'Services/Contact');
125 $this->tpl->setVariable(
'DELETE_CONFIRMATION', $c_gui->getHTML());
134 if(is_array(
$_POST[
'ml_id']))
137 foreach(
$_POST[
'ml_id'] as $id)
139 if(ilMailingList::_isOwner($id, $this->
user->getId()))
164 include_once
"Services/Mail/classes/class.ilMail.php";
166 $mailing_allowed = $this->rbacsystem->checkAccess(
'internal_mail',$mail->getMailObjectReferenceId());
168 if (!$mailing_allowed)
182 $mail_data = $this->umail->getSavedData();
183 if(!is_array($mail_data))
185 $this->umail->savePostData($this->
user->getId(),
array(),
'',
'',
'',
'',
'',
'',
'',
'');
189 foreach($ml_ids as $id)
191 if(ilMailingList::_isOwner($id, $this->
user->getId()) &&
192 !$this->umail->existsRecipient(
'#il_ml_'.$id, $mail_data[
'rcp_to']))
194 $lists[] =
'#il_ml_'.$id;
200 $mail_data = $this->umail->appendSearchResult($lists,
'to');
201 $this->umail->savePostData(
202 $mail_data[
'user_id'],
203 $mail_data[
'attachments'],
204 $mail_data[
'rcp_to'],
205 $mail_data[
'rcp_cc'],
206 $mail_data[
'rcp_bcc'],
207 $mail_data[
'm_type'],
208 $mail_data[
'm_email'],
209 $mail_data[
'm_subject'],
210 $mail_data[
'm_message'],
211 $mail_data[
'use_placeholders'],
212 $mail_data[
'tpl_ctx_id'],
213 $mail_data[
'tpl_ctx_params']
224 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
225 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_list.html',
'Services/Contact');
228 include_once
"Services/Mail/classes/class.ilMail.php";
230 $mailing_allowed = $this->rbacsystem->checkAccess(
'internal_mail',$mail->getMailObjectReferenceId());
232 require_once
'Services/Contact/classes/class.ilMailingListsTableGUI.php';
235 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
237 $create_btn->setCaption(
'create');
238 $create_btn->setUrl($this->ctrl->getLinkTarget($this,
'showForm'));
239 $this->toolbar->addButtonInstance($create_btn);
242 $entries = $this->mlists->getAll();
245 $tbl->enable(
'select_all');
247 require_once
'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
249 foreach($entries as $entry)
257 $result[
$counter][
'title'] = $entry->getTitle() .
" [#il_ml_" . $entry->getId() .
"]";
258 $result[
$counter][
'description'] = $entry->getDescription();
259 $result[
$counter][
'members'] = count($entry->getAssignedEntries());
261 $this->ctrl->setParameter($this,
'ml_id', $entry->getId());
264 $current_selection_list->setListTitle($this->lng->txt(
"actions"));
265 $current_selection_list->setId(
"act_".
$counter);
267 $current_selection_list->addItem($this->lng->txt(
"edit"),
'', $this->ctrl->getLinkTarget($this,
"showForm"));
268 $current_selection_list->addItem($this->lng->txt(
"members"),
'', $this->ctrl->getLinkTarget($this,
"showMembersList"));
271 $current_selection_list->addItem($this->lng->txt(
"send_mail_to"),
'', $this->ctrl->getLinkTarget($this,
"mailToList"));
273 $current_selection_list->addItem($this->lng->txt(
"delete"),
'', $this->ctrl->getLinkTarget($this,
"confirmDelete"));
275 $result[
$counter][
'COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
281 $tbl->addMultiCommand(
'mailToList', $this->lng->txt(
'send_mail_to'));
283 $tbl->addMultiCommand(
'confirmDelete', $this->lng->txt(
'delete'));
287 $tbl->disable(
'header');
288 $tbl->disable(
'footer');
293 if(isset(
$_GET[
'ref']) &&
$_GET[
'ref'] ==
'mail')
295 $tbl->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
298 $this->tpl->setVariable(
'MAILING_LISTS',
$tbl->getHTML());
308 if(isset(
$_GET[
'ref']) &&
$_GET[
'ref'] ==
'mail')
310 $this->ctrl->returnToParent($this);
320 if($this->mlists->getCurrentMailingList()->getId())
322 if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId()))
324 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
327 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
335 if($this->form_gui->checkInput())
337 $this->mlists->getCurrentMailingList()->setTitle(
$_POST[
'title']);
338 $this->mlists->getCurrentMailingList()->setDescription(
$_POST[
'description']);
339 if($this->mlists->getCurrentMailingList()->getId())
341 $this->mlists->getCurrentMailingList()->setChangedate(
date(
'Y-m-d H:i:s',
time()));
342 $this->mlists->getCurrentMailingList()->update();
347 $this->mlists->getCurrentMailingList()->setCreatedate(
date(
'Y-m-d H:i:s',
time()));
348 $this->mlists->getCurrentMailingList()->insert();
349 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
350 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'saveForm'));
352 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
353 $this->ctrl->redirect($this,
'showMembersList');
359 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
360 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_form.html',
'Services/Contact');
362 $this->form_gui->setValuesByPost();
364 $this->tpl->setVariable(
'FORM', $this->form_gui->getHTML());
365 return $this->tpl->show();
370 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
373 $this->form_gui->setFormAction($this->ctrl->getFormAction($this,
'saveForm'));
374 $this->form_gui->setTitle($this->lng->txt(
'mail_mailing_list'));
376 $titleGui =
new ilTextInputGUI($this->lng->txt(
'title'),
'title');
378 $this->form_gui->addItem($titleGui);
380 $descriptionGui =
new ilTextAreaInputGUI($this->lng->txt(
'description'),
'description');
382 $descriptionGui->setRows(8);
383 $this->form_gui->addItem($descriptionGui);
385 $this->form_gui->addCommandButton(
'saveForm',$this->lng->txt(
'save'));
386 $this->form_gui->addCommandButton(
'showMailingLists',$this->lng->txt(
'cancel'));
391 $this->form_gui->setValuesByArray(
array(
392 'title' => $this->mlists->getCurrentMailingList()->getTitle(),
393 'description' => $this->mlists->getCurrentMailingList()->getDescription()
399 $this->form_gui->setValuesByArray(
array(
407 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
408 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_form.html',
'Services/Contact');
410 if($this->mlists->getCurrentMailingList()->getId())
412 if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId()))
414 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
417 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
427 $this->tpl->setVariable(
'FORM', $this->form_gui->getHTML());
428 return $this->tpl->show();
433 if(!$this->mlists->getCurrentMailingList()->getId())
439 $this->ctrl->setParameter($this,
'cmd',
'post');
440 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
442 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
443 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_members.html',
'Services/Contact');
445 require_once
'Services/Contact/classes/class.ilMailingListsMembersTableGUI.php';
449 require_once
'Services/UIComponent/Button/classes/class.ilLinkButton.php';
451 $create_btn->setCaption(
'add');
452 $create_btn->setUrl($this->ctrl->getLinkTarget($this,
'showAssignmentForm'));
453 $this->toolbar->addButtonInstance($create_btn);
455 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
456 if(count($assigned_entries))
458 $tbl->enable(
'select_all');
459 $tbl->setSelectAllCheckbox(
'a_id');
462 foreach($assigned_entries as $entry)
464 $usr_ids[] = $entry[
'usr_id'];
467 require_once
'Services/User/classes/class.ilUserUtil.php';
471 foreach($assigned_entries as $entry)
478 $tbl->addMultiCommand(
'confirmDeleteMembers', $this->lng->txt(
'delete'));
482 $tbl->disable(
'header');
483 $tbl->disable(
'footer');
485 $tbl->setNoEntriesText($this->lng->txt(
'mail_search_no'));
488 $tbl->setData($result);
490 $this->tpl->setVariable(
'MEMBERS_LIST',
$tbl->getHTML());
497 if(!isset(
$_POST[
'a_id']))
504 include_once(
'Services/Utilities/classes/class.ilConfirmationGUI.php');
506 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
507 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDeleteMembers'));
508 $c_gui->setHeaderText($this->lng->txt(
'mail_sure_delete_entry'));
509 $c_gui->setCancel($this->lng->txt(
'cancel'),
'showMembersList');
510 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteMembers');
512 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
515 foreach($assigned_entries as $entry)
517 $usr_ids[] = $entry[
'usr_id'];
520 require_once
'Services/User/classes/class.ilUserUtil.php';
523 foreach($assigned_entries as $entry)
525 if(in_array($entry[
'a_id'],
$_POST[
'a_id']))
527 $c_gui->addItem(
'a_id[]', $entry[
'a_id'],
$names[$entry[
'usr_id']]);
531 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
532 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_members.html',
'Services/Contact');
533 $this->tpl->setVariable(
'DELETE_CONFIRMATION', $c_gui->getHTML());
541 if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId()))
543 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
546 if(is_array(
$_POST[
'a_id']))
548 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
549 foreach(
$_POST[
'a_id'] as $id)
551 if(isset($assigned_entries[$id]))
553 $this->mlists->getCurrentMailingList()->deleteEntry((
int)$id);
571 protected function getAssignmentForm()
573 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
575 $this->ctrl->setParameter($this,
'ml_id', $this->mlists->getCurrentMailingList()->getId());
576 $form->setFormAction($this->ctrl->getFormAction($this,
'saveAssignmentForm'));
577 $form->setTitle($this->lng->txt(
'mail_assign_entry_to_mailing_list') .
' ' . $this->mlists->getCurrentMailingList()->getTitle());
580 $options[
''] = $this->lng->txt(
'please_select');
582 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
583 require_once
'Services/User/classes/class.ilUserUtil.php';
586 foreach($relations as $relation)
591 $options[$relation->getBuddyUserId()] =
$names[$relation->getBuddyUserId()];
594 $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
595 if(count($assigned_entries))
597 foreach($assigned_entries as $assigned_entry)
599 if(is_array(
$options) && array_key_exists($assigned_entry[
'usr_id'],
$options))
601 unset(
$options[$assigned_entry[
'usr_id']]);
608 $formItem =
new ilSelectInputGUI($this->lng->txt(
'mail_entry_of_contacts'),
'usr_id');
611 $form->addItem($formItem);
613 $form->addCommandButton(
'saveAssignmentForm', $this->lng->txt(
'assign'));
615 else if(count(
$options) == 1 && count($relations))
617 ilUtil::sendInfo($this->lng->txt(
'mail_mailing_lists_all_contact_entries_assigned'));
619 else if(count($relations) == 0)
623 $form->addCommandButton(
'showMembersList', $this->lng->txt(
'cancel'));
633 if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId()))
635 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
638 $form = $this->getAssignmentForm();
639 if(!$form->checkInput())
641 $form->setValuesByPost();
646 require_once
'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
649 $this->mlists->getCurrentMailingList()->assignUser((
int)$_POST[
'usr_id']);
665 if(!$this->mlists->getCurrentMailingList()->getId())
671 if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $this->
user->getId()))
673 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
676 $this->tpl->setTitle($this->lng->txt(
'mail_addressbook'));
677 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.mail_mailing_lists_members_form.html',
'Services/Contact');
681 $form = $this->getAssignmentForm();
684 $this->tpl->setVariable(
'FORM', $form->getHTML());
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getInstanceByGlobalUser()
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
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
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)
http redirect to other script
initForm($a_type='create')
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
Confirmation screen class.