Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Method.PostIt.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  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: Method.PostIt.php,v 1.9 2007/08/06 15:42:25 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 /**
19  * @begin-method-ignore
20  * this part will be deleted when construct document class until end-method-ignore
21  */
22 class _POSTIT extends Doc
23 {
24  /*
25  * @end-method-ignore
26  */
27 
28  var $defaultview = "FDL:VIEWPOSTIT:T";
29  var $defaultedit = "FDL:EDITPOSTIT:T";
30  // -----------------------------------
31  function viewpostit($target = "_self", $ulink = true, $abstract = false)
32  {
33  // -----------------------------------
34  $tcomment = $this->getTvalue("PIT_COM");
35  $tuser = $this->getTvalue("PIT_USER");
36  $tdate = $this->getTvalue("PIT_DATE");
37  $tcolor = $this->getTvalue("PIT_COLOR");
38 
39  $nbcar = strlen($this->getvalue("PIT_COM"));
40  if ($nbcar < 60) $fontsize = 120;
41  elseif ($nbcar < 200) $fontsize = 100;
42  else $fontsize = 80;
43  $tlaycomment = array();
44  while (list($k, $v) = each($tcomment)) {
45  $tlaycomment[] = array(
46  "comments" => $this->getHtmlValue($this->getAttribute('PIT_COM') , $v, '_blank') ,
47  "user" => $tuser[$k],
48  "date" => $tdate[$k],
49  "color" => $tcolor[$k]
50  );
51  }
52 
53  $this->lay->set("EMPTY", count($tcomment) == 0);
54  $this->lay->set("fontsize", $fontsize);
55  // Out
56  $this->lay->SetBlockData("TEXT", $tlaycomment);
57  }
58  function editpostit()
59  {
60  $this->editattr();
61  }
62 
63  function getpostittitle($s)
64  {
65  return sprintf(_("postit of %s") , $this->getTitle($s));
66  }
67  function PostModify()
68  {
69  $docid = $this->getValue("PIT_IDADOC");
70  if ($docid > 0) {
71  $doc = new_Doc($this->dbaccess, $docid);
72  if (intval($doc->postitid) == 0) {
73  $doc->disableEditControl();
74  $doc->postitid = $this->id;
75  $doc->modify();
76  $doc->enableEditControl();
77  }
78  }
79 
80  $ncom = $this->getValue("PIT_NCOM");
81  if ($ncom != "") {
82 
83  $tcom = $this->getTValue("PIT_COM");
84  $tdate = $this->getTValue("PIT_DATE");
85  $tiduser = $this->getTValue("PIT_IDUSER");
86  $tcolor = $this->getTValue("PIT_COLOR");
87 
88  foreach ($tcom as $k => $v) {
89  if ($v == "") {
90  unset($tcom[$k]);
91  unset($tdate[$k]);
92  unset($tiduser[$k]);
93  unset($tcolor[$k]);
94  }
95  }
96  $nk = count($tcom);
97  $tcom[$nk] = $ncom;
98  $tdate[$nk] = $this->getDate();
99  $tiduser[$nk] = $this->getUserId();
100  $tcolor[$nk] = $this->getValue("PIT_NCOLOR");
101 
102  $this->setValue("PIT_COM", $tcom);
103  $this->setValue("PIT_DATE", $tdate);
104  $this->setValue("PIT_IDUSER", $tiduser);
105  $this->setValue("PIT_COLOR", $tcolor);
106  $this->deleteValue("PIT_NCOLOR");
107  $this->deleteValue("PIT_NCOM");
108  }
109  }
110 
111  function PostDelete()
112  {
113  $docid = $this->getValue("PIT_IDADOC");
114  if ($docid > 0) {
115  $doc = new_Doc($this->dbaccess, $docid);
116  if ($doc->locked == - 1) $doc = new_Doc($this->dbaccess, $doc->latestId());
117  if (intval($doc->postitid) > 0) {
118  $doc->disableEditControl();
119  $doc->postitid = 0;
120  $doc->modify();
121  $doc->enableEditControl();
122  }
123  }
124  }
125 
126  function preCreated()
127  {
128 
129  $tcomment = $this->getValue("PIT_NCOM");
130  if ($tcomment == "") return (_("no message : post-it creation aborted"));
131  }
132  /**
133  * @begin-method-ignore
134  * this part will be deleted when construct document class until end-method-ignore
135  */
136 }
137 /*
138  * @end-method-ignore
139 */
140 ?>
← centre documentaire © anakeen - published under CC License - Dynacase