<?php
-/**\r
+/**
* @file class_erErrorReportView.inc
- * Class for viewing error reports\r
- * @author Roland Hieber (roland.hieber@wilhelm-gym.net)\r
- * @date 21.10.2007\r
- * \r
- * Copyright © 2007 Roland Hieber\r
- * \r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- * \r
- * The above copyright notice and this permission notice shall be included in\r
- * all copies or substantial portions of the Software.\r
- * \r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
- * THE SOFTWARE.\r
+ * Class for viewing error reports
+ * @author Roland Hieber (roland.hieber@wilhelm-gym.net)
+ * @date 21.10.2007
+ *
+ * Copyright © 2007 Roland Hieber
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
*/
require_once("mod_error-reporter/class_erConfig.inc");
/** @todo document */
class erErrorReportView {
- /**
- * (object of class erConfig) pointer to the configuration class
- */
+ /** (erConfig) pointer to the configuration class */
protected $objcfg;
- /** (object of type erErrorReportManager) pointer to a erErrorReportManager instance */
+ /** (erErrorReportManager) pointer to a erErrorReportManager instance */
protected $objManager;
/**
* (string) URL to the page which allows editing of an error report.
- * The specified page must handle the <tt>uid</tt> GET parameter, which contains the unique ID
- * of the error report to be edited.
+ * The specified page must handle the <tt>uid</tt> GET parameter, which
+ * contains the unique ID of the error report to be edited.
*/
protected $strEditURL;
/**
* (string) URL to the page which allows deletion of an error report.
- * The specified page must handle the <tt>uid</tt> GET parameter, which contains the unique ID
- * of the error report to be deleted.
+ * The specified page must handle the <tt>uid</tt> GET parameter, which
+ * contains the unique ID of the error report to be deleted.
*/
protected $strDeleteURL;
/**
* Constructor
- * @param $objcfg (object of type erConfig) Pointer to an instance of the erConfig class for
+ * @param $objcfg (erConfig) Pointer to an instance of the erConfig class for
* retrieving the configuration data
- * @param $objemm (object of type erErrorReportManager) Pointer to a instance of the
+ * @param $objemm (erErrorReportManager) Pointer to a instance of the
* erErrorReportManager class for retrieving the document data
* @return erErrorReportView
*/
$this->objcfg = $objcfg;
$this->objManager = $objemm;
html_header("<style type='text/css'>
- table.errors-view-table { width:100%; border:2px solid #5276AB; }
- td.errors-view-description { width:12em; }
- td.errors-view-comment-row { font-style:italic; }
- td.errors-view-action-edit, td.errors-view-action-delete {
- width: 16px;
- padding:0 1em;
- vertical-align:middle;
- }
+ table.errors-view-table { width:100%; border:2px solid #5276AB; }
+ td.errors-view-description { width:12em; }
+ td.errors-view-comment-row { font-style:italic; }
+ td.errors-view-action-edit, td.errors-view-action-delete {
+ width: 16px;
+ padding:0 1em;
+ vertical-align:middle;
+ }
</style>");
}
/**
* Print a single error report.
- * Call this function to print a table or a compound of table rows with the information of the
- * specified error report. The function determines if the current user is the owner of the
- * specified report or if he has admin rights and in this case displays buttons for deletion and
- * editing the error report.
+ * Call this function to print a table or a compound of table rows with the
+ * information of the specified error report. The function determines if the
+ * current user is the owner of the specified report or if he has admin
+ * rights and in this case displays buttons for deletion and editing the
+ * error report.
* @param $objem (erErrorReport) Error report to print
- * @param $bSingle (bool) Determines if you call this function once (<tt>true</tt>) or several
- * times to get a compound table of reports (<tt>false</tt>).
- * @param $bAdminButtons (bool) Explcitly determines whether to show the edit and delete buttons.
- * This parameter overrides the userIsAdmin() and userIsOwner() functions.
+ * @param $bSingle (bool) Determines if you call this function once
+ * (<tt>true</tt>) or several times to get a compound table of reports
+ * (<tt>false</tt>).
+ * @param $bAdminButtons (bool) Explicitly determines whether to show the
+ * edit and delete buttons. This parameter overrides the check for owner and
+ * admin rights.
*/
public function printErrorReport(erErrorReport $objem, $bSingle = false, $bAdminButtons = true) {
global $colbox_state, $invtbl;
echo "<{$GLOBALS["invtbl"]} class='errors-view-table'>";
}
$nColor = bgcol_rgb();
- $sColor = sprintf("rgb(%d,%d,%d)", ($nColor >> 16) % 256, ($nColor >> 8) % 256, $nColor % 256);
+ $sColor = sprintf("rgb(%d,%d,%d)", ($nColor >> 16) % 256,
+ ($nColor >> 8) % 256, $nColor % 256);
echo "<tr style='background-color:$sColor'>";
- if($this->objcfg->userIsAdmin() or $this->objManager->userIsOwner($objem->getUid())) {
+ if($this->objcfg->userIsAdmin() or
+ $this->objManager->userIsOwner($objem->getUid())) {
// user is admin or owner
echo "<td style='padding:3px'><{$GLOBALS["invtbl"]} width='100%'>\n";
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>",
- _c("error-reporter:Reported by:"), erMailToUserLink($objem->getOwner()));
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Date:"), SmartDate($objem->getDate()));
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Affected machine:"), q($objem->getMachine()));
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Text:"), q($objem->getText()));
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Hidden:"), $objem->isHidden() ? _c("error-reporter:yes") : _c("error-reporter:no"));
+ $sRow = "<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>";
+ echo sprintf("$sRow\n", _c("error-reporter:Reported by:"),
+ erMailToUserLink($objem->getOwner()));
+ echo sprintf("$sRow\n", _c("error-reporter:Date:"),
+ SmartDate($objem->getDate()));
+ echo sprintf("$sRow\n", _c("error-reporter:Affected machine:"),
+ q($objem->getMachine()));
+ echo sprintf("$sRow\n", _c("error-reporter:Text:"), q($objem->getText()));
+ echo sprintf("$sRow\n", _c("error-reporter:Hidden:"), $objem->isHidden() ?
+ _c("error-reporter:yes") : _c("error-reporter:no"));
if(trim($objem->getComment()) != "") {
- echo sprintf("<tr><td class='errors-view-description errors-view-comment-row'>%s".
- "</td><td class='errors-view-comment-row'>%s</td></tr>\n",
- sprintf(_c("error-reporter:Comment by %s:"), erMailToUserLink($objem->getCommentOwner())),
+ echo sprintf("<tr><td class='errors-view-description ".
+ "errors-view-comment-row'>%s</td><td ".
+ "class='errors-view-comment-row'>%s</td></tr>\n",
+ sprintf(_c("error-reporter:Comment by %s:"),
+ erMailToUserLink($objem->getCommentOwner())),
q($objem->getComment()));
}
echo "</table></td>\n";
if($bAdminButtons) {
echo sprintf("<td class='errors-view-action-edit'>%s</td>".
"<td class='errors-view-action-delete'>%s</td>",
- $this->getEditLink($objem->getUid()), $this->getDeleteLink($objem->getUid()));
+ $this->getEditLink($objem->getUid()),
+ $this->getDeleteLink($objem->getUid()));
}
echo "</tr>\n";
} else {
// user can only read the report
echo "<td><{$GLOBALS["invtbl"]} width='100%'>\n";
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Affected machine:"), $objem->getMachine());
- echo sprintf("<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>\n",
- _c("error-reporter:Text:"), $objem->getText());
+ $sRow = "<tr><td class='errors-view-description'>%s</td><td>%s</td></tr>";
+ echo sprintf("$sRow\n", _c("error-reporter:Affected machine:"),
+ $objem->getMachine());
+ echo sprintf("$sRow\n", _c("error-reporter:Text:"), $objem->getText());
if(trim($objem->getComment()) != "") {
- echo sprintf("<tr><td class='errors-view-description errors-view-comment-row'>%s".
- "</td><td class='errors-view-comment-row'>%s</td></tr>\n",
- sprintf(_c("error-reporter:Comment by %s:"), erMailToUserLink($objem->getCommentOwner())),
+ echo sprintf("<tr><td class='errors-view-description ".
+ "errors-view-comment-row'>%s</td><td ".
+ "class='errors-view-comment-row'>%s</td></tr>\n",
+ sprintf(_c("error-reporter:Comment by %s:"),
+ erMailToUserLink($objem->getCommentOwner())),
q($objem->getComment()));
}
echo "</td></table><td /><td /></tr>\n";
/**
* Print a table of error reports.
- * Prints a table with several error reports by calling printErrorReport() for each report.
+ * Prints a table with several error reports by calling printErrorReport()
+ * for each report.
* @param $arobjem (array of errorReport objects) The reports to print
*/
public public function printErrorReports($arobjem) {
/**
* Set the link to the edit page.
- * The specified page must handle the <tt>uid</tt> GET parameter, which contains the unique ID
- * of the error report to be edited.
+ * The specified page must handle the <tt>uid</tt> GET parameter, which
+ * contains the unique ID of the error report to be edited.
* @see getEditURL()
* @see getEditLink()
* @param $strUrl (string)
* @return string
*/
public function getEditLink($nUid) {
- return sprintf("<a %s title='%s'>%s</a>", pop($this->getEditURL($nUid), 500, 500),
- _c("error-reporter:Edit this error report"), icon("write"));
+ return sprintf("<a %s title='%s'>%s</a>", pop($this->getEditURL($nUid),
+ 500, 500), _c("error-reporter:Edit this error report"), icon("write"));
}
/**
* Set the link to the delete page.
- * The specified page must handle the <tt>uid</tt> GET parameter, which contains the unique ID
- * of the error report to be deleted.
+ * The specified page must handle the <tt>uid</tt> GET parameter, which
+ * contains the unique ID of the error report to be deleted.
* @see getDeleteURL()
* @see getDeleteLink()
* @param $strUrl (string)
_c("error-reporter:Delete this error report"), icon("trash"));
}
}
-?>
\ No newline at end of file
+?>