Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Method.ElectronicMessage.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * @author Anakeen
9  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
10  * @package FDL
11  */
12 /**
13  * @begin-method-ignore
14  * this part will be deleted when construct document class until end-method-ignore
15  */
16 class _SENTMESSAGE extends Doc
17 {
18  /*
19  * @end-method-ignore
20  */
21  var $defaultview = "FDL:VIEWEMESSAGE";
22 
23  function viewemessage($target = "_self", $ulink = true, $abstract = false)
24  {
25  include_once ("FDL/Lib.Dir.php");
26  $this->viewdefaultcard($target, $ulink, $abstract);
27 
28  $from = $this->getValue("emsg_from");
29  if (preg_match("/<([^>]*)>/", $from, $erg)) {
30  $from = $erg[1];
31  }
32  $this->lay->set("hasphoto", false);
33  $filter1 = "us_mail='" . pg_escape_string($from) . "'";
34  $filter2 = "us_homemail='" . pg_escape_string($from) . "'";
35  $filter[] = "$filter1 or $filter2";
36  $tdir = getChildDoc($this->dbaccess, 0, "0", 1, $filter, 1, "LIST", "USER");
37  if (count($tdir) == 1) {
38 
39  $vphoto = $tdir[0]->getValue("us_photo");
40  if ($vphoto) {
41  $photo = $tdir[0]->GetHtmlAttrValue("us_photo");
42  $this->lay->set("photo", $photo);
43  $this->lay->set("hasphoto", ($photo != ""));
44  }
45  }
46  $hashtml = ($this->getValue("emsg_htmlbody") != "");
47 
48  $this->lay->set("hashtml", $hashtml);
49 
50  $this->lay->set("TO", false);
51  $this->lay->set("CC", false);
52 
53  $recips = $this->getTValue("emsg_recipient");
54  $reciptype = $this->getTValue("emsg_sendtype");
55  $tto = array();
56  $tcc = array();
57  $tbcc = array();
58  foreach ($recips as $k => $addr) {
59  $addr = str_replace(array(
60  "<",
61  ">"
62  ) , array(
63  "&lt;",
64  "&gt;"
65  ) , $addr);
66  if ($reciptype[$k] == "cc") $tcc[] = $addr;
67  elseif ($reciptype[$k] == "bcc") $tbcc[] = $addr;
68  else $tto[] = $addr;
69  }
70 
71  if (count($tto) > 0) {
72  $this->lay->set("TO", implode("; ", $tto));
73  }
74  if (count($tcc) > 0) {
75  $this->lay->set("CC", implode("; ", $tcc));
76  }
77  }
78  /**
79  * force no edition
80  */
81  function control($aclname)
82  {
83  if (($this->id > 0) && ($this->doctype != 'C') && ($aclname == "edit") && ($this->getParamValue("emsg_editcontrol") != "freeedit")) return _("electronic messages cannot be modified");
84  else return parent::control($aclname);
85  }
86  /**
87  * @begin-method-ignore
88  * this part will be deleted when construct document class until end-method-ignore
89  */
90 }
91 /*
92  * @end-method-ignore
93 */
94 ?>
← centre documentaire © anakeen - published under CC License - Dynacase