3 * @file class_erErrorReport.inc
4 * A container class for an error report
5 * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
8 * Copyright © 2007 Roland Hieber
10 * Permission is hereby granted, free of charge, to any person obtaining
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 /** This class represents a dataset stored in the SQL table */
34 * (int) Unique ID in the database
37 /** (timestamp) Date when the report was created */
39 /** (string) Account name of the owner */
41 /** (string) Machine to which the report refers */
43 /** (string) Text of the report */
45 /** (string) Comments of an administrator */
47 /** (string) Account name of the one who wrote the comment */
49 /** (bool) Indicate if the report can be seen by non-administrators */
58 * Constructor. Used to set the data.
59 * @param $tsDate (timestamp) Date when the report was created
60 * @param $strOwner (string) Account name of the creator
61 * @param $strMachine (string) Machine to which the report refers
62 * @param $strText (string) Text of the report
63 * @param $bHidden (bool) Indicate if the report can be seen by
67 function erErrorReport($tsDate = null, $strOwner = null, $strMachine = null,
68 $strText = null, $bHidden = false) {
70 $this->tsDate = intval($tsDate);
71 $this->strOwner = $strOwner;
72 $this->strMachine = $strMachine;
73 $this->strText = $strText;
74 $this->strComment = null;
75 $this->strCommentOwner = null;
76 $this->bHidden = ($bHidden == true);
79 ////////////////////////////// SETTER FUNCTIONS //////////////////////////////
83 * @name Setter functions
91 function setUid($value) { $this->nUid = $value; }
94 * @param $value (timestamp)
96 function setDate($value) { $this->tsDate = intval($value); }
98 * Set the account name of the owner
99 * @param $value (string)
101 function setOwner($value) { $this->strOwner = $value; }
103 * Set the label of the machine to which the report refers
104 * @param $value (string)
106 function setMachine($value) { $this->strMachine = $value; }
108 * Set the text of the report
109 * @param $value (string)
111 function setText($value) { $this->strText = $value; }
114 * Set the comment of an adminstrator
115 * @param $strComment (string) Comment
116 * @param $strAct (string) Account name of the person who sets the comment
118 function setComment($strComment, $strAct) {
119 $this->strComment = $strComment;
120 $this->strCommentOwner = $strAct;
123 * Set the visibility of the report
124 * @param $value (bool) <tt>true</tt>: the report is only visible for
127 function setVisibility($value) { $this->bHidden = $value; }
129 ////////////////////////////// GETTER FUNCTIONS //////////////////////////////
133 * @name Getter functions
138 * Get the unique ID in the database
141 function getUid() { return intval($this->nUid); }
143 * Get the date when the report was created
144 * @return (timestamp)
146 function getDate() { return intval($this->tsDate); }
148 * Get the account name of the creator
151 function getOwner() { return $this->strOwner; }
153 * Get the label of the machine to which the report refers
156 function getMachine() { return $this->strMachine; }
158 * Get the tet of the report
161 function getText() { return $this->strText; }
163 * Get the comment from an administrator
166 function getComment() { return $this->strComment; }
168 * Get the account name of the one who wrote the comment
171 function getCommentOwner() { return $this->strCommentOwner; }
173 * Determine if the report can be seen by non-administrators
176 function isHidden() { return ($this->bHidden == true); }