From dd8dbbcdde46419dd1ad193a8170cde5ca24630b Mon Sep 17 00:00:00 2001 From: Michael Neves Date: Thu, 26 Jan 2012 15:56:42 +0100 Subject: Preboot Serial and type in View --- application/models/BootIso.php | 10 +++++----- application/models/BootIsoMapper.php | 8 ++++---- application/models/PreBoot.php | 10 +++++----- application/models/PreBootMapper.php | 8 ++++---- .../modules/user/controllers/PrebootController.php | 3 +++ application/modules/user/forms/Preboot.php | 18 ++++++++++++++++++ .../modules/user/views/scripts/preboot/index.phtml | 6 +++++- 7 files changed, 44 insertions(+), 19 deletions(-) diff --git a/application/models/BootIso.php b/application/models/BootIso.php index e1c9bd8..967a612 100644 --- a/application/models/BootIso.php +++ b/application/models/BootIso.php @@ -16,7 +16,7 @@ class Application_Model_BootIso { protected $_description; protected $_membershipID; protected $_groupID; - protected $_typeID; + protected $_preboottypeID; protected $_serialnumber; protected $_created; protected $_expires; @@ -88,11 +88,11 @@ class Application_Model_BootIso { return $this; } - public function getTypeID() { - return $this->_typeID; + public function getPreBootTypeID() { + return $this->_preboottypeID; } - public function setTypeID($_typeID) { - $this->_typeID = $_typeID; + public function setPreBootTypeID($_preboottypeID) { + $this->_preboottypeID = $_preboottypeID; return $this; } diff --git a/application/models/BootIsoMapper.php b/application/models/BootIsoMapper.php index dbe1685..b6572c6 100644 --- a/application/models/BootIsoMapper.php +++ b/application/models/BootIsoMapper.php @@ -77,7 +77,7 @@ class Application_Model_BootIsoMapper { public function save(Application_Model_BootIso $botiso) { - $data = array('bootisoID' => $botiso->getID() , 'membershipID' => $botiso->getMembershipID() , 'title' => $botiso->getTitle() , 'groupID' => $botiso->getGroupID() , 'typeID' => $botiso->getTypeID(), 'serialnumber' => $botiso->getSerialnumber() , 'created' => $botiso->getCreated() , 'expires' => $botiso->getExpires() , 'public' => $botiso->getPublic(), 'description' => $botiso->getDescription() ); + $data = array('bootisoID' => $botiso->getID() , 'membershipID' => $botiso->getMembershipID() , 'title' => $botiso->getTitle() , 'groupID' => $botiso->getGroupID() , 'preboottypeID' => $botiso->getPreBootTypeID(), 'serialnumber' => $botiso->getSerialnumber() , 'created' => $botiso->getCreated() , 'expires' => $botiso->getExpires() , 'public' => $botiso->getPublic(), 'description' => $botiso->getDescription() ); if (null === ($id = $botiso->getID()) ) { unset($data['bootisoID']); @@ -105,10 +105,10 @@ class Application_Model_BootIsoMapper { if($botiso == null) { $botiso = new Application_Model_BootIso(); - $botiso->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setTypeID($row->typeID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description); + $botiso->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setPreBootTypeID($row->preboottypeID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description); return $botiso; } else { - $botiso->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setTypeID($row->typeID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description); + $botiso->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setPreBootTypeID($row->preboottypeID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description); } } @@ -118,7 +118,7 @@ class Application_Model_BootIsoMapper { foreach ($resultSet as $row) { $entry = new Application_Model_BootIso(); - $entry->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setTypeID($row->typeID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description); + $entry->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setPreBootTypeID($row->preboottypeID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description); $entries[] = $entry; } diff --git a/application/models/PreBoot.php b/application/models/PreBoot.php index 61cdf93..5b78e4d 100644 --- a/application/models/PreBoot.php +++ b/application/models/PreBoot.php @@ -15,7 +15,7 @@ class Application_Model_PreBoot { protected $_title; protected $_membershipID; protected $_groupID; - protected $_typeID; + protected $_preboottypeID; protected $_serialnumber; protected $_source; protected $_created; @@ -81,12 +81,12 @@ class Application_Model_PreBoot { $this->_groupID = $_groupID; return $this; } - public function getTypeID() { - return $this->_typeID; + public function getPreBootTypeID() { + return $this->_preboottypeID; } - public function setTypeID($_typeID) { - $this->_typeID = $_typeID; + public function setPreBootTypeID($_typeID) { + $this->_preboottypeID = $_preboottypeID; return $this; } public function getSerialnumber() { diff --git a/application/models/PreBootMapper.php b/application/models/PreBootMapper.php index f0bba2a..ac86d3c 100644 --- a/application/models/PreBootMapper.php +++ b/application/models/PreBootMapper.php @@ -81,7 +81,7 @@ class Application_Model_PreBootMapper { public function save(Application_Model_PreBoot $preboot) { - $data = array('prebootID' => $preboot->getID() , 'membershipID' => $preboot->getMembershipID() , 'title' => $preboot->getTitle() , 'groupID' => $preboot->getGroupID(), 'typeID' => $preboot->getTypeID(), 'serialnumber' => $preboot->getSerialnumber(), 'created' => $preboot->getCreated(), 'source' => $preboot->getSource(), 'description' => $preboot->getDescription()); + $data = array('prebootID' => $preboot->getID() , 'membershipID' => $preboot->getMembershipID() , 'title' => $preboot->getTitle() , 'groupID' => $preboot->getGroupID(), 'preboottypeID' => $preboot->getPreBootTypeID(), 'serialnumber' => $preboot->getSerialnumber(), 'created' => $preboot->getCreated(), 'source' => $preboot->getSource(), 'description' => $preboot->getDescription()); if (null === ($id = $preboot->getID()) ) { unset($data['prebootID']); @@ -110,10 +110,10 @@ class Application_Model_PreBootMapper { if($preboot == null) { $preboot = new Application_Model_PreBoot(); - $preboot->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setTypeID($row->typeID)->setSerialnumber($row->serialnumber)->setSource($row->source)->setCreated($row->created)->setDescription($row->description); + $preboot->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setPreBootTypeID($row->preboottypeID)->setSerialnumber($row->serialnumber)->setSource($row->source)->setCreated($row->created)->setDescription($row->description); return $preboot; } else { - $preboot->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setTypeID($row->typeID)->setSerialnumber($row->serialnumber)->setSource($row->source)->setCreated($row->created)->setDescription($row->description); + $preboot->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setPreBootTypeID($row->preboottypeID)->setSerialnumber($row->serialnumber)->setSource($row->source)->setCreated($row->created)->setDescription($row->description); } } @@ -123,7 +123,7 @@ class Application_Model_PreBootMapper { foreach ($resultSet as $row) { $entry = new Application_Model_PreBoot(); - $entry->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setTypeID($row->typeID)->setSerialnumber($row->serialnumber)->setSource($row->source)->setCreated($row->created)->setDescription($row->description); + $entry->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setPreBootTypeID($row->preboottypeID)->setSerialnumber($row->serialnumber)->setSource($row->source)->setCreated($row->created)->setDescription($row->description); $entries[] = $entry; } diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php index 746cab7..4f83820 100644 --- a/application/modules/user/controllers/PrebootController.php +++ b/application/modules/user/controllers/PrebootController.php @@ -61,9 +61,12 @@ class User_PrebootController extends Zend_Controller_Action { if(!Pbs_Acl::checkRight('pro')) { $this->_redirect('/user/index'); } + $preboottypeMapper = new Application_Model_PreBootTypeMapper(); + $this->view->prebootlist = $this->prebootMapper->findBy(array("groupID" => $groupID)); foreach ($this->view->prebootlist as $preboot) { $preboot->setCreated(date(Zend_Registry::get('dateformat'), $preboot->getCreated())); + $preboot->setPreBootTypeID($preboottypeMapper->find($preboot->getPreBootTypeID())->getName()); } // Search diff --git a/application/modules/user/forms/Preboot.php b/application/modules/user/forms/Preboot.php index 75fc471..bb90f65 100644 --- a/application/modules/user/forms/Preboot.php +++ b/application/modules/user/forms/Preboot.php @@ -57,6 +57,24 @@ class user_Form_Preboot extends Zend_Form { 'cols' => 50, 'label' => 'Description:', )); + + $serial = time(); + for($i = 2; $i < 14; $i += 3) + { + $serial = substr($serial, 0, $i) .'-'. substr($serial, $i, strlen($serial)); + } + + $this->addElement('text', 'serialnumber', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'size' => 50, + 'label' => 'Serialnumber:', + 'readOnly' => $meta, + 'value' => $serial + )); $this->addElement('file', 'preboot', array( 'validators' => array(array('Extension', false, array('zip'))), diff --git a/application/modules/user/views/scripts/preboot/index.phtml b/application/modules/user/views/scripts/preboot/index.phtml index c6fdb79..d332800 100644 --- a/application/modules/user/views/scripts/preboot/index.phtml +++ b/application/modules/user/views/scripts/preboot/index.phtml @@ -12,6 +12,8 @@
prebootID
title
description
+
preboottypeID
+
serialnumber
created
source
@@ -52,11 +54,13 @@ true) ?>">Delete Preboot -
escape($preboot->getTitle()); ?>
+
escape($preboot->getTitle()); ?> escape($preboot->getPreBootTypeID()); ?>
escape($preboot->getDescription()); ?>
escape($preboot->getID()); ?>
+ +
escape($preboot->getSerialnumber()); ?>
escape($preboot->getSource()); ?>
-- cgit v1.2.3-55-g7522