Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.ElectronicMessage.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Sent email document
8  */
9 namespace Dcp\Core;
11 {
12 
13  var $defaultview = "FDL:VIEWEMESSAGE";
14  /**
15  * @templateController
16  */
17  function viewemessage($target = "_self", $ulink = true, $abstract = false)
18  {
19  include_once ("FDL/Lib.Dir.php");
20 
21  $this->viewdefaultcard($target, $ulink, $abstract);
22 
23  $from = $this->getRawValue("emsg_from");
24  if (preg_match("/<([^>]*)>/", $from, $erg)) {
25  $from = $erg[1];
26  }
27  $this->lay->set("hasphoto", false);
28  $filter[] = "us_mail='" . pg_escape_string($from) . "'";
29  $tdir = internalGetDocCollection($this->dbaccess, 0, "0", 1, $filter, 1, "LIST", "IUSER");
30  if (count($tdir) == 1) {
31  /**
32  * @var \Dcp\Family\Iuser $first
33  */
34  $first = $tdir[0];
35  $vphoto = $first->getRawValue("us_photo");
36  if ($vphoto) {
37  $photo = $first->GetHtmlAttrValue("us_photo");
38  $this->lay->set("photo", $photo);
39  $this->lay->set("hasphoto", ($photo != ""));
40  }
41  }
42  $hashtml = ($this->getRawValue("emsg_htmlbody") != "");
43 
44  $this->lay->set("hashtml", $hashtml);
45 
46  $this->lay->set("TO", false);
47  $this->lay->set("CC", false);
48 
49  $recips = $this->getMultipleRawValues("emsg_recipient");
50  $reciptype = $this->getMultipleRawValues("emsg_sendtype");
51  $tto = array();
52  $tcc = array();
53  $tbcc = array();
54  foreach ($recips as $k => $addr) {
55  $addr = str_replace(array(
56  "<",
57  ">"
58  ) , array(
59  "&lt;",
60  "&gt;"
61  ) , $addr);
62  if ($reciptype[$k] == "cc") $tcc[] = $addr;
63  elseif ($reciptype[$k] == "bcc") $tbcc[] = $addr;
64  else $tto[] = $addr;
65  }
66 
67  if (count($tto) > 0) {
68  $this->lay->set("TO", implode("; ", $tto));
69  }
70  if (count($tcc) > 0) {
71  $this->lay->set("CC", implode("; ", $tcc));
72  }
73  }
74  /**
75  * force no edition
76  */
77  function control($aclname, $strict = false)
78  {
79  if (($this->id > 0) && ($this->doctype != 'C') && ($aclname == "edit") && ($this->getFamilyParameterValue("emsg_editcontrol") != "freeedit")) return _("electronic messages cannot be modified");
80  else return parent::control($aclname, $strict);
81  }
82 }
viewdefaultcard($target="_self", $ulink=true, $abstract=false, $viewhidden=false)
Definition: Class.Doc.php:7099
getFamilyParameterValue($idp, $def="")
Definition: Class.Doc.php:1538
getMultipleRawValues($idAttr, $def="", $index=-1)
Definition: Class.Doc.php:3240
internalGetDocCollection($dbaccess, $dirid, $start="0", $slice="ALL", $sqlfilters=array(), $userid=1, $qtype="LIST", $fromid="", $distinct=false, $orderby="title", $latest=true, $trash="", &$debug=null, $folderRecursiveLevel=2, $join= '',\SearchDoc &$searchDoc=null)
Definition: Lib.Dir.php:428
$from
control($aclname, $strict=false)
getRawValue($idAttr, $def="")
Definition: Class.Doc.php:3117
← centre documentaire © anakeen