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 non-administrators
66 function erErrorReport($tsDate = null, $strOwner = null, $strMachine = null, $strText = null,
69 $this->tsDate = intval($tsDate);
70 $this->strOwner = $strOwner;
71 $this->strMachine = $strMachine;
72 $this->strText = $strText;
73 $this->strComment = null;
74 $this->strCommentOwner = null;
75 $this->bHidden = ($bHidden == true);
78 /////////////////////////////////////////// SETTER FUNCTIONS ///////////////////////////////////////////
82 * @name Setter functions
90 function setUid($value) { $this->nUid = $value; }
93 * @param $value (timestamp)
95 function setDate($value) { $this->tsDate = intval($value); }
97 * Set the account name of the owner
98 * @param $value (string)
100 function setOwner($value) { $this->strOwner = $value; }
102 * Set the label of the machine to which the report refers
103 * @param $value (string)
105 function setMachine($value) { $this->strMachine = $value; }
107 * Set the text of the report
108 * @param $value (string)
110 function setText($value) { $this->strText = $value; }
113 * Set the comment of an adminstrator
114 * @param $strComment (string) Comment
115 * @param $strAct (string) Account name of the person who sets the comment
117 function setComment($strComment, $strAct) {
118 $this->strComment = $strComment;
119 $this->strCommentOwner = $strAct;
122 * Set the visibility of the report
123 * @param $value (bool) <tt>true</tt>: the report is only visible for administrators
125 function setVisibility($value) { $this->bHidden = $value; }
127 /////////////////////////////////////////// GETTER FUNCTIONS ///////////////////////////////////////////
131 * @name Getter functions
136 * Get the unique ID in the database
139 function getUid() { return intval($this->nUid); }
141 * Get the date when the report was created
142 * @return (timestamp)
144 function getDate() { return intval($this->tsDate); }
146 * Get the account name of the creator
149 function getOwner() { return $this->strOwner; }
151 * Get the label of the machine to which the report refers
154 function getMachine() { return $this->strMachine; }
156 * Get the tet of the report
159 function getText() { return $this->strText; }
161 * Get the comment from an administrator
164 function getComment() { return $this->strComment; }
166 * Get the account name of the one who wrote the comment
169 function getCommentOwner() { return $this->strCommentOwner; }
171 * Determine if the report can be seen by non-administrators
174 function isHidden() { return ($this->bHidden == true); }