From 446191f53387cf830e03cccee2fdf0a0dcc97eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Wed, 31 Jan 2007 02:16:54 +0000 Subject: [PATCH] Add and use vendor::display() --- include/vendor.php | 29 ++++++++++++++++++++++++++++- vendorview.php | 23 +---------------------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/include/vendor.php b/include/vendor.php index 42a2fd1..d87b0e6 100644 --- a/include/vendor.php +++ b/include/vendor.php @@ -148,11 +148,38 @@ class Vendor { return FALSE; } - function getOutputEditorValues($aClean) + function getOutputEditorValues($aClean) { $this->sName = $aClean['sVendorName']; $this->sWebpage = $aClean['sVendorWebpage']; } + + function display() + { + echo 'Vendor Name: '.$this->sName,"\n"; + if($this->canEdit()) + { + echo "[iVendorId\">edit]"; + } + + echo '
',"\n"; + if ($this->sWebpage) + echo 'Vendor URL: '. + $this->sWebpage.'
',"\n"; + + + if($this->aApplicationsIds) + { + echo '
Applications by '.$this->sName.'
    ',"\n"; + foreach($this->aApplicationsIds as $iAppId) + { + $oApp = new Application($iAppId); + echo '
  1. '. + $oApp->sName.'
  2. ',"\n"; + } + echo '
',"\n"; + } + } } /* Get the total number of Vendors in the database */ diff --git a/vendorview.php b/vendorview.php index c61bea1..b085106 100644 --- a/vendorview.php +++ b/vendorview.php @@ -33,28 +33,7 @@ if($oVendor->iVendorId) apidb_header("View Vendor"); echo html_frame_start("Vendor Information",500); - echo 'Vendor Name: '.$oVendor->sName,"\n"; - if($_SESSION['current']->hasPriv("admin")) - { - echo ' [edit]',"\n"; - } - - echo '
',"\n"; - if ($oVendor->sWebpage) - echo 'Vendor URL: '.$oVendor->sWebpage.'
',"\n"; - - - if($oVendor->aApplicationsIds) - { - echo '
Applications by '.$oVendor->sName.'
    ',"\n"; - foreach($oVendor->aApplicationsIds as $iAppId) - { - $oApp = new Application($iAppId); - echo '
  1. '.$oApp->sName.'
  2. ',"\n"; - } - echo '
',"\n"; - } - + $oVendor->display(); echo html_frame_end(); echo html_back_link(1);