ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMailingListsGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
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";
8 require_once "Services/Contact/classes/class.ilAddressbook.php";
9 
17 {
18  private $tpl = null;
19  private $ctrl = null;
20  private $lng = null;
21 
22  private $umail = null;
23  private $mlists = null;
24  private $abook = null;
25 
26  private $error = array();
27 
28  private $form_gui = null;
29 
30  public function __construct()
31  {
32  global $tpl, $ilCtrl, $lng, $ilUser;
33 
34  $this->tpl = $tpl;
35  $this->ctrl = $ilCtrl;
36  $this->lng = $lng;
37 
38  $this->umail = new ilFormatMail($ilUser->getId());
39  $this->abook = new ilAddressbook($ilUser->getId());
40 
41  $this->mlists = new ilMailingLists($ilUser);
42  $this->mlists->setCurrentMailingList($_GET['ml_id']);
43 
44  $this->ctrl->saveParameter($this, 'mobj_id');
45  }
46 
47  public function executeCommand()
48  {
49  $forward_class = $this->ctrl->getNextClass($this);
50  switch ($forward_class)
51  {
52  default:
53  if (!($cmd = $this->ctrl->getCmd()))
54  {
55  $cmd = 'showMailingLists';
56  }
57 
58  $this->$cmd();
59  break;
60  }
61  return true;
62  }
63 
64  public function confirmDelete()
65  {
66  $ml_ids = ((int)$_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
67  if (!$ml_ids)
68  {
69  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
70  $this->showMailingLists();
71  return true;
72  }
73 
74  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
75  $c_gui = new ilConfirmationGUI();
76 
77  $c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDelete'));
78  $c_gui->setHeaderText($this->lng->txt('mail_sure_delete_entry'));
79  $c_gui->setCancel($this->lng->txt('cancel'), 'showMailingLists');
80  $c_gui->setConfirm($this->lng->txt('confirm'), 'performDelete');
81 
82  $entries = $this->mlists->getSelected($ml_ids);
83  foreach($entries as $entry)
84  {
85  $c_gui->addItem('ml_id[]', $entry->getId(), $entry->getTitle());
86  }
87 
88  $this->tpl->setVariable('HEADER', $this->lng->txt('mail'));
89  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
90  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
91 
92  $this->tpl->show();
93 
94  return true;
95  }
96 
97  public function performDelete()
98  {
99  global $ilUser;
100 
101  if (is_array($_POST['ml_id']))
102  {
103  $counter = 0;
104  foreach ($_POST['ml_id'] as $id)
105  {
106  if(ilMailingList::_isOwner($id, $ilUser->getId()))
107  {
108  $this->mlists->get(ilUtil::stripSlashes($id))->delete();
109  ++$counter;
110  }
111  }
112  if($counter)
113  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
114  }
115  else
116  {
117  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
118  }
119 
120  $this->showMailingLists();
121 
122  return true;
123  }
124 
125  public function mailToList()
126  {
127  global $ilUser, $rbacsystem;
128 
129  // check if current user may send mails
130  include_once "Services/Mail/classes/class.ilMail.php";
131  $mail = new ilMail($_SESSION["AccountId"]);
132  $mailing_allowed = $rbacsystem->checkAccess('mail_visible',$mail->getMailObjectReferenceId());
133 
134  if (!$mailing_allowed)
135  {
136  ilUtil::sendFailure($this->lng->txt('no_permission'));
137  return true;
138  }
139 
140  $ml_ids = ((int)$_GET['ml_id']) ? array($_GET['ml_id']) : $_POST['ml_id'];
141  if (!$ml_ids)
142  {
143  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
144  $this->showMailingLists();
145  return true;
146  }
147 
148  $mail_data = $this->umail->getSavedData();
149  if(!is_array($mail_data))
150  {
151  $this->umail->savePostData($ilUser->getId(), array(), '', '', '', '', '', '', '', '');
152  }
153 
154  $lists = array();
155  foreach($ml_ids as $id)
156  {
157  if(ilMailingList::_isOwner($id, $ilUser->getId()) &&
158  !$this->umail->doesRecipientStillExists('#il_ml_'.$id, $mail_data['rcp_to']))
159  {
160  $lists[] = '#il_ml_'.$id;
161  }
162  }
163 
164  if(count($lists))
165  {
166  $mail_data = $this->umail->appendSearchResult($lists, 'to');
167  $this->umail->savePostData(
168  $mail_data['user_id'],
169  $mail_data['attachments'],
170  $mail_data['rcp_to'],
171  $mail_data['rcp_cc'],
172  $mail_data['rcp_bcc'],
173  $mail_data['m_type'],
174  $mail_data['m_email'],
175  $mail_data['m_subject'],
176  $mail_data['m_message'],
177  $mail_data['use_placeholders']
178  );
179  }
180 
181  ilUtil::redirect("ilias.php?baseClass=ilMailGUI&type=search_res");
182 
183  return true;
184  }
185 
186  public function showMailingLists()
187  {
188  global $rbacsystem;
189 
190  $this->tpl->setVariable('HEADER', $this->lng->txt('mail'));
191  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_list.html', 'Services/Contact');
192 
193  // check if current user may send mails
194  include_once "Services/Mail/classes/class.ilMail.php";
195  $mail = new ilMail($_SESSION["AccountId"]);
196  $mailing_allowed = $rbacsystem->checkAccess('mail_visible',$mail->getMailObjectReferenceId());
197 
198  $tbl = new ilTable2GUI($this);
199  $tbl->setId('show_mlng_lists_tbl');
200  $tbl->setFormAction($this->ctrl->getFormAction($this), 'showForm');
201  $tbl->setTitle($this->lng->txt('mail_mailing_lists'));
202  $tbl->setRowTemplate('tpl.mail_mailing_lists_listrow.html', 'Services/Contact');
203 
204  $tbl->setDefaultOrderField('title');
205 
206  $result = array();
207 
208  $tbl->addColumn('', 'check', '10%', true);
209  $tbl->addColumn($this->lng->txt('title'), 'title', '30%');
210  $tbl->addColumn($this->lng->txt('description'), 'description', '30%');
211  $tbl->addColumn($this->lng->txt('members'), 'members', '20%');
212  $tbl->addColumn($this->lng->txt('actions'), '', '10%');
213 
214  $entries = $this->mlists->getAll();
215  if (count($entries))
216  {
217  $tbl->enable('select_all');
218  $tbl->setSelectAllCheckbox('ml_id');
219 
220  $counter = 0;
221 
222  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
223 
224  foreach ($entries as $entry)
225  {
226  $result[$counter]['check'] = ilUtil::formCheckbox(0, 'ml_id[]', $entry->getId());
227  $result[$counter]['title'] = $entry->getTitle() . " [#il_ml_" . $entry->getId() . "]";
228  $result[$counter]['description'] = $entry->getDescription();
229  $result[$counter]['members'] = count($entry->getAssignedEntries());
230 
231  $this->ctrl->setParameter($this, 'ml_id', $entry->getId());
232  //$result[$counter]['edit_text'] = $this->lng->txt("edit");
233  //$result[$counter]['edit_url'] = $this->ctrl->getLinkTarget($this, "showForm");
234  //$result[$counter]['members_text'] = $this->lng->txt("members");
235  //$result[$counter]['members_url'] = $this->ctrl->getLinkTarget($this, "showMembersList");
236 
237  $current_selection_list = new ilAdvancedSelectionListGUI();
238  $current_selection_list->setListTitle($this->lng->txt("actions"));
239  $current_selection_list->setId("act_".$counter);
240 
241  $current_selection_list->addItem($this->lng->txt("edit"), '', $this->ctrl->getLinkTarget($this, "showForm"));
242  $current_selection_list->addItem($this->lng->txt("members"), '', $this->ctrl->getLinkTarget($this, "showMembersList"));
243  if ($mailing_allowed)
244  $current_selection_list->addItem($this->lng->txt("send_mail_to"), '', $this->ctrl->getLinkTarget($this, "mailToList"));
245  $current_selection_list->addItem($this->lng->txt("delete"), '', $this->ctrl->getLinkTarget($this, "confirmDelete"));
246 
247  $result[$counter]['COMMAND_SELECTION_LIST'] = $current_selection_list->getHTML();
248 
249  ++$counter;
250  }
251 
252  if ($mailing_allowed)
253  $tbl->addMultiCommand('mailToList', $this->lng->txt('send_mail_to'));
254  $tbl->addMultiCommand('confirmDelete', $this->lng->txt('delete'));
255  }
256  else
257  {
258  $tbl->disable('header');
259  $tbl->disable('footer');
260 
261  $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
262  }
263 
264  $tbl->setData($result);
265 
266  $tbl->addCommandButton('showForm', $this->lng->txt('add'));
267 
268  $this->tpl->setVariable('MAILING_LISTS', $tbl->getHTML());
269  $this->tpl->show();
270 
271  return true;
272  }
273 
274  public function saveForm()
275  {
276  if($this->mlists->getCurrentMailingList()->getId())
277  {
278  global $ilUser, $ilErr;
279 
280  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
281  {
282  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
283  }
284 
285  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
286  $this->initForm('edit');
287  }
288  else
289  {
290  $this->initForm();
291  }
292 
293  if($this->form_gui->checkInput())
294  {
295  $this->mlists->getCurrentMailingList()->setTitle($_POST['title']);
296  $this->mlists->getCurrentMailingList()->setDescription($_POST['description']);
297  if($this->mlists->getCurrentMailingList()->getId())
298  {
299  $this->mlists->getCurrentMailingList()->setChangedate(date('Y-m-d H:i:s', time()));
300  $this->mlists->getCurrentMailingList()->update();
301  ilUtil::sendSuccess($this->lng->txt('saved_successfully'));
302  }
303  else
304  {
305  $this->mlists->getCurrentMailingList()->setCreatedate(date('Y-m-d H:i:s', time()));
306  $this->mlists->getCurrentMailingList()->insert();
307  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
308  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
309 
310  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
311  $this->ctrl->redirect($this,'showMembersList');
312 
313  exit;
314  }
315  }
316 
317  $this->tpl->setVariable('HEADER', $this->lng->txt('mail'));
318  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
319 
320  $this->form_gui->setValuesByPost();
321 
322  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
323  return $this->tpl->show();
324  }
325 
326  private function initForm($a_type = 'create')
327  {
328  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
329  $this->form_gui = new ilPropertyFormGUI();
330 
331  $this->form_gui->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
332  $this->form_gui->setTitle($this->lng->txt('mail_mailing_list'));
333 
334  $titleGui = new ilTextInputGUI($this->lng->txt('title'), 'title');
335  $titleGui->setRequired(true);
336  $this->form_gui->addItem($titleGui);
337 
338  $descriptionGui = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
339  $descriptionGui->setCols(40);
340  $descriptionGui->setRows(8);
341  $this->form_gui->addItem($descriptionGui);
342 
343  $this->form_gui->addCommandButton('saveForm',$this->lng->txt('save'));
344  $this->form_gui->addCommandButton('showMailingLists',$this->lng->txt('cancel'));
345  }
346 
347  private function setValuesByObject()
348  {
349  $this->form_gui->setValuesByArray(array(
350  'title' => $this->mlists->getCurrentMailingList()->getTitle(),
351  'description' => $this->mlists->getCurrentMailingList()->getDescription()
352  ));
353  }
354 
355  private function setDefaultValues()
356  {
357  $this->form_gui->setValuesByArray(array(
358  'title' => '',
359  'description' => ''
360  ));
361  }
362 
363  public function showForm()
364  {
365  global $ilUser, $ilErr;
366 
367  $this->tpl->setVariable('HEADER', $this->lng->txt('mail'));
368  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_form.html', 'Services/Contact');
369 
370  if($this->mlists->getCurrentMailingList()->getId())
371  {
372  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
373  {
374  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
375  }
376 
377  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
378  $this->initForm('edit');
379  $this->setValuesByObject();
380  }
381  else
382  {
383  $this->initForm();
384  $this->setDefaultValues();
385  }
386 
387  $this->tpl->setVariable('FORM', $this->form_gui->getHTML());
388  return $this->tpl->show();
389  }
390 
391  public function showMembersList()
392  {
393  if (!$this->mlists->getCurrentMailingList()->getId())
394  {
395  $this->showMailingLists();
396 
397  return true;
398  }
399 
400  $this->ctrl->setParameter($this, 'cmd', 'post');
401  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
402 
403  $this->tpl->setVariable('HEADER', $this->lng->txt('mail'));
404  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
405 
406  $tbl = new ilTable2GUI($this);
407  $tbl->setId('show_mlng_mmbrs_list_tbl');
408  $tbl->setFormAction($this->ctrl->getFormAction($this), 'showMemberForm');
409  $tbl->setTitle($this->lng->txt('mail_members_of_mailing_list') . ' ' .$this->mlists->getCurrentMailingList()->getTitle());
410  $tbl->setRowTemplate('tpl.mail_mailing_lists_membersrow.html', 'Services/Contact');
411 
412  $this->ctrl->setParameter($this, 'cmd', 'showMembersList');
413 
414  $tbl->setDefaultOrderField('title');
415 
416  $result = array();
417 
418  $tbl->addColumn('', 'check', '10%');
419  $tbl->addColumn($this->lng->txt('title'), 'title', '90%');
420 
421  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
422  if (count($assigned_entries))
423  {
424  $tbl->enable('select_all');
425  $tbl->setSelectAllCheckbox('a_id');
426 
427  $counter = 0;
428  foreach ($assigned_entries as $entry)
429  {
430  $result[$counter]['check'] = ilUtil::formCheckbox(0, 'a_id[]', $entry['a_id']);
431  $result[$counter]['title'] = ($entry['login'] != '' ? $entry['login'] : $entry['email']);
432 
433  ++$counter;
434  }
435 
436  $tbl->addMultiCommand('confirmDeleteMembers', $this->lng->txt('delete'));
437  }
438  else
439  {
440  $tbl->disable('header');
441  $tbl->disable('footer');
442 
443  $tbl->setNoEntriesText($this->lng->txt('mail_search_no'));
444  }
445 
446  $tbl->setData($result);
447 
448  $tbl->addCommandButton('showAssignmentForm', $this->lng->txt('add'));
449  $tbl->addCommandButton('showMailingLists', $this->lng->txt('back'));
450 
451  $this->tpl->setVariable('MEMBERS_LIST', $tbl->getHTML());
452  $this->tpl->show();
453 
454  return true;
455  }
456 
457  public function confirmDeleteMembers()
458  {
459  if (!isset($_POST['a_id']))
460  {
461  ilUtil::sendInfo($this->lng->txt('mail_select_one_entry'));
462  $this->showMembersList();
463  return true;
464  }
465 
466  include_once('Services/Utilities/classes/class.ilConfirmationGUI.php');
467  $c_gui = new ilConfirmationGUI();
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');
473 
474  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
475  if (is_array($assigned_entries))
476  {
477  foreach ($assigned_entries as $entry)
478  {
479  if (in_array($entry['a_id'], $_POST['a_id']))
480  {
481  $c_gui->addItem('a_id[]', $entry['a_id'], ($entry['login'] != '' ? $entry['login'] : $entry['email']));
482  }
483  }
484  }
485 
486  $this->tpl->setVariable('HEADER', $this->lng->txt('mail'));
487  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members.html', 'Services/Contact');
488  $this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
489 
490  $this->tpl->show();
491 
492  return true;
493  }
494 
495  public function performDeleteMembers()
496  {
497  global $ilUser, $ilErr;
498 
499  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
500  {
501  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
502  }
503 
504  if (is_array($_POST['a_id']))
505  {
506  foreach ($_POST['a_id'] as $id)
507  {
508  $this->mlists->getCurrentMailingList()->deassignAddressbookEntry(ilUtil::stripSlashes($id));
509  }
510 
511  ilUtil::sendInfo($this->lng->txt('mail_deleted_entry'));
512  }
513  else
514  {
515  ilUtil::sendInfo($this->lng->txt('mail_delete_error'));
516  }
517 
518  $this->showMembersList();
519 
520  return true;
521  }
522 
523  public function saveAssignmentForm()
524  {
525  global $ilUser, $ilErr;
526 
527  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
528  {
529  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
530  }
531 
532  if ($_POST['addr_id'] == '') $this->setError($this->lng->txt('mail_entry_of_addressbook'));
533 
534  if (!$this->isError())
535  {
536  $found = false;
537 
538  $all_entries = $this->abook->getEntries();
539  if ((int)count($all_entries))
540  {
541  foreach ($all_entries as $entry)
542  {
543  if($entry['addr_id'] == $_POST['addr_id'])
544  {
545  $found = true;
546  break;
547  }
548  }
549  }
550 
551  if($found)
552  {
553  $this->mlists->getCurrentMailingList()->assignAddressbookEntry(ilUtil::stripSlashes($_POST['addr_id']));
554 
555  ilUtil::sendInfo($this->lng->txt('saved_successfully'));
556  }
557 
558  $this->showMembersList();
559  }
560  else
561  {
562  $mandatory = '';
563 
564  while ($error = $this->getError())
565  {
566  $mandatory .= $error;
567  if ($this->isError()) $mandatory .= ', ';
568  }
569 
570  ilUtil::sendInfo($this->lng->txt('fill_out_all_required_fields') . ': ' . $mandatory);
571 
572  $this->showAssignmentForm();
573  }
574 
575  return true;
576  }
577 
578  public function showAssignmentForm()
579  {
580  global $ilUser, $ilErr;
581 
582  if (!$this->mlists->getCurrentMailingList()->getId())
583  {
584  $this->showMembersList();
585 
586  return true;
587  }
588 
589  if(!ilMailingList::_isOwner($this->mlists->getCurrentMailingList()->getId(), $ilUser->getId()))
590  {
591  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE);
592  }
593 
594  $this->tpl->setVariable('HEADER', $this->lng->txt('mail'));
595  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_mailing_lists_members_form.html', 'Services/Contact');
596 
597  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
598 
599  $form = new ilPropertyFormGUI();
600  $this->ctrl->setParameter($this, 'ml_id', $this->mlists->getCurrentMailingList()->getId());
601  $form->setFormAction($this->ctrl->getFormAction($this, 'saveForm'));
602  $form->setTitle($this->lng->txt('mail_assign_entry_to_mailing_list') . ' ' . $this->mlists->getCurrentMailingList()->getTitle());
603 
604  $options = array();
605  $options[''] = $this->lng->txt('please_select');
606 
607  $all_entries = $this->abook->getEntries();
608  if ((int)count($all_entries))
609  {
610  foreach ($all_entries as $entry)
611  {
612  $options[$entry['addr_id']] = ($entry['login'] != '' ? $entry['login'] : $entry['email']);
613  }
614  }
615 
616  $assigned_entries = $this->mlists->getCurrentMailingList()->getAssignedEntries();
617  if ((int)count($assigned_entries))
618  {
619  foreach ($assigned_entries as $assigned_entry)
620  {
621  if (is_array($options) && array_key_exists($assigned_entry['addr_id'], $options))
622  {
623  unset($options[$assigned_entry['addr_id']]);
624  }
625  }
626  }
627 
628  if (count($options) > 1)
629  {
630  $formItem = new ilSelectInputGUI($this->lng->txt('mail_entry_of_addressbook'), 'addr_id');
631  $formItem->setOptions($options);
632  $formItem->setValue($this->mlists->getCurrentMailingList()->getTitle());
633  $form->addItem($formItem);
634 
635  $form->addCommandButton('saveAssignmentForm',$this->lng->txt('assign'));
636  }
637  else if(count($options) == 1 && (int)count($all_entries))
638  {
639  ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_all_addressbook_entries_assigned'));
640  }
641  else if(!(int)count($all_entries))
642  {
643  ilUtil::sendInfo($this->lng->txt('mail_mailing_lists_no_addressbook_entries'));
644  }
645 
646 
647  $form->addCommandButton('showMembersList',$this->lng->txt('cancel'));
648 
649  $this->tpl->setVariable('FORM', $form->getHTML());
650  $this->tpl->show();
651 
652  return true;
653  }
654 
655  public function setError($a_error = '')
656  {
657  return $this->error[] = $a_error;
658  }
659  public function getError()
660  {
661  return array_pop($this->error);
662  }
663  public function isError()
664  {
665  if (is_array($this->error) && !empty($this->error)) return true;
666 
667  return false;
668  }
669 }
670 ?>