diff options
-rw-r--r-- | application/models/Client.php | 10 | ||||
-rw-r--r-- | application/models/ClientMapper.php | 15 | ||||
-rw-r--r-- | application/modules/fbgui/controllers/IndexController.php | 1 | ||||
-rw-r--r-- | application/modules/user/controllers/ClientController.php | 12 | ||||
-rw-r--r-- | application/modules/user/controllers/PoolController.php | 7 | ||||
-rw-r--r-- | application/modules/user/views/scripts/client/index.phtml | 3 | ||||
-rw-r--r-- | application/modules/user/views/scripts/pool/index.phtml | 8 | ||||
-rw-r--r-- | setup/pbs-newdata.sql | 17 | ||||
-rw-r--r-- | setup/pbs.sql | 1 |
9 files changed, 57 insertions, 17 deletions
diff --git a/application/models/Client.php b/application/models/Client.php index a63e8ba..e8108ef 100644 --- a/application/models/Client.php +++ b/application/models/Client.php @@ -16,6 +16,7 @@ class Application_Model_Client protected $_groupID; protected $_macadress; protected $_hardwarehash; + protected $_created; public function __construct(array $options = null) { @@ -91,6 +92,15 @@ class Application_Model_Client $this->_hardwarehash = $_hardwarehash; return $this; } + public function getCreated() + { + return $this->_created; + } + public function setCreated($_created) + { + $this->_created = $_created; + return $this; + } /** * Returns current data as associative array using ReflectionClass * diff --git a/application/models/ClientMapper.php b/application/models/ClientMapper.php index d727352..bcb3286 100644 --- a/application/models/ClientMapper.php +++ b/application/models/ClientMapper.php @@ -87,7 +87,8 @@ class Application_Model_ClientMapper $data = array('clientID'=> $client->getID() , 'groupID' => $client->getGroupID(), 'macadress'=> $client->getMacadress() , - 'hardwarehash'=> $client->getHardwarehash() + 'hardwarehash'=> $client->getHardwarehash(), + 'created'=> $client->getCreated() ); if (null === ($id = $client->getID()) ) { @@ -116,7 +117,11 @@ class Application_Model_ClientMapper $row = $result->current(); - $client->setID($row->clientID)->setGroupID($row->groupID)->setMacadress($row->macadress)->setHardwarehash($row->hardwarehash); + $client->setID($row->clientID) + ->setGroupID($row->groupID) + ->setMacadress($row->macadress) + ->setHardwarehash($row->hardwarehash) + ->setCreated($row->created); } public function fetchAll() @@ -126,7 +131,11 @@ class Application_Model_ClientMapper foreach ($resultSet as $row) { $entry = new Application_Model_Client(); - $entry->setID($row->clientID)->setGroupID($row->groupID)->setMacadress($row->macadress)->setHardwarehash($row->hardwarehash); + $entry->setID($row->clientID) + ->setGroupID($row->groupID) + ->setMacadress($row->macadress) + ->setHardwarehash($row->hardwarehash) + ->setCreated($row->created); $entries[] = $entry; } diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index 150f1c5..d2b21be 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -75,6 +75,7 @@ class Fbgui_IndexController extends Zend_Controller_Action $client->setMacadress($mySession->postdata['mac']); $client->setHardwarehash($mySession->postdata['hardwarehash']); $client->setGroupID($groupID); + $client->setCreated(time()); $client = $n->createClient($client); $clientID = $client->getID(); diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 687e910..589fcdc 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -69,7 +69,12 @@ class User_ClientController extends Zend_Controller_Action $clientsInGroup = $mySearch->search($clientsInGroup); } $this->view->searchform = $mySearch->searchForm(); - + + // Format Time-String + foreach($clientsInGroup as $k=>$cig){ + $clientsInGroup[$k]['created'] = date(Zend_Registry::get('dateformat'),$cig['created']); + } + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(10); @@ -111,7 +116,8 @@ class User_ClientController extends Zend_Controller_Action $mac = ($mac!='')?$mac:$_POST['macadress']; $hh = ($hh!='')?$hh:$_POST['hardwarehash']; $client->setMacadress($mac); - $client->setHardwarehash($hh); + $client->setHardwarehash($hh); + $client->setCreated(time()); $client->setGroupID($this->membership->getGroupID()); $clientmapper = new Application_Model_ClientMapper(); $clientmapper->save($client); @@ -178,6 +184,8 @@ class User_ClientController extends Zend_Controller_Action $dbclient = new Application_Model_Client(); $clientMapper = new Application_Model_ClientMapper(); $clientMapper->find($this->_request->getParam('clientID'),$dbclient); + + $client->setCreated($dbclient->getCreated()); if($dbclient->getGroupID() == $this->membership->getGroupID()){ $client->setGroupID($this->membership->getGroupID()); diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index 3d6c0a7..3d6a0f5 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -112,7 +112,12 @@ class User_PoolController extends Zend_Controller_Action // extract the un-assigned clients from the clientlist of the group $freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray); - + + // Format Time-String + foreach($freeclients as $k=>$cig){ + $freeclients[$k]['created'] = date(Zend_Registry::get('dateformat'),$cig['created']); + } + if(Pbs_Acl::checkRight('posuc')) $this->view->freeclients = $freeclients; } diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml index b519140..6f7a806 100644 --- a/application/modules/user/views/scripts/client/index.phtml +++ b/application/modules/user/views/scripts/client/index.phtml @@ -11,6 +11,7 @@ <div class='code'>clientID</div> <div class='code'>macadress</div> <div class='code'>hardwarehash</div> + <div class='code'>created</div> </div> <div class='listelement'> @@ -55,6 +56,8 @@ <div class='item'><?php echo $this->escape($client['macadress']) ?></div> <label>Hardwarehash</label> <div class='item'><?php echo $this->escape($client['hardwarehash']) ?></div> + <label>Created</label> + <div class='item'><?php echo $this->escape($client['created']) ?></div> </div> </div> <div class='clear'></div> diff --git a/application/modules/user/views/scripts/pool/index.phtml b/application/modules/user/views/scripts/pool/index.phtml index 56ae8d5..f78df6a 100644 --- a/application/modules/user/views/scripts/pool/index.phtml +++ b/application/modules/user/views/scripts/pool/index.phtml @@ -144,7 +144,7 @@ <div class='content'> <div class='actions'> <?php if(Pbs_Acl::checkRight('polc')):?> - <select onChange="location.href=this.options[this.selectedIndex].value"> + Pool:<select onChange="location.href=this.options[this.selectedIndex].value"> <option></option> <?php foreach ($this->pools as $pool): ?> <option value="<?php echo $this->url( @@ -165,9 +165,11 @@ </div> <div class='details'> <label>MacAdress</label> - <div class='item'><?php echo $client['macadress']; ?></div> + <div class='item'><?php echo $this->escape($client['macadress']); ?></div> <label>HardwareHash</label> - <div class='item'><?php echo $client['hardwarehash']; ?></div> + <div class='item'><?php echo $this->escape($client['hardwarehash']); ?></div> + <label>Created</label> + <div class='item'><?php echo $this->escape($client['created']) ?></div> </div> </div> <div class='clear'></div> diff --git a/setup/pbs-newdata.sql b/setup/pbs-newdata.sql index e648920..2778d87 100644 --- a/setup/pbs-newdata.sql +++ b/setup/pbs-newdata.sql @@ -62,14 +62,6 @@ INSERT INTO `pbs_config` (`configID`, `title`, `groupID`, `membershipID`, `visib (1, 'Default Config', 1, null, '1', '1299693677'), (2, 'Config 2', null, 1, '1', '1299693690'); --- Adding bootosuser -INSERT INTO `pbs_bootosuser` (`bootosuserID`, `configID`, `login`, `password`, `homepath`, `hometypeID`) VALUES -(1, 1, 'login1', 'password1', null, 0), -(2, 1, 'login2', 'password2', null, 1), -(3, 1, 'login3', 'password3', '/home/bla/blub', 2), -(4, 4, 'login4', 'password4', null, 0), -(5, 4, 'login5', 'password5', null, 1); - -- Adding hometype INSERT INTO `pbs_hometype` (`hometypeID`, `name`) VALUES (0, 'standard'), @@ -78,6 +70,15 @@ INSERT INTO `pbs_hometype` (`hometypeID`, `name`) VALUES (3, 'extern'), (4, 'dropbox'); +-- Adding bootosuser +INSERT INTO `pbs_bootosuser` (`bootosuserID`, `configID`, `login`, `password`, `homepath`, `hometypeID`) VALUES +(1, 1, 'login1', 'password1', null, 0), +(2, 1, 'login2', 'password2', null, 1), +(3, 1, 'login3', 'password3', '/home/bla/blub', 2), +(4, 2, 'login4', 'password4', null, 0), +(5, 2, 'login5', 'password5', null, 1); + + -- Adding bootos INSERT INTO `pbs_bootos` (`bootosID`, `path_config`, `groupID`, `membershipID`, `title`, `description`, `path_init`, `path_kernel`, `defaultkcl`, `created`, `expires`, `public`, `source`, `distro`, `distroversion`, `shortname`, `share`) VALUES (1, 'configpath 1', 1, 1, 'BootOs 1', 'Description 1', 'initpath 1', 'kernelpath 1', 'default kcl 1', '1299693782', '2012-03-09', 0, null, null, null, null, null), diff --git a/setup/pbs.sql b/setup/pbs.sql index 8a59fbb..6614abb 100644 --- a/setup/pbs.sql +++ b/setup/pbs.sql @@ -264,6 +264,7 @@ CREATE TABLE IF NOT EXISTS `pbs_client` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1; ALTER TABLE `pbs_client` ADD `groupID` INT NOT NULL AFTER `clientID` ; ALTER TABLE `pbs_client` ADD UNIQUE (`macadress`); +ALTER TABLE `pbs_client` ADD `created` INT( 15 ) NOT NULL; ALTER TABLE `pbs_client` ADD CONSTRAINT `pbs_client_ibfk_1` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE; |