summaryrefslogtreecommitdiffstats
path: root/application/modules/user
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/user')
-rw-r--r--application/modules/user/controllers/AuthController.php1
-rw-r--r--application/modules/user/controllers/ClientController.php82
-rw-r--r--application/modules/user/controllers/IndexController.php24
-rw-r--r--application/modules/user/controllers/PoolController.php35
-rw-r--r--application/modules/user/forms/Client.php46
-rw-r--r--application/modules/user/layouts/user.phtml4
-rw-r--r--application/modules/user/views/scripts/client/addclient.phtml3
-rw-r--r--application/modules/user/views/scripts/client/editclient.phtml3
-rw-r--r--application/modules/user/views/scripts/client/index.phtml43
-rw-r--r--application/modules/user/views/scripts/client/removeclient.phtml1
-rw-r--r--application/modules/user/views/scripts/index/index.phtml17
-rw-r--r--application/modules/user/views/scripts/pool/createpool.phtml1
-rw-r--r--application/modules/user/views/scripts/pool/deletepool.phtml1
-rw-r--r--application/modules/user/views/scripts/pool/editpool.phtml1
-rw-r--r--application/modules/user/views/scripts/pool/linkclient.phtml1
-rw-r--r--application/modules/user/views/scripts/pool/unlinkclient.phtml1
16 files changed, 251 insertions, 13 deletions
diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php
index 4721616..76dc243 100644
--- a/application/modules/user/controllers/AuthController.php
+++ b/application/modules/user/controllers/AuthController.php
@@ -11,6 +11,7 @@ class User_AuthController extends Zend_Controller_Action
public function indexAction()
{
// action body
+ $_SESSION['membershipID'] = 1;
}
diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php
index 54280f4..f5f1810 100644
--- a/application/modules/user/controllers/ClientController.php
+++ b/application/modules/user/controllers/ClientController.php
@@ -2,17 +2,97 @@
class User_ClientController extends Zend_Controller_Action
{
-
+ private $membership;
public function init()
{
/* Initialize action controller here */
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $membershipMapper->find($_SESSION['membershipID'],$this->membership);
}
public function indexAction()
{
+ // TODO: ACL: is he athorized to see this ?
+
+ // Get the Clients which booted with a bootiso of this group
+ $result = $this->_request->getParam('deleteresult');
+ if($result != ""){
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete',$result);
+ }
+ $clientMapper = new Application_Model_ClientMapper();
+ $clientsInGroup = $clientMapper->findBy('groupID',$this->membership->getGroupID());
+ # print_a($clientsInGroup);
+
+ $this->view->clients = $clientsInGroup;
+
+ }
+
+ public function addclientAction()
+ {
// action body
}
+ public function removeclientAction()
+ {
+ $clientID = $this->_request->getParam('clientID');
+ // TODO: ACL: is he authorized to delete clients?
+ $clientMapper = new Application_Model_ClientMapper();
+ if(is_numeric($clientID)){
+ $client = new Application_Model_Client();
+ $clientMapper->find($clientID,$client);
+ // TODO: ACL: Is He authorized to delete
+ if($client->getGroupID() == $this->membership->getGroupID()){
+ $clientMapper = new Application_Model_ClientMapper();
+ $clientMapper->delete($client);
+ $this->_redirect('/user/client/index/deleteresult/ok');
+ }
+ else{
+ $this->_redirect('/user/client/index/deleteresult/forbidden');
+ }
+ }
+ $this->_redirect('/user/client/index/deleteresult/error');
+ }
+
+ public function editclientAction(){
+
+ if (!isset($_POST["add"])){
+ $clientID = $this->_request->getParam('clientID');
+ $client = new Application_Model_Client();
+ $mapper = new Application_Model_ClientMapper();
+ $mapper->find($clientID,$client);
+
+ if($client->getGroupID() == $this->membership->getGroupID()){
+ # print_a($this);die();
+ $editclient = new user_Form_Client(array('buttontext' => 'Edit Client'));
+ $editclient->populate($client->toArray());
+ $this->view->editclient = $editclient;
+ }
+ else{
+ $this->_redirect('/user/client/index/modifyresult/error');
+ }
+ }
+ else{
+ $editclient = new user_Form_Client(array('buttontext' => 'Edit Client','groups'=>$groups),$_POST);
+ if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
+ $client = new Application_Model_Client($_POST);
+ $client->setID($this->_request->getParam('clientID'));
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->save($client);
+ print_a('updated');
+ $this->_redirect('/dev/client');
+ }
+ $this->view->editclient = $editclient;
+ }
+ }
+
}
+
+
+
+
+
+
diff --git a/application/modules/user/controllers/IndexController.php b/application/modules/user/controllers/IndexController.php
index 1d41157..8b295e0 100644
--- a/application/modules/user/controllers/IndexController.php
+++ b/application/modules/user/controllers/IndexController.php
@@ -2,20 +2,26 @@
class User_IndexController extends Zend_Controller_Action
{
-
public function init()
{
/* Initialize action controller here */
}
- public function indexAction()
- {
- $n = new Pbs_PbsSession();
- $session = new Application_Model_Session();
- $session->setID('1');
- $n->createsession($session);
+ public function indexAction()
+ {
+ if (!Zend_Auth::getInstance()->hasIdentity()) {
+ $this->view->text = 'Your not logged in, please log in first <a href="/user/auth/">here</a>.';
+ }
+ else{
+ $this->view->text = "You're Welcome";
+ $links = array(
+ '/user/person' => 'Change your Details',
+ '/user/person/request' => 'Request Membership in a Group',
+ '/user/config' => 'Create your own Configuration',
+ '/user/bootmenu' => 'Create your Bootmenu',
+ );
+ }
+ $this->view->links = $links;
}
-
-
}
diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php
index caa7dd4..cf4dfe7 100644
--- a/application/modules/user/controllers/PoolController.php
+++ b/application/modules/user/controllers/PoolController.php
@@ -13,6 +13,41 @@ class User_PoolController extends Zend_Controller_Action
// action body
}
+ public function createpoolAction()
+ {
+ // action body
+ }
+
+ public function deletepoolAction()
+ {
+ // action body
+ }
+
+ public function editpoolAction()
+ {
+ // action body
+ }
+
+ public function linkclientAction()
+ {
+ // action body
+ }
+
+ public function unlinkclientAction()
+ {
+ // action body
+ }
+
}
+
+
+
+
+
+
+
+
+
+
diff --git a/application/modules/user/forms/Client.php b/application/modules/user/forms/Client.php
new file mode 100644
index 0000000..a79ede1
--- /dev/null
+++ b/application/modules/user/forms/Client.php
@@ -0,0 +1,46 @@
+<?php
+
+class user_Form_Client extends Zend_Form
+{
+
+ public function init()
+ {
+ $this->setName("pool");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'macadress', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'MacAdress:',
+ ));
+ $this->addElement('text', 'hardwarehash', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Hardwarehash:',
+ ));
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/client"'
+ ));
+ }
+ private $buttontext = 'Save';
+ private $groups;
+ function setButtontext($v){
+ $this->buttontext = $v;
+ }
+
+
+}
+
diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml
index 91e5eb8..36d73b4 100644
--- a/application/modules/user/layouts/user.phtml
+++ b/application/modules/user/layouts/user.phtml
@@ -23,8 +23,8 @@ echo $this->headScript()."\n";
<div id='sidepannel'>
<div id="logo"><div id="logo-bar-gray"></div></div>
<div id="sidepannel-top">
+ <h1><a href=/><</a> <a href=/user/>user</a></h1>
<ul>
- <h1>user</h1>
<li>Controller:
<ul>
<li><a href='/user/person'>Person</a></li>
@@ -37,7 +37,7 @@ echo $this->headScript()."\n";
<li><a href='/user/client'>Client</a></li>
<li><a href='/user/filter'>Filter</a></li>
<li><a href='/user/pool'>Pool</a></li>
-
+ <li><a href='/user/auth'>Auth</a></li>
<?php if (!Zend_Auth::getInstance()->hasIdentity()) {?>
<li><a href='/user/auth/login'>Login</a></li>
<li><a href='/user/auth/register'>Register</a></li>
diff --git a/application/modules/user/views/scripts/client/addclient.phtml b/application/modules/user/views/scripts/client/addclient.phtml
new file mode 100644
index 0000000..13511fb
--- /dev/null
+++ b/application/modules/user/views/scripts/client/addclient.phtml
@@ -0,0 +1,3 @@
+<?php
+echo $this->addclient;
+?>
diff --git a/application/modules/user/views/scripts/client/editclient.phtml b/application/modules/user/views/scripts/client/editclient.phtml
new file mode 100644
index 0000000..2753a0f
--- /dev/null
+++ b/application/modules/user/views/scripts/client/editclient.phtml
@@ -0,0 +1,3 @@
+<?php
+echo $this->editclient;
+?>
diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml
index 4f0e6ec..dd791ad 100644
--- a/application/modules/user/views/scripts/client/index.phtml
+++ b/application/modules/user/views/scripts/client/index.phtml
@@ -1 +1,42 @@
-<br /><br /><center>View script for controller <b>Client</b> and script/action name <b>index</b></center> \ No newline at end of file
+<h1>Clients</h1>
+<?php if($this->notification != ''){echo $this->notification;} ?>
+<?php echo $this->formButton('createbootos', 'Create Client', array(
+ 'onclick' => 'self.location="/user/client/addclient"',
+ 'class' => 'addbutton'))?>
+
+<?php if ($this->clients): ?>
+ <table>
+ <tr>
+ <th>MAC</th>
+ <th>Hardwarehash</th>
+ <th colspan=2>Actions</th>
+ </tr>
+ <?php foreach ($this->clients as $client): ?>
+ <tr class=entry>
+ <td class='monospace'><?php echo $this->escape($client['macadress']) ?></td>
+ <td class='monospace'><?php echo $this->escape($client['hardwarehash']) ?></td>
+ <td class='action'><a href="<?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'client',
+ 'action' => 'editclient',
+ 'clientID' => $client['clientID']
+ ),
+ 'default',
+ true) ?>"><img src='/media/img/edit.png' alt='Edit Client'/></a></td>
+ <td class='action'><a href="<?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'client',
+ 'action' => 'removeclient',
+ 'clientID' => $client['clientID']
+ ),
+ 'default',
+ true) ?>"><img src='/media/img/delete.png' alt='Delete Client'/></a></td>
+ </tr>
+ <?php endforeach ?>
+ </table>
+
+<?php else: ?>
+ <p>There are no clients to display.</p>
+<?php endif;?>
diff --git a/application/modules/user/views/scripts/client/removeclient.phtml b/application/modules/user/views/scripts/client/removeclient.phtml
new file mode 100644
index 0000000..97254f6
--- /dev/null
+++ b/application/modules/user/views/scripts/client/removeclient.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Client</b> and script/action name <b>removeclient</b></center> \ No newline at end of file
diff --git a/application/modules/user/views/scripts/index/index.phtml b/application/modules/user/views/scripts/index/index.phtml
index 57e6edb..a6e84a7 100644
--- a/application/modules/user/views/scripts/index/index.phtml
+++ b/application/modules/user/views/scripts/index/index.phtml
@@ -1 +1,18 @@
<h1>Welcome</h1>
+
+<div class='infobox'>infobox: <?php echo $this->text;?></div>
+<div class='okbox'>okbox: <?php echo $this->text;?></div>
+<div class='warningbox'>warningbox: <?php echo $this->text;?></div>
+<div class='errorbox'>errorbox: <?php echo $this->text;?></div>
+<?php print_a($this->links);?>
+
+<?php if(count($this->links)>0 && is_array($this->links)): ?>
+<ul>
+<?php foreach($this->links as $link => $text):?>
+<li><a href='<?php echo $link;?>'><?php echo $text;?></a></li>
+
+<?php endforeach ?>
+</ul>
+
+<?php endif ?>
+
diff --git a/application/modules/user/views/scripts/pool/createpool.phtml b/application/modules/user/views/scripts/pool/createpool.phtml
new file mode 100644
index 0000000..3d7f8ca
--- /dev/null
+++ b/application/modules/user/views/scripts/pool/createpool.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>createpool</b></center> \ No newline at end of file
diff --git a/application/modules/user/views/scripts/pool/deletepool.phtml b/application/modules/user/views/scripts/pool/deletepool.phtml
new file mode 100644
index 0000000..622e663
--- /dev/null
+++ b/application/modules/user/views/scripts/pool/deletepool.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>deletepool</b></center> \ No newline at end of file
diff --git a/application/modules/user/views/scripts/pool/editpool.phtml b/application/modules/user/views/scripts/pool/editpool.phtml
new file mode 100644
index 0000000..c70464e
--- /dev/null
+++ b/application/modules/user/views/scripts/pool/editpool.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>editpool</b></center> \ No newline at end of file
diff --git a/application/modules/user/views/scripts/pool/linkclient.phtml b/application/modules/user/views/scripts/pool/linkclient.phtml
new file mode 100644
index 0000000..a2f9a6c
--- /dev/null
+++ b/application/modules/user/views/scripts/pool/linkclient.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>linkpool</b></center> \ No newline at end of file
diff --git a/application/modules/user/views/scripts/pool/unlinkclient.phtml b/application/modules/user/views/scripts/pool/unlinkclient.phtml
new file mode 100644
index 0000000..e1d5397
--- /dev/null
+++ b/application/modules/user/views/scripts/pool/unlinkclient.phtml
@@ -0,0 +1 @@
+<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>unlinkpool</b></center> \ No newline at end of file