X-Git-Url: https://git.rohieb.name/iserv-mod-error-reporter.git/blobdiff_plain/3e05075cf3aeff4d23dc9eba7af236ea47cb919d..0c5bb7077fe9691e785bd5c160bacbe533ffa5a7:/inc/class_erErrorReportView.inc
diff --git a/inc/class_erErrorReportView.inc b/inc/class_erErrorReportView.inc
index 914393d..590205e 100644
--- a/inc/class_erErrorReportView.inc
+++ b/inc/class_erErrorReportView.inc
@@ -35,59 +35,55 @@ require_once("format.inc");
/** @todo document */
class erErrorReportView {
- /**
- * (object of 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 uid GET parameter, which contains the unique ID
- * of the error report to be edited.
+ * The specified page must handle the uid 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 uid GET parameter, which contains the unique ID
- * of the error report to be deleted.
+ * The specified page must handle the uid 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
- * 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
*/
- public function __construct(erConfig &$objcfg, erErrorReportManager &$objemm) {
- $this->objcfg = $objcfg;
+ public function __construct(erErrorReportManager &$objemm) {
$this->objManager = $objemm;
html_header("");
}
/**
* 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 (true) or several
- * times to get a compound table of reports (false).
- * @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
+ * (true) or several times to get a compound table of reports
+ * (false).
+ * @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;
@@ -96,25 +92,29 @@ class erErrorReportView {
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 "
";
- if($this->objcfg->userIsAdmin() or $this->objManager->userIsOwner($objem->getUid())) {
+ if(erConfig::userIsAdmin() or
+ $this->objManager->userIsOwner($objem->getUid())) {
// user is admin or owner
echo "<{$GLOBALS["invtbl"]} width='100%'>\n";
- echo sprintf(" |
%s | %s |
",
- _c("error-reporter:Reported by:"), erMailToUserLink($objem->getOwner()));
- echo sprintf("%s | %s |
\n",
- _c("error-reporter:Date:"), SmartDate($objem->getDate()));
- echo sprintf("%s | %s |
\n",
- _c("error-reporter:Affected machine:"), q($objem->getMachine()));
- echo sprintf("%s | %s |
\n",
- _c("error-reporter:Text:"), q($objem->getText()));
- echo sprintf("%s | %s |
\n",
- _c("error-reporter:Hidden:"), $objem->isHidden() ? _c("error-reporter:yes") : _c("error-reporter:no"));
+ $sRow = "%s | %s |
";
+ 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("
\n",
- sprintf(_c("error-reporter:Comment by %s:"), erMailToUserLink($objem->getCommentOwner())),
+ echo sprintf("%s |
\n",
+ sprintf(_c("error-reporter:Comment by %s:"),
+ erMailToUserLink($objem->getCommentOwner())),
q($objem->getComment()));
}
echo "\n";
@@ -122,20 +122,23 @@ class erErrorReportView {
if($bAdminButtons) {
echo sprintf("%s | ".
"%s | ",
- $this->getEditLink($objem->getUid()), $this->getDeleteLink($objem->getUid()));
+ $this->getEditLink($objem->getUid()),
+ $this->getDeleteLink($objem->getUid()));
}
echo "\n";
} else {
// user can only read the report
echo "<{$GLOBALS["invtbl"]} width='100%'>\n";
- echo sprintf(" | %s | %s |
\n",
- _c("error-reporter:Affected machine:"), $objem->getMachine());
- echo sprintf("%s | %s |
\n",
- _c("error-reporter:Text:"), $objem->getText());
+ $sRow = "%s | %s |
";
+ 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("
\n",
- sprintf(_c("error-reporter:Comment by %s:"), erMailToUserLink($objem->getCommentOwner())),
+ echo sprintf("%s |
\n",
+ sprintf(_c("error-reporter:Comment by %s:"),
+ erMailToUserLink($objem->getCommentOwner())),
q($objem->getComment()));
}
echo " | | \n";
@@ -148,7 +151,8 @@ class erErrorReportView {
/**
* 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) {
@@ -170,8 +174,8 @@ class erErrorReportView {
/**
* Set the link to the edit page.
- * The specified page must handle the uid GET parameter, which contains the unique ID
- * of the error report to be edited.
+ * The specified page must handle the uid GET parameter, which
+ * contains the unique ID of the error report to be edited.
* @see getEditURL()
* @see getEditLink()
* @param $strUrl (string)
@@ -202,14 +206,14 @@ class erErrorReportView {
* @return string
*/
public function getEditLink($nUid) {
- return sprintf("%s", pop($this->getEditURL($nUid), 500, 500),
- _c("error-reporter:Edit this error report"), icon("write"));
+ return sprintf("%s", 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 uid GET parameter, which contains the unique ID
- * of the error report to be deleted.
+ * The specified page must handle the uid GET parameter, which
+ * contains the unique ID of the error report to be deleted.
* @see getDeleteURL()
* @see getDeleteLink()
* @param $strUrl (string)
@@ -244,4 +248,4 @@ class erErrorReportView {
_c("error-reporter:Delete this error report"), icon("trash"));
}
}
-?>
\ No newline at end of file
+?>