summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Neves2012-01-26 15:56:42 +0100
committerMichael Neves2012-01-26 15:56:42 +0100
commitdd8dbbcdde46419dd1ad193a8170cde5ca24630b (patch)
tree501f81c7e1dfe00d420175f32bbb36bc39ece3e6
parentAdded Preboottype Model, changed bootiso and preboot model (diff)
downloadpbs2-dd8dbbcdde46419dd1ad193a8170cde5ca24630b.tar.gz
pbs2-dd8dbbcdde46419dd1ad193a8170cde5ca24630b.tar.xz
pbs2-dd8dbbcdde46419dd1ad193a8170cde5ca24630b.zip
Preboot Serial and type in View
-rw-r--r--application/models/BootIso.php10
-rw-r--r--application/models/BootIsoMapper.php8
-rw-r--r--application/models/PreBoot.php10
-rw-r--r--application/models/PreBootMapper.php8
-rw-r--r--application/modules/user/controllers/PrebootController.php3
-rw-r--r--application/modules/user/forms/Preboot.php18
-rw-r--r--application/modules/user/views/scripts/preboot/index.phtml6
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 @@
<div class='code'>prebootID</div>
<div class='code'>title</div>
<div class='code'>description</div>
+ <div class='code'>preboottypeID</div>
+ <div class='code'>serialnumber</div>
<div class='code'>created</div>
<div class='code'>source</div>
</div>
@@ -52,11 +54,13 @@
true) ?>"><img src='/media/img/delete.png' alt='Delete Preboot'/></a>
<?php endif; ?>
</div>
- <div class='title'><?php echo $this->escape($preboot->getTitle()); ?></div>
+ <div class='title'><?php echo $this->escape($preboot->getTitle()); ?> <?php echo $this->escape($preboot->getPreBootTypeID()); ?></div>
<div class='subtitle'><?php echo $this->escape($preboot->getDescription()); ?></div>
<div class='details'>
<label>PrebootID</label>
<div class='item'><?php echo $this->escape($preboot->getID()); ?></div>
+ <label>Serialnumber</label>
+ <div class='item'><?php echo $this->escape($preboot->getSerialnumber()); ?></div>
<label>Source</label>
<div class='item'><?php echo $this->escape($preboot->getSource()); ?></div>
<label>Changed</label>