summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/Bootstrap.php123
-rw-r--r--application/Functions.php54
-rw-r--r--application/controllers/ErrorController.php103
-rw-r--r--application/controllers/IndexController.php69
-rw-r--r--application/controllers/ResourceController.php1092
-rw-r--r--application/controllers/StatsController.php92
-rw-r--r--application/models/BootIso.php368
-rw-r--r--application/models/BootIsoMapper.php268
-rw-r--r--application/models/BootMenu.php272
-rw-r--r--application/models/BootMenuEntries.php288
-rw-r--r--application/models/BootMenuEntriesMapper.php350
-rw-r--r--application/models/BootMenuMapper.php316
-rw-r--r--application/models/BootOs.php398
-rw-r--r--application/models/BootOsMapper.php276
-rw-r--r--application/models/BootOsUser.php254
-rw-r--r--application/models/BootOsUserMapper.php276
-rw-r--r--application/models/Client.php236
-rw-r--r--application/models/ClientMapper.php290
-rw-r--r--application/models/Config.php292
-rw-r--r--application/models/ConfigMapper.php280
-rw-r--r--application/models/DbTable/BootIso.php23
-rw-r--r--application/models/DbTable/BootMenu.php23
-rw-r--r--application/models/DbTable/BootMenuEntries.php23
-rw-r--r--application/models/DbTable/BootOs.php23
-rw-r--r--application/models/DbTable/BootOsUser.php23
-rw-r--r--application/models/DbTable/Client.php23
-rw-r--r--application/models/DbTable/Config.php23
-rw-r--r--application/models/DbTable/Filter.php23
-rw-r--r--application/models/DbTable/FilterEntries.php23
-rw-r--r--application/models/DbTable/FilterType.php23
-rw-r--r--application/models/DbTable/Group.php23
-rw-r--r--application/models/DbTable/GroupGroups.php23
-rw-r--r--application/models/DbTable/GroupRequest.php23
-rw-r--r--application/models/DbTable/HomeType.php23
-rw-r--r--application/models/DbTable/Membership.php23
-rw-r--r--application/models/DbTable/PasswordRecovery.php23
-rw-r--r--application/models/DbTable/Person.php23
-rw-r--r--application/models/DbTable/Pool.php23
-rw-r--r--application/models/DbTable/PoolEntries.php23
-rw-r--r--application/models/DbTable/PreBoot.php23
-rw-r--r--application/models/DbTable/Right.php23
-rw-r--r--application/models/DbTable/RightCategory.php23
-rw-r--r--application/models/DbTable/RightRoles.php23
-rw-r--r--application/models/DbTable/Role.php23
-rw-r--r--application/models/DbTable/Session.php23
-rw-r--r--application/models/Filter.php290
-rw-r--r--application/models/FilterEntries.php236
-rw-r--r--application/models/FilterEntriesMapper.php324
-rw-r--r--application/models/FilterMapper.php294
-rw-r--r--application/models/FilterType.php182
-rw-r--r--application/models/FilterTypeMapper.php268
-rw-r--r--application/models/Group.php200
-rw-r--r--application/models/GroupGroups.php182
-rw-r--r--application/models/GroupGroupsMapper.php320
-rw-r--r--application/models/GroupMapper.php272
-rw-r--r--application/models/GroupRequest.php218
-rw-r--r--application/models/GroupRequestMapper.php270
-rw-r--r--application/models/HomeType.php180
-rw-r--r--application/models/HomeTypeMapper.php280
-rw-r--r--application/models/Membership.php258
-rw-r--r--application/models/MembershipMapper.php280
-rw-r--r--application/models/PasswordRecovery.php186
-rw-r--r--application/models/PasswordRecoveryMapper.php274
-rw-r--r--application/models/Person.php442
-rw-r--r--application/models/PersonMapper.php380
-rw-r--r--application/models/Pool.php236
-rw-r--r--application/models/PoolEntries.php200
-rw-r--r--application/models/PoolEntriesMapper.php266
-rw-r--r--application/models/PoolMapper.php288
-rw-r--r--application/models/PreBoot.php288
-rw-r--r--application/models/PreBootMapper.php284
-rw-r--r--application/models/Right.php240
-rw-r--r--application/models/RightCategory.php174
-rw-r--r--application/models/RightCategoryMapper.php262
-rw-r--r--application/models/RightMapper.php294
-rw-r--r--application/models/RightRoles.php182
-rw-r--r--application/models/RightRolesMapper.php258
-rw-r--r--application/models/Role.php240
-rw-r--r--application/models/RoleMapper.php268
-rw-r--r--application/models/Session.php344
-rw-r--r--application/models/SessionMapper.php322
-rw-r--r--application/modules/dev/Bootstrap.php36
-rw-r--r--application/modules/dev/controllers/AuthController.php475
-rw-r--r--application/modules/dev/controllers/BootisoController.php351
-rw-r--r--application/modules/dev/controllers/BootmenuController.php605
-rw-r--r--application/modules/dev/controllers/BootosController.php398
-rw-r--r--application/modules/dev/controllers/ClientController.php178
-rw-r--r--application/modules/dev/controllers/ConfigController.php226
-rw-r--r--application/modules/dev/controllers/ErrorController.php103
-rw-r--r--application/modules/dev/controllers/FilterController.php1290
-rw-r--r--application/modules/dev/controllers/GroupController.php488
-rw-r--r--application/modules/dev/controllers/IndexController.php43
-rw-r--r--application/modules/dev/controllers/PersonController.php333
-rw-r--r--application/modules/dev/controllers/PoolController.php316
-rw-r--r--application/modules/dev/controllers/PrebootController.php373
-rw-r--r--application/modules/dev/controllers/ResourceController.php325
-rw-r--r--application/modules/dev/controllers/RoleController.php532
-rw-r--r--application/modules/dev/controllers/SessionController.php347
-rw-r--r--application/modules/dev/forms/AuthDelete.php56
-rw-r--r--application/modules/dev/forms/AuthLogin.php82
-rw-r--r--application/modules/dev/forms/AuthRecoverPassword.php56
-rw-r--r--application/modules/dev/forms/AuthRegister.php218
-rw-r--r--application/modules/dev/forms/BootisoCreate.php220
-rw-r--r--application/modules/dev/forms/BootisoEdit.php206
-rw-r--r--application/modules/dev/forms/BootmenuCreate.php104
-rw-r--r--application/modules/dev/forms/BootmenuEdit.php106
-rw-r--r--application/modules/dev/forms/BootmenuEntriesAdd.php272
-rw-r--r--application/modules/dev/forms/BootmenuEntriesEdit.php276
-rw-r--r--application/modules/dev/forms/BootosCreate.php270
-rw-r--r--application/modules/dev/forms/BootosEdit.php286
-rw-r--r--application/modules/dev/forms/Client.php116
-rw-r--r--application/modules/dev/forms/ConfigCreate.php124
-rw-r--r--application/modules/dev/forms/ConfigEdit.php122
-rw-r--r--application/modules/dev/forms/ConfirmDeleteAccount.php54
-rw-r--r--application/modules/dev/forms/FilterAdd.php126
-rw-r--r--application/modules/dev/forms/FilterEntriesAdd.php288
-rw-r--r--application/modules/dev/forms/FilterEvaluate.php262
-rw-r--r--application/modules/dev/forms/GroupAdd.php114
-rw-r--r--application/modules/dev/forms/GroupEdit.php102
-rw-r--r--application/modules/dev/forms/GroupLink.php116
-rw-r--r--application/modules/dev/forms/GroupRequest.php92
-rw-r--r--application/modules/dev/forms/GroupSelect.php90
-rw-r--r--application/modules/dev/forms/LinkRight.php102
-rw-r--r--application/modules/dev/forms/NewPassword.php82
-rw-r--r--application/modules/dev/forms/PersonEdit.php240
-rw-r--r--application/modules/dev/forms/Pool.php110
-rw-r--r--application/modules/dev/forms/PoolClient.php68
-rw-r--r--application/modules/dev/forms/PrebootCreate.php122
-rw-r--r--application/modules/dev/forms/PrebootEdit.php120
-rw-r--r--application/modules/dev/forms/RoleAdd.php114
-rw-r--r--application/modules/dev/forms/RoleEdit.php114
-rw-r--r--application/modules/dev/forms/Session.php284
-rw-r--r--application/modules/fbgui/Bootstrap.php20
-rw-r--r--application/modules/fbgui/controllers/AuthController.php153
-rw-r--r--application/modules/fbgui/controllers/IndexController.php378
-rw-r--r--application/modules/fbgui/controllers/PersonController.php167
-rw-r--r--application/modules/fbgui/forms/Login.php92
-rw-r--r--application/modules/fbgui/forms/MembershipSelect.php92
-rw-r--r--application/modules/ipxe/controllers/AuthController.php425
-rw-r--r--application/modules/ipxe/controllers/ResourceController.php385
-rw-r--r--application/modules/user/Bootstrap.php20
-rw-r--r--application/modules/user/controllers/AuthController.php477
-rw-r--r--application/modules/user/controllers/BootisoController.php659
-rw-r--r--application/modules/user/controllers/BootmenuController.php1178
-rw-r--r--application/modules/user/controllers/BootosController.php690
-rw-r--r--application/modules/user/controllers/ClientController.php390
-rw-r--r--application/modules/user/controllers/ConfigController.php1064
-rw-r--r--application/modules/user/controllers/FilterController.php995
-rw-r--r--application/modules/user/controllers/GroupController.php1086
-rw-r--r--application/modules/user/controllers/IndexController.php60
-rw-r--r--application/modules/user/controllers/PersonController.php980
-rw-r--r--application/modules/user/controllers/PoolController.php685
-rw-r--r--application/modules/user/controllers/PrebootController.php513
-rw-r--r--application/modules/user/controllers/RoleController.php886
-rw-r--r--application/modules/user/controllers/SessionController.php221
-rw-r--r--application/modules/user/forms/Bootiso.php307
-rw-r--r--application/modules/user/forms/Bootmenu.php142
-rw-r--r--application/modules/user/forms/BootmenuEntries.php328
-rw-r--r--application/modules/user/forms/Bootos.php400
-rw-r--r--application/modules/user/forms/BootosUser.php304
-rw-r--r--application/modules/user/forms/Client.php132
-rw-r--r--application/modules/user/forms/Config.php151
-rw-r--r--application/modules/user/forms/ConfirmDeleteAccount.php54
-rw-r--r--application/modules/user/forms/Filter.php180
-rw-r--r--application/modules/user/forms/FilterEntry.php826
-rw-r--r--application/modules/user/forms/GroupAdd.php118
-rw-r--r--application/modules/user/forms/GroupEdit.php112
-rw-r--r--application/modules/user/forms/GroupLink.php106
-rw-r--r--application/modules/user/forms/GroupRequest.php106
-rw-r--r--application/modules/user/forms/LinkRight.php126
-rw-r--r--application/modules/user/forms/Login.php82
-rw-r--r--application/modules/user/forms/MembershipSelect.php90
-rw-r--r--application/modules/user/forms/NewPassword.php82
-rw-r--r--application/modules/user/forms/PersonEdit.php240
-rw-r--r--application/modules/user/forms/Pool.php114
-rw-r--r--application/modules/user/forms/PoolClient.php92
-rw-r--r--application/modules/user/forms/Preboot.php168
-rw-r--r--application/modules/user/forms/RecoverPassword.php56
-rw-r--r--application/modules/user/forms/Register.php214
-rw-r--r--application/modules/user/forms/RoleAdd.php228
-rw-r--r--application/modules/user/forms/RoleEdit.php134
-rw-r--r--library/Pbs/Acl.php81
-rw-r--r--library/Pbs/Controller/Plugin/Modularlayout.php48
-rw-r--r--library/Pbs/Debug.php22
-rw-r--r--library/Pbs/Filter.php886
-rw-r--r--library/Pbs/Graph.php269
-rw-r--r--library/Pbs/NewConfig.php114
-rw-r--r--library/Pbs/NewMember.php122
-rw-r--r--library/Pbs/Notifier.php326
-rw-r--r--library/Pbs/Pagination.php168
-rw-r--r--library/Pbs/Search.php310
-rw-r--r--library/Pbs/Session.php70
-rw-r--r--public/index.php22
-rw-r--r--public/settergetter.php64
-rw-r--r--scripts/dbContent.php351
-rw-r--r--scripts/mysqlGraph.php74
-rw-r--r--tests/application/controllers/AuthControllerTest.php19
-rw-r--r--tests/application/controllers/BootisoControllerTest.php19
-rw-r--r--tests/application/controllers/BootmenuControllerTest.php19
-rw-r--r--tests/application/controllers/BootosControllerTest.php19
-rw-r--r--tests/application/controllers/ClientControllerTest.php19
-rw-r--r--tests/application/controllers/ConfigControllerTest.php19
-rw-r--r--tests/application/controllers/FilterControllerTest.php19
-rw-r--r--tests/application/controllers/GroupControllerTest.php19
-rw-r--r--tests/application/controllers/IndexControllerTest.php19
-rw-r--r--tests/application/controllers/PersonControllerTest.php19
-rw-r--r--tests/application/controllers/PoolControllerTest.php19
-rw-r--r--tests/application/controllers/PrebootControllerTest.php19
-rw-r--r--tests/application/controllers/RessourceControllerTest.php19
-rw-r--r--tests/application/controllers/RoleControllerTest.php19
-rw-r--r--tests/application/controllers/SessionControllerTest.php19
-rw-r--r--tests/application/controllers/StatsControllerTest.php19
212 files changed, 22879 insertions, 24147 deletions
diff --git a/application/Bootstrap.php b/application/Bootstrap.php
index 45931e8..89a5846 100644
--- a/application/Bootstrap.php
+++ b/application/Bootstrap.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,70 +10,65 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
-{
- protected function _initAutoloader()
- {
- setlocale(LC_ALL, "de_DE.UTF-8");
- date_default_timezone_set('Europe/Berlin');
- $moduleLoader = new Zend_Application_Module_Autoloader
- (
- array
- (
- 'namespace' => '',
- 'basePath' => APPLICATION_PATH,
- 'resourceTypes' => array(
- 'form' => array(
- 'path' => 'forms',
- 'namespace' => 'Form',
- )
- )
- )
- );
- }
- protected function _initAutoloaders()
- {
- $this->getApplication()->setAutoloaderNamespaces(array('Pbs_'));
- return $this;
- }
+class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
+ protected function _initAutoloader() {
+ setlocale(LC_ALL, "de_DE.UTF-8");
+ date_default_timezone_set('Europe/Berlin');
+ $moduleLoader = new Zend_Application_Module_Autoloader
+ (
+ array
+ (
+ 'namespace' => '',
+ 'basePath' => APPLICATION_PATH,
+ 'resourceTypes' => array(
+ 'form' => array(
+ 'path' => 'forms',
+ 'namespace' => 'Form',
+ )
+ )
+ )
+ );
+ }
+ protected function _initAutoloaders() {
+ $this->getApplication()->setAutoloaderNamespaces(array('Pbs_'));
+ return $this;
+ }
- protected function _initAuth(){
- $auth = Zend_Auth::getInstance();
- $auth->setStorage(new Zend_Auth_Storage_Session('auth'));
- }
- protected function _initDocType(){
- $this->bootstrap('View');
- $view = $this->getResource('View');
- $view->doctype('XHTML1_STRICT');
-
- }
- function _initViewHelpers()
- {
-
- $this->bootstrap('layout');
-
- $layout = $this->getResource('layout');
- $view = $layout->getView();
- $view->doctype('XHTML1_STRICT');
- $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
- $view->headLink()->appendStylesheet('/media/css/style.css');
- $view->headLink()->appendStylesheet('/media/css/jquery-ui.css');
- $view->headLink()->appendStylesheet('/media/css/jquery-ui-timepicker.css');
- #$this->headScript()->appendFile('/media/js/jquery.min.js');
- #$this->headScript()->appendFile('/media/js/jquery-ui.min.js');
-
- $view->headTitle('pbs²')
- ->setSeparator(' :: ');
- Zend_Registry::set('dateformat' , 'Y-m-d H:i:s');
- }
- protected function _initPlugins()
- {
- $this->bootstrap('autoloaders');
- $this->bootstrap('frontController');
- $plugin = new Pbs_Controller_Plugin_Modularlayout();
- $this->frontController->registerPlugin($plugin);
-
- }
+ protected function _initAuth() {
+ $auth = Zend_Auth::getInstance();
+ $auth->setStorage(new Zend_Auth_Storage_Session('auth'));
+ }
+ protected function _initDocType() {
+ $this->bootstrap('View');
+ $view = $this->getResource('View');
+ $view->doctype('XHTML1_STRICT');
+
+ }
+ function _initViewHelpers() {
+
+ $this->bootstrap('layout');
+
+ $layout = $this->getResource('layout');
+ $view = $layout->getView();
+ $view->doctype('XHTML1_STRICT');
+ $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
+ $view->headLink()->appendStylesheet('/media/css/style.css');
+ $view->headLink()->appendStylesheet('/media/css/jquery-ui.css');
+ $view->headLink()->appendStylesheet('/media/css/jquery-ui-timepicker.css');
+#$this->headScript()->appendFile('/media/js/jquery.min.js');
+#$this->headScript()->appendFile('/media/js/jquery-ui.min.js');
+
+ $view->headTitle('pbs²')
+ ->setSeparator(' :: ');
+ Zend_Registry::set('dateformat' , 'Y-m-d H:i:s');
+ }
+ protected function _initPlugins() {
+ $this->bootstrap('autoloaders');
+ $this->bootstrap('frontController');
+ $plugin = new Pbs_Controller_Plugin_Modularlayout();
+ $this->frontController->registerPlugin($plugin);
+
+ }
}
include 'Functions.php';
diff --git a/application/Functions.php b/application/Functions.php
index 9e2ccf5..b96b039 100644
--- a/application/Functions.php
+++ b/application/Functions.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,33 +10,33 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
function randomString($name_laenge = 16) {
- $zeichen = "abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789";
- $name_neu = "";
+ $zeichen = "abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789";
+ $name_neu = "";
- mt_srand ((double) microtime() * 1000000);
- for ($i = 0; $i < $name_laenge; $i++ ) {
- $name_neu .= $zeichen{mt_rand (0,strlen($zeichen) - 1)};
- }
- return $name_neu;
+ mt_srand ((double) microtime() * 1000000);
+ for ($i = 0; $i < $name_laenge; $i++ ) {
+ $name_neu . = $zeichen {mt_rand (0, strlen($zeichen) - 1)};
+ }
+ return $name_neu;
}
-function print_a(){
- $numargs = func_num_args();
- if($numargs>1){
- $out = '';
- ob_start();
- echo "<div style='background-color:#FFCC33;border:1px solid black;margin:3px;padding:5px;'>";
- for($a=0;$a<$numargs;$a++)
- print_a(func_get_arg($a));
- echo "</div>";
- $out .= ob_get_contents();
- ob_end_clean();
- echo $out;
- }else{
- echo "<pre style='background-color:#FFDF80;border:1px solid #000;margin:3px;padding:5px;'>";
- $a = func_get_arg(0);
- $a = (is_bool($a))?(($a)?'true':'false'):$a;
- print_r($a);
- echo "</pre>";
- }
+function print_a() {
+ $numargs = func_num_args();
+ if($numargs > 1) {
+ $out = '';
+ ob_start();
+ echo "<div style='background-color:#FFCC33;border:1px solid black;margin:3px;padding:5px;'>";
+ for($a = 0; $a < $numargs; $a++)
+ { print_a(func_get_arg($a)); }
+ echo "</div>";
+ $out . = ob_get_contents();
+ ob_end_clean();
+ echo $out;
+ } else {
+ echo "<pre style='background-color:#FFDF80;border:1px solid #000;margin:3px;padding:5px;'>";
+ $a = func_get_arg(0);
+ $a = (is_bool($a)) ? (($a) ? 'true' : 'false') : $a;
+ print_r($a);
+ echo "</pre>";
+ }
} \ No newline at end of file
diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php
index a9a448d..66f9193 100644
--- a/application/controllers/ErrorController.php
+++ b/application/controllers/ErrorController.php
@@ -1,63 +1,60 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class ErrorController extends Zend_Controller_Action
-{
+class ErrorController extends Zend_Controller_Action {
- public function errorAction()
- {
- $errors = $this->_getParam('error_handler');
-
- switch ($errors->type) {
- case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
- case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
- case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
-
- // 404 error -- controller or action not found
- $this->getResponse()->setHttpResponseCode(404);
- $this->view->message = 'Page not found';
- $this->_redirect('/user/');
- print_a($errors);
- break;
- default:
- // application error
- $this->getResponse()->setHttpResponseCode(500);
- $this->view->message = 'Application error - Please contact the admin';
- print_a($errors);
- break;
- }
-
- // Log exception, if logger available
- if ($log = $this->getLog()) {
- $log->crit($this->view->message, $errors->exception);
- }
-
- // conditionally display exceptions
- if ($this->getInvokeArg('displayExceptions') == true) {
- $this->view->exception = $errors->exception;
- }
-
- $this->view->request = $errors->request;
+ public function errorAction() {
+ $errors = $this->_getParam('error_handler');
+
+ switch ($errors->type) {
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
+
+ // 404 error -- controller or action not found
+ $this->getResponse()->setHttpResponseCode(404);
+ $this->view->message = 'Page not found';
+ $this->_redirect('/user/');
+ print_a($errors);
+ break;
+ default:
+ // application error
+ $this->getResponse()->setHttpResponseCode(500);
+ $this->view->message = 'Application error - Please contact the admin';
+ print_a($errors);
+ break;
+ }
+
+ // Log exception, if logger available
+ if ($log = $this->getLog()) {
+ $log->crit($this->view->message, $errors->exception);
}
- public function getLog()
- {
- $bootstrap = $this->getInvokeArg('bootstrap');
- if (!$bootstrap->hasPluginResource('Log')) {
- return false;
- }
- $log = $bootstrap->getResource('Log');
- return $log;
+ // conditionally display exceptions
+ if ($this->getInvokeArg('displayExceptions') == true) {
+ $this->view->exception = $errors->exception;
+ }
+
+ $this->view->request = $errors->request;
+ }
+
+ public function getLog() {
+ $bootstrap = $this->getInvokeArg('bootstrap');
+ if (!$bootstrap->hasPluginResource('Log')) {
+ return false;
}
+ $log = $bootstrap->getResource('Log');
+ return $log;
+ }
}
diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php
index 8ad2fc4..bf49eae 100644
--- a/application/controllers/IndexController.php
+++ b/application/controllers/IndexController.php
@@ -1,41 +1,38 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class IndexController extends Zend_Controller_Action
-{
-
- public function init()
- {
- /* Initialize action controller here */
- }
-
- public function indexAction()
- {
- if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI')){
- $mySession =new Zend_Session_Namespace('pbs');
- if(!isset($mySession->postdata)){
- $mySession->postdata = $_POST;
- }
-
- // $d = new Pbs_Debug();
- // $d->debug(array('MainIndexController',$_SERVER['REMOTE_ADDR'],implode("\t",$mySession->postdata)));
-
- $this->_redirect("/fbgui/index/index");
- }
- $this->_redirect("/user/auth/login");
- // action body
-
-
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class IndexController extends Zend_Controller_Action {
+
+ public function init() {
+ /* Initialize action controller here */
+ }
+
+ public function indexAction() {
+ if(stristr($_SERVER['HTTP_USER_AGENT'], 'prebootGUI')) {
+ $mySession = new Zend_Session_Namespace('pbs');
+ if(!isset($mySession->postdata)) {
+ $mySession->postdata = $_POST;
+ }
+
+ // $d = new Pbs_Debug();
+ // $d->debug(array('MainIndexController',$_SERVER['REMOTE_ADDR'],implode("\t",$mySession->postdata)));
+
+ $this->_redirect("/fbgui/index/index");
+ }
+ $this->_redirect("/user/auth/login");
+ // action body
+
+
+ }
}
diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php
index 1707c38..54eeb84 100644
--- a/application/controllers/ResourceController.php
+++ b/application/controllers/ResourceController.php
@@ -1,556 +1,546 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class ResourceController extends Zend_Controller_Action
-{
-
- private $thisSession;
- private $page;
- private $membership;
- private $rightrolesMapper;
-
- public function init()
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- $session = new Application_Model_Session();
- $sm = new Application_Model_SessionMapper();
-
- //TODO Error Messages if something failed
- $alpha = $this->_request->getParam('alpha');
- $apikey = $this->_request->getParam('apikey');
-
- if($apikey != ""){
- $membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $this->rightrolesMapper = new Application_Model_RightRolesMapper();
-
- list($this->membership) = $membershipMapper->findBy(array('apikey' => $apikey));
- if($this->membership == null){
- header('HTTP/1.0 401 Member not found');
- die();
- }
-
- }
- elseif($alpha == "0"){
- $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
-
- $this->page = $this->_request->getParam('page');
-
- if(!is_numeric($bootmenuentryID)){
- $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/json/error');
- }
-
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenuentryMapper = new Application_Model_BootMenuEntriesMapper();
- $bootmenuMapper = new Application_Model_BootMenuMapper();
- $bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
-
- $session->setBootosID($bootmenuentry->getBootosID())
- ->setBootmenuentryID($bootmenuentry->getID())
- ->setTime(time())
- ->setMembershipID('1')
- ->setIp($_SERVER['REMOTE_ADDR'])
- ->setAlphasessionID('0');
-
- $this->thisSession = $session;
-
- }
- elseif($alpha != ""){
- $alphasessionID = $alpha;
- $result = $sm->findBy(array('alphasessionID' => $alphasessionID),true);
- # print_a($result);
- $this->thisSession = $session->setOptions($result[0]);
- $this->thisSession->setID($result[0]['sessionID']);
- }
-
- }
-
- public function indexAction()
- {
-
-
- }
-//TODO Try/Catch + Metadata check
- public function addbootosAction()
- {
-
- list($rightroles) = $this->rightrolesMapper->findBy(array('rightID' => '55', 'roleID' => $this->membership->getRoleID()));
- if($rightroles == null){
- header('HTTP/1.0 403 No Right to Create Bootos');
- die();
- }
-
- $apikey = $this->_request->getParam('apikey');
- if($apikey == ""){
- header('HTTP/1.0 400 No API-Key');
- die();
- }
-
- $params = $this->_request->getParams();
- $source = $_SERVER['REMOTE_ADDR'];
-
- if($params['title'] == '' || $params['distro'] == '' || $params['distroversion'] == '' || $params['share'] == '' || $source == ''){
- header('HTTP/1.0 400 Title, Distro, Distroversion and Share must be set');
- die();
- }
-
- if($_FILES['config']['size'] == 0 && $_FILES['config']['name'] != '' || $_FILES['kernel']['size'] == 0 && $_FILES['kernel']['name'] != ''|| $_FILES['init']['size'] == 0 && $_FILES['init']['name'] != ''){
- header('HTTP/1.0 400 File must be larger than 0 bytes');
- die();
- }
-
- $bootosMapper = new Application_Model_BootOsMapper();
- $groupID = $this->membership->getGroupID();
-
- list($bootos) = $bootosMapper->findBy(array('groupid' => $groupID, 'title' => $params['title'], 'distro' => $params['distro'], 'distroversion' => $params['distroversion'], 'source' => $source, 'share' => $params['share']));
- if($bootos != null){
-
- list($rightroles) = $this->rightrolesMapper->findBy(array('rightID' => '58', 'roleID' => $this->membership->getRoleID()));
- if($rightroles == null){
- header('HTTP/1.0 403 No Right to Edit Bootos');
- die();
- }
-
- $bootosID = $bootos->getID();
- $bootossrc = $bootos->getSource();
-
- $bootos->setOptions($params);
- $bootos->setID($bootosID);
- $bootos->setGroupID($groupID);
- $bootos->setSource($bootossrc);
- $bootos->setCreated(time());
- $bootos->setPublic('-1');
-
- $initpath = "../resources/bootos/".$bootosID."/initramfs/";
- $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
- $configpath = "../resources/bootos/".$bootosID."/config/";
-
- mkdir($initpath ,0777, true);
- mkdir($kernelpath ,0777, true);
- mkdir($configpath ,0777, true);
-
- if($_FILES['config']['name'] != ''){
- $bootos->setSource($_SERVER['REMOTE_ADDR']);
- move_uploaded_file($_FILES['config']['tmp_name'], $configpath."default.tgz");
- }
- if($_FILES['kernel']['name'] != ''){
- $bootos->setSource($_SERVER['REMOTE_ADDR']);
- move_uploaded_file($_FILES['kernel']['tmp_name'], $kernelpath."kernel");
- }
- if($_FILES['init']['name'] != ''){
- $bootos->setSource($_SERVER['REMOTE_ADDR']);
- move_uploaded_file($_FILES['init']['tmp_name'], $initpath."initramfs");
- }
-
- $bootosMapper->save($bootos);
-
- header('HTTP/1.0 201 Bootos edited');
-
- }else{
-
- $bootos = new Application_Model_BootOs();
-
- $bootos->setOptions($params);
- $bootos->setGroupID($groupID);
- $bootos->setSource($source);
- $bootos->setCreated(time());
- $bootos->setPublic('-1');
- $bootosID = $bootosMapper->save($bootos);
- $bootos->setID($bootosID);
-
- $initpath = "../resources/bootos/".$bootosID."/initramfs/";
- $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
- $configpath = "../resources/bootos/".$bootosID."/config/";
-
- mkdir($initpath ,0777, true);
- mkdir($kernelpath ,0777, true);
- mkdir($configpath ,0777, true);
-
- if($_FILES['config']['name'] != ''){
- move_uploaded_file($_FILES['config']['tmp_name'], $configpath."default.tgz");
-
- }
- if($_FILES['kernel']['name'] != ''){
- move_uploaded_file($_FILES['kernel']['tmp_name'], $kernelpath."kernel");
- }
- if($_FILES['init']['name'] != ''){
- move_uploaded_file($_FILES['init']['tmp_name'], $initpath."initramfs");
- $newconfig = new Pbs_NewConfig();
- $newconfig->createDefaultConfig($bootos);
- }
-
- header('HTTP/1.0 201 Bootos created');
- }
-
- }
-
-
- public function addprebootAction()
- {
-
- list($rightroles) = $this->rightrolesMapper->findBy(array('rightID' => '40', 'roleID' => $this->membership->getRoleID()));
- if($rightroles == null){
- header('HTTP/1.0 403 No Right to Create Preboots');
- die();
- }
-
- $apikey = $this->_request->getParam('apikey');
- if($apikey == ""){
- header('HTTP/1.0 400 No API-Key');
- die();
- }
-
- $params = $this->_request->getParams();
- $source = $_SERVER['REMOTE_ADDR'];
-
- if($params['title'] == '' || $_FILES['preboot']['name'] == ''){
- header('HTTP/1.0 400 Title and Preboot must be set');
- die();
- }
-
- if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != ''){
- header('HTTP/1.0 400 File must be larger than 0 bytes');
- die();
- }
-
- $prebootMapper = new Application_Model_PreBootMapper();
- $groupID = $this->membership->getGroupID();
-
- list($preboot) = $prebootMapper->findBy(array('groupid' => $groupID, 'title' => $params['title']));
- if($preboot != null){
- header('HTTP/1.0 400 Preboot already exists');
- die();
- }
-
- $preboot = new Application_Model_PreBoot();
-
- $preboot->setOptions($params);
- $preboot->setGroupID($groupID);
- $preboot->setSource($source);
- $preboot->setCreated(time());
-
- $prebootID = $prebootMapper->save($preboot);
-
- $prebootpath = "../resources/bootmedium/".$prebootID."/";
- mkdir($prebootpath ,0777, true);
-
- if($_FILES['preboot']['name'] != '' ){
- move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
- }
-
- header('HTTP/1.0 201 Preboot created');
-
-
- }
-
- public function editprebootAction()
- {
-
- list($rightroles) = $this->rightrolesMapper->findBy(array('rightID' => '41', 'roleID' => $this->membership->getRoleID()));
- if($rightroles == null){
- header('HTTP/1.0 403 No Right to Edit Preboot');
- die();
- }
-
- $apikey = $this->_request->getParam('apikey');
- if($apikey == ""){
- header('HTTP/1.0 400 No API-Key');
- die();
- }
-
- $params = $this->_request->getParams();
- $source = $_SERVER['REMOTE_ADDR'];
-
- if($params['title'] == ''){
- header('HTTP/1.0 400 Title must be set');
- die();
- }
-
- if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != ''){
- header('HTTP/1.0 400 File must be larger than 0 bytes');
- die();
- }
-
- $prebootMapper = new Application_Model_PreBootMapper();
- $groupID = $this->membership->getGroupID();
- $preboot = new Application_Model_PreBoot();
-
- list($preboot) = $prebootMapper->findBy(array('groupid' => $groupID, 'title' => $params['title']));
-
- if($preboot == null){
- header('HTTP/1.0 400 Preboot not found');
- die();
- }
-
- $prebootsrc = $preboot->getSource();
- $prebootID = $preboot->getID();
-
- $preboot->setOptions($params);
- $preboot->setGroupID($groupID);
- $preboot->setSource($prebootsrc);
- $preboot->setCreated(time());
-
- $prebootpath = "../resources/bootmedium/".$prebootID."/";
- mkdir($prebootpath ,0777, true);
-
- if($_FILES['preboot']['name'] != ''){
- $preboot->setSource($source);
- move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
- }
-
- $prebootMapper->save($preboot);
-
- header('HTTP/1.0 201 Preboot edited');
-
- }
-
- public function getinitramfsAction()
- {
-
- $bootosID = $this->thisSession->getBootosID();
-
- if(is_dir("../resources/bootos/$bootosID/initramfs/") && is_numeric($bootosID)){
-
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="initramfs"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- // create file.
- chdir("../resources/bootos/$bootosID/initramfs/");
- $initname = array_pop(scandir("./"));
-
- header("Content-Length: ".filesize(getcwd()."/".$initname));
-
- passthru( "cat ".$initname);
- }else{
- header('HTTP/1.0 404 Not Found');
- }
- }
-
- public function getconfigAction()
- {
- $bootmenuentryID = $this->thisSession->getBootmenuentryID();
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bmm = new Application_Model_BootMenuEntriesMapper();
- $bmm->find($bootmenuentryID,$bootmenuentry);
-
- $configID = $bootmenuentry->getConfigID();
- $bootosID = $this->thisSession->getBootosID();
-
- if(is_dir("../resources/bootos/$bootosID/config/")){
-
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="default.tgz"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- if($configID == null){
- chdir("../resources/bootos/$bootosID/config/");
- passthru( "cat default.tgz");
- }else{
- $bootosuserMapper = new Application_Model_BootOsUserMapper();
- $bootosuser = $bootosuserMapper->findBy(array('configID' => $configID));
-
- $hash = md5(microtime(1));
- $tmp_conf = "../resources/config/$hash";
- mkdir($tmp_conf ,0777, true);
- exec("tar -C $tmp_conf -xf ../resources/bootos/$bootosID/config/default.tgz",$restul);
- exec("tar -C $tmp_conf/rootfs/ -xf ../resources/config/etc.tgz");
-
- $username = '';
- $userpassword = '';
-
- if($this->thisSession->getMembershipID() != null){
- $person = new Application_Model_Person();
- $personMapper = new Application_Model_PersonMapper();
- $membershipMapper = new Application_Model_MembershipMapper();
- $personID = $membershipMapper->find($this->thisSession->getMembershipID())->getPersonID();
- $person = $personMapper->find($personID);
- $username = strtolower($person->getName());
- $username = preg_replace("!\s!","",$username);
- $userpassword = $person->getLoginPassword();
- }
- $anzUsers = count($bootosuser);
- $test = array();
- if($anzUsers <= 2){
- foreach($bootosuser as $user)
- $test[] = $user->getLogin();
- }
-
- $configView = new Zend_View();
- $f = fopen("$tmp_conf/initramfs/postinit.local", "a");
-
- $userid = 1000;
-
- foreach($bootosuser as $user){
-
- if($user->getLogin() == '%username%'){
- $configView->loginname = $username;
- }else{
- $configView->loginname = $user->getLogin();
- }
-
- $configView->userid = $userid++;
-
- if($user->getPassword() == '%password%'){
- $configView->password = $userpassword;
- }else{
- $configView->password = $user->getPassword();
- }
-
- if($user->getHometypeID() == 2){
- $configView->homepath = $user->getHomepath();
- }elseif($user->getHometypeID() == 1){
- $configView->homepath = "/media/openslx-stick/home/".$configView->loginname;
- }else{
- $configView->homepath = "/home/".$configView->loginname;
- }
-
- if($configView->loginname != '' && $configView->password != ''){
-
- if($user->getHometypeID() == 1){
- $configView->usb = true;
- }
- else{
- $configView->usb = false;
- if($anzUsers <= 2 && $user->getLogin() == 'kiosk' && in_array('%username%',$test) && $this->thisSession->getMembershipID() == null)
- $configView->autologin = true;
- elseif($anzUsers <= 2 && $user->getLogin() == '%username%' && $this->thisSession->getMembershipID() != null)
- $configView->autologin = true;
- else
- $configView->autologin = false;
-
- }
-
- $configView->addScriptPath(APPLICATION_PATH.'/views/scripts/resource/');
- $config = $configView->render('getconfig.phtml');
-
- fputs($f, $config);
-
- }
- }
- fclose($f);
-
- // create the gzipped tarfile.
- chdir($tmp_conf);
- passthru( "tar cz *");
- exec("rm -rf ../$hash");
-
- }
- }else{
- header('HTTP/1.0 404 Not Found');
- }
- }
-
- public function getkernelAction()
- {
-
- $bootosID = $this->thisSession->getBootosID();
-
- if(is_dir("../resources/bootos/$bootosID/kernel/") && is_numeric($bootosID)){
-
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="kernel"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- // create the gzipped tarfile.
- chdir("../resources/bootos/$bootosID/kernel/");
- $kernelname = array_pop(scandir("./"));
-
- header("Content-Length: ".filesize(getcwd()."/".$kernelname));
-
- passthru( "cat ". $kernelname);
- }else{
- header('HTTP/1.0 404 Not Found');
- }
-
- }
-
- public function getkclAction()
- {
-
-
- $bmeID = $this->thisSession->getBootmenuentryID();
-
- if(is_numeric($bmeID)){
-
- $bmemapper = new Application_Model_BootMenuEntriesMapper();
- $bme = new Application_Model_BootMenuEntries();
- $bootosmapper = new Application_Model_BootOsMapper();
- $bmemapper->find($bmeID,$bme);
-
- header('Content-Type: text/html');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="kcl.txt"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl();
-
- if($bme->getKcl() && $kcl != null){
- $result = $kcl . " alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/c/".$this->_request->getParam('alpha')."/default.tgz ".$bme->getKclappend();
- }else{
- $result = "alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/c/".$this->_request->getParam('alpha')."/default.tgz ".$bme->getKclappend();
- }
- $result = trim($result);
- header("Content-Length: ".(strlen($result)));
-
- echo $result;
-
-
- }
-
- }
-
- public function getbootmenuentryAction()
- {
- // obsolete function (now only for debugging)
- // after selecting the BootOS it will be saved in session
- // so getkclAction, getkernelAction, getconfigAction and getinitramfsAction
- // can be called with session-identifier
-
- $return_val =
- array(
- 'info' => 'This function is for debugging purpose only',
- 'kernel' => $this->generateURL('getkernel', 'alpha', $this->thisSession->getAlphasessionID(), "kernel"),
- 'initramfs' => $this->generateURL('getinitramfs', 'alpha', $this->thisSession->getAlphasessionID(), "initramfs"),
- 'kcl' => $this->generateURL('getkcl', 'alpha', $this->thisSession->getAlphasessionID(), "kcl.txt"),
- 'config' => $this->generateURL('getconfig', 'alpha', $this->thisSession->getAlphasessionID(), 'default.tgz')
- );
-
- $result = $return_val;
- $result2 = "<table class='json'>";
- $result2 .= "<tr><td><b>info</b>: </td><td>".$result['info']."</td></tr>";
- $result2 .= "<tr><td><b>kernel</b>: </td><td><a href=".$result['kernel'].">".$result['kernel']."<a></td></tr>";
- $result2 .= "<tr><td><b>initramfs</b>: </td><td><a href=".$result['initramfs'].">".$result['initramfs']."<a></td></tr>";
- $result2 .= "<tr><td><b>kcl</b>: </td><td><a href=".$result['kcl'].">".$result['kcl']."<a></td></tr>";
- $result2 .= "<tr><td><b>config</b>: </td><td><a href=".$result['config'].">".$result['config']."<a></td></tr>";
- $result2 .= "</table>";
- echo $result2;
- }
-
- private function generateURL($action, $varname, $varvalue, $filename){
- $path = '/resource/'. $action .'/' . $varname .'/' . $varvalue .'/bootmenuentryID/'.$this->thisSession->getBootmenuentryID().'/file/' . $filename ;
- $path = "http://" . $_SERVER['SERVER_NAME'] . $path;
- return $path;
- }
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class ResourceController extends Zend_Controller_Action {
+
+ private $thisSession;
+ private $page;
+ private $membership;
+ private $rightrolesMapper;
+
+ public function init() {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $session = new Application_Model_Session();
+ $sm = new Application_Model_SessionMapper();
+
+ //TODO Error Messages if something failed
+ $alpha = $this->_request->getParam('alpha');
+ $apikey = $this->_request->getParam('apikey');
+
+ if($apikey != "") {
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $this->rightrolesMapper = new Application_Model_RightRolesMapper();
+
+ list($this->membership) = $membershipMapper->findBy(array('apikey' => $apikey));
+ if($this->membership == null) {
+ header('HTTP/1.0 401 Member not found');
+ die();
+ }
+
+ }
+ elseif($alpha == "0") {
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+
+ $this->page = $this->_request->getParam('page');
+
+ if(!is_numeric($bootmenuentryID)) {
+ $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/json/error');
+ }
+
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenuentryMapper = new Application_Model_BootMenuEntriesMapper();
+ $bootmenuMapper = new Application_Model_BootMenuMapper();
+ $bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
+
+ $session->setBootosID($bootmenuentry->getBootosID())
+ ->setBootmenuentryID($bootmenuentry->getID())
+ ->setTime(time())
+ ->setMembershipID('1')
+ ->setIp($_SERVER['REMOTE_ADDR'])
+ ->setAlphasessionID('0');
+
+ $this->thisSession = $session;
+
+ }
+ elseif($alpha != "") {
+ $alphasessionID = $alpha;
+ $result = $sm->findBy(array('alphasessionID' => $alphasessionID), true);
+# print_a($result);
+ $this->thisSession = $session->setOptions($result[0]);
+ $this->thisSession->setID($result[0]['sessionID']);
+ }
+
+ }
+
+ public function indexAction() {
+
+
+ }
+ //TODO Try/Catch + Metadata check
+ public function addbootosAction() {
+
+ list($rightroles) = $this->rightrolesMapper->findBy(array('rightID' => '55', 'roleID' => $this->membership->getRoleID()));
+ if($rightroles == null) {
+ header('HTTP/1.0 403 No Right to Create Bootos');
+ die();
+ }
+
+ $apikey = $this->_request->getParam('apikey');
+ if($apikey == "") {
+ header('HTTP/1.0 400 No API-Key');
+ die();
+ }
+
+ $params = $this->_request->getParams();
+ $source = $_SERVER['REMOTE_ADDR'];
+
+ if($params['title'] == '' || $params['distro'] == '' || $params['distroversion'] == '' || $params['share'] == '' || $source == '') {
+ header('HTTP/1.0 400 Title, Distro, Distroversion and Share must be set');
+ die();
+ }
+
+ if($_FILES['config']['size'] == 0 && $_FILES['config']['name'] != '' || $_FILES['kernel']['size'] == 0 && $_FILES['kernel']['name'] != '' || $_FILES['init']['size'] == 0 && $_FILES['init']['name'] != '') {
+ header('HTTP/1.0 400 File must be larger than 0 bytes');
+ die();
+ }
+
+ $bootosMapper = new Application_Model_BootOsMapper();
+ $groupID = $this->membership->getGroupID();
+
+ list($bootos) = $bootosMapper->findBy(array('groupid' => $groupID, 'title' => $params['title'], 'distro' => $params['distro'], 'distroversion' => $params['distroversion'], 'source' => $source, 'share' => $params['share']));
+ if($bootos != null) {
+
+ list($rightroles) = $this->rightrolesMapper->findBy(array('rightID' => '58', 'roleID' => $this->membership->getRoleID()));
+ if($rightroles == null) {
+ header('HTTP/1.0 403 No Right to Edit Bootos');
+ die();
+ }
+
+ $bootosID = $bootos->getID();
+ $bootossrc = $bootos->getSource();
+
+ $bootos->setOptions($params);
+ $bootos->setID($bootosID);
+ $bootos->setGroupID($groupID);
+ $bootos->setSource($bootossrc);
+ $bootos->setCreated(time());
+ $bootos->setPublic('-1');
+
+ $initpath = "../resources/bootos/".$bootosID."/initramfs/";
+ $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
+ $configpath = "../resources/bootos/".$bootosID."/config/";
+
+ mkdir($initpath , 0777, true);
+ mkdir($kernelpath , 0777, true);
+ mkdir($configpath , 0777, true);
+
+ if($_FILES['config']['name'] != '') {
+ $bootos->setSource($_SERVER['REMOTE_ADDR']);
+ move_uploaded_file($_FILES['config']['tmp_name'], $configpath."default.tgz");
+ }
+ if($_FILES['kernel']['name'] != '') {
+ $bootos->setSource($_SERVER['REMOTE_ADDR']);
+ move_uploaded_file($_FILES['kernel']['tmp_name'], $kernelpath."kernel");
+ }
+ if($_FILES['init']['name'] != '') {
+ $bootos->setSource($_SERVER['REMOTE_ADDR']);
+ move_uploaded_file($_FILES['init']['tmp_name'], $initpath."initramfs");
+ }
+
+ $bootosMapper->save($bootos);
+
+ header('HTTP/1.0 201 Bootos edited');
+
+ } else {
+
+ $bootos = new Application_Model_BootOs();
+
+ $bootos->setOptions($params);
+ $bootos->setGroupID($groupID);
+ $bootos->setSource($source);
+ $bootos->setCreated(time());
+ $bootos->setPublic('-1');
+ $bootosID = $bootosMapper->save($bootos);
+ $bootos->setID($bootosID);
+
+ $initpath = "../resources/bootos/".$bootosID."/initramfs/";
+ $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
+ $configpath = "../resources/bootos/".$bootosID."/config/";
+
+ mkdir($initpath , 0777, true);
+ mkdir($kernelpath , 0777, true);
+ mkdir($configpath , 0777, true);
+
+ if($_FILES['config']['name'] != '') {
+ move_uploaded_file($_FILES['config']['tmp_name'], $configpath."default.tgz");
+
+ }
+ if($_FILES['kernel']['name'] != '') {
+ move_uploaded_file($_FILES['kernel']['tmp_name'], $kernelpath."kernel");
+ }
+ if($_FILES['init']['name'] != '') {
+ move_uploaded_file($_FILES['init']['tmp_name'], $initpath."initramfs");
+ $newconfig = new Pbs_NewConfig();
+ $newconfig->createDefaultConfig($bootos);
+ }
+
+ header('HTTP/1.0 201 Bootos created');
+ }
+
+ }
+
+
+ public function addprebootAction() {
+
+ list($rightroles) = $this->rightrolesMapper->findBy(array('rightID' => '40', 'roleID' => $this->membership->getRoleID()));
+ if($rightroles == null) {
+ header('HTTP/1.0 403 No Right to Create Preboots');
+ die();
+ }
+
+ $apikey = $this->_request->getParam('apikey');
+ if($apikey == "") {
+ header('HTTP/1.0 400 No API-Key');
+ die();
+ }
+
+ $params = $this->_request->getParams();
+ $source = $_SERVER['REMOTE_ADDR'];
+
+ if($params['title'] == '' || $_FILES['preboot']['name'] == '') {
+ header('HTTP/1.0 400 Title and Preboot must be set');
+ die();
+ }
+
+ if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != '') {
+ header('HTTP/1.0 400 File must be larger than 0 bytes');
+ die();
+ }
+
+ $prebootMapper = new Application_Model_PreBootMapper();
+ $groupID = $this->membership->getGroupID();
+
+ list($preboot) = $prebootMapper->findBy(array('groupid' => $groupID, 'title' => $params['title']));
+ if($preboot != null) {
+ header('HTTP/1.0 400 Preboot already exists');
+ die();
+ }
+
+ $preboot = new Application_Model_PreBoot();
+
+ $preboot->setOptions($params);
+ $preboot->setGroupID($groupID);
+ $preboot->setSource($source);
+ $preboot->setCreated(time());
+
+ $prebootID = $prebootMapper->save($preboot);
+
+ $prebootpath = "../resources/bootmedium/".$prebootID."/";
+ mkdir($prebootpath , 0777, true);
+
+ if($_FILES['preboot']['name'] != '' ) {
+ move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
+ }
+
+ header('HTTP/1.0 201 Preboot created');
+
+
+ }
+
+ public function editprebootAction() {
+
+ list($rightroles) = $this->rightrolesMapper->findBy(array('rightID' => '41', 'roleID' => $this->membership->getRoleID()));
+ if($rightroles == null) {
+ header('HTTP/1.0 403 No Right to Edit Preboot');
+ die();
+ }
+
+ $apikey = $this->_request->getParam('apikey');
+ if($apikey == "") {
+ header('HTTP/1.0 400 No API-Key');
+ die();
+ }
+
+ $params = $this->_request->getParams();
+ $source = $_SERVER['REMOTE_ADDR'];
+
+ if($params['title'] == '') {
+ header('HTTP/1.0 400 Title must be set');
+ die();
+ }
+
+ if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != '') {
+ header('HTTP/1.0 400 File must be larger than 0 bytes');
+ die();
+ }
+
+ $prebootMapper = new Application_Model_PreBootMapper();
+ $groupID = $this->membership->getGroupID();
+ $preboot = new Application_Model_PreBoot();
+
+ list($preboot) = $prebootMapper->findBy(array('groupid' => $groupID, 'title' => $params['title']));
+
+ if($preboot == null) {
+ header('HTTP/1.0 400 Preboot not found');
+ die();
+ }
+
+ $prebootsrc = $preboot->getSource();
+ $prebootID = $preboot->getID();
+
+ $preboot->setOptions($params);
+ $preboot->setGroupID($groupID);
+ $preboot->setSource($prebootsrc);
+ $preboot->setCreated(time());
+
+ $prebootpath = "../resources/bootmedium/".$prebootID."/";
+ mkdir($prebootpath , 0777, true);
+
+ if($_FILES['preboot']['name'] != '') {
+ $preboot->setSource($source);
+ move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
+ }
+
+ $prebootMapper->save($preboot);
+
+ header('HTTP/1.0 201 Preboot edited');
+
+ }
+
+ public function getinitramfsAction() {
+
+ $bootosID = $this->thisSession->getBootosID();
+
+ if(is_dir("../resources/bootos/$bootosID/initramfs/") && is_numeric($bootosID)) {
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="initramfs"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create file.
+ chdir("../resources/bootos/$bootosID/initramfs/");
+ $initname = array_pop(scandir("./"));
+
+ header("Content-Length: ".filesize(getcwd()."/".$initname));
+
+ passthru( "cat ".$initname);
+ } else {
+ header('HTTP/1.0 404 Not Found');
+ }
+ }
+
+ public function getconfigAction() {
+ $bootmenuentryID = $this->thisSession->getBootmenuentryID();
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bmm = new Application_Model_BootMenuEntriesMapper();
+ $bmm->find($bootmenuentryID, $bootmenuentry);
+
+ $configID = $bootmenuentry->getConfigID();
+ $bootosID = $this->thisSession->getBootosID();
+
+ if(is_dir("../resources/bootos/$bootosID/config/")) {
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="default.tgz"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ if($configID == null) {
+ chdir("../resources/bootos/$bootosID/config/");
+ passthru( "cat default.tgz");
+ } else {
+ $bootosuserMapper = new Application_Model_BootOsUserMapper();
+ $bootosuser = $bootosuserMapper->findBy(array('configID' => $configID));
+
+ $hash = md5(microtime(1));
+ $tmp_conf = "../resources/config/$hash";
+ mkdir($tmp_conf , 0777, true);
+ exec("tar -C $tmp_conf -xf ../resources/bootos/$bootosID/config/default.tgz", $restul);
+ exec("tar -C $tmp_conf/rootfs/ -xf ../resources/config/etc.tgz");
+
+ $username = '';
+ $userpassword = '';
+
+ if($this->thisSession->getMembershipID() != null) {
+ $person = new Application_Model_Person();
+ $personMapper = new Application_Model_PersonMapper();
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $personID = $membershipMapper->find($this->thisSession->getMembershipID())->getPersonID();
+ $person = $personMapper->find($personID);
+ $username = strtolower($person->getName());
+ $username = preg_replace("!\s!", "", $username);
+ $userpassword = $person->getLoginPassword();
+ }
+ $anzUsers = count($bootosuser);
+ $test = array();
+ if($anzUsers <= 2) {
+ foreach($bootosuser as $user)
+ $test[] = $user->getLogin();
+ }
+
+ $configView = new Zend_View();
+ $f = fopen("$tmp_conf/initramfs/postinit.local", "a");
+
+ $userid = 1000;
+
+ foreach($bootosuser as $user) {
+
+ if($user->getLogin() == '%username%') {
+ $configView->loginname = $username;
+ } else {
+ $configView->loginname = $user->getLogin();
+ }
+
+ $configView->userid = $userid++;
+
+ if($user->getPassword() == '%password%') {
+ $configView->password = $userpassword;
+ } else {
+ $configView->password = $user->getPassword();
+ }
+
+ if($user->getHometypeID() == 2) {
+ $configView->homepath = $user->getHomepath();
+ }
+ elseif($user->getHometypeID() == 1) {
+ $configView->homepath = "/media/openslx-stick/home/".$configView->loginname;
+ }
+ else {
+ $configView->homepath = "/home/".$configView->loginname;
+ }
+
+ if($configView->loginname != '' && $configView->password != '') {
+
+ if($user->getHometypeID() == 1) {
+ $configView->usb = true;
+ } else {
+ $configView->usb = false;
+ if($anzUsers <= 2 && $user->getLogin() == 'kiosk' && in_array('%username%', $test) && $this->thisSession->getMembershipID() == null)
+ { $configView->autologin = true; }
+ elseif($anzUsers <= 2 && $user->getLogin() == '%username%' && $this->thisSession->getMembershipID() != null)
+ $configView->autologin = true;
+ else
+ { $configView->autologin = false; }
+
+ }
+
+ $configView->addScriptPath(APPLICATION_PATH.'/views/scripts/resource/');
+ $config = $configView->render('getconfig.phtml');
+
+ fputs($f, $config);
+
+ }
+ }
+ fclose($f);
+
+ // create the gzipped tarfile.
+ chdir($tmp_conf);
+ passthru( "tar cz *");
+ exec("rm -rf ../$hash");
+
+ }
+ } else {
+ header('HTTP/1.0 404 Not Found');
+ }
+ }
+
+ public function getkernelAction() {
+
+ $bootosID = $this->thisSession->getBootosID();
+
+ if(is_dir("../resources/bootos/$bootosID/kernel/") && is_numeric($bootosID)) {
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="kernel"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create the gzipped tarfile.
+ chdir("../resources/bootos/$bootosID/kernel/");
+ $kernelname = array_pop(scandir("./"));
+
+ header("Content-Length: ".filesize(getcwd()."/".$kernelname));
+
+ passthru( "cat ". $kernelname);
+ } else {
+ header('HTTP/1.0 404 Not Found');
+ }
+
+ }
+
+ public function getkclAction() {
+
+
+ $bmeID = $this->thisSession->getBootmenuentryID();
+
+ if(is_numeric($bmeID)) {
+
+ $bmemapper = new Application_Model_BootMenuEntriesMapper();
+ $bme = new Application_Model_BootMenuEntries();
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $bmemapper->find($bmeID, $bme);
+
+ header('Content-Type: text/html');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="kcl.txt"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl();
+
+ if($bme->getKcl() && $kcl != null) {
+ $result = $kcl . " alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/c/".$this->_request->getParam('alpha')."/default.tgz ".$bme->getKclappend();
+ } else {
+ $result = "alpha=" . $this->_request->getParam('alpha') . " file=http://".$_SERVER['HTTP_HOST']."/c/".$this->_request->getParam('alpha')."/default.tgz ".$bme->getKclappend();
+ }
+ $result = trim($result);
+ header("Content-Length: ".(strlen($result)));
+
+ echo $result;
+
+
+ }
+
+ }
+
+ public function getbootmenuentryAction() {
+ // obsolete function (now only for debugging)
+ // after selecting the BootOS it will be saved in session
+ // so getkclAction, getkernelAction, getconfigAction and getinitramfsAction
+ // can be called with session-identifier
+
+ $return_val =
+ array(
+ 'info' => 'This function is for debugging purpose only',
+ 'kernel' => $this->generateURL('getkernel', 'alpha', $this->thisSession->getAlphasessionID(), "kernel"),
+ 'initramfs' => $this->generateURL('getinitramfs', 'alpha', $this->thisSession->getAlphasessionID(), "initramfs"),
+ 'kcl' => $this->generateURL('getkcl', 'alpha', $this->thisSession->getAlphasessionID(), "kcl.txt"),
+ 'config' => $this->generateURL('getconfig', 'alpha', $this->thisSession->getAlphasessionID(), 'default.tgz')
+ );
+
+ $result = $return_val;
+ $result2 = "<table class='json'>";
+ $result2 . = "<tr><td><b>info</b>: </td><td>".$result['info']."</td></tr>";
+ $result2 . = "<tr><td><b>kernel</b>: </td><td><a href=".$result['kernel'].">".$result['kernel']."<a></td></tr>";
+ $result2 . = "<tr><td><b>initramfs</b>: </td><td><a href=".$result['initramfs'].">".$result['initramfs']."<a></td></tr>";
+ $result2 . = "<tr><td><b>kcl</b>: </td><td><a href=".$result['kcl'].">".$result['kcl']."<a></td></tr>";
+ $result2 . = "<tr><td><b>config</b>: </td><td><a href=".$result['config'].">".$result['config']."<a></td></tr>";
+ $result2 . = "</table>";
+ echo $result2;
+ }
+
+ private function generateURL($action, $varname, $varvalue, $filename) {
+ $path = '/resource/'. $action .'/' . $varname .'/' . $varvalue .'/bootmenuentryID/'.$this->thisSession->getBootmenuentryID().'/file/' . $filename ;
+ $path = "http://" . $_SERVER['SERVER_NAME'] . $path;
+ return $path;
+ }
+
}
diff --git a/application/controllers/StatsController.php b/application/controllers/StatsController.php
index 05762a4..6ccd6bc 100644
--- a/application/controllers/StatsController.php
+++ b/application/controllers/StatsController.php
@@ -1,51 +1,49 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class StatsController extends Zend_Controller_Action
-{
-
- public function init()
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
- }
-
- public function graphgroupAction(){
-
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
-
- if(isset($userIDsNamespace['groupID'])){
- header("Content-Type: image/png");
- header("Expires: 0");
- $n = new Pbs_Graph();
-
- $level = $this->_request->getParam('level');
- if(is_numeric($level) && $level != ''){
- $n->setHiglightLevel($level);
- }
- $groupID = $userIDsNamespace['groupID'];
-
- $group = $this->_request->getParam('group');
- if((Pbs_Acl::checkRight('gsdo') || Pbs_Acl::checkRight('gsdog')) && is_numeric($group)){
- $groupID = $group;
- }
-
- $child = $this->_request->getParam('child');
- if(Pbs_Acl::checkRight('glk') && $child != ''){
- $n->newChild($child);
- }
-
- echo $n->graph($groupID);
- }
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class StatsController extends Zend_Controller_Action {
+
+ public function init() {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ }
+
+ public function graphgroupAction() {
+
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+
+ if(isset($userIDsNamespace['groupID'])) {
+ header("Content-Type: image/png");
+ header("Expires: 0");
+ $n = new Pbs_Graph();
+
+ $level = $this->_request->getParam('level');
+ if(is_numeric($level) && $level != '') {
+ $n->setHiglightLevel($level);
+ }
+ $groupID = $userIDsNamespace['groupID'];
+
+ $group = $this->_request->getParam('group');
+ if((Pbs_Acl::checkRight('gsdo') || Pbs_Acl::checkRight('gsdog')) && is_numeric($group)) {
+ $groupID = $group;
+ }
+
+ $child = $this->_request->getParam('child');
+ if(Pbs_Acl::checkRight('glk') && $child != '') {
+ $n->newChild($child);
+ }
+
+ echo $n->graph($groupID);
+ }
+ }
}
diff --git a/application/models/BootIso.php b/application/models/BootIso.php
index e34c3b8..eca6bf9 100644
--- a/application/models/BootIso.php
+++ b/application/models/BootIso.php
@@ -1,210 +1,182 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_BootIso
-{
- protected $_bootisoID;
- protected $_title;
- protected $_description;
- protected $_prebootID;
- protected $_membershipID;
- protected $_groupID;
- protected $_serialnumber;
- protected $_created;
- protected $_expires;
- protected $_public;
-
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_BootIso {
+ protected $_bootisoID;
+ protected $_title;
+ protected $_description;
+ protected $_prebootID;
+ protected $_membershipID;
+ protected $_groupID;
+ protected $_serialnumber;
+ protected $_created;
+ protected $_expires;
+ protected $_public;
+
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
}
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid bootiso property');
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid bootiso property');
+ }
+ $this->$method($value);
+ }
+
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid bootiso property');
+ }
+ return $this->$method();
+ }
+
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
$this->$method($value);
+ }
}
-
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid bootiso property');
+ return $this;
+ }
+
+ public function getID() {
+ return $this->_bootisoID;
+ }
+ public function setID($_bootisoID) {
+ $this->_bootisoID = $_bootisoID;
+ return $this;
+ }
+
+ public function getMembershipID() {
+ return $this->_membershipID;
+ }
+
+ public function setMembershipID($_membershipID) {
+ $this->_membershipID = $_membershipID;
+ return $this;
+ }
+
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getPrebootID() {
+ return $this->_prebootID;
+ }
+ public function setPrebootID($_prebootID) {
+ $this->_prebootID = $_prebootID;
+ return $this;
+ }
+ public function getSerialnumber() {
+ return $this->_serialnumber;
+ }
+
+ public function setSerialnumber($_serialnumber) {
+ $this->_serialnumber = $_serialnumber;
+ return $this;
+ }
+
+ public function getCreated() {
+ return $this->_created;
+ }
+
+ public function setCreated($_created) {
+ $this->_created = $_created;
+ return $this;
+ }
+
+ public function getExpires() {
+ return $this->_expires;
+ }
+
+ public function setExpires($_expires) {
+ $this->_expires = $_expires;
+ return $this;
+ }
+
+ public function getPublic() {
+ return $this->_public;
+ }
+
+ public function setPublic($_public) {
+ $this->_public = $_public;
+ return $this;
+ }
+
+ public function getBootisoID() {
+ return $this->_bootisoID;
+ }
+
+ public function setBootisoID($_bootisoID) {
+ $this->_bootisoID = $_bootisoID;
+ return $this;
+ }
+ public function getDescription() {
+ return $this->_description;
+ }
+ public function setDescription($_description) {
+ $this->_description = $_description;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
}
- return $this->$method();
- }
-
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $this;
- }
- public function getID()
- {
- return $this->_bootisoID;
- }
- public function setID($_bootisoID)
- {
- $this->_bootisoID = $_bootisoID;
- return $this;
- }
-
- public function getMembershipID()
- {
- return $this->_membershipID;
- }
-
- public function setMembershipID($_membershipID)
- {
- $this->_membershipID = $_membershipID;
- return $this;
- }
-
- public function getGroupID()
- {
- return $this->_groupID;
- }
-
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getPrebootID()
- {
- return $this->_prebootID;
- }
- public function setPrebootID($_prebootID)
- {
- $this->_prebootID = $_prebootID;
- return $this;
- }
- public function getSerialnumber()
- {
- return $this->_serialnumber;
- }
-
- public function setSerialnumber($_serialnumber)
- {
- $this->_serialnumber = $_serialnumber;
- return $this;
- }
-
- public function getCreated()
- {
- return $this->_created;
- }
-
- public function setCreated($_created)
- {
- $this->_created = $_created;
- return $this;
- }
-
- public function getExpires()
- {
- return $this->_expires;
- }
-
- public function setExpires($_expires)
- {
- $this->_expires = $_expires;
- return $this;
- }
-
- public function getPublic()
- {
- return $this->_public;
- }
-
- public function setPublic($_public)
- {
- $this->_public = $_public;
- return $this;
- }
-
- public function getBootisoID()
- {
- return $this->_bootisoID;
- }
-
- public function setBootisoID($_bootisoID)
- {
- $this->_bootisoID = $_bootisoID;
- return $this;
- }
- public function getDescription()
- {
- return $this->_description;
- }
- public function setDescription($_description)
- {
- $this->_description = $_description;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
- }
- return $result;
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/BootIsoMapper.php b/application/models/BootIsoMapper.php
index 6ca7ad3..3cf5548 100644
--- a/application/models/BootIsoMapper.php
+++ b/application/models/BootIsoMapper.php
@@ -1,142 +1,134 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_BootIsoMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order = false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_BootIso($row);
- $entry->setID($row['bootisoID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_BootIso');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_BootIso $botiso)
- {
-
- $data = array('bootisoID'=> $botiso->getID() ,'membershipID'=> $botiso->getMembershipID() ,'title'=> $botiso->getTitle(),'prebootID'=> $botiso->getPrebootID() ,'groupID'=> $botiso->getGroupID() ,'serialnumber'=> $botiso->getSerialnumber() ,'created'=> $botiso->getCreated() ,'expires'=> $botiso->getExpires() ,'public'=> $botiso->getPublic(), 'description' => $botiso->getDescription() );
-
- if (null === ($id = $botiso->getID()) ) {
- unset($data['bootisoID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('bootisoID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_BootIso $botiso)
- {
- if (null === ($id = $botiso->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('bootisoID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_BootIso $botiso = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($botiso == null){
- $botiso = new Application_Model_BootIso();
- $botiso->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setPrebootID($row->prebootID)->setGroupID($row->groupID)->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)->setPrebootID($row->prebootID)->setGroupID($row->groupID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description);
- }
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_BootIso();
-
- $entry->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setPrebootID($row->prebootID)->setGroupID($row->groupID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_BootIso $v1,Application_Model_BootIso $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_BootIsoMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_BootIso($row);
+ $entry->setID($row['bootisoID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_BootIso');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_BootIso $botiso) {
+
+ $data = array('bootisoID' => $botiso->getID() , 'membershipID' => $botiso->getMembershipID() , 'title' => $botiso->getTitle(), 'prebootID' => $botiso->getPrebootID() , 'groupID' => $botiso->getGroupID() , 'serialnumber' => $botiso->getSerialnumber() , 'created' => $botiso->getCreated() , 'expires' => $botiso->getExpires() , 'public' => $botiso->getPublic(), 'description' => $botiso->getDescription() );
+
+ if (null == = ($id = $botiso->getID()) ) {
+ unset($data['bootisoID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('bootisoID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_BootIso $botiso) {
+ if (null == = ($id = $botiso->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('bootisoID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_BootIso $botiso = null) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ if($botiso == null) {
+ $botiso = new Application_Model_BootIso();
+ $botiso->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setPrebootID($row->prebootID)->setGroupID($row->groupID)->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)->setPrebootID($row->prebootID)->setGroupID($row->groupID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description);
+ }
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_BootIso();
+
+ $entry->setID($row->bootisoID)->setMembershipID($row->membershipID)->setTitle($row->title)->setPrebootID($row->prebootID)->setGroupID($row->groupID)->setSerialnumber($row->serialnumber)->setCreated($row->created)->setExpires($row->expires)->setPublic($row->public)->setDescription($row->description);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_BootIso $v1, Application_Model_BootIso $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
}
diff --git a/application/models/BootMenu.php b/application/models/BootMenu.php
index dae3776..a5b8a68 100644
--- a/application/models/BootMenu.php
+++ b/application/models/BootMenu.php
@@ -1,158 +1,138 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_BootMenu
-{
- protected $_bootmenuID;
- protected $_membershipID;
- protected $_groupID;
- protected $_title;
- protected $_startcounter;
- protected $_created;
- protected $_defaultbootmenu;
-
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
+class Application_Model_BootMenu {
+ protected $_bootmenuID;
+ protected $_membershipID;
+ protected $_groupID;
+ protected $_title;
+ protected $_startcounter;
+ protected $_created;
+ protected $_defaultbootmenu;
+
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
}
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid bootmenu property');
- }
- $this->$method($value);
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid bootmenu property');
}
-
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid bootmenu property');
- }
- return $this->$method();
+ $this->$method($value);
+ }
+
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid bootmenu property');
}
-
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
+ return $this->$method();
+ }
+
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
}
-
- public function getID()
- {
- return $this->_bootmenuID;
- }
- public function setID($_bootmenuID)
- {
- $this->_bootmenuID = $_bootmenuID;
- return $this;
- }
- public function getMembershipID()
- {
- return $this->_membershipID;
- }
- public function setMembershipID($_membershipID)
- {
- $this->_membershipID = $_membershipID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getCreated()
- {
- return $this->_created;
- }
- public function setStartcounter($_startcounter)
- {
- $this->_startcounter = $_startcounter;
- return $this;
- }
- public function getStartcounter()
- {
- return $this->_startcounter;
- }
- public function setCreated($_created)
- {
- $this->_created = $_created;
- return $this;
- }
- public function getDefaultbootmenu()
- {
- return $this->_defaultbootmenu;
- }
- public function setDefaultbootmenu($_defaultbootmenu)
- {
- $this->_defaultbootmenu = $_defaultbootmenu;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ return $this;
+ }
+
+ public function getID() {
+ return $this->_bootmenuID;
+ }
+ public function setID($_bootmenuID) {
+ $this->_bootmenuID = $_bootmenuID;
+ return $this;
+ }
+ public function getMembershipID() {
+ return $this->_membershipID;
+ }
+ public function setMembershipID($_membershipID) {
+ $this->_membershipID = $_membershipID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getCreated() {
+ return $this->_created;
+ }
+ public function setStartcounter($_startcounter) {
+ $this->_startcounter = $_startcounter;
+ return $this;
+ }
+ public function getStartcounter() {
+ return $this->_startcounter;
+ }
+ public function setCreated($_created) {
+ $this->_created = $_created;
+ return $this;
+ }
+ public function getDefaultbootmenu() {
+ return $this->_defaultbootmenu;
+ }
+ public function setDefaultbootmenu($_defaultbootmenu) {
+ $this->_defaultbootmenu = $_defaultbootmenu;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/BootMenuEntries.php b/application/models/BootMenuEntries.php
index 7d53dfb..5d76702 100644
--- a/application/models/BootMenuEntries.php
+++ b/application/models/BootMenuEntries.php
@@ -1,168 +1,146 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_BootMenuEntries
-{
- protected $_bootmenuentriesID;
- protected $_bootosID;
- protected $_bootmenuID;
- protected $_title;
- protected $_kcl;
- protected $_kclappend;
- protected $_configID;
- protected $_order;
-
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
+class Application_Model_BootMenuEntries {
+ protected $_bootmenuentriesID;
+ protected $_bootosID;
+ protected $_bootmenuID;
+ protected $_title;
+ protected $_kcl;
+ protected $_kclappend;
+ protected $_configID;
+ protected $_order;
+
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
}
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid bootmenuentries property');
- }
- $this->$method($value);
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid bootmenuentries property');
}
-
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid bootmenuentries property');
- }
- return $this->$method();
+ $this->$method($value);
+ }
+
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid bootmenuentries property');
}
-
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
+ return $this->$method();
+ }
+
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
}
- public function getID()
- {
- return $this->_bootmenuentriesID;
- }
- public function setID($_bootmenuentriesID)
- {
- $this->_bootmenuentriesID = $_bootmenuentriesID;
- return $this;
- }
- public function getBootosID()
- {
- return $this->_bootosID;
- }
- public function setBootosID($_bootosID)
- {
- $this->_bootosID = $_bootosID;
- return $this;
- }
- public function getBootmenuID()
- {
- return $this->_bootmenuID;
- }
- public function setBootmenuID($_bootmenuID)
- {
- $this->_bootmenuID = $_bootmenuID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getKcl()
- {
- return $this->_kcl;
- }
- public function setKcl($_kcl)
- {
- $this->_kcl = $_kcl;
- return $this;
- }
- public function getKclappend()
- {
- return $this->_kclappend;
- }
- public function setKclappend($_kclappend)
- {
- $this->_kclappend = $_kclappend;
- return $this;
- }
- public function getConfigID()
- {
- return $this->_configID;
- }
- public function setConfigID($_configID)
- {
- $this->_configID = $_configID;
- return $this;
- }
- public function getOrder()
- {
- return $this->_order;
- }
- public function setOrder($_order)
- {
- $this->_order = $_order;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ return $this;
+ }
+ public function getID() {
+ return $this->_bootmenuentriesID;
+ }
+ public function setID($_bootmenuentriesID) {
+ $this->_bootmenuentriesID = $_bootmenuentriesID;
+ return $this;
+ }
+ public function getBootosID() {
+ return $this->_bootosID;
+ }
+ public function setBootosID($_bootosID) {
+ $this->_bootosID = $_bootosID;
+ return $this;
+ }
+ public function getBootmenuID() {
+ return $this->_bootmenuID;
+ }
+ public function setBootmenuID($_bootmenuID) {
+ $this->_bootmenuID = $_bootmenuID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getKcl() {
+ return $this->_kcl;
+ }
+ public function setKcl($_kcl) {
+ $this->_kcl = $_kcl;
+ return $this;
+ }
+ public function getKclappend() {
+ return $this->_kclappend;
+ }
+ public function setKclappend($_kclappend) {
+ $this->_kclappend = $_kclappend;
+ return $this;
+ }
+ public function getConfigID() {
+ return $this->_configID;
+ }
+ public function setConfigID($_configID) {
+ $this->_configID = $_configID;
+ return $this;
+ }
+ public function getOrder() {
+ return $this->_order;
+ }
+ public function setOrder($_order) {
+ $this->_order = $_order;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
}
- return $result;
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
+ }
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/BootMenuEntriesMapper.php b/application/models/BootMenuEntriesMapper.php
index 568dd5f..4978b22 100644
--- a/application/models/BootMenuEntriesMapper.php
+++ b/application/models/BootMenuEntriesMapper.php
@@ -1,185 +1,173 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_BootMenuEntriesMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
-
- foreach($where as $k => $v){
- $where[] = "$k = '$v'";
- }
- $where = implode(" AND " ,$where);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
-
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where)
- ->order('order');
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_BootMenuEntries($row);
- $entry->setID($row['bootmenuentriesID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_BootMenuEntries');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_BootMenuEntries $botmenuentries)
- {
-
- $data = array('bootmenuentriesID' => $botmenuentries->getID(), 'bootosID'=> $botmenuentries->getBootosID() ,'bootmenuID'=> $botmenuentries->getBootmenuID() ,'configID'=> $botmenuentries->getConfigID() ,'title'=> $botmenuentries->getTitle() ,'kcl'=> $botmenuentries->getKcl(),'kclappend'=> $botmenuentries->getKclappend() ,'order'=> $botmenuentries->getOrder() );
-
- if (null === ($id = $botmenuentries->getID()) ) {
- unset($data['bootmenuentriesID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('bootmenuentriesID = ?' => $id));
- }
- }
-
- public function order(Application_Model_BootMenuEntries $botmenuentries)
- {
- $db = Zend_Db_Table::getDefaultAdapter();
- $stmt = $db->query("UPDATE pbs_bootmenuentries SET `order` = `order` + 1 WHERE `order` >= ". $botmenuentries->getOrder() . " AND `bootmenuID` = " . $botmenuentries->getBootmenuID());
- }
-
- public function orderremove(Application_Model_BootMenuEntries $botmenuentries)
- {
- $db = Zend_Db_Table::getDefaultAdapter();
- $stmt = $db->query("UPDATE pbs_bootmenuentries SET `order` = `order` - 1 WHERE `order` > ". $botmenuentries->getOrder() . " AND `bootmenuID` = " . $botmenuentries->getBootmenuID());
- }
-
- public function orderbefore(Application_Model_BootMenuEntries $botmenuentries, $oldval)
- {
- $db = Zend_Db_Table::getDefaultAdapter();
- print_a($botmenuentries, $oldval);
- $stmt = $db->query("UPDATE pbs_bootmenuentries SET `order` = `order` + 1 WHERE `order` >= ". $botmenuentries->getOrder() . " AND `order` < " . $oldval . " AND `bootmenuID` = " . $botmenuentries->getBootmenuID());
- }
-
- public function orderafter(Application_Model_BootMenuEntries $botmenuentries, $oldval)
- {
- $db = Zend_Db_Table::getDefaultAdapter();
- print_a($botmenuentries, $oldval);
- $stmt = $db->query("UPDATE pbs_bootmenuentries SET `order` = `order` - 1 WHERE `order` <= ". $botmenuentries->getOrder() . " AND `order` > " . $oldval . " AND `bootmenuID` = " . $botmenuentries->getBootmenuID());
- }
-
- public function delete(Application_Model_BootMenuEntries $botmenuentries)
- {
- if (null === ($id = $botmenuentries->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('bootmenuentriesID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_BootMenuEntries $botmenuentries = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($botmenuentries == null){
- $botmenuentries = new Application_Model_BootMenuEntries();
- $botmenuentries->setID($row->bootmenuentriesID)
- ->setBootosID($row->bootosID)
- ->setBootmenuID($row->bootmenuID)
- ->setTitle($row->title)
- ->setConfigID($row->configID)
- ->setKcl($row->kcl)
- ->setKclappend($row->kclappend)
- ->setOrder($row->order);
- return $botmenuentries;
- }else{
- $botmenuentries->setID($row->bootmenuentriesID)
- ->setBootosID($row->bootosID)
- ->setBootmenuID($row->bootmenuID)
- ->setTitle($row->title)
- ->setConfigID($row->configID)
- ->setKcl($row->kcl)
- ->setKclappend($row->kclappend)
- ->setOrder($row->order);
- }
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_BootMenuEntries();
- $entry->setID($row->bootmenuentriesID)->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setKclappend($row->kclappend)->setOrder($row->order);
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_BootMenuEntries $v1,Application_Model_BootMenuEntries $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_BootMenuEntriesMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+
+ foreach($where as $k => $v) {
+ $where[] = "$k = '$v'";
+ }
+ $where = implode(" AND " , $where);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where)
+ ->order('order');
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_BootMenuEntries($row);
+ $entry->setID($row['bootmenuentriesID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_BootMenuEntries');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_BootMenuEntries $botmenuentries) {
+
+ $data = array('bootmenuentriesID' => $botmenuentries->getID(), 'bootosID' => $botmenuentries->getBootosID() , 'bootmenuID' => $botmenuentries->getBootmenuID() , 'configID' => $botmenuentries->getConfigID() , 'title' => $botmenuentries->getTitle() , 'kcl' => $botmenuentries->getKcl(), 'kclappend' => $botmenuentries->getKclappend() , 'order' => $botmenuentries->getOrder() );
+
+ if (null == = ($id = $botmenuentries->getID()) ) {
+ unset($data['bootmenuentriesID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('bootmenuentriesID = ?' => $id));
+ }
+ }
+
+ public function order(Application_Model_BootMenuEntries $botmenuentries) {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $stmt = $db->query("UPDATE pbs_bootmenuentries SET `order` = `order` + 1 WHERE `order` >= ". $botmenuentries->getOrder() . " AND `bootmenuID` = " . $botmenuentries->getBootmenuID());
+ }
+
+ public function orderremove(Application_Model_BootMenuEntries $botmenuentries) {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $stmt = $db->query("UPDATE pbs_bootmenuentries SET `order` = `order` - 1 WHERE `order` > ". $botmenuentries->getOrder() . " AND `bootmenuID` = " . $botmenuentries->getBootmenuID());
+ }
+
+ public function orderbefore(Application_Model_BootMenuEntries $botmenuentries, $oldval) {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ print_a($botmenuentries, $oldval);
+ $stmt = $db->query("UPDATE pbs_bootmenuentries SET `order` = `order` + 1 WHERE `order` >= ". $botmenuentries->getOrder() . " AND `order` < " . $oldval . " AND `bootmenuID` = " . $botmenuentries->getBootmenuID());
+ }
+
+ public function orderafter(Application_Model_BootMenuEntries $botmenuentries, $oldval) {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ print_a($botmenuentries, $oldval);
+ $stmt = $db->query("UPDATE pbs_bootmenuentries SET `order` = `order` - 1 WHERE `order` <= ". $botmenuentries->getOrder() . " AND `order` > " . $oldval . " AND `bootmenuID` = " . $botmenuentries->getBootmenuID());
+ }
+
+ public function delete(Application_Model_BootMenuEntries $botmenuentries) {
+ if (null == = ($id = $botmenuentries->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('bootmenuentriesID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_BootMenuEntries $botmenuentries = null) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ if($botmenuentries == null) {
+ $botmenuentries = new Application_Model_BootMenuEntries();
+ $botmenuentries->setID($row->bootmenuentriesID)
+ ->setBootosID($row->bootosID)
+ ->setBootmenuID($row->bootmenuID)
+ ->setTitle($row->title)
+ ->setConfigID($row->configID)
+ ->setKcl($row->kcl)
+ ->setKclappend($row->kclappend)
+ ->setOrder($row->order);
+ return $botmenuentries;
+ } else {
+ $botmenuentries->setID($row->bootmenuentriesID)
+ ->setBootosID($row->bootosID)
+ ->setBootmenuID($row->bootmenuID)
+ ->setTitle($row->title)
+ ->setConfigID($row->configID)
+ ->setKcl($row->kcl)
+ ->setKclappend($row->kclappend)
+ ->setOrder($row->order);
+ }
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_BootMenuEntries();
+ $entry->setID($row->bootmenuentriesID)->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setKclappend($row->kclappend)->setOrder($row->order);
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_BootMenuEntries $v1, Application_Model_BootMenuEntries $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/BootMenuMapper.php b/application/models/BootMenuMapper.php
index 6ba72bd..a729979 100644
--- a/application/models/BootMenuMapper.php
+++ b/application/models/BootMenuMapper.php
@@ -1,166 +1,158 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_BootMenuMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_BootMenu($row);
- $entry->setID($row['bootmenuID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_BootMenu');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_BootMenu $botmenu)
- {
-
- $data = array('bootmenuID'=> $botmenu->getID() ,
- 'membershipID'=> $botmenu->getMembershipID(),
- 'groupID'=> $botmenu->getGroupID() ,
- 'title'=> $botmenu->getTitle() ,
- 'startcounter'=> $botmenu->getStartcounter() ,
- 'created'=> $botmenu->getCreated(),
- 'defaultbootmenu' => $botmenu->getDefaultbootmenu());
-
- if (null === ($id = $botmenu->getID()) ) {
- unset($data['bootmenuID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('bootmenuID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_BootMenu $botmenu)
- {
- if (null === ($id = $botmenu->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('bootmenuID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_BootMenu $botmenu = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
- $row = $result->current();
-
- if($botmenu == null){
- $botmenu = new Application_Model_BootMenu();
- $botmenu->setID($row->bootmenuID)
- ->setMembershipID($row->membershipID)
- ->setGroupID($row->groupID)
- ->setTitle($row->title)
- ->setStartcounter($row->startcounter)
- ->setCreated($row->created)
- ->setDefaultbootmenu($row->defaultbootmenu);
- return $botmenu;
- }else{
- $botmenu->setID($row->bootmenuID)
- ->setMembershipID($row->membershipID)
- ->setGroupID($row->groupID)
- ->setTitle($row->title)
- ->setStartcounter($row->startcounter)
- ->setCreated($row->created)
- ->setDefaultbootmenu($row->defaultbootmenu);
- }
-
-
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_BootMenu();
-
- $entry->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setStartcounter($row->startcounter)->setCreated($row->created)->setDefault($row->default);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_BootMenu $v1,Application_Model_BootMenu $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_BootMenuMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_BootMenu($row);
+ $entry->setID($row['bootmenuID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_BootMenu');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_BootMenu $botmenu) {
+
+ $data = array('bootmenuID' => $botmenu->getID() ,
+ 'membershipID' => $botmenu->getMembershipID(),
+ 'groupID' => $botmenu->getGroupID() ,
+ 'title' => $botmenu->getTitle() ,
+ 'startcounter' => $botmenu->getStartcounter() ,
+ 'created' => $botmenu->getCreated(),
+ 'defaultbootmenu' => $botmenu->getDefaultbootmenu());
+
+ if (null == = ($id = $botmenu->getID()) ) {
+ unset($data['bootmenuID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('bootmenuID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_BootMenu $botmenu) {
+ if (null == = ($id = $botmenu->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('bootmenuID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_BootMenu $botmenu = null) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+ $row = $result->current();
+
+ if($botmenu == null) {
+ $botmenu = new Application_Model_BootMenu();
+ $botmenu->setID($row->bootmenuID)
+ ->setMembershipID($row->membershipID)
+ ->setGroupID($row->groupID)
+ ->setTitle($row->title)
+ ->setStartcounter($row->startcounter)
+ ->setCreated($row->created)
+ ->setDefaultbootmenu($row->defaultbootmenu);
+ return $botmenu;
+ } else {
+ $botmenu->setID($row->bootmenuID)
+ ->setMembershipID($row->membershipID)
+ ->setGroupID($row->groupID)
+ ->setTitle($row->title)
+ ->setStartcounter($row->startcounter)
+ ->setCreated($row->created)
+ ->setDefaultbootmenu($row->defaultbootmenu);
+ }
+
+
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_BootMenu();
+
+ $entry->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setStartcounter($row->startcounter)->setCreated($row->created)->setDefault($row->default);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_BootMenu $v1, Application_Model_BootMenu $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/BootOs.php b/application/models/BootOs.php
index f095720..ebf1750 100644
--- a/application/models/BootOs.php
+++ b/application/models/BootOs.php
@@ -1,229 +1,195 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_BootOs
-{
- protected $_bootosID;
- protected $_groupID;
- protected $_membershipID;
- protected $_title;
- protected $_defaultkcl;
- protected $_created;
- protected $_description;
- protected $_expires;
- protected $_public;
- protected $_source;
- protected $_distro;
- protected $_distroversion;
- protected $_shortname;
- protected $_share;
+class Application_Model_BootOs {
+ protected $_bootosID;
+ protected $_groupID;
+ protected $_membershipID;
+ protected $_title;
+ protected $_defaultkcl;
+ protected $_created;
+ protected $_description;
+ protected $_expires;
+ protected $_public;
+ protected $_source;
+ protected $_distro;
+ protected $_distroversion;
+ protected $_shortname;
+ protected $_share;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid bootos property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid bootos property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid bootos property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid bootos property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_bootosID;
- }
- public function setID($_bootosID)
- {
- $this->_bootosID = $_bootosID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getMembershipID()
- {
- return $this->_membershipID;
- }
- public function setMembershipID($_membershipID)
- {
- $this->_membershipID = $_membershipID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getDescription()
- {
- return $this->_description;
- }
- public function setDescription($_description)
- {
- $this->_description = $_description;
- return $this;
- }
- public function getDefaultkcl()
- {
- return $this->_defaultkcl;
- }
- public function setDefaultkcl($_defaultkcl)
- {
- $this->_defaultkcl = $_defaultkcl;
- return $this;
- }
- public function getCreated()
- {
- return $this->_created;
- }
- public function setCreated($_created)
- {
- $this->_created = $_created;
- return $this;
- }
- public function getExpires()
- {
- return $this->_expires;
- }
- public function setExpires($_expires)
- {
- $this->_expires = $_expires;
- return $this;
- }
- public function getPublic()
- {
- return $this->_public;
- }
- public function setPublic($_public)
- {
- $this->_public = $_public;
- return $this;
- }
- public function getSource()
- {
- return $this->_source;
- }
- public function setSource($_source)
- {
- $this->_source = $_source;
- return $this;
- }
- public function getDistro()
- {
- return $this->_distro;
- }
- public function setDistro($_distro)
- {
- $this->_distro = $_distro;
- return $this;
- }
- public function getDistroversion()
- {
- return $this->_distroversion;
- }
- public function setDistroversion($_distroversion)
- {
- $this->_distroversion = $_distroversion;
- return $this;
- }
- public function getShortname()
- {
- return $this->_shortname;
- }
- public function setShortname($_shortname)
- {
- $this->_shortname = $_shortname;
- return $this;
- }
- public function getShare()
- {
- return $this->_share;
- }
- public function setShare($_share)
- {
- $this->_share = $_share;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_bootosID;
+ }
+ public function setID($_bootosID) {
+ $this->_bootosID = $_bootosID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getMembershipID() {
+ return $this->_membershipID;
+ }
+ public function setMembershipID($_membershipID) {
+ $this->_membershipID = $_membershipID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getDescription() {
+ return $this->_description;
+ }
+ public function setDescription($_description) {
+ $this->_description = $_description;
+ return $this;
+ }
+ public function getDefaultkcl() {
+ return $this->_defaultkcl;
+ }
+ public function setDefaultkcl($_defaultkcl) {
+ $this->_defaultkcl = $_defaultkcl;
+ return $this;
+ }
+ public function getCreated() {
+ return $this->_created;
+ }
+ public function setCreated($_created) {
+ $this->_created = $_created;
+ return $this;
+ }
+ public function getExpires() {
+ return $this->_expires;
+ }
+ public function setExpires($_expires) {
+ $this->_expires = $_expires;
+ return $this;
+ }
+ public function getPublic() {
+ return $this->_public;
+ }
+ public function setPublic($_public) {
+ $this->_public = $_public;
+ return $this;
+ }
+ public function getSource() {
+ return $this->_source;
+ }
+ public function setSource($_source) {
+ $this->_source = $_source;
+ return $this;
+ }
+ public function getDistro() {
+ return $this->_distro;
+ }
+ public function setDistro($_distro) {
+ $this->_distro = $_distro;
+ return $this;
+ }
+ public function getDistroversion() {
+ return $this->_distroversion;
+ }
+ public function setDistroversion($_distroversion) {
+ $this->_distroversion = $_distroversion;
+ return $this;
+ }
+ public function getShortname() {
+ return $this->_shortname;
+ }
+ public function setShortname($_shortname) {
+ $this->_shortname = $_shortname;
+ return $this;
+ }
+ public function getShare() {
+ return $this->_share;
+ }
+ public function setShare($_share) {
+ $this->_share = $_share;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/BootOsMapper.php b/application/models/BootOsMapper.php
index 2bde6db..dcee7db 100644
--- a/application/models/BootOsMapper.php
+++ b/application/models/BootOsMapper.php
@@ -1,146 +1,138 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_BootOsMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_BootOs($row);
- $entry->setID($row['bootosID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_BootOs');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_BootOs $botos)
- {
- $data = array('bootosID'=> $botos->getID() ,'groupID'=> $botos->getGroupID() ,'title'=> $botos->getTitle(), 'membershipID'=> $botos->getMembershipID(),'defaultkcl'=> $botos->getDefaultkcl() ,'created'=> $botos->getCreated() ,'description'=> $botos->getDescription() ,'expires'=> $botos->getExpires() ,'public'=> $botos->getPublic(),'source'=> $botos->getSource(),'distro'=> $botos->getDistro(),'distroversion'=> $botos->getDistroversion(),'shortname'=> $botos->getShortname(),'share'=> $botos->getShare() );
- if (null === ($id = $botos->getID()) ) {
- unset($data['bootosID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('bootosID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_BootOs $botos)
- {
- if (null === ($id = $botos->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('bootosID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_BootOs $botos = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($botos == null){
- $botos = new Application_Model_BootOs();
- $botos->setID($row->bootosID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public)->setSource($row->source)->setDistro($row->distro)->setDistroversion($row->distroversion)->setShortname($row->shortname)->setShare($row->share);
- return $botos;
- }else{
- $botos->setID($row->bootosID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public)->setSource($row->source)->setDistro($row->distro)->setDistroversion($row->distroversion)->setShortname($row->shortname)->setShare($row->share);
- }
-
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_BootOs();
-
- $entry->setID($row->bootosID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public)->setSource($row->source)->setDistro($row->distro)->setDistroversion($row->distroversion)->setShortname($row->shortname)->setShare($row->share);
-
- $entries[$row->bootosID] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_BootOs $v1,Application_Model_BootOs $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_BootOsMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_BootOs($row);
+ $entry->setID($row['bootosID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_BootOs');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_BootOs $botos) {
+ $data = array('bootosID' => $botos->getID() , 'groupID' => $botos->getGroupID() , 'title' => $botos->getTitle(), 'membershipID' => $botos->getMembershipID(), 'defaultkcl' => $botos->getDefaultkcl() , 'created' => $botos->getCreated() , 'description' => $botos->getDescription() , 'expires' => $botos->getExpires() , 'public' => $botos->getPublic(), 'source' => $botos->getSource(), 'distro' => $botos->getDistro(), 'distroversion' => $botos->getDistroversion(), 'shortname' => $botos->getShortname(), 'share' => $botos->getShare() );
+ if (null == = ($id = $botos->getID()) ) {
+ unset($data['bootosID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('bootosID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_BootOs $botos) {
+ if (null == = ($id = $botos->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('bootosID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_BootOs $botos = null) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ if($botos == null) {
+ $botos = new Application_Model_BootOs();
+ $botos->setID($row->bootosID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public)->setSource($row->source)->setDistro($row->distro)->setDistroversion($row->distroversion)->setShortname($row->shortname)->setShare($row->share);
+ return $botos;
+ } else {
+ $botos->setID($row->bootosID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public)->setSource($row->source)->setDistro($row->distro)->setDistroversion($row->distroversion)->setShortname($row->shortname)->setShare($row->share);
+ }
+
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_BootOs();
+
+ $entry->setID($row->bootosID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public)->setSource($row->source)->setDistro($row->distro)->setDistroversion($row->distroversion)->setShortname($row->shortname)->setShare($row->share);
+
+ $entries[$row->bootosID] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_BootOs $v1, Application_Model_BootOs $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/BootOsUser.php b/application/models/BootOsUser.php
index aefd311..ee68b19 100644
--- a/application/models/BootOsUser.php
+++ b/application/models/BootOsUser.php
@@ -1,154 +1,136 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_BootOsUser
-{
- protected $_bootosuserID;
- protected $_configID;
- protected $_login;
- protected $_password;
- protected $_homepath;
- protected $_hometypeID;
-
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
+class Application_Model_BootOsUser {
+ protected $_bootosuserID;
+ protected $_configID;
+ protected $_login;
+ protected $_password;
+ protected $_homepath;
+ protected $_hometypeID;
+
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
}
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid BootOsUser property');
- }
- $this->$method($value);
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid BootOsUser property');
}
-
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid BootOsUser property');
- }
- return $this->$method();
+ $this->$method($value);
+ }
+
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid BootOsUser property');
}
-
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
+ return $this->$method();
+ }
+
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
}
+ return $this;
+ }
- public function getID()
- {
- return $this->_bootosuserID;
- }
- public function setID($_bootosuserID)
- {
- $this->_bootosuserID = $_bootosuserID;
- return $this;
- }
+ public function getID() {
+ return $this->_bootosuserID;
+ }
+ public function setID($_bootosuserID) {
+ $this->_bootosuserID = $_bootosuserID;
+ return $this;
+ }
- public function getConfigID()
- {
- return $this->_configID;
- }
+ public function getConfigID() {
+ return $this->_configID;
+ }
- public function setConfigID($_configID)
- {
- $this->_configID = $_configID;
- return $this;
- }
+ public function setConfigID($_configID) {
+ $this->_configID = $_configID;
+ return $this;
+ }
- public function getLogin()
- {
- return $this->_login;
- }
+ public function getLogin() {
+ return $this->_login;
+ }
- public function setLogin($_login)
- {
- $this->_login = $_login;
- return $this;
- }
- public function getPassword()
- {
- return $this->_password;
- }
+ public function setLogin($_login) {
+ $this->_login = $_login;
+ return $this;
+ }
+ public function getPassword() {
+ return $this->_password;
+ }
- public function setPassword($_password)
- {
- $this->_password = $_password;
- return $this;
- }
-
- public function getHomepath()
- {
- return $this->_homepath;
- }
- public function setHomepath($_homepath)
- {
- $this->_homepath = $_homepath;
- return $this;
- }
- public function getHometypeID()
- {
- return $this->_hometypeID;
- }
- public function setHometypeID($_hometypeID)
- {
- $this->_hometypeID = $_hometypeID;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function setPassword($_password) {
+ $this->_password = $_password;
+ return $this;
+ }
+
+ public function getHomepath() {
+ return $this->_homepath;
+ }
+ public function setHomepath($_homepath) {
+ $this->_homepath = $_homepath;
+ return $this;
+ }
+ public function getHometypeID() {
+ return $this->_hometypeID;
+ }
+ public function setHometypeID($_hometypeID) {
+ $this->_hometypeID = $_hometypeID;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/BootOsUserMapper.php b/application/models/BootOsUserMapper.php
index f93cd3f..c33645b 100644
--- a/application/models/BootOsUserMapper.php
+++ b/application/models/BootOsUserMapper.php
@@ -1,146 +1,138 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_BootOsUserMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_BootOsUser($row);
- $entry->setID($row['bootosuserID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_BootOsUser');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_BootOsUser $user)
- {
- $data = array('bootosuserID'=> $user->getID() ,'configID'=> $user->getConfigID() ,'login'=> $user->getLogin(), 'password'=> $user->getPassword(),'homepath'=> $user->getHomepath() ,'hometypeID'=> $user->getHometypeID());
- if (null === ($id = $user->getID()) ) {
- unset($data['bootosuserID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('bootosuserID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_BootOsUser $user)
- {
- if (null === ($id = $user->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('bootosuserID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_BootOsUser $user = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($user == null){
- $user = new Application_Model_BootOsUser();
- $user->setID($row->bootosuserID)->setconfigID($row->configID)->setLogin($row->login)->setPassword($row->password)->setHomepath($row->homepath)->setHometypeID($row->hometypeID);
- return $user;
- }else{
- $user->setID($row->bootosuserID)->setconfigID($row->configID)->setLogin($row->login)->setPassword($row->password)->setHomepath($row->homepath)->setHometypeID($row->hometypeID);
- }
-
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_BootOsUser();
-
- $user->setID($row->bootosuserID)->setconfigID($row->configID)->setLogin($row->login)->setPassword($row->password)->setHomepath($row->homepath)->setHometypeID($row->hometypeID);
-
- $entries[$row->bootosuserID] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_BootOsUser $v1,Application_Model_BootOsUser $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_BootOsUserMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_BootOsUser($row);
+ $entry->setID($row['bootosuserID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_BootOsUser');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_BootOsUser $user) {
+ $data = array('bootosuserID' => $user->getID() , 'configID' => $user->getConfigID() , 'login' => $user->getLogin(), 'password' => $user->getPassword(), 'homepath' => $user->getHomepath() , 'hometypeID' => $user->getHometypeID());
+ if (null == = ($id = $user->getID()) ) {
+ unset($data['bootosuserID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('bootosuserID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_BootOsUser $user) {
+ if (null == = ($id = $user->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('bootosuserID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_BootOsUser $user = null) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ if($user == null) {
+ $user = new Application_Model_BootOsUser();
+ $user->setID($row->bootosuserID)->setconfigID($row->configID)->setLogin($row->login)->setPassword($row->password)->setHomepath($row->homepath)->setHometypeID($row->hometypeID);
+ return $user;
+ } else {
+ $user->setID($row->bootosuserID)->setconfigID($row->configID)->setLogin($row->login)->setPassword($row->password)->setHomepath($row->homepath)->setHometypeID($row->hometypeID);
+ }
+
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_BootOsUser();
+
+ $user->setID($row->bootosuserID)->setconfigID($row->configID)->setLogin($row->login)->setPassword($row->password)->setHomepath($row->homepath)->setHometypeID($row->hometypeID);
+
+ $entries[$row->bootosuserID] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_BootOsUser $v1, Application_Model_BootOsUser $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/Client.php b/application/models/Client.php
index e8108ef..a11c6ad 100644
--- a/application/models/Client.php
+++ b/application/models/Client.php
@@ -1,139 +1,123 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Client
-{
- protected $_clientID;
- protected $_groupID;
- protected $_macadress;
- protected $_hardwarehash;
- protected $_created;
+class Application_Model_Client {
+ protected $_clientID;
+ protected $_groupID;
+ protected $_macadress;
+ protected $_hardwarehash;
+ protected $_created;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid client property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid client property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid client property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid client property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_clientID;
- }
- public function setID($_clientID)
- {
- $this->_clientID = $_clientID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getMacadress()
- {
- return $this->_macadress;
- }
- public function setMacadress($_macadress)
- {
- $this->_macadress = $_macadress;
- return $this;
- }
- public function getHardwarehash()
- {
- return $this->_hardwarehash;
- }
- public function setHardwarehash($_hardwarehash)
- {
- $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
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_clientID;
+ }
+ public function setID($_clientID) {
+ $this->_clientID = $_clientID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getMacadress() {
+ return $this->_macadress;
+ }
+ public function setMacadress($_macadress) {
+ $this->_macadress = $_macadress;
+ return $this;
+ }
+ public function getHardwarehash() {
+ return $this->_hardwarehash;
+ }
+ public function setHardwarehash($_hardwarehash) {
+ $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
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/ClientMapper.php b/application/models/ClientMapper.php
index bcb3286..e02a074 100644
--- a/application/models/ClientMapper.php
+++ b/application/models/ClientMapper.php
@@ -1,153 +1,145 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_ClientMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Client($row);
- $entry->setID($row['clientID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Client');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Client $client)
- {
-
- $data = array('clientID'=> $client->getID() ,
- 'groupID' => $client->getGroupID(),
- 'macadress'=> $client->getMacadress() ,
- 'hardwarehash'=> $client->getHardwarehash(),
- 'created'=> $client->getCreated()
- );
-
- if (null === ($id = $client->getID()) ) {
- unset($data['clientID']);
- return $this->getDbTable()->insert($data);
- } else {
- return $this->getDbTable()->update($data, array('clientID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Client $client)
- {
- if (null === ($id = $client->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('clientID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Client $client)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $client->setID($row->clientID)
- ->setGroupID($row->groupID)
- ->setMacadress($row->macadress)
- ->setHardwarehash($row->hardwarehash)
- ->setCreated($row->created);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Client();
-
- $entry->setID($row->clientID)
- ->setGroupID($row->groupID)
- ->setMacadress($row->macadress)
- ->setHardwarehash($row->hardwarehash)
- ->setCreated($row->created);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Client $v1,Application_Model_Client $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_ClientMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Client($row);
+ $entry->setID($row['clientID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Client');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Client $client) {
+
+ $data = array('clientID' => $client->getID() ,
+ 'groupID' => $client->getGroupID(),
+ 'macadress' => $client->getMacadress() ,
+ 'hardwarehash' => $client->getHardwarehash(),
+ 'created' => $client->getCreated()
+ );
+
+ if (null == = ($id = $client->getID()) ) {
+ unset($data['clientID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ return $this->getDbTable()->update($data, array('clientID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Client $client) {
+ if (null == = ($id = $client->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('clientID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_Client $client) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $client->setID($row->clientID)
+ ->setGroupID($row->groupID)
+ ->setMacadress($row->macadress)
+ ->setHardwarehash($row->hardwarehash)
+ ->setCreated($row->created);
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Client();
+
+ $entry->setID($row->clientID)
+ ->setGroupID($row->groupID)
+ ->setMacadress($row->macadress)
+ ->setHardwarehash($row->hardwarehash)
+ ->setCreated($row->created);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Client $v1, Application_Model_Client $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
}
diff --git a/application/models/Config.php b/application/models/Config.php
index 295f922..5f5a288 100644
--- a/application/models/Config.php
+++ b/application/models/Config.php
@@ -1,170 +1,148 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Config
-{
- protected $_configID;
- protected $_groupID;
- protected $_membershipID;
- protected $_title;
- protected $_description;
- protected $_visible;
- protected $_bootosID;
- protected $_created;
+class Application_Model_Config {
+ protected $_configID;
+ protected $_groupID;
+ protected $_membershipID;
+ protected $_title;
+ protected $_description;
+ protected $_visible;
+ protected $_bootosID;
+ protected $_created;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid config property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid config property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid config property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid config property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_configID;
- }
- public function setID($_configID)
- {
- $this->_configID = $_configID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getMembershipID()
- {
- return $this->_membershipID;
- }
- public function setMembershipID($_membershipID)
- {
- $this->_membershipID = $_membershipID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getCreated()
- {
- return $this->_created;
- }
- public function setCreated($_created)
- {
- $this->_created = $_created;
- return $this;
- }
- public function getDescription()
- {
- return $this->_description;
- }
- public function setDescription($_description)
- {
- $this->_description = $_description;
- return $this;
- }
- public function getVisible()
- {
- return $this->_visible;
- }
- public function setVisible($_visible)
- {
- $this->_visible = $_visible;
- return $this;
- }
- public function getBootosID()
- {
- return $this->_bootosID;
- }
- public function setBootosID($_bootosID)
- {
- $this->_bootosID = $_bootosID;
- return $this;
- }
-
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_configID;
+ }
+ public function setID($_configID) {
+ $this->_configID = $_configID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getMembershipID() {
+ return $this->_membershipID;
+ }
+ public function setMembershipID($_membershipID) {
+ $this->_membershipID = $_membershipID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getCreated() {
+ return $this->_created;
+ }
+ public function setCreated($_created) {
+ $this->_created = $_created;
+ return $this;
+ }
+ public function getDescription() {
+ return $this->_description;
+ }
+ public function setDescription($_description) {
+ $this->_description = $_description;
+ return $this;
+ }
+ public function getVisible() {
+ return $this->_visible;
+ }
+ public function setVisible($_visible) {
+ $this->_visible = $_visible;
+ return $this;
+ }
+ public function getBootosID() {
+ return $this->_bootosID;
+ }
+ public function setBootosID($_bootosID) {
+ $this->_bootosID = $_bootosID;
+ return $this;
+ }
+
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/ConfigMapper.php b/application/models/ConfigMapper.php
index f46bd72..63891f3 100644
--- a/application/models/ConfigMapper.php
+++ b/application/models/ConfigMapper.php
@@ -1,148 +1,140 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_ConfigMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Config($row);
- $entry->setID($row['configID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Config');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Config $config)
- {
-
- $data = array('configID'=> $config->getID() ,'groupID'=> $config->getGroupID(), 'membershipID'=> $config->getMembershipID(), 'title'=> $config->getTitle() , 'created'=> $config->getCreated(), 'description' => $config->getDescription(), 'visible' => $config->getVisible(), 'bootosID' => $config->getBootosID() );
-
- if (null === ($id = $config->getID()) ) {
- unset($data['configID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('configID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Config $config)
- {
- if (null === ($id = $config->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('configID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Config $config = null)
- {
-
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($config == null){
- $config = new Application_Model_Config();
- $config->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setTitle($row->title)->setDescription($row->description)->setVisible($row->visible)->setBootosID($row->bootosID);
- return $config;
- }else{
- $config->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setTitle($row->title)->setDescription($row->description)->setVisible($row->visible)->setBootosID($row->bootosID);
- }
-
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Config();
-
- $entry->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setTitle($row->title)->setDescription($row->description)->setVisible($row->visible)->setBootosID($row->bootosID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Config $v1,Application_Model_Config $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_ConfigMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Config($row);
+ $entry->setID($row['configID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Config');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Config $config) {
+
+ $data = array('configID' => $config->getID() , 'groupID' => $config->getGroupID(), 'membershipID' => $config->getMembershipID(), 'title' => $config->getTitle() , 'created' => $config->getCreated(), 'description' => $config->getDescription(), 'visible' => $config->getVisible(), 'bootosID' => $config->getBootosID() );
+
+ if (null == = ($id = $config->getID()) ) {
+ unset($data['configID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('configID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Config $config) {
+ if (null == = ($id = $config->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('configID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_Config $config = null) {
+
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ if($config == null) {
+ $config = new Application_Model_Config();
+ $config->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setTitle($row->title)->setDescription($row->description)->setVisible($row->visible)->setBootosID($row->bootosID);
+ return $config;
+ } else {
+ $config->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setTitle($row->title)->setDescription($row->description)->setVisible($row->visible)->setBootosID($row->bootosID);
+ }
+
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Config();
+
+ $entry->setID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setCreated($row->created)->setTitle($row->title)->setDescription($row->description)->setVisible($row->visible)->setBootosID($row->bootosID);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Config $v1, Application_Model_Config $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/DbTable/BootIso.php b/application/models/DbTable/BootIso.php
index 088654d..eb47ef0 100644
--- a/application/models/DbTable/BootIso.php
+++ b/application/models/DbTable/BootIso.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_BootIso extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_BootIso extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_bootiso';
+ protected $_name = 'pbs_bootiso';
}
diff --git a/application/models/DbTable/BootMenu.php b/application/models/DbTable/BootMenu.php
index 3c35d6c..471c3a2 100644
--- a/application/models/DbTable/BootMenu.php
+++ b/application/models/DbTable/BootMenu.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_BootMenu extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_BootMenu extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_bootmenu';
+ protected $_name = 'pbs_bootmenu';
}
diff --git a/application/models/DbTable/BootMenuEntries.php b/application/models/DbTable/BootMenuEntries.php
index 2f74b32..836dfd8 100644
--- a/application/models/DbTable/BootMenuEntries.php
+++ b/application/models/DbTable/BootMenuEntries.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_BootMenuEntries extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_BootMenuEntries extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_bootmenuentries';
+ protected $_name = 'pbs_bootmenuentries';
}
diff --git a/application/models/DbTable/BootOs.php b/application/models/DbTable/BootOs.php
index a61167a..c6c80c9 100644
--- a/application/models/DbTable/BootOs.php
+++ b/application/models/DbTable/BootOs.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_BootOs extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_BootOs extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_bootos';
+ protected $_name = 'pbs_bootos';
}
diff --git a/application/models/DbTable/BootOsUser.php b/application/models/DbTable/BootOsUser.php
index 976e21a..1dccf73 100644
--- a/application/models/DbTable/BootOsUser.php
+++ b/application/models/DbTable/BootOsUser.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_BootOsUser extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_BootOsUser extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_bootosuser';
+ protected $_name = 'pbs_bootosuser';
}
diff --git a/application/models/DbTable/Client.php b/application/models/DbTable/Client.php
index 59d71a1..a67a04e 100644
--- a/application/models/DbTable/Client.php
+++ b/application/models/DbTable/Client.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Client extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Client extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_client';
+ protected $_name = 'pbs_client';
}
diff --git a/application/models/DbTable/Config.php b/application/models/DbTable/Config.php
index 56b6a41..de194a9 100644
--- a/application/models/DbTable/Config.php
+++ b/application/models/DbTable/Config.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Config extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Config extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_config';
+ protected $_name = 'pbs_config';
}
diff --git a/application/models/DbTable/Filter.php b/application/models/DbTable/Filter.php
index 545c587..225076e 100644
--- a/application/models/DbTable/Filter.php
+++ b/application/models/DbTable/Filter.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Filter extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Filter extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_filter';
+ protected $_name = 'pbs_filter';
}
diff --git a/application/models/DbTable/FilterEntries.php b/application/models/DbTable/FilterEntries.php
index f421bd3..2df226a 100644
--- a/application/models/DbTable/FilterEntries.php
+++ b/application/models/DbTable/FilterEntries.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_FilterEntries extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_FilterEntries extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_filterentries';
+ protected $_name = 'pbs_filterentries';
}
diff --git a/application/models/DbTable/FilterType.php b/application/models/DbTable/FilterType.php
index 595e6ca..daabac2 100644
--- a/application/models/DbTable/FilterType.php
+++ b/application/models/DbTable/FilterType.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_FilterType extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_FilterType extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_filtertype';
+ protected $_name = 'pbs_filtertype';
}
diff --git a/application/models/DbTable/Group.php b/application/models/DbTable/Group.php
index d31d93a..aaf3c47 100644
--- a/application/models/DbTable/Group.php
+++ b/application/models/DbTable/Group.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Group extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Group extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_group';
+ protected $_name = 'pbs_group';
}
diff --git a/application/models/DbTable/GroupGroups.php b/application/models/DbTable/GroupGroups.php
index bd7c7c4..eebd43b 100644
--- a/application/models/DbTable/GroupGroups.php
+++ b/application/models/DbTable/GroupGroups.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_GroupGroups extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_GroupGroups extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_groupgroups';
+ protected $_name = 'pbs_groupgroups';
}
diff --git a/application/models/DbTable/GroupRequest.php b/application/models/DbTable/GroupRequest.php
index 036df59..3361659 100644
--- a/application/models/DbTable/GroupRequest.php
+++ b/application/models/DbTable/GroupRequest.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_GroupRequest extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_GroupRequest extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_grouprequest';
+ protected $_name = 'pbs_grouprequest';
}
diff --git a/application/models/DbTable/HomeType.php b/application/models/DbTable/HomeType.php
index 2bd484f..e92e519 100644
--- a/application/models/DbTable/HomeType.php
+++ b/application/models/DbTable/HomeType.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_HomeType extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_HomeType extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_hometype';
+ protected $_name = 'pbs_hometype';
}
diff --git a/application/models/DbTable/Membership.php b/application/models/DbTable/Membership.php
index cc1d4cc..164809d 100644
--- a/application/models/DbTable/Membership.php
+++ b/application/models/DbTable/Membership.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Membership extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Membership extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_membership';
+ protected $_name = 'pbs_membership';
}
diff --git a/application/models/DbTable/PasswordRecovery.php b/application/models/DbTable/PasswordRecovery.php
index b4e5082..aadb513 100644
--- a/application/models/DbTable/PasswordRecovery.php
+++ b/application/models/DbTable/PasswordRecovery.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_PasswordRecovery extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_PasswordRecovery extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_passwordrecovery';
+ protected $_name = 'pbs_passwordrecovery';
}
diff --git a/application/models/DbTable/Person.php b/application/models/DbTable/Person.php
index 132e8b6..1ae95ca 100644
--- a/application/models/DbTable/Person.php
+++ b/application/models/DbTable/Person.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Person extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Person extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_person';
+ protected $_name = 'pbs_person';
}
diff --git a/application/models/DbTable/Pool.php b/application/models/DbTable/Pool.php
index 9650166..0aadca7 100644
--- a/application/models/DbTable/Pool.php
+++ b/application/models/DbTable/Pool.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Pool extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Pool extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_pool';
+ protected $_name = 'pbs_pool';
}
diff --git a/application/models/DbTable/PoolEntries.php b/application/models/DbTable/PoolEntries.php
index 275f443..2fe216e 100644
--- a/application/models/DbTable/PoolEntries.php
+++ b/application/models/DbTable/PoolEntries.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_PoolEntries extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_PoolEntries extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_poolentries';
+ protected $_name = 'pbs_poolentries';
}
diff --git a/application/models/DbTable/PreBoot.php b/application/models/DbTable/PreBoot.php
index 8553d6b..02d3680 100644
--- a/application/models/DbTable/PreBoot.php
+++ b/application/models/DbTable/PreBoot.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_PreBoot extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_PreBoot extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_preboot';
+ protected $_name = 'pbs_preboot';
}
diff --git a/application/models/DbTable/Right.php b/application/models/DbTable/Right.php
index d73dd5d..603fee1 100644
--- a/application/models/DbTable/Right.php
+++ b/application/models/DbTable/Right.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Right extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Right extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_right';
+ protected $_name = 'pbs_right';
}
diff --git a/application/models/DbTable/RightCategory.php b/application/models/DbTable/RightCategory.php
index 4146580..8cf7ef1 100644
--- a/application/models/DbTable/RightCategory.php
+++ b/application/models/DbTable/RightCategory.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_RightCategory extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_RightCategory extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_rightcategory';
+ protected $_name = 'pbs_rightcategory';
}
diff --git a/application/models/DbTable/RightRoles.php b/application/models/DbTable/RightRoles.php
index 6a9efe0..1c62f25 100644
--- a/application/models/DbTable/RightRoles.php
+++ b/application/models/DbTable/RightRoles.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_RightRoles extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_RightRoles extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_rightroles';
+ protected $_name = 'pbs_rightroles';
}
diff --git a/application/models/DbTable/Role.php b/application/models/DbTable/Role.php
index 94b8679..756d217 100644
--- a/application/models/DbTable/Role.php
+++ b/application/models/DbTable/Role.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Role extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Role extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_role';
+ protected $_name = 'pbs_role';
}
diff --git a/application/models/DbTable/Session.php b/application/models/DbTable/Session.php
index d74d505..12a8b6b 100644
--- a/application/models/DbTable/Session.php
+++ b/application/models/DbTable/Session.php
@@ -1,19 +1,18 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_DbTable_Session extends Zend_Db_Table_Abstract
-{
+class Application_Model_DbTable_Session extends Zend_Db_Table_Abstract {
- protected $_name = 'pbs_session';
+ protected $_name = 'pbs_session';
}
diff --git a/application/models/Filter.php b/application/models/Filter.php
index 2e94aba..1e33f24 100644
--- a/application/models/Filter.php
+++ b/application/models/Filter.php
@@ -1,169 +1,147 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Filter
-{
- protected $_filterID;
- protected $_membershipID;
- protected $_groupID;
- protected $_bootmenuID;
- protected $_title;
- protected $_description;
- protected $_created;
- protected $_priority;
+class Application_Model_Filter {
+ protected $_filterID;
+ protected $_membershipID;
+ protected $_groupID;
+ protected $_bootmenuID;
+ protected $_title;
+ protected $_description;
+ protected $_created;
+ protected $_priority;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid filter property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid filter property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid filter property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid filter property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_filterID;
- }
- public function setID($_filterID)
- {
- $this->_filterID = $_filterID;
- return $this;
- }
- public function getMembershipID()
- {
- return $this->_membershipID;
- }
- public function setMembershipID($_membershipID)
- {
- $this->_membershipID = $_membershipID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getBootmenuID()
- {
- return $this->_bootmenuID;
- }
- public function setBootmenuID($_bootmenuID)
- {
- $this->_bootmenuID = $_bootmenuID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getDescription()
- {
- return $this->_description;
- }
- public function setDescription($_description)
- {
- $this->_description = $_description;
- return $this;
- }
- public function getCreated()
- {
- return $this->_created;
- }
- public function setCreated($_created)
- {
- $this->_created = $_created;
- return $this;
- }
- public function getPriority()
- {
- return $this->_priority;
- }
- public function setPriority($_priority)
- {
- $this->_priority = $_priority;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_filterID;
+ }
+ public function setID($_filterID) {
+ $this->_filterID = $_filterID;
+ return $this;
+ }
+ public function getMembershipID() {
+ return $this->_membershipID;
+ }
+ public function setMembershipID($_membershipID) {
+ $this->_membershipID = $_membershipID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getBootmenuID() {
+ return $this->_bootmenuID;
+ }
+ public function setBootmenuID($_bootmenuID) {
+ $this->_bootmenuID = $_bootmenuID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getDescription() {
+ return $this->_description;
+ }
+ public function setDescription($_description) {
+ $this->_description = $_description;
+ return $this;
+ }
+ public function getCreated() {
+ return $this->_created;
+ }
+ public function setCreated($_created) {
+ $this->_created = $_created;
+ return $this;
+ }
+ public function getPriority() {
+ return $this->_priority;
+ }
+ public function setPriority($_priority) {
+ $this->_priority = $_priority;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/FilterEntries.php b/application/models/FilterEntries.php
index 68088e2..37accca 100644
--- a/application/models/FilterEntries.php
+++ b/application/models/FilterEntries.php
@@ -1,138 +1,122 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_FilterEntries
-{
- protected $_filterentriesID;
- protected $_filterID;
- protected $_filtertypeID;
- protected $_filtervalue;
- protected $_filtervalue2;
+class Application_Model_FilterEntries {
+ protected $_filterentriesID;
+ protected $_filterID;
+ protected $_filtertypeID;
+ protected $_filtervalue;
+ protected $_filtervalue2;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid filterentries property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid filterentries property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid filterentries property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid filterentries property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_filterentriesID;
- }
- public function setID($_filterentriesID)
- {
- $this->_filterentriesID = $_filterentriesID;
- return $this;
- }
- public function getFilterID()
- {
- return $this->_filterID;
- }
- public function setFilterID($_filterID)
- {
- $this->_filterID = $_filterID;
- return $this;
- }
- public function getFiltertypeID()
- {
- return $this->_filtertypeID;
- }
- public function setFiltertypeID($_filtertypeID)
- {
- $this->_filtertypeID = $_filtertypeID;
- return $this;
- }
- public function getFiltervalue()
- {
- return $this->_filtervalue;
- }
- public function setFiltervalue($_filtervalue)
- {
- $this->_filtervalue = $_filtervalue;
- return $this;
- }
- public function getFiltervalue2()
- {
- return $this->_filtervalue2;
- }
- public function setFiltervalue2($_filtervalue2)
- {
- $this->_filtervalue2 = $_filtervalue2;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_filterentriesID;
+ }
+ public function setID($_filterentriesID) {
+ $this->_filterentriesID = $_filterentriesID;
+ return $this;
+ }
+ public function getFilterID() {
+ return $this->_filterID;
+ }
+ public function setFilterID($_filterID) {
+ $this->_filterID = $_filterID;
+ return $this;
+ }
+ public function getFiltertypeID() {
+ return $this->_filtertypeID;
+ }
+ public function setFiltertypeID($_filtertypeID) {
+ $this->_filtertypeID = $_filtertypeID;
+ return $this;
+ }
+ public function getFiltervalue() {
+ return $this->_filtervalue;
+ }
+ public function setFiltervalue($_filtervalue) {
+ $this->_filtervalue = $_filtervalue;
+ return $this;
+ }
+ public function getFiltervalue2() {
+ return $this->_filtervalue2;
+ }
+ public function setFiltervalue2($_filtervalue2) {
+ $this->_filtervalue2 = $_filtervalue2;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/FilterEntriesMapper.php b/application/models/FilterEntriesMapper.php
index f6884f0..f8c20e8 100644
--- a/application/models/FilterEntriesMapper.php
+++ b/application/models/FilterEntriesMapper.php
@@ -1,170 +1,162 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_FilterEntriesMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_FilterEntries($row);
- $entry->setID($row['filterentriesID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_FilterEntries');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_FilterEntries $filterentries)
- {
- try{
- $data = array( 'filterentriesID'=>$filterentries->getID(),
- 'filterID'=> $filterentries->getFilterID() ,
- 'filtertypeID'=> $filterentries->getFiltertypeID() ,
- 'filtervalue'=> $filterentries->getFiltervalue() ,
- 'filtervalue2'=> $filterentries->getFiltervalue2() );
-
- $filterentries2 = new Application_Model_FilterEntries();
- $result = $this->find($filterentries->getID(),$filterentries2);
-
- $id1 = $filterentries2->getID();
-
- if (0 == count($result) && null == $id1) {
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('filterentriesID = ?' => $id1));
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function delete(Application_Model_FilterEntries $filterentries)
- {
- try{
- $id1 = $filterentries->getID();
-
-
- if ((null == $id1)) {
- return;
- } else {
- $this->getDbTable()->delete(array('filterentriesID = ?' => $id1));
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function find($filterentriesID, Application_Model_FilterEntries $filterentries)
- {
- $result = $this->getDbTable()->find($filterentriesID);
- if (0 == count($result)) {
- return;
- }
- $row = $result->current();
-
- $filterentries->setID($row->filterentriesID)
- ->setFilterID($row->filterID)
- ->setFiltertypeID($row->filtertypeID)
- ->setFiltervalue($row->filtervalue)
- ->setFiltervalue2($row->filtervalue2);
- return $filterentries;
- }
-
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_FilterEntries();
-
- $entry->setID($row->filterentriesID)
- ->setFilterID($row->filterID)
- ->setFiltertypeID($row->filtertypeID)
- ->setFiltervalue($row->filtervalue)
- ->setFiltervalue2($row->filtervalue2);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_FilterEntries $v1,Application_Model_FilterEntries $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_FilterEntriesMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_FilterEntries($row);
+ $entry->setID($row['filterentriesID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_FilterEntries');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_FilterEntries $filterentries) {
+ try {
+ $data = array( 'filterentriesID' => $filterentries->getID(),
+ 'filterID' => $filterentries->getFilterID() ,
+ 'filtertypeID' => $filterentries->getFiltertypeID() ,
+ 'filtervalue' => $filterentries->getFiltervalue() ,
+ 'filtervalue2' => $filterentries->getFiltervalue2() );
+
+ $filterentries2 = new Application_Model_FilterEntries();
+ $result = $this->find($filterentries->getID(), $filterentries2);
+
+ $id1 = $filterentries2->getID();
+
+ if (0 == count($result) && null == $id1) {
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('filterentriesID = ?' => $id1));
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function delete(Application_Model_FilterEntries $filterentries) {
+ try {
+ $id1 = $filterentries->getID();
+
+
+ if ((null == $id1)) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('filterentriesID = ?' => $id1));
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function find($filterentriesID, Application_Model_FilterEntries $filterentries) {
+ $result = $this->getDbTable()->find($filterentriesID);
+ if (0 == count($result)) {
+ return;
+ }
+ $row = $result->current();
+
+ $filterentries->setID($row->filterentriesID)
+ ->setFilterID($row->filterID)
+ ->setFiltertypeID($row->filtertypeID)
+ ->setFiltervalue($row->filtervalue)
+ ->setFiltervalue2($row->filtervalue2);
+ return $filterentries;
+ }
+
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_FilterEntries();
+
+ $entry->setID($row->filterentriesID)
+ ->setFilterID($row->filterID)
+ ->setFiltertypeID($row->filtertypeID)
+ ->setFiltervalue($row->filtervalue)
+ ->setFiltervalue2($row->filtervalue2);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_FilterEntries $v1, Application_Model_FilterEntries $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/FilterMapper.php b/application/models/FilterMapper.php
index 53fffad..1ba2e3b 100644
--- a/application/models/FilterMapper.php
+++ b/application/models/FilterMapper.php
@@ -1,155 +1,147 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_FilterMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Filter($row);
- $entry->setID($row['filterID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Filter');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Filter $filter)
- {
-
- $data = array('filterID'=> $filter->getID() ,
- 'membershipID'=> $filter->getMembershipID() ,
- 'groupID'=> $filter->getGroupID() ,
- 'bootmenuID'=> $filter->getBootmenuID() ,
- 'title'=> $filter->getTitle() ,
- 'description'=> $filter->getDescription() ,
- 'created'=> $filter->getCreated() ,
- 'priority'=> $filter->getPriority() );
-
- if (null === ($id = $filter->getID()) ) {
- unset($data['filterID']);
- return $this->getDbTable()->insert($data);
- } else {
- return $this->getDbTable()->update($data, array('filterID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Filter $filter)
- {
- if (null === ($id = $filter->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('filterID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Filter $filter)
- {
-
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
- $row = $result->current();
-
- $filter->setID($row->filterID)
- ->setMembershipID($row->membershipID)
- ->setGroupID($row->groupID)
- ->setBootmenuID($row->bootmenuID)
- ->setTitle($row->title)
- ->setDescription($row->description)
- ->setCreated($row->created)
- ->setPriority($row->priority);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Filter();
-
- $entry->setID($row->filterID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setDescription($row->description)->setCreated($row->created)->setPriority($row->priority);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Filter $v1,Application_Model_Filter $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_FilterMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Filter($row);
+ $entry->setID($row['filterID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Filter');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Filter $filter) {
+
+ $data = array('filterID' => $filter->getID() ,
+ 'membershipID' => $filter->getMembershipID() ,
+ 'groupID' => $filter->getGroupID() ,
+ 'bootmenuID' => $filter->getBootmenuID() ,
+ 'title' => $filter->getTitle() ,
+ 'description' => $filter->getDescription() ,
+ 'created' => $filter->getCreated() ,
+ 'priority' => $filter->getPriority() );
+
+ if (null == = ($id = $filter->getID()) ) {
+ unset($data['filterID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ return $this->getDbTable()->update($data, array('filterID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Filter $filter) {
+ if (null == = ($id = $filter->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('filterID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_Filter $filter) {
+
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+ $row = $result->current();
+
+ $filter->setID($row->filterID)
+ ->setMembershipID($row->membershipID)
+ ->setGroupID($row->groupID)
+ ->setBootmenuID($row->bootmenuID)
+ ->setTitle($row->title)
+ ->setDescription($row->description)
+ ->setCreated($row->created)
+ ->setPriority($row->priority);
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Filter();
+
+ $entry->setID($row->filterID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setDescription($row->description)->setCreated($row->created)->setPriority($row->priority);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Filter $v1, Application_Model_Filter $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/FilterType.php b/application/models/FilterType.php
index 05d4192..7a3bfed 100644
--- a/application/models/FilterType.php
+++ b/application/models/FilterType.php
@@ -1,109 +1,99 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_FilterType
-{
- protected $_filtertypeID;
- protected $_filtertypename;
+class Application_Model_FilterType {
+ protected $_filtertypeID;
+ protected $_filtertypename;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid filtertype property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid filtertype property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid filtertype property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid filtertype property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_filtertypeID;
- }
- public function setID($_filtertypeID)
- {
- $this->_filtertypeID = $_filtertypeID;
- return $this;
- }
- public function getFiltertypename()
- {
- return $this->_filtertypename;
- }
- public function setFiltertypename($_filtertypename)
- {
- $this->_filtertypename = $_filtertypename;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_filtertypeID;
+ }
+ public function setID($_filtertypeID) {
+ $this->_filtertypeID = $_filtertypeID;
+ return $this;
+ }
+ public function getFiltertypename() {
+ return $this->_filtertypename;
+ }
+ public function setFiltertypename($_filtertypename) {
+ $this->_filtertypename = $_filtertypename;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/FilterTypeMapper.php b/application/models/FilterTypeMapper.php
index 0ee6498..a83e1fd 100644
--- a/application/models/FilterTypeMapper.php
+++ b/application/models/FilterTypeMapper.php
@@ -1,142 +1,134 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_FilterTypeMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_FilterType($row);
- $entry->setID($row['filtertypeID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_FilterType');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_FilterType $filtertype)
- {
-
- $data = array('filtertypeID'=> $filtertype->getID() ,'filtertypename'=> $filtertype->getFiltertypename() );
-
- if (null === ($id = $filtertype->getID()) ) {
- unset($data['filtertypeID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('filtertypeID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_FilterType $filtertype)
- {
- if (null === ($id = $filtertype->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('filtertypeID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_FilterType $filtertype)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $filtertype->setID($row->filtertypeID)
- ->setFiltertypename($row->filtertypename);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_FilterType();
-
- $entry->setID($row->filtertypeID)
- ->setFiltertypename($row->filtertypename);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_FilterType $v1,Application_Model_FilterType $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_FilterTypeMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_FilterType($row);
+ $entry->setID($row['filtertypeID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_FilterType');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_FilterType $filtertype) {
+
+ $data = array('filtertypeID' => $filtertype->getID() , 'filtertypename' => $filtertype->getFiltertypename() );
+
+ if (null == = ($id = $filtertype->getID()) ) {
+ unset($data['filtertypeID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('filtertypeID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_FilterType $filtertype) {
+ if (null == = ($id = $filtertype->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('filtertypeID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_FilterType $filtertype) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $filtertype->setID($row->filtertypeID)
+ ->setFiltertypename($row->filtertypename);
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_FilterType();
+
+ $entry->setID($row->filtertypeID)
+ ->setFiltertypename($row->filtertypename);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_FilterType $v1, Application_Model_FilterType $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/Group.php b/application/models/Group.php
index 262f0c3..a70373e 100644
--- a/application/models/Group.php
+++ b/application/models/Group.php
@@ -1,119 +1,107 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Group
-{
- protected $_groupID;
- protected $_title;
- protected $_description;
+class Application_Model_Group {
+ protected $_groupID;
+ protected $_title;
+ protected $_description;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid group property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid group property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid group property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid group property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_groupID;
- }
- public function setID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getDescription()
- {
- return $this->_description;
- }
- public function setDescription($_description)
- {
- $this->_description = $_description;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_groupID;
+ }
+ public function setID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getDescription() {
+ return $this->_description;
+ }
+ public function setDescription($_description) {
+ $this->_description = $_description;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/GroupGroups.php b/application/models/GroupGroups.php
index 43dcab1..7724c82 100644
--- a/application/models/GroupGroups.php
+++ b/application/models/GroupGroups.php
@@ -1,109 +1,99 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_GroupGroups
-{
- protected $_parentID;
- protected $_groupID;
+class Application_Model_GroupGroups {
+ protected $_parentID;
+ protected $_groupID;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid groupGroups property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid groupGroups property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid groupGroups property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid groupGroups property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getParentID()
- {
- return $this->_parentID;
- }
- public function setParentID($_parentID)
- {
- $this->_parentID = $_parentID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getParentID() {
+ return $this->_parentID;
+ }
+ public function setParentID($_parentID) {
+ $this->_parentID = $_parentID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/GroupGroupsMapper.php b/application/models/GroupGroupsMapper.php
index 318b298..e6fc3ab 100644
--- a/application/models/GroupGroupsMapper.php
+++ b/application/models/GroupGroupsMapper.php
@@ -1,169 +1,161 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_GroupGroupsMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_GroupGroups($row);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_GroupGroups');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_GroupGroups $groupgroups)
- {
-
- $data = array('parentID'=> $groupgroups->getParentID() ,'groupID'=> $groupgroups->getGroupID() );
-
- #Noch zu prüfen ob Eintrag schon vorhanden
- $this->getDbTable()->insert($data);
- }
-
- public function delete(Application_Model_GroupGroups $groupgroups)
- {
- if (null === ($id = $groupgroups->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('groupgroupsID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_GroupGroups $groupgroups)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $groupgroups->setParentID($row->parentID)->setGroupID($row->groupID);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_GroupGroups();
-
- $entry->setParentID($row->parentID)->setGroupID($row->groupID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
- private $crawledNodes;
- // Gets All groupIDs of the parent groups begins with the
- public function getParentGroups($groupID, &$data=null, $level=0) {
- if(isset($this->crawledNodes['parent'][$groupID]) && $this->crawledNodes['parent'][$groupID] == 1)
- return $data;
- $this->crawledNodes['parent'][$groupID] = 1;
-
- $data[$level][] = $groupID;
- $db = Zend_Db_Table::getDefaultAdapter();
- $query = 'SELECT parentID FROM pbs_groupgroups WHERE groupID="'.$groupID.'"';
- $stmt = $db->query($query);
- $result = $stmt->fetchAll();
- foreach($result as $row){
- // get the function recursive an increase the level
- $data = $this->getParentGroups($row['parentID'], $data, $level+1);
- }
- return $data;
- }
- // Gets all childs-groups from a given group
- public function getChildGroups($groupID, &$data=null, $level=0) {
- if(isset($this->crawledNodes['child'][$groupID]) && $this->crawledNodes['child'][$groupID] == 1)
- return $data;
- $this->crawledNodes['child'][$groupID] = 1;
- $data[$level][] = $groupID;
- $db = Zend_Db_Table::getDefaultAdapter();
- $query = 'SELECT groupID FROM pbs_groupgroups WHERE parentID="'.$groupID.'"';
- $stmt = $db->query($query);
- $result = $stmt->fetchAll();
- foreach($result as $row){
- // get the function recursive an increase the level
- $data = $this->getChildGroups($row['groupID'], $data, $level+1);
- }
- return $data;
- }
-
- public function compare(Application_Model_GroupGroups $v1,Application_Model_GroupGroups $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_GroupGroupsMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_GroupGroups($row);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_GroupGroups');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_GroupGroups $groupgroups) {
+
+ $data = array('parentID' => $groupgroups->getParentID() , 'groupID' => $groupgroups->getGroupID() );
+
+#Noch zu prüfen ob Eintrag schon vorhanden
+ $this->getDbTable()->insert($data);
+ }
+
+ public function delete(Application_Model_GroupGroups $groupgroups) {
+ if (null == = ($id = $groupgroups->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('groupgroupsID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_GroupGroups $groupgroups) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $groupgroups->setParentID($row->parentID)->setGroupID($row->groupID);
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_GroupGroups();
+
+ $entry->setParentID($row->parentID)->setGroupID($row->groupID);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+ private $crawledNodes;
+ // Gets All groupIDs of the parent groups begins with the
+ public function getParentGroups($groupID, &$data = null, $level = 0) {
+ if(isset($this->crawledNodes['parent'][$groupID]) && $this->crawledNodes['parent'][$groupID] == 1)
+ { return $data; }
+ $this->crawledNodes['parent'][$groupID] = 1;
+
+ $data[$level][] = $groupID;
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $query = 'SELECT parentID FROM pbs_groupgroups WHERE groupID="'.$groupID.'"';
+ $stmt = $db->query($query);
+ $result = $stmt->fetchAll();
+ foreach($result as $row) {
+ // get the function recursive an increase the level
+ $data = $this->getParentGroups($row['parentID'], $data, $level + 1);
+ }
+ return $data;
+ }
+ // Gets all childs-groups from a given group
+ public function getChildGroups($groupID, &$data = null, $level = 0) {
+ if(isset($this->crawledNodes['child'][$groupID]) && $this->crawledNodes['child'][$groupID] == 1)
+ { return $data; }
+ $this->crawledNodes['child'][$groupID] = 1;
+ $data[$level][] = $groupID;
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $query = 'SELECT groupID FROM pbs_groupgroups WHERE parentID="'.$groupID.'"';
+ $stmt = $db->query($query);
+ $result = $stmt->fetchAll();
+ foreach($result as $row) {
+ // get the function recursive an increase the level
+ $data = $this->getChildGroups($row['groupID'], $data, $level + 1);
+ }
+ return $data;
+ }
+
+ public function compare(Application_Model_GroupGroups $v1, Application_Model_GroupGroups $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
diff --git a/application/models/GroupMapper.php b/application/models/GroupMapper.php
index df93483..ce598db 100644
--- a/application/models/GroupMapper.php
+++ b/application/models/GroupMapper.php
@@ -1,144 +1,136 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_GroupMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Group($row);
- $entry->setID($row['groupID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Group');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Group $group)
- {
-
- $data = array('groupID'=> $group->getID() ,'title'=> $group->getTitle() ,'description'=> $group->getDescription() );
-
- if (null === ($id = $group->getID()) ) {
- unset($data['groupID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('groupID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Group $group)
- {
- if (null === ($id = $group->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('groupID = ?' => $id));
- }
- }
-
- public function find($id,Application_Model_Group $group = null)
- {
- $return = false;
- if($group == null){
- $return = true;
- }
- if($return){
- $group = new Application_Model_Group();
- }
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $group->setID($row->groupID)->setTitle($row->title)->setDescription($row->description);
- if($return){
- return $group;
- }
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Group();
-
- $entry->setID($row->groupID)->setTitle($row->title)->setDescription($row->description);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Group $v1,Application_Model_Group $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_GroupMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Group($row);
+ $entry->setID($row['groupID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Group');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Group $group) {
+
+ $data = array('groupID' => $group->getID() , 'title' => $group->getTitle() , 'description' => $group->getDescription() );
+
+ if (null == = ($id = $group->getID()) ) {
+ unset($data['groupID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('groupID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Group $group) {
+ if (null == = ($id = $group->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('groupID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_Group $group = null) {
+ $return = false;
+ if($group == null) {
+ $return = true;
+ }
+ if($return) {
+ $group = new Application_Model_Group();
+ }
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $group->setID($row->groupID)->setTitle($row->title)->setDescription($row->description);
+ if($return) {
+ return $group;
+ }
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Group();
+
+ $entry->setID($row->groupID)->setTitle($row->title)->setDescription($row->description);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Group $v1, Application_Model_Group $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/GroupRequest.php b/application/models/GroupRequest.php
index 21f4716..d5a0e8b 100644
--- a/application/models/GroupRequest.php
+++ b/application/models/GroupRequest.php
@@ -1,129 +1,115 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_GroupRequest
-{
- protected $_grouprequestID;
- protected $_groupID;
- protected $_personID;
- protected $_time;
+class Application_Model_GroupRequest {
+ protected $_grouprequestID;
+ protected $_groupID;
+ protected $_personID;
+ protected $_time;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid grouprequest property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid grouprequest property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid grouprequest property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid grouprequest property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_grouprequestID;
- }
- public function setID($_grouprequestID)
- {
- $this->_grouprequestID = $_grouprequestID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getPersonID()
- {
- return $this->_personID;
- }
- public function setPersonID($_personID)
- {
- $this->_personID = $_personID;
- return $this;
- }
- public function getTime()
- {
- return $this->_time;
- }
- public function setTime($_time)
- {
- $this->_time = $_time;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_grouprequestID;
+ }
+ public function setID($_grouprequestID) {
+ $this->_grouprequestID = $_grouprequestID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getPersonID() {
+ return $this->_personID;
+ }
+ public function setPersonID($_personID) {
+ $this->_personID = $_personID;
+ return $this;
+ }
+ public function getTime() {
+ return $this->_time;
+ }
+ public function setTime($_time) {
+ $this->_time = $_time;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/GroupRequestMapper.php b/application/models/GroupRequestMapper.php
index 79d19a0..107e633 100644
--- a/application/models/GroupRequestMapper.php
+++ b/application/models/GroupRequestMapper.php
@@ -1,143 +1,135 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_GroupRequestMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_GroupRequest($row);
- $entry->setID($row['grouprequestID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_GroupRequest');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_GroupRequest $grouprequest)
- {
-
- $data = array('grouprequestID'=> $grouprequest->getID() ,'groupID'=> $grouprequest->getGroupID() ,'personID'=> $grouprequest->getPersonID() ,'time'=> $grouprequest->getTime() );
-
- if (null === ($id = $grouprequest->getID()) ) {
- unset($data['grouprequestID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('grouprequestID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_GroupRequest $grouprequest)
- {
- if (null === ($id = $grouprequest->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('grouprequestID = ?' => $id));
- }
- }
-
- public function find($id)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $grouprequest = new Application_Model_GroupRequest();
- $grouprequest->setID($row->grouprequestID)->setGroupID($row->groupID)->setPersonID($row->personID)->setTime($row->time);
- return $grouprequest;
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_GroupRequest();
-
- $entry->setID($row->grouprequestID)->setGroupID($row->groupID)->setPersonID($row->personID)->setTime($row->time);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_GroupRequest $v1,Application_Model_GroupRequest $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_GroupRequestMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_GroupRequest($row);
+ $entry->setID($row['grouprequestID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_GroupRequest');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_GroupRequest $grouprequest) {
+
+ $data = array('grouprequestID' => $grouprequest->getID() , 'groupID' => $grouprequest->getGroupID() , 'personID' => $grouprequest->getPersonID() , 'time' => $grouprequest->getTime() );
+
+ if (null == = ($id = $grouprequest->getID()) ) {
+ unset($data['grouprequestID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('grouprequestID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_GroupRequest $grouprequest) {
+ if (null == = ($id = $grouprequest->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('grouprequestID = ?' => $id));
+ }
+ }
+
+ public function find($id) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $grouprequest = new Application_Model_GroupRequest();
+ $grouprequest->setID($row->grouprequestID)->setGroupID($row->groupID)->setPersonID($row->personID)->setTime($row->time);
+ return $grouprequest;
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_GroupRequest();
+
+ $entry->setID($row->grouprequestID)->setGroupID($row->groupID)->setPersonID($row->personID)->setTime($row->time);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_GroupRequest $v1, Application_Model_GroupRequest $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/HomeType.php b/application/models/HomeType.php
index afdf6ca..0532ae0 100644
--- a/application/models/HomeType.php
+++ b/application/models/HomeType.php
@@ -1,111 +1,101 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_HomeType
-{
- protected $_hometypeID;
- protected $_name;
-
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
+class Application_Model_HomeType {
+ protected $_hometypeID;
+ protected $_name;
+
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
}
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid HomeType property');
- }
- $this->$method($value);
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid HomeType property');
}
-
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid HomeType property');
- }
- return $this->$method();
+ $this->$method($value);
+ }
+
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid HomeType property');
}
-
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
+ return $this->$method();
+ }
+
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
}
+ return $this;
+ }
- public function getID()
- {
- return $this->_hometypeID;
- }
- public function setID($_hometypeID)
- {
- $this->_hometypeID = $_hometypeID;
- return $this;
- }
+ public function getID() {
+ return $this->_hometypeID;
+ }
+ public function setID($_hometypeID) {
+ $this->_hometypeID = $_hometypeID;
+ return $this;
+ }
- public function getName()
- {
- return $this->_name;
- }
+ public function getName() {
+ return $this->_name;
+ }
- public function setName($_name)
- {
- $this->_name = $_name;
- return $this;
- }
+ public function setName($_name) {
+ $this->_name = $_name;
+ return $this;
+ }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
}
- return $result;
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
+ }
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/HomeTypeMapper.php b/application/models/HomeTypeMapper.php
index d795941..71aeb3d 100644
--- a/application/models/HomeTypeMapper.php
+++ b/application/models/HomeTypeMapper.php
@@ -1,148 +1,140 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_HomeTypeMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_HomeType($row);
- $entry->setID($row['hometypeID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_HomeType');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_HomeType $hometype)
- {
-
- $data = array('hometypeID'=> $hometype->getID() ,'name'=> $hometype->getName() );
-
- if (null === ($id = $hometype->getID()) ) {
- unset($data['hometypeID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('hometypeID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_HomeType $hometype)
- {
- if (null === ($id = $hometype->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('hometypeID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_HomeType $hometype = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($hometype == null){
- $hometype = new Application_Model_HomeType();
- $hometype->setID($row->hometypeID)->setName($row->name);
- return $hometype;
- }else{
- $hometype->setID($row->hometypeID)->setName($row->name);
- }
-
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_HomeType();
-
- $entry->setID($row->hometypeID)
- ->setName($row->name);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_HomeType $v1,Application_Model_HomeType $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_HomeTypeMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_HomeType($row);
+ $entry->setID($row['hometypeID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_HomeType');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_HomeType $hometype) {
+
+ $data = array('hometypeID' => $hometype->getID() , 'name' => $hometype->getName() );
+
+ if (null == = ($id = $hometype->getID()) ) {
+ unset($data['hometypeID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('hometypeID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_HomeType $hometype) {
+ if (null == = ($id = $hometype->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('hometypeID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_HomeType $hometype = null) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ if($hometype == null) {
+ $hometype = new Application_Model_HomeType();
+ $hometype->setID($row->hometypeID)->setName($row->name);
+ return $hometype;
+ } else {
+ $hometype->setID($row->hometypeID)->setName($row->name);
+ }
+
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_HomeType();
+
+ $entry->setID($row->hometypeID)
+ ->setName($row->name);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_HomeType $v1, Application_Model_HomeType $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/Membership.php b/application/models/Membership.php
index a455848..11fc6cc 100644
--- a/application/models/Membership.php
+++ b/application/models/Membership.php
@@ -1,149 +1,131 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Membership
-{
- protected $_membershipID;
- protected $_groupID;
- protected $_roleID;
- protected $_personID;
- protected $_suspend;
- protected $_apikey;
+class Application_Model_Membership {
+ protected $_membershipID;
+ protected $_groupID;
+ protected $_roleID;
+ protected $_personID;
+ protected $_suspend;
+ protected $_apikey;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid membership property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid membership property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid membership property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid membership property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_membershipID;
- }
- public function setID($_membershipID)
- {
- $this->_membershipID = $_membershipID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getRoleID()
- {
- return $this->_roleID;
- }
- public function setRoleID($_roleID)
- {
- $this->_roleID = $_roleID;
- return $this;
- }
- public function getPersonID()
- {
- return $this->_personID;
- }
- public function setPersonID($_personID)
- {
- $this->_personID = $_personID;
- return $this;
- }
- public function getSuspend()
- {
- return $this->_suspend;
- }
- public function setSuspend($_suspend)
- {
- $this->_suspend = $_suspend;
- return $this;
- }
- public function getApikey()
- {
- return $this->_apikey;
- }
- public function setApikey($_apikey)
- {
- $this->_apikey = $_apikey;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
- }
- return $result;
- }
+ public function getID() {
+ return $this->_membershipID;
+ }
+ public function setID($_membershipID) {
+ $this->_membershipID = $_membershipID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getRoleID() {
+ return $this->_roleID;
+ }
+ public function setRoleID($_roleID) {
+ $this->_roleID = $_roleID;
+ return $this;
+ }
+ public function getPersonID() {
+ return $this->_personID;
+ }
+ public function setPersonID($_personID) {
+ $this->_personID = $_personID;
+ return $this;
+ }
+ public function getSuspend() {
+ return $this->_suspend;
+ }
+ public function setSuspend($_suspend) {
+ $this->_suspend = $_suspend;
+ return $this;
+ }
+ public function getApikey() {
+ return $this->_apikey;
+ }
+ public function setApikey($_apikey) {
+ $this->_apikey = $_apikey;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
+ }
+
+ }
+ }
+ return $result;
+ }
}
diff --git a/application/models/MembershipMapper.php b/application/models/MembershipMapper.php
index 6786c92..c3a7d60 100644
--- a/application/models/MembershipMapper.php
+++ b/application/models/MembershipMapper.php
@@ -1,149 +1,141 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_MembershipMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Membership($row);
- $entry->setID($row['membershipID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Membership');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Membership $membership)
- {
-
- $data = array('membershipID'=> $membership->getID() ,'groupID'=> $membership->getGroupID() ,'roleID'=> $membership->getRoleID() ,'personID'=> $membership->getPersonID() ,'suspend'=> $membership->getSuspend(), 'apikey'=> $membership->getApikey() );
-
- if (null === ($id = $membership->getID()) ) {
- unset($data['membershipID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('membershipID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Membership $membership)
- {
- if (null === ($id = $membership->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('membershipID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Membership $membership = null)
- {
- $return = false;
- if($membership == null){
- $return = true;
- }
- if($return){
- $membership = new Application_Model_Membership();
- }
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $membership->setID($row->membershipID)->setGroupID($row->groupID)->setRoleID($row->roleID)->setPersonID($row->personID)->setSuspend($row->suspend)->setApikey($row->apikey);
- if($return){
- return $membership;
- }
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Membership();
-
- $entry->setID($row->membershipID)->setGroupID($row->groupID)->setRoleID($row->roleID)->setPersonID($row->personID)->setSuspend($row->suspend)->setApikey($row->apikey);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Membership $v1,Application_Model_Membership $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_MembershipMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Membership($row);
+ $entry->setID($row['membershipID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Membership');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Membership $membership) {
+
+ $data = array('membershipID' => $membership->getID() , 'groupID' => $membership->getGroupID() , 'roleID' => $membership->getRoleID() , 'personID' => $membership->getPersonID() , 'suspend' => $membership->getSuspend(), 'apikey' => $membership->getApikey() );
+
+ if (null == = ($id = $membership->getID()) ) {
+ unset($data['membershipID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('membershipID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Membership $membership) {
+ if (null == = ($id = $membership->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('membershipID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_Membership $membership = null) {
+ $return = false;
+ if($membership == null) {
+ $return = true;
+ }
+ if($return) {
+ $membership = new Application_Model_Membership();
+ }
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $membership->setID($row->membershipID)->setGroupID($row->groupID)->setRoleID($row->roleID)->setPersonID($row->personID)->setSuspend($row->suspend)->setApikey($row->apikey);
+ if($return) {
+ return $membership;
+ }
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Membership();
+
+ $entry->setID($row->membershipID)->setGroupID($row->groupID)->setRoleID($row->roleID)->setPersonID($row->personID)->setSuspend($row->suspend)->setApikey($row->apikey);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Membership $v1, Application_Model_Membership $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
diff --git a/application/models/PasswordRecovery.php b/application/models/PasswordRecovery.php
index f860cdd..81710aa 100644
--- a/application/models/PasswordRecovery.php
+++ b/application/models/PasswordRecovery.php
@@ -1,108 +1,98 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_PasswordRecovery
-{
- protected $_personID;
- protected $_recoveryID;
+class Application_Model_PasswordRecovery {
+ protected $_personID;
+ protected $_recoveryID;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid passwordrecovery property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid passwordrecovery property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid membership property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid membership property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
- public function getID()
- {
- return $this->_personID;
- }
- public function setID($_personID)
- {
- $this->_personID = $_personID;
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
+ public function getID() {
+ return $this->_personID;
+ }
+ public function setID($_personID) {
+ $this->_personID = $_personID;
+ return $this;
+ }
- public function getRecoveryID()
- {
- return $this->_recoveryID;
- }
- public function setRecoveryID($_recoveryID)
- {
- $this->_recoveryID = $_recoveryID;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
- }
- return $result;
- }
+ public function getRecoveryID() {
+ return $this->_recoveryID;
+ }
+ public function setRecoveryID($_recoveryID) {
+ $this->_recoveryID = $_recoveryID;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
+ }
+
+ }
+ }
+ return $result;
+ }
} \ No newline at end of file
diff --git a/application/models/PasswordRecoveryMapper.php b/application/models/PasswordRecoveryMapper.php
index c6ffd04..fca4812 100644
--- a/application/models/PasswordRecoveryMapper.php
+++ b/application/models/PasswordRecoveryMapper.php
@@ -1,145 +1,137 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PasswordRecoveryMapper
-{
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_PasswordRecovery($row);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_PasswordRecovery');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_PasswordRecovery $passwordrecovery)
- {
-
- $data = array('personID'=> $passwordrecovery->getID() ,'recoveryID'=> $passwordrecovery->getRecoveryID() );
-
- if (null === ($id = $passwordrecovery->getID()) ) {
- return;
- } else {
- $passwordRecoveryFound = $this->find($passwordrecovery->getID());
- if(is_object($passwordRecoveryFound)) {
- $personIDFound = $passwordRecoveryFound->getID();
- }
- if(isset($personIDFound)) {
- $this->getDbTable()->update($data, array('personID = ?' => $passwordrecovery->getID()));
- } else {
- $this->getDbTable()->insert($data);
- }
- }
- }
-
- public function delete(Application_Model_PasswordRecovery $passwordrecovery)
- {
- if (null === ($id = $passwordrecovery->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('personID = ?' => $id));
- }
- }
-
- public function find($id)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $passwordrecovery = new Application_Model_PasswordRecovery();
- $passwordrecovery->setID($row->personID)->setRecoveryID($row->recoveryID);
- return $passwordrecovery;
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_PasswordRecovery();
-
- $entry->setID($row->personID)->setRecoveryID($row->recoveryID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_PasswordRecovery $v1,Application_Model_PasswordRecovery $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_PasswordRecoveryMapper {
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_PasswordRecovery($row);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_PasswordRecovery');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_PasswordRecovery $passwordrecovery) {
+
+ $data = array('personID' => $passwordrecovery->getID() , 'recoveryID' => $passwordrecovery->getRecoveryID() );
+
+ if (null == = ($id = $passwordrecovery->getID()) ) {
+ return;
+ } else {
+ $passwordRecoveryFound = $this->find($passwordrecovery->getID());
+ if(is_object($passwordRecoveryFound)) {
+ $personIDFound = $passwordRecoveryFound->getID();
+ }
+ if(isset($personIDFound)) {
+ $this->getDbTable()->update($data, array('personID = ?' => $passwordrecovery->getID()));
+ } else {
+ $this->getDbTable()->insert($data);
+ }
+ }
+ }
+
+ public function delete(Application_Model_PasswordRecovery $passwordrecovery) {
+ if (null == = ($id = $passwordrecovery->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('personID = ?' => $id));
+ }
+ }
+
+ public function find($id) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $passwordrecovery = new Application_Model_PasswordRecovery();
+ $passwordrecovery->setID($row->personID)->setRecoveryID($row->recoveryID);
+ return $passwordrecovery;
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_PasswordRecovery();
+
+ $entry->setID($row->personID)->setRecoveryID($row->recoveryID);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_PasswordRecovery $v1, Application_Model_PasswordRecovery $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
}
diff --git a/application/models/Person.php b/application/models/Person.php
index 637eb7d..40c4cf3 100644
--- a/application/models/Person.php
+++ b/application/models/Person.php
@@ -1,251 +1,213 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Person
-{
- protected $_personID;
- protected $_title;
- protected $_name;
- protected $_firstname;
- protected $_street;
- protected $_housenumber;
- protected $_city;
- protected $_postalcode;
- protected $_logindate;
- protected $_registerdate;
- protected $_email;
- protected $_login;
- protected $_password;
- protected $_password_salt;
- protected $_loginpassword;
- protected $_suspend;
+class Application_Model_Person {
+ protected $_personID;
+ protected $_title;
+ protected $_name;
+ protected $_firstname;
+ protected $_street;
+ protected $_housenumber;
+ protected $_city;
+ protected $_postalcode;
+ protected $_logindate;
+ protected $_registerdate;
+ protected $_email;
+ protected $_login;
+ protected $_password;
+ protected $_password_salt;
+ protected $_loginpassword;
+ protected $_suspend;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid person property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid person property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid person property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid person property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- $options['passwordSalt'] = $options['password_salt'];
- unset($options['password_salt']);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ $options['passwordSalt'] = $options['password_salt'];
+ unset($options['password_salt']);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_personID;
- }
- public function setID($_personID)
- {
- $this->_personID = $_personID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getName()
- {
- return $this->_name;
- }
- public function setName($_name)
- {
- $this->_name = $_name;
- return $this;
- }
- public function getFirstname()
- {
- return $this->_firstname;
- }
- public function setFirstname($_firstname)
- {
- $this->_firstname = $_firstname;
- return $this;
- }
- public function getStreet()
- {
- return $this->_street;
- }
- public function setStreet($_street)
- {
- $this->_street = $_street;
- return $this;
- }
- public function getHousenumber()
- {
- return $this->_housenumber;
- }
- public function setHousenumber($_housenumber)
- {
- $this->_housenumber = $_housenumber;
- return $this;
- }
- public function getCity()
- {
- return $this->_city;
- }
- public function setCity($_city)
- {
- $this->_city = $_city;
- return $this;
- }
- public function getPostalcode()
- {
- return $this->_postalcode;
- }
- public function setPostalcode($_postalcode)
- {
- $this->_postalcode = $_postalcode;
- return $this;
- }
- public function getLogindate()
- {
- return $this->_logindate;
- }
- public function setLogindate($_logindate)
- {
- $this->_logindate = $_logindate;
- return $this;
- }
- public function getRegisterdate()
- {
- return $this->_registerdate;
- }
- public function setRegisterdate($_registerdate)
- {
- $this->_registerdate = $_registerdate;
- return $this;
- }
- public function getEmail()
- {
- return $this->_email;
- }
- public function setEmail($_email)
- {
- $this->_email = $_email;
- return $this;
- }
- public function getLogin()
- {
- return $this->_login;
- }
- public function setLogin($_login)
- {
- $this->_login = $_login;
- return $this;
- }
- public function getPassword()
- {
- return $this->_password;
- }
- public function setPassword($_password)
- {
- $this->_password = $_password;
- return $this;
- }
- public function getLoginpassword()
- {
- return $this->_loginpassword;
- }
- public function setLoginpassword($_loginpassword)
- {
- $this->_loginpassword = $_loginpassword;
- return $this;
- }
- public function setPasswordSalt($_password_salt)
- {
- $this->_password_salt = $_password_salt;
- return $this;
- }
- public function getPasswordSalt()
- {
- return $this->_password_salt;
- }
- public function getSuspend()
- {
- return $this->_suspend;
- }
- public function setSuspend($_suspend)
- {
- $this->_suspend = $_suspend;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
- }
- return $result;
- }
+ public function getID() {
+ return $this->_personID;
+ }
+ public function setID($_personID) {
+ $this->_personID = $_personID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getName() {
+ return $this->_name;
+ }
+ public function setName($_name) {
+ $this->_name = $_name;
+ return $this;
+ }
+ public function getFirstname() {
+ return $this->_firstname;
+ }
+ public function setFirstname($_firstname) {
+ $this->_firstname = $_firstname;
+ return $this;
+ }
+ public function getStreet() {
+ return $this->_street;
+ }
+ public function setStreet($_street) {
+ $this->_street = $_street;
+ return $this;
+ }
+ public function getHousenumber() {
+ return $this->_housenumber;
+ }
+ public function setHousenumber($_housenumber) {
+ $this->_housenumber = $_housenumber;
+ return $this;
+ }
+ public function getCity() {
+ return $this->_city;
+ }
+ public function setCity($_city) {
+ $this->_city = $_city;
+ return $this;
+ }
+ public function getPostalcode() {
+ return $this->_postalcode;
+ }
+ public function setPostalcode($_postalcode) {
+ $this->_postalcode = $_postalcode;
+ return $this;
+ }
+ public function getLogindate() {
+ return $this->_logindate;
+ }
+ public function setLogindate($_logindate) {
+ $this->_logindate = $_logindate;
+ return $this;
+ }
+ public function getRegisterdate() {
+ return $this->_registerdate;
+ }
+ public function setRegisterdate($_registerdate) {
+ $this->_registerdate = $_registerdate;
+ return $this;
+ }
+ public function getEmail() {
+ return $this->_email;
+ }
+ public function setEmail($_email) {
+ $this->_email = $_email;
+ return $this;
+ }
+ public function getLogin() {
+ return $this->_login;
+ }
+ public function setLogin($_login) {
+ $this->_login = $_login;
+ return $this;
+ }
+ public function getPassword() {
+ return $this->_password;
+ }
+ public function setPassword($_password) {
+ $this->_password = $_password;
+ return $this;
+ }
+ public function getLoginpassword() {
+ return $this->_loginpassword;
+ }
+ public function setLoginpassword($_loginpassword) {
+ $this->_loginpassword = $_loginpassword;
+ return $this;
+ }
+ public function setPasswordSalt($_password_salt) {
+ $this->_password_salt = $_password_salt;
+ return $this;
+ }
+ public function getPasswordSalt() {
+ return $this->_password_salt;
+ }
+ public function getSuspend() {
+ return $this->_suspend;
+ }
+ public function setSuspend($_suspend) {
+ $this->_suspend = $_suspend;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
+ }
+
+ }
+ }
+ return $result;
+ }
}
diff --git a/application/models/PersonMapper.php b/application/models/PersonMapper.php
index 9330e7e..e8f6169 100644
--- a/application/models/PersonMapper.php
+++ b/application/models/PersonMapper.php
@@ -1,198 +1,190 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PersonMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
- # print_a($select);
- $stmt = $select->query();
- # print_a($stmt);
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Person($row);
- $entry->setID($row['personID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Person');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Person $person)
- {
-
- $data = array('personID'=> $person->getID() ,
- 'title'=> $person->getTitle() ,
- 'name'=> $person->getName() ,
- 'firstname'=> $person->getFirstname() ,
- 'street'=> $person->getStreet() ,
- 'housenumber'=> $person->getHousenumber() ,
- 'city'=> $person->getCity() ,
- 'postalcode'=> $person->getPostalcode() ,
- 'logindate'=> $person->getLogindate() ,
- 'registerdate'=> $person->getRegisterdate() ,
- 'email'=> $person->getEmail() ,
- 'login'=> $person->getLogin() ,
- 'password'=> $person->getPassword(),
- 'loginpassword'=> $person->getLoginpassword() ,
- 'password_salt'=> $person->getPasswordSalt() ,
- 'suspend'=> $person->getSuspend() );
-
- if (null === ($id = $person->getID()) ) {
- unset($data['personID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('personID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Person $person)
- {
- if (null === ($id = $person->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('personID = ?' => $id));
- }
- }
-
- public function find($id,Application_Model_Person $person = null)
- {
- $return = false;
-
- if($person == null){
- $return = true;
- }
- if($return){
- $person = new Application_Model_Person();
- }
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $person->setID($row->personID)
- ->setTitle($row->title)
- ->setName($row->name)
- ->setFirstname($row->firstname)
- ->setStreet($row->street)
- ->setHousenumber($row->housenumber)
- ->setCity($row->city)
- ->setPostalcode($row->postalcode)
- ->setLogindate($row->logindate)
- ->setRegisterdate($row->registerdate)
- ->setEmail($row->email)
- ->setLogin($row->login)
- ->setPassword($row->password)
- ->setPasswordSalt($row->password_salt)
- ->setLoginpassword($row->loginpassword)
- ->setSuspend($row->suspend);
- if($return){
- return $person;
- }
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Person();
-
- $entry->setID($row->personID)
- ->setTitle($row->title)
- ->setName($row->name)
- ->setFirstname($row->firstname)
- ->setStreet($row->street)
- ->setHousenumber($row->housenumber)
- ->setCity($row->city)
- ->setPostalcode($row->postalcode)
- ->setLogindate($row->logindate)
- ->setRegisterdate($row->registerdate)
- ->setEmail($row->email)
- ->setLogin($row->login)
- ->setPassword($row->password)
- ->setPasswordSalt($row->password_salt)
- ->setSuspend($row->suspend)
- ->setLoginpassword($row->loginpassword);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Person $v1,Application_Model_Person $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_PersonMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+# print_a($select);
+ $stmt = $select->query();
+# print_a($stmt);
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Person($row);
+ $entry->setID($row['personID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Person');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Person $person) {
+
+ $data = array('personID' => $person->getID() ,
+ 'title' => $person->getTitle() ,
+ 'name' => $person->getName() ,
+ 'firstname' => $person->getFirstname() ,
+ 'street' => $person->getStreet() ,
+ 'housenumber' => $person->getHousenumber() ,
+ 'city' => $person->getCity() ,
+ 'postalcode' => $person->getPostalcode() ,
+ 'logindate' => $person->getLogindate() ,
+ 'registerdate' => $person->getRegisterdate() ,
+ 'email' => $person->getEmail() ,
+ 'login' => $person->getLogin() ,
+ 'password' => $person->getPassword(),
+ 'loginpassword' => $person->getLoginpassword() ,
+ 'password_salt' => $person->getPasswordSalt() ,
+ 'suspend' => $person->getSuspend() );
+
+ if (null == = ($id = $person->getID()) ) {
+ unset($data['personID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('personID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Person $person) {
+ if (null == = ($id = $person->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('personID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_Person $person = null) {
+ $return = false;
+
+ if($person == null) {
+ $return = true;
+ }
+ if($return) {
+ $person = new Application_Model_Person();
+ }
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $person->setID($row->personID)
+ ->setTitle($row->title)
+ ->setName($row->name)
+ ->setFirstname($row->firstname)
+ ->setStreet($row->street)
+ ->setHousenumber($row->housenumber)
+ ->setCity($row->city)
+ ->setPostalcode($row->postalcode)
+ ->setLogindate($row->logindate)
+ ->setRegisterdate($row->registerdate)
+ ->setEmail($row->email)
+ ->setLogin($row->login)
+ ->setPassword($row->password)
+ ->setPasswordSalt($row->password_salt)
+ ->setLoginpassword($row->loginpassword)
+ ->setSuspend($row->suspend);
+ if($return) {
+ return $person;
+ }
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Person();
+
+ $entry->setID($row->personID)
+ ->setTitle($row->title)
+ ->setName($row->name)
+ ->setFirstname($row->firstname)
+ ->setStreet($row->street)
+ ->setHousenumber($row->housenumber)
+ ->setCity($row->city)
+ ->setPostalcode($row->postalcode)
+ ->setLogindate($row->logindate)
+ ->setRegisterdate($row->registerdate)
+ ->setEmail($row->email)
+ ->setLogin($row->login)
+ ->setPassword($row->password)
+ ->setPasswordSalt($row->password_salt)
+ ->setSuspend($row->suspend)
+ ->setLoginpassword($row->loginpassword);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Person $v1, Application_Model_Person $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/Pool.php b/application/models/Pool.php
index 4ceca29..ce90950 100644
--- a/application/models/Pool.php
+++ b/application/models/Pool.php
@@ -1,139 +1,123 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Pool
-{
- protected $_poolID;
- protected $_groupID;
- protected $_title;
- protected $_description;
- protected $_location;
+class Application_Model_Pool {
+ protected $_poolID;
+ protected $_groupID;
+ protected $_title;
+ protected $_description;
+ protected $_location;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid pool property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid pool property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid pool property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid pool property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_poolID;
- }
- public function setID($_poolID)
- {
- $this->_poolID = $_poolID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getDescription()
- {
- return $this->_description;
- }
- public function setDescription($_description)
- {
- $this->_description = $_description;
- return $this;
- }
- public function getLocation()
- {
- return $this->_location;
- }
- public function setLocation($_location)
- {
- $this->_location = $_location;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_poolID;
+ }
+ public function setID($_poolID) {
+ $this->_poolID = $_poolID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getDescription() {
+ return $this->_description;
+ }
+ public function setDescription($_description) {
+ $this->_description = $_description;
+ return $this;
+ }
+ public function getLocation() {
+ return $this->_location;
+ }
+ public function setLocation($_location) {
+ $this->_location = $_location;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/PoolEntries.php b/application/models/PoolEntries.php
index 020358c..c8f5d2a 100644
--- a/application/models/PoolEntries.php
+++ b/application/models/PoolEntries.php
@@ -1,118 +1,106 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_PoolEntries
-{
- protected $_poolentriesID;
- protected $_poolID;
- protected $_clientID;
+class Application_Model_PoolEntries {
+ protected $_poolentriesID;
+ protected $_poolID;
+ protected $_clientID;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid poolentries property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid poolentries property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid poolentries property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid poolentries property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_poolentriesID;
- }
- public function setID($_poolentriesID)
- {
- $this->_poolentriesID = $_poolentriesID;
- return $this;
- }
- public function getPoolID()
- {
- return $this->_poolID;
- }
- public function setPoolID($_poolID)
- {
- $this->_poolID = $_poolID;
- return $this;
- }
- public function getClientID()
- {
- return $this->_clientID;
- }
- public function setClientID($_clientID)
- {
- $this->_clientID = $_clientID;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_poolentriesID;
+ }
+ public function setID($_poolentriesID) {
+ $this->_poolentriesID = $_poolentriesID;
+ return $this;
+ }
+ public function getPoolID() {
+ return $this->_poolID;
+ }
+ public function setPoolID($_poolID) {
+ $this->_poolID = $_poolID;
+ return $this;
+ }
+ public function getClientID() {
+ return $this->_clientID;
+ }
+ public function setClientID($_clientID) {
+ $this->_clientID = $_clientID;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/PoolEntriesMapper.php b/application/models/PoolEntriesMapper.php
index c5a6893..c0a4a69 100644
--- a/application/models/PoolEntriesMapper.php
+++ b/application/models/PoolEntriesMapper.php
@@ -1,141 +1,133 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PoolEntriesMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_PoolEntries($row);
- $entry->setID($row['poolentriesID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_PoolEntries');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_PoolEntries $polentries)
- {
-
- $data = array('poolentriesID' => $polentries->getID(), 'poolID'=> $polentries->getPoolID() ,'clientID'=> $polentries->getClientID() );
-
- if (null === ($id = $polentries->getID()) ) {
- unset($data['poolentriesID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('poolentriesID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_PoolEntries $polentries)
- {
- if (null === ($id = $polentries->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('poolentriesID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_PoolEntries $polentries)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $polentries->setID($row->poolentriesID)->setPoolID($row->poolID)->setClientID($row->clientID);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_PoolEntries();
-
- $entry->setID($row->poolentriesID)->setPoolID($row->poolID)->setClientID($row->clientID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_PoolEntries $v1,Application_Model_PoolEntries $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_PoolEntriesMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_PoolEntries($row);
+ $entry->setID($row['poolentriesID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_PoolEntries');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_PoolEntries $polentries) {
+
+ $data = array('poolentriesID' => $polentries->getID(), 'poolID' => $polentries->getPoolID() , 'clientID' => $polentries->getClientID() );
+
+ if (null == = ($id = $polentries->getID()) ) {
+ unset($data['poolentriesID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('poolentriesID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_PoolEntries $polentries) {
+ if (null == = ($id = $polentries->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('poolentriesID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_PoolEntries $polentries) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $polentries->setID($row->poolentriesID)->setPoolID($row->poolID)->setClientID($row->clientID);
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_PoolEntries();
+
+ $entry->setID($row->poolentriesID)->setPoolID($row->poolID)->setClientID($row->clientID);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_PoolEntries $v1, Application_Model_PoolEntries $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/PoolMapper.php b/application/models/PoolMapper.php
index 469ab92..fef6f60 100644
--- a/application/models/PoolMapper.php
+++ b/application/models/PoolMapper.php
@@ -1,152 +1,144 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PoolMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Pool($row);
- $entry->setID($row['poolID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Pool');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Pool $pol)
- {
- print_a($pol);
- $data = array('poolID'=> $pol->getID() ,
- 'groupID'=> $pol->getGroupID() ,
- 'title'=> $pol->getTitle() ,
- 'description'=> $pol->getDescription() ,
- 'location'=> $pol->getLocation() );
-
- if (null === ($id = $pol->getID()) ) {
- unset($data['poolID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('poolID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Pool $pol)
- {
- if (null === ($id = $pol->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('poolID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Pool $pol)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $pol->setID($row->poolID)
- ->setGroupID($row->groupID)
- ->setTitle($row->title)
- ->setDescription($row->description)
- ->setLocation($row->location);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Pool();
-
- $entry->setID($row->poolID)
- ->setGroupID($row->groupID)
- ->setTitle($row->title)
- ->setDescription($row->description)
- ->setLocation($row->location);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Pool $v1,Application_Model_Pool $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_PoolMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Pool($row);
+ $entry->setID($row['poolID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Pool');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Pool $pol) {
+ print_a($pol);
+ $data = array('poolID' => $pol->getID() ,
+ 'groupID' => $pol->getGroupID() ,
+ 'title' => $pol->getTitle() ,
+ 'description' => $pol->getDescription() ,
+ 'location' => $pol->getLocation() );
+
+ if (null == = ($id = $pol->getID()) ) {
+ unset($data['poolID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('poolID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Pool $pol) {
+ if (null == = ($id = $pol->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('poolID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_Pool $pol) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $pol->setID($row->poolID)
+ ->setGroupID($row->groupID)
+ ->setTitle($row->title)
+ ->setDescription($row->description)
+ ->setLocation($row->location);
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Pool();
+
+ $entry->setID($row->poolID)
+ ->setGroupID($row->groupID)
+ ->setTitle($row->title)
+ ->setDescription($row->description)
+ ->setLocation($row->location);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Pool $v1, Application_Model_Pool $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
}
diff --git a/application/models/PreBoot.php b/application/models/PreBoot.php
index 34b4346..2a2737a 100644
--- a/application/models/PreBoot.php
+++ b/application/models/PreBoot.php
@@ -1,167 +1,147 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PreBoot
-{
- protected $_prebootID;
- protected $_title;
- protected $_membershipID;
- protected $_groupID;
- protected $_source;
- protected $_created;
- protected $_description;
-
-
-
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_PreBoot {
+ protected $_prebootID;
+ protected $_title;
+ protected $_membershipID;
+ protected $_groupID;
+ protected $_source;
+ protected $_created;
+ protected $_description;
+
+
+
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
}
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid preboot property');
- }
- $this->$method($value);
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid preboot property');
}
-
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid preboot property');
- }
- return $this->$method();
+ $this->$method($value);
+ }
+
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid preboot property');
}
-
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
+ return $this->$method();
+ }
+
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
}
+ return $this;
+ }
+
+ public function getID() {
+ return $this->_prebootID;
+ }
+ public function setID($_prebootID) {
+ $this->_prebootID = $_prebootID;
+ return $this;
+ }
+
+ public function getMembershipID() {
+ return $this->_membershipID;
+ }
+
+ public function setMembershipID($_membershipID) {
+ $this->_membershipID = $_membershipID;
+ return $this;
+ }
- public function getID()
- {
- return $this->_prebootID;
- }
- public function setID($_prebootID)
- {
- $this->_prebootID = $_prebootID;
- return $this;
- }
-
- public function getMembershipID()
- {
- return $this->_membershipID;
- }
-
- public function setMembershipID($_membershipID)
- {
- $this->_membershipID = $_membershipID;
- return $this;
- }
-
- public function getGroupID()
- {
- return $this->_groupID;
- }
-
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getCreated()
- {
- return $this->_created;
- }
-
- public function setCreated($_created)
- {
- $this->_created = $_created;
- return $this;
- }
- public function getSource()
- {
- return $this->_source;
- }
-
- public function setSource($_source)
- {
- $this->_source = $_source;
- return $this;
- }
- public function getDescription()
- {
- return $this->_description;
- }
- public function setDescription($_description)
- {
- $this->_description = $_description;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getCreated() {
+ return $this->_created;
+ }
+
+ public function setCreated($_created) {
+ $this->_created = $_created;
+ return $this;
+ }
+ public function getSource() {
+ return $this->_source;
+ }
+
+ public function setSource($_source) {
+ $this->_source = $_source;
+ return $this;
+ }
+ public function getDescription() {
+ return $this->_description;
+ }
+ public function setDescription($_description) {
+ $this->_description = $_description;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
}
- return $result;
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
+ }
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/PreBootMapper.php b/application/models/PreBootMapper.php
index b7b4104..f215e65 100644
--- a/application/models/PreBootMapper.php
+++ b/application/models/PreBootMapper.php
@@ -1,150 +1,142 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PreBootMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_PreBoot($row);
- $entry->setID($row['prebootID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_PreBoot');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_PreBoot $preboot)
- {
-
- $data = array('prebootID'=> $preboot->getID() ,'membershipID'=> $preboot->getMembershipID() ,'title'=> $preboot->getTitle() ,'groupID'=> $preboot->getGroupID(), 'created' => $preboot->getCreated(), 'source' => $preboot->getSource(), 'description' => $preboot->getDescription());
-
- if (null === ($id = $preboot->getID()) ) {
- unset($data['prebootID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('prebootID = ?' => $id));
- }
-
- }
-
- public function delete(Application_Model_PreBoot $preboot)
- {
- if (null === ($id = $preboot->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('prebootID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_PreBoot $preboot = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($preboot == null){
- $preboot = new Application_Model_PreBoot();
- $preboot->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->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)->setSource($row->source)->setCreated($row->created)->setDescription($row->description);
- }
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_PreBoot();
-
- $entry->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setSource($row->source)->setCreated($row->created)->setDescription($row->description);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_PreBoot $v1,Application_Model_PreBoot $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_PreBootMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_PreBoot($row);
+ $entry->setID($row['prebootID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_PreBoot');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_PreBoot $preboot) {
+
+ $data = array('prebootID' => $preboot->getID() , 'membershipID' => $preboot->getMembershipID() , 'title' => $preboot->getTitle() , 'groupID' => $preboot->getGroupID(), 'created' => $preboot->getCreated(), 'source' => $preboot->getSource(), 'description' => $preboot->getDescription());
+
+ if (null == = ($id = $preboot->getID()) ) {
+ unset($data['prebootID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('prebootID = ?' => $id));
+ }
+
+ }
+
+ public function delete(Application_Model_PreBoot $preboot) {
+ if (null == = ($id = $preboot->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('prebootID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_PreBoot $preboot = null) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ if($preboot == null) {
+ $preboot = new Application_Model_PreBoot();
+ $preboot->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->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)->setSource($row->source)->setCreated($row->created)->setDescription($row->description);
+ }
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_PreBoot();
+
+ $entry->setID($row->prebootID)->setMembershipID($row->membershipID)->setTitle($row->title)->setGroupID($row->groupID)->setSource($row->source)->setCreated($row->created)->setDescription($row->description);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_PreBoot $v1, Application_Model_PreBoot $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/Right.php b/application/models/Right.php
index 7201dd7..8e4732d 100644
--- a/application/models/Right.php
+++ b/application/models/Right.php
@@ -1,139 +1,123 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Right
-{
- protected $_rightID;
- protected $_rightcategoryID;
- protected $_shortcut;
- protected $_title;
- protected $_description;
+class Application_Model_Right {
+ protected $_rightID;
+ protected $_rightcategoryID;
+ protected $_shortcut;
+ protected $_title;
+ protected $_description;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid right property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid right property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid right property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid right property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_rightID;
- }
- public function setID($_rightID)
- {
- $this->_rightID = $_rightID;
- return $this;
- }
- public function getRightcategoryID()
- {
- return $this->_rightcategoryID;
- }
- public function setRightcategoryID($_rightcategoryID)
- {
- $this->_rightcategoryID = $_rightcategoryID;
- return $this;
- }
- public function getShortcut()
- {
- return $this->_shortcut;
- }
- public function setShortcut($_shortcut)
- {
- $this->_shortcut = $_shortcut;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getDescription()
- {
- return $this->_description;
- }
- public function setDescription($_description)
- {
- $this->_description = $_description;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
- }
- return $result;
- }
+ public function getID() {
+ return $this->_rightID;
+ }
+ public function setID($_rightID) {
+ $this->_rightID = $_rightID;
+ return $this;
+ }
+ public function getRightcategoryID() {
+ return $this->_rightcategoryID;
+ }
+ public function setRightcategoryID($_rightcategoryID) {
+ $this->_rightcategoryID = $_rightcategoryID;
+ return $this;
+ }
+ public function getShortcut() {
+ return $this->_shortcut;
+ }
+ public function setShortcut($_shortcut) {
+ $this->_shortcut = $_shortcut;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getDescription() {
+ return $this->_description;
+ }
+ public function setDescription($_description) {
+ $this->_description = $_description;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
+ }
+
+ }
+ }
+ return $result;
+ }
}
diff --git a/application/models/RightCategory.php b/application/models/RightCategory.php
index fb6df23..7aeea63 100644
--- a/application/models/RightCategory.php
+++ b/application/models/RightCategory.php
@@ -1,104 +1,94 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_RightCategory
-{
- protected $_rightcategoryID;
- protected $_title;
+class Application_Model_RightCategory {
+ protected $_rightcategoryID;
+ protected $_title;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid rightcategory property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid rightcategory property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid rightcategory property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid rightcategory property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_rightcategoryID;
- }
- public function setID($_rightcategoryID)
- {
- $this->_rightcategoryID = $_rightcategoryID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
+ public function getID() {
+ return $this->_rightcategoryID;
+ }
+ public function setID($_rightcategoryID) {
+ $this->_rightcategoryID = $_rightcategoryID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
- }
- return $result;
- }
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
+ }
+
+ }
+ }
+ return $result;
+ }
}
diff --git a/application/models/RightCategoryMapper.php b/application/models/RightCategoryMapper.php
index 9d7f277..142d2b7 100644
--- a/application/models/RightCategoryMapper.php
+++ b/application/models/RightCategoryMapper.php
@@ -1,140 +1,132 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_RightCategoryMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_RightCategory($row);
- $entry->setID($row['rightcategoryID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_RightCategory');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_RightCategory $rightCategory)
- {
-
- $data = array('rightcategoryID'=> $rightCategory->getID() ,'title'=> $rightCategory->getTitle() );
-
- if (null === ($id = $rightCategory->getID()) ) {
- unset($data['rightcategoryID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('rightcategoryID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_RightCategory $rightCategory)
- {
- if (null === ($id = $rightCategory->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('rightcategoryID = ?' => $id));
- }
- }
-
- public function find($id)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $rightCategory = new Application_Model_RightCategory();
- $rightCategory->setID($row->rightcategoryID)->setTitle($row->title);
- return $rightCategory;
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_RightCategory();
-
- $entry->setID($row->rightcategoryID)->setTitle($row->title);
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_RightCategory $v1,Application_Model_RightCategory $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_RightCategoryMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_RightCategory($row);
+ $entry->setID($row['rightcategoryID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_RightCategory');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_RightCategory $rightCategory) {
+
+ $data = array('rightcategoryID' => $rightCategory->getID() , 'title' => $rightCategory->getTitle() );
+
+ if (null == = ($id = $rightCategory->getID()) ) {
+ unset($data['rightcategoryID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('rightcategoryID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_RightCategory $rightCategory) {
+ if (null == = ($id = $rightCategory->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('rightcategoryID = ?' => $id));
+ }
+ }
+
+ public function find($id) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $rightCategory = new Application_Model_RightCategory();
+ $rightCategory->setID($row->rightcategoryID)->setTitle($row->title);
+ return $rightCategory;
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_RightCategory();
+
+ $entry->setID($row->rightcategoryID)->setTitle($row->title);
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_RightCategory $v1, Application_Model_RightCategory $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
}
diff --git a/application/models/RightMapper.php b/application/models/RightMapper.php
index 4b742a2..4fd56a5 100644
--- a/application/models/RightMapper.php
+++ b/application/models/RightMapper.php
@@ -1,155 +1,147 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_RightMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Right($row);
- $entry->setID($row['rightID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Right');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Right $right)
- {
-
- $data = array('rightID'=> $right->getID(),
- 'rightcategoryID'=> $right->getRightcategoryID(),
- 'shortcut'=>$right->getShortcut(),
- 'title'=> $right->getTitle() ,
- 'description'=> $right->getDescription() );
-
- if (null === ($id = $right->getID()) ) {
- unset($data['rightID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('rightID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Right $right)
- {
- if (null === ($id = $right->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('rightID = ?' => $id));
- }
- }
-
- public function find($id)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $right = new Application_Model_Right();
- $right->setID($row->rightID)
- ->setRightcategoryID($row->rightcategoryID)
- ->setShortcut($row->shortcut)
- ->setTitle($row->title)
- ->setDescription($row->description);
- return $right;
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Right();
-
- $entry->setID($row->rightID)
- ->setRightcategoryID($row->rightcategoryID)
- ->setShortcut($row->shortcut)
- ->setTitle($row->title)
- ->setDescription($row->description);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Right $v1,Application_Model_Right $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_RightMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Right($row);
+ $entry->setID($row['rightID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Right');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Right $right) {
+
+ $data = array('rightID' => $right->getID(),
+ 'rightcategoryID' => $right->getRightcategoryID(),
+ 'shortcut' => $right->getShortcut(),
+ 'title' => $right->getTitle() ,
+ 'description' => $right->getDescription() );
+
+ if (null == = ($id = $right->getID()) ) {
+ unset($data['rightID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('rightID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Right $right) {
+ if (null == = ($id = $right->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('rightID = ?' => $id));
+ }
+ }
+
+ public function find($id) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $right = new Application_Model_Right();
+ $right->setID($row->rightID)
+ ->setRightcategoryID($row->rightcategoryID)
+ ->setShortcut($row->shortcut)
+ ->setTitle($row->title)
+ ->setDescription($row->description);
+ return $right;
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Right();
+
+ $entry->setID($row->rightID)
+ ->setRightcategoryID($row->rightcategoryID)
+ ->setShortcut($row->shortcut)
+ ->setTitle($row->title)
+ ->setDescription($row->description);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Right $v1, Application_Model_Right $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/RightRoles.php b/application/models/RightRoles.php
index 3b5f816..8cfaa73 100644
--- a/application/models/RightRoles.php
+++ b/application/models/RightRoles.php
@@ -1,109 +1,99 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_RightRoles
-{
- protected $_roleID;
- protected $_rightID;
+class Application_Model_RightRoles {
+ protected $_roleID;
+ protected $_rightID;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid rightroles property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid rightroles property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid rightroles property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid rightroles property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getRoleID()
- {
- return $this->_roleID;
- }
- public function setRoleID($_roleID)
- {
- $this->_roleID = $_roleID;
- return $this;
- }
- public function getRightID()
- {
- return $this->_rightID;
- }
- public function setRightID($_rightID)
- {
- $this->_rightID = $_rightID;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getRoleID() {
+ return $this->_roleID;
+ }
+ public function setRoleID($_roleID) {
+ $this->_roleID = $_roleID;
+ return $this;
+ }
+ public function getRightID() {
+ return $this->_rightID;
+ }
+ public function setRightID($_rightID) {
+ $this->_rightID = $_rightID;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/RightRolesMapper.php b/application/models/RightRolesMapper.php
index a7e8c89..8688277 100644
--- a/application/models/RightRolesMapper.php
+++ b/application/models/RightRolesMapper.php
@@ -1,138 +1,130 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_RightRolesMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_RightRoles($row);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_RightRoles');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_RightRoles $rightroles)
- {
- $data = array('roleID'=> $rightroles->getRoleID() ,'rightID'=> $rightroles->getRightID() );
-
- if (null === $rightroles->getRoleID() || null === $rightroles->getRightID()) {
- return;
- } else {
- $this->getDbTable()->insert($data);
- }
- }
-
- public function delete(Application_Model_RightRoles $rightroles)
- {
- if (null === ($roleID = $rightroles->getRoleID()) || null === ($rightID = $rightroles->getRightID())) {
- return;
- } else {
- $this->getDbTable()->delete(array('roleID = ?' => $roleID, 'rightID = ?' => $rightID));
- }
- }
-
- public function find($roleID, $rightID)
- {
- $result = $this->getDbTable()->find($roleID, $rightID);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRoleID($row->roleID)->setRightID($row->rightID);
- return $rightroles;
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_RightRoles();
-
- $entry->setRoleID($row->roleID)->setRightID($row->rightID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_RightRoles $v1,Application_Model_RightRoles $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_RightRolesMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_RightRoles($row);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_RightRoles');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_RightRoles $rightroles) {
+ $data = array('roleID' => $rightroles->getRoleID() , 'rightID' => $rightroles->getRightID() );
+
+ if (null == = $rightroles->getRoleID() || null == = $rightroles->getRightID()) {
+ return;
+ } else {
+ $this->getDbTable()->insert($data);
+ }
+ }
+
+ public function delete(Application_Model_RightRoles $rightroles) {
+ if (null == = ($roleID = $rightroles->getRoleID()) || null == = ($rightID = $rightroles->getRightID())) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('roleID = ?' => $roleID, 'rightID = ?' => $rightID));
+ }
+ }
+
+ public function find($roleID, $rightID) {
+ $result = $this->getDbTable()->find($roleID, $rightID);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $rightroles = new Application_Model_RightRoles();
+ $rightroles->setRoleID($row->roleID)->setRightID($row->rightID);
+ return $rightroles;
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_RightRoles();
+
+ $entry->setRoleID($row->roleID)->setRightID($row->rightID);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_RightRoles $v1, Application_Model_RightRoles $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
diff --git a/application/models/Role.php b/application/models/Role.php
index 3d03d53..b8146d5 100644
--- a/application/models/Role.php
+++ b/application/models/Role.php
@@ -1,139 +1,123 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Role
-{
- protected $_roleID;
- protected $_groupID;
- protected $_title;
- protected $_description;
- protected $_inheritance;
+class Application_Model_Role {
+ protected $_roleID;
+ protected $_groupID;
+ protected $_title;
+ protected $_description;
+ protected $_inheritance;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid role property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid role property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid role property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid role property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_roleID;
- }
- public function setID($_roleID)
- {
- $this->_roleID = $_roleID;
- return $this;
- }
- public function getGroupID()
- {
- return $this->_groupID;
- }
- public function setGroupID($_groupID)
- {
- $this->_groupID = $_groupID;
- return $this;
- }
- public function getTitle()
- {
- return $this->_title;
- }
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
- public function getDescription()
- {
- return $this->_description;
- }
- public function setDescription($_description)
- {
- $this->_description = $_description;
- return $this;
- }
- public function getInheritance()
- {
- return $this->_inheritance;
- }
- public function setInheritance($_inheritance)
- {
- $this->_inheritance = $_inheritance;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
- }
- return $result;
- }
+ public function getID() {
+ return $this->_roleID;
+ }
+ public function setID($_roleID) {
+ $this->_roleID = $_roleID;
+ return $this;
+ }
+ public function getGroupID() {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID) {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getTitle() {
+ return $this->_title;
+ }
+ public function setTitle($_title) {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getDescription() {
+ return $this->_description;
+ }
+ public function setDescription($_description) {
+ $this->_description = $_description;
+ return $this;
+ }
+ public function getInheritance() {
+ return $this->_inheritance;
+ }
+ public function setInheritance($_inheritance) {
+ $this->_inheritance = $_inheritance;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
+ }
+
+ }
+ }
+ return $result;
+ }
}
diff --git a/application/models/RoleMapper.php b/application/models/RoleMapper.php
index 88ac208..61ad1c4 100644
--- a/application/models/RoleMapper.php
+++ b/application/models/RoleMapper.php
@@ -1,142 +1,134 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_RoleMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Role($row);
- $entry->setID($row['roleID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Role');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Role $role)
- {
-
- $data = array('roleID'=> $role->getID() ,'groupID'=> $role->getGroupID() ,'title'=> $role->getTitle() ,'description'=> $role->getDescription(), 'inheritance' => $role->getInheritance() );
-
- if (null === ($id = $role->getID()) ) {
- unset($data['roleID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('roleID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Role $role)
- {
- if (null === ($id = $role->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('roleID = ?' => $id));
- }
- }
-
- public function find($id)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
- $role = new Application_Model_Role();
- $role->setID($row->roleID)->setGroupID($row->groupID)->setTitle($row->title)->setDescription($row->description)->setInheritance($row->inheritance);
- return $role;
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Role();
-
- $entry->setID($row->roleID)->setGroupID($row->groupID)->setTitle($row->title)->setDescription($row->description)->setInheritance($row->inheritance);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Role $v1,Application_Model_Role $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_RoleMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Role($row);
+ $entry->setID($row['roleID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Role');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Role $role) {
+
+ $data = array('roleID' => $role->getID() , 'groupID' => $role->getGroupID() , 'title' => $role->getTitle() , 'description' => $role->getDescription(), 'inheritance' => $role->getInheritance() );
+
+ if (null == = ($id = $role->getID()) ) {
+ unset($data['roleID']);
+ $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('roleID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Role $role) {
+ if (null == = ($id = $role->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('roleID = ?' => $id));
+ }
+ }
+
+ public function find($id) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+ $role = new Application_Model_Role();
+ $role->setID($row->roleID)->setGroupID($row->groupID)->setTitle($row->title)->setDescription($row->description)->setInheritance($row->inheritance);
+ return $role;
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Role();
+
+ $entry->setID($row->roleID)->setGroupID($row->groupID)->setTitle($row->title)->setDescription($row->description)->setInheritance($row->inheritance);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Role $v1, Application_Model_Role $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/models/Session.php b/application/models/Session.php
index fa9979a..2d794d2 100644
--- a/application/models/Session.php
+++ b/application/models/Session.php
@@ -1,199 +1,171 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Application_Model_Session
-{
- protected $_sessionID;
- protected $_alphasessionID;
- protected $_clientID;
- protected $_bootmenuentryID;
- protected $_bootosID;
- protected $_bootisoID;
- protected $_membershipID;
- protected $_personID;
- protected $_time;
- protected $_ip;
- protected $_ip6;
+class Application_Model_Session {
+ protected $_sessionID;
+ protected $_alphasessionID;
+ protected $_clientID;
+ protected $_bootmenuentryID;
+ protected $_bootosID;
+ protected $_bootisoID;
+ protected $_membershipID;
+ protected $_personID;
+ protected $_time;
+ protected $_ip;
+ protected $_ip6;
- public function __construct(array $options = null)
- {
- if (is_array($options)) {
- $this->setOptions($options);
- }
- }
+ public function __construct(array $options = null) {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
- public function __set($name, $value)
- {
- $method = 'set' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid session property');
- }
- $this->$method($value);
- }
+ public function __set($name, $value) {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid session property');
+ }
+ $this->$method($value);
+ }
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid session property');
- }
- return $this->$method();
- }
+ public function __get($name) {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid session property');
+ }
+ return $this->$method();
+ }
- public function setOptions(array $options)
- {
- $methods = get_class_methods($this);
- foreach ($options as $key => $value) {
- $method = 'set' . ucfirst($key);
- if (in_array($method, $methods)) {
- $this->$method($value);
- }
- }
- return $this;
- }
+ public function setOptions(array $options) {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
- public function getID()
- {
- return $this->_sessionID;
- }
- public function setID($_sessionID)
- {
- $this->_sessionID = $_sessionID;
- return $this;
- }
- public function getAlphasessionID()
- {
- return $this->_alphasessionID;
- }
- public function setAlphasessionID($_alphasessionID)
- {
- $this->_alphasessionID = $_alphasessionID;
- return $this;
- }
- public function getClientID()
- {
- return $this->_clientID;
- }
- public function setClientID($_clientID)
- {
- $this->_clientID = $_clientID;
- return $this;
- }
- public function getBootmenuentryID()
- {
- return $this->_bootmenuentryID;
- }
- public function setBootmenuentryID($_bootmenuentryID)
- {
- $this->_bootmenuentryID = $_bootmenuentryID;
- return $this;
- }
- public function getBootosID()
- {
- return $this->_bootosID;
- }
- public function setBootosID($_bootosID)
- {
- $this->_bootosID = $_bootosID;
- return $this;
- }
- public function getBootisoID()
- {
- return $this->_bootisoID;
- }
- public function setBootisoID($_bootisoID)
- {
- $this->_bootisoID = $_bootisoID;
- return $this;
- }
- public function getMembershipID()
- {
- return $this->_membershipID;
- }
- public function setMembershipID($_membershipID)
- {
- $this->_membershipID = $_membershipID;
- return $this;
- }
- public function getPersonID()
- {
- return $this->_personID;
- }
- public function setPersonID($_personID)
- {
- $this->_personID = $_personID;
- return $this;
- }
- public function getTime()
- {
- return $this->_time;
- }
- public function setTime($_time)
- {
- $this->_time = $_time;
- return $this;
- }
- public function getIp()
- {
- return $this->_ip;
- }
- public function setIp($_ip)
- {
- $this->_ip = $_ip;
- return $this;
- }
- public function getIp6()
- {
- return $this->_ip6;
- }
- public function setIp6($_ip6)
- {
- $this->_ip6 = $_ip6;
- return $this;
- }
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
- public function toArray()
- {
- $reflectionClass = new ReflectionClass($this);
- $properties = $reflectionClass->getProperties();
- $result = array();
- foreach ($properties as $property) {
- $key = $property->name;
- if (substr($key, 0, 1) != '_' && $this->$key !== null) {
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- } else {
- $result[$key] = $this->$key;
- }
- }
- elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
- $key = substr($key, 1);
- $method = 'get' . ucfirst($key);
- if ($reflectionClass->hasMethod($method)) {
- $result[$key] = $this->$method();
- }else{
- $result[$key] = $this->getID();
- }
-
- }
+ public function getID() {
+ return $this->_sessionID;
+ }
+ public function setID($_sessionID) {
+ $this->_sessionID = $_sessionID;
+ return $this;
+ }
+ public function getAlphasessionID() {
+ return $this->_alphasessionID;
+ }
+ public function setAlphasessionID($_alphasessionID) {
+ $this->_alphasessionID = $_alphasessionID;
+ return $this;
+ }
+ public function getClientID() {
+ return $this->_clientID;
+ }
+ public function setClientID($_clientID) {
+ $this->_clientID = $_clientID;
+ return $this;
+ }
+ public function getBootmenuentryID() {
+ return $this->_bootmenuentryID;
+ }
+ public function setBootmenuentryID($_bootmenuentryID) {
+ $this->_bootmenuentryID = $_bootmenuentryID;
+ return $this;
+ }
+ public function getBootosID() {
+ return $this->_bootosID;
+ }
+ public function setBootosID($_bootosID) {
+ $this->_bootosID = $_bootosID;
+ return $this;
+ }
+ public function getBootisoID() {
+ return $this->_bootisoID;
+ }
+ public function setBootisoID($_bootisoID) {
+ $this->_bootisoID = $_bootisoID;
+ return $this;
+ }
+ public function getMembershipID() {
+ return $this->_membershipID;
+ }
+ public function setMembershipID($_membershipID) {
+ $this->_membershipID = $_membershipID;
+ return $this;
+ }
+ public function getPersonID() {
+ return $this->_personID;
+ }
+ public function setPersonID($_personID) {
+ $this->_personID = $_personID;
+ return $this;
+ }
+ public function getTime() {
+ return $this->_time;
+ }
+ public function setTime($_time) {
+ $this->_time = $_time;
+ return $this;
+ }
+ public function getIp() {
+ return $this->_ip;
+ }
+ public function setIp($_ip) {
+ $this->_ip = $_ip;
+ return $this;
+ }
+ public function getIp6() {
+ return $this->_ip6;
+ }
+ public function setIp6($_ip6) {
+ $this->_ip6 = $_ip6;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray() {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key != = null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key != = null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->getID();
}
- return $result;
+
+ }
}
+ return $result;
+ }
}
diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php
index 3b35ccb..3304798 100644
--- a/application/models/SessionMapper.php
+++ b/application/models/SessionMapper.php
@@ -1,169 +1,161 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_SessionMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Session($row);
- $entry->setID($row['sessionID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Session');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Session $session)
- {
- $data = array( 'sessionID'=> $session->getID() ,
- 'alphasessionID'=> $session->getAlphasessionID(),
- 'clientID'=> $session->getClientID() ,
- 'bootmenuentryID'=> $session->getBootmenuentryID(),
- 'bootosID'=> $session->getBootosID() ,
- 'bootisoID'=> $session->getBootisoID() ,
- 'membershipID'=> $session->getMembershipID() ,
- 'personID'=> $session->getPersonID() ,
- 'time'=> $session->getTime() ,
- 'ip'=> $session->getIp() ,
- 'ip6'=> $session->getIp6() );
- if (null === ($id = $session->getID()) ) {
- unset($data['sessionID']);
- return $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('sessionID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Session $sesion)
- {
- if (null === ($id = $sesion->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('sessionID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Session $sesion)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $sesion->setID($row->sessionID)
- ->setAlphasessionID($row->alphasessionID)
- ->setClientID($row->clientID)
- ->setBootmenuentryID($row->bootmenuentryID)
- ->setBootosID($row->bootosID)
- ->setBootisoID($row->bootisoID)
- ->setMembershipID($row->membershipID)
- ->setPersonID($row->personID)
- ->setTime($row->time)
- ->setIp($row->ip)
- ->setIp6($row->ip6);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Session();
-
- $entry->setID($row->sessionID)
- ->setAlphasessionID($row->alphasessionID)
- ->setClientID($row->clientID)
- ->setBootmenuentryID($row->bootmenuentryID)
- ->setBootosID($row->bootosID)
- ->setBootisoID($row->bootisoID)
- ->setMembershipID($row->membershipID)
- ->setPersonID($row->personID)
- ->setTime($row->time)
- ->setIp($row->ip)
- ->setIp6($row->ip6);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Session $v1,Application_Model_Session $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Application_Model_SessionMapper {
+
+ protected $_dbTable;
+
+ public function findBy($where, $array = false, $order = false) {
+ foreach($where as $k => $v) {
+ if($v != null)
+ { $where2[] = "$k = '$v'"; }
+ else
+ { $where2[] = "$k IS NULL"; }
+ }
+ $where = implode(" AND " , $where2);
+
+ try {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
+ if(is_array($order)) {
+ foreach ($order as $k => $v)
+ $a[] = "$k $v";
+ $select->order($a);
+ }
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+
+ if(!$array) {
+ $entries = array();
+ foreach ($result as $row) {
+ $entry = new Application_Model_Session($row);
+ $entry->setID($row['sessionID']);
+ $entries[] = $entry;
+ }
+ return $entries;
+ } else {
+ return $result;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function setDbTable($dbTable) {
+ if (is_string($dbTable)) {
+ $dbTable = new $dbTable();
+ }
+
+ if (!$dbTable instanceof Zend_Db_Table_Abstract) {
+ throw new Exception('Invalid table data gateway provided');
+ }
+
+ $this->_dbTable = $dbTable;
+
+ return $this;
+ }
+
+ public function getDbTable() {
+ if (null == = $this->_dbTable) {
+ $this->setDbTable('Application_Model_DbTable_Session');
+ }
+
+ return $this->_dbTable;
+ }
+
+ public function save(Application_Model_Session $session) {
+ $data = array( 'sessionID' => $session->getID() ,
+ 'alphasessionID' => $session->getAlphasessionID(),
+ 'clientID' => $session->getClientID() ,
+ 'bootmenuentryID' => $session->getBootmenuentryID(),
+ 'bootosID' => $session->getBootosID() ,
+ 'bootisoID' => $session->getBootisoID() ,
+ 'membershipID' => $session->getMembershipID() ,
+ 'personID' => $session->getPersonID() ,
+ 'time' => $session->getTime() ,
+ 'ip' => $session->getIp() ,
+ 'ip6' => $session->getIp6() );
+ if (null == = ($id = $session->getID()) ) {
+ unset($data['sessionID']);
+ return $this->getDbTable()->insert($data);
+ } else {
+ $this->getDbTable()->update($data, array('sessionID = ?' => $id));
+ }
+ }
+
+ public function delete(Application_Model_Session $sesion) {
+ if (null == = ($id = $sesion->getID()) ) {
+ return;
+ } else {
+ $this->getDbTable()->delete(array('sessionID = ?' => $id));
+ }
+ }
+
+ public function find($id, Application_Model_Session $sesion) {
+ $result = $this->getDbTable()->find($id);
+ if (0 == count($result)) {
+ return;
+ }
+
+ $row = $result->current();
+
+ $sesion->setID($row->sessionID)
+ ->setAlphasessionID($row->alphasessionID)
+ ->setClientID($row->clientID)
+ ->setBootmenuentryID($row->bootmenuentryID)
+ ->setBootosID($row->bootosID)
+ ->setBootisoID($row->bootisoID)
+ ->setMembershipID($row->membershipID)
+ ->setPersonID($row->personID)
+ ->setTime($row->time)
+ ->setIp($row->ip)
+ ->setIp6($row->ip6);
+ }
+
+ public function fetchAll() {
+ $resultSet = $this->getDbTable()->fetchAll();
+ $entries = array();
+ foreach ($resultSet as $row) {
+ $entry = new Application_Model_Session();
+
+ $entry->setID($row->sessionID)
+ ->setAlphasessionID($row->alphasessionID)
+ ->setClientID($row->clientID)
+ ->setBootmenuentryID($row->bootmenuentryID)
+ ->setBootosID($row->bootosID)
+ ->setBootisoID($row->bootisoID)
+ ->setMembershipID($row->membershipID)
+ ->setPersonID($row->personID)
+ ->setTime($row->time)
+ ->setIp($row->ip)
+ ->setIp6($row->ip6);
+
+ $entries[] = $entry;
+ }
+ return $entries;
+ }
+
+ public function compare(Application_Model_Session $v1, Application_Model_Session $v2) {
+ $vv1 = $v1->toArray();
+ $vv2 = $v2->toArray();
+ return array_diff($vv1, $vv2);
+ }
+
+
+
}
diff --git a/application/modules/dev/Bootstrap.php b/application/modules/dev/Bootstrap.php
index d8dece3..4215699 100644
--- a/application/modules/dev/Bootstrap.php
+++ b/application/modules/dev/Bootstrap.php
@@ -1,22 +1,20 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-class dev_Bootstrap extends Zend_Application_Module_Bootstrap
-{
- function _initViewHelpers()
- {
- $this->bootstrap('layout');
-
- $layout = $this->getResource('layout');
- $view = $layout->getView();
- $view->headLink()->appendStylesheet('/media/css/dev.css');
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+class dev_Bootstrap extends Zend_Application_Module_Bootstrap {
+ function _initViewHelpers() {
+ $this->bootstrap('layout');
+
+ $layout = $this->getResource('layout');
+ $view = $layout->getView();
+ $view->headLink()->appendStylesheet('/media/css/dev.css');
+ }
}
diff --git a/application/modules/dev/controllers/AuthController.php b/application/modules/dev/controllers/AuthController.php
index bb59037..2e99cd7 100644
--- a/application/modules/dev/controllers/AuthController.php
+++ b/application/modules/dev/controllers/AuthController.php
@@ -1,247 +1,234 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_AuthController extends Zend_Controller_Action
-{
- protected $personmapper;
- private $db = null;
-
- public function init()
- {
- $this->db = Zend_Db_Table::getDefaultAdapter();
- $this->personmapper = new Application_Model_PersonMapper();
- }
-
- public function indexAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- $this->_helper->redirector('login', 'auth');
- }
-
- public function loginAction()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->_redirect('/dev/');
- } else {
- if (!isset($_POST["login"])){
- $loginForm = new dev_Form_AuthLogin();
- } else {
- $loginForm = new dev_Form_AuthLogin($_POST);
-
- if ($loginForm->isValid($_POST)) {
-
- $auth = Zend_Auth::getInstance();
-
- $adapter = new Zend_Auth_Adapter_DbTable(
- $this->db,
- 'pbs_person',
- 'email',
- 'password',
- 'MD5(CONCAT(?, password_salt))'
- );
-
-
- $adapter->setIdentity($loginForm->getValue('email'));
- $adapter->setCredential($loginForm->getValue('password'));
-
- $result = $auth->authenticate($adapter);
-
- // TODO: erweiterte fehlerbeschreibung des Users
-
- if ($result->isValid()) {
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $date = new DateTime();
- $person->setLogindate($date->getTimestamp());
- $this->personmapper->save($person);
- $this->_redirect('/dev/');
- return;
- } else {
- echo "Wrong Email or Password.";
- }
- }
- }
- $this->view->loginForm = $loginForm;
- }
- }
-
- public function registerAction()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- print_a('Already logged in.');
- } else {
- if (!isset($_POST["register"])){
- $registerForm = new dev_Form_AuthRegister();
- } else {
- $registerForm = new dev_Form_AuthRegister($_POST);
-
- if ($registerForm->isValid($_POST)) {
-
- $person = new Application_Model_Person($_POST);
- $this->personmapper = new Application_Model_PersonMapper();
-
- $date = new DateTime();
- $person->setRegisterdate($date->getTimestamp());
- $person->setPasswordSalt(MD5($date->getTimestamp()));
- $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
- print_a($person);
- try {
- $this->personmapper->save($person);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- echo "Email Address already existing..";
- return;
- }
- echo "Successfully registered. <br/>";
- echo "Continue to Login: <a href=\""."/dev/auth/login"."\">Login</a>";
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
- $this->view->registerForm = $registerForm;
- }
- }
-
- public function logoutAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- $auth = Zend_Auth::getInstance();
- $auth->clearIdentity();
- Zend_Session::namespaceUnset('userIDs');
- Zend_Session::forgetMe();
- $this->_helper->redirector('login', 'auth');
- return;
- }
-
- public function recoverpasswordAction()
- {
- if (isset($_POST["savePassword"])){
- $personID = $_POST['personID'];
- $recoverPasswordForm = new dev_Form_NewPassword(array("personID" => $personID, $_POST));
- if ($recoverPasswordForm->isValid($_POST)) {
- $this->personmapper = new Application_Model_PersonMapper();
- $person = $this->personmapper->find($personID);
- $date = new DateTime();
- $person->setPassword($_POST['password']);
- $person->setPasswordSalt(MD5($date->getTimestamp()));
- $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
- try {
- $this->personmapper->save($person);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- echo "Email Address already existing.";
- return;
- }
- $this->_helper->redirector('login', 'auth');
- return;
- }
- } else if(isset($_GET['recoveryid'])) {
- $recoveryid = $_GET['recoveryid'];
- $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
- $passwordRecovery = $passwordRecoveryMapper->findBy(array("recoveryID" => $recoveryid),true);
- if(count($passwordRecovery) > 0) {
- $passwordRecoveryObject = new Application_Model_PasswordRecovery();
- $passwordRecoveryObject->setID($passwordRecovery[0]['personID']);
- $passwordRecoveryObject->setRecoveryID($passwordRecovery[0]['recoveryID']);
- $personID = $passwordRecoveryObject->getID();
- $recoverPasswordForm = new dev_Form_NewPassword(array("personID" => $personID));
- try {
- $passwordRecoveryMapper->delete($passwordRecoveryObject);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- } else {
- $this->_helper->redirector('login', 'auth');
- return;
- }
- } else {
- if (!isset($_POST["recoverPassword"])){
- $recoverPasswordForm = new dev_Form_AuthRecoverPassword();
- } else {
- $recoverPasswordForm = new dev_Form_AuthRecoverPassword($_POST);
- if ($recoverPasswordForm->isValid($_POST)) {
- $recoverPasswordForm->getView()->url();
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy('email', $_POST['email']);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $email = $person->getEmail();
- $name = $person->getFirstname() . ' ' . $person->getName();
- $url = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->view->url();
- $recoveryid = randomString(100);
- $mailbody = 'Um das Passwort zu ändern klicken Sie auf folgenden Link<br /><br /><a href="'. $url . '/auth/recoverpassword/?recoveryid='. $recoveryid . '">Passwort ändern</a>';
- $mail = new Zend_Mail();
- $mail->setBodyHtml($mailbody, 'utf8');
- $mail->getBodyHtml()->getContent();
- $mail->setFrom('admin@local', 'Admin');
- $mail->addTo($email, $name);
- $mail->setSubject('Password Wiederherstellung Preboot Server');
- $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
- $passwordRecoveryObject = new Application_Model_PasswordRecovery();
- $passwordRecoveryObject->setID($person->getID());
- $passwordRecoveryObject->setRecoveryID($recoveryid);
- try {
- $passwordRecoveryMapper->save($passwordRecoveryObject);
- $mail->send();
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
- }
- $this->view->recoverPasswordForm = $recoverPasswordForm;
- }
-
- public function deleteAction()
- {
- if($_POST['confirmdelete']) {
- $auth = Zend_Auth::getInstance();
- $result = $this->personmapper->findBy(array('email' => $auth->getIdentity()), true);
- $person = $result[0];
- $personID = $person["personID"];
- if (isset($personID)){
- $this->personmapper = new Application_Model_PersonMapper();
- $person = $this->personmapper->find($personID);
- try {
- $this->personmapper->delete($person);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $auth->clearIdentity();
- Zend_Session::namespaceUnset('userIDs');
- Zend_Session::forgetMe();
- $this->_helper->redirector('login', 'auth');
- return;
- }
- } else {
- $deleteconfirmform = new dev_Form_ConfirmDeleteAccount();
- $this->view->deleteconfirmform = $deleteconfirmform;
- }
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_AuthController extends Zend_Controller_Action {
+ protected $personmapper;
+ private $db = null;
+
+ public function init() {
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ $this->personmapper = new Application_Model_PersonMapper();
+ }
+
+ public function indexAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ $this->_helper->redirector('login', 'auth');
+ }
+
+ public function loginAction() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->_redirect('/dev/');
+ } else {
+ if (!isset($_POST["login"])) {
+ $loginForm = new dev_Form_AuthLogin();
+ } else {
+ $loginForm = new dev_Form_AuthLogin($_POST);
+
+ if ($loginForm->isValid($_POST)) {
+
+ $auth = Zend_Auth::getInstance();
+
+ $adapter = new Zend_Auth_Adapter_DbTable(
+ $this->db,
+ 'pbs_person',
+ 'email',
+ 'password',
+ 'MD5(CONCAT(?, password_salt))'
+ );
+
+
+ $adapter->setIdentity($loginForm->getValue('email'));
+ $adapter->setCredential($loginForm->getValue('password'));
+
+ $result = $auth->authenticate($adapter);
+
+ // TODO: erweiterte fehlerbeschreibung des Users
+
+ if ($result->isValid()) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()), true);
+ $person = new Application_Model_Person($result[0]);
+ $person->setID($result[0]['personID']);
+ $date = new DateTime();
+ $person->setLogindate($date->getTimestamp());
+ $this->personmapper->save($person);
+ $this->_redirect('/dev/');
+ return;
+ } else {
+ echo "Wrong Email or Password.";
+ }
+ }
+ }
+ $this->view->loginForm = $loginForm;
+ }
+ }
+
+ public function registerAction() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ print_a('Already logged in.');
+ } else {
+ if (!isset($_POST["register"])) {
+ $registerForm = new dev_Form_AuthRegister();
+ } else {
+ $registerForm = new dev_Form_AuthRegister($_POST);
+
+ if ($registerForm->isValid($_POST)) {
+
+ $person = new Application_Model_Person($_POST);
+ $this->personmapper = new Application_Model_PersonMapper();
+
+ $date = new DateTime();
+ $person->setRegisterdate($date->getTimestamp());
+ $person->setPasswordSalt(MD5($date->getTimestamp()));
+ $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
+ print_a($person);
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ echo "Email Address already existing..";
+ return;
+ }
+ echo "Successfully registered. <br/>";
+ echo "Continue to Login: <a href=\""."/dev/auth/login"."\">Login</a>";
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ }
+ $this->view->registerForm = $registerForm;
+ }
+ }
+
+ public function logoutAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ $auth = Zend_Auth::getInstance();
+ $auth->clearIdentity();
+ Zend_Session::namespaceUnset('userIDs');
+ Zend_Session::forgetMe();
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+
+ public function recoverpasswordAction() {
+ if (isset($_POST["savePassword"])) {
+ $personID = $_POST['personID'];
+ $recoverPasswordForm = new dev_Form_NewPassword(array("personID" => $personID, $_POST));
+ if ($recoverPasswordForm->isValid($_POST)) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $person = $this->personmapper->find($personID);
+ $date = new DateTime();
+ $person->setPassword($_POST['password']);
+ $person->setPasswordSalt(MD5($date->getTimestamp()));
+ $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ echo "Email Address already existing.";
+ return;
+ }
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ } else if(isset($_GET['recoveryid'])) {
+ $recoveryid = $_GET['recoveryid'];
+ $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
+ $passwordRecovery = $passwordRecoveryMapper->findBy(array("recoveryID" => $recoveryid), true);
+ if(count($passwordRecovery) > 0) {
+ $passwordRecoveryObject = new Application_Model_PasswordRecovery();
+ $passwordRecoveryObject->setID($passwordRecovery[0]['personID']);
+ $passwordRecoveryObject->setRecoveryID($passwordRecovery[0]['recoveryID']);
+ $personID = $passwordRecoveryObject->getID();
+ $recoverPasswordForm = new dev_Form_NewPassword(array("personID" => $personID));
+ try {
+ $passwordRecoveryMapper->delete($passwordRecoveryObject);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ } else {
+ if (!isset($_POST["recoverPassword"])) {
+ $recoverPasswordForm = new dev_Form_AuthRecoverPassword();
+ } else {
+ $recoverPasswordForm = new dev_Form_AuthRecoverPassword($_POST);
+ if ($recoverPasswordForm->isValid($_POST)) {
+ $recoverPasswordForm->getView()->url();
+ $this->personmapper = new Application_Model_PersonMapper();
+ $result = $this->personmapper->findBy('email', $_POST['email']);
+ $person = new Application_Model_Person($result[0]);
+ $person->setID($result[0]['personID']);
+ $email = $person->getEmail();
+ $name = $person->getFirstname() . ' ' . $person->getName();
+ $url = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->view->url();
+ $recoveryid = randomString(100);
+ $mailbody = 'Um das Passwort zu ändern klicken Sie auf folgenden Link<br /><br /><a href="'. $url . '/auth/recoverpassword/?recoveryid='. $recoveryid . '">Passwort ändern</a>';
+ $mail = new Zend_Mail();
+ $mail->setBodyHtml($mailbody, 'utf8');
+ $mail->getBodyHtml()->getContent();
+ $mail->setFrom('admin@local', 'Admin');
+ $mail->addTo($email, $name);
+ $mail->setSubject('Password Wiederherstellung Preboot Server');
+ $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
+ $passwordRecoveryObject = new Application_Model_PasswordRecovery();
+ $passwordRecoveryObject->setID($person->getID());
+ $passwordRecoveryObject->setRecoveryID($recoveryid);
+ try {
+ $passwordRecoveryMapper->save($passwordRecoveryObject);
+ $mail->send();
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ }
+ }
+ $this->view->recoverPasswordForm = $recoverPasswordForm;
+ }
+
+ public function deleteAction() {
+ if($_POST['confirmdelete']) {
+ $auth = Zend_Auth::getInstance();
+ $result = $this->personmapper->findBy(array('email' => $auth->getIdentity()), true);
+ $person = $result[0];
+ $personID = $person["personID"];
+ if (isset($personID)) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $person = $this->personmapper->find($personID);
+ try {
+ $this->personmapper->delete($person);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $auth->clearIdentity();
+ Zend_Session::namespaceUnset('userIDs');
+ Zend_Session::forgetMe();
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ } else {
+ $deleteconfirmform = new dev_Form_ConfirmDeleteAccount();
+ $this->view->deleteconfirmform = $deleteconfirmform;
+ }
+ }
}
diff --git a/application/modules/dev/controllers/BootisoController.php b/application/modules/dev/controllers/BootisoController.php
index 5c250cc..d9a2b15 100644
--- a/application/modules/dev/controllers/BootisoController.php
+++ b/application/modules/dev/controllers/BootisoController.php
@@ -1,194 +1,185 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_BootisoController extends Zend_Controller_Action
-{
-
- public function init()
- {
- $db = Zend_Db_Table::getDefaultAdapter();
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_BootisoController extends Zend_Controller_Action {
+
+ public function init() {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ }
+
+ public function indexAction() {
+ $bootisomapper = new Application_Model_BootIsoMapper();
+ $groupmapper = new Application_Model_GroupMapper();
+ $membershipmapper = new Application_Model_MembershipMapper();
+ $personmapper = new Application_Model_PersonMapper();
+ $prebootmapper = new Application_Model_PreBootMapper();
+
+ $this->view->bootisolist = $bootisomapper->fetchAll();
+ $this->view->prebootlist = array();
+
+
+ foreach ($this->view->bootisolist as $bootiso) {
+ $this->view->prebootlist[$bootiso->getID()] = $prebootmapper->find($bootiso->getPrebootID())->getTitle();
+ $bootiso->setGroupID("[".$bootiso->getGroupID()."] ".$groupmapper->find($bootiso->getGroupID())->getTitle());
+ $bootiso->setMembershipID("[".$bootiso->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootiso->getMembershipID())->getPersonID())->getFirstname());
}
- public function indexAction()
- {
- $bootisomapper = new Application_Model_BootIsoMapper();
- $groupmapper = new Application_Model_GroupMapper();
- $membershipmapper = new Application_Model_MembershipMapper();
- $personmapper = new Application_Model_PersonMapper();
- $prebootmapper = new Application_Model_PreBootMapper();
-
- $this->view->bootisolist = $bootisomapper->fetchAll();
- $this->view->prebootlist = array();
-
-
- foreach ($this->view->bootisolist as $bootiso){
- $this->view->prebootlist[$bootiso->getID()] = $prebootmapper->find($bootiso->getPrebootID())->getTitle();
- $bootiso->setGroupID("[".$bootiso->getGroupID()."] ".$groupmapper->find($bootiso->getGroupID())->getTitle());
- $bootiso->setMembershipID("[".$bootiso->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootiso->getMembershipID())->getPersonID())->getFirstname());
- }
-
- }
-
- public function downloadbootisoAction()
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender(true);
-
- $prebootID = $this->_request->getParam('prebootID');
- $bootisoID = $this->_request->getParam('bootisoID');
-
- if(is_dir("../resources/bootmedium/$prebootID/") && is_numeric($prebootID) && is_numeric($bootisoID)){
-
- chdir("../resources/bootmedium/$prebootID/");
-
- header("X-Sendfile: $bootisoID".".zip");
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="preboot.zip"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
-
- $handle = fopen($bootisoID.".zip", 'r');
- $chunk_size = 8192;
- while ($chunk = fread($handle, $chunk_size)) {
- echo $chunk;
- ob_flush();
- }
-
- }
-
-
-
-
+ }
+
+ public function downloadbootisoAction() {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender(true);
+
+ $prebootID = $this->_request->getParam('prebootID');
+ $bootisoID = $this->_request->getParam('bootisoID');
+
+ if(is_dir("../resources/bootmedium/$prebootID/") && is_numeric($prebootID) && is_numeric($bootisoID)) {
+
+ chdir("../resources/bootmedium/$prebootID/");
+
+ header("X-Sendfile: $bootisoID".".zip");
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="preboot.zip"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+
+ $handle = fopen($bootisoID.".zip", 'r');
+ $chunk_size = 8192;
+ while ($chunk = fread($handle, $chunk_size)) {
+ echo $chunk;
+ ob_flush();
+ }
+
}
- public function createbootisoAction()
- {
- $groupmapper = new Application_Model_GroupMapper();
- $prebootmapper = new Application_Model_PreBootMapper();
-
- if (!isset($_POST["createbootiso"])){
- $createbootisoForm = new dev_Form_BootisoCreate(array('grouplist' => $groupmapper->fetchAll(),'prebootlist' => $prebootmapper->fetchAll()));
- } else {
-
- $createbootisoForm = new dev_Form_BootisoCreate(array('grouplist' => $groupmapper->fetchAll(),'prebootlist' => $prebootmapper->fetchAll()),$_POST);
-
- if ($createbootisoForm->isValid($_POST)) {
-
- $bootiso = new Application_Model_BootIso($_POST);
- $bootiso->setMembershipID('1');
- $bootisomapper = new Application_Model_BootIsoMapper();
- $bootiso->setCreated(time());
-
- $prebootID = $bootiso->getPrebootID();
-
- try {
-
- $bootisoID = $bootisomapper->save($bootiso);
-
- copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
- $zip = new ZipArchive();
- $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
- if($res === true){
- $rootdir = $zip->getNameIndex(0);
- $zip->addFromString($rootdir."build/rootfs/tmp/serial", $bootiso->getSerialnumber());
- $zip->close();
- }
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
-
- }
- $this->_redirect('/dev/bootiso');
- }
- }
-
- $this->view->createbootisoForm = $createbootisoForm;
+
+
+
+ }
+
+ public function createbootisoAction() {
+ $groupmapper = new Application_Model_GroupMapper();
+ $prebootmapper = new Application_Model_PreBootMapper();
+
+ if (!isset($_POST["createbootiso"])) {
+ $createbootisoForm = new dev_Form_BootisoCreate(array('grouplist' => $groupmapper->fetchAll(), 'prebootlist' => $prebootmapper->fetchAll()));
+ } else {
+
+ $createbootisoForm = new dev_Form_BootisoCreate(array('grouplist' => $groupmapper->fetchAll(), 'prebootlist' => $prebootmapper->fetchAll()), $_POST);
+
+ if ($createbootisoForm->isValid($_POST)) {
+
+ $bootiso = new Application_Model_BootIso($_POST);
+ $bootiso->setMembershipID('1');
+ $bootisomapper = new Application_Model_BootIsoMapper();
+ $bootiso->setCreated(time());
+
+ $prebootID = $bootiso->getPrebootID();
+
+ try {
+
+ $bootisoID = $bootisomapper->save($bootiso);
+
+ copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res == = true) {
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/tmp/serial", $bootiso->getSerialnumber());
+ $zip->close();
+ }
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+
+ }
+ $this->_redirect('/dev/bootiso');
+ }
}
- public function editbootisoAction()
- {
- $bootisoID = $this->_request->getParam('bootisoID');
- $groupmapper = new Application_Model_GroupMapper();
- $prebootmapper = new Application_Model_PreBootMapper();
-
-
- if (!isset($_POST["editbootiso"])){
- $bootisoID = $this->_request->getParam('bootisoID');
- if (!isset($bootisoID) || !is_numeric($bootisoID)){
- $this->_redirect('/dev/bootiso');
- } else {
- $bootiso = new Application_Model_BootIso();
- $bootisomapper = new Application_Model_BootIsoMapper();
- $bootisomapper->find($bootisoID, $bootiso);
-
- $editbootisoForm = new dev_Form_BootisoEdit(array('grouplist' => $groupmapper->fetchAll(),'prebootlist' => $prebootmapper->fetchAll()));
- $editbootisoForm->populate($bootiso->toArray());
- }
- }else{
- $editbootisoForm = new dev_Form_BootisoEdit(array('grouplist' => $groupmapper->fetchAll(),'prebootlist' => $prebootmapper->fetchAll()),$_POST);
-
- if ($editbootisoForm->isValid($_POST)) {
-
- $bootiso = new Application_Model_BootIso($_POST);
- $bootiso->setMembershipID('1');
- $bootisomapper = new Application_Model_BootIsoMapper();
- $bootiso->setCreated(time());
- $bootiso->setID($bootisoID);
- $prebootID = $bootiso->getPrebootID();
-
- try {
-
-
- $zip = new ZipArchive();
- $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
- if($res === true){
- $rootdir = $zip->getNameIndex(0);
- $zip->addFromString($rootdir."build/rootfs/serial", $bootiso->getSerialnumber());
- $zip->close();
- }
-
- $bootisomapper->save($bootiso);
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- }
-
- $this->_redirect('/dev/bootiso');
- }
-
- }
-
- $this->view->editbootisoForm = $editbootisoForm;
+ $this->view->createbootisoForm = $createbootisoForm;
+ }
+
+ public function editbootisoAction() {
+ $bootisoID = $this->_request->getParam('bootisoID');
+ $groupmapper = new Application_Model_GroupMapper();
+ $prebootmapper = new Application_Model_PreBootMapper();
+
+
+ if (!isset($_POST["editbootiso"])) {
+ $bootisoID = $this->_request->getParam('bootisoID');
+ if (!isset($bootisoID) || !is_numeric($bootisoID)) {
+ $this->_redirect('/dev/bootiso');
+ } else {
+ $bootiso = new Application_Model_BootIso();
+ $bootisomapper = new Application_Model_BootIsoMapper();
+ $bootisomapper->find($bootisoID, $bootiso);
+
+ $editbootisoForm = new dev_Form_BootisoEdit(array('grouplist' => $groupmapper->fetchAll(), 'prebootlist' => $prebootmapper->fetchAll()));
+ $editbootisoForm->populate($bootiso->toArray());
+ }
+ } else {
+ $editbootisoForm = new dev_Form_BootisoEdit(array('grouplist' => $groupmapper->fetchAll(), 'prebootlist' => $prebootmapper->fetchAll()), $_POST);
+
+ if ($editbootisoForm->isValid($_POST)) {
+
+ $bootiso = new Application_Model_BootIso($_POST);
+ $bootiso->setMembershipID('1');
+ $bootisomapper = new Application_Model_BootIsoMapper();
+ $bootiso->setCreated(time());
+ $bootiso->setID($bootisoID);
+ $prebootID = $bootiso->getPrebootID();
+
+ try {
+
+
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res == = true) {
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/serial", $bootiso->getSerialnumber());
+ $zip->close();
+ }
+
+ $bootisomapper->save($bootiso);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ }
+
+ $this->_redirect('/dev/bootiso');
+ }
+
}
- public function deletebootisoAction()
- {
- $bootisoID = $this->_request->getParam('bootisoID');
- if (!isset($bootisoID)){
- $this->_redirect('/dev/bootiso');
- } else {
- $bootiso = new Application_Model_BootIso();
- $bootiso->setID($bootisoID);
- $bootisomapper = new Application_Model_BootIsoMapper();
- $bootisomapper->delete($bootiso);
- }
- $this->_redirect('/dev/bootiso');
+ $this->view->editbootisoForm = $editbootisoForm;
+ }
+
+ public function deletebootisoAction() {
+ $bootisoID = $this->_request->getParam('bootisoID');
+ if (!isset($bootisoID)) {
+ $this->_redirect('/dev/bootiso');
+ } else {
+ $bootiso = new Application_Model_BootIso();
+ $bootiso->setID($bootisoID);
+ $bootisomapper = new Application_Model_BootIsoMapper();
+ $bootisomapper->delete($bootiso);
}
+ $this->_redirect('/dev/bootiso');
+ }
}
diff --git a/application/modules/dev/controllers/BootmenuController.php b/application/modules/dev/controllers/BootmenuController.php
index cada566..d05f42c 100644
--- a/application/modules/dev/controllers/BootmenuController.php
+++ b/application/modules/dev/controllers/BootmenuController.php
@@ -1,330 +1,313 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_BootmenuController extends Zend_Controller_Action
-{
-
- public function init()
- {
- $db = Zend_Db_Table::getDefaultAdapter();
- }
-
- public function indexAction()
- {
- $bootmenumapper = new Application_Model_BootMenuMapper();
- $bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper();
- $bootosmapper = new Application_Model_BootOsMapper();
- $configmapper = new Application_Model_ConfigMapper();
- $membershipmapper = new Application_Model_MembershipMapper();
- $groupmapper = new Application_Model_GroupMapper();
- $personmapper = new Application_Model_PersonMapper();
-
- $this->view->bootosmapper = $bootosmapper;
- $this->view->configmapper = $configmapper;
-
- $bootmenuID = $this->_request->getParam('bootmenuid');
- $preboot = $this->_request->getParam('preboot');
-
- if($preboot=="")
- {
- if($bootmenuID == "")
- {
- $this->view->bootmenulist = $bootmenumapper->fetchAll();
- $bootmenuentries = array();
- foreach ($this->view->bootmenulist as $bootmenu){
- $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy(array('bootmenuID' => $bootmenu->getID()));
- $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle());
- $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname());
- }
- }else{
- $bootmenu = new Application_Model_BootMenu();
- $bootmenumapper->find($bootmenuID, $bootmenu);
-
- $bootmenuentries = array();
- $bootmenuentries[$bootmenuID] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenuID);
- $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle());
- $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname());
-
- $this->view->bootmenulist = array($bootmenu);
-
- }
-
- $this->view->bootmenuentrylist = $bootmenuentries;
-
- }else{
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- if($bootmenuID == "")
- {
- $this->view->bootmenulist = $bootmenumapper->fetchAll();
- $bootmenuentries = array();
- foreach ($this->view->bootmenulist as $bootmenu){
- $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenu->getID());
- $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle());
- $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname());
- }
- }else{
- $bootmenu = new Application_Model_BootMenu();
- $bootmenumapper->find($bootmenuID, $bootmenu);
-
- $cc['title'] = $bootmenu->getTitle();
-
- $bootmenuentries = array();
- $bootmenuentries = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenuID);
-
- foreach($bootmenuentries as $bootmenuentry){
- $ar = array();
- $ar['title'] = $bootmenuentry->getTitle();
- $ar['id'] = $bootmenuentry->getID();
- $cc['data'][] = $ar;
- }
-
- echo json_encode($cc);
-
- //print_a($cc);
-
- }
-
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_BootmenuController extends Zend_Controller_Action {
+
+ public function init() {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ }
+
+ public function indexAction() {
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+ $bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper();
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $configmapper = new Application_Model_ConfigMapper();
+ $membershipmapper = new Application_Model_MembershipMapper();
+ $groupmapper = new Application_Model_GroupMapper();
+ $personmapper = new Application_Model_PersonMapper();
+
+ $this->view->bootosmapper = $bootosmapper;
+ $this->view->configmapper = $configmapper;
+
+ $bootmenuID = $this->_request->getParam('bootmenuid');
+ $preboot = $this->_request->getParam('preboot');
+
+ if($preboot == "") {
+ if($bootmenuID == "") {
+ $this->view->bootmenulist = $bootmenumapper->fetchAll();
+ $bootmenuentries = array();
+ foreach ($this->view->bootmenulist as $bootmenu) {
+ $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy(array('bootmenuID' => $bootmenu->getID()));
+ $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle());
+ $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname());
+ }
+ } else {
+ $bootmenu = new Application_Model_BootMenu();
+ $bootmenumapper->find($bootmenuID, $bootmenu);
+
+ $bootmenuentries = array();
+ $bootmenuentries[$bootmenuID] = $bootmenuentriesmapper->findBy('bootmenuID', $bootmenuID);
+ $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle());
+ $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname());
+
+ $this->view->bootmenulist = array($bootmenu);
+
+ }
+
+ $this->view->bootmenuentrylist = $bootmenuentries;
+
+ } else {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ if($bootmenuID == "") {
+ $this->view->bootmenulist = $bootmenumapper->fetchAll();
+ $bootmenuentries = array();
+ foreach ($this->view->bootmenulist as $bootmenu) {
+ $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy('bootmenuID', $bootmenu->getID());
+ $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle());
+ $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname());
+ }
+ } else {
+ $bootmenu = new Application_Model_BootMenu();
+ $bootmenumapper->find($bootmenuID, $bootmenu);
+
+ $cc['title'] = $bootmenu->getTitle();
+
+ $bootmenuentries = array();
+ $bootmenuentries = $bootmenuentriesmapper->findBy('bootmenuID', $bootmenuID);
+
+ foreach($bootmenuentries as $bootmenuentry) {
+ $ar = array();
+ $ar['title'] = $bootmenuentry->getTitle();
+ $ar['id'] = $bootmenuentry->getID();
+ $cc['data'][] = $ar;
+ }
+
+ echo json_encode($cc);
+
+ //print_a($cc);
+
+ }
+
+ }
+ }
+
+ public function addbootmenuentryAction() {
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $configmapper = new Application_Model_ConfigMapper();
+
+ if (!isset($_POST["addbootmenuentry"])) {
+ $addbootmenuentryForm = new dev_Form_BootmenuEntriesAdd(array('bootoslist' => $bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist' => $configmapper->fetchAll()));
+ $addbootmenuentryForm->populate(array('order' => $this->_request->getParam('maxorder')));
+ unset($_POST['kcl']);
+ unset($_POST['configID']);
+ $addbootmenuentryForm->populate($_POST);
+ } else {
+
+ $addbootmenuentryForm = new dev_Form_BootmenuEntriesAdd(array('bootoslist' => $bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist' => $configmapper->fetchAll()), $_POST);
+
+ if ($addbootmenuentryForm->isValid($_POST)) {
+
+ $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
+ $bootmenuentry->setBootmenuID($bootmenuID);
+
+ $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
+
+ try {
+ if($bootmenuentry->getOrder() < $this->_request->getParam('maxorder')) {
+ $bootmenuentry->setOrder($bootmenuentry->getOrder());
+ $bootmenuentrymapper->order($bootmenuentry);
+ }
+
+ //print_a($bootmenuentry);
+
+ $bootmenuentrymapper->save($bootmenuentry);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+
+ }
+ $this->_redirect('/dev/bootmenu');
+ }
}
- public function addbootmenuentryAction()
- {
- $bootmenuID = $this->_request->getParam('bootmenuID');
- $bootosmapper = new Application_Model_BootOsMapper();
- $configmapper = new Application_Model_ConfigMapper();
-
- if (!isset($_POST["addbootmenuentry"])){
- $addbootmenuentryForm = new dev_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll()));
- $addbootmenuentryForm->populate(array('order' => $this->_request->getParam('maxorder')));
- unset($_POST['kcl']);
- unset($_POST['configID']);
- $addbootmenuentryForm->populate($_POST);
- } else {
-
- $addbootmenuentryForm = new dev_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll()),$_POST);
-
- if ($addbootmenuentryForm->isValid($_POST)) {
-
- $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
- $bootmenuentry->setBootmenuID($bootmenuID);
-
- $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
-
- try {
- if($bootmenuentry->getOrder() < $this->_request->getParam('maxorder')){
- $bootmenuentry->setOrder($bootmenuentry->getOrder());
- $bootmenuentrymapper->order($bootmenuentry);
- }
-
- //print_a($bootmenuentry);
-
- $bootmenuentrymapper->save($bootmenuentry);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
-
- }
- $this->_redirect('/dev/bootmenu');
- }
- }
-
- $this->view->addbootmenuentryForm = $addbootmenuentryForm;
-
+ $this->view->addbootmenuentryForm = $addbootmenuentryForm;
+
+ }
+
+ public function createbootmenuAction() {
+ $groupmapper = new Application_Model_GroupMapper();
+
+ if (!isset($_POST["createbootmenu"])) {
+ $createbootmenuForm = new dev_Form_BootmenuCreate(array('grouplist' => $groupmapper->fetchAll()));
+ } else {
+
+ $createbootmenuForm = new dev_Form_BootmenuCreate(array('grouplist' => $groupmapper->fetchAll()), $_POST);
+
+ if ($createbootmenuForm->isValid($_POST)) {
+
+ $bootmenu = new Application_Model_BootMenu($_POST);
+ $bootmenu->setMembershipID('1');
+ $bootmenu->setCreated(time());
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+
+ try {
+ $bootmenumapper->save($bootmenu);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+
+ }
+ $this->_redirect('/dev/bootmenu');
+ }
}
- public function createbootmenuAction()
- {
- $groupmapper = new Application_Model_GroupMapper();
-
- if (!isset($_POST["createbootmenu"])){
- $createbootmenuForm = new dev_Form_BootmenuCreate(array('grouplist' => $groupmapper->fetchAll()));
- } else {
-
- $createbootmenuForm = new dev_Form_BootmenuCreate(array('grouplist' => $groupmapper->fetchAll()),$_POST);
-
- if ($createbootmenuForm->isValid($_POST)) {
-
- $bootmenu = new Application_Model_BootMenu($_POST);
- $bootmenu->setMembershipID('1');
- $bootmenu->setCreated(time());
- $bootmenumapper = new Application_Model_BootMenuMapper();
-
- try {
- $bootmenumapper->save($bootmenu);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
-
- }
- $this->_redirect('/dev/bootmenu');
- }
- }
-
- $this->view->createbootmenuForm = $createbootmenuForm;
+ $this->view->createbootmenuForm = $createbootmenuForm;
+ }
+
+ public function editbootmenuAction() {
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ $groupmapper = new Application_Model_GroupMapper();
+
+ if (!isset($_POST["editbootmenu"])) {
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!isset($bootmenuID) || !is_numeric($bootmenuID)) {
+ $this->_redirect('/bootmenu');
+ } else {
+ $bootmenu = new Application_Model_BootMenu();
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+ $bootmenumapper->find($bootmenuID, $bootmenu);
+
+ $editbootmenuForm = new dev_Form_BootmenuEdit(array('grouplist' => $groupmapper->fetchAll()));
+ $editbootmenuForm->populate($bootmenu->toArray());
+ }
+ } else {
+ $editbootmenuForm = new dev_Form_BootmenuEdit(array('grouplist' => $groupmapper->fetchAll()), $_POST);
+
+ if ($editbootmenuForm->isValid($_POST)) {
+
+ $bootmenu = new Application_Model_BootMenu($_POST);
+ $bootmenu->setMembershipID('1');
+ $bootmenu->setCreated(time());
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+
+ $bootmenu->setID($bootmenuID);
+
+ try {
+
+ $bootmenumapper->save($bootmenu);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ }
+
+ $this->_redirect('/dev/bootmenu');
+ }
+
}
- public function editbootmenuAction()
- {
- $bootmenuID = $this->_request->getParam('bootmenuID');
- $groupmapper = new Application_Model_GroupMapper();
-
- if (!isset($_POST["editbootmenu"])){
- $bootmenuID = $this->_request->getParam('bootmenuID');
- if (!isset($bootmenuID) || !is_numeric($bootmenuID)){
- $this->_redirect('/bootmenu');
- } else {
- $bootmenu = new Application_Model_BootMenu();
- $bootmenumapper = new Application_Model_BootMenuMapper();
- $bootmenumapper->find($bootmenuID, $bootmenu);
-
- $editbootmenuForm = new dev_Form_BootmenuEdit(array('grouplist' => $groupmapper->fetchAll()));
- $editbootmenuForm->populate($bootmenu->toArray());
- }
- }else{
- $editbootmenuForm = new dev_Form_BootmenuEdit(array('grouplist' => $groupmapper->fetchAll()),$_POST);
-
- if ($editbootmenuForm->isValid($_POST)) {
-
- $bootmenu = new Application_Model_BootMenu($_POST);
- $bootmenu->setMembershipID('1');
- $bootmenu->setCreated(time());
- $bootmenumapper = new Application_Model_BootMenuMapper();
-
- $bootmenu->setID($bootmenuID);
-
- try {
-
- $bootmenumapper->save($bootmenu);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- }
-
- $this->_redirect('/dev/bootmenu');
- }
-
- }
-
- $this->view->editbootmenuForm = $editbootmenuForm;
+ $this->view->editbootmenuForm = $editbootmenuForm;
+ }
+
+ public function editbootmenuentryAction() {
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $configmapper = new Application_Model_ConfigMapper();
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
+
+ if (!isset($_POST["editbootmenuentry"])) {
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ if (!isset($bootmenuentryID) || !is_numeric($bootmenuentryID)) {
+ $this->_redirect('/dev/bootmenu');
+ } else {
+
+ $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry);
+
+ $editbootmenuentryForm = new dev_Form_BootmenuEntriesEdit(array('bootoslist' => $bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist' => $configmapper->fetchAll(), 'kcl' => $bootmenuentry->getKcl()));
+
+ if(!isset($_POST['configID'])) {
+ $editbootmenuentryForm->populate($bootmenuentry->toArray());
+ } else {
+ unset($_POST['kcl']);
+ unset($_POST['configID']);
+ $editbootmenuentryForm->populate($_POST);
+ }
+ }
+ } else {
+ $editbootmenuentryForm = new dev_Form_BootmenuEntriesEdit(array('bootoslist' => $bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist' => $configmapper->fetchAll(), 'kcl' => $bootmenuentry->getKcl()), $_POST);
+
+ if ($editbootmenuentryForm->isValid($_POST)) {
+
+ $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
+
+ $bootmenuentry->setBootmenuID($bootmenuID);
+ $bootmenuentry->setID($bootmenuentryID);
+
+ $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
+
+ try {
+ if($bootmenuentry->getOrder() < $this->_request->getParam('oldorder'))
+ { $bootmenuentrymapper->orderbefore($bootmenuentry, $this->_request->getParam('oldorder')); }
+ else
+ { $bootmenuentrymapper->orderafter($bootmenuentry, $this->_request->getParam('oldorder')); }
+
+ $bootmenuentrymapper->save($bootmenuentry);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ }
+
+ $this->_redirect('/dev/bootmenu');
+ }
+
}
- public function editbootmenuentryAction()
- {
- $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
- $bootmenuID = $this->_request->getParam('bootmenuID');
- $bootosmapper = new Application_Model_BootOsMapper();
- $configmapper = new Application_Model_ConfigMapper();
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
-
- if (!isset($_POST["editbootmenuentry"])){
- $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
- if (!isset($bootmenuentryID) || !is_numeric($bootmenuentryID)){
- $this->_redirect('/dev/bootmenu');
- } else {
-
- $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry);
-
- $editbootmenuentryForm = new dev_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll(), 'kcl' => $bootmenuentry->getKcl()));
-
- if(!isset($_POST['configID'])){
- $editbootmenuentryForm->populate($bootmenuentry->toArray());
- }
- else{
- unset($_POST['kcl']);
- unset($_POST['configID']);
- $editbootmenuentryForm->populate($_POST);
- }
- }
- }else{
- $editbootmenuentryForm = new dev_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll(), 'kcl' => $bootmenuentry->getKcl()),$_POST);
-
- if ($editbootmenuentryForm->isValid($_POST)) {
-
- $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
-
- $bootmenuentry->setBootmenuID($bootmenuID);
- $bootmenuentry->setID($bootmenuentryID);
-
- $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
-
- try {
- if($bootmenuentry->getOrder() < $this->_request->getParam('oldorder'))
- $bootmenuentrymapper->orderbefore($bootmenuentry, $this->_request->getParam('oldorder'));
- else
- $bootmenuentrymapper->orderafter($bootmenuentry, $this->_request->getParam('oldorder'));
-
- $bootmenuentrymapper->save($bootmenuentry);
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- }
-
- $this->_redirect('/dev/bootmenu');
- }
-
- }
-
- $this->view->editbootmenuentryForm = $editbootmenuentryForm;
-
+ $this->view->editbootmenuentryForm = $editbootmenuentryForm;
+
+ }
+
+ public function removebootmenuentryAction() {
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ if (!isset($bootmenuentryID) || !is_numeric($bootmenuentryID)) {
+ $this->_redirect('/bootmenu');
+ } else {
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
+ $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry);
+ $bootmenuentrymapper->delete($bootmenuentry);
+ $bootmenuentrymapper->orderremove($bootmenuentry);
}
+ $this->_redirect('/dev/bootmenu');
+ }
- public function removebootmenuentryAction()
- {
- $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
- if (!isset($bootmenuentryID) || !is_numeric($bootmenuentryID)){
- $this->_redirect('/bootmenu');
- } else {
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenuentrymapper = new Application_Model_BootMenuEntriesMapper();
- $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry);
- $bootmenuentrymapper->delete($bootmenuentry);
- $bootmenuentrymapper->orderremove($bootmenuentry);
- }
- $this->_redirect('/dev/bootmenu');
+ public function deletebootmenuAction() {
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!isset($bootmenuID) || !is_numeric($bootmenuID)) {
+ $this->_redirect('/dev/bootmenu');
+ } else {
+ $bootmenu = new Application_Model_BootMenu();
+ $bootmenu->setID($bootmenuID);
+ $bootmenumapper = new Application_Model_BootMenuMapper();
+ $bootmenumapper->delete($bootmenu);
}
+ $this->_redirect('/dev/bootmenu');
+ }
- public function deletebootmenuAction()
- {
- $bootmenuID = $this->_request->getParam('bootmenuID');
- if (!isset($bootmenuID) || !is_numeric($bootmenuID)){
- $this->_redirect('/dev/bootmenu');
- } else {
- $bootmenu = new Application_Model_BootMenu();
- $bootmenu->setID($bootmenuID);
- $bootmenumapper = new Application_Model_BootMenuMapper();
- $bootmenumapper->delete($bootmenu);
- }
- $this->_redirect('/dev/bootmenu');
+ private function arrayDiff($a, $b) {
+ foreach($a as $k1 => $i1) {
+ foreach($b as $k2 => $i2) {
+ if($i1->getID() == $i2->getBootosID()) {
+ unset($a[$k1]);
+ }
+ }
}
+ return $a;
+ }
- private function arrayDiff($a, $b){
- foreach($a as $k1 => $i1){
- foreach($b as $k2 => $i2){
- if($i1->getID() == $i2->getBootosID()){
- unset($a[$k1]);
- }
- }
- }
- return $a;
- }
-
}
diff --git a/application/modules/dev/controllers/BootosController.php b/application/modules/dev/controllers/BootosController.php
index 55537a9..dfe2765 100644
--- a/application/modules/dev/controllers/BootosController.php
+++ b/application/modules/dev/controllers/BootosController.php
@@ -1,218 +1,208 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_BootosController extends Zend_Controller_Action
-{
-
- public function init()
- {
- $db = Zend_Db_Table::getDefaultAdapter();
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_BootosController extends Zend_Controller_Action {
+
+ public function init() {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ }
+
+ public function indexAction() {
+
+ $bootosmapper = new Application_Model_BootOsMapper();
+
+ $groupmapper = new Application_Model_GroupMapper();
+ $membershipmapper = new Application_Model_MembershipMapper();
+ $personmapper = new Application_Model_PersonMapper();
+ $configmapper = new Application_Model_ConfigMapper();
+
+ $this->view->bootoslist = $bootosmapper->fetchAll();
+ $this->view->update = array();
- public function indexAction()
- {
-
- $bootosmapper = new Application_Model_BootOsMapper();
-
- $groupmapper = new Application_Model_GroupMapper();
- $membershipmapper = new Application_Model_MembershipMapper();
- $personmapper = new Application_Model_PersonMapper();
- $configmapper = new Application_Model_ConfigMapper();
-
- $this->view->bootoslist = $bootosmapper->fetchAll();
- $this->view->update = array();
-
- if(count($this->view->bootoslist)>0){
- foreach ($this->view->bootoslist as $bootos){
- $this->view->update[$bootos->getID()] = $this->checkupdateAction($bootos);
- $bootos->setGroupID("[".$bootos->getGroupID()."] ".$groupmapper->find($bootos->getGroupID())->getTitle());
- $bootos->setMembershipID("[".$bootos->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootos->getMembershipID())->getPersonID())->getFirstname());
- $bootos->setConfigID("[".$bootos->getConfigID()."] ".$configmapper->find($bootos->getConfigID())->getTitle());
-
- }
- }
-
+ if(count($this->view->bootoslist) > 0) {
+ foreach ($this->view->bootoslist as $bootos) {
+ $this->view->update[$bootos->getID()] = $this->checkupdateAction($bootos);
+ $bootos->setGroupID("[".$bootos->getGroupID()."] ".$groupmapper->find($bootos->getGroupID())->getTitle());
+ $bootos->setMembershipID("[".$bootos->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootos->getMembershipID())->getPersonID())->getFirstname());
+ $bootos->setConfigID("[".$bootos->getConfigID()."] ".$configmapper->find($bootos->getConfigID())->getTitle());
+
+ }
}
- public function createbootosAction()
- {
- $groupmapper = new Application_Model_GroupMapper();
- $configmapper = new Application_Model_ConfigMapper();
-
- if (!isset($_POST["createbootos"])){
- try{
- $createbootosForm = new dev_Form_BootosCreate(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll()));
- }catch(Zend_Exception $e){
- print_a($e);
- }
- } else {
-
- $createbootosForm = new dev_Form_BootosCreate(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll()),$_POST);
-
- if ($createbootosForm->isValid($_POST)) {
-
- $bootos = new Application_Model_BootOs($_POST);
-
- $bootos->setMembershipID('1');
- if($bootos->getConfigID() == '')
- $bootos->setConfigID(NULL);
- $bootosmapper = new Application_Model_BootOsMapper();
- $bootos->setCreated(time());
-
- try {
- exec("wget --spider ".$bootos->getPath_kernel()." 2>&1 | grep 'Remote file exists.'", $exists_kernel);
- exec("wget --spider ".$bootos->getPath_init()." 2>&1 | grep 'Remote file exists.'" , $exists_init);
-
- if(!array_pop($exists_init) || !array_pop($exists_kernel)){
- $this->view->createbootosForm = $createbootosForm;
- return;
- }
-
- $bootosID = $bootosmapper->save($bootos);
-
- $initpath = "../resources/bootos/".$bootosID."/initramfs/";
- $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
-
- mkdir($initpath ,0777, true);
- mkdir($kernelpath ,0777, true);
-
- exec("wget -O '".$kernelpath."kernel' ".$bootos->getPath_kernel());
- exec("wget -O '".$initpath."initramfs' ".$bootos->getPath_init());
-
-
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
-
- }
-
- $this->_redirect('/dev/bootos');
- }
- }
-
+ }
+
+ public function createbootosAction() {
+ $groupmapper = new Application_Model_GroupMapper();
+ $configmapper = new Application_Model_ConfigMapper();
+
+ if (!isset($_POST["createbootos"])) {
+ try {
+ $createbootosForm = new dev_Form_BootosCreate(array('grouplist' => $groupmapper->fetchAll() , 'configlist' => $configmapper->fetchAll()));
+ } catch(Zend_Exception $e) {
+ print_a($e);
+ }
+ } else {
+
+ $createbootosForm = new dev_Form_BootosCreate(array('grouplist' => $groupmapper->fetchAll() , 'configlist' => $configmapper->fetchAll()), $_POST);
+
+ if ($createbootosForm->isValid($_POST)) {
+
+ $bootos = new Application_Model_BootOs($_POST);
+
+ $bootos->setMembershipID('1');
+ if($bootos->getConfigID() == '')
+ { $bootos->setConfigID(NULL); }
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $bootos->setCreated(time());
+
+ try {
+ exec("wget --spider ".$bootos->getPath_kernel()." 2>&1 | grep 'Remote file exists.'", $exists_kernel);
+ exec("wget --spider ".$bootos->getPath_init()." 2>&1 | grep 'Remote file exists.'" , $exists_init);
+
+ if(!array_pop($exists_init) || !array_pop($exists_kernel)) {
$this->view->createbootosForm = $createbootosForm;
+ return;
+ }
+
+ $bootosID = $bootosmapper->save($bootos);
+
+ $initpath = "../resources/bootos/".$bootosID."/initramfs/";
+ $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
+
+ mkdir($initpath , 0777, true);
+ mkdir($kernelpath , 0777, true);
+
+ exec("wget -O '".$kernelpath."kernel' ".$bootos->getPath_kernel());
+ exec("wget -O '".$initpath."initramfs' ".$bootos->getPath_init());
+
+
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+
+ }
+
+ $this->_redirect('/dev/bootos');
+ }
}
-
- public function checkupdateAction($bootos)
- {
- exec("wget --server-response --spider '".escapeshellcmd($bootos->getPath_kernel())."' 2>&1 | grep 'Last-Modified:'", $kerneldate);
- exec("wget --server-response --spider '".escapeshellcmd($bootos->getPath_init())."' 2>&1 | grep 'Last-Modified:'", $initdate);
-
- $kerneldate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($kerneldate))));
- $kernelname = array_pop(scandir("../resources/bootos/".$bootos->getID()."/kernel/"));
-
- if($kernelname != "." && $kernelname != "..")
- $kernelolddate = filemtime("../resources/bootos/".$bootos->getID()."/kernel/".$kernelname);
- else
- $kernelolddate = false;
-
- $initdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($initdate))));
- $initname = array_pop(scandir("../resources/bootos/".$bootos->getID()."/initramfs/"));
-
- if($initname != "." && $initname != "..")
- $initolddate = filemtime("../resources/bootos/".$bootos->getID()."/initramfs/".$initname);
- else
- $initolddate = false;
-
- //print_a($kernelname,$kerneldate,$kernelolddate,$initname,$initdate,$initolddate);
-
-
- if($kerneldate > $kernelolddate || $initdate > $initolddate)
- return true;
- else
- return false;
-
- }
-
- public function updatebootosAction()
- {
- $bootosID = $this->_request->getParam('bootosID');
- $bootosmapper = new Application_Model_BootOsMapper();
- $bootos = $bootosmapper->find($bootosID);
-
- $initpath = "../resources/bootos/".$bootosID."/initramfs/";
- $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
-
- exec("wget -P ".$kernelpath." -N ".$bootos->getPath_kernel());
- exec("wget -P ".$initpath." -N ".$bootos->getPath_init());
-
- $this->_redirect('/dev/bootos');
- }
- public function editbootosAction()
- {
- $bootosID = $this->_request->getParam('bootosID');
- $groupmapper = new Application_Model_GroupMapper();
- $configmapper = new Application_Model_ConfigMapper();
-
- if (!isset($_POST["editbootos"])){
- $bootosID = $this->_request->getParam('bootosID');
- if (!isset($bootosID) || !is_numeric($bootosID)){
- $this->_redirect('/dev/bootos');
- } else {
- $bootos = new Application_Model_BootOs();
- $bootosmapper = new Application_Model_BootOsMapper();
- $bootos = $bootosmapper->find($bootosID);
-
- $editbootosForm = new dev_Form_BootosEdit(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll()));
- $editbootosForm->populate($bootos->toArray());
- }
- }else{
- $editbootosForm = new dev_Form_BootosEdit(array('grouplist' => $groupmapper->fetchAll() ,'configlist'=>$configmapper->fetchAll()),$_POST);
-
- if ($editbootosForm->isValid($_POST)) {
-
- //TODO: Check for new URL and download new files.
- $bootos = new Application_Model_BootOs($_POST);
- $bootos->setMembershipID('1');
- if($bootos->getConfigID() == '')
- $bootos->setConfigID(NULL);
- $bootosmapper = new Application_Model_BootOsMapper();
- $bootos->setCreated(time());
- $bootos->setID($bootosID);
-
- try {
- $bootosmapper->save($bootos);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- }
-
- $this->_redirect('/dev/bootos');
- }
-
- }
-
- $this->view->editbootosForm = $editbootosForm;
-
+ $this->view->createbootosForm = $createbootosForm;
+ }
+
+ public function checkupdateAction($bootos) {
+ exec("wget --server-response --spider '".escapeshellcmd($bootos->getPath_kernel())."' 2>&1 | grep 'Last-Modified:'", $kerneldate);
+ exec("wget --server-response --spider '".escapeshellcmd($bootos->getPath_init())."' 2>&1 | grep 'Last-Modified:'", $initdate);
+
+ $kerneldate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($kerneldate))));
+ $kernelname = array_pop(scandir("../resources/bootos/".$bootos->getID()."/kernel/"));
+
+ if($kernelname != "." && $kernelname != "..")
+ { $kernelolddate = filemtime("../resources/bootos/".$bootos->getID()."/kernel/".$kernelname); }
+ else
+ { $kernelolddate = false; }
+
+ $initdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($initdate))));
+ $initname = array_pop(scandir("../resources/bootos/".$bootos->getID()."/initramfs/"));
+
+ if($initname != "." && $initname != "..")
+ { $initolddate = filemtime("../resources/bootos/".$bootos->getID()."/initramfs/".$initname); }
+ else
+ { $initolddate = false; }
+
+ //print_a($kernelname,$kerneldate,$kernelolddate,$initname,$initdate,$initolddate);
+
+
+ if($kerneldate > $kernelolddate || $initdate > $initolddate)
+ { return true; }
+ else
+ { return false; }
+
+ }
+
+ public function updatebootosAction() {
+ $bootosID = $this->_request->getParam('bootosID');
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $bootos = $bootosmapper->find($bootosID);
+
+ $initpath = "../resources/bootos/".$bootosID."/initramfs/";
+ $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
+
+ exec("wget -P ".$kernelpath." -N ".$bootos->getPath_kernel());
+ exec("wget -P ".$initpath." -N ".$bootos->getPath_init());
+
+ $this->_redirect('/dev/bootos');
+ }
+
+ public function editbootosAction() {
+ $bootosID = $this->_request->getParam('bootosID');
+ $groupmapper = new Application_Model_GroupMapper();
+ $configmapper = new Application_Model_ConfigMapper();
+
+ if (!isset($_POST["editbootos"])) {
+ $bootosID = $this->_request->getParam('bootosID');
+ if (!isset($bootosID) || !is_numeric($bootosID)) {
+ $this->_redirect('/dev/bootos');
+ } else {
+ $bootos = new Application_Model_BootOs();
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $bootos = $bootosmapper->find($bootosID);
+
+ $editbootosForm = new dev_Form_BootosEdit(array('grouplist' => $groupmapper->fetchAll() , 'configlist' => $configmapper->fetchAll()));
+ $editbootosForm->populate($bootos->toArray());
+ }
+ } else {
+ $editbootosForm = new dev_Form_BootosEdit(array('grouplist' => $groupmapper->fetchAll() , 'configlist' => $configmapper->fetchAll()), $_POST);
+
+ if ($editbootosForm->isValid($_POST)) {
+
+ //TODO: Check for new URL and download new files.
+ $bootos = new Application_Model_BootOs($_POST);
+ $bootos->setMembershipID('1');
+ if($bootos->getConfigID() == '')
+ { $bootos->setConfigID(NULL); }
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $bootos->setCreated(time());
+ $bootos->setID($bootosID);
+
+ try {
+ $bootosmapper->save($bootos);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ }
+
+ $this->_redirect('/dev/bootos');
+ }
+
}
- public function deletebootosAction()
- {
- $bootosID = $this->_request->getParam('bootosID');
- if (!isset($bootosID)){
- $this->_redirect('/dev/bootos');
- } else {
- $bootos = new Application_Model_BootOs();
- $bootos->setID($bootosID);
- $bootosmapper = new Application_Model_BootOsMapper();
- $bootosmapper->delete($bootos);
- }
- $this->_redirect('/dev/bootos');
-
+ $this->view->editbootosForm = $editbootosForm;
+
+ }
+
+ public function deletebootosAction() {
+ $bootosID = $this->_request->getParam('bootosID');
+ if (!isset($bootosID)) {
+ $this->_redirect('/dev/bootos');
+ } else {
+ $bootos = new Application_Model_BootOs();
+ $bootos->setID($bootosID);
+ $bootosmapper = new Application_Model_BootOsMapper();
+ $bootosmapper->delete($bootos);
}
+ $this->_redirect('/dev/bootos');
+
+ }
}
diff --git a/application/modules/dev/controllers/ClientController.php b/application/modules/dev/controllers/ClientController.php
index b6c202c..d70db4a 100644
--- a/application/modules/dev/controllers/ClientController.php
+++ b/application/modules/dev/controllers/ClientController.php
@@ -1,101 +1,93 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_ClientController extends Zend_Controller_Action
-{
-
- public function init()
- {
- /* Initialize action controller here */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_ClientController extends Zend_Controller_Action {
+
+ public function init() {
+ /* Initialize action controller here */
+ }
+
+ public function indexAction() {
+ $clientMapper = new Application_Model_ClientMapper();
+ $this->view->clients = $clientMapper->fetchAll();
+ }
+
+ public function addclientAction() {
+ $mac = $this->_request->getParam('mac');
+ $hh = $this->_request->getParam('hh');
+
+ $groupMapper = new Application_Model_GroupMapper();
+ $groups = $groupMapper->fetchAll();
+#print_a($groups);die();
+
+ if (!isset($_POST["add"])) {
+ $addclient = new dev_Form_Client(array('buttontext' => 'Create Client', 'groups' => $groups));
+ $this->view->addclient = $addclient;
+ } else {
+ $addfilterform = new dev_Form_Client(array('buttontext' => 'Create Client', 'groups' => $groups), $_POST);
+ if ($addfilterform->isValid($_POST) || ($mac != '' && $hh != '') ) {
+ $client = new Application_Model_Client($_POST);
+ $mac = ($mac != '') ? $mac : $_POST['macadress'];
+ $hh = ($hh != '') ? $hh : $_POST['hardwarehash'];
+ $client->setMacadress($mac);
+ $client->setHardwarehash($hh);
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->save($client);
+ print_a('inserted');
+ $this->_redirect('/dev/client');
+ }
+ $this->view->addclient = $addclient;
}
-
- public function indexAction()
- {
- $clientMapper = new Application_Model_ClientMapper();
- $this->view->clients = $clientMapper->fetchAll();
- }
-
- public function addclientAction()
- {
- $mac = $this->_request->getParam('mac');
- $hh = $this->_request->getParam('hh');
-
- $groupMapper = new Application_Model_GroupMapper();
- $groups = $groupMapper->fetchAll();
- #print_a($groups);die();
-
- if (!isset($_POST["add"])){
- $addclient = new dev_Form_Client(array('buttontext' => 'Create Client','groups'=>$groups));
- $this->view->addclient = $addclient;
- }
- else{
- $addfilterform = new dev_Form_Client(array('buttontext' => 'Create Client','groups'=>$groups),$_POST);
- if ($addfilterform->isValid($_POST) || ($mac != '' && $hh != '') ) {
- $client = new Application_Model_Client($_POST);
- $mac = ($mac!='')?$mac:$_POST['macadress'];
- $hh = ($hh!='')?$hh:$_POST['hardwarehash'];
- $client->setMacadress($mac);
- $client->setHardwarehash($hh);
- $clientmapper = new Application_Model_ClientMapper();
- $clientmapper->save($client);
- print_a('inserted');
- $this->_redirect('/dev/client');
- }
- $this->view->addclient = $addclient;
- }
+ }
+
+ public function removeclientAction() {
+ $clientID = $this->_request->getParam('clientID');
+ // TODO: ACL implementieren ob er den filter löschen darf
+ if(is_numeric($clientID)) {
+ $removeClient = new Application_Model_Client();
+ $removeClient->setID($clientID);
+ $clientMapper = new Application_Model_ClientMapper();
+ $clientMapper->delete($removeClient);
}
-
- public function removeclientAction()
- {
- $clientID = $this->_request->getParam('clientID');
- // TODO: ACL implementieren ob er den filter löschen darf
- if(is_numeric($clientID)){
- $removeClient = new Application_Model_Client();
- $removeClient->setID($clientID);
- $clientMapper = new Application_Model_ClientMapper();
- $clientMapper->delete($removeClient);
- }
- $this->_redirect('/dev/client');
- }
-
- public function editclientAction()
- {
- $groupMapper = new Application_Model_GroupMapper();
- $groups = $groupMapper->fetchAll();
- # print_a($this);die();
-
- if (!isset($_POST["add"])){
- $clientID = $this->_request->getParam('clientID');
- $data = new Application_Model_Client();
- $mapper = new Application_Model_ClientMapper();
- $mapper->find($clientID,$data);
-
- $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client', 'groups'=>$groups));
- $editclient->populate($data->toArray());
- $this->view->editclient = $editclient;
- }
- else{
- $editclient = new dev_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;
- }
+ $this->_redirect('/dev/client');
+ }
+
+ public function editclientAction() {
+ $groupMapper = new Application_Model_GroupMapper();
+ $groups = $groupMapper->fetchAll();
+# print_a($this);die();
+
+ if (!isset($_POST["add"])) {
+ $clientID = $this->_request->getParam('clientID');
+ $data = new Application_Model_Client();
+ $mapper = new Application_Model_ClientMapper();
+ $mapper->find($clientID, $data);
+
+ $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client', 'groups' => $groups));
+ $editclient->populate($data->toArray());
+ $this->view->editclient = $editclient;
+ } else {
+ $editclient = new dev_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/dev/controllers/ConfigController.php b/application/modules/dev/controllers/ConfigController.php
index d89b6e1..2b0b857 100644
--- a/application/modules/dev/controllers/ConfigController.php
+++ b/application/modules/dev/controllers/ConfigController.php
@@ -1,129 +1,121 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_ConfigController extends Zend_Controller_Action
-{
-
- public function init()
- {
- $db = Zend_Db_Table::getDefaultAdapter();
- }
-
- public function indexAction()
- {
- $configmapper = new Application_Model_ConfigMapper();
-
- $groupmapper = new Application_Model_GroupMapper();
- $membershipmapper = new Application_Model_MembershipMapper();
- $personmapper = new Application_Model_PersonMapper();
-
- $this->view->configlist = $configmapper->fetchAll();
-
- foreach ($this->view->configlist as $config){
- $config->setGroupID("[".$config->getGroupID()."] ".$groupmapper->find($config->getGroupID())->getTitle());
- $config->setMembershipID("[".$config->getMembershipID()."] ".$personmapper->find($membershipmapper->find($config->getMembershipID())->getPersonID())->getFirstname());
- }
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_ConfigController extends Zend_Controller_Action {
+
+ public function init() {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ }
+
+ public function indexAction() {
+ $configmapper = new Application_Model_ConfigMapper();
+
+ $groupmapper = new Application_Model_GroupMapper();
+ $membershipmapper = new Application_Model_MembershipMapper();
+ $personmapper = new Application_Model_PersonMapper();
+
+ $this->view->configlist = $configmapper->fetchAll();
+
+ foreach ($this->view->configlist as $config) {
+ $config->setGroupID("[".$config->getGroupID()."] ".$groupmapper->find($config->getGroupID())->getTitle());
+ $config->setMembershipID("[".$config->getMembershipID()."] ".$personmapper->find($membershipmapper->find($config->getMembershipID())->getPersonID())->getFirstname());
}
- public function createconfigAction()
- {
- $groupmapper = new Application_Model_GroupMapper();
- if (!isset($_POST["createconfig"])){
- $createconfigForm = new dev_Form_ConfigCreate(array('grouplist' => $groupmapper->fetchAll()));
- } else {
-
- $createconfigForm = new dev_Form_ConfigCreate(array('grouplist' => $groupmapper->fetchAll()),$_POST);
-
- if ($createconfigForm->isValid($_POST)) {
-
- $config = new Application_Model_Config($_POST);
- $config->setCreated(time());
- $config->setMembershipID('1');
-
- $configmapper = new Application_Model_ConfigMapper();
-
- try {
- $configmapper->save($config);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
-
- }
- $this->_redirect('/dev/config');
- }
- }
-
- $this->view->createconfigForm = $createconfigForm;
+ }
+
+ public function createconfigAction() {
+ $groupmapper = new Application_Model_GroupMapper();
+ if (!isset($_POST["createconfig"])) {
+ $createconfigForm = new dev_Form_ConfigCreate(array('grouplist' => $groupmapper->fetchAll()));
+ } else {
+
+ $createconfigForm = new dev_Form_ConfigCreate(array('grouplist' => $groupmapper->fetchAll()), $_POST);
+
+ if ($createconfigForm->isValid($_POST)) {
+
+ $config = new Application_Model_Config($_POST);
+ $config->setCreated(time());
+ $config->setMembershipID('1');
+
+ $configmapper = new Application_Model_ConfigMapper();
+
+ try {
+ $configmapper->save($config);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+
+ }
+ $this->_redirect('/dev/config');
+ }
}
- public function editconfigAction()
- {
- $configID = $this->_request->getParam('configID');
- $groupmapper = new Application_Model_GroupMapper();
-
- if (!isset($_POST["editconfig"])){
- $configID = $this->_request->getParam('configID');
- if (!isset($configID) || !is_numeric($configID)){
- $this->_redirect('/dev/config');
- } else {
- $config = new Application_Model_Config();
- $configmapper = new Application_Model_ConfigMapper();
- $config = $configmapper->find($configID);
-
- $editconfigForm = new dev_Form_ConfigEdit(array('grouplist' => $groupmapper->fetchAll()));
- $editconfigForm->populate($config->toArray());
- }
- }else{
- $editconfigForm = new dev_Form_ConfigEdit(array('grouplist' => $groupmapper->fetchAll()),$_POST);
-
- if ($editconfigForm->isValid($_POST)) {
-
- $config = new Application_Model_Config($_POST);
- $configmapper = new Application_Model_ConfigMapper();
- $config->setCreated(time());
- $config->setMembershipID('1');
- $config->setID($configID);
-
- try {
- $configmapper->save($config);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- }
-
- $this->_redirect('/dev/config');
- }
-
- }
-
- $this->view->editconfigForm = $editconfigForm;
+ $this->view->createconfigForm = $createconfigForm;
+ }
+
+ public function editconfigAction() {
+ $configID = $this->_request->getParam('configID');
+ $groupmapper = new Application_Model_GroupMapper();
+
+ if (!isset($_POST["editconfig"])) {
+ $configID = $this->_request->getParam('configID');
+ if (!isset($configID) || !is_numeric($configID)) {
+ $this->_redirect('/dev/config');
+ } else {
+ $config = new Application_Model_Config();
+ $configmapper = new Application_Model_ConfigMapper();
+ $config = $configmapper->find($configID);
+
+ $editconfigForm = new dev_Form_ConfigEdit(array('grouplist' => $groupmapper->fetchAll()));
+ $editconfigForm->populate($config->toArray());
+ }
+ } else {
+ $editconfigForm = new dev_Form_ConfigEdit(array('grouplist' => $groupmapper->fetchAll()), $_POST);
+
+ if ($editconfigForm->isValid($_POST)) {
+
+ $config = new Application_Model_Config($_POST);
+ $configmapper = new Application_Model_ConfigMapper();
+ $config->setCreated(time());
+ $config->setMembershipID('1');
+ $config->setID($configID);
+
+ try {
+ $configmapper->save($config);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ }
+
+ $this->_redirect('/dev/config');
+ }
+
}
- public function deleteconfigAction()
- {
- $configID = $this->_request->getParam('configID');
- if (!isset($configID)){
- $this->_redirect('/dev/config');
- } else {
- $config = new Application_Model_Config();
- $config->setID($configID);
- $configmapper = new Application_Model_ConfigMapper();
- $configmapper->delete($config);
- }
- $this->_redirect('/dev/config');
+ $this->view->editconfigForm = $editconfigForm;
+ }
+
+ public function deleteconfigAction() {
+ $configID = $this->_request->getParam('configID');
+ if (!isset($configID)) {
+ $this->_redirect('/dev/config');
+ } else {
+ $config = new Application_Model_Config();
+ $config->setID($configID);
+ $configmapper = new Application_Model_ConfigMapper();
+ $configmapper->delete($config);
}
+ $this->_redirect('/dev/config');
+ }
}
diff --git a/application/modules/dev/controllers/ErrorController.php b/application/modules/dev/controllers/ErrorController.php
index 6d63b1b..02f4c2f 100644
--- a/application/modules/dev/controllers/ErrorController.php
+++ b/application/modules/dev/controllers/ErrorController.php
@@ -1,61 +1,58 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_ErrorController extends Zend_Controller_Action
-{
-
- public function errorAction()
- {
- $errors = $this->_getParam('error_handler');
- switch ($errors->type) {
- case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
- case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
- case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
-
- // 404 error -- controller or action not found
- $this->getResponse()->setHttpResponseCode(404);
- $this->view->message = 'Page not found';
- print_a($errors);
- break;
- default:
- // application error
- $this->getResponse()->setHttpResponseCode(500);
- $this->view->message = 'Application error';
- print_a($errors);
- break;
- }
-
- // Log exception, if logger available
- if ($log = $this->getLog()) {
- $log->crit($this->view->message, $errors->exception);
- }
-
- // conditionally display exceptions
- if ($this->getInvokeArg('displayExceptions') == true) {
- $this->view->exception = $errors->exception;
- }
-
- $this->view->request = $errors->request;
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_ErrorController extends Zend_Controller_Action {
+
+ public function errorAction() {
+ $errors = $this->_getParam('error_handler');
+ switch ($errors->type) {
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
+ case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
+
+ // 404 error -- controller or action not found
+ $this->getResponse()->setHttpResponseCode(404);
+ $this->view->message = 'Page not found';
+ print_a($errors);
+ break;
+ default:
+ // application error
+ $this->getResponse()->setHttpResponseCode(500);
+ $this->view->message = 'Application error';
+ print_a($errors);
+ break;
+ }
+
+ // Log exception, if logger available
+ if ($log = $this->getLog()) {
+ $log->crit($this->view->message, $errors->exception);
+ }
+
+ // conditionally display exceptions
+ if ($this->getInvokeArg('displayExceptions') == true) {
+ $this->view->exception = $errors->exception;
}
- public function getLog()
- {
- $bootstrap = $this->getInvokeArg('bootstrap');
- if (!$bootstrap->hasPluginResource('Log')) {
- return false;
- }
- $log = $bootstrap->getResource('Log');
- return $log;
+ $this->view->request = $errors->request;
+ }
+
+ public function getLog() {
+ $bootstrap = $this->getInvokeArg('bootstrap');
+ if (!$bootstrap->hasPluginResource('Log')) {
+ return false;
}
+ $log = $bootstrap->getResource('Log');
+ return $log;
+ }
}
diff --git a/application/modules/dev/controllers/FilterController.php b/application/modules/dev/controllers/FilterController.php
index d68f033..b8aecfd 100644
--- a/application/modules/dev/controllers/FilterController.php
+++ b/application/modules/dev/controllers/FilterController.php
@@ -1,674 +1,656 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_FilterController extends Zend_Controller_Action
-{
-
- private $_filtermapper = null;
-
- private $db = null;
-
- public function init()
- {
- try{
- $this->_filtermapper = new Application_Model_FilterMapper();
- }catch (Zend_Exception $e) {
- echo "Error message 1: " . $e->getMessage() . "\n";
- }
- $this->db = Zend_Db_Table::getDefaultAdapter();
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_FilterController extends Zend_Controller_Action {
+
+ private $_filtermapper = null;
+
+ private $db = null;
+
+ public function init() {
+ try {
+ $this->_filtermapper = new Application_Model_FilterMapper();
+ } catch (Zend_Exception $e) {
+ echo "Error message 1: " . $e->getMessage() . "\n";
}
-
- public function indexAction()
- {
- try{
- $this->_filtermapper = new Application_Model_FilterMapper();
- $this->view->filters = $this->_filtermapper->fetchAll();
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function addfilterAction()
- {
- $bmmapper = new Application_Model_BootMenuMapper();
- //TODO get bootmenu by group
- $bootmenus = $bmmapper->fetchAll();
- if (!isset($_POST["add"])){
- $addfilterform = new dev_Form_FilterAdd(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus));
- $this->view->addfilterform = $addfilterform;
- }else {
- $addfilterform = new dev_Form_FilterAdd(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus),$_POST);
- if ($addfilterform->isValid($_POST)) {
- try{
- $newfilter = new Application_Model_Filter($_POST);
- $newfilter->setCreated(time());
-
- // TODO: Ändere mit ACL
- $newfilter->setGroupID('1');
- $newfilter->setMembershipID('1');
-
- $newfilter2 = new Application_Model_FilterMapper();
- $newfilter2->save($newfilter);
-
- $this->_redirect('/dev/filter');
- return;
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
- $this->view->addfilterform = $addfilterform;
- }
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ }
+
+ public function indexAction() {
+ try {
+ $this->_filtermapper = new Application_Model_FilterMapper();
+ $this->view->filters = $this->_filtermapper->fetchAll();
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+
+ public function addfilterAction() {
+ $bmmapper = new Application_Model_BootMenuMapper();
+ //TODO get bootmenu by group
+ $bootmenus = $bmmapper->fetchAll();
+ if (!isset($_POST["add"])) {
+ $addfilterform = new dev_Form_FilterAdd(array('buttontext' => 'Create Filter', 'bootmenus' => $bootmenus));
+ $this->view->addfilterform = $addfilterform;
+ } else {
+ $addfilterform = new dev_Form_FilterAdd(array('buttontext' => 'Create Filter', 'bootmenus' => $bootmenus), $_POST);
+ if ($addfilterform->isValid($_POST)) {
+ try {
+ $newfilter = new Application_Model_Filter($_POST);
+ $newfilter->setCreated(time());
+
+ // TODO: Ändere mit ACL
+ $newfilter->setGroupID('1');
+ $newfilter->setMembershipID('1');
+
+ $newfilter2 = new Application_Model_FilterMapper();
+ $newfilter2->save($newfilter);
+
+ $this->_redirect('/dev/filter');
+ return;
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+ $this->view->addfilterform = $addfilterform;
}
+ }
+
+ public function removefilterAction() {
+ $filterID = $this->_request->getParam('filterID');
+ // TODO: ACL implementieren ob er den filter löschen darf
+ if(is_numeric($filterID)) {
+ $deletefilter = new Application_Model_Filter();
+ $deletefilter->setID($filterID);
+ $filtermapper = new Application_Model_FilterMapper();
+ $filtermapper->delete($deletefilter);
+ }
+ $this->_redirect('/dev/filter');
+ }
+
+ public function editfilterAction() {
+ $bmmapper = new Application_Model_BootMenuMapper();
+ //TODO get bootmenu by group
+ $bootmenus = $bmmapper->fetchAll();
+ if (!isset($_POST["add"])) {
+ // TODO: ACL implementieren ob er editieren darf
+ $filterID = $this->_request->getParam('filterID');
+ $filter = new Application_Model_Filter();
- public function removefilterAction()
- {
+
+ $filtermapper = new Application_Model_FilterMapper();
+ $filtermapper->find($filterID, $filter);
+ $filter2 = $filter->toArray();
+
+ $editfilterform = new dev_Form_FilterAdd(array('buttontext' => 'Edit Filter', 'bootmenus' => $bootmenus));
+ $editfilterform->populate($filter2);
+ $this->view->editfilterform = $editfilterform;
+
+ } else {
+ try {
$filterID = $this->_request->getParam('filterID');
- // TODO: ACL implementieren ob er den filter löschen darf
- if(is_numeric($filterID)){
- $deletefilter = new Application_Model_Filter();
- $deletefilter->setID($filterID);
- $filtermapper = new Application_Model_FilterMapper();
- $filtermapper->delete($deletefilter);
- }
- $this->_redirect('/dev/filter');
- }
- public function editfilterAction()
- {
- $bmmapper = new Application_Model_BootMenuMapper();
- //TODO get bootmenu by group
- $bootmenus = $bmmapper->fetchAll();
- if (!isset($_POST["add"])){
- // TODO: ACL implementieren ob er editieren darf
- $filterID = $this->_request->getParam('filterID');
- $filter = new Application_Model_Filter();
-
-
- $filtermapper = new Application_Model_FilterMapper();
- $filtermapper->find($filterID,$filter);
- $filter2 = $filter->toArray();
-
- $editfilterform = new dev_Form_FilterAdd(array('buttontext' => 'Edit Filter','bootmenus'=>$bootmenus));
- $editfilterform->populate($filter2);
- $this->view->editfilterform = $editfilterform;
-
- } else{
- try{
- $filterID = $this->_request->getParam('filterID');
-
- $editfilterform = new dev_Form_FilterAdd(array('buttontext' => 'Edit Filter','bootmenus'=>$bootmenus),$_POST);
- //TODO: ACL integrieren
- $_POST['groupID'] = 1;
- $_POST['membershipID'] = 1;
- $_POST['created'] = time();
-
- if ($editfilterform->isValid($_POST)) {
- $newfilterenty = new Application_Model_Filter($_POST);
- $newfilterenty->setID($this->_request->getParam('filterID'));
- $newfilter2 = new Application_Model_FilterMapper();
- $newfilter2->save($newfilterenty);
- echo 'valid';
- $this->_redirect('/dev/filter');
- }
- $this->view->editfilterform = $editfilterform;
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
+ $editfilterform = new dev_Form_FilterAdd(array('buttontext' => 'Edit Filter', 'bootmenus' => $bootmenus), $_POST);
+ //TODO: ACL integrieren
+ $_POST['groupID'] = 1;
+ $_POST['membershipID'] = 1;
+ $_POST['created'] = time();
+
+ if ($editfilterform->isValid($_POST)) {
+ $newfilterenty = new Application_Model_Filter($_POST);
+ $newfilterenty->setID($this->_request->getParam('filterID'));
+ $newfilter2 = new Application_Model_FilterMapper();
+ $newfilter2->save($newfilterenty);
+ echo 'valid';
+ $this->_redirect('/dev/filter');
+ }
+ $this->view->editfilterform = $editfilterform;
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
}
-
- public function addfilterentryAction()
- {
- // TODO: ACL implementieren ob er editieren darf
- if (!isset($_POST["add"])){
- try{
- $editfilterform = new dev_Form_FilterEntriesAdd(
- array( 'buttontext' => 'Add Filterentry',
- 'filterID' => $this->_request->getParam('filterID'),
- 'data' => $_POST
- ));
- $editfilterform->populate($_POST);
- $this->view->editfilterform = $editfilterform;
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- } else{
- $editfilterform = new dev_Form_FilterEntriesAdd(array('buttontext' => 'Add Filterentry'),$_POST);
- if ($editfilterform->isValid($_POST)) {
- $newfilterenty = new Application_Model_FilterEntries();
- $newfilterenty->setFilterID($_POST['filterID']);
- $newfilterenty->setFiltertypeID($_POST['filtertypeID']);
-
- if($_POST['filtertypeID'] == 1){
- $newfilterenty->setFiltervalue($this->fillIP($_POST['filtervalue']));
- $newfilterenty->setFiltervalue2($this->fillIP($_POST['filtervalue2']));
- }
- else{
- $newfilterenty->setFiltervalue($_POST['filtervalue']);
- $newfilterenty->setFiltervalue2($_POST['filtervalue2']);
- }
-
- $newfilter2 = new Application_Model_FilterEntriesMapper();
- $newfilter2->save($newfilterenty);
- #print_a($newfilterenty);
- $this->_redirect('/dev/filter');
- }
- $this->view->editfilterform = $editfilterform;
- }
+ }
+
+ public function addfilterentryAction() {
+ // TODO: ACL implementieren ob er editieren darf
+ if (!isset($_POST["add"])) {
+ try {
+ $editfilterform = new dev_Form_FilterEntriesAdd(
+ array( 'buttontext' => 'Add Filterentry',
+ 'filterID' => $this->_request->getParam('filterID'),
+ 'data' => $_POST
+ ));
+ $editfilterform->populate($_POST);
+ $this->view->editfilterform = $editfilterform;
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ } else {
+ $editfilterform = new dev_Form_FilterEntriesAdd(array('buttontext' => 'Add Filterentry'), $_POST);
+ if ($editfilterform->isValid($_POST)) {
+ $newfilterenty = new Application_Model_FilterEntries();
+ $newfilterenty->setFilterID($_POST['filterID']);
+ $newfilterenty->setFiltertypeID($_POST['filtertypeID']);
+
+ if($_POST['filtertypeID'] == 1) {
+ $newfilterenty->setFiltervalue($this->fillIP($_POST['filtervalue']));
+ $newfilterenty->setFiltervalue2($this->fillIP($_POST['filtervalue2']));
+ } else {
+ $newfilterenty->setFiltervalue($_POST['filtervalue']);
+ $newfilterenty->setFiltervalue2($_POST['filtervalue2']);
+ }
+
+ $newfilter2 = new Application_Model_FilterEntriesMapper();
+ $newfilter2->save($newfilterenty);
+#print_a($newfilterenty);
+ $this->_redirect('/dev/filter');
+ }
+ $this->view->editfilterform = $editfilterform;
}
-
- public function editfilterentryAction()
- {
- if (!isset($_POST["add"])){
- try{
- $filterentriesID = $this->_request->getParam('filterentriesID');
-
- $filterentry = new Application_Model_FilterEntries();
- $filterentriesmapper = new Application_Model_FilterEntriesMapper();
- $filterentriesmapper->find($filterentriesID,$filterentry);
-
-
-
- #$editfilterform->setFilterID($filterID);
- if(isset($_POST['filtertypeID']) && $_POST['filtertypeID'] != $filterentry->getFiltertypeID()){
- $filterentry->setFiltertypeID($_POST['filtertypeID']) ;
- }
- $data = $filterentry->toArray();
- print_a($data);
- $editfilterform = new dev_Form_FilterEntriesAdd(
- array('buttontext' => 'Edit Filterentry',
- 'data' => $data));
-
- $editfilterform->populate($filterentry->toArray());
- $this->view->editfilterform = $editfilterform;
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- } else{
- try{
- $filterentriesID = $this->_request->getParam('filterentriesID');
- $editfilterform = new dev_Form_FilterEntriesAdd(array('buttontext' => 'Edit Filterentry'),$_POST);
- if ($editfilterform->isValid($_POST)) {
- if($_POST['filterID'] == '')
- unset($_POST['filterID']);
- $newfilterenty = new Application_Model_FilterEntries($_POST);
- $newfilterenty->setID($filterentriesID);
- if($_POST['filtertypeID'] == 1){
- $newfilterenty->setFiltervalue($this->fillIP($_POST['filtervalue']));
- $newfilterenty->setFiltervalue2($this->fillIP($_POST['filtervalue2']));
- }
- else{
- $newfilterenty->setFiltervalue($_POST['filtervalue']);
- $newfilterenty->setFiltervalue2($_POST['filtervalue2']);
- }
- $newfilter2 = new Application_Model_FilterEntriesMapper();
- $newfilter2->save($newfilterenty);
- #print_a($newfilterenty);
- $this->_redirect('/dev/filter');
-
- }
- $this->view->editfilterform = $editfilterform;
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
+ }
+
+ public function editfilterentryAction() {
+ if (!isset($_POST["add"])) {
+ try {
+ $filterentriesID = $this->_request->getParam('filterentriesID');
+
+ $filterentry = new Application_Model_FilterEntries();
+ $filterentriesmapper = new Application_Model_FilterEntriesMapper();
+ $filterentriesmapper->find($filterentriesID, $filterentry);
+
+
+
+#$editfilterform->setFilterID($filterID);
+ if(isset($_POST['filtertypeID']) && $_POST['filtertypeID'] != $filterentry->getFiltertypeID()) {
+ $filterentry->setFiltertypeID($_POST['filtertypeID']) ;
+ }
+ $data = $filterentry->toArray();
+ print_a($data);
+ $editfilterform = new dev_Form_FilterEntriesAdd(
+ array('buttontext' => 'Edit Filterentry',
+ 'data' => $data));
+
+ $editfilterform->populate($filterentry->toArray());
+ $this->view->editfilterform = $editfilterform;
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ } else {
+ try {
+ $filterentriesID = $this->_request->getParam('filterentriesID');
+ $editfilterform = new dev_Form_FilterEntriesAdd(array('buttontext' => 'Edit Filterentry'), $_POST);
+ if ($editfilterform->isValid($_POST)) {
+ if($_POST['filterID'] == '')
+ { unset($_POST['filterID']); }
+ $newfilterenty = new Application_Model_FilterEntries($_POST);
+ $newfilterenty->setID($filterentriesID);
+ if($_POST['filtertypeID'] == 1) {
+ $newfilterenty->setFiltervalue($this->fillIP($_POST['filtervalue']));
+ $newfilterenty->setFiltervalue2($this->fillIP($_POST['filtervalue2']));
+ } else {
+ $newfilterenty->setFiltervalue($_POST['filtervalue']);
+ $newfilterenty->setFiltervalue2($_POST['filtervalue2']);
+ }
+ $newfilter2 = new Application_Model_FilterEntriesMapper();
+ $newfilter2->save($newfilterenty);
+#print_a($newfilterenty);
+ $this->_redirect('/dev/filter');
+
+ }
+ $this->view->editfilterform = $editfilterform;
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
}
-
- public function removefilterentryAction()
- {
- try{
- $filterentriesID = $this->_request->getParam('filterentriesID');
-
- // TODO: ACL implementieren ob er den filter löschen darf
- if(is_numeric($filterentriesID)){
- $deletefilterentry = new Application_Model_FilterEntries();
- $deletefilterentry->setID($filterentriesID);
-
- $filterentriesmapper = new Application_Model_FilterEntriesMapper();
- $filterentriesmapper->delete($deletefilterentry);
- echo "ok";
- }
- $this->_redirect('/dev/filter');
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
+ }
+
+ public function removefilterentryAction() {
+ try {
+ $filterentriesID = $this->_request->getParam('filterentriesID');
+
+ // TODO: ACL implementieren ob er den filter löschen darf
+ if(is_numeric($filterentriesID)) {
+ $deletefilterentry = new Application_Model_FilterEntries();
+ $deletefilterentry->setID($filterentriesID);
+
+ $filterentriesmapper = new Application_Model_FilterEntriesMapper();
+ $filterentriesmapper->delete($deletefilterentry);
+ echo "ok";
+ }
+ $this->_redirect('/dev/filter');
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
}
+ }
- private function fillIP($ip)
- {
- $ar = explode(".",$ip);
- $representation = array();
- foreach($ar as $part){
- $representation[] = sprintf("%03s",$part);
- }
- return implode(".",$representation);
+ private function fillIP($ip) {
+ $ar = explode(".", $ip);
+ $representation = array();
+ foreach($ar as $part) {
+ $representation[] = sprintf("%03s", $part);
}
-
- private function fillMac($ip)
- {
- $ar = explode(":",$ip);
- $representation = array();
- foreach($ar as $part){
- $representation[] = sprintf("%02s",$part);
- }
- return implode(":",$representation);
+ return implode(".", $representation);
+ }
+
+ private function fillMac($ip) {
+ $ar = explode(":", $ip);
+ $representation = array();
+ foreach($ar as $part) {
+ $representation[] = sprintf("%02s", $part);
}
-
- public function evaluateAction()
- {
- $db = $this->db;
- $showPartResults = false;
- // For Testing Filters
-
-
- $testFilter = (isset($_POST['submit']))?true:false;
-
- if($testFilter){
- $ipAdress = $_POST['ip'];
- $macAdress = $_POST['mac'];
- $poolID = $_POST['poolID'];
- $bootisoID = $_POST['bootisoID'];
- $membershipID = $_POST['membershipID'];
- $groupID = $_POST['groupID'];
- $time = ($_POST['time']);
- $clientID = $_POST['clientID'];
- $weekday = $_POST['weekday'];
- $date = $_POST['date'];
- print_a('Input',
- array('ipAdress'=>$ipAdress,
- 'macAdress'=>$macAdress,
- 'poolID' => $poolID,
- 'bootisoID' => $bootisoID,
- 'membershipID'=>$membershipID,
- 'groupID'=>$groupID,
- 'time'=> $time." - ".date('d.m.Y H:i:s',$time),
- 'clientID' => $clientID,
- 'hardwarehash' => $hardwarehash,
- 'weekday' => $weekday,
- 'date' => $date));
- }
-
-
- try{
- $mysession = '1';
- $set = array();
-
-
- $session = new Application_Model_Session();
- $sessionmapper = new Application_Model_SessionMapper();
- $sessionmapper->find($mysession,$session);
- #########################################################
- // IP Adress
- $filtertypID = 1;
- // get it from session_table with session_id from the session
- if(!$testFilter){
- $ipAdress = $session->getIp();
- }
- $ipAdress = str_replace(".","",$this->fillIP($ipAdress));
-
- $select = $db->select()
- ->from(array('pbs_filterentries')
- )
- ->where('filtertypeID = ?',$filtertypID)
- ->where('REPLACE(filtervalue,".","") <= ?',$ipAdress)
- ->where('? <= REPLACE(filtervalue2,".","")',$ipAdress);
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
-
- if($showPartResults)
- print_a('ipAdress',$result,$set[$filtertypID]);
-
- #########################################################
- // Mac range
- $filtertypID = 2;
- // get it from session_table with session_id from the session
- if(!$testFilter){
- $client = new Application_Model_Client();
- $clientmapper = new Application_Model_ClientMapper();
- $clientmapper->find($session->getClientID(),$client);
- $macAdress = $client->getMacadress();
- }
- try{
- $macAdress = $this->fillMac($macAdress);
- $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
- filtertypeID = ".$filtertypID." AND
- filtervalue <= '".$macAdress."' AND
- '".$macAdress."' <= filtervalue2");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
- if($showPartResults)
- print_a('macAdress',$result,$set[$filtertypID]);
-
- #########################################################
- // PoolID
- $filtertypID = 3;
- // get PoolID from client_ID from session_id from the session
- if(!$testFilter){
- $poolentry = new Application_Model_PoolEntries();
- $poolentrymapper = new Application_Model_PoolEntriesMapper();
- $poolentry = $poolentrymapper->findby(array('clientID' => $client->getID()),true);
- $poolentry = $poolentry[0];
-
- $poolID = $poolentry['poolID'];
- }
-
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
- filtertypeID = ".$filtertypID." AND
- filtervalue = ".$poolID." ");
- $result = $stmt->fetchAll();
- if(count($result)>0){
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- }
- catch(Exception $e){}
-
- if($showPartResults)
- print_a('poolID',$result,$set[$filtertypID]);
- #########################################################
- // ClientID
- $filtertypID = 8;
- // get client_ID from session_id from the session
-
- if(!$testFilter){
- $clientID = $session->getClientID();
- }
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
- filtertypeID = ".$filtertypID." AND
- filtervalue = ".$clientID." ");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($showPartResults)
- print_a('clientID',$result,$set[$filtertypID]);
- #########################################################
- // BootIsoID
- $filtertypID = 4;
- // get BootIsoID from client_ID from session_id from the session
- if(!$testFilter){
- $bootisoID = $session->getBootisoID();
- }
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
- filtertypeID = ".$filtertypID." AND
- filtervalue = ".$bootisoID." ");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($showPartResults)
- print_a('bootisoID',$result,$set[$filtertypID]);
- #########################################################
- // MembershipID
- $filtertypID = 5;
-
- if(!$testFilter){
- // get membership from the session
- //TODO: GET MEMBERSHIP from SESSION
- $membershipID = 1;
- }
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
- filtertypeID = ".$filtertypID." AND
- filtervalue = ".$membershipID." ");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($showPartResults)
- print_a('membership',$result,$set[$filtertypID]);
- #########################################################
- // GroupID
- $filtertypID = 6;
-
- if(!$testFilter){
- // get membership from the session
- //TODO: GET GROUP from SESSION
- $groupID = 1;
- }
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
- filtertypeID = ".$filtertypID." AND
- filtervalue = ".$groupID." ");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($showPartResults)
- print_a('membership',$result,$set[$filtertypID]);
- #########################################################
- // Time
- $filtertypID = 7;
- if(!$testFilter){
- $time = time("H:i");
- }
-
- $nowShort = $time;
-
- $nowShort = str_replace(":","",$nowShort);
- try{
- $select = $db->select()
- ->from(array('pbs_filterentries')
- )
- ->where('filtertypeID = ?',$filtertypID)
- ->where('REPLACE(filtervalue,":","") <= ? AND ? <= REPLACE(filtervalue2,":","")',$nowShort);
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($showPartResults)
- print_a('time',$result,$set[$filtertypID]);
- #########################################################
- // Hardwarehash
- $filtertypID = 9;
- if(!$testFilter){
- // get hardwarehash from session
- $hardwarehash = 'aaaa';
- }
-
- try{
- $select = $db->select()
- ->from(array('pbs_filterentries')
- )
- ->where('filtertypeID = ?',$filtertypID)
- ->where('`filtervalue` = ?',$hardwarehash);
- $stmt = $select->query();
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($showPartResults)
- print_a('hardwarehash',$result,$set[$filtertypID]);
- #########################################################
- // weekday
- $filtertypID = 10;
- if(!$testFilter){
- $weekday = date('N');
- }
-
- try{
- $select = $db->select()
- ->from(array('pbs_filterentries')
- )
- ->where('filtertypeID = ?',$filtertypID)
- ->where('filtervalue = ? ',$weekday);
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($showPartResults)
- print_a('weekday',$result,$set[$filtertypID]);
- #########################################################
- // weekday
- $filtertypID = 11;
- if(!$testFilter){
- $date = date('d.m.Y');
- }
-
- try{
- $select = $db->select()
- ->from(array('pbs_filterentries')
- )
- ->where('filtertypeID = ?',$filtertypID)
- ->where('REPLACE(filtervalue,".","") <= ? AND ? <= REPLACE(filtervalue2,".","")',$date);
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($showPartResults)
- print_a('weekday',$result,$set[$filtertypID]);
- ########################################
- // ErgebnisSet auswerten
- print_a('the result sets of the filtertypes',$set);
-
- // Merging of the resultsets of the filter
- $kk = array();
- foreach($set as $myset){
- $kk = array_merge($kk,$myset);
- }
- $set = $kk;
- // counting how often a filter is evaluated at database
- $a = array();
- foreach($set as $k=> $s){
- $a[$s] += 1;
- }
- print_a('Übereinstimmungen pro Filter',$a);
- // Get the number of filtertypes every filter has
- $stmt = $db->query('SELECT filterID, COUNT(filtertypeID) as num FROM pbs_filterentries GROUP BY filterID');
- $resultset = $stmt->fetchAll();
- foreach($resultset as $d){
- $database[$d['filterID']] = $d['num'];
- }
- print_a('Anzahl Filterentries in Datenbank',$database);
-
- // remove all filters from resultset, which to few filtertypes satisfied
- $result = array();
- foreach($a as $i=>$b){
- if($a[$i] < $database[$i]){
- unset($a[$i]);
- }
- else{
- $result[] = $i;
- }
- }
-
- print_a('True Filters',$result);
- // now selecting the filter with the highest priority
- $query = 'SELECT filterID, bootmenuID, priority
- FROM pbs_filter WHERE ';
- foreach($result as $e){
- $queryTmp[] = "filterID = '$e'";
- }
- $query .= implode(" OR ", $queryTmp);
- $query .= 'ORDER BY priority DESC LIMIT 0,1';
- $bootmenuID = 'null';
- try{
- $stmt = $db->query($query);
- $resultset = $stmt->fetchAll();
- $bootmenuID = $resultset[0]['bootmenuID'];
- }
- catch(Exception $e){
- }
- if($bootmenuID != 'null'){
- $bm = new Application_Model_BootMenu();
- $bmmapper = new Application_Model_BootMenuMapper();
- $bmmapper->find($bootmenuID,$bm);
- echo "<h1><a href='/bootmenu/index/bootmenuid/".$bootmenuID."'>Goto BootmenuID: ".$bootmenuID."</a></h1>";
- }
- else{
- echo "<h1>No Result :-(</h1>";
- }
-
- }catch (Zend_Exception $e) {
- echo "class: ".get_class($e)."<br>\n";
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
+ return implode(":", $representation);
+ }
+
+ public function evaluateAction() {
+ $db = $this->db;
+ $showPartResults = false;
+ // For Testing Filters
+
+
+ $testFilter = (isset($_POST['submit'])) ? true : false;
+
+ if($testFilter) {
+ $ipAdress = $_POST['ip'];
+ $macAdress = $_POST['mac'];
+ $poolID = $_POST['poolID'];
+ $bootisoID = $_POST['bootisoID'];
+ $membershipID = $_POST['membershipID'];
+ $groupID = $_POST['groupID'];
+ $time = ($_POST['time']);
+ $clientID = $_POST['clientID'];
+ $weekday = $_POST['weekday'];
+ $date = $_POST['date'];
+ print_a('Input',
+ array('ipAdress' => $ipAdress,
+ 'macAdress' => $macAdress,
+ 'poolID' => $poolID,
+ 'bootisoID' => $bootisoID,
+ 'membershipID' => $membershipID,
+ 'groupID' => $groupID,
+ 'time' => $time." - ".date('d.m.Y H:i:s', $time),
+ 'clientID' => $clientID,
+ 'hardwarehash' => $hardwarehash,
+ 'weekday' => $weekday,
+ 'date' => $date));
}
- public function testevaluateAction()
- {
- $pm = new Application_Model_PoolMapper();
- $pools = $pm->fetchAll();
-
- $bim = new Application_Model_BootIsoMapper();
- $bootisos = $bim->fetchAll();
-
- $mm = new Application_Model_MembershipMapper();
- $memberships = $mm->fetchAll();
-
- $gm = new Application_Model_GroupMapper();
- $groups = $gm->fetchAll();
-
- $cm = new Application_Model_ClientMapper();
- $clients = $cm->fetchAll();
-
- $filterevaluate = new dev_Form_FilterEvaluate(
- array( 'pools' => $pools,
- 'bootisos' => $bootisos,
- 'memberships' => $memberships,
- 'groups' => $groups,
- 'clients' => $clients,
-
- ));
- $filterevaluate->populate(array(
- 'ip' => '132.230.5.6',
- 'mac' => '08:00:20:ae:fd:7e',
- 'time'=>date('d.m.Y H:i'))
- );
- $this->view->filterevaluate = $filterevaluate;
+
+ try {
+ $mysession = '1';
+ $set = array();
+
+
+ $session = new Application_Model_Session();
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->find($mysession, $session);
+#########################################################
+ // IP Adress
+ $filtertypID = 1;
+ // get it from session_table with session_id from the session
+ if(!$testFilter) {
+ $ipAdress = $session->getIp();
+ }
+ $ipAdress = str_replace(".", "", $this->fillIP($ipAdress));
+
+ $select = $db->select()
+ ->from(array('pbs_filterentries')
+ )
+ ->where('filtertypeID = ?', $filtertypID)
+ ->where('REPLACE(filtervalue,".","") <= ?', $ipAdress)
+ ->where('? <= REPLACE(filtervalue2,".","")', $ipAdress);
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+
+ if($showPartResults)
+ { print_a('ipAdress', $result, $set[$filtertypID]); }
+
+#########################################################
+ // Mac range
+ $filtertypID = 2;
+ // get it from session_table with session_id from the session
+ if(!$testFilter) {
+ $client = new Application_Model_Client();
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->find($session->getClientID(), $client);
+ $macAdress = $client->getMacadress();
+ }
+ try {
+ $macAdress = $this->fillMac($macAdress);
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue <= '".$macAdress."' AND
+ '".$macAdress."' <= filtervalue2");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {
+ }
+ if($showPartResults)
+ { print_a('macAdress', $result, $set[$filtertypID]); }
+
+#########################################################
+ // PoolID
+ $filtertypID = 3;
+ // get PoolID from client_ID from session_id from the session
+ if(!$testFilter) {
+ $poolentry = new Application_Model_PoolEntries();
+ $poolentrymapper = new Application_Model_PoolEntriesMapper();
+ $poolentry = $poolentrymapper->findby(array('clientID' => $client->getID()), true);
+ $poolentry = $poolentry[0];
+
+ $poolID = $poolentry['poolID'];
+ }
+
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$poolID." ");
+ $result = $stmt->fetchAll();
+ if(count($result) > 0) {
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ }
+ } catch(Exception $e) {
+ }
+
+ if($showPartResults)
+ { print_a('poolID', $result, $set[$filtertypID]); }
+#########################################################
+ // ClientID
+ $filtertypID = 8;
+ // get client_ID from session_id from the session
+
+ if(!$testFilter) {
+ $clientID = $session->getClientID();
+ }
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$clientID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {
+ }
+
+ if($showPartResults)
+ { print_a('clientID', $result, $set[$filtertypID]); }
+#########################################################
+ // BootIsoID
+ $filtertypID = 4;
+ // get BootIsoID from client_ID from session_id from the session
+ if(!$testFilter) {
+ $bootisoID = $session->getBootisoID();
+ }
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$bootisoID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {
+ }
+
+ if($showPartResults)
+ { print_a('bootisoID', $result, $set[$filtertypID]); }
+#########################################################
+ // MembershipID
+ $filtertypID = 5;
+
+ if(!$testFilter) {
+ // get membership from the session
+ //TODO: GET MEMBERSHIP from SESSION
+ $membershipID = 1;
+ }
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$membershipID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {
+ }
+
+ if($showPartResults)
+ { print_a('membership', $result, $set[$filtertypID]); }
+#########################################################
+ // GroupID
+ $filtertypID = 6;
+
+ if(!$testFilter) {
+ // get membership from the session
+ //TODO: GET GROUP from SESSION
+ $groupID = 1;
+ }
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE
+ filtertypeID = ".$filtertypID." AND
+ filtervalue = ".$groupID." ");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {
+ }
+
+ if($showPartResults)
+ { print_a('membership', $result, $set[$filtertypID]); }
+#########################################################
+ // Time
+ $filtertypID = 7;
+ if(!$testFilter) {
+ $time = time("H:i");
+ }
+
+ $nowShort = $time;
+
+ $nowShort = str_replace(":", "", $nowShort);
+ try {
+ $select = $db->select()
+ ->from(array('pbs_filterentries')
+ )
+ ->where('filtertypeID = ?', $filtertypID)
+ ->where('REPLACE(filtervalue,":","") <= ? AND ? <= REPLACE(filtervalue2,":","")', $nowShort);
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {
+ }
+
+ if($showPartResults)
+ { print_a('time', $result, $set[$filtertypID]); }
+#########################################################
+ // Hardwarehash
+ $filtertypID = 9;
+ if(!$testFilter) {
+ // get hardwarehash from session
+ $hardwarehash = 'aaaa';
+ }
+
+ try {
+ $select = $db->select()
+ ->from(array('pbs_filterentries')
+ )
+ ->where('filtertypeID = ?', $filtertypID)
+ ->where('`filtervalue` = ?', $hardwarehash);
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {
+ }
+
+ if($showPartResults)
+ { print_a('hardwarehash', $result, $set[$filtertypID]); }
+#########################################################
+ // weekday
+ $filtertypID = 10;
+ if(!$testFilter) {
+ $weekday = date('N');
+ }
+
+ try {
+ $select = $db->select()
+ ->from(array('pbs_filterentries')
+ )
+ ->where('filtertypeID = ?', $filtertypID)
+ ->where('filtervalue = ? ', $weekday);
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {
+ }
+
+ if($showPartResults)
+ { print_a('weekday', $result, $set[$filtertypID]); }
+#########################################################
+ // weekday
+ $filtertypID = 11;
+ if(!$testFilter) {
+ $date = date('d.m.Y');
+ }
+
+ try {
+ $select = $db->select()
+ ->from(array('pbs_filterentries')
+ )
+ ->where('filtertypeID = ?', $filtertypID)
+ ->where('REPLACE(filtervalue,".","") <= ? AND ? <= REPLACE(filtervalue2,".","")', $date);
+
+ $stmt = $select->query();
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {
+ }
+
+ if($showPartResults)
+ { print_a('weekday', $result, $set[$filtertypID]); }
+########################################
+ // ErgebnisSet auswerten
+ print_a('the result sets of the filtertypes', $set);
+
+ // Merging of the resultsets of the filter
+ $kk = array();
+ foreach($set as $myset) {
+ $kk = array_merge($kk, $myset);
+ }
+ $set = $kk;
+ // counting how often a filter is evaluated at database
+ $a = array();
+ foreach($set as $k => $s) {
+ $a[$s] += 1;
+ }
+ print_a('Übereinstimmungen pro Filter', $a);
+ // Get the number of filtertypes every filter has
+ $stmt = $db->query('SELECT filterID, COUNT(filtertypeID) as num FROM pbs_filterentries GROUP BY filterID');
+ $resultset = $stmt->fetchAll();
+ foreach($resultset as $d) {
+ $database[$d['filterID']] = $d['num'];
+ }
+ print_a('Anzahl Filterentries in Datenbank', $database);
+
+ // remove all filters from resultset, which to few filtertypes satisfied
+ $result = array();
+ foreach($a as $i => $b) {
+ if($a[$i] < $database[$i]) {
+ unset($a[$i]);
+ } else {
+ $result[] = $i;
+ }
+ }
+
+ print_a('True Filters', $result);
+ // now selecting the filter with the highest priority
+ $query = 'SELECT filterID, bootmenuID, priority
+ FROM pbs_filter WHERE ';
+ foreach($result as $e) {
+ $queryTmp[] = "filterID = '$e'";
+ }
+ $query . = implode(" OR ", $queryTmp);
+ $query . = 'ORDER BY priority DESC LIMIT 0,1';
+ $bootmenuID = 'null';
+ try {
+ $stmt = $db->query($query);
+ $resultset = $stmt->fetchAll();
+ $bootmenuID = $resultset[0]['bootmenuID'];
+ } catch(Exception $e) {
+ }
+ if($bootmenuID != 'null') {
+ $bm = new Application_Model_BootMenu();
+ $bmmapper = new Application_Model_BootMenuMapper();
+ $bmmapper->find($bootmenuID, $bm);
+ echo "<h1><a href='/bootmenu/index/bootmenuid/".$bootmenuID."'>Goto BootmenuID: ".$bootmenuID."</a></h1>";
+ } else {
+ echo "<h1>No Result :-(</h1>";
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "class: ".get_class($e)."<br>\n";
+ echo "Error message 2: " . $e->getMessage() . "\n";
}
+ }
+
+ public function testevaluateAction() {
+ $pm = new Application_Model_PoolMapper();
+ $pools = $pm->fetchAll();
+
+ $bim = new Application_Model_BootIsoMapper();
+ $bootisos = $bim->fetchAll();
+
+ $mm = new Application_Model_MembershipMapper();
+ $memberships = $mm->fetchAll();
+
+ $gm = new Application_Model_GroupMapper();
+ $groups = $gm->fetchAll();
+
+ $cm = new Application_Model_ClientMapper();
+ $clients = $cm->fetchAll();
+
+ $filterevaluate = new dev_Form_FilterEvaluate(
+ array( 'pools' => $pools,
+ 'bootisos' => $bootisos,
+ 'memberships' => $memberships,
+ 'groups' => $groups,
+ 'clients' => $clients,
+
+ ));
+ $filterevaluate->populate(array(
+ 'ip' => '132.230.5.6',
+ 'mac' => '08:00:20:ae:fd:7e',
+ 'time' => date('d.m.Y H:i'))
+ );
+ $this->view->filterevaluate = $filterevaluate;
+ }
}
diff --git a/application/modules/dev/controllers/GroupController.php b/application/modules/dev/controllers/GroupController.php
index 4188a1d..08bbe45 100644
--- a/application/modules/dev/controllers/GroupController.php
+++ b/application/modules/dev/controllers/GroupController.php
@@ -1,258 +1,240 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_GroupController extends Zend_Controller_Action
-{
- protected $groupMapper;
- protected $groupGroupsMapper;
- protected $membershipMapper;
- protected $groupRequestMapper;
- protected $personmapper;
- protected $rolemapper;
- protected $groupList;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->groupMapper = new Application_Model_GroupMapper();
- $this->groupGroupsMapper = new Application_Model_GroupGroupsMapper();
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->groupRequestMapper = new Application_Model_GroupRequestMapper();
- $this->personmapper = new Application_Model_PersonMapper();
- $this->rolemapper = new Application_Model_RoleMapper();
- $this->groupList = $this->groupMapper->fetchAll();
- } else {
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
-
- public function indexAction()
- {
- $this->view->groupList = $this->groupList;
- }
-
- public function addAction()
- {
- if (!isset($_POST["add"])){
- $addForm = new dev_Form_GroupAdd(array('grouplist' => $this->groupList));
- } else {
- $addForm = new dev_Form_GroupAdd(array('grouplist' => $this->groupList),$_POST);
-
- if ($addForm->isValid($_POST)) {
- $group = new Application_Model_Group($_POST);
- try {
- $this->groupMapper->save($group);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- if($_POST['superordinatedGroupID'] != -1) {
- $lastID = $this->groupMapper->getDbTable()->getDefaultAdapter()->lastInsertId();
- $groupgroups = new Application_Model_GroupGroups();
- $groupgroups->setParentID($_POST['superordinatedGroupID']);
- $groupgroups->setGroupID($lastID);
- try {
- $this->groupGroupsMapper->save($groupgroups);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
-
- }
- $this->_helper->redirector('', 'group');
- return;
- }
- }
-
- $this->view->addForm = $addForm;
- }
-
- public function editAction()
- {
- $groupID = $this->_request->getParam('groupID');
- if(!isset($groupID)) {
- $addForm = new dev_Form_GroupAdd(array('grouplist' => $this->groupList));
- $this->view->addForm = $addForm;
- return;
- }
- if (!isset($_POST["save"])){
- $group = $this->groupMapper->find($groupID);
- $_POST['title'] = $group->getTitle();
- $_POST['description'] = $group->getDescription();
- $editForm = new dev_Form_GroupEdit();
- } else {
- $editForm = new dev_Form_GroupEdit($_POST);
- if ($editForm->isValid($_POST)) {
- $group = new Application_Model_Group($_POST);
- $group->setID($this->_request->getParam('groupID'));
- try {
- $this->groupMapper->save($group);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'group');
- return;
- }
- }
-
- $this->view->editForm = $editForm;
-
- }
-
- public function showAction()
- {
- $groupID = $this->_request->getParam('groupID');
- if($groupID) {
- $groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID),true);
- if(isset($groupRequests)) {
- foreach($groupRequests as $groupRequest) {
- $person = $this->personmapper->find($groupRequest['personID']);
- $groupRequestList[] = array(
- 'grouprequestID' => $groupRequest['grouprequestID'],
- 'person' => $person
- );
- }
- if(is_array($groupRequestList)) {
- $this->view->groupRequestList = $groupRequestList;
- }
- $this->view->roleList = $this->rolemapper->findBy('groupID', $groupID);
- }
- $members = $this->membershipMapper->findBy('groupID', $groupID);
- if(isset($members)) {
- foreach($members as $member) {
- $person = $this->personmapper->find($member['personID']);
- $membersList[] = array(
- 'membershipID' => $member['membershipID'],
- 'person' => $person
- );
- }
- if(is_array($membersList)) {
- $this->view->membersList = $membersList;
- }
- }
- $groupgroups = $this->groupGroupsMapper->findBy('groupID', $groupID);
- if(is_object($groupgroups)) {
- $parentGroup = $this->groupMapper->find($groupgroups->getParentID());
- $this->view->$parentGroup = $parentGroup;
- }
- $group = $this->groupMapper->find($groupID);
- $this->view->group = $group;
- $this->view->groupID = $groupID;
- }
- }
-
- public function linkAction()
- {
- if (!isset($_POST["link"])){
- $linkForm = new dev_Form_GroupLink(array('grouplist' => $this->groupList));
- } else {
- $linkForm = new dev_Form_GroupLink(array('grouplist' => $this->groupList),$_POST);
-
- if ($linkForm->isValid($_POST)) {
- $groupgroups = new Application_Model_GroupGroups();
- $groupgroups->setParentID($_POST['superordinatedGroupID']);
- $groupgroups->setGroupID($_POST['groupID']);
- try {
- $this->groupGroupsMapper->save($groupgroups);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'group');
- return;
- }
- }
-
- $this->view->linkForm = $linkForm;
- }
-
- public function deleteAction()
- {
- $this->_helper->viewRenderer->setNoRender();
- $groupID = $this->_request->getParam('groupID');
- if (isset($groupID)){
- $group = $this->groupMapper->find($groupID);
- try {
- $this->groupMapper->delete($group);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'group');
- return;
- }
- }
-
- public function grantpersonAction()
- {
- $this->_helper->viewRenderer->setNoRender();
- if(isset($_POST['grouprequestID']) && isset($_POST['roleID'])) {
- $groupRequest = $this->groupRequestMapper->find($_POST['grouprequestID']);
- try {
- $this->groupRequestMapper->delete($groupRequest);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $membership = new Application_Model_Membership();
- $membership->setGroupID($groupRequest->getGroupID());
- $membership->setPersonID($groupRequest->getPersonID());
- $membership->setRoleID($_POST['roleID']);
- try {
- $this->membershipMapper->save($membership);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect("/dev/group/show/groupID/" . $groupRequest->getGroupID());
- }
- }
-
- public function revokepersonAction()
- {
- $this->_helper->viewRenderer->setNoRender();
- $membershipID = $this->_request->getParam('membershipID');
- if(isset($membershipID)) {
- $membership = $this->membershipMapper->find($membershipID);
- if(isset($membership)) {
- try {
- $this->membershipMapper->delete($membership);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect("/dev/group/edit/groupID/" . $membership->getGroupID());
- }
-
- }
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_GroupController extends Zend_Controller_Action {
+ protected $groupMapper;
+ protected $groupGroupsMapper;
+ protected $membershipMapper;
+ protected $groupRequestMapper;
+ protected $personmapper;
+ protected $rolemapper;
+ protected $groupList;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->groupMapper = new Application_Model_GroupMapper();
+ $this->groupGroupsMapper = new Application_Model_GroupGroupsMapper();
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->groupRequestMapper = new Application_Model_GroupRequestMapper();
+ $this->personmapper = new Application_Model_PersonMapper();
+ $this->rolemapper = new Application_Model_RoleMapper();
+ $this->groupList = $this->groupMapper->fetchAll();
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ }
+
+ public function indexAction() {
+ $this->view->groupList = $this->groupList;
+ }
+
+ public function addAction() {
+ if (!isset($_POST["add"])) {
+ $addForm = new dev_Form_GroupAdd(array('grouplist' => $this->groupList));
+ } else {
+ $addForm = new dev_Form_GroupAdd(array('grouplist' => $this->groupList), $_POST);
+
+ if ($addForm->isValid($_POST)) {
+ $group = new Application_Model_Group($_POST);
+ try {
+ $this->groupMapper->save($group);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ if($_POST['superordinatedGroupID'] != -1) {
+ $lastID = $this->groupMapper->getDbTable()->getDefaultAdapter()->lastInsertId();
+ $groupgroups = new Application_Model_GroupGroups();
+ $groupgroups->setParentID($_POST['superordinatedGroupID']);
+ $groupgroups->setGroupID($lastID);
+ try {
+ $this->groupGroupsMapper->save($groupgroups);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+
+ }
+ $this->_helper->redirector('', 'group');
+ return;
+ }
+ }
+
+ $this->view->addForm = $addForm;
+ }
+
+ public function editAction() {
+ $groupID = $this->_request->getParam('groupID');
+ if(!isset($groupID)) {
+ $addForm = new dev_Form_GroupAdd(array('grouplist' => $this->groupList));
+ $this->view->addForm = $addForm;
+ return;
+ }
+ if (!isset($_POST["save"])) {
+ $group = $this->groupMapper->find($groupID);
+ $_POST['title'] = $group->getTitle();
+ $_POST['description'] = $group->getDescription();
+ $editForm = new dev_Form_GroupEdit();
+ } else {
+ $editForm = new dev_Form_GroupEdit($_POST);
+ if ($editForm->isValid($_POST)) {
+ $group = new Application_Model_Group($_POST);
+ $group->setID($this->_request->getParam('groupID'));
+ try {
+ $this->groupMapper->save($group);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('', 'group');
+ return;
+ }
+ }
+
+ $this->view->editForm = $editForm;
+
+ }
+
+ public function showAction() {
+ $groupID = $this->_request->getParam('groupID');
+ if($groupID) {
+ $groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID), true);
+ if(isset($groupRequests)) {
+ foreach($groupRequests as $groupRequest) {
+ $person = $this->personmapper->find($groupRequest['personID']);
+ $groupRequestList[] = array(
+ 'grouprequestID' => $groupRequest['grouprequestID'],
+ 'person' => $person
+ );
+ }
+ if(is_array($groupRequestList)) {
+ $this->view->groupRequestList = $groupRequestList;
+ }
+ $this->view->roleList = $this->rolemapper->findBy('groupID', $groupID);
+ }
+ $members = $this->membershipMapper->findBy('groupID', $groupID);
+ if(isset($members)) {
+ foreach($members as $member) {
+ $person = $this->personmapper->find($member['personID']);
+ $membersList[] = array(
+ 'membershipID' => $member['membershipID'],
+ 'person' => $person
+ );
+ }
+ if(is_array($membersList)) {
+ $this->view->membersList = $membersList;
+ }
+ }
+ $groupgroups = $this->groupGroupsMapper->findBy('groupID', $groupID);
+ if(is_object($groupgroups)) {
+ $parentGroup = $this->groupMapper->find($groupgroups->getParentID());
+ $this->view->$parentGroup = $parentGroup;
+ }
+ $group = $this->groupMapper->find($groupID);
+ $this->view->group = $group;
+ $this->view->groupID = $groupID;
+ }
+ }
+
+ public function linkAction() {
+ if (!isset($_POST["link"])) {
+ $linkForm = new dev_Form_GroupLink(array('grouplist' => $this->groupList));
+ } else {
+ $linkForm = new dev_Form_GroupLink(array('grouplist' => $this->groupList), $_POST);
+
+ if ($linkForm->isValid($_POST)) {
+ $groupgroups = new Application_Model_GroupGroups();
+ $groupgroups->setParentID($_POST['superordinatedGroupID']);
+ $groupgroups->setGroupID($_POST['groupID']);
+ try {
+ $this->groupGroupsMapper->save($groupgroups);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('', 'group');
+ return;
+ }
+ }
+
+ $this->view->linkForm = $linkForm;
+ }
+
+ public function deleteAction() {
+ $this->_helper->viewRenderer->setNoRender();
+ $groupID = $this->_request->getParam('groupID');
+ if (isset($groupID)) {
+ $group = $this->groupMapper->find($groupID);
+ try {
+ $this->groupMapper->delete($group);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('', 'group');
+ return;
+ }
+ }
+
+ public function grantpersonAction() {
+ $this->_helper->viewRenderer->setNoRender();
+ if(isset($_POST['grouprequestID']) && isset($_POST['roleID'])) {
+ $groupRequest = $this->groupRequestMapper->find($_POST['grouprequestID']);
+ try {
+ $this->groupRequestMapper->delete($groupRequest);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $membership = new Application_Model_Membership();
+ $membership->setGroupID($groupRequest->getGroupID());
+ $membership->setPersonID($groupRequest->getPersonID());
+ $membership->setRoleID($_POST['roleID']);
+ try {
+ $this->membershipMapper->save($membership);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/dev/group/show/groupID/" . $groupRequest->getGroupID());
+ }
+ }
+
+ public function revokepersonAction() {
+ $this->_helper->viewRenderer->setNoRender();
+ $membershipID = $this->_request->getParam('membershipID');
+ if(isset($membershipID)) {
+ $membership = $this->membershipMapper->find($membershipID);
+ if(isset($membership)) {
+ try {
+ $this->membershipMapper->delete($membership);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/dev/group/edit/groupID/" . $membership->getGroupID());
+ }
+
+ }
+ }
}
diff --git a/application/modules/dev/controllers/IndexController.php b/application/modules/dev/controllers/IndexController.php
index 2b8873d..cbf4e77 100644
--- a/application/modules/dev/controllers/IndexController.php
+++ b/application/modules/dev/controllers/IndexController.php
@@ -1,28 +1,25 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_IndexController extends Zend_Controller_Action
-{
-
- public function init()
- {
- /* Initialize action controller here */
- }
-
- public function indexAction()
- {
- // action body
-
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_IndexController extends Zend_Controller_Action {
+
+ public function init() {
+ /* Initialize action controller here */
+ }
+
+ public function indexAction() {
+ // action body
+
+ }
}
diff --git a/application/modules/dev/controllers/PersonController.php b/application/modules/dev/controllers/PersonController.php
index 25c415a..3119ab9 100644
--- a/application/modules/dev/controllers/PersonController.php
+++ b/application/modules/dev/controllers/PersonController.php
@@ -1,176 +1,167 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_PersonController extends Zend_Controller_Action
-{
- protected $person;
- protected $personmapper;
- protected $membershipMapper;
- protected $memberships;
- protected $groupMapper;
- protected $groups;
- protected $groupRequestMapper;
-
- public function init() {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $this->person = new Application_Model_Person($result[0]);
- $this->person->setID($result[0]['personID']);
- $this->groupMapper = new Application_Model_GroupMapper();
- $this->groupRequestMapper = new Application_Model_GroupRequestMapper();
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->memberships = $this->membershipMapper->findBy("personID",$this->person->getID());
- if(isset($this->memberships)) {
- foreach($this->memberships as $membership) {
- $group = $this->groupMapper->find($membership['groupID']);
- $this->groups[] = array (
- 'groupID' => $group->getID(),
- 'title' => $group->getTitle(),
- 'description' => $group->getDescription(),
- 'membershipID' => $membership['membershipID']
- );
- }
- }
- } else {
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
-
- public function indexAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- $this->_helper->redirector('show', 'person');
- return;
- }
-
- public function showAction()
- {
- $this->view->person = $this->person;
- $this->view->groups = $this->groups;
- }
-
- public function editAction()
- {
- $this->view->person = $this->person;
- if (!isset($_POST["save"])){
- $editForm = new dev_Form_PersonEdit();
- } else {
- $editForm = new dev_Form_PersonEdit($_POST);
- if ($editForm->isValid($_POST)) {
- if(isset($_POST['newpassword'])) {
- $date = new DateTime();
- $this->person->setPassword($_POST['newpassword']);
- $this->person->setPasswordSalt(MD5($date->getTimestamp()));
- $this->person->setPassword(MD5($this->person->getPassword() . $this->person->getPasswordSalt()));
- }
- $this->person->setOptions($_POST);
- try {
- $this->personmapper->save($this->person);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- echo "Email Address already existing.";
- return;
- }
- $this->_helper->redirector('show', 'person');
- return;
- }
- }
- $this->view->editForm = $editForm;
- }
-
- public function requestAction()
- {
- $this->view->person = $this->person;
- $allgroups = $this->groupMapper->fetchAll();
- $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()),true);
- $count = 0;
- foreach($allgroups as $group) {
- foreach($groupRequests as $groupRequest) {
- if($groupRequest['groupID'] == $group->getID()) {
- $groupsFound[$count] = true;
- } else {
- $groupsFound[$count] = false;
- }
- }
- foreach($this->memberships as $membership) {
- if($membership['groupID'] == $group->getID()) {
- $groupsFound[$count] = true;
- } else {
- if($groupsFound[$count] != true) {
- $groupsFound[$count] = false;
- }
- }
- }
- $count++;
- }
- if(count($groupsFound) > 0) {
- foreach($groupsFound as $k => $v) {
- if($v == true) {
- unset($allgroups[$k]);
- }
- }
- }
- if (!isset($_POST["request"])){
- if(count($allgroups) <= 0) {
- echo "No Groups to choose.";
- }
- $requestForm = new dev_Form_GroupRequest(array('grouplist' => $allgroups));
- } else {
- $requestForm = new dev_Form_GroupRequest(array('grouplist' => $allgroups), $_POST);
- if ($requestForm->isValid($_POST)) {
- $groupRequestMapper = new Application_Model_GroupRequestMapper();
- $groupRequest = new Application_Model_GroupRequest();
- $groupRequest->setGroupID($_POST['groupID']);
- $date = new DateTime();
- $groupRequest->setTime($date->getTimestamp());
- $groupRequest->setPersonID($this->person->getID());
- try {
- $groupRequestMapper->save($groupRequest);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('show', 'person');
- return;
- }
- }
- $this->view->requestForm = $requestForm;
- }
-
- public function leaveAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- $this->view->person = $this->person;
- $membershipID = $this->_request->getParam('membershipID');
- if(isset($membershipID)) {
- $membership = $this->membershipMapper->find($membershipID);
- try {
- $this->membershipMapper->delete($membership);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('show', 'person');
- return;
- }
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_PersonController extends Zend_Controller_Action {
+ protected $person;
+ protected $personmapper;
+ protected $membershipMapper;
+ protected $memberships;
+ protected $groupMapper;
+ protected $groups;
+ protected $groupRequestMapper;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()), true);
+ $this->person = new Application_Model_Person($result[0]);
+ $this->person->setID($result[0]['personID']);
+ $this->groupMapper = new Application_Model_GroupMapper();
+ $this->groupRequestMapper = new Application_Model_GroupRequestMapper();
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->memberships = $this->membershipMapper->findBy("personID", $this->person->getID());
+ if(isset($this->memberships)) {
+ foreach($this->memberships as $membership) {
+ $group = $this->groupMapper->find($membership['groupID']);
+ $this->groups[] = array (
+ 'groupID' => $group->getID(),
+ 'title' => $group->getTitle(),
+ 'description' => $group->getDescription(),
+ 'membershipID' => $membership['membershipID']
+ );
+ }
+ }
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ }
+
+ public function indexAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ $this->_helper->redirector('show', 'person');
+ return;
+ }
+
+ public function showAction() {
+ $this->view->person = $this->person;
+ $this->view->groups = $this->groups;
+ }
+
+ public function editAction() {
+ $this->view->person = $this->person;
+ if (!isset($_POST["save"])) {
+ $editForm = new dev_Form_PersonEdit();
+ } else {
+ $editForm = new dev_Form_PersonEdit($_POST);
+ if ($editForm->isValid($_POST)) {
+ if(isset($_POST['newpassword'])) {
+ $date = new DateTime();
+ $this->person->setPassword($_POST['newpassword']);
+ $this->person->setPasswordSalt(MD5($date->getTimestamp()));
+ $this->person->setPassword(MD5($this->person->getPassword() . $this->person->getPasswordSalt()));
+ }
+ $this->person->setOptions($_POST);
+ try {
+ $this->personmapper->save($this->person);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ echo "Email Address already existing.";
+ return;
+ }
+ $this->_helper->redirector('show', 'person');
+ return;
+ }
+ }
+ $this->view->editForm = $editForm;
+ }
+
+ public function requestAction() {
+ $this->view->person = $this->person;
+ $allgroups = $this->groupMapper->fetchAll();
+ $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()), true);
+ $count = 0;
+ foreach($allgroups as $group) {
+ foreach($groupRequests as $groupRequest) {
+ if($groupRequest['groupID'] == $group->getID()) {
+ $groupsFound[$count] = true;
+ } else {
+ $groupsFound[$count] = false;
+ }
+ }
+ foreach($this->memberships as $membership) {
+ if($membership['groupID'] == $group->getID()) {
+ $groupsFound[$count] = true;
+ } else {
+ if($groupsFound[$count] != true) {
+ $groupsFound[$count] = false;
+ }
+ }
+ }
+ $count++;
+ }
+ if(count($groupsFound) > 0) {
+ foreach($groupsFound as $k => $v) {
+ if($v == true) {
+ unset($allgroups[$k]);
+ }
+ }
+ }
+ if (!isset($_POST["request"])) {
+ if(count($allgroups) <= 0) {
+ echo "No Groups to choose.";
+ }
+ $requestForm = new dev_Form_GroupRequest(array('grouplist' => $allgroups));
+ } else {
+ $requestForm = new dev_Form_GroupRequest(array('grouplist' => $allgroups), $_POST);
+ if ($requestForm->isValid($_POST)) {
+ $groupRequestMapper = new Application_Model_GroupRequestMapper();
+ $groupRequest = new Application_Model_GroupRequest();
+ $groupRequest->setGroupID($_POST['groupID']);
+ $date = new DateTime();
+ $groupRequest->setTime($date->getTimestamp());
+ $groupRequest->setPersonID($this->person->getID());
+ try {
+ $groupRequestMapper->save($groupRequest);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('show', 'person');
+ return;
+ }
+ }
+ $this->view->requestForm = $requestForm;
+ }
+
+ public function leaveAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ $this->view->person = $this->person;
+ $membershipID = $this->_request->getParam('membershipID');
+ if(isset($membershipID)) {
+ $membership = $this->membershipMapper->find($membershipID);
+ try {
+ $this->membershipMapper->delete($membership);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('show', 'person');
+ return;
+ }
+ }
}
diff --git a/application/modules/dev/controllers/PoolController.php b/application/modules/dev/controllers/PoolController.php
index 6f80468..6e31161 100644
--- a/application/modules/dev/controllers/PoolController.php
+++ b/application/modules/dev/controllers/PoolController.php
@@ -1,175 +1,167 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_PoolController extends Zend_Controller_Action
-{
-
- public function init()
- {
- /* Initialize action controller here */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_PoolController extends Zend_Controller_Action {
+
+ public function init() {
+ /* Initialize action controller here */
+ }
+
+ public function indexAction() {
+ $poolMapper = new Application_Model_PoolMapper();
+ $this->view->pools = $poolMapper->fetchAll();
+
+ $clientmapper = new Application_Model_ClientMapper();
+ $clients = $clientmapper->fetchAll();
+ foreach($clients as $c) {
+#$client = new Application_Model_Client($c);
+ $clientsArray[] = $c->toArray();
}
-
- public function indexAction()
- {
- $poolMapper = new Application_Model_PoolMapper();
- $this->view->pools = $poolMapper->fetchAll();
-
- $clientmapper = new Application_Model_ClientMapper();
- $clients = $clientmapper->fetchAll();
- foreach($clients as $c){
- #$client = new Application_Model_Client($c);
- $clientsArray[] = $c->toArray();
- }
- $assignedclientmapper = new Application_Model_PoolEntriesMapper();
- $assignedclients = $assignedclientmapper->fetchAll();
- foreach($assignedclients as $c){
- $assignedclientsArray[] = $c->toArray();
- }
- $freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray);
-
- $this->view->freeclients = $freeclients;
-
+ $assignedclientmapper = new Application_Model_PoolEntriesMapper();
+ $assignedclients = $assignedclientmapper->fetchAll();
+ foreach($assignedclients as $c) {
+ $assignedclientsArray[] = $c->toArray();
}
-
- public function createpoolAction()
- {
- if (!isset($_POST["add"])){
- $addfilterform = new dev_Form_Pool(array('buttontext' => 'Create Pool'));
- $this->view->addpool = $addfilterform;
- }else {
- $addpoolform = new dev_Form_Pool(array('buttontext' => 'Create Pool'),$_POST);
- if ($addpoolform->isValid($_POST)) {
- try{
- $pool = new Application_Model_Pool($_POST);
- $poolmapper = new Application_Model_PoolMapper();
- $poolmapper->save($pool);
- $this->_redirect('/dev/pool');
- return;
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
- $this->view->addpool = $addfilterform;
- }
+ $freeclients = $this->arrayDiff($clientsArray, $assignedclientsArray);
+
+ $this->view->freeclients = $freeclients;
+
+ }
+
+ public function createpoolAction() {
+ if (!isset($_POST["add"])) {
+ $addfilterform = new dev_Form_Pool(array('buttontext' => 'Create Pool'));
+ $this->view->addpool = $addfilterform;
+ } else {
+ $addpoolform = new dev_Form_Pool(array('buttontext' => 'Create Pool'), $_POST);
+ if ($addpoolform->isValid($_POST)) {
+ try {
+ $pool = new Application_Model_Pool($_POST);
+ $poolmapper = new Application_Model_PoolMapper();
+ $poolmapper->save($pool);
+ $this->_redirect('/dev/pool');
+ return;
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+ $this->view->addpool = $addfilterform;
}
-
- public function deletepoolAction()
- {
- $poolID = $this->_request->getParam('poolID');
- // TODO: ACL implementieren ob er den pool löschen darf
- if(is_numeric($poolID)){
- $deletepool = new Application_Model_Pool();
- $deletepool->setID($poolID);
- $poolmapper = new Application_Model_PoolMapper();
- $poolmapper->delete($deletepool);
- }
- $this->_redirect('/dev/pool');
+ }
+
+ public function deletepoolAction() {
+ $poolID = $this->_request->getParam('poolID');
+ // TODO: ACL implementieren ob er den pool löschen darf
+ if(is_numeric($poolID)) {
+ $deletepool = new Application_Model_Pool();
+ $deletepool->setID($poolID);
+ $poolmapper = new Application_Model_PoolMapper();
+ $poolmapper->delete($deletepool);
}
-
- public function editpoolAction()
- {
- if (!isset($_POST["add"])){
- $poolID = $this->_request->getParam('poolID');
-
- $pool = new Application_Model_Pool();
- $poolmapper = new Application_Model_PoolMapper();
- $poolmapper->find($poolID,$pool);
- $poolArray = $pool->toArray();
-
- $editpool = new dev_Form_Pool(array('buttontext' => 'Edit Pool'));
- $editpool->populate($poolArray);
- $this->view->editpoolform = $editpool;
-
- }else {
- $editpoolform = new dev_Form_Pool(array('buttontext' => 'Edit Pool'),$_POST);
- if ($editpoolform->isValid($_POST)) {
- try{
- $pool = new Application_Model_Pool($_POST);
- $pool->setID($this->_request->getParam('poolID'));
- $poolmapper = new Application_Model_PoolMapper();
- $poolmapper->save($pool);
- $this->_redirect('/dev/pool');
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
- $this->view->editpoolform = $editpoolform;
- }
+ $this->_redirect('/dev/pool');
+ }
+
+ public function editpoolAction() {
+ if (!isset($_POST["add"])) {
+ $poolID = $this->_request->getParam('poolID');
+
+ $pool = new Application_Model_Pool();
+ $poolmapper = new Application_Model_PoolMapper();
+ $poolmapper->find($poolID, $pool);
+ $poolArray = $pool->toArray();
+
+ $editpool = new dev_Form_Pool(array('buttontext' => 'Edit Pool'));
+ $editpool->populate($poolArray);
+ $this->view->editpoolform = $editpool;
+
+ } else {
+ $editpoolform = new dev_Form_Pool(array('buttontext' => 'Edit Pool'), $_POST);
+ if ($editpoolform->isValid($_POST)) {
+ try {
+ $pool = new Application_Model_Pool($_POST);
+ $pool->setID($this->_request->getParam('poolID'));
+ $poolmapper = new Application_Model_PoolMapper();
+ $poolmapper->save($pool);
+ $this->_redirect('/dev/pool');
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+ $this->view->editpoolform = $editpoolform;
}
+ }
+
+ public function linkclientAction() {
+ $clientID = $this->_request->getParam('clientID');
+ $poolID = $this->_request->getParam('poolID');
+ if(!isset($_POST['clientID']) && ($clientID == '')) {
+ $clientmapper = new Application_Model_ClientMapper();
+ $clients = $clientmapper->fetchAll();
+ foreach($clients as $c) {
+ $clientsArray[] = $c->toArray();
+ }
+ $assignedclientmapper = new Application_Model_PoolEntriesMapper();
+ $assignedclients = $assignedclientmapper->fetchAll();
+ foreach($assignedclients as $c) {
+ $assignedclientsArray[] = $c->toArray();
+ }
+ $freeclients = $this->arrayDiff($clientsArray, $assignedclientsArray);
+
+ $poolclient = new dev_Form_PoolClient(array('buttontext' => 'Link Client', 'clients' => $freeclients));
+ $this->view->poolclient = $poolclient;
+ } else {
+ $poolclient = new dev_Form_PoolClient(array('buttontext' => 'Link Client'), $_POST);
+ try {
+ $pool = new Application_Model_PoolEntries($_POST);
+ $pool->setPoolID($this->_request->getParam('poolID'));
+ if($pool->getClientID() == '') {
+ $pool->setClientID($this->_request->getParam('clientID'));
+ }
+ $poolmapper = new Application_Model_PoolEntriesMapper();
+ $poolmapper->save($pool);
+ $this->_redirect('/dev/pool');
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ $this->view->poolclient = $poolclient;
- public function linkclientAction()
- {
- $clientID = $this->_request->getParam('clientID');
- $poolID = $this->_request->getParam('poolID');
- if(!isset($_POST['clientID']) && ($clientID == '')){
- $clientmapper = new Application_Model_ClientMapper();
- $clients = $clientmapper->fetchAll();
- foreach($clients as $c){
- $clientsArray[] = $c->toArray();
- }
- $assignedclientmapper = new Application_Model_PoolEntriesMapper();
- $assignedclients = $assignedclientmapper->fetchAll();
- foreach($assignedclients as $c){
- $assignedclientsArray[] = $c->toArray();
- }
- $freeclients = $this->arrayDiff($clientsArray,$assignedclientsArray);
-
- $poolclient = new dev_Form_PoolClient(array('buttontext' => 'Link Client','clients'=> $freeclients));
- $this->view->poolclient = $poolclient;
- }else {
- $poolclient = new dev_Form_PoolClient(array('buttontext' => 'Link Client'),$_POST);
- try{
- $pool = new Application_Model_PoolEntries($_POST);
- $pool->setPoolID($this->_request->getParam('poolID'));
- if($pool->getClientID() == ''){
- $pool->setClientID($this->_request->getParam('clientID'));
- }
- $poolmapper = new Application_Model_PoolEntriesMapper();
- $poolmapper->save($pool);
- $this->_redirect('/dev/pool');
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- $this->view->poolclient = $poolclient;
-
- }
}
- private function arrayDiff($a, $b){
- foreach($a as $k1 => $i1){
- foreach($b as $k2 => $i2){
- if($i1['clientID'] == $i2['clientID']){
- unset($a[$k1]);
- }
- }
- }
- return $a;
- }
-
-
- public function unlinkclientAction()
- {
- $poolentriesID = $this->_request->getParam('poolentriesID');
-
- // TODO: ACL implementieren ob er den filter löschen darf
- if(is_numeric($poolentriesID)){
- $deletepoolentries = new Application_Model_PoolEntries();
- $deletepoolentries->setID($poolentriesID);
-
- $deletepoolentriesmapper = new Application_Model_PoolEntriesMapper();
- $deletepoolentriesmapper->delete($deletepoolentries);
- echo "ok";
- }
- $this->_redirect('/dev/pool');
+ }
+ private function arrayDiff($a, $b) {
+ foreach($a as $k1 => $i1) {
+ foreach($b as $k2 => $i2) {
+ if($i1['clientID'] == $i2['clientID']) {
+ unset($a[$k1]);
+ }
+ }
+ }
+ return $a;
+ }
+
+
+ public function unlinkclientAction() {
+ $poolentriesID = $this->_request->getParam('poolentriesID');
+
+ // TODO: ACL implementieren ob er den filter löschen darf
+ if(is_numeric($poolentriesID)) {
+ $deletepoolentries = new Application_Model_PoolEntries();
+ $deletepoolentries->setID($poolentriesID);
+
+ $deletepoolentriesmapper = new Application_Model_PoolEntriesMapper();
+ $deletepoolentriesmapper->delete($deletepoolentries);
+ echo "ok";
}
+ $this->_redirect('/dev/pool');
+ }
}
diff --git a/application/modules/dev/controllers/PrebootController.php b/application/modules/dev/controllers/PrebootController.php
index c3933c6..4936d2c 100644
--- a/application/modules/dev/controllers/PrebootController.php
+++ b/application/modules/dev/controllers/PrebootController.php
@@ -1,206 +1,195 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_PrebootController extends Zend_Controller_Action
-{
-
- public function init()
- {
- $db = Zend_Db_Table::getDefaultAdapter();
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_PrebootController extends Zend_Controller_Action {
+
+ public function init() {
+ $db = Zend_Db_Table::getDefaultAdapter();
+ }
- public function indexAction()
- {
- $prebootmapper = new Application_Model_PreBootMapper();
- $groupmapper = new Application_Model_GroupMapper();
- $membershipmapper = new Application_Model_MembershipMapper();
- $personmapper = new Application_Model_PersonMapper();
-
- $this->view->prebootlist = $prebootmapper->fetchAll();
- $this->view->update = array();
-
- foreach ($this->view->prebootlist as $preboot){
- $this->view->update[$preboot->getID()] = $this->checkupdateAction($preboot);
- $preboot->setGroupID("[".$preboot->getGroupID()."] ".$groupmapper->find($preboot->getGroupID())->getTitle());
- $preboot->setMembershipID("[".$preboot->getMembershipID()."] ".$personmapper->find($membershipmapper->find($preboot->getMembershipID())->getPersonID())->getFirstname());
- }
+ public function indexAction() {
+ $prebootmapper = new Application_Model_PreBootMapper();
+ $groupmapper = new Application_Model_GroupMapper();
+ $membershipmapper = new Application_Model_MembershipMapper();
+ $personmapper = new Application_Model_PersonMapper();
+
+ $this->view->prebootlist = $prebootmapper->fetchAll();
+ $this->view->update = array();
+
+ foreach ($this->view->prebootlist as $preboot) {
+ $this->view->update[$preboot->getID()] = $this->checkupdateAction($preboot);
+ $preboot->setGroupID("[".$preboot->getGroupID()."] ".$groupmapper->find($preboot->getGroupID())->getTitle());
+ $preboot->setMembershipID("[".$preboot->getMembershipID()."] ".$personmapper->find($membershipmapper->find($preboot->getMembershipID())->getPersonID())->getFirstname());
}
-
- public function createprebootAction()
- {
- $groupmapper = new Application_Model_GroupMapper();
-
- if (!isset($_POST["createpreboot"])){
- $createprebootForm = new dev_Form_PrebootCreate(array('grouplist' => $groupmapper->fetchAll()));
- } else {
-
- $createprebootForm = new dev_Form_PrebootCreate(array('grouplist' => $groupmapper->fetchAll()),$_POST);
-
- if ($createprebootForm->isValid($_POST)) {
-
- $preboot = new Application_Model_PreBoot($_POST);
- $preboot->setMembershipID('1');
- $prebootmapper = new Application_Model_PreBootMapper();
-
- try {
-
- exec("wget --spider ".$preboot->getPath_preboot()." 2>&1 | grep 'Remote file exists.'", $exists_preboot);
-
- if(!array_pop($exists_preboot)){
- $this->view->createprebootForm = $createprebootForm;
- return;
- }
-
- $prebootID = $prebootmapper->save($preboot);
-
- $path_preboot = "../resources/bootmedium/$prebootID/";
- mkdir($path_preboot ,0777, true);
-
- exec("wget -O '".$path_preboot."preboot.zip' ".$preboot->getPath_preboot());
-
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
-
- }
- $this->_redirect('/dev/preboot');
- }
- }
-
+ }
+
+ public function createprebootAction() {
+ $groupmapper = new Application_Model_GroupMapper();
+
+ if (!isset($_POST["createpreboot"])) {
+ $createprebootForm = new dev_Form_PrebootCreate(array('grouplist' => $groupmapper->fetchAll()));
+ } else {
+
+ $createprebootForm = new dev_Form_PrebootCreate(array('grouplist' => $groupmapper->fetchAll()), $_POST);
+
+ if ($createprebootForm->isValid($_POST)) {
+
+ $preboot = new Application_Model_PreBoot($_POST);
+ $preboot->setMembershipID('1');
+ $prebootmapper = new Application_Model_PreBootMapper();
+
+ try {
+
+ exec("wget --spider ".$preboot->getPath_preboot()." 2>&1 | grep 'Remote file exists.'", $exists_preboot);
+
+ if(!array_pop($exists_preboot)) {
$this->view->createprebootForm = $createprebootForm;
+ return;
+ }
+
+ $prebootID = $prebootmapper->save($preboot);
+
+ $path_preboot = "../resources/bootmedium/$prebootID/";
+ mkdir($path_preboot , 0777, true);
+
+ exec("wget -O '".$path_preboot."preboot.zip' ".$preboot->getPath_preboot());
+
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+
+ }
+ $this->_redirect('/dev/preboot');
+ }
}
-
- public function checkupdateAction($preboot)
- {
- $prebootID = $preboot->getID();
- exec("wget --server-response --spider ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'Last-Modified:'", $prebootdate);
-
- //print_a($prebootdate);
-
- $prebootdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($prebootdate))));
-
- if(is_file("../resources/bootmedium/$prebootID/preboot.zip"))
- $prebootolddate = filemtime("../resources/bootmedium/".$prebootID."/preboot.zip");
- else
- $prebootolddate = false;
-
- //print_a($prebootname,$prebootdate,$prebootolddate);
-
-
- if($prebootdate > $prebootolddate)
- return true;
- else
- return false;
-
- }
-
- public function updateprebootAction()
- {
-
- $prebootID = $this->_request->getParam('prebootID');
-
- $prebootmapper = new Application_Model_PreBootMapper();
- $preboot = new Application_Model_PreBoot();
- $prebootmapper->find($prebootID,$preboot);
-
- $path_preboot = "../resources/bootmedium/$prebootID/";
-
- exec("wget -O '".$path_preboot."preboot.zip' ".$preboot->getPath_preboot());
-
- $filelist = array();
- $filelist = scandir($path_preboot);
-
- $bootisoMapper = new Application_Model_BootIsoMapper();
-
- foreach($filelist as $file){
- if($file == "." || $file == ".." || $file == "preboot.zip"){
- //do nothing
- }
- else{
- $bootisoID = str_replace('.zip', '', $file);
- $serialnumber = $bootisoMapper->find($bootisoID)->getSerialnumber();
-
- copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
- $zip = new ZipArchive();
- $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
- if($res === true){
- $rootdir = $zip->getNameIndex(0);
- $zip->addFromString($rootdir."build/rootfs/serial", $serialnumber);
- $zip->close();
- }
- }
- }
-
- $this->_redirect('/dev/preboot');
+
+ $this->view->createprebootForm = $createprebootForm;
+ }
+
+ public function checkupdateAction($preboot) {
+ $prebootID = $preboot->getID();
+ exec("wget --server-response --spider ".escapeshellcmd($preboot->getPath_preboot())." 2>&1 | grep 'Last-Modified:'", $prebootdate);
+
+ //print_a($prebootdate);
+
+ $prebootdate = strtotime(trim(str_replace('Last-Modified:', '', array_pop($prebootdate))));
+
+ if(is_file("../resources/bootmedium/$prebootID/preboot.zip"))
+ { $prebootolddate = filemtime("../resources/bootmedium/".$prebootID."/preboot.zip"); }
+ else
+ { $prebootolddate = false; }
+
+ //print_a($prebootname,$prebootdate,$prebootolddate);
+
+
+ if($prebootdate > $prebootolddate)
+ { return true; }
+ else
+ { return false; }
+
+ }
+
+ public function updateprebootAction() {
+
+ $prebootID = $this->_request->getParam('prebootID');
+
+ $prebootmapper = new Application_Model_PreBootMapper();
+ $preboot = new Application_Model_PreBoot();
+ $prebootmapper->find($prebootID, $preboot);
+
+ $path_preboot = "../resources/bootmedium/$prebootID/";
+
+ exec("wget -O '".$path_preboot."preboot.zip' ".$preboot->getPath_preboot());
+
+ $filelist = array();
+ $filelist = scandir($path_preboot);
+
+ $bootisoMapper = new Application_Model_BootIsoMapper();
+
+ foreach($filelist as $file) {
+ if($file == "." || $file == ".." || $file == "preboot.zip") {
+ //do nothing
+ } else {
+ $bootisoID = str_replace('.zip', '', $file);
+ $serialnumber = $bootisoMapper->find($bootisoID)->getSerialnumber();
+
+ copy("../resources/bootmedium/$prebootID/preboot.zip", "../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/$bootisoID".".zip");
+ if($res == = true) {
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/serial", $serialnumber);
+ $zip->close();
+ }
+ }
}
- public function editprebootAction()
- {
- $prebootID = $this->_request->getParam('prebootID');
- $groupmapper = new Application_Model_GroupMapper();
-
- if (!isset($_POST["editpreboot"])){
- $prebootID = $this->_request->getParam('prebootID');
- if (!isset($prebootID) || !is_numeric($prebootID)){
- $this->_redirect('/dev/preboot');
- } else {
- $preboot = new Application_Model_PreBoot();
- $prebootmapper = new Application_Model_PreBootMapper();
- $prebootmapper->find($prebootID, $preboot);
-
- $editprebootForm = new dev_Form_PrebootEdit(array('grouplist' => $groupmapper->fetchAll()));
- $editprebootForm->populate($preboot->toArray());
- }
- }else{
- $editprebootForm = new dev_Form_PrebootEdit(array('grouplist' => $groupmapper->fetchAll()),$_POST);
-
- if ($editprebootForm->isValid($_POST)) {
-
- $preboot = new Application_Model_PreBoot($_POST);
- $preboot->setMembershipID('1');
- $prebootmapper = new Application_Model_PreBootMapper();
- $preboot->setID($prebootID);
-
- try {
- $prebootmapper->save($preboot);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- }
-
- $this->_redirect('/dev/preboot');
- }
-
- }
-
- $this->view->editprebootForm = $editprebootForm;
+ $this->_redirect('/dev/preboot');
+ }
+
+ public function editprebootAction() {
+ $prebootID = $this->_request->getParam('prebootID');
+ $groupmapper = new Application_Model_GroupMapper();
+
+ if (!isset($_POST["editpreboot"])) {
+ $prebootID = $this->_request->getParam('prebootID');
+ if (!isset($prebootID) || !is_numeric($prebootID)) {
+ $this->_redirect('/dev/preboot');
+ } else {
+ $preboot = new Application_Model_PreBoot();
+ $prebootmapper = new Application_Model_PreBootMapper();
+ $prebootmapper->find($prebootID, $preboot);
+
+ $editprebootForm = new dev_Form_PrebootEdit(array('grouplist' => $groupmapper->fetchAll()));
+ $editprebootForm->populate($preboot->toArray());
+ }
+ } else {
+ $editprebootForm = new dev_Form_PrebootEdit(array('grouplist' => $groupmapper->fetchAll()), $_POST);
+
+ if ($editprebootForm->isValid($_POST)) {
+
+ $preboot = new Application_Model_PreBoot($_POST);
+ $preboot->setMembershipID('1');
+ $prebootmapper = new Application_Model_PreBootMapper();
+ $preboot->setID($prebootID);
+
+ try {
+ $prebootmapper->save($preboot);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ }
+
+ $this->_redirect('/dev/preboot');
+ }
+
}
- public function deleteprebootAction()
- {
- $prebootID = $this->_request->getParam('prebootID');
- if (!isset($prebootID)){
- $this->_redirect('/dev/preboot');
- } else {
- $preboot = new Application_Model_PreBoot();
- $preboot->setID($prebootID);
- $prebootmapper = new Application_Model_PreBootMapper();
- $prebootmapper->delete($preboot);
- }
- $this->_redirect('/dev/preboot');
+ $this->view->editprebootForm = $editprebootForm;
+ }
+
+ public function deleteprebootAction() {
+ $prebootID = $this->_request->getParam('prebootID');
+ if (!isset($prebootID)) {
+ $this->_redirect('/dev/preboot');
+ } else {
+ $preboot = new Application_Model_PreBoot();
+ $preboot->setID($prebootID);
+ $prebootmapper = new Application_Model_PreBootMapper();
+ $prebootmapper->delete($preboot);
}
+ $this->_redirect('/dev/preboot');
+ }
}
diff --git a/application/modules/dev/controllers/ResourceController.php b/application/modules/dev/controllers/ResourceController.php
index 6889f9b..0c5fa85 100644
--- a/application/modules/dev/controllers/ResourceController.php
+++ b/application/modules/dev/controllers/ResourceController.php
@@ -1,172 +1,163 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_ResourceController extends Zend_Controller_Action
-{
-
- private $thisSession;
-
- public function init()
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- $alphasessionID = $this->_request->getParam('alpha');
- $session = new Application_Model_Session();
- $sm = new Application_Model_SessionMapper();
- $result = $sm->findBy(array('alphasessionID' => $alphasessionID), true);
- # print_a($result);
- $this->thisSession = $session->setOptions($result[0]);
- $this->thisSession->setID($result[0]['sessionID']);
- }
-
- public function indexAction()
- {
-
-
- }
-
- public function getinitramfsAction()
- {
-
- $bootosID = $this->thisSession->getBootosID();
-
- if(is_dir("../resources/bootos/$bootosID/initramfs/") && is_numeric($bootosID)){
-
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="initramfs"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- // create file.
- chdir("../resources/bootos/$bootosID/initramfs/");
- $initname = array_pop(scandir("./"));
-
- passthru( "cat ".$initname);
- }
- }
-
- public function getconfigAction()
- {
- $bootmenuentryID = $this->thisSession->getBootmenuentryID();
-
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bmm = new Application_Model_BootMenuEntriesMapper();
- $bmm->find($bootmenuentryID,$bootmenuentry);
- # print_a($bootmenuentry);
-
- $configID = $bootmenuentry->getConfigID();
-
- if(is_dir("../resources/config/$configID/config/") && is_numeric($configID)){
-
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="config.tgz"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- // create the gzipped tarfile.
- chdir("../resources/config/$configID/config/");
- passthru( "tar cz ./");
- }
- }
-
- public function getkernelAction()
- {
- $bootosID = $this->thisSession->getBootosID();
-
- if(is_dir("../resources/bootos/$bootosID/kernel/") && is_numeric($bootosID)){
-
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="kernel"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- // create the gzipped tarfile.
- chdir("../resources/bootos/$bootosID/kernel/");
- $kernelname = array_pop(scandir("./"));
-
- passthru( "cat ". $kernelname);
- }
- }
-
- public function getkclAction()
- {
- $bmeID = $this->thisSession->getBootmenuentryID();
-
- if(is_numeric($bmeID)){
-
- $bmemapper = new Application_Model_BootMenuEntriesMapper();
- $bme = new Application_Model_BootMenuEntries();
- $bmemapper->find($bmeID,$bme);
-
- header('Content-Type: text/html');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="kcl.txt"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- if($bme->getKcl() != null)
- $result = $bme->getKcl() . " " . $bme->getKclappend();
- else
- $result = $bme->getKclappend();
-
- echo $result;
-
-
- }
-
- }
-
- public function getbootmenuentryAction()
- {
- // obsolete function (now only for debugging)
- // after selecting the BootOS it will be saved in session
- // so getkclAction, getkernelAction, getconfigAction and getinitramfsAction
- // can be called with session-identifier
- $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
- $bootosID = $this->_request->getParam('bootosID');
-
- $this->thisSession->setBootosID($bootosID)->setBootmenuentryID($bootmenuentryID);
- $sessionMapper = new Application_Model_SessionMapper();
- $sessionMapper->save($this->thisSession);
-
- if($this->thisSession->getBootmenuentryID() != null){
- header('Content-Type: application/json');
- $return_val =
- array(
- 'info' => 'This function is for debugging purpose only',
- 'kernel' => $this->generateURL('getkernel', 'alpha', $_SESSION['alphasessionID'], "kernel"),
- 'initramfs' => $this->generateURL('getinitramfs', 'alpha', $_SESSION['alphasessionID'], "initramfs"),
- 'kcl' => $this->generateURL('getkcl', 'alpha', $_SESSION['alphasessionID'], "kcl.txt"),
- 'config' => $_SESSION['alphasessionID']
- );
- echo json_encode($return_val);
- }
- else{
- echo json_encode(
- array( 'info' => 'This function is for debugging purpose only',
- 'error'=> 'your session is out of date')
- );
- }
- }
-
- private function generateURL($action, $varname, $varvalue, $filename){
- $path = '/dev/resource/'. $action .'/' . $varname .'/' . $varvalue .'/file/' . $filename ;
- $path = "http://" . $_SERVER['SERVER_NAME'] . $path;
- return $path;
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_ResourceController extends Zend_Controller_Action {
+
+ private $thisSession;
+
+ public function init() {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $alphasessionID = $this->_request->getParam('alpha');
+ $session = new Application_Model_Session();
+ $sm = new Application_Model_SessionMapper();
+ $result = $sm->findBy(array('alphasessionID' => $alphasessionID), true);
+# print_a($result);
+ $this->thisSession = $session->setOptions($result[0]);
+ $this->thisSession->setID($result[0]['sessionID']);
+ }
+
+ public function indexAction() {
+
+
+ }
+
+ public function getinitramfsAction() {
+
+ $bootosID = $this->thisSession->getBootosID();
+
+ if(is_dir("../resources/bootos/$bootosID/initramfs/") && is_numeric($bootosID)) {
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="initramfs"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create file.
+ chdir("../resources/bootos/$bootosID/initramfs/");
+ $initname = array_pop(scandir("./"));
+
+ passthru( "cat ".$initname);
+ }
+ }
+
+ public function getconfigAction() {
+ $bootmenuentryID = $this->thisSession->getBootmenuentryID();
+
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bmm = new Application_Model_BootMenuEntriesMapper();
+ $bmm->find($bootmenuentryID, $bootmenuentry);
+# print_a($bootmenuentry);
+
+ $configID = $bootmenuentry->getConfigID();
+
+ if(is_dir("../resources/config/$configID/config/") && is_numeric($configID)) {
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="config.tgz"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create the gzipped tarfile.
+ chdir("../resources/config/$configID/config/");
+ passthru( "tar cz ./");
+ }
+ }
+
+ public function getkernelAction() {
+ $bootosID = $this->thisSession->getBootosID();
+
+ if(is_dir("../resources/bootos/$bootosID/kernel/") && is_numeric($bootosID)) {
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="kernel"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create the gzipped tarfile.
+ chdir("../resources/bootos/$bootosID/kernel/");
+ $kernelname = array_pop(scandir("./"));
+
+ passthru( "cat ". $kernelname);
+ }
+ }
+
+ public function getkclAction() {
+ $bmeID = $this->thisSession->getBootmenuentryID();
+
+ if(is_numeric($bmeID)) {
+
+ $bmemapper = new Application_Model_BootMenuEntriesMapper();
+ $bme = new Application_Model_BootMenuEntries();
+ $bmemapper->find($bmeID, $bme);
+
+ header('Content-Type: text/html');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="kcl.txt"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ if($bme->getKcl() != null)
+ { $result = $bme->getKcl() . " " . $bme->getKclappend(); }
+ else
+ { $result = $bme->getKclappend(); }
+
+ echo $result;
+
+
+ }
+
+ }
+
+ public function getbootmenuentryAction() {
+ // obsolete function (now only for debugging)
+ // after selecting the BootOS it will be saved in session
+ // so getkclAction, getkernelAction, getconfigAction and getinitramfsAction
+ // can be called with session-identifier
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ $bootosID = $this->_request->getParam('bootosID');
+
+ $this->thisSession->setBootosID($bootosID)->setBootmenuentryID($bootmenuentryID);
+ $sessionMapper = new Application_Model_SessionMapper();
+ $sessionMapper->save($this->thisSession);
+
+ if($this->thisSession->getBootmenuentryID() != null) {
+ header('Content-Type: application/json');
+ $return_val =
+ array(
+ 'info' => 'This function is for debugging purpose only',
+ 'kernel' => $this->generateURL('getkernel', 'alpha', $_SESSION['alphasessionID'], "kernel"),
+ 'initramfs' => $this->generateURL('getinitramfs', 'alpha', $_SESSION['alphasessionID'], "initramfs"),
+ 'kcl' => $this->generateURL('getkcl', 'alpha', $_SESSION['alphasessionID'], "kcl.txt"),
+ 'config' => $_SESSION['alphasessionID']
+ );
+ echo json_encode($return_val);
+ } else {
+ echo json_encode(
+ array( 'info' => 'This function is for debugging purpose only',
+ 'error' => 'your session is out of date')
+ );
+ }
+ }
+
+ private function generateURL($action, $varname, $varvalue, $filename) {
+ $path = '/dev/resource/'. $action .'/' . $varname .'/' . $varvalue .'/file/' . $filename ;
+ $path = "http://" . $_SERVER['SERVER_NAME'] . $path;
+ return $path;
+ }
}
diff --git a/application/modules/dev/controllers/RoleController.php b/application/modules/dev/controllers/RoleController.php
index ab5870b..468e2ae 100644
--- a/application/modules/dev/controllers/RoleController.php
+++ b/application/modules/dev/controllers/RoleController.php
@@ -1,279 +1,263 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_RoleController extends Zend_Controller_Action
-{
- protected $roleMapper;
- protected $rightMapper;
- protected $rightRolesMapper;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->roleMapper = new Application_Model_RoleMapper();
- $this->rightMapper = new Application_Model_RightMapper();
- $this->rightRolesMapper = new Application_Model_RightRolesMapper();
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- }
-
- public function indexAction()
- {
- $roleNamespace = Zend_Session::namespaceGet('role');
- if(isset($roleNamespace['groupID'])) {
- $roleList = $this->roleMapper->findBy(array('groupID' => $roleNamespace['groupID']),true);
- $this->view->groupID = $roleNamespace['groupID'];
- $this->view->roleList = $roleList;
- } else {
- $this->_helper->redirector('groupselect', 'role');
- return;
- }
- }
-
- public function addAction()
- {
- $roleNamespace = Zend_Session::namespaceGet('role');
- if(isset($roleNamespace['groupID'])) {
- if (!isset($_POST["add"])){
- $addForm = new dev_Form_RoleAdd(array('rightlist' => $rightList));
- } else {
- $addForm = new dev_Form_RoleAdd(array('rightlist' => $rightList),$_POST);
- if ($addForm->isValid($_POST)) {
-
- $_POST['groupID'] = $roleNamespace['groupID'];
- $role = new Application_Model_Role($_POST);
- try {
- $this->roleMapper->save($role);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- $this->view->addForm = $addForm;
- } else {
- $this->_helper->redirector('groupselect', 'role');
- return;
- }
- }
-
- public function editAction()
- {
- $roleID = $this->_request->getParam('roleID');
- if(!isset($roleID)) {
- $addForm = new dev_Form_RoleAdd();
- $this->view->addForm = $addForm;
- return;
- }
- if (!isset($_POST["save"])){
- $role = $this->roleMapper->find($roleID);
- $_POST['title'] = $role->getTitle();
- $_POST['description'] = $role->getDescription();
- $_POST['groupID'] = $role->getGroupID();
- $_POST['inheritance'] = $role->getInheritance();
- $editForm = new dev_Form_RoleEdit();
- } else {
- $editForm = new dev_Form_RoleEdit($_POST);
- if ($editForm->isValid($_POST)) {
- $role = new Application_Model_Role($_POST);
- $role->setID($this->_request->getParam('roleID'));
- try {
- $this->roleMapper->save($role);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'role');
- return;
- }
- }
- $this->view->editForm = $editForm;
- }
-
- public function showAction()
- {
- $roleID = $this->_request->getParam('roleID');
- if($roleID) {
- $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID),true);
- if(count($rightroles) > 0) {
- foreach($rightroles as $rightrole) {
- $right = $this->rightMapper->find($rightrole['rightID']);
- $rightsList[] = $right;
- }
- if(is_array($rightsList)) {
- $this->view->rightsList = $rightsList;
- }
- }
- $this->view->role = $this->roleMapper->find($roleID);
- $this->view->roleID = $roleID;
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- public function deleteAction()
- {
- $this->_helper->viewRenderer->setNoRender();
- $roleID = $this->_request->getParam('roleID');
- if (isset($roleID)){
- $role = $this->roleMapper->find($roleID);
- try {
- $this->roleMapper->delete($role);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'role');
- return;
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- public function linkrightAction()
- {
- $roleID = $this->_request->getParam('roleID');
- if(isset($roleID)) {
- $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID),true);
- $rights = $this->rightMapper->fetchAll();
- if(count($rightroles) > 0) {
- if(count($rights) > 0) {
- foreach($rights as $right) {
- foreach($rightroles as $rightrole) {
- if($right->getID() == $rightrole['rightID']) {
- $found = true;
- break;
- }
- }
- if(!$found) {
- $rightlist[] = $right;
- }
- $found = false;
- }
- }
- } else {
- $rightlist = $rights;
- }
- if(count($rightlist) > 0) {
- if (!isset($_POST["link"])){
- $linkForm = new dev_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID));
- } else {
- $linkForm = new dev_Form_LinkRight(array('rightlist' => $rightlist),$_POST);
- if ($linkForm->isValid($_POST)) {
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRightID($_POST['rightID']);
- $rightroles->setRoleID($roleID);
- try {
- $this->rightRolesMapper->save($rightroles);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect('/dev/role/show/roleID/' . $roleID);
- return;
- }
- }
- $this->view->linkForm = $linkForm;
- } else {
- $this->_redirect('/dev/role/show/roleID/' . $roleID);
- return;
- }
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- public function unlinkrightAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- $rightRolesID = $this->_request->getParam('rightrolesID');
- if(isset($rightRolesID)) {
- $rightRolesID = explode('-',$rightRolesID);
- $roleID = $rightRolesID[0];
- $rightID = $rightRolesID[1];
- if (isset($roleID) && isset($rightID)){
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRoleID($roleID);
- $rightroles->setRightID($rightID);
- try {
- $this->rightRolesMapper->delete($rightroles);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect('/dev/role/show/roleID/' . $roleID);
- return;
- }
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
-
- public function groupselectAction()
- {
- $roleNamespace = Zend_Session::namespaceGet('role');
- if(isset($roleNamespace['groupID'])) {
- $this->_helper->redirector('', 'role');
- } else {
- if(isset($_POST['selectgroup'])) {
- $roleSession = new Zend_Session_Namespace('role');
- $roleSession->groupID = $_POST['groupID'];
- $this->_helper->redirector('', 'role');
- return;
- } else {
- $personMapper = new Application_Model_PersonMapper();
- $result = $personMapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $membershipMapper = new Application_Model_MembershipMapper();
- $memberships = $membershipMapper->findBy(array("personID" => $person->getID(), true));
- $groupMapper = new Application_Model_GroupMapper();
- if(isset($memberships)) {
- foreach($memberships as $membership) {
- $group = $groupMapper->find($membership['groupID']);
- $groupList[] = $group;
- }
- }
- $groupSelectForm = new dev_Form_GroupSelect(array('grouplist' => $groupList));
- $this->view->groupSelectForm = $groupSelectForm;
- }
- }
- }
-
- public function changegroupAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- Zend_Session::namespaceUnset('role');
- $this->_helper->redirector('groupselect', 'role');
- return;
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_RoleController extends Zend_Controller_Action {
+ protected $roleMapper;
+ protected $rightMapper;
+ protected $rightRolesMapper;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->roleMapper = new Application_Model_RoleMapper();
+ $this->rightMapper = new Application_Model_RightMapper();
+ $this->rightRolesMapper = new Application_Model_RightRolesMapper();
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ }
+
+ public function indexAction() {
+ $roleNamespace = Zend_Session::namespaceGet('role');
+ if(isset($roleNamespace['groupID'])) {
+ $roleList = $this->roleMapper->findBy(array('groupID' => $roleNamespace['groupID']), true);
+ $this->view->groupID = $roleNamespace['groupID'];
+ $this->view->roleList = $roleList;
+ } else {
+ $this->_helper->redirector('groupselect', 'role');
+ return;
+ }
+ }
+
+ public function addAction() {
+ $roleNamespace = Zend_Session::namespaceGet('role');
+ if(isset($roleNamespace['groupID'])) {
+ if (!isset($_POST["add"])) {
+ $addForm = new dev_Form_RoleAdd(array('rightlist' => $rightList));
+ } else {
+ $addForm = new dev_Form_RoleAdd(array('rightlist' => $rightList), $_POST);
+ if ($addForm->isValid($_POST)) {
+
+ $_POST['groupID'] = $roleNamespace['groupID'];
+ $role = new Application_Model_Role($_POST);
+ try {
+ $this->roleMapper->save($role);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
+
+ $this->view->addForm = $addForm;
+ } else {
+ $this->_helper->redirector('groupselect', 'role');
+ return;
+ }
+ }
+
+ public function editAction() {
+ $roleID = $this->_request->getParam('roleID');
+ if(!isset($roleID)) {
+ $addForm = new dev_Form_RoleAdd();
+ $this->view->addForm = $addForm;
+ return;
+ }
+ if (!isset($_POST["save"])) {
+ $role = $this->roleMapper->find($roleID);
+ $_POST['title'] = $role->getTitle();
+ $_POST['description'] = $role->getDescription();
+ $_POST['groupID'] = $role->getGroupID();
+ $_POST['inheritance'] = $role->getInheritance();
+ $editForm = new dev_Form_RoleEdit();
+ } else {
+ $editForm = new dev_Form_RoleEdit($_POST);
+ if ($editForm->isValid($_POST)) {
+ $role = new Application_Model_Role($_POST);
+ $role->setID($this->_request->getParam('roleID'));
+ try {
+ $this->roleMapper->save($role);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
+ $this->view->editForm = $editForm;
+ }
+
+ public function showAction() {
+ $roleID = $this->_request->getParam('roleID');
+ if($roleID) {
+ $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID), true);
+ if(count($rightroles) > 0) {
+ foreach($rightroles as $rightrole) {
+ $right = $this->rightMapper->find($rightrole['rightID']);
+ $rightsList[] = $right;
+ }
+ if(is_array($rightsList)) {
+ $this->view->rightsList = $rightsList;
+ }
+ }
+ $this->view->role = $this->roleMapper->find($roleID);
+ $this->view->roleID = $roleID;
+ } else {
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
+
+ public function deleteAction() {
+ $this->_helper->viewRenderer->setNoRender();
+ $roleID = $this->_request->getParam('roleID');
+ if (isset($roleID)) {
+ $role = $this->roleMapper->find($roleID);
+ try {
+ $this->roleMapper->delete($role);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('', 'role');
+ return;
+ } else {
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
+
+ public function linkrightAction() {
+ $roleID = $this->_request->getParam('roleID');
+ if(isset($roleID)) {
+ $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID), true);
+ $rights = $this->rightMapper->fetchAll();
+ if(count($rightroles) > 0) {
+ if(count($rights) > 0) {
+ foreach($rights as $right) {
+ foreach($rightroles as $rightrole) {
+ if($right->getID() == $rightrole['rightID']) {
+ $found = true;
+ break;
+ }
+ }
+ if(!$found) {
+ $rightlist[] = $right;
+ }
+ $found = false;
+ }
+ }
+ } else {
+ $rightlist = $rights;
+ }
+ if(count($rightlist) > 0) {
+ if (!isset($_POST["link"])) {
+ $linkForm = new dev_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID));
+ } else {
+ $linkForm = new dev_Form_LinkRight(array('rightlist' => $rightlist), $_POST);
+ if ($linkForm->isValid($_POST)) {
+ $rightroles = new Application_Model_RightRoles();
+ $rightroles->setRightID($_POST['rightID']);
+ $rightroles->setRoleID($roleID);
+ try {
+ $this->rightRolesMapper->save($rightroles);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect('/dev/role/show/roleID/' . $roleID);
+ return;
+ }
+ }
+ $this->view->linkForm = $linkForm;
+ } else {
+ $this->_redirect('/dev/role/show/roleID/' . $roleID);
+ return;
+ }
+ } else {
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
+
+ public function unlinkrightAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ $rightRolesID = $this->_request->getParam('rightrolesID');
+ if(isset($rightRolesID)) {
+ $rightRolesID = explode('-', $rightRolesID);
+ $roleID = $rightRolesID[0];
+ $rightID = $rightRolesID[1];
+ if (isset($roleID) && isset($rightID)) {
+ $rightroles = new Application_Model_RightRoles();
+ $rightroles->setRoleID($roleID);
+ $rightroles->setRightID($rightID);
+ try {
+ $this->rightRolesMapper->delete($rightroles);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect('/dev/role/show/roleID/' . $roleID);
+ return;
+ }
+ } else {
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
+
+ public function groupselectAction() {
+ $roleNamespace = Zend_Session::namespaceGet('role');
+ if(isset($roleNamespace['groupID'])) {
+ $this->_helper->redirector('', 'role');
+ } else {
+ if(isset($_POST['selectgroup'])) {
+ $roleSession = new Zend_Session_Namespace('role');
+ $roleSession->groupID = $_POST['groupID'];
+ $this->_helper->redirector('', 'role');
+ return;
+ } else {
+ $personMapper = new Application_Model_PersonMapper();
+ $result = $personMapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()), true);
+ $person = new Application_Model_Person($result[0]);
+ $person->setID($result[0]['personID']);
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $memberships = $membershipMapper->findBy(array("personID" => $person->getID(), true));
+ $groupMapper = new Application_Model_GroupMapper();
+ if(isset($memberships)) {
+ foreach($memberships as $membership) {
+ $group = $groupMapper->find($membership['groupID']);
+ $groupList[] = $group;
+ }
+ }
+ $groupSelectForm = new dev_Form_GroupSelect(array('grouplist' => $groupList));
+ $this->view->groupSelectForm = $groupSelectForm;
+ }
+ }
+ }
+
+ public function changegroupAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ Zend_Session::namespaceUnset('role');
+ $this->_helper->redirector('groupselect', 'role');
+ return;
+ }
}
diff --git a/application/modules/dev/controllers/SessionController.php b/application/modules/dev/controllers/SessionController.php
index 11da1be..58b4316 100644
--- a/application/modules/dev/controllers/SessionController.php
+++ b/application/modules/dev/controllers/SessionController.php
@@ -1,186 +1,177 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_SessionController extends Zend_Controller_Action
-{
-
- public function init()
- {
- /* Initialize action controller here */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_SessionController extends Zend_Controller_Action {
+
+ public function init() {
+ /* Initialize action controller here */
+ }
+
+ public function indexAction() {
+ $mapper = new Application_Model_SessionMapper();
+ $this->view->sessions = $mapper->fetchAll();
+#print_a($_SESSION);
+ }
+ private function getUniqueCode($length = "") {
+ $code = md5(uniqid(rand(), true));
+ if ($length != "") { return substr($code, 0, $length); }
+ else { return $code; }
+ }
+
+ public function createsessionAction() {
+ $cm = new Application_Model_ClientMapper();
+ $clients = $cm->fetchAll();
+
+ $bm = new Application_Model_BootOsMapper();
+ $bootos = $bm->fetchAll();
+
+ $bi = new Application_Model_BootIsoMapper();
+ $bootisos = $bi->fetchAll();
+
+ $bmem = new Application_Model_BootMenuEntriesMapper();
+ $bootmenuentries = $bmem->fetchAll();
+
+ $mm = new Application_Model_MembershipMapper();
+ $memberships = $mm->fetchAll();
+
+
+ if (!isset($_POST["add"])) {
+ $createsession = new dev_Form_Session(array('buttontext' => 'Create Session', 'bootmenuentries' => $bootmenuentries, 'clients' => $clients, 'bootos' => $bootos, 'bootisos' => $bootisos, 'memberships' => $memberships));
+ $this->view->createsession = $createsession;
+ } else {
+ // TODO extend with normal function not only with post
+ $createsession = new dev_Form_Session(array('buttontext' => 'Create Session', 'bootmenuentries' => $bootmenuentries, 'clients' => $clients, 'bootos' => $bootos, 'bootisos' => $bootisos), $_POST);
+#print_a($_POST);
+ if ($createsession->isValid($_POST)) {
+ try {
+ $uniqid = $this->getUniqueCode(10);
+ $sm = new Application_Model_SessionMapper();
+ while(count($sm->findBy(array('alphasessionID' => $uniqid), true)) > 0) {
+ $uniqid = $this->getUniqueCode(16);
+ }
+
+ $session = new Application_Model_Session($_POST);
+ $session->setTime(strtotime($_POST['time']));
+ $session->setAlphasessionID($uniqid);
+
+ // UNIQUE ID IN SESSION SPEICHERN:
+ $_SESSION['alphasessionID'] = $uniqid;
+
+ if($session->getClientID() == '') {
+ $session->setClientID(null);
+ }
+ if($session->getBootosID() == '') {
+ $session->setBootosID(null);
+ }
+ if($session->getBootmenuentryID() == '') {
+ $session->setBootmenuentryID(null);
+ }
+ if($session->getMembershipID() == '') {
+ $session->setMembershipID(null);
+ }
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->save($session);
+
+ $this->_redirect('/dev/session');
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+ $this->view->createsession = $createsession;
}
-
- public function indexAction()
- {
- $mapper = new Application_Model_SessionMapper();
- $this->view->sessions = $mapper->fetchAll();
- #print_a($_SESSION);
- }
- private function getUniqueCode($length = "")
- {
- $code = md5(uniqid(rand(), true));
- if ($length != "") return substr($code, 0, $length);
- else return $code;
- }
-
- public function createsessionAction()
- {
- $cm = new Application_Model_ClientMapper();
- $clients = $cm->fetchAll();
-
- $bm = new Application_Model_BootOsMapper();
- $bootos = $bm->fetchAll();
-
- $bi = new Application_Model_BootIsoMapper();
- $bootisos = $bi->fetchAll();
-
- $bmem = new Application_Model_BootMenuEntriesMapper();
- $bootmenuentries = $bmem->fetchAll();
-
- $mm = new Application_Model_MembershipMapper();
- $memberships = $mm->fetchAll();
-
-
- if (!isset($_POST["add"])){
- $createsession = new dev_Form_Session(array('buttontext' => 'Create Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos,'memberships'=>$memberships));
- $this->view->createsession = $createsession;
- }else {
- // TODO extend with normal function not only with post
- $createsession = new dev_Form_Session(array('buttontext' => 'Create Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST);
- #print_a($_POST);
- if ($createsession->isValid($_POST)) {
- try{
- $uniqid = $this->getUniqueCode(10);
- $sm = new Application_Model_SessionMapper();
- while(count($sm->findBy(array('alphasessionID' => $uniqid),true))>0){
- $uniqid = $this->getUniqueCode(16);
- }
-
- $session = new Application_Model_Session($_POST);
- $session->setTime(strtotime($_POST['time']));
- $session->setAlphasessionID($uniqid);
-
- // UNIQUE ID IN SESSION SPEICHERN:
- $_SESSION['alphasessionID'] = $uniqid;
-
- if($session->getClientID() == ''){
- $session->setClientID(null);
- }
- if($session->getBootosID() == ''){
- $session->setBootosID(null);
- }
- if($session->getBootmenuentryID() == ''){
- $session->setBootmenuentryID(null);
- }
- if($session->getMembershipID() == ''){
- $session->setMembershipID(null);
- }
- $sessionmapper = new Application_Model_SessionMapper();
- $sessionmapper->save($session);
-
- $this->_redirect('/dev/session');
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
- $this->view->createsession = $createsession;
- }
+ }
+
+ public function editsessionAction() {
+ $cm = new Application_Model_ClientMapper();
+ $clients = $cm->fetchAll();
+
+ $bm = new Application_Model_BootOsMapper();
+ $bootos = $bm->fetchAll();
+
+ $bi = new Application_Model_BootIsoMapper();
+ $bootisos = $bi->fetchAll();
+
+ $bmem = new Application_Model_BootMenuEntriesMapper();
+ $bootmenuentries = $bmem->fetchAll();
+
+ $mm = new Application_Model_MembershipMapper();
+ $memberships = $mm->fetchAll();
+
+ if (!isset($_POST["add"])) {
+ // TODO: ACL implementieren ob er editieren darf
+ $sessionID = $this->_request->getParam('sessionID');
+ $session = new Application_Model_Session();
+ try {
+
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->find($sessionID, $session);
+ $session->setTime(date('d.m.Y H:i', $session->getTime()));
+ $session2 = $session->toArray();
+#print_a($session2);
+
+ $editsession = new dev_Form_Session(array('buttontext' => 'Edit Session', 'bootmenuentries' => $bootmenuentries, 'clients' => $clients, 'bootos' => $bootos, 'bootisos' => $bootisos, 'memberships' => $memberships));
+ $editsession->populate($session2);
+ $this->view->editsession = $editsession;
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+
+ } else {
+ try {
+ $sessionID = $this->_request->getParam('sessionID');
+
+ $editsession = new dev_Form_Session(array('buttontext' => 'Edit Session', 'bootmenuentries' => $bootmenuentries, 'clients' => $clients, 'bootos' => $bootos, 'bootisos' => $bootisos, 'memberships' => $memberships), $_POST);
+
+ if ($editsession->isValid($_POST)) {
+ $_SESSION['alphasessionID'] = $_POST['alphasessionID'];
+ $session = new Application_Model_Session($_POST);
+ $session->setID($this->_request->getParam('sessionID'));
+ $session->setTime(strtotime($_POST['time']));
+ if($session->getClientID() == '') {
+ $session->setClientID(null);
+ }
+ if($session->getBootosID() == '') {
+ $session->setBootosID(null);
+ }
+ if($session->getBootmenuentryID() == '') {
+ $session->setBootmenuentryID(null);
+ }
+ if($session->getMembershipID() == '') {
+ $session->setMembershipID(null);
+ }
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->save($session);
+ echo 'valid';
+ } else {
+ echo 'not valid';
+ }
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ $this->_redirect('/dev/session');
}
-
- public function editsessionAction()
- {
- $cm = new Application_Model_ClientMapper();
- $clients = $cm->fetchAll();
-
- $bm = new Application_Model_BootOsMapper();
- $bootos = $bm->fetchAll();
-
- $bi = new Application_Model_BootIsoMapper();
- $bootisos = $bi->fetchAll();
-
- $bmem = new Application_Model_BootMenuEntriesMapper();
- $bootmenuentries = $bmem->fetchAll();
-
- $mm = new Application_Model_MembershipMapper();
- $memberships = $mm->fetchAll();
-
- if (!isset($_POST["add"])){
- // TODO: ACL implementieren ob er editieren darf
- $sessionID = $this->_request->getParam('sessionID');
- $session = new Application_Model_Session();
- try{
-
- $sessionmapper = new Application_Model_SessionMapper();
- $sessionmapper->find($sessionID,$session);
- $session->setTime(date('d.m.Y H:i',$session->getTime()));
- $session2 = $session->toArray();
- #print_a($session2);
-
- $editsession = new dev_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos,'memberships'=>$memberships));
- $editsession->populate($session2);
- $this->view->editsession = $editsession;
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
-
- } else{
- try{
- $sessionID = $this->_request->getParam('sessionID');
-
- $editsession = new dev_Form_Session(array('buttontext' => 'Edit Session','bootmenuentries'=>$bootmenuentries,'clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos,'memberships'=>$memberships),$_POST);
-
- if ($editsession->isValid($_POST)) {
- $_SESSION['alphasessionID'] = $_POST['alphasessionID'];
- $session = new Application_Model_Session($_POST);
- $session->setID($this->_request->getParam('sessionID'));
- $session->setTime(strtotime($_POST['time']));
- if($session->getClientID() == ''){
- $session->setClientID(null);
- }
- if($session->getBootosID() == ''){
- $session->setBootosID(null);
- }
- if($session->getBootmenuentryID() == ''){
- $session->setBootmenuentryID(null);
- }
- if($session->getMembershipID() == ''){
- $session->setMembershipID(null);
- }
- $sessionmapper = new Application_Model_SessionMapper();
- $sessionmapper->save($session);
- echo 'valid';
- }
- else
- {
- echo 'not valid';
- }
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- $this->_redirect('/dev/session');
- }
- }
-
- public function deletesessionAction()
- {
- $sessionID = $this->_request->getParam('sessionID');
- if(is_numeric($sessionID)){
- $deletesession = new Application_Model_Session();
- $deletesession->setID($sessionID);
- $sessionmapper = new Application_Model_SessionMapper();
- $sessionmapper->delete($deletesession);
- }
- $this->_redirect('/dev/session');
+ }
+
+ public function deletesessionAction() {
+ $sessionID = $this->_request->getParam('sessionID');
+ if(is_numeric($sessionID)) {
+ $deletesession = new Application_Model_Session();
+ $deletesession->setID($sessionID);
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionmapper->delete($deletesession);
}
+ $this->_redirect('/dev/session');
+ }
}
diff --git a/application/modules/dev/forms/AuthDelete.php b/application/modules/dev/forms/AuthDelete.php
index c8f4a8f..fd0707c 100644
--- a/application/modules/dev/forms/AuthDelete.php
+++ b/application/modules/dev/forms/AuthDelete.php
@@ -1,37 +1,35 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_AuthDelete extends Zend_Form
-{
+class dev_Form_AuthDelete extends Zend_Form {
- public function init()
- {
- $this->setName("Delete");
- $this->setMethod('post');
+ public function init() {
+ $this->setName("Delete");
+ $this->setMethod('post');
- $this->addElement('text', 'ID', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'ID:',
- ));
- $this->addElement('submit', 'delete', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Delete',
- ));
- }
+ $this->addElement('text', 'ID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'ID:',
+ ));
+ $this->addElement('submit', 'delete', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Delete',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/AuthLogin.php b/application/modules/dev/forms/AuthLogin.php
index 2192c35..193b2ff 100644
--- a/application/modules/dev/forms/AuthLogin.php
+++ b/application/modules/dev/forms/AuthLogin.php
@@ -1,47 +1,45 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_AuthLogin extends Zend_Form
-{
-
- public function init()
- {
- $this->setName("Login");
- $this->setMethod('post');
-
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim', 'StringToLower'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'E-Mail:',
- ));
-
- $this->addElement('password', 'password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Password:',
- ));
-
- $this->addElement('submit', 'login', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Login',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_AuthLogin extends Zend_Form {
+
+ public function init() {
+ $this->setName("Login");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'email', array(
+ 'filters' => array('StringTrim', 'StringToLower'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'E-Mail:',
+ ));
+
+ $this->addElement('password', 'password', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Password:',
+ ));
+
+ $this->addElement('submit', 'login', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Login',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/AuthRecoverPassword.php b/application/modules/dev/forms/AuthRecoverPassword.php
index 2502b7a..31d2c00 100644
--- a/application/modules/dev/forms/AuthRecoverPassword.php
+++ b/application/modules/dev/forms/AuthRecoverPassword.php
@@ -1,37 +1,35 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_AuthRecoverPassword extends Zend_Form
-{
+class dev_Form_AuthRecoverPassword extends Zend_Form {
- public function init()
- {
- $this->setName("RecoverPassword");
- $this->setMethod('post');
+ public function init() {
+ $this->setName("RecoverPassword");
+ $this->setMethod('post');
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 30)),
- ),
- 'required' => true,
- 'label' => 'Email:',
- ));
- $this->addElement('submit', 'recoverPassword', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Recover',
- ));
- }
+ $this->addElement('text', 'email', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 30)),
+ ),
+ 'required' => true,
+ 'label' => 'Email:',
+ ));
+ $this->addElement('submit', 'recoverPassword', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Recover',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/AuthRegister.php b/application/modules/dev/forms/AuthRegister.php
index 823bd31..0f1ee4a 100644
--- a/application/modules/dev/forms/AuthRegister.php
+++ b/application/modules/dev/forms/AuthRegister.php
@@ -1,115 +1,113 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_AuthRegister extends Zend_Form
-{
-
- public function init()
- {
- $this->setName("Register");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
-
- $this->addElement('text', 'name', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Name:',
- ));
-
- $this->addElement('text', 'firstname', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Firstname:',
- ));
-
- $this->addElement('text', 'street', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Street:',
- ));
-
- $this->addElement('text', 'housenumber', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Housenumber:',
- ));
-
- $this->addElement('text', 'city', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'City:',
- ));
-
- $this->addElement('text', 'postalcode', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Postalcode:',
- ));
-
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim', 'StringToLower'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Email:',
- ));
-
- $this->addElement('password', 'password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Password:',
- ));
-
- $this->addElement('submit', 'register', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Register',
- ));
-
-
- }
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_AuthRegister extends Zend_Form {
+
+ public function init() {
+ $this->setName("Register");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+
+ $this->addElement('text', 'name', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Name:',
+ ));
+
+ $this->addElement('text', 'firstname', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Firstname:',
+ ));
+
+ $this->addElement('text', 'street', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Street:',
+ ));
+
+ $this->addElement('text', 'housenumber', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Housenumber:',
+ ));
+
+ $this->addElement('text', 'city', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'City:',
+ ));
+
+ $this->addElement('text', 'postalcode', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Postalcode:',
+ ));
+
+ $this->addElement('text', 'email', array(
+ 'filters' => array('StringTrim', 'StringToLower'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Email:',
+ ));
+
+ $this->addElement('password', 'password', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Password:',
+ ));
+
+ $this->addElement('submit', 'register', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Register',
+ ));
+
+
+ }
+
+
}
diff --git a/application/modules/dev/forms/BootisoCreate.php b/application/modules/dev/forms/BootisoCreate.php
index edb1053..eed1e87 100644
--- a/application/modules/dev/forms/BootisoCreate.php
+++ b/application/modules/dev/forms/BootisoCreate.php
@@ -1,119 +1,117 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_BootisoCreate extends Zend_Form
-{
-
- private $grouplist;
- private $prebootlist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
- public function setPrebootlist($prebootlist){
- $this->prebootlist = $prebootlist;
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_BootisoCreate extends Zend_Form {
+
+ private $grouplist;
+ private $prebootlist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+ public function setPrebootlist($prebootlist) {
+ $this->prebootlist = $prebootlist;
+
+ }
+
+
+ public function init() {
+ $this->setName("BootIsoCreate");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
-
-
- public function init()
- {
- $this->setName("BootIsoCreate");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $prebootfield = $this->createElement('select','prebootID');
- $prebootfield ->setLabel('Preboot:');
-
- if(count($this->prebootlist)>0){
- foreach($this->prebootlist as $preboot => $p){
- $prebootfield->addMultiOption($p->getID(), $p->getTitle());
- }
- }
- $prebootfield->setRegisterInArrayValidator(false);
- $this->addElement($prebootfield);
-
- $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:',
- 'value' => $serial
- ));
-
-
-
-
- $date = new DateTime();
- $date->add(new DateInterval('P1Y'));
- $this->addElement('text', 'expires', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Expires:',
- 'value' => $date->format('Y-m-d'),
- ));
-
- $this->addElement('text', 'public', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Public-Level:',
- 'value' => '0'
- ));
-
- $this->addElement('submit', 'createbootiso', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Create BootISO',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/dev/bootiso"'
- ));
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $prebootfield = $this->createElement('select', 'prebootID');
+ $prebootfield ->setLabel('Preboot:');
+ if(count($this->prebootlist) > 0) {
+ foreach($this->prebootlist as $preboot => $p) {
+ $prebootfield->addMultiOption($p->getID(), $p->getTitle());
+ }
}
+ $prebootfield->setRegisterInArrayValidator(false);
+ $this->addElement($prebootfield);
+
+ $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:',
+ 'value' => $serial
+ ));
+
+
+
+
+ $date = new DateTime();
+ $date->add(new DateInterval('P1Y'));
+ $this->addElement('text', 'expires', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Expires:',
+ 'value' => $date->format('Y-m-d'),
+ ));
+
+ $this->addElement('text', 'public', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Public-Level:',
+ 'value' => '0'
+ ));
+
+ $this->addElement('submit', 'createbootiso', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Create BootISO',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/dev/bootiso"'
+ ));
+
+ }
+
-
}
diff --git a/application/modules/dev/forms/BootisoEdit.php b/application/modules/dev/forms/BootisoEdit.php
index f1ad6a7..2478036 100644
--- a/application/modules/dev/forms/BootisoEdit.php
+++ b/application/modules/dev/forms/BootisoEdit.php
@@ -1,111 +1,109 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_BootisoEdit extends Zend_Form
-{
-
-
- private $grouplist;
- private $prebootlist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
- public function setPrebootlist($prebootlist){
- $this->prebootlist = $prebootlist;
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_BootisoEdit extends Zend_Form {
+
+
+ private $grouplist;
+ private $prebootlist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+ public function setPrebootlist($prebootlist) {
+ $this->prebootlist = $prebootlist;
+
+ }
+
+
+ public function init() {
+ $this->setName("BootIsoCreate");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
-
-
- public function init()
- {
- $this->setName("BootIsoCreate");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $prebootfield = $this->createElement('select','prebootID');
- $prebootfield ->setLabel('Preboot:');
-
- if(count($this->prebootlist)>0){
- foreach($this->prebootlist as $preboot => $p){
- $prebootfield->addMultiOption($p->getID(), $p->getTitle());
- }
- }
- $prebootfield->setRegisterInArrayValidator(false);
- $this->addElement($prebootfield);
-
- $this->addElement('text', 'serialnumber', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'size' => 50,
- 'label' => 'Serialnumber:',
- ));
-
- $date = new DateTime();
- $date->add(new DateInterval('P1Y'));
- $this->addElement('text', 'expires', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Expires:',
- 'value' => $date->format('Y-m-d'),
- ));
-
- $this->addElement('text', 'public', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Public-Level:',
- 'value' => '0'
- ));
-
-
- $this->addElement('submit', 'editbootiso', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Edit BootISO',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/dev/bootiso"'
- ));
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $prebootfield = $this->createElement('select', 'prebootID');
+ $prebootfield ->setLabel('Preboot:');
+ if(count($this->prebootlist) > 0) {
+ foreach($this->prebootlist as $preboot => $p) {
+ $prebootfield->addMultiOption($p->getID(), $p->getTitle());
+ }
}
+ $prebootfield->setRegisterInArrayValidator(false);
+ $this->addElement($prebootfield);
+
+ $this->addElement('text', 'serialnumber', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'size' => 50,
+ 'label' => 'Serialnumber:',
+ ));
+
+ $date = new DateTime();
+ $date->add(new DateInterval('P1Y'));
+ $this->addElement('text', 'expires', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Expires:',
+ 'value' => $date->format('Y-m-d'),
+ ));
+
+ $this->addElement('text', 'public', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Public-Level:',
+ 'value' => '0'
+ ));
+
+
+ $this->addElement('submit', 'editbootiso', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Edit BootISO',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/dev/bootiso"'
+ ));
+
+ }
}
diff --git a/application/modules/dev/forms/BootmenuCreate.php b/application/modules/dev/forms/BootmenuCreate.php
index f94f3c5..5d4ff28 100644
--- a/application/modules/dev/forms/BootmenuCreate.php
+++ b/application/modules/dev/forms/BootmenuCreate.php
@@ -1,60 +1,58 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_BootmenuCreate extends Zend_Form
-{
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function init()
- {
- $this->setName("BootMenuCreate");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('submit', 'createbootmenu', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Create Bootmenu',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/bootmenu"'
- ));
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_BootmenuCreate extends Zend_Form {
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function init() {
+ $this->setName("BootMenuCreate");
+ $this->setMethod('post');
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('submit', 'createbootmenu', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Create Bootmenu',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/bootmenu"'
+ ));
+
+ }
}
diff --git a/application/modules/dev/forms/BootmenuEdit.php b/application/modules/dev/forms/BootmenuEdit.php
index f20cd08..d8d80d7 100644
--- a/application/modules/dev/forms/BootmenuEdit.php
+++ b/application/modules/dev/forms/BootmenuEdit.php
@@ -1,61 +1,59 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_BootmenuEdit extends Zend_Form
-{
-
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function init()
- {
- $this->setName("BootMenuEdit");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('submit', 'editbootmenu', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Edit BootMenu',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/bootmenu"'
- ));
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_BootmenuEdit extends Zend_Form {
+
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function init() {
+ $this->setName("BootMenuEdit");
+ $this->setMethod('post');
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('submit', 'editbootmenu', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Edit BootMenu',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/bootmenu"'
+ ));
+
+ }
}
diff --git a/application/modules/dev/forms/BootmenuEntriesAdd.php b/application/modules/dev/forms/BootmenuEntriesAdd.php
index 9b17c3a..0d33916 100644
--- a/application/modules/dev/forms/BootmenuEntriesAdd.php
+++ b/application/modules/dev/forms/BootmenuEntriesAdd.php
@@ -1,147 +1,145 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_BootmenuEntriesAdd extends Zend_Form
-{
- private $bootoslist;
- private $configlist;
- private $maxorder;
-
- public function setBootoslist($bootoslist){
- $this->bootoslist = $bootoslist;
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_BootmenuEntriesAdd extends Zend_Form {
+ private $bootoslist;
+ private $configlist;
+ private $maxorder;
+
+ public function setBootoslist($bootoslist) {
+ $this->bootoslist = $bootoslist;
+ }
+
+ public function setMaxorder($maxorder) {
+ $this->maxorder = $maxorder;
+
+ }
+
+ public function setConfiglist($configlist) {
+ $this->configlist = $configlist;
+
+ }
+
+
+ public function init() {
+
+ if(!isset($_POST['bootosID'])) {
+ $firstbootos = array_slice($this->bootoslist, 0, 1);
+ $_POST['bootosID'] = $firstbootos[0]->getID();
+ $_POST['kclactive'] = true;
}
-
- public function setMaxorder($maxorder){
- $this->maxorder = $maxorder;
-
+
+ $this->setName("BootMenuEntryAdd");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $bootosfield = $this->createElement('select', 'bootosID');
+ $bootosfield ->setLabel('BootOs:');
+ $bootosfield->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();");
+
+ if(count($this->bootoslist) > 0) {
+ foreach($this->bootoslist as $bootos => $b) {
+ $bootosfield->addMultiOption($b->getID(), $b->getTitle());
+ }
+ }
+ $bootosfield->setRegisterInArrayValidator(false);
+
+ $this->addElement($bootosfield);
+
+ $kclactive = $this->createElement('checkbox', 'kclactive');
+ $kclactive->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();");
+ $kclactive->setLabel('Use default KCL:');
+ $kclactive->setValue(true);
+ $this->addElement($kclactive);
+
+
+ if($_POST['kclactive']) {
+ $this->addElement('textarea', 'kcl', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'cols' => 50,
+ 'rows' => 5,
+ 'label' => 'KCL:',
+ 'readOnly' => true,
+ 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl()
+
+ ));
}
-
- public function setConfiglist($configlist){
- $this->configlist = $configlist;
-
+
+ if($_POST['kclactive'])
+ { $kcllength = 175 - strlen($this->bootoslist[$_POST['bootosID']]->getDefaultkcl()); }
+ else
+ { $kcllength = 175; }
+
+ $this->addElement('textarea', 'kclappend', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, $kcllength)),
+ ),
+ 'required' => false,
+ 'cols' => 50,
+ 'rows' => 5,
+ 'label' => 'KCL-Append:',
+ 'description' => 'Chars left: ' . $kcllength
+ ));
+
+ $defaultconfigid = $this->bootoslist[$_POST['bootosID']]->getConfigID();
+ $configfield = $this->createElement('select', 'configID');
+ $configfield->setLabel('Config:');
+ $configfield->addMultiOption($defaultconfigid, 'default');
+
+ if(count($this->configlist) > 0) {
+ foreach($this->configlist as $config => $c) {
+ if($c->getID() != $defaultconfigid)
+ { $configfield->addMultiOption($c->getID(), $c->getTitle()); }
+ }
}
-
-
- public function init()
- {
-
- if(!isset($_POST['bootosID'])){
- $firstbootos = array_slice($this->bootoslist,0,1);
- $_POST['bootosID'] = $firstbootos[0]->getID();
- $_POST['kclactive'] = true;
- }
-
- $this->setName("BootMenuEntryAdd");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $bootosfield = $this->createElement('select','bootosID');
- $bootosfield ->setLabel('BootOs:');
- $bootosfield->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();");
-
- if(count($this->bootoslist)>0){
- foreach($this->bootoslist as $bootos => $b){
- $bootosfield->addMultiOption($b->getID(), $b->getTitle());
- }
- }
- $bootosfield->setRegisterInArrayValidator(false);
-
- $this->addElement($bootosfield);
-
- $kclactive = $this->createElement('checkbox','kclactive');
- $kclactive->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();");
- $kclactive->setLabel('Use default KCL:');
- $kclactive->setValue(true);
- $this->addElement($kclactive);
-
-
- if($_POST['kclactive']){
- $this->addElement('textarea', 'kcl', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'cols' => 50,
- 'rows' => 5,
- 'label' => 'KCL:',
- 'readOnly' => true,
- 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl()
-
- ));
- }
-
- if($_POST['kclactive'])
- $kcllength = 175 - strlen($this->bootoslist[$_POST['bootosID']]->getDefaultkcl());
- else
- $kcllength = 175;
-
- $this->addElement('textarea', 'kclappend', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, $kcllength)),
- ),
- 'required' => false,
- 'cols' => 50,
- 'rows' => 5,
- 'label' => 'KCL-Append:',
- 'description' => 'Chars left: ' . $kcllength
- ));
-
- $defaultconfigid = $this->bootoslist[$_POST['bootosID']]->getConfigID();
- $configfield = $this->createElement('select','configID');
- $configfield->setLabel('Config:');
- $configfield->addMultiOption($defaultconfigid, 'default');
-
- if(count($this->configlist)>0){
- foreach($this->configlist as $config => $c){
- if($c->getID() != $defaultconfigid)
- $configfield->addMultiOption($c->getID(), $c->getTitle());
- }
- }
-
- $configfield->setRegisterInArrayValidator(false);
- $this->addElement($configfield);
-
- $orderfield = $this->createElement('select','order');
- $orderfield ->setLabel('Position:');
-
- for ($i = 0; $i <= $this->maxorder; $i++) {
- $orderfield->addMultiOption($i, $i+1);
- }
- $orderfield->setRegisterInArrayValidator(false);
- $this->addElement($orderfield);
-
- $this->addElement('submit', 'addbootmenuentry', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Add Bootmenuentry',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/dev/bootmenu"'
- ));
+ $configfield->setRegisterInArrayValidator(false);
+ $this->addElement($configfield);
+
+ $orderfield = $this->createElement('select', 'order');
+ $orderfield ->setLabel('Position:');
+
+ for ($i = 0; $i <= $this->maxorder; $i++) {
+ $orderfield->addMultiOption($i, $i + 1);
}
-
-
+ $orderfield->setRegisterInArrayValidator(false);
+ $this->addElement($orderfield);
+
+ $this->addElement('submit', 'addbootmenuentry', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add Bootmenuentry',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/dev/bootmenu"'
+ ));
+
+ }
+
+
}
diff --git a/application/modules/dev/forms/BootmenuEntriesEdit.php b/application/modules/dev/forms/BootmenuEntriesEdit.php
index 87fcb9e..096d0f4 100644
--- a/application/modules/dev/forms/BootmenuEntriesEdit.php
+++ b/application/modules/dev/forms/BootmenuEntriesEdit.php
@@ -1,150 +1,148 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_BootmenuEntriesEdit extends Zend_Form
-{
-
- private $bootoslist;
- private $configlist;
- private $maxorder;
- private $kcl;
-
- public function setBootoslist($bootoslist){
- $this->bootoslist = $bootoslist;
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_BootmenuEntriesEdit extends Zend_Form {
+
+ private $bootoslist;
+ private $configlist;
+ private $maxorder;
+ private $kcl;
+
+ public function setBootoslist($bootoslist) {
+ $this->bootoslist = $bootoslist;
+ }
+
+ public function setMaxorder($maxorder) {
+ $this->maxorder = $maxorder;
+ }
+
+ public function setConfiglist($configlist) {
+ $this->configlist = $configlist;
+ }
+ public function setKcl($kcl) {
+ $this->kcl = $kcl;
+ }
+
+
+ public function init() {
+
+ if(!isset($_POST['bootosID'])) {
+ $firstbootos = array_slice($this->bootoslist, 0, 1);
+ $_POST['bootosID'] = $firstbootos[0]->getID();
+ if(isset($this->kcl))
+ { $_POST['kclactive'] = true; }
+ else
+ { $_POST['kclactive'] = false; }
}
-
- public function setMaxorder($maxorder){
- $this->maxorder = $maxorder;
+
+ $this->setName("BootMenuEntryAdd");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $bootosfield = $this->createElement('select', 'bootosID');
+ $bootosfield->setLabel('BootOs:');
+ $bootosfield->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();");
+
+
+ if(count($this->bootoslist) > 0) {
+ foreach($this->bootoslist as $bootos => $b) {
+ $bootosfield->addMultiOption($b->getID(), $b->getTitle());
+ }
}
-
- public function setConfiglist($configlist){
- $this->configlist = $configlist;
+ $bootosfield->setRegisterInArrayValidator(false);
+ $this->addElement($bootosfield);
+
+ $kclactive = $this->createElement('checkbox', 'kclactive');
+ $kclactive->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();");
+ $kclactive->setLabel('Use default KCL:');
+ $kclactive->setValue($_POST['kclactive']);
+ $this->addElement($kclactive);
+
+ if($_POST['kclactive']) {
+ $this->addElement('textarea', 'kcl', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'cols' => 50,
+ 'rows' => 5,
+ 'label' => 'KCL:',
+ 'readOnly' => true,
+ 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl()
+ ));
}
- public function setKcl($kcl){
- $this->kcl = $kcl;
+
+ if($_POST['kclactive'])
+ { $kcllength = 175 - strlen($this->bootoslist[$_POST['bootosID']]->getDefaultkcl()); }
+ else
+ { $kcllength = 175; }
+
+ $this->addElement('textarea', 'kclappend', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, $kcllength)),
+ ),
+ 'required' => false,
+ 'cols' => 50,
+ 'rows' => 5,
+ 'label' => 'KCL-Append:',
+ 'description' => 'Chars left: ' . $kcllength
+
+ ));
+
+ $defaultconfigid = $this->bootoslist[$_POST['bootosID']]->getConfigID();
+ $configfield = $this->createElement('select', 'configID');
+ $configfield->setLabel('Config:');
+ $configfield->addMultiOption($defaultconfigid, 'default');
+
+ if(count($this->configlist) > 0) {
+ foreach($this->configlist as $config => $c) {
+ if($c->getID() != $defaultconfigid)
+ { $configfield->addMultiOption($c->getID(), $c->getTitle()); }
+ }
}
-
-
- public function init()
- {
-
- if(!isset($_POST['bootosID'])){
- $firstbootos = array_slice($this->bootoslist,0,1);
- $_POST['bootosID'] = $firstbootos[0]->getID();
- if(isset($this->kcl))
- $_POST['kclactive'] = true;
- else
- $_POST['kclactive'] = false;
- }
-
- $this->setName("BootMenuEntryAdd");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $bootosfield = $this->createElement('select','bootosID');
- $bootosfield->setLabel('BootOs:');
- $bootosfield->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();");
-
-
- if(count($this->bootoslist)>0){
- foreach($this->bootoslist as $bootos => $b){
- $bootosfield->addMultiOption($b->getID(), $b->getTitle());
- }
- }
- $bootosfield->setRegisterInArrayValidator(false);
- $this->addElement($bootosfield);
-
- $kclactive = $this->createElement('checkbox','kclactive');
- $kclactive->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();");
- $kclactive->setLabel('Use default KCL:');
- $kclactive->setValue($_POST['kclactive']);
- $this->addElement($kclactive);
-
- if($_POST['kclactive']){
- $this->addElement('textarea', 'kcl', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'cols' => 50,
- 'rows' => 5,
- 'label' => 'KCL:',
- 'readOnly' => true,
- 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl()
- ));
- }
-
- if($_POST['kclactive'])
- $kcllength = 175 - strlen($this->bootoslist[$_POST['bootosID']]->getDefaultkcl());
- else
- $kcllength = 175;
-
- $this->addElement('textarea', 'kclappend', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, $kcllength)),
- ),
- 'required' => false,
- 'cols' => 50,
- 'rows' => 5,
- 'label' => 'KCL-Append:',
- 'description' => 'Chars left: ' . $kcllength
-
- ));
-
- $defaultconfigid = $this->bootoslist[$_POST['bootosID']]->getConfigID();
- $configfield = $this->createElement('select','configID');
- $configfield->setLabel('Config:');
- $configfield->addMultiOption($defaultconfigid, 'default');
-
- if(count($this->configlist)>0){
- foreach($this->configlist as $config => $c){
- if($c->getID() != $defaultconfigid)
- $configfield->addMultiOption($c->getID(), $c->getTitle());
- }
- }
- $configfield->setRegisterInArrayValidator(false);
- $this->addElement($configfield);
-
- $orderfield = $this->createElement('select','order');
- $orderfield ->setLabel('Position:');
-
- for ($i = 0; $i < $this->maxorder; $i++) {
- $orderfield->addMultiOption($i, $i+1);
- }
- $orderfield->setRegisterInArrayValidator(false);
- $this->addElement($orderfield);
-
- $this->addElement('submit', 'editbootmenuentry', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Edit Bootmenuentry',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/dev/bootmenu"'
- ));
+ $configfield->setRegisterInArrayValidator(false);
+ $this->addElement($configfield);
+
+ $orderfield = $this->createElement('select', 'order');
+ $orderfield ->setLabel('Position:');
+ for ($i = 0; $i < $this->maxorder; $i++) {
+ $orderfield->addMultiOption($i, $i + 1);
}
-
+ $orderfield->setRegisterInArrayValidator(false);
+ $this->addElement($orderfield);
+
+ $this->addElement('submit', 'editbootmenuentry', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Edit Bootmenuentry',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/dev/bootmenu"'
+ ));
+
+ }
+
}
diff --git a/application/modules/dev/forms/BootosCreate.php b/application/modules/dev/forms/BootosCreate.php
index b13e9e6..78ad28d 100644
--- a/application/modules/dev/forms/BootosCreate.php
+++ b/application/modules/dev/forms/BootosCreate.php
@@ -1,144 +1,142 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_BootosCreate extends Zend_Form
-{
-
- private $grouplist;
- private $configlist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function setConfiglist($configlist){
- $this->configlist = $configlist;
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_BootosCreate extends Zend_Form {
+
+ private $grouplist;
+ private $configlist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function setConfiglist($configlist) {
+ $this->configlist = $configlist;
+
+ }
+
+ public function init() {
+ $this->setName("BootOsCreate");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+
+ $configfield = $this->createElement('select', 'configID');
+ $configfield ->setLabel('Config:');
+
+ if(count($this->configlist) > 0) {
+ foreach($this->configlist as $config => $c) {
+ $configfield->addMultiOption($c->getID(), $c->getTitle());
+ }
}
-
- public function init()
- {
- $this->setName("BootOsCreate");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
-
- $configfield = $this->createElement('select','configID');
- $configfield ->setLabel('Config:');
-
- if(count($this->configlist)>0){
- foreach($this->configlist as $config => $c){
- $configfield->addMultiOption($c->getID(), $c->getTitle());
- }
- }
- $configfield->setRegisterInArrayValidator(false);
- $this->addElement($configfield);
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('text', 'path_init', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 250)),
- ),
- 'required' => true,
- 'size' => 50,
- 'label' => 'Init-Path:',
- ));
-
- $this->addElement('text', 'path_kernel', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 250)),
- ),
- 'required' => true,
- 'size' => 50,
- 'label' => 'Kernel-Path:',
- ));
-
- $this->addElement('textarea', 'defaultkcl', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 175)),
- ),
- 'required' => false,
- 'rows' => 5,
- 'cols' => 50,
- 'label' => 'Default-KCL:',
- ));
-
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'rows' => 5,
- 'cols' => 50,
- 'label' => 'Description:',
- ));
-
- $date = new DateTime();
- $date->add(new DateInterval('P1Y'));
- $this->addElement('text', 'expires', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Expires:',
- 'value' => $date->format('Y-m-d'),
- ));
-
-
- $this->addElement('text', 'public', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Public-Level:',
- 'value' => '0',
- ));
-
- $this->addElement('submit', 'createbootos', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Create BootOS',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/bootos"'
- ));
+ $configfield->setRegisterInArrayValidator(false);
+ $this->addElement($configfield);
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('text', 'path_init', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 250)),
+ ),
+ 'required' => true,
+ 'size' => 50,
+ 'label' => 'Init-Path:',
+ ));
+
+ $this->addElement('text', 'path_kernel', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 250)),
+ ),
+ 'required' => true,
+ 'size' => 50,
+ 'label' => 'Kernel-Path:',
+ ));
+
+ $this->addElement('textarea', 'defaultkcl', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 175)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Default-KCL:',
+ ));
+
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Description:',
+ ));
+
+ $date = new DateTime();
+ $date->add(new DateInterval('P1Y'));
+ $this->addElement('text', 'expires', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Expires:',
+ 'value' => $date->format('Y-m-d'),
+ ));
+
+
+ $this->addElement('text', 'public', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Public-Level:',
+ 'value' => '0',
+ ));
+
+ $this->addElement('submit', 'createbootos', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Create BootOS',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/bootos"'
+ ));
+
+ }
}
diff --git a/application/modules/dev/forms/BootosEdit.php b/application/modules/dev/forms/BootosEdit.php
index c7224f7..5f10051 100644
--- a/application/modules/dev/forms/BootosEdit.php
+++ b/application/modules/dev/forms/BootosEdit.php
@@ -1,152 +1,150 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_BootosEdit extends Zend_Form
-{
-
- private $grouplist;
- private $configlist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function setConfiglist($configlist){
- $this->configlist = $configlist;
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_BootosEdit extends Zend_Form {
+
+ private $grouplist;
+ private $configlist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function setConfiglist($configlist) {
+ $this->configlist = $configlist;
+
+ }
+
+ public function init() {
+ $this->setName("BootOsEdit");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $configfield = $this->createElement('select', 'configID');
+ $configfield ->setLabel('Config:');
+
+ if(count($this->configlist) > 0) {
+ foreach($this->configlist as $config => $c) {
+ $configfield->addMultiOption($c->getID(), $c->getTitle());
+ }
}
-
- public function init()
- {
- $this->setName("BootOsEdit");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $configfield = $this->createElement('select','configID');
- $configfield ->setLabel('Config:');
-
- if(count($this->configlist)>0){
- foreach($this->configlist as $config => $c){
- $configfield->addMultiOption($c->getID(), $c->getTitle());
- }
- }
- $configfield->setRegisterInArrayValidator(false);
- $this->addElement($configfield);
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('text', 'path_init', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'size' => 50,
- 'label' => 'Init-Path:',
- ));
-
- $this->addElement('text', 'path_kernel', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'size' => 50,
- 'label' => 'Kernel-Path:',
- ));
-
- $this->addElement('textarea', 'defaultkcl', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 175)),
- ),
- 'required' => false,
- 'rows' => 5,
- 'cols' => 50,
- 'label' => 'Default-KCL:',
- ));
-
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'rows' => 5,
- 'cols' => 50,
- 'label' => 'Description:',
- ));
-
- $date = new DateTime();
- $date->add(new DateInterval('P1Y'));
- $this->addElement('text', 'expires', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Expires:',
- 'value' => $date->format('Y-m-d'),
- ));
-
-
- $this->addElement('text', 'public', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Public-Level:',
- 'value' => '0',
- ));
-
- $this->addElement('submit', 'editbootos', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Edit BootOS',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/bootos"'
- ));
+ $configfield->setRegisterInArrayValidator(false);
+ $this->addElement($configfield);
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('text', 'path_init', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'size' => 50,
+ 'label' => 'Init-Path:',
+ ));
+
+ $this->addElement('text', 'path_kernel', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'size' => 50,
+ 'label' => 'Kernel-Path:',
+ ));
+
+ $this->addElement('textarea', 'defaultkcl', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 175)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Default-KCL:',
+ ));
+
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Description:',
+ ));
+
+ $date = new DateTime();
+ $date->add(new DateInterval('P1Y'));
+ $this->addElement('text', 'expires', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Expires:',
+ 'value' => $date->format('Y-m-d'),
+ ));
+
+
+ $this->addElement('text', 'public', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Public-Level:',
+ 'value' => '0',
+ ));
+
+ $this->addElement('submit', 'editbootos', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Edit BootOS',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/bootos"'
+ ));
+
+ }
}
diff --git a/application/modules/dev/forms/Client.php b/application/modules/dev/forms/Client.php
index 6bf16dd..bc94154 100644
--- a/application/modules/dev/forms/Client.php
+++ b/application/modules/dev/forms/Client.php
@@ -1,68 +1,66 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_Client extends Zend_Form
-{
+class dev_Form_Client extends Zend_Form {
- public function init()
- {
- $this->setName("pool");
- $this->setMethod('post');
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- foreach($this->groups as $c){
- $groupfield->addMultiOption($c->getID(),$c->getTitle());
- }
- $this->addElement($groupfield);
-
-
- $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:',
- ));
+ public function init() {
+ $this->setName("pool");
+ $this->setMethod('post');
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $this->buttontext,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/dev/client"'
- ));
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ foreach($this->groups as $c) {
+ $groupfield->addMultiOption($c->getID(), $c->getTitle());
}
- private $buttontext = 'Save';
- private $groups;
- function setButtontext($v){
- $this->buttontext = $v;
- }
- public function setGroups($groups){
- $this->groups = $groups;
- return $this;
- }
+ $this->addElement($groupfield);
+
+
+ $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="/dev/client"'
+ ));
+ }
+ private $buttontext = 'Save';
+ private $groups;
+ function setButtontext($v) {
+ $this->buttontext = $v;
+ }
+ public function setGroups($groups) {
+ $this->groups = $groups;
+ return $this;
+ }
}
diff --git a/application/modules/dev/forms/ConfigCreate.php b/application/modules/dev/forms/ConfigCreate.php
index 8e05937..8ebc560 100644
--- a/application/modules/dev/forms/ConfigCreate.php
+++ b/application/modules/dev/forms/ConfigCreate.php
@@ -1,73 +1,71 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_ConfigCreate extends Zend_Form
-{
+class dev_Form_ConfigCreate extends Zend_Form {
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function init()
- {
- $this->setName("ConfigCreate");
- $this->setMethod('post');
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function init() {
+ $this->setName("ConfigCreate");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
-
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('textarea', 'shellscript', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'rows' => 10,
- 'cols' => 70,
- 'label' => 'Shellscript:',
- ));
-
- $this->addElement('submit', 'createconfig', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Create Config',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/config"'
- ));
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('textarea', 'shellscript', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'rows' => 10,
+ 'cols' => 70,
+ 'label' => 'Shellscript:',
+ ));
+
+ $this->addElement('submit', 'createconfig', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Create Config',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/config"'
+ ));
+
+ }
+
}
diff --git a/application/modules/dev/forms/ConfigEdit.php b/application/modules/dev/forms/ConfigEdit.php
index b6d3ae7..809929c 100644
--- a/application/modules/dev/forms/ConfigEdit.php
+++ b/application/modules/dev/forms/ConfigEdit.php
@@ -1,72 +1,70 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_ConfigEdit extends Zend_Form
-{
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
+class dev_Form_ConfigEdit extends Zend_Form {
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
- public function init()
- {
- $this->setName("ConfigEdit");
- $this->setMethod('post');
+ public function init() {
+ $this->setName("ConfigEdit");
+ $this->setMethod('post');
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
-
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('textarea', 'shellscript', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'rows' => 10,
- 'cols' => 70,
- 'label' => 'Shellscript:',
- ));
-
- $this->addElement('submit', 'editconfig', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Edit Config',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/config"'
- ));
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('textarea', 'shellscript', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'rows' => 10,
+ 'cols' => 70,
+ 'label' => 'Shellscript:',
+ ));
+
+ $this->addElement('submit', 'editconfig', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Edit Config',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/config"'
+ ));
+
+ }
+
}
diff --git a/application/modules/dev/forms/ConfirmDeleteAccount.php b/application/modules/dev/forms/ConfirmDeleteAccount.php
index 567fec0..a27e02a 100644
--- a/application/modules/dev/forms/ConfirmDeleteAccount.php
+++ b/application/modules/dev/forms/ConfirmDeleteAccount.php
@@ -1,35 +1,33 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_ConfirmDeleteAccount extends Zend_Form
-{
+class dev_Form_ConfirmDeleteAccount extends Zend_Form {
- public function init()
- {
- $this->setName("ConfirmDeleteAccount");
- $this->setMethod('post');
-
- $this->addElement('submit', 'confirmdelete', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Confirm',
- ));
+ public function init() {
+ $this->setName("ConfirmDeleteAccount");
+ $this->setMethod('post');
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+ $this->addElement('submit', 'confirmdelete', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Confirm',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/FilterAdd.php b/application/modules/dev/forms/FilterAdd.php
index 67acd6f..3b3b905 100644
--- a/application/modules/dev/forms/FilterAdd.php
+++ b/application/modules/dev/forms/FilterAdd.php
@@ -1,75 +1,73 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_FilterAdd extends Zend_Form
-{
- private $bootmenus;
+class dev_Form_FilterAdd extends Zend_Form {
+ private $bootmenus;
- public function init()
- {
- $this->setName("Add Filter");
- $this->setMethod('post');
+ public function init() {
+ $this->setName("Add Filter");
+ $this->setMethod('post');
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'required' => false,
- 'label' => 'Description:',
- ));
-
- $bootmenufield = $this->createElement('select','bootmenuID');
- $bootmenufield ->setLabel('Bootmenu:');
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'required' => false,
+ 'label' => 'Description:',
+ ));
- if(count($this->bootmenus)>0){
- foreach($this->bootmenus as $id => $g){
- $bootmenufield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $bootmenufield->setRegisterInArrayValidator(false);
- $this->addElement($bootmenufield);
+ $bootmenufield = $this->createElement('select', 'bootmenuID');
+ $bootmenufield ->setLabel('Bootmenu:');
- $this->addElement('text', 'priority', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Priority:',
- ));
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $this->buttontext,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/filter"'
- ));
+ if(count($this->bootmenus) > 0) {
+ foreach($this->bootmenus as $id => $g) {
+ $bootmenufield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
- function setBootmenus($val){
- $this->bootmenus = $val;
- return;
- }
- private $buttontext = 'Save';
- function setButtontext($v){
- $this->buttontext = $v;
- }
+ $bootmenufield->setRegisterInArrayValidator(false);
+ $this->addElement($bootmenufield);
+
+ $this->addElement('text', 'priority', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Priority:',
+ ));
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/filter"'
+ ));
+ }
+ function setBootmenus($val) {
+ $this->bootmenus = $val;
+ return;
+ }
+ private $buttontext = 'Save';
+ function setButtontext($v) {
+ $this->buttontext = $v;
+ }
}
diff --git a/application/modules/dev/forms/FilterEntriesAdd.php b/application/modules/dev/forms/FilterEntriesAdd.php
index d196cc9..dd15a22 100644
--- a/application/modules/dev/forms/FilterEntriesAdd.php
+++ b/application/modules/dev/forms/FilterEntriesAdd.php
@@ -1,155 +1,153 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_FilterEntriesAdd extends Zend_Form
-{
- private $filterID = 0;
+class dev_Form_FilterEntriesAdd extends Zend_Form {
+ private $filterID = 0;
- public function init()
- {
- $this->setName("Add Filterentry");
- $this->setMethod('post');
- $this->setAttrib('id','filterentryform');
- #print_a($this->data);
+ public function init() {
+ $this->setName("Add Filterentry");
+ $this->setMethod('post');
+ $this->setAttrib('id', 'filterentryform');
+#print_a($this->data);
- try{
- $filtertypemapper = new Application_Model_FilterTypeMapper();
- $filtertype = $filtertypemapper->fetchAll();
-
- $filtertypes = $this->createElement('select','filtertypeID');
- $filtertypes ->setLabel('Type:');
- $filtertypes ->setAttrib('id','filtertype');
- $filtertypes->addMultiOption('','');
- foreach($filtertype as $f){
- $filtertypes->addMultiOption($f->getID(),$f->getFiltertypename());
- }
- $filterentry = $filtertypes->getMultiOption($this->data['filtertypeID']);
- $filterentryID = $this->data['filtertypeID'];
- }catch (Zend_Exception $e) {
- echo "Error message 1: " . $e->getMessage() . "\n";
- }
- switch($filterentryID){
- default:
- $desc = "Select the filtertype";
- $label1 = 'Value 1:';
- $label2 = 'Value 2:';
- break;
- case "1":
- $desc = "You can set one IP or an IP-Range";
- $label1 = 'Start:';
- $label2 = 'End:';
- break;
- case "2":
- $desc = "You can set one Mac-Adress or an Mac-Range";
- $label1 = 'Start:';
- $label2 = 'End:';
- break;
- case "3":
- $desc = "Select your Pool";
- $label1 = 'PoolID:';
- break;
- case "4":
- $desc = "Select your BootIso";
- $label1 = 'BootIsoID:';
- break;
- case "5":
- $desc = "Select a Membership";
- $label1 = 'Membership:';
- break;
- case "6":
- $desc = "Select a Group";
- $label1 = 'Group:';
- break;
- case "7":
- $desc = "Specify a time-range";
- $label1 = 'Start:';
- $label2 = 'End:';
- break;
- case "8":
- $desc = "Select a Client";
- $label1 = 'Client:';
- break;
- case "9":
- $desc = "Define a Hardwarehash";
- $label1 = 'Hardwarehash:';
- break;
- case "10":
- $desc = "Specify the Weekday (Monday:1, Tuesday:2 ... Sunday:7) or a range";
- $label1 = 'Start Day:';
- $label2 = 'End Day:';
- break;
- case "11":
- $desc = "Specify the date or a day range of the filter";
- $label1 = 'Start Date:';
- $label2 = 'End Date:';
- break;
- }
- $filtertypes->setDescription($desc);
- $this->addElement($filtertypes);
-
- $this->addElement('text', 'filtervalue', array(
- 'label' => $label1,
- 'id' => 'val1'
- ));
-
- if(!in_array($filterentryID,array(3,4,5,6,8,9))){
- $this->addElement('text', 'filtervalue2', array(
- 'label' => $label2,
- 'id' => 'val2'
- ));
- }
+ try {
+ $filtertypemapper = new Application_Model_FilterTypeMapper();
+ $filtertype = $filtertypemapper->fetchAll();
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $this->buttontext,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/filter"'
- ));
-
- $this->addElement('hidden', 'filterID', array(
- 'value' => $this->filterID
- ));
-
-
+ $filtertypes = $this->createElement('select', 'filtertypeID');
+ $filtertypes ->setLabel('Type:');
+ $filtertypes ->setAttrib('id', 'filtertype');
+ $filtertypes->addMultiOption('', '');
+ foreach($filtertype as $f) {
+ $filtertypes->addMultiOption($f->getID(), $f->getFiltertypename());
+ }
+ $filterentry = $filtertypes->getMultiOption($this->data['filtertypeID']);
+ $filterentryID = $this->data['filtertypeID'];
+ } catch (Zend_Exception $e) {
+ echo "Error message 1: " . $e->getMessage() . "\n";
}
+ switch($filterentryID) {
+ default:
+ $desc = "Select the filtertype";
+ $label1 = 'Value 1:';
+ $label2 = 'Value 2:';
+ break;
+ case "1":
+ $desc = "You can set one IP or an IP-Range";
+ $label1 = 'Start:';
+ $label2 = 'End:';
+ break;
+ case "2":
+ $desc = "You can set one Mac-Adress or an Mac-Range";
+ $label1 = 'Start:';
+ $label2 = 'End:';
+ break;
+ case "3":
+ $desc = "Select your Pool";
+ $label1 = 'PoolID:';
+ break;
+ case "4":
+ $desc = "Select your BootIso";
+ $label1 = 'BootIsoID:';
+ break;
+ case "5":
+ $desc = "Select a Membership";
+ $label1 = 'Membership:';
+ break;
+ case "6":
+ $desc = "Select a Group";
+ $label1 = 'Group:';
+ break;
+ case "7":
+ $desc = "Specify a time-range";
+ $label1 = 'Start:';
+ $label2 = 'End:';
+ break;
+ case "8":
+ $desc = "Select a Client";
+ $label1 = 'Client:';
+ break;
+ case "9":
+ $desc = "Define a Hardwarehash";
+ $label1 = 'Hardwarehash:';
+ break;
+ case "10":
+ $desc = "Specify the Weekday (Monday:1, Tuesday:2 ... Sunday:7) or a range";
+ $label1 = 'Start Day:';
+ $label2 = 'End Day:';
+ break;
+ case "11":
+ $desc = "Specify the date or a day range of the filter";
+ $label1 = 'Start Date:';
+ $label2 = 'End Date:';
+ break;
+ }
+ $filtertypes->setDescription($desc);
+ $this->addElement($filtertypes);
+
+ $this->addElement('text', 'filtervalue', array(
+ 'label' => $label1,
+ 'id' => 'val1'
+ ));
+
+ if(!in_array($filterentryID, array(3, 4, 5, 6, 8, 9))) {
+ $this->addElement('text', 'filtervalue2', array(
+ 'label' => $label2,
+ 'id' => 'val2'
+ ));
+ }
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/filter"'
+ ));
+
+ $this->addElement('hidden', 'filterID', array(
+ 'value' => $this->filterID
+ ));
+
+
+ }
- private $buttontext = 'Save';
- function setButtontext($v){
- $this->buttontext = $v;
- }
- private $data ;
- function setData($v){
- $this->data = $v;
- }
- function setFilterID($v){
- $this->filterID = $v;
- }
+ private $buttontext = 'Save';
+ function setButtontext($v) {
+ $this->buttontext = $v;
+ }
+ private $data ;
+ function setData($v) {
+ $this->data = $v;
+ }
+ function setFilterID($v) {
+ $this->filterID = $v;
+ }
}
-?>
-<script type="text/javascript">
- $('#filtertype').change(function(){
- //alert($("#filtertype option:selected").val());
- $('#filterentryform').submit();
- });
- $('#val1').focusout(function(){
- if($("#filtertype option:selected").val() == 1 && $('#val2').val() == ""){
- $('#val2').val($('#val1').val());
- }
- if($("#filtertype option:selected").val() == 2 && $('#val2').val() == ""){
- $('#val2').val($('#val1').val());
- }
- });
-</script>
+? >
+< script type = "text/javascript" >
+$('#filtertype').change(function() {
+ //alert($("#filtertype option:selected").val());
+ $('#filterentryform').submit();
+});
+$('#val1').focusout(function() {
+ if($("#filtertype option:selected").val() == 1 && $('#val2').val() == "") {
+ $('#val2').val($('#val1').val());
+ }
+ if($("#filtertype option:selected").val() == 2 && $('#val2').val() == "") {
+ $('#val2').val($('#val1').val());
+ }
+});
+< / script >
diff --git a/application/modules/dev/forms/FilterEvaluate.php b/application/modules/dev/forms/FilterEvaluate.php
index 4cd67d0..b5f6fb1 100644
--- a/application/modules/dev/forms/FilterEvaluate.php
+++ b/application/modules/dev/forms/FilterEvaluate.php
@@ -1,140 +1,138 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_FilterEvaluate extends Zend_Form
-{
- private $pools;
- private $bootisos;
- private $memberships;
- private $groups;
- private $clients;
+class dev_Form_FilterEvaluate extends Zend_Form {
+ private $pools;
+ private $bootisos;
+ private $memberships;
+ private $groups;
+ private $clients;
- public function init()
- {
- $this->setName("Test Filter");
- $this->setMethod('post');
- $this->setAction('/dev/filter/evaluate');
+ public function init() {
+ $this->setName("Test Filter");
+ $this->setMethod('post');
+ $this->setAction('/dev/filter/evaluate');
- $this->addElement('text', 'ip', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'IP:',
- ));
- ######################################
- $this->addElement('text', 'mac', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Mac:',
- ));
- ######################################
- $poolfield = $this->createElement('select','poolID');
- $poolfield ->setLabel('Pool:');
- $poolfield->addMultiOption('','');
- if(count($this->pools)>0){
- foreach($this->pools as $id => $g){
- $poolfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $poolfield->setRegisterInArrayValidator(false);
- $this->addElement($poolfield);
- ######################################
- $bootisofield = $this->createElement('select','bootisoID');
- $bootisofield ->setLabel('BootIso:');
- $bootisofield->addMultiOption('','');
- if(count($this->bootisos)>0){
- foreach($this->bootisos as $id => $g){
- $bootisofield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $bootisofield->setRegisterInArrayValidator(false);
- $this->addElement($bootisofield);
- ######################################
- $membershipfield = $this->createElement('select','membershipID');
- $membershipfield ->setLabel('Membership:');
- $membershipfield->addMultiOption('','');
- if(count($this->memberships)>0){
- foreach($this->memberships as $id => $g){
- $membershipfield->addMultiOption($g->getID(), $g->getPersonID());
- }
- }
- $membershipfield->setRegisterInArrayValidator(false);
- $this->addElement($membershipfield);
- ######################################
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
- $groupfield->addMultiOption('','');
- if(count($this->groups)>0){
- foreach($this->groups as $id => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
- ######################################
- $this->addElement('text', 'time', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Time:',
- ));
- ######################################
- $clientfield = $this->createElement('select','clientID');
- $clientfield ->setLabel('Client:');
- $clientfield->addMultiOption('','');
- if(count($this->clients)>0){
- foreach($this->clients as $id => $g){
- $clientfield->addMultiOption($g->getID(), $g->getID() . " - " . $g->getMacadress());
- }
- }
- $clientfield->setRegisterInArrayValidator(false);
- $this->addElement($clientfield);
- ######################################
- $this->addElement('text', 'hardwarehash', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Hardwarehash:',
- ));
-
- $this->addElement('submit', 'submit', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Get It On!',
- ));
+ $this->addElement('text', 'ip', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'IP:',
+ ));
+######################################
+ $this->addElement('text', 'mac', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Mac:',
+ ));
+######################################
+ $poolfield = $this->createElement('select', 'poolID');
+ $poolfield ->setLabel('Pool:');
+ $poolfield->addMultiOption('', '');
+ if(count($this->pools) > 0) {
+ foreach($this->pools as $id => $g) {
+ $poolfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
- function setPools($v){
- $this->pools = $v;
- }
- function setBootisos($v){
- $this->bootisos = $v;
- }
- function setMemberships($v){
- $this->memberships = $v;
- }
- function setGroups($v){
- $this->groups = $v;
- }
- function setClients($v){
- $this->clients = $v;
- }
+ $poolfield->setRegisterInArrayValidator(false);
+ $this->addElement($poolfield);
+######################################
+ $bootisofield = $this->createElement('select', 'bootisoID');
+ $bootisofield ->setLabel('BootIso:');
+ $bootisofield->addMultiOption('', '');
+ if(count($this->bootisos) > 0) {
+ foreach($this->bootisos as $id => $g) {
+ $bootisofield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $bootisofield->setRegisterInArrayValidator(false);
+ $this->addElement($bootisofield);
+######################################
+ $membershipfield = $this->createElement('select', 'membershipID');
+ $membershipfield ->setLabel('Membership:');
+ $membershipfield->addMultiOption('', '');
+ if(count($this->memberships) > 0) {
+ foreach($this->memberships as $id => $g) {
+ $membershipfield->addMultiOption($g->getID(), $g->getPersonID());
+ }
+ }
+ $membershipfield->setRegisterInArrayValidator(false);
+ $this->addElement($membershipfield);
+######################################
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+ $groupfield->addMultiOption('', '');
+ if(count($this->groups) > 0) {
+ foreach($this->groups as $id => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+######################################
+ $this->addElement('text', 'time', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Time:',
+ ));
+######################################
+ $clientfield = $this->createElement('select', 'clientID');
+ $clientfield ->setLabel('Client:');
+ $clientfield->addMultiOption('', '');
+ if(count($this->clients) > 0) {
+ foreach($this->clients as $id => $g) {
+ $clientfield->addMultiOption($g->getID(), $g->getID() . " - " . $g->getMacadress());
+ }
+ }
+ $clientfield->setRegisterInArrayValidator(false);
+ $this->addElement($clientfield);
+######################################
+ $this->addElement('text', 'hardwarehash', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Hardwarehash:',
+ ));
+
+ $this->addElement('submit', 'submit', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Get It On!',
+ ));
+ }
+ function setPools($v) {
+ $this->pools = $v;
+ }
+ function setBootisos($v) {
+ $this->bootisos = $v;
+ }
+ function setMemberships($v) {
+ $this->memberships = $v;
+ }
+ function setGroups($v) {
+ $this->groups = $v;
+ }
+ function setClients($v) {
+ $this->clients = $v;
+ }
}
diff --git a/application/modules/dev/forms/GroupAdd.php b/application/modules/dev/forms/GroupAdd.php
index 89595e6..b0df640 100644
--- a/application/modules/dev/forms/GroupAdd.php
+++ b/application/modules/dev/forms/GroupAdd.php
@@ -1,74 +1,72 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_GroupAdd extends Zend_Form
-{
- private $grouplist;
+class dev_Form_GroupAdd extends Zend_Form {
+ private $grouplist;
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+ }
- public function init()
- {
- $this->setName("GroupAdd");
- $this->setMethod('post');
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
+ public function init() {
+ $this->setName("GroupAdd");
+ $this->setMethod('post');
- $this->addElement('text', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'label' => 'Description:',
- ));
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
- $groupfield = $this->createElement('select','superordinatedGroupID');
- $groupfield ->setLabel('superordinated Group:');
+ $this->addElement('text', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ ));
- $groupfield->addMultiOption('-1', '---- none ----');
+ $groupfield = $this->createElement('select', 'superordinatedGroupID');
+ $groupfield ->setLabel('superordinated Group:');
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
+ $groupfield->addMultiOption('-1', '---- none ----');
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Add',
- ));
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/GroupEdit.php b/application/modules/dev/forms/GroupEdit.php
index a3828f5..a90c7d2 100644
--- a/application/modules/dev/forms/GroupEdit.php
+++ b/application/modules/dev/forms/GroupEdit.php
@@ -1,57 +1,55 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_GroupEdit extends Zend_Form
-{
-
-
- public function init()
- {
- $this->setName("GroupEdit");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- 'value' => $_POST['title'],
- ));
-
- $this->addElement('text', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'label' => 'Description:',
- 'value' => $_POST['description'],
- ));
-
- $this->addElement('submit', 'save', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
-
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_GroupEdit extends Zend_Form {
+
+
+ public function init() {
+ $this->setName("GroupEdit");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ 'value' => $_POST['title'],
+ ));
+
+ $this->addElement('text', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ 'value' => $_POST['description'],
+ ));
+
+ $this->addElement('submit', 'save', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/GroupLink.php b/application/modules/dev/forms/GroupLink.php
index cd77565..4857655 100644
--- a/application/modules/dev/forms/GroupLink.php
+++ b/application/modules/dev/forms/GroupLink.php
@@ -1,64 +1,62 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_GroupLink extends Zend_Form
-{
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function init()
- {
- $this->setName("GroupLink");
- $this->setMethod('post');
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $groupfield1 = $this->createElement('select','superordinatedGroupID');
- $groupfield1 ->setLabel('superordinated Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield1->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield1->setRegisterInArrayValidator(false);
- $this->addElement($groupfield1);
-
- $this->addElement('submit', 'link', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Link',
- ));
-
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_GroupLink extends Zend_Form {
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function init() {
+ $this->setName("GroupLink");
+ $this->setMethod('post');
+
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $groupfield1 = $this->createElement('select', 'superordinatedGroupID');
+ $groupfield1 ->setLabel('superordinated Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield1->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $groupfield1->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield1);
+
+ $this->addElement('submit', 'link', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Link',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/GroupRequest.php b/application/modules/dev/forms/GroupRequest.php
index 691c24b..8a1acbf 100644
--- a/application/modules/dev/forms/GroupRequest.php
+++ b/application/modules/dev/forms/GroupRequest.php
@@ -1,52 +1,50 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_GroupRequest extends Zend_Form
-{
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function getGrouplist(){
- return $this->grouplist;
- }
-
- public function init()
- {
- $this->setName("GroupRequest");
- $this->setMethod('post');
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
-
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('submit', 'request', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Request',
- ));
-
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_GroupRequest extends Zend_Form {
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function getGrouplist() {
+ return $this->grouplist;
+ }
+
+ public function init() {
+ $this->setName("GroupRequest");
+ $this->setMethod('post');
+
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('submit', 'request', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Request',
+ ));
+
+ }
}
diff --git a/application/modules/dev/forms/GroupSelect.php b/application/modules/dev/forms/GroupSelect.php
index cd5dfc6..0080044 100644
--- a/application/modules/dev/forms/GroupSelect.php
+++ b/application/modules/dev/forms/GroupSelect.php
@@ -1,51 +1,49 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_GroupSelect extends Zend_Form
-{
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function getGrouplist(){
- return $this->grouplist;
- }
-
- public function init()
- {
- $this->setName("GroupSelect");
- $this->setMethod('post');
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
-
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('submit', 'selectgroup', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Select',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_GroupSelect extends Zend_Form {
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function getGrouplist() {
+ return $this->grouplist;
+ }
+
+ public function init() {
+ $this->setName("GroupSelect");
+ $this->setMethod('post');
+
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('submit', 'selectgroup', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Select',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/LinkRight.php b/application/modules/dev/forms/LinkRight.php
index 38a14f9..5894905 100644
--- a/application/modules/dev/forms/LinkRight.php
+++ b/application/modules/dev/forms/LinkRight.php
@@ -1,57 +1,55 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_LinkRight extends Zend_Form
-{
- private $rightlist;
- private $roleID;
-
- public function setRightlist($rightlist){
- $this->rightlist = $rightlist;
- }
-
- public function setRoleID($roleID){
- $this->roleID = $roleID;
- }
-
- public function init()
- {
- $this->setName("LinkRight");
- $this->setMethod('post');
-
- $rightfield = $this->createElement('select','rightID');
- $rightfield ->setLabel('Right:');
-
- if(count($this->rightlist)>0){
- foreach($this->rightlist as $right => $r){
- $rightfield->addMultiOption($r->getID(), $r->getTitle());
- }
- }
- $rightfield->setRegisterInArrayValidator(false);
- $this->addElement($rightfield);
-
- $this->addElement('submit', 'link', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Add',
- ));
-
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_LinkRight extends Zend_Form {
+ private $rightlist;
+ private $roleID;
+
+ public function setRightlist($rightlist) {
+ $this->rightlist = $rightlist;
+ }
+
+ public function setRoleID($roleID) {
+ $this->roleID = $roleID;
+ }
+
+ public function init() {
+ $this->setName("LinkRight");
+ $this->setMethod('post');
+
+ $rightfield = $this->createElement('select', 'rightID');
+ $rightfield ->setLabel('Right:');
+
+ if(count($this->rightlist) > 0) {
+ foreach($this->rightlist as $right => $r) {
+ $rightfield->addMultiOption($r->getID(), $r->getTitle());
+ }
+ }
+ $rightfield->setRegisterInArrayValidator(false);
+ $this->addElement($rightfield);
+
+ $this->addElement('submit', 'link', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/NewPassword.php b/application/modules/dev/forms/NewPassword.php
index 4a7f1cf..ca2be56 100644
--- a/application/modules/dev/forms/NewPassword.php
+++ b/application/modules/dev/forms/NewPassword.php
@@ -1,47 +1,45 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_NewPassword extends Zend_Form
-{
- private $personID;
-
- public function setPersonID($personID){
- $this->personID = $personID;
- }
-
- public function init()
- {
- $this->setName("NewPassword");
- $this->setMethod('post');
-
- $this->addElement('hidden', 'personID', array(
- 'value' => $this->personID
- ));
-
- $this->addElement('password', 'password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Password:',
- ));
-
- $this->addElement('submit', 'savePassword', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_NewPassword extends Zend_Form {
+ private $personID;
+
+ public function setPersonID($personID) {
+ $this->personID = $personID;
+ }
+
+ public function init() {
+ $this->setName("NewPassword");
+ $this->setMethod('post');
+
+ $this->addElement('hidden', 'personID', array(
+ 'value' => $this->personID
+ ));
+
+ $this->addElement('password', 'password', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Password:',
+ ));
+
+ $this->addElement('submit', 'savePassword', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+ }
} \ No newline at end of file
diff --git a/application/modules/dev/forms/PersonEdit.php b/application/modules/dev/forms/PersonEdit.php
index 67f317c..b49ce7b 100644
--- a/application/modules/dev/forms/PersonEdit.php
+++ b/application/modules/dev/forms/PersonEdit.php
@@ -1,126 +1,124 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_PersonEdit extends Zend_Form
-{
-
- public function init()
- {
- $this->setName("PersonEdit");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- 'value' => $this->getView()->person->getTitle(),
- ));
-
-
- $this->addElement('text', 'name', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Name:',
- 'value' => $this->getView()->person->getName(),
- ));
-
- $this->addElement('text', 'firstname', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Firstname:',
- 'value' => $this->getView()->person->getFirstname(),
- ));
-
- $this->addElement('text', 'street', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Street:',
- 'value' => $this->getView()->person->getStreet(),
- ));
-
- $this->addElement('text', 'housenumber', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Housenumber:',
- 'value' => $this->getView()->person->getHousenumber(),
- ));
-
- $this->addElement('text', 'city', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'City:',
- 'value' => $this->getView()->person->getCity(),
- ));
-
- $this->addElement('text', 'postalcode', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Postalcode:',
- 'value' => $this->getView()->person->getPostalcode(),
- ));
-
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim', 'StringToLower'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Email:',
- 'value' => $this->getView()->person->getEmail(),
- ));
-
- $this->addElement('password', 'newpassword', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Neues Password:',
- ));
-
- $this->addElement('submit', 'save', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
-
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_PersonEdit extends Zend_Form {
+
+ public function init() {
+ $this->setName("PersonEdit");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ 'value' => $this->getView()->person->getTitle(),
+ ));
+
+
+ $this->addElement('text', 'name', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Name:',
+ 'value' => $this->getView()->person->getName(),
+ ));
+
+ $this->addElement('text', 'firstname', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Firstname:',
+ 'value' => $this->getView()->person->getFirstname(),
+ ));
+
+ $this->addElement('text', 'street', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Street:',
+ 'value' => $this->getView()->person->getStreet(),
+ ));
+
+ $this->addElement('text', 'housenumber', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Housenumber:',
+ 'value' => $this->getView()->person->getHousenumber(),
+ ));
+
+ $this->addElement('text', 'city', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'City:',
+ 'value' => $this->getView()->person->getCity(),
+ ));
+
+ $this->addElement('text', 'postalcode', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Postalcode:',
+ 'value' => $this->getView()->person->getPostalcode(),
+ ));
+
+ $this->addElement('text', 'email', array(
+ 'filters' => array('StringTrim', 'StringToLower'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Email:',
+ 'value' => $this->getView()->person->getEmail(),
+ ));
+
+ $this->addElement('password', 'newpassword', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Neues Password:',
+ ));
+
+ $this->addElement('submit', 'save', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/Pool.php b/application/modules/dev/forms/Pool.php
index 7fff200..dc2efb2 100644
--- a/application/modules/dev/forms/Pool.php
+++ b/application/modules/dev/forms/Pool.php
@@ -1,61 +1,59 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_Pool extends Zend_Form
-{
-
- public function init()
- {
- $this->setName("pool");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'required' => false,
- 'label' => 'Description:',
- ));
- // TODO: Add target of Filter
-
- $this->addElement('text', 'location', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Location:',
- ));
-
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $this->buttontext,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/pool"'
- ));
- }
- private $buttontext = 'Save';
- function setButtontext($v){
- $this->buttontext = $v;
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_Pool extends Zend_Form {
+
+ public function init() {
+ $this->setName("pool");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'required' => false,
+ 'label' => 'Description:',
+ ));
+ // TODO: Add target of Filter
+
+ $this->addElement('text', 'location', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Location:',
+ ));
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/pool"'
+ ));
+ }
+ private $buttontext = 'Save';
+ function setButtontext($v) {
+ $this->buttontext = $v;
+ }
}
diff --git a/application/modules/dev/forms/PoolClient.php b/application/modules/dev/forms/PoolClient.php
index 434343a..a9dc880 100644
--- a/application/modules/dev/forms/PoolClient.php
+++ b/application/modules/dev/forms/PoolClient.php
@@ -1,42 +1,40 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_PoolClient extends Zend_Form
-{
- private $clients;
+class dev_Form_PoolClient extends Zend_Form {
+ private $clients;
- public function init()
- {
- $this->setName("addClientToPool");
- $this->setMethod('post');
-
- $clientfield = $this->createElement('select','clientID');
- $clientfield ->setLabel('Client:');
- print_a($this->clients);
- foreach($this->clients as $c){
- $clientfield->addMultiOption($c['clientID'],$c['macadress']." - ".$c['hardwarehash']);
- }
- $this->addElement($clientfield);
-
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
+ public function init() {
+ $this->setName("addClientToPool");
+ $this->setMethod('post');
+
+ $clientfield = $this->createElement('select', 'clientID');
+ $clientfield ->setLabel('Client:');
+ print_a($this->clients);
+ foreach($this->clients as $c) {
+ $clientfield->addMultiOption($c['clientID'], $c['macadress']." - ".$c['hardwarehash']);
}
- public function setClients($clients){
- $this->clients = $clients;
- return $this;
- }
-
+ $this->addElement($clientfield);
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+ }
+ public function setClients($clients) {
+ $this->clients = $clients;
+ return $this;
+ }
+
}
diff --git a/application/modules/dev/forms/PrebootCreate.php b/application/modules/dev/forms/PrebootCreate.php
index 2979606..5365640 100644
--- a/application/modules/dev/forms/PrebootCreate.php
+++ b/application/modules/dev/forms/PrebootCreate.php
@@ -1,72 +1,70 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_PrebootCreate extends Zend_Form
-{
+class dev_Form_PrebootCreate extends Zend_Form {
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function init()
- {
- $this->setName("PreBootCreate");
- $this->setMethod('post');
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function init() {
+ $this->setName("PreBootCreate");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('text', 'path_preboot', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 240)),
- ),
- 'required' => true,
- 'size' => 50,
- 'label' => 'Path to Preboot:',
- ));
-
- $this->addElement('submit', 'createpreboot', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Create Preboot',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/dev/preboot"'
- ));
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('text', 'path_preboot', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 240)),
+ ),
+ 'required' => true,
+ 'size' => 50,
+ 'label' => 'Path to Preboot:',
+ ));
+
+ $this->addElement('submit', 'createpreboot', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Create Preboot',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/dev/preboot"'
+ ));
+
+ }
+
-
}
diff --git a/application/modules/dev/forms/PrebootEdit.php b/application/modules/dev/forms/PrebootEdit.php
index 6e8268b..a691bff 100644
--- a/application/modules/dev/forms/PrebootEdit.php
+++ b/application/modules/dev/forms/PrebootEdit.php
@@ -1,69 +1,67 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_PrebootEdit extends Zend_Form
-{
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function init()
- {
- $this->setName("PreBootEdit");
- $this->setMethod('post');
+class dev_Form_PrebootEdit extends Zend_Form {
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function init() {
+ $this->setName("PreBootEdit");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('text', 'path_preboot', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 240)),
- ),
- 'required' => true,
- 'size' => 50,
- 'label' => 'Path to Preboot:',
- ));
-
- $this->addElement('submit', 'editpreboot', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Edit Preboot',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/dev/preboot"'
- ));
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
}
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('text', 'path_preboot', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 240)),
+ ),
+ 'required' => true,
+ 'size' => 50,
+ 'label' => 'Path to Preboot:',
+ ));
+
+ $this->addElement('submit', 'editpreboot', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Edit Preboot',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/dev/preboot"'
+ ));
+
+ }
}
diff --git a/application/modules/dev/forms/RoleAdd.php b/application/modules/dev/forms/RoleAdd.php
index a9ada27..46cf025 100644
--- a/application/modules/dev/forms/RoleAdd.php
+++ b/application/modules/dev/forms/RoleAdd.php
@@ -1,63 +1,61 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_RoleAdd extends Zend_Form
-{
- private $rightlist;
-
- public function setRightlist($rightlist){
- $this->rightlist = $rightlist;
- }
-
- public function init()
- {
- $this->setName("RoleAdd");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $this->addElement('text', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'label' => 'Description:',
- ));
-
- $this->addElement('checkbox', 'inheritance', array(
- 'label' => 'Inheritance:',
- ));
-
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Add',
- ));
-
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_RoleAdd extends Zend_Form {
+ private $rightlist;
+
+ public function setRightlist($rightlist) {
+ $this->rightlist = $rightlist;
+ }
+
+ public function init() {
+ $this->setName("RoleAdd");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $this->addElement('text', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ ));
+
+ $this->addElement('checkbox', 'inheritance', array(
+ 'label' => 'Inheritance:',
+ ));
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/RoleEdit.php b/application/modules/dev/forms/RoleEdit.php
index 8ae4733..a36795e 100644
--- a/application/modules/dev/forms/RoleEdit.php
+++ b/application/modules/dev/forms/RoleEdit.php
@@ -1,71 +1,69 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class dev_Form_RoleEdit extends Zend_Form
-{
+class dev_Form_RoleEdit extends Zend_Form {
- public function init()
- {
- $this->setName("RoleEdit");
- $this->setMethod('post');
+ public function init() {
+ $this->setName("RoleEdit");
+ $this->setMethod('post');
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- 'value' => $_POST['title'],
- ));
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ 'value' => $_POST['title'],
+ ));
- $this->addElement('text', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'label' => 'Description:',
- 'value' => $_POST['description'],
- ));
+ $this->addElement('text', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ 'value' => $_POST['description'],
+ ));
- if($_POST['inheritance'] == 1) {
- $this->addElement('checkbox', 'inheritance', array(
- 'label' => 'Inheritance:',
- 'checked' => 'checked',
- ));
- } else {
- $this->addElement('checkbox', 'inheritance', array(
- 'label' => 'Inheritance:',
- ));
- }
+ if($_POST['inheritance'] == 1) {
+ $this->addElement('checkbox', 'inheritance', array(
+ 'label' => 'Inheritance:',
+ 'checked' => 'checked',
+ ));
+ } else {
+ $this->addElement('checkbox', 'inheritance', array(
+ 'label' => 'Inheritance:',
+ ));
+ }
- $this->addElement('hidden', 'groupID', array(
- 'value' => $_POST['groupID'],
- ));
+ $this->addElement('hidden', 'groupID', array(
+ 'value' => $_POST['groupID'],
+ ));
- $this->addElement('submit', 'save', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
+ $this->addElement('submit', 'save', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/dev/forms/Session.php b/application/modules/dev/forms/Session.php
index c543188..14004ef 100644
--- a/application/modules/dev/forms/Session.php
+++ b/application/modules/dev/forms/Session.php
@@ -1,149 +1,147 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class dev_Form_Session extends Zend_Form
-{
-
- private $clients;
- private $bootos;
- private $bootisos;
- private $bootmenuentries;
- private $memberships;
-
- public function init()
- {
- $this->setName("session");
- $this->setMethod('post');
-
- $this->addElement('text', 'alphasessionID', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 16)),
- ),
- 'required' => false,
- 'label' => 'alphasessionID:',
- ));
-
- $clientfield = $this->createElement('select','clientID');
- $clientfield ->setLabel('Client:');
- $clientfield->addMultiOption('','');
- if(count($this->clients)>0){
- foreach($this->clients as $id => $g){
- $clientfield->addMultiOption($g->getID(), $g->getMacadress());
- }
- }
- $clientfield->setRegisterInArrayValidator(false);
- $this->addElement($clientfield);
-
-
- $bootmenuentrieyfield = $this->createElement('select','bootmenuentryID');
- $bootmenuentrieyfield->setLabel('BootmenuentryID:');
- $bootmenuentrieyfield->addMultiOption('','');
- if(count($this->bootmenuentries)>0){
- foreach($this->bootmenuentries as $id => $g){
- $bootmenuentrieyfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $bootmenuentrieyfield->setRegisterInArrayValidator(false);
- $this->addElement($bootmenuentrieyfield);
-
-
- $bootosfield = $this->createElement('select','bootosID');
- $bootosfield ->setLabel('BootOs:');
- $bootosfield->addMultiOption('','');
- if(count($this->bootos)>0){
- foreach($this->bootos as $id => $g){
- $bootosfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $bootosfield->setRegisterInArrayValidator(false);
- $this->addElement($bootosfield);
-
- $bootisofield = $this->createElement('select','bootisoID');
- $bootisofield ->setLabel('BootIso:');
- if(count($this->bootisos)>0){
- foreach($this->bootisos as $id => $g){
- $bootisofield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $bootisofield->setRegisterInArrayValidator(false);
- $this->addElement($bootisofield);
-
- $membershipfield = $this->createElement('select','membershipID');
- $membershipfield ->setLabel('Membership:');
- $membershipfield ->addMultiOption('','');
- if(count($this->memberships)>0){
- foreach($this->memberships as $id => $g){
- $membershipfield->addMultiOption($g->getID(), $g->getPersonID());
- }
- }
- $membershipfield->setRegisterInArrayValidator(false);
- $this->addElement($membershipfield);
-
-$this->addElement('text', 'time', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'time:',
- ));
-$this->addElement('text', 'ip', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'ip:',
- ));
-$this->addElement('text', 'ip6', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'ip6:',
- ));
-
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $this->buttontext,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/session"'
- ));
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class dev_Form_Session extends Zend_Form {
+
+ private $clients;
+ private $bootos;
+ private $bootisos;
+ private $bootmenuentries;
+ private $memberships;
+
+ public function init() {
+ $this->setName("session");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'alphasessionID', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 16)),
+ ),
+ 'required' => false,
+ 'label' => 'alphasessionID:',
+ ));
+
+ $clientfield = $this->createElement('select', 'clientID');
+ $clientfield ->setLabel('Client:');
+ $clientfield->addMultiOption('', '');
+ if(count($this->clients) > 0) {
+ foreach($this->clients as $id => $g) {
+ $clientfield->addMultiOption($g->getID(), $g->getMacadress());
+ }
}
- function setClients($v){
- $this->clients = $v;
- }
- function setBootos($v){
- $this->bootos = $v;
- }
- function setBootisos($v){
- $this->bootisos = $v;
- }
- function setBootmenuentries($v){
- $this->bootmenuentries = $v;
- }
- function setMemberships($v){
- $this->memberships = $v;
- }
- private $buttontext = 'Save';
- function setButtontext($v){
- $this->buttontext = $v;
- }
-
+ $clientfield->setRegisterInArrayValidator(false);
+ $this->addElement($clientfield);
+
+
+ $bootmenuentrieyfield = $this->createElement('select', 'bootmenuentryID');
+ $bootmenuentrieyfield->setLabel('BootmenuentryID:');
+ $bootmenuentrieyfield->addMultiOption('', '');
+ if(count($this->bootmenuentries) > 0) {
+ foreach($this->bootmenuentries as $id => $g) {
+ $bootmenuentrieyfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $bootmenuentrieyfield->setRegisterInArrayValidator(false);
+ $this->addElement($bootmenuentrieyfield);
+
+
+ $bootosfield = $this->createElement('select', 'bootosID');
+ $bootosfield ->setLabel('BootOs:');
+ $bootosfield->addMultiOption('', '');
+ if(count($this->bootos) > 0) {
+ foreach($this->bootos as $id => $g) {
+ $bootosfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $bootosfield->setRegisterInArrayValidator(false);
+ $this->addElement($bootosfield);
+
+ $bootisofield = $this->createElement('select', 'bootisoID');
+ $bootisofield ->setLabel('BootIso:');
+ if(count($this->bootisos) > 0) {
+ foreach($this->bootisos as $id => $g) {
+ $bootisofield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $bootisofield->setRegisterInArrayValidator(false);
+ $this->addElement($bootisofield);
+
+ $membershipfield = $this->createElement('select', 'membershipID');
+ $membershipfield ->setLabel('Membership:');
+ $membershipfield ->addMultiOption('', '');
+ if(count($this->memberships) > 0) {
+ foreach($this->memberships as $id => $g) {
+ $membershipfield->addMultiOption($g->getID(), $g->getPersonID());
+ }
+ }
+ $membershipfield->setRegisterInArrayValidator(false);
+ $this->addElement($membershipfield);
+
+ $this->addElement('text', 'time', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'time:',
+ ));
+ $this->addElement('text', 'ip', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'ip:',
+ ));
+ $this->addElement('text', 'ip6', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'ip6:',
+ ));
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/session"'
+ ));
+ }
+ function setClients($v) {
+ $this->clients = $v;
+ }
+ function setBootos($v) {
+ $this->bootos = $v;
+ }
+ function setBootisos($v) {
+ $this->bootisos = $v;
+ }
+ function setBootmenuentries($v) {
+ $this->bootmenuentries = $v;
+ }
+ function setMemberships($v) {
+ $this->memberships = $v;
+ }
+ private $buttontext = 'Save';
+ function setButtontext($v) {
+ $this->buttontext = $v;
+ }
+
}
diff --git a/application/modules/fbgui/Bootstrap.php b/application/modules/fbgui/Bootstrap.php
index 60e2a7b..75c3df3 100644
--- a/application/modules/fbgui/Bootstrap.php
+++ b/application/modules/fbgui/Bootstrap.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -9,14 +9,12 @@
*
* General information about OpenSLX can be found at http://openslx.org/
*/
-class fbgui_Bootstrap extends Zend_Application_Module_Bootstrap
-{
- function _initViewHelpers()
- {
- $this->bootstrap('layout');
-
- $layout = $this->getResource('layout');
- $view = $layout->getView();
- $view->headLink()->appendStylesheet('/media/css/fbgui.css');
- }
+class fbgui_Bootstrap extends Zend_Application_Module_Bootstrap {
+ function _initViewHelpers() {
+ $this->bootstrap('layout');
+
+ $layout = $this->getResource('layout');
+ $view = $layout->getView();
+ $view->headLink()->appendStylesheet('/media/css/fbgui.css');
+ }
}
diff --git a/application/modules/fbgui/controllers/AuthController.php b/application/modules/fbgui/controllers/AuthController.php
index 936aa61..f51d89f 100644
--- a/application/modules/fbgui/controllers/AuthController.php
+++ b/application/modules/fbgui/controllers/AuthController.php
@@ -1,84 +1,79 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Fbgui_AuthController extends Zend_Controller_Action
-{
-
- public function init()
- {
- $this->db = Zend_Db_Table::getDefaultAdapter();
- $this->personmapper = new Application_Model_PersonMapper();
- }
-
- public function indexAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- $this->_helper->redirector('login', 'auth');
- }
-
- public function loginAction()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->_redirect('/fbgui/');
- } else {
- if (!isset($_POST["login"])){
- $loginForm = new fbgui_Form_Login();
- } else {
- $loginForm = new fbgui_Form_Login($_POST);
-
- if ($loginForm->isValid($_POST)) {
-
- $auth = Zend_Auth::getInstance();
-
- $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'pbs_person', 'email', 'password', 'MD5(CONCAT(?, password_salt))');
-
-
- $adapter->setIdentity($loginForm->getValue('email'));
- $adapter->setCredential($loginForm->getValue('password'));
-
- $result = $auth->authenticate($adapter);
-
- // TODO: erweiterte fehlerbeschreibung des Users
-
- if ($result->isValid()) {
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $date = new DateTime();
- $person->setLogindate($date->getTimestamp());
- $this->personmapper->save($person);
- $this->_helper->redirector('selectmembership', 'person');
- return;
- } else {
- echo "Wrong Email or Password.";
- }
- }
- }
- $this->view->loginForm = $loginForm;
- }
- }
-
- public function logoutAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- $auth = Zend_Auth::getInstance();
- $auth->clearIdentity();
- Zend_Session::namespaceUnset('userIDs');
- Zend_Session::forgetMe();
- $this->_redirect('/fbgui/index');
-# $this->_helper->redirector('fbgui', 'index');
- return;
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Fbgui_AuthController extends Zend_Controller_Action {
+
+ public function init() {
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ $this->personmapper = new Application_Model_PersonMapper();
+ }
+
+ public function indexAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ $this->_helper->redirector('login', 'auth');
+ }
+
+ public function loginAction() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->_redirect('/fbgui/');
+ } else {
+ if (!isset($_POST["login"])) {
+ $loginForm = new fbgui_Form_Login();
+ } else {
+ $loginForm = new fbgui_Form_Login($_POST);
+
+ if ($loginForm->isValid($_POST)) {
+
+ $auth = Zend_Auth::getInstance();
+
+ $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'pbs_person', 'email', 'password', 'MD5(CONCAT(?, password_salt))');
+
+
+ $adapter->setIdentity($loginForm->getValue('email'));
+ $adapter->setCredential($loginForm->getValue('password'));
+
+ $result = $auth->authenticate($adapter);
+
+ // TODO: erweiterte fehlerbeschreibung des Users
+
+ if ($result->isValid()) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()), true);
+ $person = new Application_Model_Person($result[0]);
+ $person->setID($result[0]['personID']);
+ $date = new DateTime();
+ $person->setLogindate($date->getTimestamp());
+ $this->personmapper->save($person);
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ } else {
+ echo "Wrong Email or Password.";
+ }
+ }
+ }
+ $this->view->loginForm = $loginForm;
+ }
+ }
+
+ public function logoutAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ $auth = Zend_Auth::getInstance();
+ $auth->clearIdentity();
+ Zend_Session::namespaceUnset('userIDs');
+ Zend_Session::forgetMe();
+ $this->_redirect('/fbgui/index');
+# $this->_helper->redirector('fbgui', 'index');
+ return;
+ }
}
diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php
index e5f8abd..9e2856e 100644
--- a/application/modules/fbgui/controllers/IndexController.php
+++ b/application/modules/fbgui/controllers/IndexController.php
@@ -1,197 +1,189 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Fbgui_IndexController extends Zend_Controller_Action
-{
- protected $membership;
-
- public function init()
- {
- /* Initialize action controller here */
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
-
- $membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
- }
-
- public function errorAction()
- {
- $result = $this->_request->getParam('serialresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('serial',$result);
- }
- }
-
- public function indexAction()
- {
- $mySession = new Zend_Session_Namespace('pbs');
- $this->view->notification = array();
-
-
- if(count($mySession->postdata)<=0){
- $mySession->postdata = $_POST;
- }
-
- $result = $this->_request->getParam('notify');
- if($result == 'nomember'){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification[] = $pbsNotifier->notify('You have no membership, therefore you have no own BootMenu','info');
- }
-
- $d = new Pbs_Debug();
- $d->debug(array('FBGuiIndexController',$_SERVER['REMOTE_ADDR'],implode("\t",$mySession->postdata)));
-
- if(isset($mySession->postdata['bootisoID']) || isset($mySession->postdata['serialnumber'])){
- // Create a session
- $n = new Pbs_Session();
-
- $bootisomapper = new Application_Model_BootIsoMapper();
- $bootiso = new Application_Model_BootIso();
- if(isset($mySession->postdata['bootisoID'])){
- $bootisomapper->find($mySession->postdata['bootisoID'],$bootiso);
- $groupID = $bootiso->getGroupID();
- }
- elseif(isset($mySession->postdata['serialnumber'])){
- $results = $bootisomapper->findBy(array('serialnumber' => $mySession->postdata['serialnumber']),true);
- if(count($results) == 0){
- $this->_redirect('/fbgui/index/error/serialresult/noserial2');
- }
- $bootiso->setOptions($results[0]);
- $bootiso->setID($results[0]['bootisoID']);
- $groupID = $bootiso->getGroupID();
-
- }
-
- $client = new Application_Model_Client();
- $client->setMacadress($mySession->postdata['mac']);
- $client->setHardwarehash($mySession->postdata['hardwarehash']);
- $client->setGroupID($groupID);
- $client->setCreated(time());
- $client = $n->createClient($client);
- $clientID = $client->getID();
-
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
-
- if(!isset($_SESSION['alphasessionID'])){
- $session = new Application_Model_Session();
- $session->setBootisoID($bootiso->getID());
- $session->setClientID($clientID);
- $session->setTime(time());
- if($this->membership->getID() != ''){
- $session->setMembershipID($this->membership->getID());
- }
- $session->setIp($_SERVER['REMOTE_ADDR']);
- $session = $n->createSession($session);
- $_SESSION['alphasessionID'] = $session->getAlphasessionID();
- }
- else{
- $session = new Application_Model_Session();
- $sessionMapper = new Application_Model_SessionMapper();
- $sessions = $sessionMapper->findBy(array('alphasessionID'=>$_SESSION['alphasessionID']));
- $session = $sessions[0];
- if($this->membership->getID() != '' && $session->getMembershipID() == ''){
- $session->setMembershipID($this->membership->getID());
- $sessionMapper->save($session);
- }
- }
- // Request Bootmenu
- $pbsFilter = new Pbs_Filter();
- $bootmenuID = $pbsFilter->evaluate();
- if($bootmenuID != null){
- $this->view->alphasessionID = $_SESSION['alphasessionID'];
- // print_a('Debug Output',
- // 'Session is now set',
- // 'Your sessionID is '.$session->getID(),
- // 'Your alphasessionID is '.$session->getAlphasessionID(),
- // 'Your client is '.$session->getClientID(),
- // 'goto bootmenu '.$bootmenuID);
-
- $bootmenuMapper = new Application_Model_BootMenuMapper();
- $bm = $bootmenuMapper->find($bootmenuID);
- $this->view->title = $bm->getTitle();
- $this->view->startcounter = $bm->getStartcounter();
-
- $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false);
- $this->view->entries = $res;
-
- if (!Zend_Auth::getInstance()->hasIdentity()) {
- $this->view->loginmenu = true;
- }
-
- if(Zend_Auth::getInstance()->hasIdentity()){
- if($bm->MembershipID != '' && $bm->MembershipID == $this->membership->getID()){}
- else{
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification[] = $pbsNotifier->notify("This is not your Bootmenu. There is currently a BootMenu with a higher priority active.",'info');
- }
- }
-
- if(count($res) == 0){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification[] = $pbsNotifier->notify("There are no entries in the bootmenu.",'info');
- $this->view->nobootmenu = true;
- unset($this->view->entries);
- }
-
-
- }
- else{
- // print_a('Debug Output',
- // 'Session is now set',
- // 'Your sessionID is '.$session->getID(),
- // 'Your alphasessionID is '.$session->getAlphasessionID(),
- // 'Your client is '.$session->getClientID(),
- // 'there is no bootmenu for you');
- if (!Zend_Auth::getInstance()->hasIdentity()) {
- $this->view->loginmenu = true;
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification[] = $pbsNotifier->notify("There is no default BootMenu, please Login to get your BootMenu.",'info');
- }
- else{
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification[] = $pbsNotifier->notify("You have no BootMenu.",'info');
- }
- $this->view->nobootmenu = true;
- }
- }
- else{
- #$this->_redirect('/fbgui/index/error/serialresult/noserial');
- }
-
- }
- public function startAction(){
- $bootmenuntryID = $this->_request->getParam('bme');
- $a = $_SESSION['alphasessionID'];
- $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry);
-
- $sessionMapper = new Application_Model_SessionMapper();
- $session_k = $sessionMapper->findBy(array('alphasessionID' => $a),true);
-
- $session = new Application_Model_Session();
- $session->setOptions($session_k[0]);
- $session->setID($session_k[0]['sessionID']);
-
- $session->setBootmenuentryID($bootmenuntryID);
- $session->setBootosID($bootmenuentry->getBootosID());
- $sessionMapper->save($session);
-
-
- $this->view->host = 'pbs2.mp.openslx.org';
- $this->view->alphasessionID = $a;
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Fbgui_IndexController extends Zend_Controller_Action {
+ protected $membership;
+
+ public function init() {
+ /* Initialize action controller here */
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+ }
+
+ public function errorAction() {
+ $result = $this->_request->getParam('serialresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('serial', $result);
+ }
+ }
+
+ public function indexAction() {
+ $mySession = new Zend_Session_Namespace('pbs');
+ $this->view->notification = array();
+
+
+ if(count($mySession->postdata) <= 0) {
+ $mySession->postdata = $_POST;
+ }
+
+ $result = $this->_request->getParam('notify');
+ if($result == 'nomember') {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification[] = $pbsNotifier->notify('You have no membership, therefore you have no own BootMenu', 'info');
+ }
+
+ $d = new Pbs_Debug();
+ $d->debug(array('FBGuiIndexController', $_SERVER['REMOTE_ADDR'], implode("\t", $mySession->postdata)));
+
+ if(isset($mySession->postdata['bootisoID']) || isset($mySession->postdata['serialnumber'])) {
+ // Create a session
+ $n = new Pbs_Session();
+
+ $bootisomapper = new Application_Model_BootIsoMapper();
+ $bootiso = new Application_Model_BootIso();
+ if(isset($mySession->postdata['bootisoID'])) {
+ $bootisomapper->find($mySession->postdata['bootisoID'], $bootiso);
+ $groupID = $bootiso->getGroupID();
+ }
+ elseif(isset($mySession->postdata['serialnumber'])) {
+ $results = $bootisomapper->findBy(array('serialnumber' => $mySession->postdata['serialnumber']), true);
+ if(count($results) == 0) {
+ $this->_redirect('/fbgui/index/error/serialresult/noserial2');
+ }
+ $bootiso->setOptions($results[0]);
+ $bootiso->setID($results[0]['bootisoID']);
+ $groupID = $bootiso->getGroupID();
+
+ }
+
+ $client = new Application_Model_Client();
+ $client->setMacadress($mySession->postdata['mac']);
+ $client->setHardwarehash($mySession->postdata['hardwarehash']);
+ $client->setGroupID($groupID);
+ $client->setCreated(time());
+ $client = $n->createClient($client);
+ $clientID = $client->getID();
+
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+
+ if(!isset($_SESSION['alphasessionID'])) {
+ $session = new Application_Model_Session();
+ $session->setBootisoID($bootiso->getID());
+ $session->setClientID($clientID);
+ $session->setTime(time());
+ if($this->membership->getID() != '') {
+ $session->setMembershipID($this->membership->getID());
+ }
+ $session->setIp($_SERVER['REMOTE_ADDR']);
+ $session = $n->createSession($session);
+ $_SESSION['alphasessionID'] = $session->getAlphasessionID();
+ } else {
+ $session = new Application_Model_Session();
+ $sessionMapper = new Application_Model_SessionMapper();
+ $sessions = $sessionMapper->findBy(array('alphasessionID' => $_SESSION['alphasessionID']));
+ $session = $sessions[0];
+ if($this->membership->getID() != '' && $session->getMembershipID() == '') {
+ $session->setMembershipID($this->membership->getID());
+ $sessionMapper->save($session);
+ }
+ }
+ // Request Bootmenu
+ $pbsFilter = new Pbs_Filter();
+ $bootmenuID = $pbsFilter->evaluate();
+ if($bootmenuID != null) {
+ $this->view->alphasessionID = $_SESSION['alphasessionID'];
+ // print_a('Debug Output',
+ // 'Session is now set',
+ // 'Your sessionID is '.$session->getID(),
+ // 'Your alphasessionID is '.$session->getAlphasessionID(),
+ // 'Your client is '.$session->getClientID(),
+ // 'goto bootmenu '.$bootmenuID);
+
+ $bootmenuMapper = new Application_Model_BootMenuMapper();
+ $bm = $bootmenuMapper->find($bootmenuID);
+ $this->view->title = $bm->getTitle();
+ $this->view->startcounter = $bm->getStartcounter();
+
+ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID), false);
+ $this->view->entries = $res;
+
+ if (!Zend_Auth::getInstance()->hasIdentity()) {
+ $this->view->loginmenu = true;
+ }
+
+ if(Zend_Auth::getInstance()->hasIdentity()) {
+ if($bm->MembershipID != '' && $bm->MembershipID == $this->membership->getID()) {
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification[] = $pbsNotifier->notify("This is not your Bootmenu. There is currently a BootMenu with a higher priority active.", 'info');
+ }
+ }
+
+ if(count($res) == 0) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification[] = $pbsNotifier->notify("There are no entries in the bootmenu.", 'info');
+ $this->view->nobootmenu = true;
+ unset($this->view->entries);
+ }
+
+
+ } else {
+ // print_a('Debug Output',
+ // 'Session is now set',
+ // 'Your sessionID is '.$session->getID(),
+ // 'Your alphasessionID is '.$session->getAlphasessionID(),
+ // 'Your client is '.$session->getClientID(),
+ // 'there is no bootmenu for you');
+ if (!Zend_Auth::getInstance()->hasIdentity()) {
+ $this->view->loginmenu = true;
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification[] = $pbsNotifier->notify("There is no default BootMenu, please Login to get your BootMenu.", 'info');
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification[] = $pbsNotifier->notify("You have no BootMenu.", 'info');
+ }
+ $this->view->nobootmenu = true;
+ }
+ } else {
+#$this->_redirect('/fbgui/index/error/serialresult/noserial');
+ }
+
+ }
+ public function startAction() {
+ $bootmenuntryID = $this->_request->getParam('bme');
+ $a = $_SESSION['alphasessionID'];
+ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenuentriesMapper->find($bootmenuntryID, $bootmenuentry);
+
+ $sessionMapper = new Application_Model_SessionMapper();
+ $session_k = $sessionMapper->findBy(array('alphasessionID' => $a), true);
+
+ $session = new Application_Model_Session();
+ $session->setOptions($session_k[0]);
+ $session->setID($session_k[0]['sessionID']);
+
+ $session->setBootmenuentryID($bootmenuntryID);
+ $session->setBootosID($bootmenuentry->getBootosID());
+ $sessionMapper->save($session);
+
+
+ $this->view->host = 'pbs2.mp.openslx.org';
+ $this->view->alphasessionID = $a;
+ }
}
diff --git a/application/modules/fbgui/controllers/PersonController.php b/application/modules/fbgui/controllers/PersonController.php
index b884a28..0e3ab14 100644
--- a/application/modules/fbgui/controllers/PersonController.php
+++ b/application/modules/fbgui/controllers/PersonController.php
@@ -1,94 +1,91 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class Fbgui_PersonController extends Zend_Controller_Action
-{
- protected $person;
- protected $personmapper;
- protected $membershipMapper;
- protected $memberships;
+class Fbgui_PersonController extends Zend_Controller_Action {
+ protected $person;
+ protected $personmapper;
+ protected $membershipMapper;
+ protected $memberships;
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $this->person = new Application_Model_Person($result[0]);
- $this->person->setID($result[0]['personID']);
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->memberships = $this->membershipMapper->findBy(array("personID" => $this->person->getID()),true);
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- }
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()), true);
+ $this->person = new Application_Model_Person($result[0]);
+ $this->person->setID($result[0]['personID']);
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->memberships = $this->membershipMapper->findBy(array("personID" => $this->person->getID()), true);
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ }
- public function indexAction()
- {
- $this->_helper->redirector('selectmembership', 'person');
- }
+ public function indexAction() {
+ $this->_helper->redirector('selectmembership', 'person');
+ }
- public function selectmembershipAction()
- {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if(isset($userIDsNamespace['membershipID'])) {
- $this->_redirect('/fbgui/');
- } else {
- if(count($this->memberships) == 1) {
- $myMembership = $this->memberships[0];
- $roleSession = new Zend_Session_Namespace('userIDs');
- $roleSession->membershipID = $myMembership['membershipID'];
- $roleSession->personID = $myMembership['personID'];
- $roleSession->groupID = $myMembership['groupID'];
- $roleSession->roleID = $myMembership['roleID'];
- $this->_redirect('/fbgui/');
- } elseif(count($this->memberships) > 1) {
- if(isset($_POST['selectmembership'])) {
- $roleSession = new Zend_Session_Namespace('userIDs');
- $roleSession->membershipID = $_POST['membershipID'];
- $roleSession->personID = $this->person->getID();
- $membership = $this->membershipMapper->find($_POST['membershipID']);
- $roleSession->groupID = $membership->getGroupID();
- $roleSession->roleID = $membership->getRoleID();
- $this->_redirect('/fbgui/');
- return;
- } else {
- $groupMapper = new Application_Model_GroupMapper();
- $roleMapper = new Application_Model_RoleMapper();
- if(isset($this->memberships)) {
- foreach($this->memberships as $membership) {
- $group = $groupMapper->find($membership['groupID']);
- $role = $roleMapper->find($membership['roleID']);
- $membershipList[] = array(
- 'membershipID' => $membership['membershipID'],
- 'group' => $group->getTitle(),
- 'role' => $role->getTitle()
- );
- }
- }
- $membershipSelectForm = new fbgui_Form_MembershipSelect(array('membershiplist' => $membershipList));
- $this->view->membershipSelectForm = $membershipSelectForm;
- }
- } else {
- $this->_redirect('/fbgui/index/index/notify/nomember');
- }
- }
- }
+ public function selectmembershipAction() {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if(isset($userIDsNamespace['membershipID'])) {
+ $this->_redirect('/fbgui/');
+ } else {
+ if(count($this->memberships) == 1) {
+ $myMembership = $this->memberships[0];
+ $roleSession = new Zend_Session_Namespace('userIDs');
+ $roleSession->membershipID = $myMembership['membershipID'];
+ $roleSession->personID = $myMembership['personID'];
+ $roleSession->groupID = $myMembership['groupID'];
+ $roleSession->roleID = $myMembership['roleID'];
+ $this->_redirect('/fbgui/');
+ }
+ elseif(count($this->memberships) > 1) {
+ if(isset($_POST['selectmembership'])) {
+ $roleSession = new Zend_Session_Namespace('userIDs');
+ $roleSession->membershipID = $_POST['membershipID'];
+ $roleSession->personID = $this->person->getID();
+ $membership = $this->membershipMapper->find($_POST['membershipID']);
+ $roleSession->groupID = $membership->getGroupID();
+ $roleSession->roleID = $membership->getRoleID();
+ $this->_redirect('/fbgui/');
+ return;
+ } else {
+ $groupMapper = new Application_Model_GroupMapper();
+ $roleMapper = new Application_Model_RoleMapper();
+ if(isset($this->memberships)) {
+ foreach($this->memberships as $membership) {
+ $group = $groupMapper->find($membership['groupID']);
+ $role = $roleMapper->find($membership['roleID']);
+ $membershipList[] = array(
+ 'membershipID' => $membership['membershipID'],
+ 'group' => $group->getTitle(),
+ 'role' => $role->getTitle()
+ );
+ }
+ }
+ $membershipSelectForm = new fbgui_Form_MembershipSelect(array('membershiplist' => $membershipList));
+ $this->view->membershipSelectForm = $membershipSelectForm;
+ }
+ }
+ else {
+ $this->_redirect('/fbgui/index/index/notify/nomember');
+ }
+ }
+ }
- public function changemembershipAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- Zend_Session::namespaceUnset('userIDs');
- $this->_helper->redirector('selectmembership', 'person');
- return;
- }
+ public function changemembershipAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ Zend_Session::namespaceUnset('userIDs');
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ }
}
diff --git a/application/modules/fbgui/forms/Login.php b/application/modules/fbgui/forms/Login.php
index 896b555..759f53e 100644
--- a/application/modules/fbgui/forms/Login.php
+++ b/application/modules/fbgui/forms/Login.php
@@ -1,52 +1,50 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class fbgui_Form_Login extends Zend_Form
-{
-
- public function init()
- {
- $this->setName("Login");
- $this->setMethod('post');
-
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim', 'StringToLower'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'id' => 'email',
- 'class' => 'keyboardInput',
- 'label' => 'E-Mail:',
- ));
-
- $this->addElement('password', 'password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'id' => 'pass',
- 'class' => 'keyboardInput',
- 'label' => 'Password:',
- ));
-
- $this->addElement('submit', 'login', array(
- 'required' => false,
- 'id' => 'submit',
- 'ignore' => true,
- 'label' => 'Login',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class fbgui_Form_Login extends Zend_Form {
+
+ public function init() {
+ $this->setName("Login");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'email', array(
+ 'filters' => array('StringTrim', 'StringToLower'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'id' => 'email',
+ 'class' => 'keyboardInput',
+ 'label' => 'E-Mail:',
+ ));
+
+ $this->addElement('password', 'password', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'id' => 'pass',
+ 'class' => 'keyboardInput',
+ 'label' => 'Password:',
+ ));
+
+ $this->addElement('submit', 'login', array(
+ 'required' => false,
+ 'id' => 'submit',
+ 'ignore' => true,
+ 'label' => 'Login',
+ ));
+ }
}
diff --git a/application/modules/fbgui/forms/MembershipSelect.php b/application/modules/fbgui/forms/MembershipSelect.php
index d59a6d8..d75a5bf 100644
--- a/application/modules/fbgui/forms/MembershipSelect.php
+++ b/application/modules/fbgui/forms/MembershipSelect.php
@@ -1,52 +1,50 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class fbgui_Form_MembershipSelect extends Zend_Form
-{
- private $membershiplist;
-
- public function setMembershiplist($membershiplist){
- $this->membershiplist = $membershiplist;
-
- }
-
- public function getMembershiplist(){
- return $this->membershiplist;
- }
-
- public function init()
- {
- $this->setName("MembershipSelect");
- $this->setMethod('post');
-
- $membershipfield = $this->createElement('select','membershipID');
- $membershipfield ->setLabel('Membership:');
-
- if(count($this->membershiplist)>0){
- foreach($this->membershiplist as $membership => $m){
- $membershipfield->addMultiOption($m['membershipID'], $m['group'] . ' - ' . $m['role']);
- }
- }
-
- $membershipfield->setRegisterInArrayValidator(false);
- $this->addElement($membershipfield);
-
- $this->addElement('submit', 'selectmembership', array(
- 'required' => false,
- 'id' => 'submit',
- 'ignore' => true,
- 'label' => 'Select',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class fbgui_Form_MembershipSelect extends Zend_Form {
+ private $membershiplist;
+
+ public function setMembershiplist($membershiplist) {
+ $this->membershiplist = $membershiplist;
+
+ }
+
+ public function getMembershiplist() {
+ return $this->membershiplist;
+ }
+
+ public function init() {
+ $this->setName("MembershipSelect");
+ $this->setMethod('post');
+
+ $membershipfield = $this->createElement('select', 'membershipID');
+ $membershipfield ->setLabel('Membership:');
+
+ if(count($this->membershiplist) > 0) {
+ foreach($this->membershiplist as $membership => $m) {
+ $membershipfield->addMultiOption($m['membershipID'], $m['group'] . ' - ' . $m['role']);
+ }
+ }
+
+ $membershipfield->setRegisterInArrayValidator(false);
+ $this->addElement($membershipfield);
+
+ $this->addElement('submit', 'selectmembership', array(
+ 'required' => false,
+ 'id' => 'submit',
+ 'ignore' => true,
+ 'label' => 'Select',
+ ));
+ }
}
diff --git a/application/modules/ipxe/controllers/AuthController.php b/application/modules/ipxe/controllers/AuthController.php
index e6f1336..b59c146 100644
--- a/application/modules/ipxe/controllers/AuthController.php
+++ b/application/modules/ipxe/controllers/AuthController.php
@@ -1,218 +1,213 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Ipxe_AuthController extends Zend_Controller_Action
-{
- protected $session;
- protected $sessionMapper;
- protected $error;
-
- public function init()
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
- $this->db = Zend_Db_Table::getDefaultAdapter();
-
- $this->session = new Application_Model_Session();
- $this->sessionMapper = new Application_Model_SessionMapper();
-
- $alphaID = $this->_request->getParam('alpha');
-
- if(isset($alphaID)){
- $alphasessionID = $alphaID;
- $result = $this->sessionMapper->findBy(array('alphasessionID' => $alphasessionID),true);
- if(isset($result)){
- $this->session = $this->session->setOptions($result[0]);
- $this->session->setID($result[0]['sessionID']);
- }else{
- $this->error = "session";
- }
- }
- }
-
- public function serialAction()
- {
- $serialnumber = $this->_request->getParam('serialnumber');
- $mac = $this->_request->getParam('mac');
-
- if(isset($serialnumber)){
- // Create a session
- $n = new Pbs_Session();
-
- $bootisomapper = new Application_Model_BootIsoMapper();
- $bootiso = new Application_Model_BootIso();
-
- $results = $bootisomapper->findBy(array('serialnumber' => $serialnumber),true);
-
- if(isset($results)){
- $bootiso->setOptions($results[0]);
- $bootiso->setID($results[0]['bootisoID']);
- $groupID = $bootiso->getGroupID();
-
- $client = new Application_Model_Client();
- $client->setGroupID($groupID);
- $client->setMacadress($mac);
- $client->setCreated(time());
- $client = $n->createClient($client);
- $clientID = $client->getID();
-
- $this->session->setBootisoID($bootiso->getID());
- $this->session->setClientID($clientID);
- $this->session->setTime(time());
- $this->session->setIp($_SERVER['REMOTE_ADDR']);
- $this->session = $n->createSession($this->session);
- }else{
- $this->error = "serial";
- }
- }
- else{
- $this->error = "serial";
- }
-
- header('Content-Type: text/plain');
-
- $result = "#!ipxe\n";
- if(isset($this->session)){
- $result .= "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/".$this->error."\n";
- $result .= ":start\n";
- $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 \${filename}\n";
- $result .= "goto start\n";
- }else{
- $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/serialnumber/$serialnumber/mac/$mac/error/$this->error\n";
- }
- header("Content-Length: ".(strlen($result)));
- echo $result;
-
- }
-
- public function loginAction()
- {
- $alpha = $this->_request->getParam('alpha');
- $login = $this->_request->getParam('login');
-
- if (isset($login)){
- header('Content-Type: text/plain');
- $result = "#!ipxe\n";
- $result .= "clear username\n";
- $result .= "clear password\n";
- $result .= "login\n";
- $result .= "isset \${username} || set username null\n";
- $result .= "chain http://\${username:uristring}:\${password:uristring}@".$_SERVER['HTTP_HOST']."/ipxe/auth/login/alpha/".$alpha."\n";
- header("Content-Length: ".(strlen($result)));
- echo $result;
- exit;
- }
-
- if(!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])){
- header('WWW-Authenticate: Basic realm=""');
- header('HTTP/1.0 401 Unauthorized');
- $result = "#!ipxe\n";
- $result .= "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/login\n";
- header("Content-Length: ".(strlen($result)));
- echo $result;
- exit;
- }
-
- $email = $_SERVER['PHP_AUTH_USER'];
- $password = $_SERVER['PHP_AUTH_PW'];
-
- $auth = Zend_Auth::getInstance();
- $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'pbs_person', 'email', 'password', 'MD5(CONCAT(?, password_salt))');
- $adapter->setIdentity($email);
- $adapter->setCredential($password);
-
- $result = $auth->authenticate($adapter);
-
- if (isset($this->session)){
- if ($result->isValid()) {
-
- $personmapper = new Application_Model_PersonMapper();
- $result = $personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $date = new DateTime();
- $person->setLogindate($date->getTimestamp());
- $personmapper->save($person);
-
- $this->session->setPersonID($person->getID());
- $this->sessionMapper->save($this->session);
-
- } else {
- $this->error = "login";
- }
- }else{
- $this->error = "session";
- }
-
-
- header('Content-Type: text/plain');
- $result = "#!ipxe\n";
- $result .= "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/".$this->error."\n";
- header("Content-Length: ".(strlen($result)));
- echo $result;
- exit;
-
-
-
- }
-
- public function logoutAction(){
-
- $alpha = $this->_request->getParam('alpha');
-
- if (isset($this->session)){
- $this->session->setPersonID(null);
- $this->session->setMembershipID(null);
- $this->sessionMapper->save($this->session);
- }else{
- $this->error = "session";
- }
-
- $this->_redirect('/ipxe/resource/getvesamenuconfig/alpha/'.$alpha.'/error/'.$this->error);
-
- }
-
- public function switchgroupAction(){
-
- $alpha = $this->_request->getParam('alpha');
-
- if (isset($this->session)){
- $this->session->setMembershipID(null);
- $this->sessionMapper->save($this->session);
- }else{
- $this->error = "session";
- }
-
- $this->_redirect('/ipxe/resource/getvesamenuconfig/alpha/'.$alpha.'/error/'.$this->error);
- }
-
- public function setgroupAction(){
-
- $alpha = $this->_request->getParam('alpha');
- $membershipID = $this->_request->getParam('membershipid');
-
- //TODO test if member of group
- if (isset($this->session)){
- $this->session->setMembershipID($membershipID);
- $this->sessionMapper->save($this->session);
- }else{
- $this->error = "session";
- }
-
- $this->_redirect('/ipxe/resource/getvesamenuconfig/alpha/'.$alpha.'/error/'.$this->error);
- }
-
-
-
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Ipxe_AuthController extends Zend_Controller_Action {
+ protected $session;
+ protected $sessionMapper;
+ protected $error;
+
+ public function init() {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+
+ $this->session = new Application_Model_Session();
+ $this->sessionMapper = new Application_Model_SessionMapper();
+
+ $alphaID = $this->_request->getParam('alpha');
+
+ if(isset($alphaID)) {
+ $alphasessionID = $alphaID;
+ $result = $this->sessionMapper->findBy(array('alphasessionID' => $alphasessionID), true);
+ if(isset($result)) {
+ $this->session = $this->session->setOptions($result[0]);
+ $this->session->setID($result[0]['sessionID']);
+ } else {
+ $this->error = "session";
+ }
+ }
+ }
+
+ public function serialAction() {
+ $serialnumber = $this->_request->getParam('serialnumber');
+ $mac = $this->_request->getParam('mac');
+
+ if(isset($serialnumber)) {
+ // Create a session
+ $n = new Pbs_Session();
+
+ $bootisomapper = new Application_Model_BootIsoMapper();
+ $bootiso = new Application_Model_BootIso();
+
+ $results = $bootisomapper->findBy(array('serialnumber' => $serialnumber), true);
+
+ if(isset($results)) {
+ $bootiso->setOptions($results[0]);
+ $bootiso->setID($results[0]['bootisoID']);
+ $groupID = $bootiso->getGroupID();
+
+ $client = new Application_Model_Client();
+ $client->setGroupID($groupID);
+ $client->setMacadress($mac);
+ $client->setCreated(time());
+ $client = $n->createClient($client);
+ $clientID = $client->getID();
+
+ $this->session->setBootisoID($bootiso->getID());
+ $this->session->setClientID($clientID);
+ $this->session->setTime(time());
+ $this->session->setIp($_SERVER['REMOTE_ADDR']);
+ $this->session = $n->createSession($this->session);
+ } else {
+ $this->error = "serial";
+ }
+ } else {
+ $this->error = "serial";
+ }
+
+ header('Content-Type: text/plain');
+
+ $result = "#!ipxe\n";
+ if(isset($this->session)) {
+ $result . = "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/".$this->error."\n";
+ $result . = ":start\n";
+ $result . = "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 \${filename}\n";
+ $result . = "goto start\n";
+ } else {
+ $result . = "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/serialnumber/$serialnumber/mac/$mac/error/$this->error\n";
+ }
+ header("Content-Length: ".(strlen($result)));
+ echo $result;
+
+ }
+
+ public function loginAction() {
+ $alpha = $this->_request->getParam('alpha');
+ $login = $this->_request->getParam('login');
+
+ if (isset($login)) {
+ header('Content-Type: text/plain');
+ $result = "#!ipxe\n";
+ $result . = "clear username\n";
+ $result . = "clear password\n";
+ $result . = "login\n";
+ $result . = "isset \${username} || set username null\n";
+ $result . = "chain http://\${username:uristring}:\${password:uristring}@".$_SERVER['HTTP_HOST']."/ipxe/auth/login/alpha/".$alpha."\n";
+ header("Content-Length: ".(strlen($result)));
+ echo $result;
+ exit;
+ }
+
+ if(!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {
+ header('WWW-Authenticate: Basic realm=""');
+ header('HTTP/1.0 401 Unauthorized');
+ $result = "#!ipxe\n";
+ $result . = "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/login\n";
+ header("Content-Length: ".(strlen($result)));
+ echo $result;
+ exit;
+ }
+
+ $email = $_SERVER['PHP_AUTH_USER'];
+ $password = $_SERVER['PHP_AUTH_PW'];
+
+ $auth = Zend_Auth::getInstance();
+ $adapter = new Zend_Auth_Adapter_DbTable($this->db, 'pbs_person', 'email', 'password', 'MD5(CONCAT(?, password_salt))');
+ $adapter->setIdentity($email);
+ $adapter->setCredential($password);
+
+ $result = $auth->authenticate($adapter);
+
+ if (isset($this->session)) {
+ if ($result->isValid()) {
+
+ $personmapper = new Application_Model_PersonMapper();
+ $result = $personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()), true);
+ $person = new Application_Model_Person($result[0]);
+ $person->setID($result[0]['personID']);
+ $date = new DateTime();
+ $person->setLogindate($date->getTimestamp());
+ $personmapper->save($person);
+
+ $this->session->setPersonID($person->getID());
+ $this->sessionMapper->save($this->session);
+
+ } else {
+ $this->error = "login";
+ }
+ } else {
+ $this->error = "session";
+ }
+
+
+ header('Content-Type: text/plain');
+ $result = "#!ipxe\n";
+ $result . = "set filename http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/".$this->error."\n";
+ header("Content-Length: ".(strlen($result)));
+ echo $result;
+ exit;
+
+
+
+ }
+
+ public function logoutAction() {
+
+ $alpha = $this->_request->getParam('alpha');
+
+ if (isset($this->session)) {
+ $this->session->setPersonID(null);
+ $this->session->setMembershipID(null);
+ $this->sessionMapper->save($this->session);
+ } else {
+ $this->error = "session";
+ }
+
+ $this->_redirect('/ipxe/resource/getvesamenuconfig/alpha/'.$alpha.'/error/'.$this->error);
+
+ }
+
+ public function switchgroupAction() {
+
+ $alpha = $this->_request->getParam('alpha');
+
+ if (isset($this->session)) {
+ $this->session->setMembershipID(null);
+ $this->sessionMapper->save($this->session);
+ } else {
+ $this->error = "session";
+ }
+
+ $this->_redirect('/ipxe/resource/getvesamenuconfig/alpha/'.$alpha.'/error/'.$this->error);
+ }
+
+ public function setgroupAction() {
+
+ $alpha = $this->_request->getParam('alpha');
+ $membershipID = $this->_request->getParam('membershipid');
+
+ //TODO test if member of group
+ if (isset($this->session)) {
+ $this->session->setMembershipID($membershipID);
+ $this->sessionMapper->save($this->session);
+ } else {
+ $this->error = "session";
+ }
+
+ $this->_redirect('/ipxe/resource/getvesamenuconfig/alpha/'.$alpha.'/error/'.$this->error);
+ }
+
+
+
+
+
}
diff --git a/application/modules/ipxe/controllers/ResourceController.php b/application/modules/ipxe/controllers/ResourceController.php
index 0f5988a..c33ed45 100644
--- a/application/modules/ipxe/controllers/ResourceController.php
+++ b/application/modules/ipxe/controllers/ResourceController.php
@@ -1,199 +1,196 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Ipxe_ResourceController extends Zend_Controller_Action
-{
-
- private $session;
-
- public function init()
- {
-
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
- $this->session = new Application_Model_Session();
- $sessionMapper = new Application_Model_SessionMapper();
-
- //TODO Error Messages if something failed
- $alphaID = $this->_request->getParam('alpha');
-
- if(isset($alphaID)){
- $alphasessionID = $alphaID;
- $result = $sessionMapper->findBy(array('alphasessionID' => $alphasessionID),true);
- # print_a($result);
- $this->session = $this->session->setOptions($result[0]);
- $this->session->setID($result[0]['sessionID']);
- }
-
- $bootmenuntryID = $this->_request->getParam('bme');
-
- if(isset($bootmenuntryID) && isset($this->session)){
- //TODO check if allowed
- $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry);
-
- $this->session->setBootmenuentryID($bootmenuntryID);
- $this->session->setBootosID($bootmenuentry->getBootosID());
- $sessionMapper->save($this->session);
- }
- }
-
- public function getvesamenuconfigAction(){
-
- header('Content-Type: text/html');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="vesamenu.conf"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- $vesamenuView = new Zend_View();
- $vesamenuView->addScriptPath(APPLICATION_PATH.'/modules/ipxe/views/scripts/resource/');
-
- $vesamenuView->host = $_SERVER['HTTP_HOST'];
- $vesamenuView->error = $this->_request->getParam('error');
-
- if (isset($this->session)){
- $vesamenuView->alphaID = $this->session->getAlphasessionID();
-
- if ($this->session->getPersonID() != null){
- $personMapper = new Application_Model_PersonMapper();
- $person = $personMapper->find($this->session->getPersonID());
- $vesamenuView->name = $person->getName();
- $vesamenuView->firstname = $person->getFirstname();
- $vesamenuView->loggedin = true;
- }else{
- $vesamenuView->loggedin = false;
- }
-
- if($this->session->getMembershipID() != null){
- $groupMapper = new Application_Model_GroupMapper();
- $membershipMapper = new Application_Model_MembershipMapper();
- $membership = $membershipMapper->find($this->session->getMembershipID());
- $vesamenuView->group = $groupMapper->find($membership->getGroupID())->getTitle();
- $_SESSION['userIDs']['membershipID'] = $this->session->getMembershipID();
- $_SESSION['userIDs']['groupID'] = $membership->getGroupID();
- }
-
- if ($this->session->getPersonID() != null && $this->session->getMembershipID() == null ){
- $groupMapper = new Application_Model_GroupMapper();
- $roleMapper = new Application_Model_RoleMapper();
- $membershipMapper = new Application_Model_MembershipMapper();
- $memberships = $membershipMapper->findBy(array('personID' => $this->session->getPersonID()),true);
-
- if(isset($memberships)) {
- foreach($memberships as $membership) {
- $group = $groupMapper->find($membership['groupID']);
- $role = $roleMapper->find($membership['roleID']);
- $membershipList[] = array(
- 'membershipID' => $membership['membershipID'],
- 'group' => $group->getTitle(),
- 'role' => $role->getTitle()
- );
- }
- $vesamenuView->memberships = $membershipList;
- }else{
- $vesamenuView->memberships = null;
- }
-
- $vesamenuView->action = "selectmembership";
-
- }
-
- // Request Bootmenu
- $_SESSION['alphasessionID'] = $this->session->getAlphasessionID();
- $pbsFilter = new Pbs_Filter();
- $bootmenuID = $pbsFilter->evaluate();
-
- if($bootmenuID != null){
- $bootmenuMapper = new Application_Model_BootMenuMapper();
- $bm = $bootmenuMapper->find($bootmenuID);
- $vesamenuView->title = $bm->getTitle();
- $vesamenuView->startcounter = $bm->getStartcounter();
-
- $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false);
- $vesamenuView->bmelist = $res;
- }else{
- $vesamenuView->bmelist = null;
- }
- }else{
- $vesamenuView->serialnumber = $this->_request->getParam('serialnumber');
- $vesamenuView->mac = $this->_request->getParam('mac');
- if($vesamenuView->error == "serial"){
- $vesamenuView->error = "serial";
- }else{
- $vesamenuView->error = "session";
- }
- }
-
- $vesamenu = $vesamenuView->render('getvesamenu.phtml');
-
- header("Content-Length: ".(strlen($vesamenu)));
-
- echo $vesamenu;
- }
-
- public function getkernelAction(){
-
- //TODO session & bme error
- $bootosID = $this->session->getBootosID();
-
- if(is_dir("../resources/bootos/$bootosID/kernel/") && is_numeric($bootosID)){
-
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="kernel"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- // create the gzipped tarfile.
- chdir("../resources/bootos/$bootosID/kernel/");
- $kernelname = array_pop(scandir("./"));
-
- header("Content-Length: ".filesize(getcwd()."/".$kernelname));
-
- passthru( "cat ". $kernelname);
- }else{
- header('HTTP/1.0 404 Not Found');
- }
- }
-
- public function getinitramfsAction()
- {
-
- $bootosID = $this->session->getBootosID();
-
- if(is_dir("../resources/bootos/$bootosID/initramfs/") && is_numeric($bootosID)){
-
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="initramfs"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- // create file.
- chdir("../resources/bootos/$bootosID/initramfs/");
- $initname = array_pop(scandir("./"));
-
- header("Content-Length: ".filesize(getcwd()."/".$initname));
-
- passthru( "cat ".$initname);
- }else{
- header('HTTP/1.0 404 Not Found');
- }
- }
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class Ipxe_ResourceController extends Zend_Controller_Action {
+
+ private $session;
+
+ public function init() {
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
+ $this->session = new Application_Model_Session();
+ $sessionMapper = new Application_Model_SessionMapper();
+
+ //TODO Error Messages if something failed
+ $alphaID = $this->_request->getParam('alpha');
+
+ if(isset($alphaID)) {
+ $alphasessionID = $alphaID;
+ $result = $sessionMapper->findBy(array('alphasessionID' => $alphasessionID), true);
+# print_a($result);
+ $this->session = $this->session->setOptions($result[0]);
+ $this->session->setID($result[0]['sessionID']);
+ }
+
+ $bootmenuntryID = $this->_request->getParam('bme');
+
+ if(isset($bootmenuntryID) && isset($this->session)) {
+ //TODO check if allowed
+ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenuentriesMapper->find($bootmenuntryID, $bootmenuentry);
+
+ $this->session->setBootmenuentryID($bootmenuntryID);
+ $this->session->setBootosID($bootmenuentry->getBootosID());
+ $sessionMapper->save($this->session);
+ }
+ }
+
+ public function getvesamenuconfigAction() {
+
+ header('Content-Type: text/html');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="vesamenu.conf"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ $vesamenuView = new Zend_View();
+ $vesamenuView->addScriptPath(APPLICATION_PATH.'/modules/ipxe/views/scripts/resource/');
+
+ $vesamenuView->host = $_SERVER['HTTP_HOST'];
+ $vesamenuView->error = $this->_request->getParam('error');
+
+ if (isset($this->session)) {
+ $vesamenuView->alphaID = $this->session->getAlphasessionID();
+
+ if ($this->session->getPersonID() != null) {
+ $personMapper = new Application_Model_PersonMapper();
+ $person = $personMapper->find($this->session->getPersonID());
+ $vesamenuView->name = $person->getName();
+ $vesamenuView->firstname = $person->getFirstname();
+ $vesamenuView->loggedin = true;
+ } else {
+ $vesamenuView->loggedin = false;
+ }
+
+ if($this->session->getMembershipID() != null) {
+ $groupMapper = new Application_Model_GroupMapper();
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $membership = $membershipMapper->find($this->session->getMembershipID());
+ $vesamenuView->group = $groupMapper->find($membership->getGroupID())->getTitle();
+ $_SESSION['userIDs']['membershipID'] = $this->session->getMembershipID();
+ $_SESSION['userIDs']['groupID'] = $membership->getGroupID();
+ }
+
+ if ($this->session->getPersonID() != null && $this->session->getMembershipID() == null ) {
+ $groupMapper = new Application_Model_GroupMapper();
+ $roleMapper = new Application_Model_RoleMapper();
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $memberships = $membershipMapper->findBy(array('personID' => $this->session->getPersonID()), true);
+
+ if(isset($memberships)) {
+ foreach($memberships as $membership) {
+ $group = $groupMapper->find($membership['groupID']);
+ $role = $roleMapper->find($membership['roleID']);
+ $membershipList[] = array(
+ 'membershipID' => $membership['membershipID'],
+ 'group' => $group->getTitle(),
+ 'role' => $role->getTitle()
+ );
+ }
+ $vesamenuView->memberships = $membershipList;
+ } else {
+ $vesamenuView->memberships = null;
+ }
+
+ $vesamenuView->action = "selectmembership";
+
+ }
+
+ // Request Bootmenu
+ $_SESSION['alphasessionID'] = $this->session->getAlphasessionID();
+ $pbsFilter = new Pbs_Filter();
+ $bootmenuID = $pbsFilter->evaluate();
+
+ if($bootmenuID != null) {
+ $bootmenuMapper = new Application_Model_BootMenuMapper();
+ $bm = $bootmenuMapper->find($bootmenuID);
+ $vesamenuView->title = $bm->getTitle();
+ $vesamenuView->startcounter = $bm->getStartcounter();
+
+ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID), false);
+ $vesamenuView->bmelist = $res;
+ } else {
+ $vesamenuView->bmelist = null;
+ }
+ } else {
+ $vesamenuView->serialnumber = $this->_request->getParam('serialnumber');
+ $vesamenuView->mac = $this->_request->getParam('mac');
+ if($vesamenuView->error == "serial") {
+ $vesamenuView->error = "serial";
+ } else {
+ $vesamenuView->error = "session";
+ }
+ }
+
+ $vesamenu = $vesamenuView->render('getvesamenu.phtml');
+
+ header("Content-Length: ".(strlen($vesamenu)));
+
+ echo $vesamenu;
+ }
+
+ public function getkernelAction() {
+
+ //TODO session & bme error
+ $bootosID = $this->session->getBootosID();
+
+ if(is_dir("../resources/bootos/$bootosID/kernel/") && is_numeric($bootosID)) {
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="kernel"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create the gzipped tarfile.
+ chdir("../resources/bootos/$bootosID/kernel/");
+ $kernelname = array_pop(scandir("./"));
+
+ header("Content-Length: ".filesize(getcwd()."/".$kernelname));
+
+ passthru( "cat ". $kernelname);
+ } else {
+ header('HTTP/1.0 404 Not Found');
+ }
+ }
+
+ public function getinitramfsAction() {
+
+ $bootosID = $this->session->getBootosID();
+
+ if(is_dir("../resources/bootos/$bootosID/initramfs/") && is_numeric($bootosID)) {
+
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="initramfs"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ // create file.
+ chdir("../resources/bootos/$bootosID/initramfs/");
+ $initname = array_pop(scandir("./"));
+
+ header("Content-Length: ".filesize(getcwd()."/".$initname));
+
+ passthru( "cat ".$initname);
+ } else {
+ header('HTTP/1.0 404 Not Found');
+ }
+ }
+
}
diff --git a/application/modules/user/Bootstrap.php b/application/modules/user/Bootstrap.php
index 2537ee0..a80ceac 100644
--- a/application/modules/user/Bootstrap.php
+++ b/application/modules/user/Bootstrap.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -9,14 +9,12 @@
*
* General information about OpenSLX can be found at http://openslx.org/
*/
-class user_Bootstrap extends Zend_Application_Module_Bootstrap
-{
- function _initViewHelpers()
- {
- $this->bootstrap('layout');
-
- $layout = $this->getResource('layout');
- $view = $layout->getView();
- $view->headLink()->appendStylesheet('/media/css/user.css');
- }
+class user_Bootstrap extends Zend_Application_Module_Bootstrap {
+ function _initViewHelpers() {
+ $this->bootstrap('layout');
+
+ $layout = $this->getResource('layout');
+ $view = $layout->getView();
+ $view->headLink()->appendStylesheet('/media/css/user.css');
+ }
}
diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php
index cc3fec4..ec5bb2b 100644
--- a/application/modules/user/controllers/AuthController.php
+++ b/application/modules/user/controllers/AuthController.php
@@ -1,261 +1,248 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class User_AuthController extends Zend_Controller_Action
-{
- protected $personmapper = null;
- private $db = null;
+class User_AuthController extends Zend_Controller_Action {
+ protected $personmapper = null;
+ private $db = null;
- public function init()
- {
- $this->db = Zend_Db_Table::getDefaultAdapter();
- $this->personmapper = new Application_Model_PersonMapper();
- }
+ public function init() {
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ $this->personmapper = new Application_Model_PersonMapper();
+ }
- public function indexAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- $this->_helper->redirector('login', 'auth');
- }
+ public function indexAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ $this->_helper->redirector('login', 'auth');
+ }
- public function loginAction()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->_redirect('/user/');
- } else {
- if (!isset($_POST["login"])){
- $loginForm = new user_Form_Login();
- } else {
- $loginForm = new user_Form_Login($_POST);
+ public function loginAction() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->_redirect('/user/');
+ } else {
+ if (!isset($_POST["login"])) {
+ $loginForm = new user_Form_Login();
+ } else {
+ $loginForm = new user_Form_Login($_POST);
- if ($loginForm->isValid($_POST)) {
+ if ($loginForm->isValid($_POST)) {
- $auth = Zend_Auth::getInstance();
+ $auth = Zend_Auth::getInstance();
- $adapter = new Zend_Auth_Adapter_DbTable( $this->db, 'pbs_person', 'email', 'password', 'MD5(CONCAT(?, password_salt))');
-
- $adapter->setIdentity($loginForm->getValue('email'));
- $adapter->setCredential($loginForm->getValue('password'));
+ $adapter = new Zend_Auth_Adapter_DbTable( $this->db, 'pbs_person', 'email', 'password', 'MD5(CONCAT(?, password_salt))');
- $result = $auth->authenticate($adapter);
+ $adapter->setIdentity($loginForm->getValue('email'));
+ $adapter->setCredential($loginForm->getValue('password'));
- if ($result->isValid()) {
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $person = new Application_Model_Person($result[0]);
- print_a('case1',$person);
- $person->setID($result[0]['personID']);
- $date = new DateTime();
- $person->setLogindate($date->getTimestamp());
- if($person->getSuspend()) {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Your Account is suspended', 'error');
- } else {
- $this->personmapper->save($person);
- $this->_helper->redirector('selectmembership', 'person');
- return;
- }
- } else {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Wrong Email or Password', 'error');
- }
- }
- }
- $this->view->loginForm = $loginForm;
- }
- }
+ $result = $auth->authenticate($adapter);
- public function logoutAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- $auth = Zend_Auth::getInstance();
- $auth->clearIdentity();
- Zend_Session::namespaceUnset('userIDs');
- Zend_Session::forgetMe();
- $this->_helper->redirector('login', 'auth');
- return;
- }
+ if ($result->isValid()) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()), true);
+ $person = new Application_Model_Person($result[0]);
+ print_a('case1', $person);
+ $person->setID($result[0]['personID']);
+ $date = new DateTime();
+ $person->setLogindate($date->getTimestamp());
+ if($person->getSuspend()) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Your Account is suspended', 'error');
+ } else {
+ $this->personmapper->save($person);
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ }
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Wrong Email or Password', 'error');
+ }
+ }
+ }
+ $this->view->loginForm = $loginForm;
+ }
+ }
- public function registerAction()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Already logged in.', 'error');
- } else {
- if (!isset($_POST["register"])){
- $registerForm = new user_Form_Register();
- } else {
- foreach($_POST as $k => $v) {
- if($v != '') {
- $data[$k] = $v;
- }
- }
- $registerForm = new user_Form_Register($data);
- if ($registerForm->isValid($_POST)) {
- $person = new Application_Model_Person($_POST);
- $this->personmapper = new Application_Model_PersonMapper();
- $date = new DateTime();
- $person->setSuspend(0)
- ->setRegisterdate($date->getTimestamp())
- ->setPasswordSalt(MD5($date->getTimestamp()))
- ->setLoginPassword(crypt($person->getPassword(), '$6$'.randomString(8).'$'))
- ->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
- try {
- $this->personmapper->save($person);
- }catch(Zend_Exception $e)
- {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Email already registered', 'error');
- $this->view->registerForm = $registerForm;
- return;
- }
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
- $this->view->registerForm = $registerForm;
- }
- }
+ public function logoutAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ $auth = Zend_Auth::getInstance();
+ $auth->clearIdentity();
+ Zend_Session::namespaceUnset('userIDs');
+ Zend_Session::forgetMe();
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
- public function deleteAction()
- {
- if($this->_request->getParam('personID')) {
- if(!Pbs_Acl::checkRight('peoa')) {
- $this->_redirect('/user');
- }
- $personID = $this->_request->getParam('personID');
- } else {
- if(!Pbs_Acl::checkRight('pdo')) {
- $this->_redirect('/user');
- }
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- $personID = $userIDsNamespace['personID'];
- }
- if($_POST['confirmdelete']) {
- if (isset($personID)){
- $this->personmapper = new Application_Model_PersonMapper();
- $person = $this->personmapper->find($personID);
- print_r($person);
- try {
- $this->personmapper->delete($person);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- if($this->_request->getParam('personID')) {
- $this->_helper->redirector('', 'person');
- } else {
- $auth->clearIdentity();
- Zend_Session::namespaceUnset('userIDs');
- Zend_Session::forgetMe();
- $this->_helper->redirector('login', 'auth');
- }
- return;
- }
- } else {
- $deleteconfirmform = new user_Form_ConfirmDeleteAccount();
- $this->view->deleteconfirmform = $deleteconfirmform;
- }
- }
+ public function registerAction() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Already logged in.', 'error');
+ } else {
+ if (!isset($_POST["register"])) {
+ $registerForm = new user_Form_Register();
+ } else {
+ foreach($_POST as $k => $v) {
+ if($v != '') {
+ $data[$k] = $v;
+ }
+ }
+ $registerForm = new user_Form_Register($data);
+ if ($registerForm->isValid($_POST)) {
+ $person = new Application_Model_Person($_POST);
+ $this->personmapper = new Application_Model_PersonMapper();
+ $date = new DateTime();
+ $person->setSuspend(0)
+ ->setRegisterdate($date->getTimestamp())
+ ->setPasswordSalt(MD5($date->getTimestamp()))
+ ->setLoginPassword(crypt($person->getPassword(), '$6$'.randomString(8).'$'))
+ ->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Email already registered', 'error');
+ $this->view->registerForm = $registerForm;
+ return;
+ }
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ }
+ $this->view->registerForm = $registerForm;
+ }
+ }
- public function recoverpasswordAction()
- {
- if (isset($_POST["savePassword"])){
- $personID = $_POST['personID'];
- $recoverPasswordForm = new user_Form_NewPassword(array("personID" => $personID, $_POST));
- if ($recoverPasswordForm->isValid($_POST)) {
- $this->personmapper = new Application_Model_PersonMapper();
- $person = $this->personmapper->find($personID);
- $date = new DateTime();
- $person->setPassword($_POST['password'])
- ->setPasswordSalt(MD5($date->getTimestamp()))
- ->setLoginPassword(crypt($person->getPassword(), '$6$'.randomString(8).'$'))
- ->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
- try {
- $this->personmapper->save($person);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- echo "Email Address already existing.";
- return;
- }
- $this->_helper->redirector('login', 'auth');
- return;
- }
- } else if(isset($_GET['recoveryid'])) {
- $recoveryid = $_GET['recoveryid'];
- $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
- $passwordRecovery = $passwordRecoveryMapper->findBy(array("recoveryID" => $recoveryid),true);
- if(count($passwordRecovery) > 0) {
- $passwordRecoveryObject = new Application_Model_PasswordRecovery();
- $passwordRecoveryObject->setID($passwordRecovery[0]['personID']);
- $passwordRecoveryObject->setRecoveryID($passwordRecovery[0]['recoveryID']);
- $personID = $passwordRecoveryObject->getID();
- $recoverPasswordForm = new user_Form_NewPassword(array("personID" => $personID));
- try {
- $passwordRecoveryMapper->delete($passwordRecoveryObject);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- } else {
- $this->_helper->redirector('login', 'auth');
- return;
- }
- } else {
- if (!isset($_POST["recoverPassword"])){
- $recoverPasswordForm = new user_Form_RecoverPassword();
- } else {
- $recoverPasswordForm = new user_Form_RecoverPassword($_POST);
- if ($recoverPasswordForm->isValid($_POST)) {
- $recoverPasswordForm->getView()->url();
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy(array('email' => $_POST['email']),true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $email = $person->getEmail();
- $name = $person->getFirstname() . ' ' . $person->getName();
- $url = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->view->url();
- $recoveryid = randomString(100);
- $mailbody = 'Um das Passwort zu ändern klicken Sie auf folgenden Link<br /><br /><a href="'. $url . '/auth/recoverpassword/?recoveryid='. $recoveryid . '">Passwort ändern</a>';
- $mail = new Zend_Mail();
- $mail->setBodyHtml($mailbody, 'utf8')
- ->getBodyHtml()->getContent()
- ->setFrom('admin@local', 'Admin')
- ->addTo($email, $name)
- ->setSubject('Password Wiederherstellung Preboot Server');
- $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
- $passwordRecoveryObject = new Application_Model_PasswordRecovery();
- $passwordRecoveryObject->setID($person->getID())
- ->setRecoveryID($recoveryid);
- try {
- $passwordRecoveryMapper->save($passwordRecoveryObject);
- $mail->send();
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
- }
- $this->view->recoverPasswordForm = $recoverPasswordForm;
- }
+ public function deleteAction() {
+ if($this->_request->getParam('personID')) {
+ if(!Pbs_Acl::checkRight('peoa')) {
+ $this->_redirect('/user');
+ }
+ $personID = $this->_request->getParam('personID');
+ } else {
+ if(!Pbs_Acl::checkRight('pdo')) {
+ $this->_redirect('/user');
+ }
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ $personID = $userIDsNamespace['personID'];
+ }
+ if($_POST['confirmdelete']) {
+ if (isset($personID)) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $person = $this->personmapper->find($personID);
+ print_r($person);
+ try {
+ $this->personmapper->delete($person);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ if($this->_request->getParam('personID')) {
+ $this->_helper->redirector('', 'person');
+ } else {
+ $auth->clearIdentity();
+ Zend_Session::namespaceUnset('userIDs');
+ Zend_Session::forgetMe();
+ $this->_helper->redirector('login', 'auth');
+ }
+ return;
+ }
+ } else {
+ $deleteconfirmform = new user_Form_ConfirmDeleteAccount();
+ $this->view->deleteconfirmform = $deleteconfirmform;
+ }
+ }
+
+ public function recoverpasswordAction() {
+ if (isset($_POST["savePassword"])) {
+ $personID = $_POST['personID'];
+ $recoverPasswordForm = new user_Form_NewPassword(array("personID" => $personID, $_POST));
+ if ($recoverPasswordForm->isValid($_POST)) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $person = $this->personmapper->find($personID);
+ $date = new DateTime();
+ $person->setPassword($_POST['password'])
+ ->setPasswordSalt(MD5($date->getTimestamp()))
+ ->setLoginPassword(crypt($person->getPassword(), '$6$'.randomString(8).'$'))
+ ->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ echo "Email Address already existing.";
+ return;
+ }
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ } else if(isset($_GET['recoveryid'])) {
+ $recoveryid = $_GET['recoveryid'];
+ $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
+ $passwordRecovery = $passwordRecoveryMapper->findBy(array("recoveryID" => $recoveryid), true);
+ if(count($passwordRecovery) > 0) {
+ $passwordRecoveryObject = new Application_Model_PasswordRecovery();
+ $passwordRecoveryObject->setID($passwordRecovery[0]['personID']);
+ $passwordRecoveryObject->setRecoveryID($passwordRecovery[0]['recoveryID']);
+ $personID = $passwordRecoveryObject->getID();
+ $recoverPasswordForm = new user_Form_NewPassword(array("personID" => $personID));
+ try {
+ $passwordRecoveryMapper->delete($passwordRecoveryObject);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ } else {
+ if (!isset($_POST["recoverPassword"])) {
+ $recoverPasswordForm = new user_Form_RecoverPassword();
+ } else {
+ $recoverPasswordForm = new user_Form_RecoverPassword($_POST);
+ if ($recoverPasswordForm->isValid($_POST)) {
+ $recoverPasswordForm->getView()->url();
+ $this->personmapper = new Application_Model_PersonMapper();
+ $result = $this->personmapper->findBy(array('email' => $_POST['email']), true);
+ $person = new Application_Model_Person($result[0]);
+ $person->setID($result[0]['personID']);
+ $email = $person->getEmail();
+ $name = $person->getFirstname() . ' ' . $person->getName();
+ $url = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->view->url();
+ $recoveryid = randomString(100);
+ $mailbody = 'Um das Passwort zu ändern klicken Sie auf folgenden Link<br /><br /><a href="'. $url . '/auth/recoverpassword/?recoveryid='. $recoveryid . '">Passwort ändern</a>';
+ $mail = new Zend_Mail();
+ $mail->setBodyHtml($mailbody, 'utf8')
+ ->getBodyHtml()->getContent()
+ ->setFrom('admin@local', 'Admin')
+ ->addTo($email, $name)
+ ->setSubject('Password Wiederherstellung Preboot Server');
+ $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
+ $passwordRecoveryObject = new Application_Model_PasswordRecovery();
+ $passwordRecoveryObject->setID($person->getID())
+ ->setRecoveryID($recoveryid);
+ try {
+ $passwordRecoveryMapper->save($passwordRecoveryObject);
+ $mail->send();
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ }
+ }
+ $this->view->recoverPasswordForm = $recoverPasswordForm;
+ }
}
diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php
index f1cf37a..a5619f4 100644
--- a/application/modules/user/controllers/BootisoController.php
+++ b/application/modules/user/controllers/BootisoController.php
@@ -1,339 +1,330 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_BootisoController extends Zend_Controller_Action
-{
-
- protected $bootisoMapper;
- protected $membershipMapper;
- protected $membership;
- protected $page;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($userIDsNamespace['membershipID'] ==''){
- $this->_redirect('/user/index');
- }
-
- $this->bootisoMapper = new Application_Model_BootIsoMapper();
-
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
-
- $this->db = Zend_Db_Table::getDefaultAdapter();
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- $this->page = $this->_request->getParam('page');
- }
-
- public function indexAction()
- {
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
- $result = $this->_request->getParam('downloadresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('download',$result);
- }
-
-
- $groupMapper = new Application_Model_GroupMapper();
-
- $groupID = $this->membership->getGroupID();
-
- //ACL Darf er BootISOMenu sehen?
- if(!Pbs_Acl::checkRight('bai') && !Pbs_Acl::checkRight('bui'))
- $this->_redirect('/user/index');
-
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
-
- $parents = array();
- $this->view->bootisolist = array();
- $parents = $groupgroupsMapper->getParentGroups($groupID);
-
- foreach($parents as $k => $parent){
- foreach($parent as $p){
- $bootiso = $this->bootisoMapper->findBy(array("groupID" => $p));
- foreach ($bootiso as $b)
- if($b->getPublic() - $k >= 0 )
- $this->view->bootisolist[] = $b;
- elseif($k == 0 && $b->getPublic() == -1 && Pbs_Acl::checkRight('bc'))
- $this->view->bootisolist[] = $b;
- }
- }
-
- $this->view->bootisolist = array_reverse($this->view->bootisolist);
-
- $prebootMapper = new Application_Model_PreBootMapper();
- $this->view->prebootlist = array();
-
- foreach ($this->view->bootisolist as $bootiso){
- $bootiso->setPrebootID("[".$bootiso->getPrebootID()."] ".$prebootMapper->find($bootiso->getPrebootID())->getTitle());
- $bootiso->setGroupID("[".$bootiso->getGroupID()."] ".$groupMapper->find($bootiso->getGroupID())->getTitle());
- $bootiso->setCreated(date(Zend_Registry::get('dateformat'),$bootiso->getCreated()));
- if($bootiso->getExpires() == ""){
- $bootiso->setExpires(0);
- }
- $bootiso->setExpires(date(Zend_Registry::get('dateformat'),$bootiso->getExpires()));
- }
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('bootiso');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->bootisolist = $mySearch->search($this->view->bootisolist);
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->view->bootisolist);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/bootiso/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $this->view->bootisolist = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- }
-
- public function searchAction(){
- $this->_redirect('/user/bootiso/index/search/'.($_GET['search']));
- }
-
- public function downloadbootisoAction()
- {
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender(true);
-
- //ACL Darf er BootISOs downloaden?
- if(!Pbs_Acl::checkRight('bdld'))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden');
-
- $bootisoID = $this->_request->getParam('bootisoID');
-
- if(!is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden');
-
- $bootiso = $this->bootisoMapper->find($bootisoID);
- $prebootID = $bootiso->getPrebootID();
-
- if(!is_dir("../resources/bootmedium/$prebootID/"))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/404');
-
- $zip = new ZipArchive();
- $res = $zip->open("../resources/bootmedium/$prebootID/preboot.zip");
- if($res === true){
- $rootdir = $zip->getNameIndex(0);
- $zip->addFromString($rootdir."build/rootfs/tmp/serial", $bootiso->getSerialnumber());
- $zip->close();
- }
-
- chdir("../resources/bootmedium/$prebootID/");
-
- header("X-Sendfile: preboot.zip");
- header('Content-Type: application/x-gzip');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="preboot.zip"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- $handle = fopen("preboot.zip", 'r');
- $chunk_size = 8192;
- while ($chunk = fread($handle, $chunk_size)) {
- echo $chunk;
- ob_flush();
- }
-
- }
-
- public function createbootisoAction()
- {
- //ACL Darf er BootISOs erstellen?
- if(!Pbs_Acl::checkRight('bc'))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/forbidden');
-
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
- $groupID = $this->membership->getGroupID();
-
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
- $childgroups = count($groupgroupsMapper->getChildGroups($groupID));
-
- $prebootMapper = new Application_Model_PreBootMapper();
- $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID));
- if (!isset($_POST["createbootiso"])){
- $bootisoForm = new user_Form_Bootiso(array(
- 'action' => 'createbootiso',
- 'prebootlist' => $prebootlist,
- 'groupdepth' => $childgroups,
- 'page'=>$this->page));
- } else {
-
- $bootisoForm = new user_Form_Bootiso(array(
- 'action' => 'createbootiso',
- 'prebootlist' => $prebootlist,
- 'groupdepth' => $childgroups,
- 'page'=>$this->page),$_POST);
-
- if ($bootisoForm->isValid($_POST)) {
-
- $bootiso = new Application_Model_BootIso($_POST);
-
- $bootiso->setGroupID($this->membership->getGroupID());
- $bootiso->setCreated(time());
-
- try {
- $bootisoID = $this->bootisoMapper->save($bootiso);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/error');
- //TODO Delete File & delete bootiso from DB
-
- }
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->bootisoForm = $bootisoForm;
- }
-
- public function editbootisoAction()
- {
- //ACL Darf er BootISOs editieren?
- if(!Pbs_Acl::checkRight('be') && !Pbs_Acl::checkRight('bem'))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
-
- $bootisoID = $this->_request->getParam('bootisoID');
- if (!is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
-
- $groupID = $this->membership->getGroupID();
-
- $prebootMapper = new Application_Model_PreBootMapper();
- $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID));
-
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
- $childgroups = count($groupgroupsMapper->getChildGroups($groupID));
-
- $bootiso = new Application_Model_BootIso();
- $this->bootisoMapper->find($bootisoID, $bootiso);
-
- if($this->membership->getGroupID() != $bootiso->getGroupID())
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
-
- if (!isset($_POST["editbootiso"])){
-
- $bootisoForm = new user_Form_Bootiso(array(
- 'action' => 'editbootiso',
- 'prebootlist' => $prebootlist,
- 'groupdepth' => $childgroups,
- 'page' => $this->page));
- $bootisoForm->populate($bootiso->toArray());
-
- }else{
- $bootisoForm = new user_Form_Bootiso(array(
- 'action' => 'editbootiso',
- 'prebootlist' => $prebootlist,
- 'groupdepth' => $childgroups,
- 'page' => $this->page),$_POST);
-
- if ($bootisoForm->isValid($_POST)) {
-
- $bootisoold = $bootiso;
-
- $bootiso = new Application_Model_BootIso($_POST);
- $bootiso->setGroupID($this->membership->getGroupID());
- $bootiso->setCreated(time());
- $bootiso->setID($bootisoID);
- $prebootID = $bootiso->getPrebootID();
-
- if( $bootiso->getPrebootID() != $bootisoold->getPrebootID() ||
- $bootiso->getExpires() != $bootisoold->getExpires() ||
- $bootiso->getPublic() != $bootisoold->getPublic() ||
- $bootiso->getSerialnumber() != $bootisoold->getSerialnumber()){
- //ACL Is he allowed to edit other than Metadata?
- if(!Pbs_Acl::checkRight('be'))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- try {
-
- $this->bootisoMapper->save($bootiso);
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/error');
- //TODO Redo Serial in Files...
- }
-
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/ok');
- }
-
- }
-
- $this->view->bootisoForm = $bootisoForm;
- }
-
- public function deletebootisoAction()
- {
- //ACL Darf er BootISOs löschen?
- if(!Pbs_Acl::checkRight('bd'))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
-
- $bootisoID = $this->_request->getParam('bootisoID');
- if (!is_numeric($bootisoID))
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden');
-
- $bootiso = new Application_Model_BootIso();
- $this->bootisoMapper->find($bootisoID,$bootiso);
-
- if($this->membership->getGroupID() != $bootiso->getGroupID())
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden');
-
- $this->bootisoMapper->delete($bootiso);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/ok');
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_BootisoController extends Zend_Controller_Action {
+
+ protected $bootisoMapper;
+ protected $membershipMapper;
+ protected $membership;
+ protected $page;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] == '') {
+ $this->_redirect('/user/index');
+ }
+
+ $this->bootisoMapper = new Application_Model_BootIsoMapper();
+
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $this->membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
+ public function indexAction() {
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+ $result = $this->_request->getParam('downloadresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('download', $result);
+ }
+
+
+ $groupMapper = new Application_Model_GroupMapper();
+
+ $groupID = $this->membership->getGroupID();
+
+ //ACL Darf er BootISOMenu sehen?
+ if(!Pbs_Acl::checkRight('bai') && !Pbs_Acl::checkRight('bui'))
+ { $this->_redirect('/user/index'); }
+
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+
+ $parents = array();
+ $this->view->bootisolist = array();
+ $parents = $groupgroupsMapper->getParentGroups($groupID);
+
+ foreach($parents as $k => $parent) {
+ foreach($parent as $p) {
+ $bootiso = $this->bootisoMapper->findBy(array("groupID" => $p));
+ foreach ($bootiso as $b)
+ if($b->getPublic() - $k >= 0 )
+ { $this->view->bootisolist[] = $b; }
+ elseif($k == 0 && $b->getPublic() == -1 && Pbs_Acl::checkRight('bc'))
+ $this->view->bootisolist[] = $b;
+ }
+ }
+
+ $this->view->bootisolist = array_reverse($this->view->bootisolist);
+
+ $prebootMapper = new Application_Model_PreBootMapper();
+ $this->view->prebootlist = array();
+
+ foreach ($this->view->bootisolist as $bootiso) {
+ $bootiso->setPrebootID("[".$bootiso->getPrebootID()."] ".$prebootMapper->find($bootiso->getPrebootID())->getTitle());
+ $bootiso->setGroupID("[".$bootiso->getGroupID()."] ".$groupMapper->find($bootiso->getGroupID())->getTitle());
+ $bootiso->setCreated(date(Zend_Registry::get('dateformat'), $bootiso->getCreated()));
+ if($bootiso->getExpires() == "") {
+ $bootiso->setExpires(0);
+ }
+ $bootiso->setExpires(date(Zend_Registry::get('dateformat'), $bootiso->getExpires()));
+ }
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('bootiso');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->bootisolist = $mySearch->search($this->view->bootisolist);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->view->bootisolist);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/bootiso/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ $this->view->bootisolist = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ }
+
+ public function searchAction() {
+ $this->_redirect('/user/bootiso/index/search/'.($_GET['search']));
+ }
+
+ public function downloadbootisoAction() {
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender(true);
+
+ //ACL Darf er BootISOs downloaden?
+ if(!Pbs_Acl::checkRight('bdld'))
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden'); }
+
+ $bootisoID = $this->_request->getParam('bootisoID');
+
+ if(!is_numeric($bootisoID))
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden'); }
+
+ $bootiso = $this->bootisoMapper->find($bootisoID);
+ $prebootID = $bootiso->getPrebootID();
+
+ if(!is_dir("../resources/bootmedium/$prebootID/"))
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/404'); }
+
+ $zip = new ZipArchive();
+ $res = $zip->open("../resources/bootmedium/$prebootID/preboot.zip");
+ if($res == = true) {
+ $rootdir = $zip->getNameIndex(0);
+ $zip->addFromString($rootdir."build/rootfs/tmp/serial", $bootiso->getSerialnumber());
+ $zip->close();
+ }
+
+ chdir("../resources/bootmedium/$prebootID/");
+
+ header("X-Sendfile: preboot.zip");
+ header('Content-Type: application/x-gzip');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="preboot.zip"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ $handle = fopen("preboot.zip", 'r');
+ $chunk_size = 8192;
+ while ($chunk = fread($handle, $chunk_size)) {
+ echo $chunk;
+ ob_flush();
+ }
+
+ }
+
+ public function createbootisoAction() {
+ //ACL Darf er BootISOs erstellen?
+ if(!Pbs_Acl::checkRight('bc'))
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/forbidden'); }
+
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+ $groupID = $this->membership->getGroupID();
+
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+ $childgroups = count($groupgroupsMapper->getChildGroups($groupID));
+
+ $prebootMapper = new Application_Model_PreBootMapper();
+ $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID));
+ if (!isset($_POST["createbootiso"])) {
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'createbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'page' => $this->page));
+ } else {
+
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'createbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'page' => $this->page), $_POST);
+
+ if ($bootisoForm->isValid($_POST)) {
+
+ $bootiso = new Application_Model_BootIso($_POST);
+
+ $bootiso->setGroupID($this->membership->getGroupID());
+ $bootiso->setCreated(time());
+
+ try {
+ $bootisoID = $this->bootisoMapper->save($bootiso);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/error');
+ //TODO Delete File & delete bootiso from DB
+
+ }
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->bootisoForm = $bootisoForm;
+ }
+
+ public function editbootisoAction() {
+ //ACL Darf er BootISOs editieren?
+ if(!Pbs_Acl::checkRight('be') && !Pbs_Acl::checkRight('bem'))
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $bootisoID = $this->_request->getParam('bootisoID');
+ if (!is_numeric($bootisoID))
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $groupID = $this->membership->getGroupID();
+
+ $prebootMapper = new Application_Model_PreBootMapper();
+ $prebootlist = $prebootMapper->findBy(array("groupID" => $groupID));
+
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+ $childgroups = count($groupgroupsMapper->getChildGroups($groupID));
+
+ $bootiso = new Application_Model_BootIso();
+ $this->bootisoMapper->find($bootisoID, $bootiso);
+
+ if($this->membership->getGroupID() != $bootiso->getGroupID())
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ if (!isset($_POST["editbootiso"])) {
+
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'editbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'page' => $this->page));
+ $bootisoForm->populate($bootiso->toArray());
+
+ } else {
+ $bootisoForm = new user_Form_Bootiso(array(
+ 'action' => 'editbootiso',
+ 'prebootlist' => $prebootlist,
+ 'groupdepth' => $childgroups,
+ 'page' => $this->page), $_POST);
+
+ if ($bootisoForm->isValid($_POST)) {
+
+ $bootisoold = $bootiso;
+
+ $bootiso = new Application_Model_BootIso($_POST);
+ $bootiso->setGroupID($this->membership->getGroupID());
+ $bootiso->setCreated(time());
+ $bootiso->setID($bootisoID);
+ $prebootID = $bootiso->getPrebootID();
+
+ if( $bootiso->getPrebootID() != $bootisoold->getPrebootID() ||
+ $bootiso->getExpires() != $bootisoold->getExpires() ||
+ $bootiso->getPublic() != $bootisoold->getPublic() ||
+ $bootiso->getSerialnumber() != $bootisoold->getSerialnumber()) {
+ //ACL Is he allowed to edit other than Metadata?
+ if(!Pbs_Acl::checkRight('be'))
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); }
+ }
+
+ try {
+
+ $this->bootisoMapper->save($bootiso);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/error');
+ //TODO Redo Serial in Files...
+ }
+
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/ok');
+ }
+
+ }
+
+ $this->view->bootisoForm = $bootisoForm;
+ }
+
+ public function deletebootisoAction() {
+ //ACL Darf er BootISOs löschen?
+ if(!Pbs_Acl::checkRight('bd'))
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ try {
+
+ $bootisoID = $this->_request->getParam('bootisoID');
+ if (!is_numeric($bootisoID))
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ $bootiso = new Application_Model_BootIso();
+ $this->bootisoMapper->find($bootisoID, $bootiso);
+
+ if($this->membership->getGroupID() != $bootiso->getGroupID())
+ { $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ $this->bootisoMapper->delete($bootiso);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/error');
+ }
+ $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/ok');
+ }
}
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php
index 3d6fbf1..33201ec 100644
--- a/application/modules/user/controllers/BootmenuController.php
+++ b/application/modules/user/controllers/BootmenuController.php
@@ -1,601 +1,587 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_BootmenuController extends Zend_Controller_Action
-{
-
- protected $bootmenuMapper;
- protected $bootmenuentryMapper;
- protected $membershipMapper;
- protected $membership;
- protected $page;
- protected $type;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($userIDsNamespace['membershipID'] ==''){
- $this->_redirect('/user/index');
- }
-
- $this->bootmenuMapper = new Application_Model_BootMenuMapper();
- $this->bootmenuentryMapper = new Application_Model_BootMenuEntriesMapper();
-
-
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
-
- $this->db = Zend_Db_Table::getDefaultAdapter();
-
- $this->type = $this->_request->getParam('type');
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- $this->page = $this->_request->getParam('page');
- }
-
- public function indexAction()
- {
-
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
- $result = $this->_request->getParam('json');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('json',$result);
- }
-
-
- //ACL Darf er Bootmenus sehen?
- if(!Pbs_Acl::checkRight('booai') && !Pbs_Acl::checkRight('booui'))
- $this->_redirect('/user/index');
-
- $this->bootMenumapper = new Application_Model_BootMenuMapper();
- $this->bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $bootosMapper = new Application_Model_BootOsMapper();
- $configMapper = new Application_Model_ConfigMapper();
-
- $bootmenuentries = array();
- if($this->type =='group' && Pbs_Acl::checkRight('booai')){
- $this->view->type = 'group';
- $bootmenu = $this->bootmenuMapper->findBy(array('groupID' => $this->membership->getGroupID()));
- foreach ($bootmenu as $bm){
- $bm->setCreated(date(Zend_Registry::get('dateformat'),$bm->getCreated()));
- $bootmenuID = $bm->getID();
- $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
- foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){
- $kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
- if($bootmenuentry->getKcl() && $kcl != null)
- $bootmenuentry->setKcl($kcl);
- else
- $bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)");
- if($bootmenuentry->getKclappend() == null)
- $bootmenuentry->setKclappend("none (edit Bootmenuentry to set KCL-Append)");
- $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
- if($bootmenuentry->getConfigID() != null)
- $bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->getTitle());
- }
- }
- }else{
- $this->view->type = 'own';
- $bootmenu = $this->bootmenuMapper->findBy(array('membershipID' => $this->membership->getID()));
- if($bootmenu != null){
- $bootmenu[0]->setCreated(date(Zend_Registry::get('dateformat'),$bootmenu[0]->getCreated()));
- $bootmenuID = $bootmenu[0]->getID();
- $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
- foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry){
- $kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
- if($bootmenuentry->getKcl() && $kcl != null)
- $bootmenuentry->setKcl($kcl);
- else
- $bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)");
- if($bootmenuentry->getKclappend() == null)
- $bootmenuentry->setKclappend("none");
- $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
- if($bootmenuentry->getConfigID() != null)
- $bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->gettitle());
- }
- }
- }
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setType($this->type);
- $mySearch->setModule('bootmenu');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $bootmenu = $mySearch->search($bootmenu);
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($bootmenu);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/bootmenu/index/type/'.$this->type.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $bootmenu = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
-
- $this->view->bootmenulist = $bootmenu;
- $this->view->bootmenuentrylist = $bootmenuentries;
-
- }
-
- public function searchAction(){
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/search/'.($_GET['search']));
- }
-
-
- public function createbootmenuAction()
- {
- //ACL Darf er BootMenus erstellen?
- if(!Pbs_Acl::checkRight('booc'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
-
- if (!isset($_POST["createbootmenu"])){
- $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page, 'type'=>$this->type));
- } else {
-
- $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page, 'type'=>$this->type),$_POST);
-
- if ($bootmenuForm->isValid($_POST)) {
-
- $bootmenu = new Application_Model_BootMenu($_POST);
- $bootmenu->setCreated(time());
- $bootmenu->setGroupID($this->membership->getGroupID());
- $bootmenu->setDefaultbootmenu('0');
-
- try{
- $this->bootmenuMapper->save($bootmenu);
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->bootmenuForm = $bootmenuForm;
- }
-
- public function editbootmenuAction()
- {
-
- //ACL Is he allowed to edit BootMenus?
- if(!Pbs_Acl::checkRight('booe'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- $bootmenuID = $this->_request->getParam('bootmenuID');
- if (!is_numeric($bootmenuID))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuMapper->find($bootmenuID, $bootmenu);
-
- if($this->membership->getGroupID() != $bootmenu->getGroupID())
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- if (!isset($_POST["editbootmenu"])){
-
- $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page, 'type'=>$this->type));
- $bootmenuForm->populate($bootmenu->toArray());
-
- }else{
- $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page, 'type'=>$this->type),$_POST);
-
- if ($bootmenuForm->isValid($_POST)) {
-
- $bootmenuold = $bootmenu;
-
- $bootmenu = new Application_Model_BootMenu($_POST);
- $bootmenu->setGroupID($this->membership->getGroupID());
- $bootmenu->setCreated(time());
- $bootmenu->setID($bootmenuID);
- $bootmenu->setDefaultbootmenu($bootmenuold->getDefaultbootmenu());
- print_a($bootmenu);
- try {
- $this->bootmenuMapper->save($bootmenu);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
- }
-
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
- }
-
- }
-
- $this->view->bootmenuForm = $bootmenuForm;
- }
-
- public function deletebootmenuAction()
- {
-
- //ACL Is he allowed to delete Bootmenu?
- if(!Pbs_Acl::checkRight('bood'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
- $bootmenuID = $this->_request->getParam('bootmenuID');
- if (!is_numeric($bootmenuID))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuMapper->find($bootmenuID, $bootmenu);
-
- if($this->membership->getGroupID() != $bootmenu->getGroupID())
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- $this->bootmenuMapper->delete($bootmenu);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
- }
-
- public function defaultbootmenuAction()
- {
-
- //ACL Is he allowed to set Bootmenu as Default?
- if(!Pbs_Acl::checkRight('boodbm'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- try{
- $bootmenuID = $this->_request->getParam('bootmenuID');
- if (!is_numeric($bootmenuID))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $bootmenu = new Application_Model_BootMenu();
-
- $this->bootmenuMapper->find($bootmenuID, $bootmenu);
-
- if($bootmenu->getDefaultbootmenu() == false){
-
- list($defaultbootmenu) = $this->bootmenuMapper->findBy(array('defaultbootmenu' => '1'));
- if($defaultbootmenu != null){
- $defaultbootmenu->setDefaultbootmenu(false);
- $this->bootmenuMapper->save($defaultbootmenu);
- }
- $bootmenu->setDefaultbootmenu(true);
- $this->bootmenuMapper->save($bootmenu);
- }
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
-
- }
-
- public function addbootmenuentryAction()
- {
-
- //ACL Darf er BootMenuEntries erstellen?
- if(!Pbs_Acl::checkRight('booae') && !Pbs_Acl::checkRight('booaeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
-
- $bootmenuID = $this->_request->getParam('bootmenuID');
- $maxorder = $this->_request->getParam('maxorder');
-
- if (!is_numeric($bootmenuID) || !is_numeric($maxorder))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $bootosMapper = new Application_Model_BootOsMapper();
- $configMapper = new Application_Model_ConfigMapper();
- $groupMapper = new Application_Model_GroupMapper();
-
- $groupID = $this->membership->getGroupID();
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
-
- $parents = array();
- $bootoslist = array();
- $parents = $groupgroupsMapper->getParentGroups($groupID);
-
- $configlist = array('Preset' => array(), 'Custom' => Array());
-
- foreach($parents as $k => $parent){
- foreach($parent as $p){
- $bootos = $bootosMapper->findBy(array("groupID" => $p));
- foreach ($bootos as $b)
- if($b->getPublic() - $k >= 0 ){
- $grouptitle = $groupMapper->find($p)->getTitle();
- $bootoslist[$b->getID()] = $b;
- $bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
- $configlist['Preset'][$b->getID()] = $configMapper->findBy(array('bootosID' => $b->getID(), 'visible' => '1'));
- $configlist['Custom'][$b->getID()] = $configMapper->findBy(array('membershipID' => $this->membership->getID(), 'bootosID' => $b->getID(), 'visible' => '1'));
- }
- }
- }
-
-
-
-
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuMapper->find($bootmenuID, $bootmenu);
-
- if($bootmenu->getMembershipID() != null){
- if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booaeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('booae'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
- }
-
- if (!isset($_POST["addbootmenuentry"])){
-
- if(!isset($_POST['kcl']))
- $_POST['kcl'] = true;
-
- $bootmenuentryForm = new user_Form_BootmenuEntries(array(
- 'bootoslist'=> $bootoslist,
- 'bootosanzeige' => $bootosanzeige,
- 'maxorder'=> $maxorder,
- 'configlist'=> $configlist,
- 'page' => $this->page,
- 'type' => $this->type,
- 'action' => 'addbootmenuentry',
- ));
-
- $bootmenuentryForm->populate(array('order' => $maxorder));
- unset($_POST['defaultkcl']);
- unset($_POST['configID']);
- $bootmenuentryForm->populate($_POST);
-
- } else {
-
- $bootmenuentryForm = new user_Form_BootmenuEntries(array(
- 'bootoslist'=>$bootoslist,
- 'bootosanzeige' => $bootosanzeige,
- 'maxorder'=> $maxorder,
- 'configlist'=>$configlist,
- 'page' => $this->page,
- 'type' => $this->type,
- 'action' => 'addbootmenuentry',
- ),$_POST);
-
- if ($bootmenuentryForm->isValid($_POST)) {
-
- $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
- $bootmenuentry->setBootmenuID($bootmenuID);
-
- try {
- if($bootmenuentry->getOrder() < $maxorder){
- $bootmenuentry->setOrder($bootmenuentry->getOrder());
- $this->bootmenuentryMapper->order($bootmenuentry);
- }
-
- //print_a($bootmenuentry);
-
- $this->bootmenuentryMapper->save($bootmenuentry);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
-
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->bootmenuentryForm = $bootmenuentryForm;
-
- }
-
- public function editbootmenuentryAction()
- {
- //ACL Is he allowed to edit BootMenus?
- if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem') && !Pbs_Acl::checkRight('booeeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
- $maxorder = $this->_request->getParam('maxorder');
- $oldorder = $this->_request->getParam('oldorder');
- if (!is_numeric($bootmenuentryID) || !is_numeric($maxorder) || !is_numeric($oldorder))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $bootosMapper = new Application_Model_BootOsMapper();
- $configMapper = new Application_Model_ConfigMapper();
-
- $groupID = $this->membership->getGroupID();
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
- $groupMapper = new Application_Model_GroupMapper();
-
- $parents = array();
- $bootoslist = array();
- $parents = $groupgroupsMapper->getParentGroups($groupID);
-
- foreach($parents as $k => $parent){
- foreach($parent as $p){
- $bootos = $bootosMapper->findBy(array("groupID" => $p));
- foreach ($bootos as $b)
- if($b->getPublic() - $k >= 0 ){
- $grouptitle = $groupMapper->find($p)->getTitle();
- $bootoslist[$b->getID()] = $b;
- $bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
- $configlist['Preset'][$b->getID()] = $configMapper->findBy(array('bootosID' => $b->getID(), 'visible' => '1'));
- $configlist['Custom'][$b->getID()] = $configMapper->findBy(array('membershipID' => $this->membership->getID(), 'bootosID' => $b->getID(), 'visible' => '1'));
-
- }
- }
- }
-
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
- $this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);
-
- if($bootmenu->getMembershipID() != null){
- if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booeeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $bootmenu->getGroupID() || (!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem')))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- $neworder = $this->_request->getParam('neworder');
- if($neworder != ''){
- if($neworder == 'undefined')
- $neworder = $maxorder-1;
-
- $_POST = array(
- 'title' => $bootmenuentry->getTitle(),
- 'bootosID' => $bootmenuentry->getBootosID(),
- 'kcl' => $bootmenuentry->getKcl(),
- 'kclappend' => $bootmenuentry->getKclappend(),
- 'configID' => $bootmenuentry->getConfigID(),
- 'order' => $neworder,
- 'editbootmenuentry' => 'Edit Bootmenuentry',
- );
- }
-
- if (!isset($_POST["editbootmenuentry"])){
- if(!isset($_POST['bootosID']))
- $_POST['bootosID'] = $bootmenuentry->getBootosID();
- if(!isset($_POST['kcl']))
- $_POST['kcl'] = $bootmenuentry->getKcl();
-
- $bootmenuentryForm = new user_Form_BootmenuEntries(array(
- 'bootoslist'=> $bootoslist,
- 'bootosanzeige' => $bootosanzeige,
- 'maxorder'=> $maxorder-1,
- 'configlist'=> $configlist,
- 'page' => $this->page,
- 'type' => $this->type,
- 'action' => 'editbootmenuentry',
- ));
-
- if(!isset($_POST['configID'])){
- $bootmenuentryForm->populate($bootmenuentry->toArray());
- }
- else{
- unset($_POST['defaultkcl']);
- unset($_POST['configID']);
- $bootmenuentryForm->populate($_POST);
- }
-
- }else{
- $bootmenuentryForm = new user_Form_BootmenuEntries(array(
- 'bootoslist'=> $bootoslist,
- 'bootosanzeige' => $bootosanzeige,
- 'maxorder'=> $maxorder-1,
- 'configlist'=> $configlist,
- 'page' => $this->page,
- 'type' => $this->type,
- 'action' => 'editbootmenuentry'),$_POST);
-
- if ($bootmenuentryForm->isValid($_POST)) {
-
- $bootmenuentryold= $bootmenuentry;
-
- $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
- $bootmenuentry->setBootmenuID($bootmenu->getID());
- $bootmenuentry->setID($bootmenuentryID);
-
- if( $bootmenuentryold->getBootosID() != $bootmenuentry->getBootosID() ||
- $bootmenuentryold->getConfigID() != $bootmenuentry->getConfigID() ||
- $bootmenuentryold->getKcl() != $bootmenuentry->getKcl() ||
- $bootmenuentryold->getKclappend() != $bootmenuentry->getKclappend()){
- //ACL Is he allowed to edit this?
- if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- try {
- if($bootmenuentry->getOrder() < $oldorder)
- $this->bootmenuentryMapper->orderbefore($bootmenuentry, $oldorder);
- else
- $this->bootmenuentryMapper->orderafter($bootmenuentry, $oldorder);
-
- $this->bootmenuentryMapper->save($bootmenuentry);
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- }
-
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
- }
-
- }
-
- $this->view->bootmenuentryForm = $bootmenuentryForm;
-
- }
-
- public function removebootmenuentryAction()
- {
- //ACL Is he allowed to delete Bootos?
- if(!Pbs_Acl::checkRight('boode') && !Pbs_Acl::checkRight('boodeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
- $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
- if (!is_numeric($bootmenuentryID))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- $bootmenuentry = new Application_Model_BootMenuEntries();
- $bootmenu = new Application_Model_BootMenu();
- $this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
- $this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);
-
- if($bootmenu->getMembershipID() != null){
- if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('boodeo'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('boode'))
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
- }
-
- $this->bootmenuentryMapper->delete($bootmenuentry);
- $this->bootmenuentryMapper->orderremove($bootmenuentry);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_BootmenuController extends Zend_Controller_Action {
+
+ protected $bootmenuMapper;
+ protected $bootmenuentryMapper;
+ protected $membershipMapper;
+ protected $membership;
+ protected $page;
+ protected $type;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] == '') {
+ $this->_redirect('/user/index');
+ }
+
+ $this->bootmenuMapper = new Application_Model_BootMenuMapper();
+ $this->bootmenuentryMapper = new Application_Model_BootMenuEntriesMapper();
+
+
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $this->membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+
+ $this->type = $this->_request->getParam('type');
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
+ public function indexAction() {
+
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+ $result = $this->_request->getParam('json');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('json', $result);
+ }
+
+
+ //ACL Darf er Bootmenus sehen?
+ if(!Pbs_Acl::checkRight('booai') && !Pbs_Acl::checkRight('booui'))
+ { $this->_redirect('/user/index'); }
+
+ $this->bootMenumapper = new Application_Model_BootMenuMapper();
+ $this->bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $bootosMapper = new Application_Model_BootOsMapper();
+ $configMapper = new Application_Model_ConfigMapper();
+
+ $bootmenuentries = array();
+ if($this->type == 'group' && Pbs_Acl::checkRight('booai')) {
+ $this->view->type = 'group';
+ $bootmenu = $this->bootmenuMapper->findBy(array('groupID' => $this->membership->getGroupID()));
+ foreach ($bootmenu as $bm) {
+ $bm->setCreated(date(Zend_Registry::get('dateformat'), $bm->getCreated()));
+ $bootmenuID = $bm->getID();
+ $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
+ foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry) {
+ $kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
+ if($bootmenuentry->getKcl() && $kcl != null)
+ { $bootmenuentry->setKcl($kcl); }
+ else
+ { $bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)"); }
+ if($bootmenuentry->getKclappend() == null)
+ { $bootmenuentry->setKclappend("none (edit Bootmenuentry to set KCL-Append)"); }
+ $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
+ if($bootmenuentry->getConfigID() != null)
+ { $bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->getTitle()); }
+ }
+ }
+ } else {
+ $this->view->type = 'own';
+ $bootmenu = $this->bootmenuMapper->findBy(array('membershipID' => $this->membership->getID()));
+ if($bootmenu != null) {
+ $bootmenu[0]->setCreated(date(Zend_Registry::get('dateformat'), $bootmenu[0]->getCreated()));
+ $bootmenuID = $bootmenu[0]->getID();
+ $bootmenuentries[$bootmenuID] = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
+ foreach ($bootmenuentries[$bootmenuID] as $bootmenuentry) {
+ $kcl = $bootosMapper->find($bootmenuentry->getBootosID())->getDefaultkcl();
+ if($bootmenuentry->getKcl() && $kcl != null)
+ { $bootmenuentry->setKcl($kcl); }
+ else
+ { $bootmenuentry->setKcl("deactivated (edit Bootmenuentry to activate)"); }
+ if($bootmenuentry->getKclappend() == null)
+ { $bootmenuentry->setKclappend("none"); }
+ $bootmenuentry->setBootosID("[".$bootmenuentry->getBootosID()."] ".$bootosMapper->find($bootmenuentry->getBootosID())->getTitle());
+ if($bootmenuentry->getConfigID() != null)
+ { $bootmenuentry->setConfigID("[".$bootmenuentry->getConfigID()."] ".$configMapper->find($bootmenuentry->getConfigID())->gettitle()); }
+ }
+ }
+ }
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setType($this->type);
+ $mySearch->setModule('bootmenu');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $bootmenu = $mySearch->search($bootmenu);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($bootmenu);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/bootmenu/index/type/'.$this->type.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ $bootmenu = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+
+ $this->view->bootmenulist = $bootmenu;
+ $this->view->bootmenuentrylist = $bootmenuentries;
+
+ }
+
+ public function searchAction() {
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/search/'.($_GET['search']));
+ }
+
+
+ public function createbootmenuAction() {
+ //ACL Darf er BootMenus erstellen?
+ if(!Pbs_Acl::checkRight('booc'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden'); }
+
+ if (!isset($_POST["createbootmenu"])) {
+ $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu', 'page' => $this->page, 'type' => $this->type));
+ } else {
+
+ $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu', 'page' => $this->page, 'type' => $this->type), $_POST);
+
+ if ($bootmenuForm->isValid($_POST)) {
+
+ $bootmenu = new Application_Model_BootMenu($_POST);
+ $bootmenu->setCreated(time());
+ $bootmenu->setGroupID($this->membership->getGroupID());
+ $bootmenu->setDefaultbootmenu('0');
+
+ try {
+ $this->bootmenuMapper->save($bootmenu);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->bootmenuForm = $bootmenuForm;
+ }
+
+ public function editbootmenuAction() {
+
+ //ACL Is he allowed to edit BootMenus?
+ if(!Pbs_Acl::checkRight('booe'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!is_numeric($bootmenuID))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuMapper->find($bootmenuID, $bootmenu);
+
+ if($this->membership->getGroupID() != $bootmenu->getGroupID())
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ if (!isset($_POST["editbootmenu"])) {
+
+ $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu', 'page' => $this->page, 'type' => $this->type));
+ $bootmenuForm->populate($bootmenu->toArray());
+
+ } else {
+ $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu', 'page' => $this->page, 'type' => $this->type), $_POST);
+
+ if ($bootmenuForm->isValid($_POST)) {
+
+ $bootmenuold = $bootmenu;
+
+ $bootmenu = new Application_Model_BootMenu($_POST);
+ $bootmenu->setGroupID($this->membership->getGroupID());
+ $bootmenu->setCreated(time());
+ $bootmenu->setID($bootmenuID);
+ $bootmenu->setDefaultbootmenu($bootmenuold->getDefaultbootmenu());
+ print_a($bootmenu);
+ try {
+ $this->bootmenuMapper->save($bootmenu);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+ }
+
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
+ }
+
+ }
+
+ $this->view->bootmenuForm = $bootmenuForm;
+ }
+
+ public function deletebootmenuAction() {
+
+ //ACL Is he allowed to delete Bootmenu?
+ if(!Pbs_Acl::checkRight('bood'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ try {
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!is_numeric($bootmenuID))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuMapper->find($bootmenuID, $bootmenu);
+
+ if($this->membership->getGroupID() != $bootmenu->getGroupID())
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ $this->bootmenuMapper->delete($bootmenu);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
+ }
+
+ public function defaultbootmenuAction() {
+
+ //ACL Is he allowed to set Bootmenu as Default?
+ if(!Pbs_Acl::checkRight('boodbm'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ try {
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ if (!is_numeric($bootmenuID))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error'); }
+
+ $bootmenu = new Application_Model_BootMenu();
+
+ $this->bootmenuMapper->find($bootmenuID, $bootmenu);
+
+ if($bootmenu->getDefaultbootmenu() == false) {
+
+ list($defaultbootmenu) = $this->bootmenuMapper->findBy(array('defaultbootmenu' => '1'));
+ if($defaultbootmenu != null) {
+ $defaultbootmenu->setDefaultbootmenu(false);
+ $this->bootmenuMapper->save($defaultbootmenu);
+ }
+ $bootmenu->setDefaultbootmenu(true);
+ $this->bootmenuMapper->save($bootmenu);
+ }
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
+
+ }
+
+ public function addbootmenuentryAction() {
+
+ //ACL Darf er BootMenuEntries erstellen?
+ if(!Pbs_Acl::checkRight('booae') && !Pbs_Acl::checkRight('booaeo'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden'); }
+
+ $bootmenuID = $this->_request->getParam('bootmenuID');
+ $maxorder = $this->_request->getParam('maxorder');
+
+ if (!is_numeric($bootmenuID) || !is_numeric($maxorder))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error'); }
+
+ $bootosMapper = new Application_Model_BootOsMapper();
+ $configMapper = new Application_Model_ConfigMapper();
+ $groupMapper = new Application_Model_GroupMapper();
+
+ $groupID = $this->membership->getGroupID();
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+
+ $parents = array();
+ $bootoslist = array();
+ $parents = $groupgroupsMapper->getParentGroups($groupID);
+
+ $configlist = array('Preset' => array(), 'Custom' => Array());
+
+ foreach($parents as $k => $parent) {
+ foreach($parent as $p) {
+ $bootos = $bootosMapper->findBy(array("groupID" => $p));
+ foreach ($bootos as $b)
+ if($b->getPublic() - $k >= 0 ) {
+ $grouptitle = $groupMapper->find($p)->getTitle();
+ $bootoslist[$b->getID()] = $b;
+ $bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
+ $configlist['Preset'][$b->getID()] = $configMapper->findBy(array('bootosID' => $b->getID(), 'visible' => '1'));
+ $configlist['Custom'][$b->getID()] = $configMapper->findBy(array('membershipID' => $this->membership->getID(), 'bootosID' => $b->getID(), 'visible' => '1'));
+ }
+ }
+ }
+
+
+
+
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuMapper->find($bootmenuID, $bootmenu);
+
+ if($bootmenu->getMembershipID() != null) {
+ if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booaeo'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden'); }
+ } else {
+ if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('booae'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden'); }
+ }
+
+ if (!isset($_POST["addbootmenuentry"])) {
+
+ if(!isset($_POST['kcl']))
+ { $_POST['kcl'] = true; }
+
+ $bootmenuentryForm = new user_Form_BootmenuEntries(array(
+ 'bootoslist' => $bootoslist,
+ 'bootosanzeige' => $bootosanzeige,
+ 'maxorder' => $maxorder,
+ 'configlist' => $configlist,
+ 'page' => $this->page,
+ 'type' => $this->type,
+ 'action' => 'addbootmenuentry',
+ ));
+
+ $bootmenuentryForm->populate(array('order' => $maxorder));
+ unset($_POST['defaultkcl']);
+ unset($_POST['configID']);
+ $bootmenuentryForm->populate($_POST);
+
+ } else {
+
+ $bootmenuentryForm = new user_Form_BootmenuEntries(array(
+ 'bootoslist' => $bootoslist,
+ 'bootosanzeige' => $bootosanzeige,
+ 'maxorder' => $maxorder,
+ 'configlist' => $configlist,
+ 'page' => $this->page,
+ 'type' => $this->type,
+ 'action' => 'addbootmenuentry',
+ ), $_POST);
+
+ if ($bootmenuentryForm->isValid($_POST)) {
+
+ $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
+ $bootmenuentry->setBootmenuID($bootmenuID);
+
+ try {
+ if($bootmenuentry->getOrder() < $maxorder) {
+ $bootmenuentry->setOrder($bootmenuentry->getOrder());
+ $this->bootmenuentryMapper->order($bootmenuentry);
+ }
+
+ //print_a($bootmenuentry);
+
+ $this->bootmenuentryMapper->save($bootmenuentry);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
+
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->bootmenuentryForm = $bootmenuentryForm;
+
+ }
+
+ public function editbootmenuentryAction() {
+ //ACL Is he allowed to edit BootMenus?
+ if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem') && !Pbs_Acl::checkRight('booeeo'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ $maxorder = $this->_request->getParam('maxorder');
+ $oldorder = $this->_request->getParam('oldorder');
+ if (!is_numeric($bootmenuentryID) || !is_numeric($maxorder) || !is_numeric($oldorder))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error'); }
+
+ $bootosMapper = new Application_Model_BootOsMapper();
+ $configMapper = new Application_Model_ConfigMapper();
+
+ $groupID = $this->membership->getGroupID();
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+ $groupMapper = new Application_Model_GroupMapper();
+
+ $parents = array();
+ $bootoslist = array();
+ $parents = $groupgroupsMapper->getParentGroups($groupID);
+
+ foreach($parents as $k => $parent) {
+ foreach($parent as $p) {
+ $bootos = $bootosMapper->findBy(array("groupID" => $p));
+ foreach ($bootos as $b)
+ if($b->getPublic() - $k >= 0 ) {
+ $grouptitle = $groupMapper->find($p)->getTitle();
+ $bootoslist[$b->getID()] = $b;
+ $bootosanzeige[$grouptitle][$b->getID()] = $b->getTitle();
+ $configlist['Preset'][$b->getID()] = $configMapper->findBy(array('bootosID' => $b->getID(), 'visible' => '1'));
+ $configlist['Custom'][$b->getID()] = $configMapper->findBy(array('membershipID' => $this->membership->getID(), 'bootosID' => $b->getID(), 'visible' => '1'));
+
+ }
+ }
+ }
+
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
+ $this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);
+
+ if($bootmenu->getMembershipID() != null) {
+ if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('booeeo'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+ } else {
+ if($this->membership->getGroupID() != $bootmenu->getGroupID() || (!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeem')))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+ }
+
+ $neworder = $this->_request->getParam('neworder');
+ if($neworder != '') {
+ if($neworder == 'undefined')
+ { $neworder = $maxorder - 1; }
+
+ $_POST = array(
+ 'title' => $bootmenuentry->getTitle(),
+ 'bootosID' => $bootmenuentry->getBootosID(),
+ 'kcl' => $bootmenuentry->getKcl(),
+ 'kclappend' => $bootmenuentry->getKclappend(),
+ 'configID' => $bootmenuentry->getConfigID(),
+ 'order' => $neworder,
+ 'editbootmenuentry' => 'Edit Bootmenuentry',
+ );
+ }
+
+ if (!isset($_POST["editbootmenuentry"])) {
+ if(!isset($_POST['bootosID']))
+ { $_POST['bootosID'] = $bootmenuentry->getBootosID(); }
+ if(!isset($_POST['kcl']))
+ { $_POST['kcl'] = $bootmenuentry->getKcl(); }
+
+ $bootmenuentryForm = new user_Form_BootmenuEntries(array(
+ 'bootoslist' => $bootoslist,
+ 'bootosanzeige' => $bootosanzeige,
+ 'maxorder' => $maxorder - 1,
+ 'configlist' => $configlist,
+ 'page' => $this->page,
+ 'type' => $this->type,
+ 'action' => 'editbootmenuentry',
+ ));
+
+ if(!isset($_POST['configID'])) {
+ $bootmenuentryForm->populate($bootmenuentry->toArray());
+ } else {
+ unset($_POST['defaultkcl']);
+ unset($_POST['configID']);
+ $bootmenuentryForm->populate($_POST);
+ }
+
+ } else {
+ $bootmenuentryForm = new user_Form_BootmenuEntries(array(
+ 'bootoslist' => $bootoslist,
+ 'bootosanzeige' => $bootosanzeige,
+ 'maxorder' => $maxorder - 1,
+ 'configlist' => $configlist,
+ 'page' => $this->page,
+ 'type' => $this->type,
+ 'action' => 'editbootmenuentry'), $_POST);
+
+ if ($bootmenuentryForm->isValid($_POST)) {
+
+ $bootmenuentryold = $bootmenuentry;
+
+ $bootmenuentry = new Application_Model_BootMenuEntries($_POST);
+ $bootmenuentry->setBootmenuID($bootmenu->getID());
+ $bootmenuentry->setID($bootmenuentryID);
+
+ if( $bootmenuentryold->getBootosID() != $bootmenuentry->getBootosID() ||
+ $bootmenuentryold->getConfigID() != $bootmenuentry->getConfigID() ||
+ $bootmenuentryold->getKcl() != $bootmenuentry->getKcl() ||
+ $bootmenuentryold->getKclappend() != $bootmenuentry->getKclappend()) {
+ //ACL Is he allowed to edit this?
+ if(!Pbs_Acl::checkRight('booee') && !Pbs_Acl::checkRight('booeeo'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+ }
+
+ try {
+ if($bootmenuentry->getOrder() < $oldorder)
+ { $this->bootmenuentryMapper->orderbefore($bootmenuentry, $oldorder); }
+ else
+ { $this->bootmenuentryMapper->orderafter($bootmenuentry, $oldorder); }
+
+ $this->bootmenuentryMapper->save($bootmenuentry);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+
+ }
+
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
+ }
+
+ }
+
+ $this->view->bootmenuentryForm = $bootmenuentryForm;
+
+ }
+
+ public function removebootmenuentryAction() {
+ //ACL Is he allowed to delete Bootos?
+ if(!Pbs_Acl::checkRight('boode') && !Pbs_Acl::checkRight('boodeo'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ try {
+ $bootmenuentryID = $this->_request->getParam('bootmenuentryID');
+ if (!is_numeric($bootmenuentryID))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ $bootmenuentry = new Application_Model_BootMenuEntries();
+ $bootmenu = new Application_Model_BootMenu();
+ $this->bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
+ $this->bootmenuMapper->find($bootmenuentry->getBootmenuID(), $bootmenu);
+
+ if($bootmenu->getMembershipID() != null) {
+ if($this->membership->getID() != $bootmenu->getMembershipID() || !Pbs_Acl::checkRight('boodeo'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+ } else {
+ if($this->membership->getGroupID() != $bootmenu->getGroupID() || !Pbs_Acl::checkRight('boode'))
+ { $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+ }
+
+ $this->bootmenuentryMapper->delete($bootmenuentry);
+ $this->bootmenuentryMapper->orderremove($bootmenuentry);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
+ }
+ $this->_redirect('/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
+ }
}
diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php
index f7fad49..c428937 100644
--- a/application/modules/user/controllers/BootosController.php
+++ b/application/modules/user/controllers/BootosController.php
@@ -1,354 +1,346 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_BootosController extends Zend_Controller_Action
-{
-
- protected $bootosMapper;
- protected $membershipMapper;
- protected $membership;
- protected $page;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($userIDsNamespace['membershipID'] ==''){
- $this->_redirect('/user/index');
- }
-
- $this->bootosMapper = new Application_Model_BootOsMapper();
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
-
- $this->db = Zend_Db_Table::getDefaultAdapter();
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- $this->page = $this->_request->getParam('page');
- }
-
- public function indexAction()
- {
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
- $result = $this->_request->getParam('updateresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('update',$result);
- }
-
- $groupID = $this->membership->getGroupID();
-
- //ACL Darf er BootOs sehen?
- if(!Pbs_Acl::checkRight('boai') && !Pbs_Acl::checkRight('boui'))
- $this->_redirect('/user/index');
-
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
-
- $parents = array();
- $this->view->bootoslist = array();
- $parents = $groupgroupsMapper->getParentGroups($groupID);
-
- foreach($parents as $k => $parent){
- foreach($parent as $p){
- $bootos = $this->bootosMapper->findBy(array("groupID" => $p));
- foreach ($bootos as $b)
- if($b->getPublic() - $k >= 0 )
- $this->view->bootoslist[] = $b;
- elseif($k == 0 && $b->getPublic() == -1 && Pbs_Acl::checkRight('boc'))
- $this->view->bootoslist[] = $b;
- }
- }
-
- $this->view->bootoslist = array_reverse($this->view->bootoslist);
- $this->view->resources = array();
-
- $groupMapper = new Application_Model_GroupMapper();
-
- if(count($this->view->bootoslist)>0){
- foreach ($this->view->bootoslist as $bootos){
- if($bootos->getDefaultkcl() == null)
- $bootos->setDefaultkcl("none (edit Bootos to set KCL)");
- $this->view->resources[$bootos->getID()]['kernel'] = is_file("../resources/bootos/".$bootos->getID()."/kernel/kernel");
- $this->view->resources[$bootos->getID()]['initramfs'] = is_file("../resources/bootos/".$bootos->getID()."/initramfs/initramfs");
- $this->view->resources[$bootos->getID()]['config'] = is_file("../resources/bootos/".$bootos->getID()."/config/default.tgz");
- $bootos->setGroupID("[".$bootos->getGroupID()."] ".$groupMapper->find($bootos->getGroupID())->getTitle());
- $bootos->setCreated(date(Zend_Registry::get('dateformat'),$bootos->getCreated()));
- $bootos->setExpires(date(Zend_Registry::get('dateformat'),$bootos->getExpires()));
- }
- }
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('bootos');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->bootoslist = $mySearch->search($this->view->bootoslist);
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->view->bootoslist);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/bootos/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $this->view->bootoslist = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
-
- }
- public function searchAction(){
- $this->_redirect('/user/bootos/index/search/'.($_GET['search']));
- }
-
- public function createbootosAction()
- {
-
- //ACL Darf er BootISOs erstellen?
- if(!Pbs_Acl::checkRight('boc'))
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/forbidden');
-
- $groupID = $this->membership->getGroupID();
-
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
- $childgroups = count($groupgroupsMapper->getChildGroups($groupID));
-
- if (!isset($_POST["createbootos"])){
- $bootosForm = new user_Form_Bootos(array(
- 'action' => 'createbootos',
- 'groupdepth' => $childgroups,
- 'page' => $this->page));
- } else {
-
- $bootosForm = new user_Form_Bootos(array(
- 'action' => 'createbootos',
- 'groupdepth' => $childgroups,
- 'page' => $this->page),$_POST);
-
- if ($bootosForm->isValid($_POST)) {
-
- $bootos = new Application_Model_BootOs($_POST);
-
- $bootos->setGroupID($this->membership->getGroupID());
- $bootos->setCreated(time());
- $bootos->setSource($_SERVER['REMOTE_ADDR']);
-
- try {
-
- $bootosID = $this->bootosMapper->save($bootos);
- $bootos->setID($bootosID);
-
- if( $_FILES['kernel']['size'] == 0 && $_FILES['kernel']['name'] != '' ||
- $_FILES['init']['size'] == 0 && $_FILES['init']['name'] != '' ||
- $_FILES['config']['size'] == 0 && $_FILES['config']['name'] != '' ){
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/file');
- }
-
- $initpath = "../resources/bootos/".$bootosID."/initramfs/";
- $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
- $configpath = "../resources/bootos/".$bootosID."/config/";
-
- mkdir($initpath ,0777, true);
- mkdir($kernelpath ,0777, true);
- mkdir($configpath ,0777, true);
-
- if($_FILES['kernel']['name'] != ''){
- move_uploaded_file($_FILES['kernel']['tmp_name'], $kernelpath."kernel");
- }
- if($_FILES['init']['name'] != ''){
- move_uploaded_file($_FILES['init']['tmp_name'], $initpath."initramfs");
- }
- if($_FILES['config']['name'] != ''){
- move_uploaded_file($_FILES['config']['tmp_name'], $configpath."default.tgz");
- $newconfig = new Pbs_NewConfig();
- $newconfig->createDefaultConfig($bootos);
- }
-
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/error');
- //TODO Delete File & delete bootiso from DB
-
- }
-
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->bootosForm = $bootosForm;
- }
-
- public function editbootosAction()
- {
-
- //ACL Is he allowed to edit Bootos?
- if(!Pbs_Acl::checkRight('boe') && !Pbs_Acl::checkRight('boem'))
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
-
- $bootosID = $this->_request->getParam('bootosID');
- if (!is_numeric($bootosID))
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
-
- $groupID = $this->membership->getGroupID();
-
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
- $childgroups = count($groupgroupsMapper->getChildGroups($groupID));
- $bootos = new Application_Model_BootOs();
- $bootos = $this->bootosMapper->find($bootosID);
-
- if($this->membership->getGroupID() != $bootos->getGroupID())
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
-
- if (!isset($_POST["editbootos"])){
-
- $bootosForm = new user_Form_Bootos(array(
- 'action' => 'editbootos',
- 'groupdepth' => $childgroups,
- 'page' => $this->page));
-
- $bootosForm->populate($bootos->toArray());
-
- }else{
- $bootosForm = new user_Form_Bootos(array(
- 'action' => 'editbootos',
- 'groupdepth' => $childgroups,
- 'page' => $this->page),$_POST);
-
- if ($bootosForm->isValid($_POST)) {
-
- $bootosold = $bootos;
-
- $bootos = new Application_Model_BootOs($_POST);
- $bootos->setGroupID($this->membership->getGroupID());
- $bootos->setSource($bootosold->getSource());
- $bootos->setCreated(time());
- $bootos->setID($bootosID);
-
- try {
-
- if( $bootos->getDistro() != $bootosold->getDistro() ||
- $bootos->getDistroversion() != $bootosold->getDistroversion() ||
- $bootos->getShare() != $bootosold->getShare() ||
- $bootos->getShortname() != $bootosold->getShortname() ||
- $bootos->getDefaultkcl() != $bootosold->getDefaultkcl() ||
- $bootos->getExpires() != $bootosold->getExpires() ||
- $bootos->getPublic() != $bootosold->getPublic() ){
- //ACL Is he allowed to edit this?
- if(!Pbs_Acl::checkRight('boe'))
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- if($_FILES['kernel']['name'] != '' || $_FILES['init']['name'] != '' || $_FILES['config']['name'] != ''){
- //ACL Is he allowed to edit the Kernel/Init Path?
- if(!Pbs_Acl::checkRight('boe'))
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- if( $_FILES['kernel']['size'] == 0 && $_FILES['kernel']['name'] != '' ||
- $_FILES['init']['size'] == 0 && $_FILES['init']['name'] != '' ||
- $_FILES['config']['size'] == 0 && $_FILES['config']['name'] != '' ){
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/file');
- }
-
- $initpath = "../resources/bootos/".$bootosID."/initramfs/";
- $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
- $configpath = "../resources/bootos/".$bootosID."/config/";
-
- mkdir($initpath ,0777, true);
- mkdir($kernelpath ,0777, true);
- mkdir($configpath ,0777, true);
-
-
- if($_FILES['kernel']['name'] != ''){
- $bootos->setSource($_SERVER['REMOTE_ADDR']);
- move_uploaded_file($_FILES['kernel']['tmp_name'], $kernelpath."kernel");
- }
- if($_FILES['init']['name'] != ''){
- $bootos->setSource($_SERVER['REMOTE_ADDR']);
- move_uploaded_file($_FILES['init']['tmp_name'], $initpath."initramfs");
- }
- if($_FILES['config']['name'] != ''){
- $bootos->setSource($_SERVER['REMOTE_ADDR']);
- move_uploaded_file($_FILES['config']['tmp_name'], $configpath."default.tgz");
- }
-
- $this->bootosMapper->save($bootos);
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/error');
- //TODO Delete Folder + Preboot
- }
-
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/ok');
- }
-
- }
-
- $this->view->bootosForm = $bootosForm;
-
- }
-
- public function deletebootosAction()
- {
- //ACL Is he allowed to delete Bootos?
- if(!Pbs_Acl::checkRight('bod'))
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
- $bootosID = $this->_request->getParam('bootosID');
- if (!is_numeric($bootosID))
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
-
- $bootos = new Application_Model_BootOs();
- $this->bootosMapper->find($bootosID, $bootos);
-
- if($this->membership->getGroupID() != $bootos->getGroupID())
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden');
-
- $this->bootosMapper->delete($bootos);
- exec("rm -r ../resources/bootos/".$bootosID);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/ok');
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_BootosController extends Zend_Controller_Action {
+
+ protected $bootosMapper;
+ protected $membershipMapper;
+ protected $membership;
+ protected $page;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] == '') {
+ $this->_redirect('/user/index');
+ }
+
+ $this->bootosMapper = new Application_Model_BootOsMapper();
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $this->membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
+ public function indexAction() {
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+ $result = $this->_request->getParam('updateresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('update', $result);
+ }
+
+ $groupID = $this->membership->getGroupID();
+
+ //ACL Darf er BootOs sehen?
+ if(!Pbs_Acl::checkRight('boai') && !Pbs_Acl::checkRight('boui'))
+ { $this->_redirect('/user/index'); }
+
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+
+ $parents = array();
+ $this->view->bootoslist = array();
+ $parents = $groupgroupsMapper->getParentGroups($groupID);
+
+ foreach($parents as $k => $parent) {
+ foreach($parent as $p) {
+ $bootos = $this->bootosMapper->findBy(array("groupID" => $p));
+ foreach ($bootos as $b)
+ if($b->getPublic() - $k >= 0 )
+ { $this->view->bootoslist[] = $b; }
+ elseif($k == 0 && $b->getPublic() == -1 && Pbs_Acl::checkRight('boc'))
+ $this->view->bootoslist[] = $b;
+ }
+ }
+
+ $this->view->bootoslist = array_reverse($this->view->bootoslist);
+ $this->view->resources = array();
+
+ $groupMapper = new Application_Model_GroupMapper();
+
+ if(count($this->view->bootoslist) > 0) {
+ foreach ($this->view->bootoslist as $bootos) {
+ if($bootos->getDefaultkcl() == null)
+ { $bootos->setDefaultkcl("none (edit Bootos to set KCL)"); }
+ $this->view->resources[$bootos->getID()]['kernel'] = is_file("../resources/bootos/".$bootos->getID()."/kernel/kernel");
+ $this->view->resources[$bootos->getID()]['initramfs'] = is_file("../resources/bootos/".$bootos->getID()."/initramfs/initramfs");
+ $this->view->resources[$bootos->getID()]['config'] = is_file("../resources/bootos/".$bootos->getID()."/config/default.tgz");
+ $bootos->setGroupID("[".$bootos->getGroupID()."] ".$groupMapper->find($bootos->getGroupID())->getTitle());
+ $bootos->setCreated(date(Zend_Registry::get('dateformat'), $bootos->getCreated()));
+ $bootos->setExpires(date(Zend_Registry::get('dateformat'), $bootos->getExpires()));
+ }
+ }
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('bootos');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->bootoslist = $mySearch->search($this->view->bootoslist);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->view->bootoslist);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/bootos/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ $this->view->bootoslist = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+
+ }
+ public function searchAction() {
+ $this->_redirect('/user/bootos/index/search/'.($_GET['search']));
+ }
+
+ public function createbootosAction() {
+
+ //ACL Darf er BootISOs erstellen?
+ if(!Pbs_Acl::checkRight('boc'))
+ { $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/forbidden'); }
+
+ $groupID = $this->membership->getGroupID();
+
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+ $childgroups = count($groupgroupsMapper->getChildGroups($groupID));
+
+ if (!isset($_POST["createbootos"])) {
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'createbootos',
+ 'groupdepth' => $childgroups,
+ 'page' => $this->page));
+ } else {
+
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'createbootos',
+ 'groupdepth' => $childgroups,
+ 'page' => $this->page), $_POST);
+
+ if ($bootosForm->isValid($_POST)) {
+
+ $bootos = new Application_Model_BootOs($_POST);
+
+ $bootos->setGroupID($this->membership->getGroupID());
+ $bootos->setCreated(time());
+ $bootos->setSource($_SERVER['REMOTE_ADDR']);
+
+ try {
+
+ $bootosID = $this->bootosMapper->save($bootos);
+ $bootos->setID($bootosID);
+
+ if( $_FILES['kernel']['size'] == 0 && $_FILES['kernel']['name'] != '' ||
+ $_FILES['init']['size'] == 0 && $_FILES['init']['name'] != '' ||
+ $_FILES['config']['size'] == 0 && $_FILES['config']['name'] != '' ) {
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/file');
+ }
+
+ $initpath = "../resources/bootos/".$bootosID."/initramfs/";
+ $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
+ $configpath = "../resources/bootos/".$bootosID."/config/";
+
+ mkdir($initpath , 0777, true);
+ mkdir($kernelpath , 0777, true);
+ mkdir($configpath , 0777, true);
+
+ if($_FILES['kernel']['name'] != '') {
+ move_uploaded_file($_FILES['kernel']['tmp_name'], $kernelpath."kernel");
+ }
+ if($_FILES['init']['name'] != '') {
+ move_uploaded_file($_FILES['init']['tmp_name'], $initpath."initramfs");
+ }
+ if($_FILES['config']['name'] != '') {
+ move_uploaded_file($_FILES['config']['tmp_name'], $configpath."default.tgz");
+ $newconfig = new Pbs_NewConfig();
+ $newconfig->createDefaultConfig($bootos);
+ }
+
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/error');
+ //TODO Delete File & delete bootiso from DB
+
+ }
+
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->bootosForm = $bootosForm;
+ }
+
+ public function editbootosAction() {
+
+ //ACL Is he allowed to edit Bootos?
+ if(!Pbs_Acl::checkRight('boe') && !Pbs_Acl::checkRight('boem'))
+ { $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $bootosID = $this->_request->getParam('bootosID');
+ if (!is_numeric($bootosID))
+ { $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $groupID = $this->membership->getGroupID();
+
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+ $childgroups = count($groupgroupsMapper->getChildGroups($groupID));
+ $bootos = new Application_Model_BootOs();
+ $bootos = $this->bootosMapper->find($bootosID);
+
+ if($this->membership->getGroupID() != $bootos->getGroupID())
+ { $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ if (!isset($_POST["editbootos"])) {
+
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'editbootos',
+ 'groupdepth' => $childgroups,
+ 'page' => $this->page));
+
+ $bootosForm->populate($bootos->toArray());
+
+ } else {
+ $bootosForm = new user_Form_Bootos(array(
+ 'action' => 'editbootos',
+ 'groupdepth' => $childgroups,
+ 'page' => $this->page), $_POST);
+
+ if ($bootosForm->isValid($_POST)) {
+
+ $bootosold = $bootos;
+
+ $bootos = new Application_Model_BootOs($_POST);
+ $bootos->setGroupID($this->membership->getGroupID());
+ $bootos->setSource($bootosold->getSource());
+ $bootos->setCreated(time());
+ $bootos->setID($bootosID);
+
+ try {
+
+ if( $bootos->getDistro() != $bootosold->getDistro() ||
+ $bootos->getDistroversion() != $bootosold->getDistroversion() ||
+ $bootos->getShare() != $bootosold->getShare() ||
+ $bootos->getShortname() != $bootosold->getShortname() ||
+ $bootos->getDefaultkcl() != $bootosold->getDefaultkcl() ||
+ $bootos->getExpires() != $bootosold->getExpires() ||
+ $bootos->getPublic() != $bootosold->getPublic() ) {
+ //ACL Is he allowed to edit this?
+ if(!Pbs_Acl::checkRight('boe'))
+ { $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden'); }
+ }
+
+ if($_FILES['kernel']['name'] != '' || $_FILES['init']['name'] != '' || $_FILES['config']['name'] != '') {
+ //ACL Is he allowed to edit the Kernel/Init Path?
+ if(!Pbs_Acl::checkRight('boe'))
+ { $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden'); }
+ }
+
+ if( $_FILES['kernel']['size'] == 0 && $_FILES['kernel']['name'] != '' ||
+ $_FILES['init']['size'] == 0 && $_FILES['init']['name'] != '' ||
+ $_FILES['config']['size'] == 0 && $_FILES['config']['name'] != '' ) {
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/file');
+ }
+
+ $initpath = "../resources/bootos/".$bootosID."/initramfs/";
+ $kernelpath = "../resources/bootos/".$bootosID."/kernel/";
+ $configpath = "../resources/bootos/".$bootosID."/config/";
+
+ mkdir($initpath , 0777, true);
+ mkdir($kernelpath , 0777, true);
+ mkdir($configpath , 0777, true);
+
+
+ if($_FILES['kernel']['name'] != '') {
+ $bootos->setSource($_SERVER['REMOTE_ADDR']);
+ move_uploaded_file($_FILES['kernel']['tmp_name'], $kernelpath."kernel");
+ }
+ if($_FILES['init']['name'] != '') {
+ $bootos->setSource($_SERVER['REMOTE_ADDR']);
+ move_uploaded_file($_FILES['init']['tmp_name'], $initpath."initramfs");
+ }
+ if($_FILES['config']['name'] != '') {
+ $bootos->setSource($_SERVER['REMOTE_ADDR']);
+ move_uploaded_file($_FILES['config']['tmp_name'], $configpath."default.tgz");
+ }
+
+ $this->bootosMapper->save($bootos);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/error');
+ //TODO Delete Folder + Preboot
+ }
+
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/ok');
+ }
+
+ }
+
+ $this->view->bootosForm = $bootosForm;
+
+ }
+
+ public function deletebootosAction() {
+ //ACL Is he allowed to delete Bootos?
+ if(!Pbs_Acl::checkRight('bod'))
+ { $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ try {
+ $bootosID = $this->_request->getParam('bootosID');
+ if (!is_numeric($bootosID))
+ { $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ $bootos = new Application_Model_BootOs();
+ $this->bootosMapper->find($bootosID, $bootos);
+
+ if($this->membership->getGroupID() != $bootos->getGroupID())
+ { $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ $this->bootosMapper->delete($bootos);
+ exec("rm -r ../resources/bootos/".$bootosID);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/error');
+ }
+ $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/ok');
+ }
}
diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php
index 76419a8..40c8c73 100644
--- a/application/modules/user/controllers/ClientController.php
+++ b/application/modules/user/controllers/ClientController.php
@@ -1,203 +1,193 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class User_ClientController extends Zend_Controller_Action
-{
- private $membership;
- protected $page;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($userIDsNamespace['membershipID'] ==''){
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('No membershipID set','forbidden');
- }
- /* Initialize action controller here */
- $membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- $this->page = $this->_request->getParam('page');
- }
-
- public function indexAction()
- {
- // ACL: is he authorized to see this ?
- if(!Pbs_Acl::checkRight('clo'))
- $this->_redirect('/user');
-
- // 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);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
-
- $clientMapper = new Application_Model_ClientMapper();
- $clientsInGroup = $clientMapper->findBy(array('groupID' => $this->membership->getGroupID()),true);
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('client');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $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)
- ->setElement($clientsInGroup)
- ->setRequestPage($this->_request->getParam('page'))
- ->setPageUrl('/user/client/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $clientsInGroup = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- $this->view->clients = $clientsInGroup;
-
- }
- public function searchAction(){
- $this->_redirect('/user/client/index/search/'.($_GET['search']));
- }
-
- public function addclientAction()
- {
- $mac = $this->_request->getParam('mac');
- $hh = $this->_request->getParam('hh');
-
- // ACL: is he authorized to create new clients?
- if(!Pbs_Acl::checkRight('cla'))
- $this->_redirect('/user');
-
- if (!isset($_POST["add"])){
- $addclient = new user_Form_Client(array(
- 'buttontext' => 'Create Client',
- 'page' => $this->page));
- $this->view->addclient = $addclient;
- }
- else{
- $addclient = new user_Form_Client(array(
- 'buttontext' => 'Create Client',
- 'page' => $this->page),$_POST);
- if ($addclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
- $client = new Application_Model_Client($_POST);
- $mac = ($mac!='')?$mac:$_POST['macadress'];
- $hh = ($hh!='')?$hh:$_POST['hardwarehash'];
- $client->setMacadress($mac)
- ->setHardwarehash($hh)
- ->setCreated(time())
- ->setGroupID($this->membership->getGroupID());
- $clientmapper = new Application_Model_ClientMapper();
- $clientmapper->save($client);
- $this->_redirect('/user/client/index/addresult/ok');
- }
- $this->view->addclient = $addclient;
- }
- }
-
- public function removeclientAction()
- {
- $clientID = $this->_request->getParam('clientID');
-
- // ACL: is he authorized to delete clients?
- if(!Pbs_Acl::checkRight('cld'))
- $this->_redirect('/user');
-
- $clientMapper = new Application_Model_ClientMapper();
- if(is_numeric($clientID)){
- $client = new Application_Model_Client();
- $clientMapper->find($clientID,$client);
- if($client->getGroupID() == $this->membership->getGroupID()){
- $clientMapper = new Application_Model_ClientMapper();
- $clientMapper->delete($client);
- $this->_redirect('/user/client/index/page/'.$this->page.'/deleteresult/ok');
- }
- else{
- $this->_redirect('/user/client/index/page/'.$this->page.'/deleteresult/forbidden');
- }
- }
- $this->_redirect('/user/client/index/page/'.$this->page.'/deleteresult/error');
- }
-
- public function editclientAction(){
- // ACL: Is he authorized to edit clients ?
- if(!Pbs_Acl::checkRight('cle'))
- $this->_redirect('/user');
-
- 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()){
- $editclient = new user_Form_Client(array(
- 'buttontext' => 'Edit Client',
- 'page' => $this->page));
- $editclient->populate($client->toArray());
- $this->view->editclient = $editclient;
- }
- else{
- $this->_redirect('/user/client/index/page/'.$this->page.'/modifyresult/error');
- }
- }
- else{
- $editclient = new user_Form_Client(array(
- 'buttontext' => 'Edit Client',
- 'page' => $this->page),$_POST);
- if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
- $client = new Application_Model_Client($_POST);
- $client->setID($this->_request->getParam('clientID'));
-
- $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());
- $clientmapper = new Application_Model_ClientMapper();
- $clientmapper->save($client);
- $this->_redirect('/user/client/index/page/'.$this->page.'/modifyresult/ok');
- }
- else{
- $this->_redirect('/user/client/index/page/'.$this->page.'/modifyresult/error');
- }
- }
- $this->view->editclient = $editclient;
- }
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class User_ClientController extends Zend_Controller_Action {
+ private $membership;
+ protected $page;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] == '') {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('No membershipID set', 'forbidden');
+ }
+ /* Initialize action controller here */
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
+ public function indexAction() {
+ // ACL: is he authorized to see this ?
+ if(!Pbs_Acl::checkRight('clo'))
+ { $this->_redirect('/user'); }
+
+ // 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);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+
+ $clientMapper = new Application_Model_ClientMapper();
+ $clientsInGroup = $clientMapper->findBy(array('groupID' => $this->membership->getGroupID()), true);
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('client');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $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)
+ ->setElement($clientsInGroup)
+ ->setRequestPage($this->_request->getParam('page'))
+ ->setPageUrl('/user/client/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ $clientsInGroup = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->clients = $clientsInGroup;
+
+ }
+ public function searchAction() {
+ $this->_redirect('/user/client/index/search/'.($_GET['search']));
+ }
+
+ public function addclientAction() {
+ $mac = $this->_request->getParam('mac');
+ $hh = $this->_request->getParam('hh');
+
+ // ACL: is he authorized to create new clients?
+ if(!Pbs_Acl::checkRight('cla'))
+ { $this->_redirect('/user'); }
+
+ if (!isset($_POST["add"])) {
+ $addclient = new user_Form_Client(array(
+ 'buttontext' => 'Create Client',
+ 'page' => $this->page));
+ $this->view->addclient = $addclient;
+ } else {
+ $addclient = new user_Form_Client(array(
+ 'buttontext' => 'Create Client',
+ 'page' => $this->page), $_POST);
+ if ($addclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
+ $client = new Application_Model_Client($_POST);
+ $mac = ($mac != '') ? $mac : $_POST['macadress'];
+ $hh = ($hh != '') ? $hh : $_POST['hardwarehash'];
+ $client->setMacadress($mac)
+ ->setHardwarehash($hh)
+ ->setCreated(time())
+ ->setGroupID($this->membership->getGroupID());
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->save($client);
+ $this->_redirect('/user/client/index/addresult/ok');
+ }
+ $this->view->addclient = $addclient;
+ }
+ }
+
+ public function removeclientAction() {
+ $clientID = $this->_request->getParam('clientID');
+
+ // ACL: is he authorized to delete clients?
+ if(!Pbs_Acl::checkRight('cld'))
+ { $this->_redirect('/user'); }
+
+ $clientMapper = new Application_Model_ClientMapper();
+ if(is_numeric($clientID)) {
+ $client = new Application_Model_Client();
+ $clientMapper->find($clientID, $client);
+ if($client->getGroupID() == $this->membership->getGroupID()) {
+ $clientMapper = new Application_Model_ClientMapper();
+ $clientMapper->delete($client);
+ $this->_redirect('/user/client/index/page/'.$this->page.'/deleteresult/ok');
+ } else {
+ $this->_redirect('/user/client/index/page/'.$this->page.'/deleteresult/forbidden');
+ }
+ }
+ $this->_redirect('/user/client/index/page/'.$this->page.'/deleteresult/error');
+ }
+
+ public function editclientAction() {
+ // ACL: Is he authorized to edit clients ?
+ if(!Pbs_Acl::checkRight('cle'))
+ { $this->_redirect('/user'); }
+
+ 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()) {
+ $editclient = new user_Form_Client(array(
+ 'buttontext' => 'Edit Client',
+ 'page' => $this->page));
+ $editclient->populate($client->toArray());
+ $this->view->editclient = $editclient;
+ } else {
+ $this->_redirect('/user/client/index/page/'.$this->page.'/modifyresult/error');
+ }
+ } else {
+ $editclient = new user_Form_Client(array(
+ 'buttontext' => 'Edit Client',
+ 'page' => $this->page), $_POST);
+ if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) {
+ $client = new Application_Model_Client($_POST);
+ $client->setID($this->_request->getParam('clientID'));
+
+ $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());
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->save($client);
+ $this->_redirect('/user/client/index/page/'.$this->page.'/modifyresult/ok');
+ } else {
+ $this->_redirect('/user/client/index/page/'.$this->page.'/modifyresult/error');
+ }
+ }
+ $this->view->editclient = $editclient;
+ }
+ }
}
diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php
index b271974..d38c981 100644
--- a/application/modules/user/controllers/ConfigController.php
+++ b/application/modules/user/controllers/ConfigController.php
@@ -1,542 +1,532 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_ConfigController extends Zend_Controller_Action
-{
-
- protected $configMapper;
- protected $bootosMapper;
- protected $bootosuserMapper;
- protected $bootmenuMapper;
- protected $bootmenuentriesMapper;
- protected $membershipMapper;
- protected $membership;
- protected $page;
- protected $config;
- protected $type;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($userIDsNamespace['membershipID'] ==''){
- $this->_redirect('/user/index');
- }
-
- $this->configMapper = new Application_Model_ConfigMapper();
- $this->bootosuserMapper = new Application_Model_BootOsUserMapper();
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
-
- $this->db = Zend_Db_Table::getDefaultAdapter();
-
- $this->type = $this->_request->getParam('type');
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- $this->page = $this->_request->getParam('page');
- }
-
- public function indexAction()
- {
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
-
- $groupID = $this->membership->getGroupID();
-
- //ACL Darf er Configs sehen?
- if(!Pbs_Acl::checkRight('csai') && !Pbs_Acl::checkRight('csui'))
- $this->_redirect('/user/index');
-
- $this->configMapper = new Application_Model_ConfigMapper();
- $this->bootosMapper = new Application_Model_BootOsMapper();
- $this->bootmenuMapper = new Application_Model_BootMenuMapper();
- $this->bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $groupMapper = new Application_Model_GroupMapper();
- $this->view->bootoslist = array();
- $this->view->configlist = array();
-
- if($this->type =='own' && Pbs_Acl::checkRight('csui')){
- $this->view->type = 'own';
- $bootmenu = $this->bootmenuMapper->findBy(array('membershipID' => $this->membership->getID()));
- if($bootmenu != null){
- $bootmenuID = $bootmenu[0]->getID();
- $bootmenuentries = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
- foreach ($bootmenuentries as $bootmenuentry){
- $bootos = $this->bootosMapper->find($bootmenuentry->getBootosID());
- $bootos->setGroupID("[".$bootos->getGroupID()."] ".$groupMapper->find($bootos->getGroupID())->getTitle());
- $this->view->bootoslist[$bootos->getID()] = $bootos;
- $this->view->configlist[$bootos->getID()] = $this->configMapper->findBy(array('membershipID' => $this->membership->getID(), 'bootosID' => $bootos->getID()));
- foreach ($this->view->configlist[$bootos->getID()] as $config){
- $config->setCreated(date(Zend_Registry::get('dateformat'),$config->getCreated()));
- }
- }
- }
- }else{
- $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
-
- $parents = array();
- $groupconfs = array();
- $ownerconfs = array();
- $parents = $groupgroupsMapper->getParentGroups($groupID);
-
- foreach($parents as $k => $parent){
- foreach($parent as $p){
- $bootos = $this->bootosMapper->findBy(array("groupID" => $p));
- foreach ($bootos as $b)
- if($b->getPublic() - $k >= 0 ){
- $this->view->bootoslist[] = $b;
- if(Pbs_Acl::checkRight('cc')){
- $ownerconfs = $this->configMapper->findBy(array('groupID' => $b->getGroupID(), 'membershipID' => null, 'bootosID' => $b->getID()));
- if($groupID != $b->getGroupID())
- $groupconfs = $this->configMapper->findBy(array('groupID' => $groupID, 'membershipID' => null, 'bootosID' => $b->getID()));
- $this->view->configlist[$b->getID()] = array_merge($ownerconfs,$groupconfs);
- }else{
- $ownerconfs = $this->configMapper->findBy(array('groupID' => $b->getGroupID(), 'membershipID' => null, 'bootosID' => $b->getID(), 'visible' => '1'));
- if($groupID != $b->getGroupID())
- $groupconfs = $this->configMapper->findBy(array('groupID' => $groupID, 'membershipID' => null, 'bootosID' => $b->getID(), 'visible' => '1'));
- $this->view->configlist[$b->getID()] = array_merge($ownerconfs,$groupconfs);
-
- }
- foreach ($this->view->configlist[$b->getID()] as $config){
- $config->setCreated(date(Zend_Registry::get('dateformat'),$config->getCreated()));
- }
- }
- elseif($k == 0 && $b->getPublic() == -1 && Pbs_Acl::checkRight('boc')){
- $this->view->bootoslist[] = $b;
- if(Pbs_Acl::checkRight('cc')){
- $ownerconfs = $this->configMapper->findBy(array('groupID' => $b->getGroupID(), 'membershipID' => null, 'bootosID' => $b->getID()));
- if($groupID != $b->getGroupID())
- $groupconfs = $this->configMapper->findBy(array('groupID' => $groupID, 'membershipID' => null, 'bootosID' => $b->getID()));
- $this->view->configlist[$b->getID()] = array_merge($ownerconfs,$groupconfs);
- }else{
- $ownerconfs = $this->configMapper->findBy(array('groupID' => $b->getGroupID(), 'membershipID' => null, 'bootosID' => $b->getID(), 'visible' => '1'));
- if($groupID != $b->getGroupID())
- $groupconfs = $this->configMapper->findBy(array('groupID' => $groupID, 'membershipID' => null, 'bootosID' => $b->getID(), 'visible' => '1'));
- $this->view->configlist[$b->getID()] = array_merge($ownerconfs,$groupconfs);
- }
- foreach ($this->view->configlist[$b->getID()] as $config){
- $config->setCreated(date(Zend_Registry::get('dateformat'),$config->getCreated()));
- }
- }
- }
- }
-
- $this->view->bootoslist = array_reverse($this->view->bootoslist);
-
- if(count($this->view->bootoslist)>0){
- foreach ($this->view->bootoslist as $bootos){
- $bootos->setGroupID("[".$bootos->getGroupID()."] ".$groupMapper->find($bootos->getGroupID())->getTitle());
- }
- }
- $this->view->type = 'group';
- //$this->view->configlist = $this->configMapper->findBy(array('groupID' => $this->membership->getGroupID()));
- }
-
- //print_a($this->view->configlist);
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setType($this->type);
- $mySearch->setModule('config');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->configlist = $mySearch->search($this->view->configlist
- );
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->view->bootoslist);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/config/index/type/'.$this->type.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $this->view->bootoslist = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
-
- }
-
- public function searchAction(){
- $this->_redirect('/user/config/index/type/'.$this->type.'/search/'.($_GET['search']));
- }
-
- public function createconfigAction()
- {
- //ACL Darf er Configs erstellen?
- if(!Pbs_Acl::checkRight('cc') && !Pbs_Acl::checkRight('cco'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden');
-
- $bootosID = $this->_request->getParam('bootosID');
-
- if (!is_numeric($bootosID))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
-
- if (!isset($_POST["createconfig"])){
- $configForm = new user_Form_Config(array('action' => 'createconfig','page'=>$this->page, 'type'=>$this->type));
- } else {
- $configForm = new user_Form_Config(array('action' => 'createconfig','page'=>$this->page, 'type'=>$this->type),$_POST);
-
- if ($configForm->isValid($_POST)) {
-
- $config = new Application_Model_Config($_POST);
- $config->setCreated(time());
- $config->setBootosID($bootosID);
-
- if(Pbs_Acl::checkRight('cc') && $this->_request->getParam('type') == 'group'){
- $config->setGroupID($this->membership->getGroupID());
- }
- elseif(Pbs_Acl::checkRight('cco') && $this->_request->getParam('type') == 'own'){
- $config->setVisible('1');
- $config->setMembershipID($this->membership->getID());
- }
- else
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
-
- try {
- $this->configMapper->save($config);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
- }
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->configForm = $configForm;
- }
-
- public function showconfigAction(){
-
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
-
- $configID = $this->_request->getParam('configID');
- if (!is_numeric($configID))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $groupID = $this->membership->getGroupID();
-
- $config = new Application_Model_Config();
- $this->configMapper->find($configID, $config);
-
- $hometypeMapper = new Application_Model_HomeTypeMapper();
-
- $this->view->configID = $configID;
- $this->view->type = $this->_request->getParam('type');
- $this->view->config = $this->configMapper->find($configID)->getTitle();
- $this->view->userlist = $this->bootosuserMapper->findBy(array('configID' => $configID));
- foreach($this->view->userlist as $user){
- $user->setHometypeID("[".$user->getHometypeID()."] ".$hometypeMapper->find($user->getHometypeID())->getName());
- }
-
- }
-
- public function adduserAction(){
- $configID = $this->_request->getParam('configID');
- if (!is_numeric($configID))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/addresult/error');
- //ACL Darf er User adden?
- if(!Pbs_Acl::checkRight('cc') && !Pbs_Acl::checkRight('cco'))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/addresult/forbidden');
-
- $hometypeMapper = new Application_Model_HomeTypeMapper();
- $hometype = $hometypeMapper->fetchAll();
-
- if (!isset($_POST["addbootosuser"])){
- $bootosuserForm = new user_Form_BootosUser(array('action' => 'addbootosuser', 'type'=>$this->type, 'configID' => $configID, 'hometype' => $hometype),$_POST);
- } else {
- $bootosuserForm = new user_Form_BootosUser(array('action' => 'addbootosuser', 'type'=>$this->type, 'configID' => $configID, 'hometype' => $hometype),$_POST);
-
- if ($bootosuserForm->isValid($_POST)) {
-
- $bootosuser = new Application_Model_BootOsUser($_POST);
- $bootosuser->setConfigID($configID);
- $bootosuser->setHomepath(str_replace("%login-name%", $bootosuser->getLogin(), $bootosuser->getHomepath()));
- if($bootosuser->getPassword() != '%password%')
- $bootosuser->setPassword(crypt($bootosuser->getPassword(), '$6$'.randomString(8).'$'));
-
- try {
- $this->bootosuserMapper->save($bootosuser);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/addresult/error');
- }
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/addresult/ok');
- }
- }
-
- $this->view->bootosuserForm = $bootosuserForm;
- }
-
-
- public function edituserAction(){
- //ACL Darf er Configs editieren?
- if(!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem') && !Pbs_Acl::checkRight('ceo'))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/forbidden');
-
- $configID = $this->_request->getParam('configID');
- $bootosuserID = $this->_request->getParam('bootosuserID');
-
- if (!is_numeric($configID) || !is_numeric($bootosuserID))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/error');
-
- $groupID = $this->membership->getGroupID();
-
- $bootosuser = new Application_Model_BootOsUser();
- $this->bootosuserMapper->find($bootosuserID,$bootosuser);
-
- $config = new Application_Model_Config();
- $this->configMapper->find($configID, $config);
-
- $hometypeMapper = new Application_Model_HomeTypeMapper();
- $hometype = $hometypeMapper->fetchAll();
-
- if($config->getMembershipID() != null){
- if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('ceo'))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $config->getGroupID() || (!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem')))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/forbidden');
- }
-
- if (!isset($_POST["editbootosuser"])){
- if(!isset($_POST['homepath'])){
- $_POST['login'] = $bootosuser->getLogin();
- $_POST['hometypeID'] = $bootosuser->getHometypeID();
-
- }
-
- $bootosuserForm = new user_Form_BootosUser(array('action' => 'editbootosuser', 'type'=>$this->type, 'configID' => $configID, 'hometype' => $hometype),$_POST);
-
- if(!isset($_POST['homepath']) && $bootosuser->getHometypeID() == '2')
- $bootosuserForm->populate(array('homepath' => $bootosuser->getHomepath()));
- }else{
- $bootosuserForm = new user_Form_BootosUser(array('action' => 'editbootosuser', 'type'=>$this->type, 'configID' => $configID, 'hometype' => $hometype),$_POST);
-
- if ($bootosuserForm->isValid($_POST)) {
-
- $bootosuserold = $bootosuser;
-
- $bootosuser = new Application_Model_BootOsUser($_POST);
-
- if($bootosuserold->getHometypeID() != $bootosuser->getHometypeID() ||
- $bootosuserold->getHomepath() != $bootosuser->getHomepath()){
- //ACL Is he allowed to edit other than Metadata?
- if(!Pbs_Acl::checkRight('ce'))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/forbidden');
- }
-
- $bootosuser->setID($bootosuserID);
- $bootosuser->setConfigID($configID);
- $bootosuser->setHomepath(str_replace("%login-name%", $bootosuser->getLogin(), $bootosuser->getHomepath()));
- if($bootosuser->getPassword() != '%password%')
- $bootosuser->setPassword(crypt($bootosuser->getPassword(), '$6$'.randomString(8).'$'));
-
- try {
- $this->bootosuserMapper->save($bootosuser);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/error');
- }
-
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/ok');
- }
-
- }
-
- $this->view->bootosuserForm = $bootosuserForm;
- }
-
- public function deleteuserAction(){
-
- $configID = $this->_request->getParam('configID');
- $bootosuserID = $this->_request->getParam('bootosuserID');
- if (!is_numeric($configID) || !is_numeric($bootosuserID))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/error');
- //ACL Darf er User löschen?
- if(!Pbs_Acl::checkRight('cd') && !Pbs_Acl::checkRight('cdo'))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/forbidden');
-
- try{
- $bootosuser = new Application_Model_BootOsUser();
- $this->bootosuserMapper->find($bootosuserID,$bootosuser);
-
- $config = new Application_Model_Config();
- $this->configMapper->find($configID,$config);
-
- if($config->getMembershipID() != null){
- if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('cdo'))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $config->getGroupID() || !Pbs_Acl::checkRight('cd'))
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/forbidden');
- }
-
- $this->bootosuserMapper->delete($bootosuser);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/error');
- }
- $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/ok');
- }
-
-
-
- public function editconfigAction()
- {
- //ACL Darf er Configs editieren?
- if(!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem') && !Pbs_Acl::checkRight('ceo'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
-
- $configID = $this->_request->getParam('configID');
- if (!is_numeric($configID))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $groupID = $this->membership->getGroupID();
-
- $config = new Application_Model_Config();
- $this->configMapper->find($configID, $config);
-
- if($config->getMembershipID() != null){
- if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('ceo'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $config->getGroupID() || (!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem')))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- if (!isset($_POST["editconfig"])){
-
- $configForm = new user_Form_Config(array('action' => 'editconfig','page'=>$this->page, 'type'=>$this->type));
- $configForm->populate($config->toArray());
-
- }else{
- $configForm = new user_Form_Config(array('action' => 'editconfig','page'=>$this->page, 'type'=>$this->type),$_POST);
-
- if ($configForm->isValid($_POST)) {
-
- $configold = $config;
-
- $config = new Application_Model_Config($_POST);
- $config->setCreated(time());
- $config->setBootosID($configold->getBootosID());
-
- if(Pbs_Acl::checkRight('ce') && $configold->getGroupID() != null){
- $config->setGroupID($this->membership->getGroupID());
- }
- elseif(Pbs_Acl::checkRight('ceo') && $configold->getMembershipID() != null){
- $config->setVisible($configold->getVisible());
- $config->setMembershipID($this->membership->getID());
- }
- else
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
-
- $config->setID($configID);
-
- if($configold->getVisible() != $config->getVisible()){
- //ACL Is he allowed to edit other than Metadata?
- if(!Pbs_Acl::checkRight('ce'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden');
- }
-
-
- try {
- $this->configMapper->save($config);
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
- }
-
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
- }
-
- }
-
- $this->view->configForm = $configForm;
- }
-
- public function deleteconfigAction()
- {
- //ACL Darf er Configs löschen?
- if(!Pbs_Acl::checkRight('cd') && !Pbs_Acl::checkRight('cdo'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
- $configID = $this->_request->getParam('configID');
- if (!is_numeric($configID))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
-
- $config = new Application_Model_Config();
- $this->configMapper->find($configID,$config);
-
- if($config->getMembershipID() != null){
- if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('cdo'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
- }else{
- if($this->membership->getGroupID() != $config->getGroupID() || !Pbs_Acl::checkRight('cd'))
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden');
- }
-
- $this->configMapper->delete($config);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_ConfigController extends Zend_Controller_Action {
+
+ protected $configMapper;
+ protected $bootosMapper;
+ protected $bootosuserMapper;
+ protected $bootmenuMapper;
+ protected $bootmenuentriesMapper;
+ protected $membershipMapper;
+ protected $membership;
+ protected $page;
+ protected $config;
+ protected $type;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] == '') {
+ $this->_redirect('/user/index');
+ }
+
+ $this->configMapper = new Application_Model_ConfigMapper();
+ $this->bootosuserMapper = new Application_Model_BootOsUserMapper();
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $this->membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+
+ $this->type = $this->_request->getParam('type');
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
+ public function indexAction() {
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+
+ $groupID = $this->membership->getGroupID();
+
+ //ACL Darf er Configs sehen?
+ if(!Pbs_Acl::checkRight('csai') && !Pbs_Acl::checkRight('csui'))
+ { $this->_redirect('/user/index'); }
+
+ $this->configMapper = new Application_Model_ConfigMapper();
+ $this->bootosMapper = new Application_Model_BootOsMapper();
+ $this->bootmenuMapper = new Application_Model_BootMenuMapper();
+ $this->bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $groupMapper = new Application_Model_GroupMapper();
+ $this->view->bootoslist = array();
+ $this->view->configlist = array();
+
+ if($this->type == 'own' && Pbs_Acl::checkRight('csui')) {
+ $this->view->type = 'own';
+ $bootmenu = $this->bootmenuMapper->findBy(array('membershipID' => $this->membership->getID()));
+ if($bootmenu != null) {
+ $bootmenuID = $bootmenu[0]->getID();
+ $bootmenuentries = $this->bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID));
+ foreach ($bootmenuentries as $bootmenuentry) {
+ $bootos = $this->bootosMapper->find($bootmenuentry->getBootosID());
+ $bootos->setGroupID("[".$bootos->getGroupID()."] ".$groupMapper->find($bootos->getGroupID())->getTitle());
+ $this->view->bootoslist[$bootos->getID()] = $bootos;
+ $this->view->configlist[$bootos->getID()] = $this->configMapper->findBy(array('membershipID' => $this->membership->getID(), 'bootosID' => $bootos->getID()));
+ foreach ($this->view->configlist[$bootos->getID()] as $config) {
+ $config->setCreated(date(Zend_Registry::get('dateformat'), $config->getCreated()));
+ }
+ }
+ }
+ } else {
+ $groupgroupsMapper = new Application_Model_GroupGroupsMapper();
+
+ $parents = array();
+ $groupconfs = array();
+ $ownerconfs = array();
+ $parents = $groupgroupsMapper->getParentGroups($groupID);
+
+ foreach($parents as $k => $parent) {
+ foreach($parent as $p) {
+ $bootos = $this->bootosMapper->findBy(array("groupID" => $p));
+ foreach ($bootos as $b)
+ if($b->getPublic() - $k >= 0 ) {
+ $this->view->bootoslist[] = $b;
+ if(Pbs_Acl::checkRight('cc')) {
+ $ownerconfs = $this->configMapper->findBy(array('groupID' => $b->getGroupID(), 'membershipID' => null, 'bootosID' => $b->getID()));
+ if($groupID != $b->getGroupID())
+ { $groupconfs = $this->configMapper->findBy(array('groupID' => $groupID, 'membershipID' => null, 'bootosID' => $b->getID())); }
+ $this->view->configlist[$b->getID()] = array_merge($ownerconfs, $groupconfs);
+ } else {
+ $ownerconfs = $this->configMapper->findBy(array('groupID' => $b->getGroupID(), 'membershipID' => null, 'bootosID' => $b->getID(), 'visible' => '1'));
+ if($groupID != $b->getGroupID())
+ { $groupconfs = $this->configMapper->findBy(array('groupID' => $groupID, 'membershipID' => null, 'bootosID' => $b->getID(), 'visible' => '1')); }
+ $this->view->configlist[$b->getID()] = array_merge($ownerconfs, $groupconfs);
+
+ }
+ foreach ($this->view->configlist[$b->getID()] as $config) {
+ $config->setCreated(date(Zend_Registry::get('dateformat'), $config->getCreated()));
+ }
+ }
+ elseif($k == 0 && $b->getPublic() == -1 && Pbs_Acl::checkRight('boc')) {
+ $this->view->bootoslist[] = $b;
+ if(Pbs_Acl::checkRight('cc')) {
+ $ownerconfs = $this->configMapper->findBy(array('groupID' => $b->getGroupID(), 'membershipID' => null, 'bootosID' => $b->getID()));
+ if($groupID != $b->getGroupID())
+ { $groupconfs = $this->configMapper->findBy(array('groupID' => $groupID, 'membershipID' => null, 'bootosID' => $b->getID())); }
+ $this->view->configlist[$b->getID()] = array_merge($ownerconfs, $groupconfs);
+ } else {
+ $ownerconfs = $this->configMapper->findBy(array('groupID' => $b->getGroupID(), 'membershipID' => null, 'bootosID' => $b->getID(), 'visible' => '1'));
+ if($groupID != $b->getGroupID())
+ { $groupconfs = $this->configMapper->findBy(array('groupID' => $groupID, 'membershipID' => null, 'bootosID' => $b->getID(), 'visible' => '1')); }
+ $this->view->configlist[$b->getID()] = array_merge($ownerconfs, $groupconfs);
+ }
+ foreach ($this->view->configlist[$b->getID()] as $config) {
+ $config->setCreated(date(Zend_Registry::get('dateformat'), $config->getCreated()));
+ }
+ }
+ }
+ }
+
+ $this->view->bootoslist = array_reverse($this->view->bootoslist);
+
+ if(count($this->view->bootoslist) > 0) {
+ foreach ($this->view->bootoslist as $bootos) {
+ $bootos->setGroupID("[".$bootos->getGroupID()."] ".$groupMapper->find($bootos->getGroupID())->getTitle());
+ }
+ }
+ $this->view->type = 'group';
+ //$this->view->configlist = $this->configMapper->findBy(array('groupID' => $this->membership->getGroupID()));
+ }
+
+ //print_a($this->view->configlist);
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setType($this->type);
+ $mySearch->setModule('config');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->configlist = $mySearch->search($this->view->configlist
+ );
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->view->bootoslist);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/config/index/type/'.$this->type.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ $this->view->bootoslist = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+
+ }
+
+ public function searchAction() {
+ $this->_redirect('/user/config/index/type/'.$this->type.'/search/'.($_GET['search']));
+ }
+
+ public function createconfigAction() {
+ //ACL Darf er Configs erstellen?
+ if(!Pbs_Acl::checkRight('cc') && !Pbs_Acl::checkRight('cco'))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/forbidden'); }
+
+ $bootosID = $this->_request->getParam('bootosID');
+
+ if (!is_numeric($bootosID))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error'); }
+
+ if (!isset($_POST["createconfig"])) {
+ $configForm = new user_Form_Config(array('action' => 'createconfig', 'page' => $this->page, 'type' => $this->type));
+ } else {
+ $configForm = new user_Form_Config(array('action' => 'createconfig', 'page' => $this->page, 'type' => $this->type), $_POST);
+
+ if ($configForm->isValid($_POST)) {
+
+ $config = new Application_Model_Config($_POST);
+ $config->setCreated(time());
+ $config->setBootosID($bootosID);
+
+ if(Pbs_Acl::checkRight('cc') && $this->_request->getParam('type') == 'group') {
+ $config->setGroupID($this->membership->getGroupID());
+ }
+ elseif(Pbs_Acl::checkRight('cco') && $this->_request->getParam('type') == 'own') {
+ $config->setVisible('1');
+ $config->setMembershipID($this->membership->getID());
+ }
+ else
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error'); }
+
+ try {
+ $this->configMapper->save($config);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/error');
+ }
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->configForm = $configForm;
+ }
+
+ public function showconfigAction() {
+
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+
+ $configID = $this->_request->getParam('configID');
+ if (!is_numeric($configID))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error'); }
+
+ $groupID = $this->membership->getGroupID();
+
+ $config = new Application_Model_Config();
+ $this->configMapper->find($configID, $config);
+
+ $hometypeMapper = new Application_Model_HomeTypeMapper();
+
+ $this->view->configID = $configID;
+ $this->view->type = $this->_request->getParam('type');
+ $this->view->config = $this->configMapper->find($configID)->getTitle();
+ $this->view->userlist = $this->bootosuserMapper->findBy(array('configID' => $configID));
+ foreach($this->view->userlist as $user) {
+ $user->setHometypeID("[".$user->getHometypeID()."] ".$hometypeMapper->find($user->getHometypeID())->getName());
+ }
+
+ }
+
+ public function adduserAction() {
+ $configID = $this->_request->getParam('configID');
+ if (!is_numeric($configID))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/addresult/error'); }
+ //ACL Darf er User adden?
+ if(!Pbs_Acl::checkRight('cc') && !Pbs_Acl::checkRight('cco'))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/addresult/forbidden'); }
+
+ $hometypeMapper = new Application_Model_HomeTypeMapper();
+ $hometype = $hometypeMapper->fetchAll();
+
+ if (!isset($_POST["addbootosuser"])) {
+ $bootosuserForm = new user_Form_BootosUser(array('action' => 'addbootosuser', 'type' => $this->type, 'configID' => $configID, 'hometype' => $hometype), $_POST);
+ } else {
+ $bootosuserForm = new user_Form_BootosUser(array('action' => 'addbootosuser', 'type' => $this->type, 'configID' => $configID, 'hometype' => $hometype), $_POST);
+
+ if ($bootosuserForm->isValid($_POST)) {
+
+ $bootosuser = new Application_Model_BootOsUser($_POST);
+ $bootosuser->setConfigID($configID);
+ $bootosuser->setHomepath(str_replace("%login-name%", $bootosuser->getLogin(), $bootosuser->getHomepath()));
+ if($bootosuser->getPassword() != '%password%')
+ { $bootosuser->setPassword(crypt($bootosuser->getPassword(), '$6$'.randomString(8).'$')); }
+
+ try {
+ $this->bootosuserMapper->save($bootosuser);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/addresult/error');
+ }
+ $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/addresult/ok');
+ }
+ }
+
+ $this->view->bootosuserForm = $bootosuserForm;
+ }
+
+
+ public function edituserAction() {
+ //ACL Darf er Configs editieren?
+ if(!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem') && !Pbs_Acl::checkRight('ceo'))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/forbidden'); }
+
+ $configID = $this->_request->getParam('configID');
+ $bootosuserID = $this->_request->getParam('bootosuserID');
+
+ if (!is_numeric($configID) || !is_numeric($bootosuserID))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/error'); }
+
+ $groupID = $this->membership->getGroupID();
+
+ $bootosuser = new Application_Model_BootOsUser();
+ $this->bootosuserMapper->find($bootosuserID, $bootosuser);
+
+ $config = new Application_Model_Config();
+ $this->configMapper->find($configID, $config);
+
+ $hometypeMapper = new Application_Model_HomeTypeMapper();
+ $hometype = $hometypeMapper->fetchAll();
+
+ if($config->getMembershipID() != null) {
+ if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('ceo'))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/forbidden'); }
+ } else {
+ if($this->membership->getGroupID() != $config->getGroupID() || (!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem')))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/forbidden'); }
+ }
+
+ if (!isset($_POST["editbootosuser"])) {
+ if(!isset($_POST['homepath'])) {
+ $_POST['login'] = $bootosuser->getLogin();
+ $_POST['hometypeID'] = $bootosuser->getHometypeID();
+
+ }
+
+ $bootosuserForm = new user_Form_BootosUser(array('action' => 'editbootosuser', 'type' => $this->type, 'configID' => $configID, 'hometype' => $hometype), $_POST);
+
+ if(!isset($_POST['homepath']) && $bootosuser->getHometypeID() == '2')
+ { $bootosuserForm->populate(array('homepath' => $bootosuser->getHomepath())); }
+ } else {
+ $bootosuserForm = new user_Form_BootosUser(array('action' => 'editbootosuser', 'type' => $this->type, 'configID' => $configID, 'hometype' => $hometype), $_POST);
+
+ if ($bootosuserForm->isValid($_POST)) {
+
+ $bootosuserold = $bootosuser;
+
+ $bootosuser = new Application_Model_BootOsUser($_POST);
+
+ if($bootosuserold->getHometypeID() != $bootosuser->getHometypeID() ||
+ $bootosuserold->getHomepath() != $bootosuser->getHomepath()) {
+ //ACL Is he allowed to edit other than Metadata?
+ if(!Pbs_Acl::checkRight('ce'))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/forbidden'); }
+ }
+
+ $bootosuser->setID($bootosuserID);
+ $bootosuser->setConfigID($configID);
+ $bootosuser->setHomepath(str_replace("%login-name%", $bootosuser->getLogin(), $bootosuser->getHomepath()));
+ if($bootosuser->getPassword() != '%password%')
+ { $bootosuser->setPassword(crypt($bootosuser->getPassword(), '$6$'.randomString(8).'$')); }
+
+ try {
+ $this->bootosuserMapper->save($bootosuser);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/error');
+ }
+
+ $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/modifyresult/ok');
+ }
+
+ }
+
+ $this->view->bootosuserForm = $bootosuserForm;
+ }
+
+ public function deleteuserAction() {
+
+ $configID = $this->_request->getParam('configID');
+ $bootosuserID = $this->_request->getParam('bootosuserID');
+ if (!is_numeric($configID) || !is_numeric($bootosuserID))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/error'); }
+ //ACL Darf er User löschen?
+ if(!Pbs_Acl::checkRight('cd') && !Pbs_Acl::checkRight('cdo'))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/forbidden'); }
+
+ try {
+ $bootosuser = new Application_Model_BootOsUser();
+ $this->bootosuserMapper->find($bootosuserID, $bootosuser);
+
+ $config = new Application_Model_Config();
+ $this->configMapper->find($configID, $config);
+
+ if($config->getMembershipID() != null) {
+ if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('cdo'))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/forbidden'); }
+ } else {
+ if($this->membership->getGroupID() != $config->getGroupID() || !Pbs_Acl::checkRight('cd'))
+ { $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/forbidden'); }
+ }
+
+ $this->bootosuserMapper->delete($bootosuser);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/error');
+ }
+ $this->_redirect('/user/config/showconfig/type/'.$this->type.'/configID/'.$configID.'/deleteresult/ok');
+ }
+
+
+
+ public function editconfigAction() {
+ //ACL Darf er Configs editieren?
+ if(!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem') && !Pbs_Acl::checkRight('ceo'))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $configID = $this->_request->getParam('configID');
+ if (!is_numeric($configID))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error'); }
+
+ $groupID = $this->membership->getGroupID();
+
+ $config = new Application_Model_Config();
+ $this->configMapper->find($configID, $config);
+
+ if($config->getMembershipID() != null) {
+ if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('ceo'))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+ } else {
+ if($this->membership->getGroupID() != $config->getGroupID() || (!Pbs_Acl::checkRight('ce') && !Pbs_Acl::checkRight('cem')))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+ }
+
+ if (!isset($_POST["editconfig"])) {
+
+ $configForm = new user_Form_Config(array('action' => 'editconfig', 'page' => $this->page, 'type' => $this->type));
+ $configForm->populate($config->toArray());
+
+ } else {
+ $configForm = new user_Form_Config(array('action' => 'editconfig', 'page' => $this->page, 'type' => $this->type), $_POST);
+
+ if ($configForm->isValid($_POST)) {
+
+ $configold = $config;
+
+ $config = new Application_Model_Config($_POST);
+ $config->setCreated(time());
+ $config->setBootosID($configold->getBootosID());
+
+ if(Pbs_Acl::checkRight('ce') && $configold->getGroupID() != null) {
+ $config->setGroupID($this->membership->getGroupID());
+ }
+ elseif(Pbs_Acl::checkRight('ceo') && $configold->getMembershipID() != null) {
+ $config->setVisible($configold->getVisible());
+ $config->setMembershipID($this->membership->getID());
+ }
+ else
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error'); }
+
+ $config->setID($configID);
+
+ if($configold->getVisible() != $config->getVisible()) {
+ //ACL Is he allowed to edit other than Metadata?
+ if(!Pbs_Acl::checkRight('ce'))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/forbidden'); }
+ }
+
+
+ try {
+ $this->configMapper->save($config);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/error');
+ }
+
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/modifyresult/ok');
+ }
+
+ }
+
+ $this->view->configForm = $configForm;
+ }
+
+ public function deleteconfigAction() {
+ //ACL Darf er Configs löschen?
+ if(!Pbs_Acl::checkRight('cd') && !Pbs_Acl::checkRight('cdo'))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ try {
+ $configID = $this->_request->getParam('configID');
+ if (!is_numeric($configID))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error'); }
+
+ $config = new Application_Model_Config();
+ $this->configMapper->find($configID, $config);
+
+ if($config->getMembershipID() != null) {
+ if($this->membership->getID() != $config->getMembershipID() || !Pbs_Acl::checkRight('cdo'))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+ } else {
+ if($this->membership->getGroupID() != $config->getGroupID() || !Pbs_Acl::checkRight('cd'))
+ { $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/forbidden'); }
+ }
+
+ $this->configMapper->delete($config);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/error');
+ }
+ $this->_redirect('/user/config/index/type/'.$this->type.'/page/'.$this->page.'/deleteresult/ok');
+ }
}
diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php
index 11f5445..13e63eb 100644
--- a/application/modules/user/controllers/FilterController.php
+++ b/application/modules/user/controllers/FilterController.php
@@ -1,512 +1,493 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class User_FilterController extends Zend_Controller_Action
-{
- protected $filterMapper;
- protected $membershipMapper;
- protected $page;
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($userIDsNamespace['membershipID'] ==''){
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('No membershipID set','forbidden');
- }
- $this->filterMapper = new Application_Model_FilterMapper();
-
- $membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
-
- $this->db = Zend_Db_Table::getDefaultAdapter();
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- $this->page = $this->_request->getParam('page');
- }
-
- public function indexAction()
- {
- // ACL: Is he allowed to see the overview
- if(!Pbs_Acl::checkRight('fo'))
- $this->_redirect('/user');
-
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
-
- $filters = $this->filterMapper->findBy(array('groupID' => $this->membership->getGroupID(),'membershipID'=>null),true,array('priority'=>'DESC'));
- $bootmenuMapper = new Application_Model_BootMenuMapper();
- foreach($filters as $filter){
- $ff = new Application_Model_Filter();
- $ff->setOptions($filter);
- $ff->setID($filter['filterID']);
- $ff->setBootmenuID("[".$ff->getBootmenuID()."] ".$bootmenuMapper->find($ff->getBootmenuID())->getTitle());
- $ff->setCreated(date(Zend_Registry::get('dateformat'),$ff->getCreated()));
- $allFilter[] = $ff;
- }
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search)->setModule('filter');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $allFilter = $mySearch->search($allFilter);
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10)
- ->setElement($allFilter)
- ->setRequestPage($this->_request->getParam('page'))
- ->setPageUrl('/user/filter/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $allFilter = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- $this->view->filters = $allFilter;
-
- }
-
- public function searchAction(){
- $this->_redirect('/user/filter/index/search/'.($_GET['search']));
- }
-
- public function addfilterAction()
- {
- // ACL: Is he allowed to add a Filter
- if(!Pbs_Acl::checkRight('fa'))
- $this->_redirect('/user');
-
- $bmmapper = new Application_Model_BootMenuMapper();
-
- $result = $bmmapper->findBy(array('groupID' => $this->membership->getGroupID()),true);
-
- foreach($result as $rr){
- $bm = new Application_Model_BootMenu();
- $bm->setOptions($rr);
- $bm->setID($rr['bootmenuID']);
- $bootmenus[] = $bm;
- }
-
- $this->view->bootmenus = $bootmenus;
-
- if (!isset($_POST["add"])){
- $addfilterform = new user_Form_Filter(array(
- 'buttontext' => 'Create Filter',
- 'bootmenus'=>$bootmenus,
- 'page' => $this->page));
- $this->view->addfilterform = $addfilterform;
- }else {
- $addfilterform = new user_Form_Filter(array(
- 'buttontext' => 'Create Filter',
- 'bootmenus'=>$bootmenus,
- 'page' => $this->page),$_POST);
- if ($addfilterform->isValid($_POST)) {
- try{
- $newfilter = new Application_Model_Filter($_POST);
- $newfilter->setCreated(time())
- ->setGroupID($this->membership->getGroupID())
- ->setMembershipID(null);
- $newfilter2 = new Application_Model_FilterMapper();
- $id = $newfilter2->save($newfilter);
-
- $filterentriesMapper = new Application_Model_FilterEntriesMapper();
- $filterentry = new Application_Model_FilterEntries();
- $filterentry->setFilterID($id)
- ->setFiltertypeID(6)
- ->setFiltervalue($this->membership->getGroupID());
- $filterentriesMapper->save($filterentry);
-
- $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/ok');
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/error');
- }
- }
- $this->view->addfilterform = $addfilterform;
- }
- }
-
- public function removefilterAction()
- {
- $filterID = $this->_request->getParam('filterID');
- $filtermapper = new Application_Model_FilterMapper();
-
- // ACL: Is he allowed to remove the filter
- if(!Pbs_Acl::checkRight('fd'))
- $this->_redirect('/user');
-
- if(is_numeric($filterID)){
- $filter = new Application_Model_Filter();
- $filtermapper->find($filterID,$filter);
- if($filter->getGroupID() == $this->membership->getGroupID()){
- $deletefilter = new Application_Model_Filter();
- $deletefilter->setID($filterID);
- $filtermapper->delete($deletefilter);
- $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/ok');
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/forbidden');
- }
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
- }
- }
-
- public function editfilterAction()
- {
- $bmmapper = new Application_Model_BootMenuMapper();
- $result = $bmmapper->findBy(array('groupID' => $this->membership->getGroupID()),true);
- foreach($result as $rr){
- $bm = new Application_Model_BootMenu();
- $bm->setOptions($rr);
- $bm->setID($rr['bootmenuID']);
- $bootmenus[] = $bm;
- }
-
- // ACL: Is he allowed to edit the filter or the filterpriority?
- if(!Pbs_Acl::checkRight('fe') && !Pbs_Acl::checkRight('fefp'))
- $this->_redirect('/user');
-
- if (!isset($_POST["add"])){
- $filterID = $this->_request->getParam('filterID');
- $filter = new Application_Model_Filter();
-
- $filtermapper = new Application_Model_FilterMapper();
- $filtermapper->find($filterID,$filter);
- if($filter->getGroupID() == $this->membership->getGroupID()){
- $filter2 = $filter->toArray();
- $editfilterform = new user_Form_Filter(array(
- 'buttontext' => 'Edit Filter',
- 'bootmenus'=>$bootmenus,
- 'page' => $this->page));
- $editfilterform->populate($filter2);
- $this->view->editfilterform = $editfilterform;
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
- }
- } else{
- try{
- $filterID = $this->_request->getParam('filterID');
- $filter = new Application_Model_Filter();
- $filtermapper = new Application_Model_FilterMapper();
- $filtermapper->find($filterID,$filter);
- if($filter->getGroupID() == $this->membership->getGroupID()){
- $editfilterform = new user_Form_Filter(array(
- 'buttontext' => 'Edit Filter',
- 'bootmenus'=>$bootmenus,
- 'page' => $this->page),$_POST);
- if ($editfilterform->isValid($_POST)) {
- $filtermapper = new Application_Model_FilterMapper();
-
- $newfilterentry = new Application_Model_Filter($_POST);
- $newfilterentry->setID($this->_request->getParam('filterID'))
- ->setGroupID($this->membership->getGroupID())
- ->setMembershipID(null);
-
- // ACL: if he is only allowed to edit filterpriority
- if(Pbs_Acl::checkRight('fefp') && !Pbs_Acl::checkRight('fe')){
- $DBfilterentry = new Application_Model_Filter();
- $filtermapper->find($this->_request->getParam('filterID'),$DBfilterentry);
-
- $compareresult = $filtermapper->compare($newfilterentry,$DBfilterentry);
- if(isset($compareresult['priority']) && count($compareresult) == 1){
- $filtermapper->save($newfilterentry);
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
- }
- }
- // ACL: he is allowed to edit the filter
- elseif(Pbs_Acl::checkRight('fe')){
- $filtermapper->save($newfilterentry);
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
- }
- }
- $this->view->editfilterform = $editfilterform;
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
- }
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/error');
- }
- }
- }
-
- private function prepareFormData(){
- $poolMapper = new Application_Model_PoolMapper();
- $pools = $poolMapper->findBy(array('groupID'=>$this->membership->getGroupID()),true);
-
- $bootisoMapper = new Application_Model_BootIsoMapper();
- $bootisos = $bootisoMapper->findBy(array('groupID'=>$this->membership->getGroupID()),true);
-
- $membershipMapper = new Application_Model_MembershipMapper();
- $memberships = $membershipMapper->findBy(array('groupID'=>$this->membership->getGroupID()),true);
-
- $grouppMapper = new Application_Model_GroupMapper();
- $group = new Application_Model_Group();
- $grouppMapper->find($this->membership->getGroupID(),$group);
- $groups[] = $group->toArray();
-
- $clientMapper = new Application_Model_ClientMapper();
- $clients = $clientMapper->findBy(array('groupID'=>$this->membership->getGroupID()),true);
-
- return array ( 'clients' => $clients,
- 'memberships' => $memberships,
- 'groups' => $groups,
- 'bootisos' => $bootisos,
- 'pools' => $pools);
-
- }
-
- public function addfilterentryAction()
- {
- // ACL: is he allowed to create a new filterentry?
- if(!Pbs_Acl::checkRight('ffa'))
- $this->_redirect('/user');
-
- $filterID = $this->_request->getParam('filterID');
- $filterMapper = new Application_Model_FilterMapper();
- $filter = new Application_Model_Filter();
- $filterMapper->find($filterID,$filter);
-
- $selectData = $this->prepareFormData();
-
- if($filter->getGroupID() == $this->membership->getGroupID()){
- if (!isset($_POST["add"])){
- try{
- $addform = new user_Form_FilterEntry(array(
- 'buttontext' => 'Add Filterentry',
- 'filterID' => $filterID,
- 'selectData' => $selectData,
- 'data' => $_POST,
- 'page' => $this->page));
- $addform->populate($_POST);
- $this->view->addform = $addform;
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/error');
- }
- } else{
- $addform = new user_Form_FilterEntry(array(
- 'buttontext' => 'Add Filterentry',
- 'selectData' => $selectData,
- 'data' => $_POST,
- 'page' => $this->page));
- if ($addform->isValid($_POST)) {
- # print_a('valid');
- $newfilterenty = new Application_Model_FilterEntries();
- $newfilterenty->setFilterID($filterID)
- ->setFiltertypeID($_POST['filtertypeID']);
-
- if($_POST['filtertypeID'] == 1){
- $newfilterenty->setFiltervalue($this->fillup($_POST['filtervalue'],3,'.'));
- $newfilterenty->setFiltervalue2($this->fillup($_POST['filtervalue2'],3,'.'));
- }
- elseif($_POST['filtertypeID'] == 2){
- $newfilterenty->setFiltervalue($this->fillup($_POST['filtervalue'],2,':'));
- $newfilterenty->setFiltervalue2($this->fillup($_POST['filtervalue2'],2,':'));
- }
- elseif($_POST['filtertypeID'] == 11){
- $newfilterenty->setFiltervalue(strtotime($_POST['filtervalue']));
- $newfilterenty->setFiltervalue2(strtotime($_POST['filtervalue2']));
- }
- else{
- $newfilterenty->setFiltervalue($_POST['filtervalue']);
- if(isset($_POST['filtervalue2'])){
- $newfilterenty->setFiltervalue2($_POST['filtervalue2']);
- }
- }
-
- $newfilter2 = new Application_Model_FilterEntriesMapper();
- $newfilter2->save($newfilterenty);
- $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/ok');
- }
- $this->view->addform = $addform;
- }
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/forbidden');
- }
- }
-
- public function editfilterentryAction()
- {
- //ACL: is he allowed to edit filterentrys ?
- if(!Pbs_Acl::checkRight('ffe'))
- $this->_redirect('/user');
- $selectData = $this->prepareFormData();
- if (!isset($_POST["add"])){
- try{
- $filterentriesID = $this->_request->getParam('filterentriesID');
- $filterentry = new Application_Model_FilterEntries();
- $filterentriesmapper = new Application_Model_FilterEntriesMapper();
- $filterentriesmapper->find($filterentriesID,$filterentry);
-
- $filterMapper = new Application_Model_FilterMapper();
- $filter = new Application_Model_Filter();
- $filterMapper->find($filterentry->getFilterID(),$filter);
-
- if($filter->getGroupID() == $this->membership->getGroupID()){
- if(isset($_POST['filtertypeID']) && $_POST['filtertypeID'] != $filterentry->getFiltertypeID()){
- $filterentry->setFiltertypeID($_POST['filtertypeID']) ;
- }
- if($filterentry->getFiltertypeID() == 11){
- $filterentry->setFiltervalue(date('d.m.Y',$filterentry->getFiltervalue()));
- $filterentry->setFiltervalue2(date('d.m.Y',$filterentry->getFiltervalue2()));
- }
- $data = $filterentry->toArray();
- $editfilterform = new user_Form_FilterEntry(array(
- 'buttontext' => 'Edit Filterentry',
- 'selectData' => $selectData,
- 'data' => $data,
- 'page' => $this->page));
-
- $editfilterform->populate($filterentry->toArray());
- $this->view->editfilterform = $editfilterform;
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
- }
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/error');
- }
- } else{
- try{
- $filterentriesID = $this->_request->getParam('filterentriesID');
- $editfilterform = new user_Form_FilterEntry(array(
- 'buttontext' => 'Edit Filterentry',
- 'selectData' => $selectData,
- 'data' => $_POST,
- 'page' => $this->page));
- if ($editfilterform->isValid($_POST)) {
- $filterentry = new Application_Model_FilterEntries();
- $filterentriesmapper = new Application_Model_FilterEntriesMapper();
- $filterentriesmapper->find($filterentriesID,$filterentry);
-
- $filterMapper = new Application_Model_FilterMapper();
- $filter = new Application_Model_Filter();
- $filterMapper->find($filterentry->getFilterID(),$filter);
-
- if($filter->getGroupID() == $this->membership->getGroupID()){
- if($_POST['filterID'] == '')
- unset($_POST['filterID']);
-
- $newfilterenty = new Application_Model_FilterEntries($_POST);
- $newfilterenty->setID($filterentriesID);
- if($_POST['filtertypeID'] == 1){
- $newfilterenty->setFiltervalue($this->fillup($_POST['filtervalue'],3,'.'));
- $newfilterenty->setFiltervalue2($this->fillup($_POST['filtervalue2'],3,'.'));
- }
- elseif($_POST['filtertypeID'] == 2){
- $newfilterenty->setFiltervalue($this->fillup($_POST['filtervalue'],2,';'));
- $newfilterenty->setFiltervalue2($this->fillup($_POST['filtervalue2'],2,':'));
- }
- elseif($_POST['filtertypeID'] == 11){
- $newfilterenty->setFiltervalue(strtotime($_POST['filtervalue']));
- $newfilterenty->setFiltervalue2(strtotime($_POST['filtervalue2']));
- }
- else{
- $newfilterenty->setFiltervalue($_POST['filtervalue']);
- $newfilterenty->setFiltervalue2($_POST['filtervalue2']);
- }
-
- $newfilter2 = new Application_Model_FilterEntriesMapper();
- $newfilter2->save($newfilterenty);
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
-
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
- }
- }
- $this->view->editfilterform = $editfilterform;
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/error');
- }
- }
- }
-
- public function removefilterentryAction()
- {
- //ACL: is he autohorized to delete a filterentry?
- if(!Pbs_Acl::checkRight('ffd'))
- $this->_redirect('/user');
-
- $filterentriesID = $this->_request->getParam('filterentriesID');
- if(is_numeric($filterentriesID)){
- $filterentriesmapper = new Application_Model_FilterEntriesMapper();
- $filterentry = new Application_Model_FilterEntries();
- $filterentriesmapper->find($filterentriesID, $filterentry);
- $filterID = $filterentry->getFilterID();
-
- $filterMapper = new Application_Model_FilterMapper();
- $filter = new Application_Model_Filter();
- $filterMapper->find($filterID,$filter);
-
- if($filter->getGroupID() == $this->membership->getGroupID()){
- try{
- $deletefilterentry = new Application_Model_FilterEntries();
- $deletefilterentry->setID($filterentriesID);
-
- $filterentriesmapper = new Application_Model_FilterEntriesMapper();
- $filterentriesmapper->delete($deletefilterentry);
- $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/ok');
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
- }
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/forbidden');
- }
- }
- else{
- $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
- }
- }
- private function fillup($string, $length, $seperator=':',$sign='0'){
- $ar = explode($seperator,$string);
- $representation = array();
- foreach($ar as $part){
- $representation[] = sprintf("%".$sign.$length."s",$part);
- }
- return implode($seperator,$representation);
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class User_FilterController extends Zend_Controller_Action {
+ protected $filterMapper;
+ protected $membershipMapper;
+ protected $page;
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] == '') {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('No membershipID set', 'forbidden');
+ }
+ $this->filterMapper = new Application_Model_FilterMapper();
+
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
+ public function indexAction() {
+ // ACL: Is he allowed to see the overview
+ if(!Pbs_Acl::checkRight('fo'))
+ { $this->_redirect('/user'); }
+
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+
+ $filters = $this->filterMapper->findBy(array('groupID' => $this->membership->getGroupID(), 'membershipID' => null), true, array('priority' => 'DESC'));
+ $bootmenuMapper = new Application_Model_BootMenuMapper();
+ foreach($filters as $filter) {
+ $ff = new Application_Model_Filter();
+ $ff->setOptions($filter);
+ $ff->setID($filter['filterID']);
+ $ff->setBootmenuID("[".$ff->getBootmenuID()."] ".$bootmenuMapper->find($ff->getBootmenuID())->getTitle());
+ $ff->setCreated(date(Zend_Registry::get('dateformat'), $ff->getCreated()));
+ $allFilter[] = $ff;
+ }
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search)->setModule('filter');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $allFilter = $mySearch->search($allFilter);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10)
+ ->setElement($allFilter)
+ ->setRequestPage($this->_request->getParam('page'))
+ ->setPageUrl('/user/filter/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ $allFilter = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->filters = $allFilter;
+
+ }
+
+ public function searchAction() {
+ $this->_redirect('/user/filter/index/search/'.($_GET['search']));
+ }
+
+ public function addfilterAction() {
+ // ACL: Is he allowed to add a Filter
+ if(!Pbs_Acl::checkRight('fa'))
+ { $this->_redirect('/user'); }
+
+ $bmmapper = new Application_Model_BootMenuMapper();
+
+ $result = $bmmapper->findBy(array('groupID' => $this->membership->getGroupID()), true);
+
+ foreach($result as $rr) {
+ $bm = new Application_Model_BootMenu();
+ $bm->setOptions($rr);
+ $bm->setID($rr['bootmenuID']);
+ $bootmenus[] = $bm;
+ }
+
+ $this->view->bootmenus = $bootmenus;
+
+ if (!isset($_POST["add"])) {
+ $addfilterform = new user_Form_Filter(array(
+ 'buttontext' => 'Create Filter',
+ 'bootmenus' => $bootmenus,
+ 'page' => $this->page));
+ $this->view->addfilterform = $addfilterform;
+ } else {
+ $addfilterform = new user_Form_Filter(array(
+ 'buttontext' => 'Create Filter',
+ 'bootmenus' => $bootmenus,
+ 'page' => $this->page), $_POST);
+ if ($addfilterform->isValid($_POST)) {
+ try {
+ $newfilter = new Application_Model_Filter($_POST);
+ $newfilter->setCreated(time())
+ ->setGroupID($this->membership->getGroupID())
+ ->setMembershipID(null);
+ $newfilter2 = new Application_Model_FilterMapper();
+ $id = $newfilter2->save($newfilter);
+
+ $filterentriesMapper = new Application_Model_FilterEntriesMapper();
+ $filterentry = new Application_Model_FilterEntries();
+ $filterentry->setFilterID($id)
+ ->setFiltertypeID(6)
+ ->setFiltervalue($this->membership->getGroupID());
+ $filterentriesMapper->save($filterentry);
+
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/ok');
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/error');
+ }
+ }
+ $this->view->addfilterform = $addfilterform;
+ }
+ }
+
+ public function removefilterAction() {
+ $filterID = $this->_request->getParam('filterID');
+ $filtermapper = new Application_Model_FilterMapper();
+
+ // ACL: Is he allowed to remove the filter
+ if(!Pbs_Acl::checkRight('fd'))
+ { $this->_redirect('/user'); }
+
+ if(is_numeric($filterID)) {
+ $filter = new Application_Model_Filter();
+ $filtermapper->find($filterID, $filter);
+ if($filter->getGroupID() == $this->membership->getGroupID()) {
+ $deletefilter = new Application_Model_Filter();
+ $deletefilter->setID($filterID);
+ $filtermapper->delete($deletefilter);
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/ok');
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/forbidden');
+ }
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
+ }
+ }
+
+ public function editfilterAction() {
+ $bmmapper = new Application_Model_BootMenuMapper();
+ $result = $bmmapper->findBy(array('groupID' => $this->membership->getGroupID()), true);
+ foreach($result as $rr) {
+ $bm = new Application_Model_BootMenu();
+ $bm->setOptions($rr);
+ $bm->setID($rr['bootmenuID']);
+ $bootmenus[] = $bm;
+ }
+
+ // ACL: Is he allowed to edit the filter or the filterpriority?
+ if(!Pbs_Acl::checkRight('fe') && !Pbs_Acl::checkRight('fefp'))
+ { $this->_redirect('/user'); }
+
+ if (!isset($_POST["add"])) {
+ $filterID = $this->_request->getParam('filterID');
+ $filter = new Application_Model_Filter();
+
+ $filtermapper = new Application_Model_FilterMapper();
+ $filtermapper->find($filterID, $filter);
+ if($filter->getGroupID() == $this->membership->getGroupID()) {
+ $filter2 = $filter->toArray();
+ $editfilterform = new user_Form_Filter(array(
+ 'buttontext' => 'Edit Filter',
+ 'bootmenus' => $bootmenus,
+ 'page' => $this->page));
+ $editfilterform->populate($filter2);
+ $this->view->editfilterform = $editfilterform;
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
+ }
+ } else {
+ try {
+ $filterID = $this->_request->getParam('filterID');
+ $filter = new Application_Model_Filter();
+ $filtermapper = new Application_Model_FilterMapper();
+ $filtermapper->find($filterID, $filter);
+ if($filter->getGroupID() == $this->membership->getGroupID()) {
+ $editfilterform = new user_Form_Filter(array(
+ 'buttontext' => 'Edit Filter',
+ 'bootmenus' => $bootmenus,
+ 'page' => $this->page), $_POST);
+ if ($editfilterform->isValid($_POST)) {
+ $filtermapper = new Application_Model_FilterMapper();
+
+ $newfilterentry = new Application_Model_Filter($_POST);
+ $newfilterentry->setID($this->_request->getParam('filterID'))
+ ->setGroupID($this->membership->getGroupID())
+ ->setMembershipID(null);
+
+ // ACL: if he is only allowed to edit filterpriority
+ if(Pbs_Acl::checkRight('fefp') && !Pbs_Acl::checkRight('fe')) {
+ $DBfilterentry = new Application_Model_Filter();
+ $filtermapper->find($this->_request->getParam('filterID'), $DBfilterentry);
+
+ $compareresult = $filtermapper->compare($newfilterentry, $DBfilterentry);
+ if(isset($compareresult['priority']) && count($compareresult) == 1) {
+ $filtermapper->save($newfilterentry);
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
+ }
+ }
+ // ACL: he is allowed to edit the filter
+ elseif(Pbs_Acl::checkRight('fe')) {
+ $filtermapper->save($newfilterentry);
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
+ }
+ }
+ $this->view->editfilterform = $editfilterform;
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
+ }
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/error');
+ }
+ }
+ }
+
+ private function prepareFormData() {
+ $poolMapper = new Application_Model_PoolMapper();
+ $pools = $poolMapper->findBy(array('groupID' => $this->membership->getGroupID()), true);
+
+ $bootisoMapper = new Application_Model_BootIsoMapper();
+ $bootisos = $bootisoMapper->findBy(array('groupID' => $this->membership->getGroupID()), true);
+
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $memberships = $membershipMapper->findBy(array('groupID' => $this->membership->getGroupID()), true);
+
+ $grouppMapper = new Application_Model_GroupMapper();
+ $group = new Application_Model_Group();
+ $grouppMapper->find($this->membership->getGroupID(), $group);
+ $groups[] = $group->toArray();
+
+ $clientMapper = new Application_Model_ClientMapper();
+ $clients = $clientMapper->findBy(array('groupID' => $this->membership->getGroupID()), true);
+
+ return array ( 'clients' => $clients,
+ 'memberships' => $memberships,
+ 'groups' => $groups,
+ 'bootisos' => $bootisos,
+ 'pools' => $pools);
+
+ }
+
+ public function addfilterentryAction() {
+ // ACL: is he allowed to create a new filterentry?
+ if(!Pbs_Acl::checkRight('ffa'))
+ { $this->_redirect('/user'); }
+
+ $filterID = $this->_request->getParam('filterID');
+ $filterMapper = new Application_Model_FilterMapper();
+ $filter = new Application_Model_Filter();
+ $filterMapper->find($filterID, $filter);
+
+ $selectData = $this->prepareFormData();
+
+ if($filter->getGroupID() == $this->membership->getGroupID()) {
+ if (!isset($_POST["add"])) {
+ try {
+ $addform = new user_Form_FilterEntry(array(
+ 'buttontext' => 'Add Filterentry',
+ 'filterID' => $filterID,
+ 'selectData' => $selectData,
+ 'data' => $_POST,
+ 'page' => $this->page));
+ $addform->populate($_POST);
+ $this->view->addform = $addform;
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/error');
+ }
+ } else {
+ $addform = new user_Form_FilterEntry(array(
+ 'buttontext' => 'Add Filterentry',
+ 'selectData' => $selectData,
+ 'data' => $_POST,
+ 'page' => $this->page));
+ if ($addform->isValid($_POST)) {
+# print_a('valid');
+ $newfilterenty = new Application_Model_FilterEntries();
+ $newfilterenty->setFilterID($filterID)
+ ->setFiltertypeID($_POST['filtertypeID']);
+
+ if($_POST['filtertypeID'] == 1) {
+ $newfilterenty->setFiltervalue($this->fillup($_POST['filtervalue'], 3, '.'));
+ $newfilterenty->setFiltervalue2($this->fillup($_POST['filtervalue2'], 3, '.'));
+ }
+ elseif($_POST['filtertypeID'] == 2) {
+ $newfilterenty->setFiltervalue($this->fillup($_POST['filtervalue'], 2, ':'));
+ $newfilterenty->setFiltervalue2($this->fillup($_POST['filtervalue2'], 2, ':'));
+ }
+ elseif($_POST['filtertypeID'] == 11) {
+ $newfilterenty->setFiltervalue(strtotime($_POST['filtervalue']));
+ $newfilterenty->setFiltervalue2(strtotime($_POST['filtervalue2']));
+ }
+ else {
+ $newfilterenty->setFiltervalue($_POST['filtervalue']);
+ if(isset($_POST['filtervalue2'])) {
+ $newfilterenty->setFiltervalue2($_POST['filtervalue2']);
+ }
+ }
+
+ $newfilter2 = new Application_Model_FilterEntriesMapper();
+ $newfilter2->save($newfilterenty);
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/ok');
+ }
+ $this->view->addform = $addform;
+ }
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/addresult/forbidden');
+ }
+ }
+
+ public function editfilterentryAction() {
+ //ACL: is he allowed to edit filterentrys ?
+ if(!Pbs_Acl::checkRight('ffe'))
+ { $this->_redirect('/user'); }
+ $selectData = $this->prepareFormData();
+ if (!isset($_POST["add"])) {
+ try {
+ $filterentriesID = $this->_request->getParam('filterentriesID');
+ $filterentry = new Application_Model_FilterEntries();
+ $filterentriesmapper = new Application_Model_FilterEntriesMapper();
+ $filterentriesmapper->find($filterentriesID, $filterentry);
+
+ $filterMapper = new Application_Model_FilterMapper();
+ $filter = new Application_Model_Filter();
+ $filterMapper->find($filterentry->getFilterID(), $filter);
+
+ if($filter->getGroupID() == $this->membership->getGroupID()) {
+ if(isset($_POST['filtertypeID']) && $_POST['filtertypeID'] != $filterentry->getFiltertypeID()) {
+ $filterentry->setFiltertypeID($_POST['filtertypeID']) ;
+ }
+ if($filterentry->getFiltertypeID() == 11) {
+ $filterentry->setFiltervalue(date('d.m.Y', $filterentry->getFiltervalue()));
+ $filterentry->setFiltervalue2(date('d.m.Y', $filterentry->getFiltervalue2()));
+ }
+ $data = $filterentry->toArray();
+ $editfilterform = new user_Form_FilterEntry(array(
+ 'buttontext' => 'Edit Filterentry',
+ 'selectData' => $selectData,
+ 'data' => $data,
+ 'page' => $this->page));
+
+ $editfilterform->populate($filterentry->toArray());
+ $this->view->editfilterform = $editfilterform;
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
+ }
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/error');
+ }
+ } else {
+ try {
+ $filterentriesID = $this->_request->getParam('filterentriesID');
+ $editfilterform = new user_Form_FilterEntry(array(
+ 'buttontext' => 'Edit Filterentry',
+ 'selectData' => $selectData,
+ 'data' => $_POST,
+ 'page' => $this->page));
+ if ($editfilterform->isValid($_POST)) {
+ $filterentry = new Application_Model_FilterEntries();
+ $filterentriesmapper = new Application_Model_FilterEntriesMapper();
+ $filterentriesmapper->find($filterentriesID, $filterentry);
+
+ $filterMapper = new Application_Model_FilterMapper();
+ $filter = new Application_Model_Filter();
+ $filterMapper->find($filterentry->getFilterID(), $filter);
+
+ if($filter->getGroupID() == $this->membership->getGroupID()) {
+ if($_POST['filterID'] == '')
+ { unset($_POST['filterID']); }
+
+ $newfilterenty = new Application_Model_FilterEntries($_POST);
+ $newfilterenty->setID($filterentriesID);
+ if($_POST['filtertypeID'] == 1) {
+ $newfilterenty->setFiltervalue($this->fillup($_POST['filtervalue'], 3, '.'));
+ $newfilterenty->setFiltervalue2($this->fillup($_POST['filtervalue2'], 3, '.'));
+ }
+ elseif($_POST['filtertypeID'] == 2) {
+ $newfilterenty->setFiltervalue($this->fillup($_POST['filtervalue'], 2, ';'));
+ $newfilterenty->setFiltervalue2($this->fillup($_POST['filtervalue2'], 2, ':'));
+ }
+ elseif($_POST['filtertypeID'] == 11) {
+ $newfilterenty->setFiltervalue(strtotime($_POST['filtervalue']));
+ $newfilterenty->setFiltervalue2(strtotime($_POST['filtervalue2']));
+ }
+ else {
+ $newfilterenty->setFiltervalue($_POST['filtervalue']);
+ $newfilterenty->setFiltervalue2($_POST['filtervalue2']);
+ }
+
+ $newfilter2 = new Application_Model_FilterEntriesMapper();
+ $newfilter2->save($newfilterenty);
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/ok');
+
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/forbidden');
+ }
+ }
+ $this->view->editfilterform = $editfilterform;
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/modifyresult/error');
+ }
+ }
+ }
+
+ public function removefilterentryAction() {
+ //ACL: is he autohorized to delete a filterentry?
+ if(!Pbs_Acl::checkRight('ffd'))
+ { $this->_redirect('/user'); }
+
+ $filterentriesID = $this->_request->getParam('filterentriesID');
+ if(is_numeric($filterentriesID)) {
+ $filterentriesmapper = new Application_Model_FilterEntriesMapper();
+ $filterentry = new Application_Model_FilterEntries();
+ $filterentriesmapper->find($filterentriesID, $filterentry);
+ $filterID = $filterentry->getFilterID();
+
+ $filterMapper = new Application_Model_FilterMapper();
+ $filter = new Application_Model_Filter();
+ $filterMapper->find($filterID, $filter);
+
+ if($filter->getGroupID() == $this->membership->getGroupID()) {
+ try {
+ $deletefilterentry = new Application_Model_FilterEntries();
+ $deletefilterentry->setID($filterentriesID);
+
+ $filterentriesmapper = new Application_Model_FilterEntriesMapper();
+ $filterentriesmapper->delete($deletefilterentry);
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/ok');
+
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
+ }
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/forbidden');
+ }
+ } else {
+ $this->_redirect('/user/filter/index/page/'.$this->page.'/deleteresult/error');
+ }
+ }
+ private function fillup($string, $length, $seperator = ':', $sign = '0') {
+ $ar = explode($seperator, $string);
+ $representation = array();
+ foreach($ar as $part) {
+ $representation[] = sprintf("%".$sign.$length."s", $part);
+ }
+ return implode($seperator, $representation);
+ }
}
diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php
index 66fe02b..60b4c4d 100644
--- a/application/modules/user/controllers/GroupController.php
+++ b/application/modules/user/controllers/GroupController.php
@@ -1,559 +1,533 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class User_GroupController extends Zend_Controller_Action
-{
- protected $groupMapper = null;
- protected $groupGroupsMapper = null;
- protected $membershipMapper = null;
- protected $groupRequestMapper = null;
- protected $personmapper = null;
- protected $rolemapper = null;
- protected $groupList = null;
- protected $userIDsNamespace = null;
- protected $membership;
- protected $page;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- $this->groupMapper = new Application_Model_GroupMapper();
- $this->groupGroupsMapper = new Application_Model_GroupGroupsMapper();
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->groupRequestMapper = new Application_Model_GroupRequestMapper();
- $this->personmapper = new Application_Model_PersonMapper();
- $this->rolemapper = new Application_Model_RoleMapper();
- $this->groupList = $this->groupMapper->fetchAll();
-
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- $this->membership = new Application_Model_Membership();
- $this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
-
- $this->page = $this->_request->getParam('page');
- } else {
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
-
- public function indexAction()
- {
- // ACL show overview
- if(!Pbs_Acl::checkRight('gso'))
- $this->_redirect('/user');
-
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
-
- $this->view->groupList = $this->groupList;
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('group');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->groupList = $mySearch->search($this->view->groupList);
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->view->groupList);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/group/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
-
- $this->view->groupList = $pagination->getElements();
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- $this->view->userIDsNamespace = $this->userIDsNamespace;
- }
-
- public function searchAction(){
- $this->_redirect('/user/group/index/search/'.($_GET['search']));
- }
-
- public function addAction()
- {
- // ACL create new group
- if(!Pbs_Acl::checkRight('gc'))
- $this->_redirect('/user');
-
- if (!isset($_POST["add"])){
- $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList));
- } else {
- $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList),$_POST);
-
- if ($addForm->isValid($_POST)) {
- $group = new Application_Model_Group($_POST);
-
- $db = $this->groupMapper->findBy(array('title'=>$group->getTitle()));
- if(count($db)>=1){
- $this->_redirect('/user/group/index/page/'.$this->page.'/addresult/error');
- }
-
- try {
- $this->groupMapper->save($group);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $groupID = $this->groupMapper->getDbTable()->getDefaultAdapter()->lastInsertId();
- $membership = $this->membershipMapper->find($this->userIDsNamespace['membershipID']);
- // setting the actually used role in the new group
- $roleID = $this->membership->getRoleID();
- $membership->setID();
- $membership->setGroupID($groupID);
- $membership->setRoleID($roleID);
-
- try {
- $this->membershipMapper->save($membership);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- foreach($rightroleslist as $rightroles) {
- $rightroles->setRoleID($roleID);
- try {
- $rightrolesMapper->save($rightroles);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- }
- if($_POST['superordinatedGroupID'] != -1) {
- $groupgroups = new Application_Model_GroupGroups();
- #print_a($this->membership->getGroupID(),$this->membership);
- $groupgroups->setParentID($this->membership->getGroupID());
- $groupgroups->setGroupID($groupID);
- try {
- $this->groupGroupsMapper->save($groupgroups);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
-
- }
- $this->_redirect('/user/group/index/page/'.$this->page.'/addresult/ok');
- return;
- }
- }
-
- $this->view->addForm = $addForm;
- }
-
- public function editAction()
- {
- // ACL edit a group
- if(!Pbs_Acl::checkRight('geo') && !Pbs_Acl::checkRight('ge'))
- $this->_redirect('/user');
-
- $groupID = $this->_request->getParam('groupID');
- if(!isset($groupID)) {
- if(count($this->userIDsNamespace) > 0) {
- $groupID = $this->userIDsNamespace['groupID'];
- }
- }
- if(!isset($groupID)) {
- $this->_helper->redirector('add', 'group');
- return;
- }
- if((!Pbs_Acl::checkRight('geo') && $groupID == $this->membership->getGroupID()) || ( !Pbs_Acl::checkRight('ge') && $groupID != $this->membership->getGroupID() ))
- $this->_redirect('/user/group/index/page/'.$this->page.'/modifyresult/forbidden');
- if (!isset($_POST["save"])){
- $group = $this->groupMapper->find($groupID);
- $_POST['title'] = $group->getTitle();
- $_POST['description'] = $group->getDescription();
- $editForm = new user_Form_GroupEdit(array('groupID' => $groupID));
- } else {
- $editForm = new user_Form_GroupEdit(array('groupID' => $groupID), $_POST);
- if ($editForm->isValid($_POST)) {
- $group = new Application_Model_Group($_POST);
- $group->setID($groupID);
- try {
- $this->groupMapper->save($group);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect('/user/group/index/page/'.$this->page.'/modifyresult/ok');
- return;
- }
- }
- $this->view->editForm = $editForm;
- }
-
- public function showAction()
- {
- // ACL create new group
- if(!Pbs_Acl::checkRight('gsdo') && !Pbs_Acl::checkRight('gsdog'))
- $this->_redirect('/user');
-
- $groupID = $this->_request->getParam('groupID');
- if($groupID == '' || !Pbs_Acl::checkRight('gsdog')) {
- if(count($this->userIDsNamespace) > 0) {
- $groupID = $this->userIDsNamespace['groupID'];
- }
- }
- if($groupID == $this->membership->getGroupID() && !Pbs_Acl::checkRight('gsdo'))
- $this->_redirect('/user');
-
- $this->view->usergroup = $this->membership->getGroupID();
- $this->view->requestgroup = $groupID;
- $groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID),true);
- if(isset($groupRequests)) {
- $groupRequestList = array();
- foreach($groupRequests as $groupRequest) {
- $person = $this->personmapper->find($groupRequest['personID']);
- $groupRequestList[] = array(
- 'grouprequestID' => $groupRequest['grouprequestID'],
- 'person' => $person
- );
- }
- if(count($groupRequestList) > 0) {
- $this->view->groupRequestList = $groupRequestList;
- }
- // Search all inherit Roles
- $roles = array();
- $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
- $parents = $groupGroupsMapper->getParentGroups($groupID);
- $groupMapper = new Application_Model_GroupMapper();
- $crawled = array();
- foreach($parents as $p){
- foreach($p as $a){
- if(!in_array($a,$crawled)){
- $crawled[] = $a;
- $group = $groupMapper->find($a);
- if($groupID != $a)
- $r = $this->rolemapper->findBy(array('groupID' => $a,'inheritance'=>"1"));
- else
- $r = $this->rolemapper->findBy(array('groupID' => $a));
- foreach($r as $d){
- $roles[$group->getTitle()][] = $d;
- }
- }
- }
- }
- $this->view->roleList = $roles;
- }
-
- if(Pbs_Acl::checkRight('gsmg') || Pbs_Acl::checkRight('gsmgo')){
- $members = $this->membershipMapper->findBy(array('groupID' => $groupID),true);
- if(isset($members)) {
- foreach($members as $member) {
- $person = $this->personmapper->find($member['personID']);
- $membership_tmp = $this->membershipMapper->find($member['membershipID']);
- $role = $this->rolemapper->find($membership_tmp->getRoleID());
- $membersList[] = array(
- 'membershipID' => $member['membershipID'],
- 'suspend' => $member['suspend'],
- 'person' => $person,
- 'role' => $role
- );
- }
- if(is_array($membersList)) {
- // Member Pagination
- $memberPagination = new Pbs_Pagination();
- $memberPagination->setPerPage(10)
- ->setElement($membersList)
- ->setRequestPage($this->_request->getParam('page'));
- if($this->_request->getParam('groupID')) {
- $memberPagination->setPageUrl('/user/group/show/groupID/' . $groupID . ((isset($this->view->search))?'/search/'.$this->view->search:''));
- } else {
- $memberPagination->setPageUrl('/user/group/show'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- }
- $this->view->membersList = $memberPagination->getElements();
- $this->view->memberPagination = $memberPagination->pagination();
- $this->view->page = $memberPagination->getRequestPage();
- }
- }
- }
- $groupgroups = $this->groupGroupsMapper->findBy(array('groupID' => $groupID),true);
- if(is_object($groupgroups)) {
- $parentGroup = $this->groupMapper->find($groupgroups->getParentID());
- $this->view->$parentGroup = $parentGroup;
- }
- $group = $this->groupMapper->find($groupID);
- $this->view->userIDsNamespace = $this->userIDsNamespace;
- $this->view->group = $group;
- $this->view->groupID = $groupID;
- }
-
- public function linkAction()
- {
- if(!Pbs_Acl::checkRight('glk'))
- $this->_redirect('/user');
-
- $linkableGroups = $this->groupList;
- $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
- $childs = array();
- $parents = array();
- $childs = $groupGroupsMapper->getChildGroups($this->membership->getGroupID());
- $parents = $groupGroupsMapper->getParentGroups($this->membership->getGroupID());
- #print_a($childs,$parents);
- foreach($linkableGroups as $i => $group){
- #print_a($group->getID());
- if(isset($childs[1]) && in_array($group->getID(),$childs[1])){
- unset($linkableGroups[$i]);
- }
- if(count($parents) > 0){
- foreach($parents as $d){
- if(in_array($group->getID(),$d)){
- unset($linkableGroups[$i]);
- }
- }
- }
- }
- #print_a($linkableGroups);
- if (!isset($_POST["link"])){
- $linkForm = new user_Form_GroupLink(array('grouplist' => $linkableGroups));
- } else {
- $linkForm = new user_Form_GroupLink(array('grouplist' => $linkableGroups),$_POST);
-
- if ($linkForm->isValid($_POST)) {
- $groupgroups = new Application_Model_GroupGroups();
- if($_POST['superordinatedGroupID'] == $_POST['groupID'] || $_POST['groupID'] == 1) {
- $this->_redirect('/user/group/index/page/'.$this->page.'/addresult/forbidden');
- }
- $groupgroups->setParentID($this->membership->getGroupID());
- $groupgroups->setGroupID($_POST['groupID']);
- try {
- $this->groupGroupsMapper->save($groupgroups);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'group');
- return;
- }
- }
-
- $this->view->linkForm = $linkForm;
- }
-
- public function deleteAction()
- {
- // ACL delete a group
- if(!Pbs_Acl::checkRight('gd'))
- $this->_redirect('/user');
-
- $this->_helper->viewRenderer->setNoRender();
- $groupID = $this->_request->getParam('groupID');
- if(!isset($groupID)) {
- if(count($this->userIDsNamespace) > 0) {
- $groupID = $this->userIDsNamespace['groupID'];
- }
- }
- if (isset($groupID)){
- $group = $this->groupMapper->find($groupID);
- try {
- $this->groupMapper->delete($group);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- if($_SERVER['HTTP_REFERER']) {
- if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show') !== false && strpos($_SERVER['HTTP_REFERER'], '/groupID/') === false) {
- $this->_helper->redirector('changemembership', 'person');
- } else {
- $this->_redirect('/user/group/index/page/'.$this->page.'/deleteresult/ok');
- }
- } else {
- $this->_helper->redirector('', 'group');
- }
- return;
- } else {
- $this->_redirect('/user/');
- return;
- }
- }
-
- public function grantpersonAction()
- {
- // ACL grant a membership to request
- if(!Pbs_Acl::checkRight('gam'))
- $this->_redirect('/user');
-
- $this->_helper->viewRenderer->setNoRender();
- if(isset($_POST['grouprequestID']) && isset($_POST['roleID'])) {
- $groupRequest = $this->groupRequestMapper->find($_POST['grouprequestID']);
- try {
- $this->groupRequestMapper->delete($groupRequest);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $membership = new Application_Model_Membership();
- $membership->setGroupID($groupRequest->getGroupID())
- ->setPersonID($groupRequest->getPersonID())
- ->setRoleID($_POST['roleID'])
- ->setSuspend(0);
- $apikey = randomString(32);
- $membership->setApikey($apikey);
-
-
- try {
- $id = $this->membershipMapper->save($membership);
- $membership->setID($id);
- $newMember = new Pbs_NewMember();
- $newMember->createDefaults($membership);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect("/user/group/show/groupID/" . $groupRequest->getGroupID());
- }
- }
-
- public function revokepersonAction()
- {
-
- $this->_helper->viewRenderer->setNoRender();
- $membershipID = $this->_request->getParam('membershipID');
- $rr = $this->membershipMapper->find($membershipID);
-
- if(($rr->getGroupID() == $this->membership->getGroupID() && Pbs_Acl::checkRight('gdmo') ) || ( $rr->getGroupID() != $this->membership->getGroupID() && Pbs_Acl::checkRight('gdmog'))){
- if(isset($membershipID)) {
- $membership = $this->membershipMapper->find($membershipID);
- if(isset($membership)) {
- try {
- $this->membershipMapper->delete($membership);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect("/user/group/show/groupID/" . $membership->getGroupID());
- }
- }
- }
- }
-
- public function declineAction()
- {
- if(!Pbs_Acl::checkRight('gdm')) {
- $this->_redirect('/user');
- }
- $this->_helper->viewRenderer->setNoRender();
- $grouprequestID = $this->_request->getParam('grouprequestID');
- if(isset($grouprequestID)) {
- $groupRequest = $this->groupRequestMapper->find($grouprequestID);
- if($groupRequest->getGroupID() != $this->userIDsNamespace['groupID']) {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Not allowed to decline this grouprequest', 'forbidden');
- return;
- }
- try {
- $this->groupRequestMapper->delete($groupRequest);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect("/user/group/show/groupID");
- }
- }
-
- public function suspendmembershipAction()
- {
- if(!Pbs_Acl::checkRight('gsm')) {
- $this->_redirect('/user');
- }
- $this->_helper->viewRenderer->setNoRender();
- $membershipID = $this->_request->getParam('membershipID');
- if(isset($membershipID)) {
- $membership = $this->membershipMapper->find($membershipID);
- $membership->setSuspend(1);
- if(isset($membership)) {
- if($membership->getGroupID() != $this->userIDsNamespace['groupID']) {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Not allowed to suspend this membership', 'forbidden');
- return;
- }
- try {
- $this->membershipMapper->save($membership);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect("/user/group/show/");
- }
- }
- }
-
- public function resumemembershipAction()
- {
- if(!Pbs_Acl::checkRight('gsm')) {
- $this->_redirect('/user');
- }
- $this->_helper->viewRenderer->setNoRender();
- $membershipID = $this->_request->getParam('membershipID');
- if(isset($membershipID)) {
- $membership = $this->membershipMapper->find($membershipID);
- $membership->setSuspend(0);
- if(isset($membership)) {
- if($membership->getGroupID() != $this->userIDsNamespace['groupID']) {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Not allowed to resume this membership', 'forbidden');
- return;
- }
- try {
- $this->membershipMapper->save($membership);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect("/user/group/show/");
- }
- }
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class User_GroupController extends Zend_Controller_Action {
+ protected $groupMapper = null;
+ protected $groupGroupsMapper = null;
+ protected $membershipMapper = null;
+ protected $groupRequestMapper = null;
+ protected $personmapper = null;
+ protected $rolemapper = null;
+ protected $groupList = null;
+ protected $userIDsNamespace = null;
+ protected $membership;
+ protected $page;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ $this->groupMapper = new Application_Model_GroupMapper();
+ $this->groupGroupsMapper = new Application_Model_GroupGroupsMapper();
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->groupRequestMapper = new Application_Model_GroupRequestMapper();
+ $this->personmapper = new Application_Model_PersonMapper();
+ $this->rolemapper = new Application_Model_RoleMapper();
+ $this->groupList = $this->groupMapper->fetchAll();
+
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ $this->membership = new Application_Model_Membership();
+ $this->membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+
+ $this->page = $this->_request->getParam('page');
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ }
+
+ public function indexAction() {
+ // ACL show overview
+ if(!Pbs_Acl::checkRight('gso'))
+ { $this->_redirect('/user'); }
+
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+
+ $this->view->groupList = $this->groupList;
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('group');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->groupList = $mySearch->search($this->view->groupList);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->view->groupList);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/group/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+
+ $this->view->groupList = $pagination->getElements();
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->userIDsNamespace = $this->userIDsNamespace;
+ }
+
+ public function searchAction() {
+ $this->_redirect('/user/group/index/search/'.($_GET['search']));
+ }
+
+ public function addAction() {
+ // ACL create new group
+ if(!Pbs_Acl::checkRight('gc'))
+ { $this->_redirect('/user'); }
+
+ if (!isset($_POST["add"])) {
+ $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList));
+ } else {
+ $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList), $_POST);
+
+ if ($addForm->isValid($_POST)) {
+ $group = new Application_Model_Group($_POST);
+
+ $db = $this->groupMapper->findBy(array('title' => $group->getTitle()));
+ if(count($db) >= 1) {
+ $this->_redirect('/user/group/index/page/'.$this->page.'/addresult/error');
+ }
+
+ try {
+ $this->groupMapper->save($group);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $groupID = $this->groupMapper->getDbTable()->getDefaultAdapter()->lastInsertId();
+ $membership = $this->membershipMapper->find($this->userIDsNamespace['membershipID']);
+ // setting the actually used role in the new group
+ $roleID = $this->membership->getRoleID();
+ $membership->setID();
+ $membership->setGroupID($groupID);
+ $membership->setRoleID($roleID);
+
+ try {
+ $this->membershipMapper->save($membership);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ foreach($rightroleslist as $rightroles) {
+ $rightroles->setRoleID($roleID);
+ try {
+ $rightrolesMapper->save($rightroles);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ }
+ if($_POST['superordinatedGroupID'] != -1) {
+ $groupgroups = new Application_Model_GroupGroups();
+#print_a($this->membership->getGroupID(),$this->membership);
+ $groupgroups->setParentID($this->membership->getGroupID());
+ $groupgroups->setGroupID($groupID);
+ try {
+ $this->groupGroupsMapper->save($groupgroups);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+
+ }
+ $this->_redirect('/user/group/index/page/'.$this->page.'/addresult/ok');
+ return;
+ }
+ }
+
+ $this->view->addForm = $addForm;
+ }
+
+ public function editAction() {
+ // ACL edit a group
+ if(!Pbs_Acl::checkRight('geo') && !Pbs_Acl::checkRight('ge'))
+ { $this->_redirect('/user'); }
+
+ $groupID = $this->_request->getParam('groupID');
+ if(!isset($groupID)) {
+ if(count($this->userIDsNamespace) > 0) {
+ $groupID = $this->userIDsNamespace['groupID'];
+ }
+ }
+ if(!isset($groupID)) {
+ $this->_helper->redirector('add', 'group');
+ return;
+ }
+ if((!Pbs_Acl::checkRight('geo') && $groupID == $this->membership->getGroupID()) || ( !Pbs_Acl::checkRight('ge') && $groupID != $this->membership->getGroupID() ))
+ { $this->_redirect('/user/group/index/page/'.$this->page.'/modifyresult/forbidden'); }
+ if (!isset($_POST["save"])) {
+ $group = $this->groupMapper->find($groupID);
+ $_POST['title'] = $group->getTitle();
+ $_POST['description'] = $group->getDescription();
+ $editForm = new user_Form_GroupEdit(array('groupID' => $groupID));
+ } else {
+ $editForm = new user_Form_GroupEdit(array('groupID' => $groupID), $_POST);
+ if ($editForm->isValid($_POST)) {
+ $group = new Application_Model_Group($_POST);
+ $group->setID($groupID);
+ try {
+ $this->groupMapper->save($group);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect('/user/group/index/page/'.$this->page.'/modifyresult/ok');
+ return;
+ }
+ }
+ $this->view->editForm = $editForm;
+ }
+
+ public function showAction() {
+ // ACL create new group
+ if(!Pbs_Acl::checkRight('gsdo') && !Pbs_Acl::checkRight('gsdog'))
+ { $this->_redirect('/user'); }
+
+ $groupID = $this->_request->getParam('groupID');
+ if($groupID == '' || !Pbs_Acl::checkRight('gsdog')) {
+ if(count($this->userIDsNamespace) > 0) {
+ $groupID = $this->userIDsNamespace['groupID'];
+ }
+ }
+ if($groupID == $this->membership->getGroupID() && !Pbs_Acl::checkRight('gsdo'))
+ { $this->_redirect('/user'); }
+
+ $this->view->usergroup = $this->membership->getGroupID();
+ $this->view->requestgroup = $groupID;
+ $groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID), true);
+ if(isset($groupRequests)) {
+ $groupRequestList = array();
+ foreach($groupRequests as $groupRequest) {
+ $person = $this->personmapper->find($groupRequest['personID']);
+ $groupRequestList[] = array(
+ 'grouprequestID' => $groupRequest['grouprequestID'],
+ 'person' => $person
+ );
+ }
+ if(count($groupRequestList) > 0) {
+ $this->view->groupRequestList = $groupRequestList;
+ }
+ // Search all inherit Roles
+ $roles = array();
+ $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
+ $parents = $groupGroupsMapper->getParentGroups($groupID);
+ $groupMapper = new Application_Model_GroupMapper();
+ $crawled = array();
+ foreach($parents as $p) {
+ foreach($p as $a) {
+ if(!in_array($a, $crawled)) {
+ $crawled[] = $a;
+ $group = $groupMapper->find($a);
+ if($groupID != $a)
+ { $r = $this->rolemapper->findBy(array('groupID' => $a, 'inheritance' => "1")); }
+ else
+ { $r = $this->rolemapper->findBy(array('groupID' => $a)); }
+ foreach($r as $d) {
+ $roles[$group->getTitle()][] = $d;
+ }
+ }
+ }
+ }
+ $this->view->roleList = $roles;
+ }
+
+ if(Pbs_Acl::checkRight('gsmg') || Pbs_Acl::checkRight('gsmgo')) {
+ $members = $this->membershipMapper->findBy(array('groupID' => $groupID), true);
+ if(isset($members)) {
+ foreach($members as $member) {
+ $person = $this->personmapper->find($member['personID']);
+ $membership_tmp = $this->membershipMapper->find($member['membershipID']);
+ $role = $this->rolemapper->find($membership_tmp->getRoleID());
+ $membersList[] = array(
+ 'membershipID' => $member['membershipID'],
+ 'suspend' => $member['suspend'],
+ 'person' => $person,
+ 'role' => $role
+ );
+ }
+ if(is_array($membersList)) {
+ // Member Pagination
+ $memberPagination = new Pbs_Pagination();
+ $memberPagination->setPerPage(10)
+ ->setElement($membersList)
+ ->setRequestPage($this->_request->getParam('page'));
+ if($this->_request->getParam('groupID')) {
+ $memberPagination->setPageUrl('/user/group/show/groupID/' . $groupID . ((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ } else {
+ $memberPagination->setPageUrl('/user/group/show'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ }
+ $this->view->membersList = $memberPagination->getElements();
+ $this->view->memberPagination = $memberPagination->pagination();
+ $this->view->page = $memberPagination->getRequestPage();
+ }
+ }
+ }
+ $groupgroups = $this->groupGroupsMapper->findBy(array('groupID' => $groupID), true);
+ if(is_object($groupgroups)) {
+ $parentGroup = $this->groupMapper->find($groupgroups->getParentID());
+ $this->view->$parentGroup = $parentGroup;
+ }
+ $group = $this->groupMapper->find($groupID);
+ $this->view->userIDsNamespace = $this->userIDsNamespace;
+ $this->view->group = $group;
+ $this->view->groupID = $groupID;
+ }
+
+ public function linkAction() {
+ if(!Pbs_Acl::checkRight('glk'))
+ { $this->_redirect('/user'); }
+
+ $linkableGroups = $this->groupList;
+ $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
+ $childs = array();
+ $parents = array();
+ $childs = $groupGroupsMapper->getChildGroups($this->membership->getGroupID());
+ $parents = $groupGroupsMapper->getParentGroups($this->membership->getGroupID());
+#print_a($childs,$parents);
+ foreach($linkableGroups as $i => $group) {
+#print_a($group->getID());
+ if(isset($childs[1]) && in_array($group->getID(), $childs[1])) {
+ unset($linkableGroups[$i]);
+ }
+ if(count($parents) > 0) {
+ foreach($parents as $d) {
+ if(in_array($group->getID(), $d)) {
+ unset($linkableGroups[$i]);
+ }
+ }
+ }
+ }
+#print_a($linkableGroups);
+ if (!isset($_POST["link"])) {
+ $linkForm = new user_Form_GroupLink(array('grouplist' => $linkableGroups));
+ } else {
+ $linkForm = new user_Form_GroupLink(array('grouplist' => $linkableGroups), $_POST);
+
+ if ($linkForm->isValid($_POST)) {
+ $groupgroups = new Application_Model_GroupGroups();
+ if($_POST['superordinatedGroupID'] == $_POST['groupID'] || $_POST['groupID'] == 1) {
+ $this->_redirect('/user/group/index/page/'.$this->page.'/addresult/forbidden');
+ }
+ $groupgroups->setParentID($this->membership->getGroupID());
+ $groupgroups->setGroupID($_POST['groupID']);
+ try {
+ $this->groupGroupsMapper->save($groupgroups);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('', 'group');
+ return;
+ }
+ }
+
+ $this->view->linkForm = $linkForm;
+ }
+
+ public function deleteAction() {
+ // ACL delete a group
+ if(!Pbs_Acl::checkRight('gd'))
+ { $this->_redirect('/user'); }
+
+ $this->_helper->viewRenderer->setNoRender();
+ $groupID = $this->_request->getParam('groupID');
+ if(!isset($groupID)) {
+ if(count($this->userIDsNamespace) > 0) {
+ $groupID = $this->userIDsNamespace['groupID'];
+ }
+ }
+ if (isset($groupID)) {
+ $group = $this->groupMapper->find($groupID);
+ try {
+ $this->groupMapper->delete($group);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ if($_SERVER['HTTP_REFERER']) {
+ if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show') != = false && strpos($_SERVER['HTTP_REFERER'], '/groupID/') == = false) {
+ $this->_helper->redirector('changemembership', 'person');
+ } else {
+ $this->_redirect('/user/group/index/page/'.$this->page.'/deleteresult/ok');
+ }
+ } else {
+ $this->_helper->redirector('', 'group');
+ }
+ return;
+ } else {
+ $this->_redirect('/user/');
+ return;
+ }
+ }
+
+ public function grantpersonAction() {
+ // ACL grant a membership to request
+ if(!Pbs_Acl::checkRight('gam'))
+ { $this->_redirect('/user'); }
+
+ $this->_helper->viewRenderer->setNoRender();
+ if(isset($_POST['grouprequestID']) && isset($_POST['roleID'])) {
+ $groupRequest = $this->groupRequestMapper->find($_POST['grouprequestID']);
+ try {
+ $this->groupRequestMapper->delete($groupRequest);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $membership = new Application_Model_Membership();
+ $membership->setGroupID($groupRequest->getGroupID())
+ ->setPersonID($groupRequest->getPersonID())
+ ->setRoleID($_POST['roleID'])
+ ->setSuspend(0);
+ $apikey = randomString(32);
+ $membership->setApikey($apikey);
+
+
+ try {
+ $id = $this->membershipMapper->save($membership);
+ $membership->setID($id);
+ $newMember = new Pbs_NewMember();
+ $newMember->createDefaults($membership);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/group/show/groupID/" . $groupRequest->getGroupID());
+ }
+ }
+
+ public function revokepersonAction() {
+
+ $this->_helper->viewRenderer->setNoRender();
+ $membershipID = $this->_request->getParam('membershipID');
+ $rr = $this->membershipMapper->find($membershipID);
+
+ if(($rr->getGroupID() == $this->membership->getGroupID() && Pbs_Acl::checkRight('gdmo') ) || ( $rr->getGroupID() != $this->membership->getGroupID() && Pbs_Acl::checkRight('gdmog'))) {
+ if(isset($membershipID)) {
+ $membership = $this->membershipMapper->find($membershipID);
+ if(isset($membership)) {
+ try {
+ $this->membershipMapper->delete($membership);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/group/show/groupID/" . $membership->getGroupID());
+ }
+ }
+ }
+ }
+
+ public function declineAction() {
+ if(!Pbs_Acl::checkRight('gdm')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $grouprequestID = $this->_request->getParam('grouprequestID');
+ if(isset($grouprequestID)) {
+ $groupRequest = $this->groupRequestMapper->find($grouprequestID);
+ if($groupRequest->getGroupID() != $this->userIDsNamespace['groupID']) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Not allowed to decline this grouprequest', 'forbidden');
+ return;
+ }
+ try {
+ $this->groupRequestMapper->delete($groupRequest);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/group/show/groupID");
+ }
+ }
+
+ public function suspendmembershipAction() {
+ if(!Pbs_Acl::checkRight('gsm')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $membershipID = $this->_request->getParam('membershipID');
+ if(isset($membershipID)) {
+ $membership = $this->membershipMapper->find($membershipID);
+ $membership->setSuspend(1);
+ if(isset($membership)) {
+ if($membership->getGroupID() != $this->userIDsNamespace['groupID']) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Not allowed to suspend this membership', 'forbidden');
+ return;
+ }
+ try {
+ $this->membershipMapper->save($membership);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/group/show/");
+ }
+ }
+ }
+
+ public function resumemembershipAction() {
+ if(!Pbs_Acl::checkRight('gsm')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $membershipID = $this->_request->getParam('membershipID');
+ if(isset($membershipID)) {
+ $membership = $this->membershipMapper->find($membershipID);
+ $membership->setSuspend(0);
+ if(isset($membership)) {
+ if($membership->getGroupID() != $this->userIDsNamespace['groupID']) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Not allowed to resume this membership', 'forbidden');
+ return;
+ }
+ try {
+ $this->membershipMapper->save($membership);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/group/show/");
+ }
+ }
+ }
}
diff --git a/application/modules/user/controllers/IndexController.php b/application/modules/user/controllers/IndexController.php
index a704261..4bbfe1d 100644
--- a/application/modules/user/controllers/IndexController.php
+++ b/application/modules/user/controllers/IndexController.php
@@ -1,38 +1,34 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class User_IndexController extends Zend_Controller_Action
-{
- public function init()
- {
- /* Initialize action controller here */
- }
+class User_IndexController extends Zend_Controller_Action {
+ public function init() {
+ /* Initialize action controller here */
+ }
- 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;
- }
- }
+ 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/PersonController.php b/application/modules/user/controllers/PersonController.php
index 168add9..195ad5a 100644
--- a/application/modules/user/controllers/PersonController.php
+++ b/application/modules/user/controllers/PersonController.php
@@ -1,529 +1,509 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_PersonController extends Zend_Controller_Action
-{
+class user_PersonController extends Zend_Controller_Action {
- protected $person = null;
- protected $personmapper = null;
- protected $membershipMapper = null;
- protected $memberships = null;
- protected $groupMapper = null;
- protected $groups = null;
- protected $groupRequestMapper = null;
- protected $userIDsNamespace = null;
+ protected $person = null;
+ protected $personmapper = null;
+ protected $membershipMapper = null;
+ protected $memberships = null;
+ protected $groupMapper = null;
+ protected $groups = null;
+ protected $groupRequestMapper = null;
+ protected $userIDsNamespace = null;
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->personmapper = new Application_Model_PersonMapper();
- $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if(isset($this->userIDsNamespace['personID'])) {
- $this->person = $this->personmapper->find($this->userIDsNamespace['personID']);
- } else {
- $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $this->person = new Application_Model_Person($result[0]);
- $this->person->setID($result[0]['personID']);
- }
- $this->groupMapper = new Application_Model_GroupMapper();
- $this->groupRequestMapper = new Application_Model_GroupRequestMapper();
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->memberships = $this->membershipMapper->findBy(array("personID" => $this->person->getID()),true);
-
- $rightrolesMapper = new Application_Model_RightRolesMapper();
- $rightroles = new Application_Model_RightRoles();
- $role = new Application_Model_Role();
- $roleMapper = new Application_Model_RoleMapper();
-
- $this->view->apikeys = array();
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->personmapper = new Application_Model_PersonMapper();
+ $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if(isset($this->userIDsNamespace['personID'])) {
+ $this->person = $this->personmapper->find($this->userIDsNamespace['personID']);
+ } else {
+ $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()), true);
+ $this->person = new Application_Model_Person($result[0]);
+ $this->person->setID($result[0]['personID']);
+ }
+ $this->groupMapper = new Application_Model_GroupMapper();
+ $this->groupRequestMapper = new Application_Model_GroupRequestMapper();
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->memberships = $this->membershipMapper->findBy(array("personID" => $this->person->getID()), true);
- if(isset($this->memberships)) {
- foreach($this->memberships as $membership) {
- $group = $this->groupMapper->find($membership['groupID']);
- list($rightroles) = $rightrolesMapper->findBy(array('rightID' => '55', 'roleID' => $membership['roleID']));
- $role = $roleMapper->find($membership['roleID']);
- if($rightroles != null)
- $this->view->apikeys[$group->getID()] = $membership['apikey'];
-
- $this->groups[] = array (
- 'groupID' => $group->getID(),
- 'title' => $group->getTitle(),
- 'description' => $group->getDescription(),
- 'membershipID' => $membership['membershipID'],
- 'role' => $role->getTitle()
- );
- }
- }
- } else {
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
+ $rightrolesMapper = new Application_Model_RightRolesMapper();
+ $rightroles = new Application_Model_RightRoles();
+ $role = new Application_Model_Role();
+ $roleMapper = new Application_Model_RoleMapper();
- public function indexAction()
- {
- if(!Pbs_Acl::checkRight('pso')) {
- $this->_redirect('/user');
- }
- $this->view->showRight = true;//Pbs_Acl::checkRight('psod');
- $this->view->editRight = Pbs_Acl::checkRight('peod');
- $this->view->deleteRight = Pbs_Acl::checkRight('pdo');
- $this->view->showOtherRight = Pbs_Acl::checkRight('psood');
- $this->view->editOtherRight = Pbs_Acl::checkRight('peoa');
- $this->view->deleteOtherRight = Pbs_Acl::checkRight('pd');
- $this->view->suspendRight = Pbs_Acl::checkRight('psa');
- $this->view->userIDsNamespace = $this->userIDsNamespace;
+ $this->view->apikeys = array();
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
+ if(isset($this->memberships)) {
+ foreach($this->memberships as $membership) {
+ $group = $this->groupMapper->find($membership['groupID']);
+ list($rightroles) = $rightrolesMapper->findBy(array('rightID' => '55', 'roleID' => $membership['roleID']));
+ $role = $roleMapper->find($membership['roleID']);
+ if($rightroles != null)
+ { $this->view->apikeys[$group->getID()] = $membership['apikey']; }
+ $this->groups[] = array (
+ 'groupID' => $group->getID(),
+ 'title' => $group->getTitle(),
+ 'description' => $group->getDescription(),
+ 'membershipID' => $membership['membershipID'],
+ 'role' => $role->getTitle()
+ );
+ }
+ }
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ return;
+ }
+ }
- $this->view->personList = $this->personmapper->fetchAll();
+ public function indexAction() {
+ if(!Pbs_Acl::checkRight('pso')) {
+ $this->_redirect('/user');
+ }
+ $this->view->showRight = true;//Pbs_Acl::checkRight('psod');
+ $this->view->editRight = Pbs_Acl::checkRight('peod');
+ $this->view->deleteRight = Pbs_Acl::checkRight('pdo');
+ $this->view->showOtherRight = Pbs_Acl::checkRight('psood');
+ $this->view->editOtherRight = Pbs_Acl::checkRight('peoa');
+ $this->view->deleteOtherRight = Pbs_Acl::checkRight('pd');
+ $this->view->suspendRight = Pbs_Acl::checkRight('psa');
+ $this->view->userIDsNamespace = $this->userIDsNamespace;
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('person');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->personList = $mySearch->search($this->view->personList);
- }
- $this->view->searchform = $mySearch->searchForm();
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->view->personList);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/person/index/'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $this->view->personList = $pagination->getElements();
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- }
+ $this->view->personList = $this->personmapper->fetchAll();
- public function owndetailsAction()
- {
- #if(!Pbs_Acl::checkRight('psod')) {
- # $this->_redirect('/user');
- #}
- $this->view->person = $this->person;
- $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()),true);
- if(isset($groupRequests)) {
- $groupRequestList = array();
- foreach($groupRequests as $groupRequest) {
- $group = $this->groupMapper->find($groupRequest['groupID']);
- $groupRequestList[] = array(
- 'grouprequestID' => $groupRequest['grouprequestID'],
- 'group' => $group
- );
- }
- if(count($groupRequestList)> 0) {
- $this->view->groupRequestList = $groupRequestList;
- }
- }
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->groups);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/person/index' .((isset($this->view->search))?'/search/'.$this->view->search:''));
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('person');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->personList = $mySearch->search($this->view->personList);
+ }
+ $this->view->searchform = $mySearch->searchForm();
- $this->view->groups = $pagination->getElements();
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- // This should be activated in case the person has no membership and no rights.
- $this->view->groupRequestRight = true;
- $this->view->editRight = Pbs_Acl::checkRight('peod');
- $this->view->leaveRight = Pbs_Acl::checkRight('gl');
- $this->view->suspendRight = Pbs_Acl::checkRight('psa');
- $this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- }
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->view->personList);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/person/index/'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
- public function editAction()
- {
- if(!Pbs_Acl::checkRight('peod')) {
- $this->_redirect('/user');
- }
- $requestedUser = $this->_request->getParam('personID');
- if($requestedUser != "" && $this->person->getID() != $requestedUser) {
- if(!is_numeric($requestedUser)){
- $this->_redirect('/user/person/index/page/'.$this->page.'/modifyresult/error');
- }
- if(!Pbs_Acl::checkRight('peoa')) {
- $this->_redirect('/user/person/index/page/'.$this->page.'/modifyresult/forbidden');
- }
- $person = $this->personmapper->find($requestedUser);
- $this->view->person = $person;
- } else {
- $this->view->person = $this->person;
- }
- if (!isset($_POST["save"])){
- $editForm = new user_Form_PersonEdit();
- } else {
- $editForm = new user_Form_PersonEdit($_POST);
- if ($editForm->isValid($_POST)) {
- if($this->person->getID() == $requestedUser) {
- $person->setOptions($_POST);
- $this->person->setID($this->view->person->getID());
- if($_POST['newpassword'] != '') {
- $person->setPassword($_POST['newpassword']);
- $person->setPasswordSalt(MD5(microtime(true)));
- $person->setLoginPassword(crypt($person->getPassword(), '$6$'.randomString(8).'$'));
- $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
- }
- try {
- $this->personmapper->save($person);
- } catch(Zend_Exception $e)
- {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Email already registered', 'error');
- $this->view->registerForm = $registerForm;
- return;
- }
- $this->_helper->redirector('', 'person');
- } else {
- $this->person->setOptions($_POST);
- $this->person->setID($this->view->person->getID());
- if($_POST['newpassword'] != '') {
- $this->person->setPassword($_POST['newpassword']);
- $this->person->setPasswordSalt(MD5(microtime(true)));
- $this->person->setLoginPassword(crypt($this->person->getPassword(), '$6$'.randomString(8).'$'));
- $this->person->setPassword(MD5($this->person->getPassword() . $this->person->getPasswordSalt()));
- }
- try {
- $this->personmapper->save($this->person);
- } catch(Zend_Exception $e)
- {
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('Email already registered', 'error');
- $this->view->registerForm = $registerForm;
- return;
- }
- $this->_helper->redirector('index', 'person');
- }
- return;
- }
- }
- $this->view->editForm = $editForm;
- }
+ $this->view->personList = $pagination->getElements();
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ }
- public function requestAction()
- {
- #if(!Pbs_Acl::checkRight('grm')) {
- # $this->_redirect('/user');
- #}
- $this->view->person = $this->person;
- $allgroups = $this->groupMapper->fetchAll();
- $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()),true);
- $count = 0;
- foreach($allgroups as $group) {
- foreach($groupRequests as $groupRequest) {
- if($groupRequest['groupID'] == $group->getID()) {
- $groupsFound[$count] = true;
- } else {
- $groupsFound[$count] = false;
- }
- }
- foreach($this->memberships as $membership) {
- if($membership['groupID'] == $group->getID()) {
- $groupsFound[$count] = true;
- } else {
- if(isset($groupsFound[$count]) && $groupsFound[$count] != true) {
- $groupsFound[$count] = false;
- }
- }
- }
- $count++;
- }
- if(count($groupsFound) > 0) {
- foreach($groupsFound as $k => $v) {
- if($v == true) {
- unset($allgroups[$k]);
- }
- }
- }
- if (!isset($_POST["request"])){
- if(count($allgroups) <= 0) {
- $this->_helper->redirector('owndetails', 'person');
- return;
- }
- $requestForm = new user_Form_GroupRequest(array('grouplist' => $allgroups));
- } else {
- $requestForm = new user_Form_GroupRequest(array('grouplist' => $allgroups), $_POST);
- if ($requestForm->isValid($_POST)) {
- $groupRequestMapper = new Application_Model_GroupRequestMapper();
- $groupRequest = new Application_Model_GroupRequest();
- $groupRequest->setGroupID($_POST['groupID']);
- $date = new DateTime();
- $groupRequest->setTime($date->getTimestamp());
- $groupRequest->setPersonID($this->person->getID());
- foreach($groupRequests as $groupRequestDB) {
- if($groupRequestDB['groupID'] == $groupRequest->getGroupID()) {
- $requestFound = true;
- break;
- }
- }
- if(!$requestFound) {
- try {
- $groupRequestMapper->save($groupRequest);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- }
- $this->_helper->redirector('owndetails', 'person');
- return;
- }
- }
- $this->view->requestForm = $requestForm;
- }
+ public function owndetailsAction() {
+#if(!Pbs_Acl::checkRight('psod')) {
+# $this->_redirect('/user');
+#}
+ $this->view->person = $this->person;
+ $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()), true);
+ if(isset($groupRequests)) {
+ $groupRequestList = array();
+ foreach($groupRequests as $groupRequest) {
+ $group = $this->groupMapper->find($groupRequest['groupID']);
+ $groupRequestList[] = array(
+ 'grouprequestID' => $groupRequest['grouprequestID'],
+ 'group' => $group
+ );
+ }
+ if(count($groupRequestList) > 0) {
+ $this->view->groupRequestList = $groupRequestList;
+ }
+ }
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->groups);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/person/index' .((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
- public function leaveAction()
- {
- if(!Pbs_Acl::checkRight('gl')) {
- $this->_redirect('/user');
- }
- $this->_helper-> viewRenderer-> setNoRender();
- $this->view->person = $this->person;
- $membershipID = $this->_request->getParam('membershipID');
- if(isset($membershipID)) {
- $membership = $this->membershipMapper->find($membershipID);
- try {
- $this->membershipMapper->delete($membership);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('owndetails', 'person');
- return;
- }
- }
+ $this->view->groups = $pagination->getElements();
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ // This should be activated in case the person has no membership and no rights.
+ $this->view->groupRequestRight = true;
+ $this->view->editRight = Pbs_Acl::checkRight('peod');
+ $this->view->leaveRight = Pbs_Acl::checkRight('gl');
+ $this->view->suspendRight = Pbs_Acl::checkRight('psa');
+ $this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ }
- public function selectmembershipAction()
- {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if(isset($userIDsNamespace['membershipID'])) {
- $this->_redirect('/user/');
- } else {
- if(count($this->memberships) == 1) {
- $myMembership = $this->memberships[0];
- $roleSession = new Zend_Session_Namespace('userIDs');
- $roleSession->membershipID = $myMembership['membershipID'];
- $roleSession->personID = $myMembership['personID'];
- $roleSession->groupID = $myMembership['groupID'];
- $roleSession->roleID = $myMembership['roleID'];
- $this->_redirect('/user/');
- } elseif(count($this->memberships) > 1) {
- if(isset($_POST['selectmembership'])) {
- $roleSession = new Zend_Session_Namespace('userIDs');
- $roleSession->membershipID = $_POST['membershipID'];
- $roleSession->personID = $this->person->getID();
- $membership = $this->membershipMapper->find($_POST['membershipID']);
- $roleSession->groupID = $membership->getGroupID();
- $roleSession->roleID = $membership->getRoleID();
- $this->_redirect('/user/');
- return;
- } else {
- $groupMapper = new Application_Model_GroupMapper();
- $roleMapper = new Application_Model_RoleMapper();
- if(isset($this->memberships)) {
- $suspendlist = array();
- foreach($this->memberships as $membership) {
- $group = $groupMapper->find($membership['groupID']);
- $role = $roleMapper->find($membership['roleID']);
- if($membership['suspend'] == 0){
- $membershipList[] = array(
- 'membershipID' => $membership['membershipID'],
- 'group' => $group->getTitle(),
- 'role' => $role->getTitle()
- );
- }
- else{
- $suspendlist[] = array(
- 'membershipID' => $membership['membershipID'],
- 'group' => $group->getTitle(),
- 'role' => $role->getTitle());
- }
+ public function editAction() {
+ if(!Pbs_Acl::checkRight('peod')) {
+ $this->_redirect('/user');
+ }
+ $requestedUser = $this->_request->getParam('personID');
+ if($requestedUser != "" && $this->person->getID() != $requestedUser) {
+ if(!is_numeric($requestedUser)) {
+ $this->_redirect('/user/person/index/page/'.$this->page.'/modifyresult/error');
+ }
+ if(!Pbs_Acl::checkRight('peoa')) {
+ $this->_redirect('/user/person/index/page/'.$this->page.'/modifyresult/forbidden');
+ }
+ $person = $this->personmapper->find($requestedUser);
+ $this->view->person = $person;
+ } else {
+ $this->view->person = $this->person;
+ }
+ if (!isset($_POST["save"])) {
+ $editForm = new user_Form_PersonEdit();
+ } else {
+ $editForm = new user_Form_PersonEdit($_POST);
+ if ($editForm->isValid($_POST)) {
+ if($this->person->getID() == $requestedUser) {
+ $person->setOptions($_POST);
+ $this->person->setID($this->view->person->getID());
+ if($_POST['newpassword'] != '') {
+ $person->setPassword($_POST['newpassword']);
+ $person->setPasswordSalt(MD5(microtime(true)));
+ $person->setLoginPassword(crypt($person->getPassword(), '$6$'.randomString(8).'$'));
+ $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
+ }
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Email already registered', 'error');
+ $this->view->registerForm = $registerForm;
+ return;
+ }
+ $this->_helper->redirector('', 'person');
+ } else {
+ $this->person->setOptions($_POST);
+ $this->person->setID($this->view->person->getID());
+ if($_POST['newpassword'] != '') {
+ $this->person->setPassword($_POST['newpassword']);
+ $this->person->setPasswordSalt(MD5(microtime(true)));
+ $this->person->setLoginPassword(crypt($this->person->getPassword(), '$6$'.randomString(8).'$'));
+ $this->person->setPassword(MD5($this->person->getPassword() . $this->person->getPasswordSalt()));
+ }
+ try {
+ $this->personmapper->save($this->person);
+ } catch(Zend_Exception $e) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Email already registered', 'error');
+ $this->view->registerForm = $registerForm;
+ return;
+ }
+ $this->_helper->redirector('index', 'person');
+ }
+ return;
+ }
+ }
+ $this->view->editForm = $editForm;
+ }
- }
- if(count($suspendlist) >=1){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify("Actually ".count($suspendlist)." Memberships are suspended", 'error' );
- }
- }
- $membershipSelectForm = new user_Form_MembershipSelect(array('membershiplist' => $membershipList));
- $this->view->membershipSelectForm = $membershipSelectForm;
- }
- } else {
- $this->_helper->redirector('request', 'person');
- }
- }
- }
+ public function requestAction() {
+#if(!Pbs_Acl::checkRight('grm')) {
+# $this->_redirect('/user');
+#}
+ $this->view->person = $this->person;
+ $allgroups = $this->groupMapper->fetchAll();
+ $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $this->person->getID()), true);
+ $count = 0;
+ foreach($allgroups as $group) {
+ foreach($groupRequests as $groupRequest) {
+ if($groupRequest['groupID'] == $group->getID()) {
+ $groupsFound[$count] = true;
+ } else {
+ $groupsFound[$count] = false;
+ }
+ }
+ foreach($this->memberships as $membership) {
+ if($membership['groupID'] == $group->getID()) {
+ $groupsFound[$count] = true;
+ } else {
+ if(isset($groupsFound[$count]) && $groupsFound[$count] != true) {
+ $groupsFound[$count] = false;
+ }
+ }
+ }
+ $count++;
+ }
+ if(count($groupsFound) > 0) {
+ foreach($groupsFound as $k => $v) {
+ if($v == true) {
+ unset($allgroups[$k]);
+ }
+ }
+ }
+ if (!isset($_POST["request"])) {
+ if(count($allgroups) <= 0) {
+ $this->_helper->redirector('owndetails', 'person');
+ return;
+ }
+ $requestForm = new user_Form_GroupRequest(array('grouplist' => $allgroups));
+ } else {
+ $requestForm = new user_Form_GroupRequest(array('grouplist' => $allgroups), $_POST);
+ if ($requestForm->isValid($_POST)) {
+ $groupRequestMapper = new Application_Model_GroupRequestMapper();
+ $groupRequest = new Application_Model_GroupRequest();
+ $groupRequest->setGroupID($_POST['groupID']);
+ $date = new DateTime();
+ $groupRequest->setTime($date->getTimestamp());
+ $groupRequest->setPersonID($this->person->getID());
+ foreach($groupRequests as $groupRequestDB) {
+ if($groupRequestDB['groupID'] == $groupRequest->getGroupID()) {
+ $requestFound = true;
+ break;
+ }
+ }
+ if(!$requestFound) {
+ try {
+ $groupRequestMapper->save($groupRequest);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ }
+ $this->_helper->redirector('owndetails', 'person');
+ return;
+ }
+ }
+ $this->view->requestForm = $requestForm;
+ }
- public function changemembershipAction()
- {
- $this->_helper-> viewRenderer-> setNoRender();
- Zend_Session::namespaceUnset('userIDs');
- $this->_helper->redirector('selectmembership', 'person');
- return;
- }
+ public function leaveAction() {
+ if(!Pbs_Acl::checkRight('gl')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper-> viewRenderer-> setNoRender();
+ $this->view->person = $this->person;
+ $membershipID = $this->_request->getParam('membershipID');
+ if(isset($membershipID)) {
+ $membership = $this->membershipMapper->find($membershipID);
+ try {
+ $this->membershipMapper->delete($membership);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('owndetails', 'person');
+ return;
+ }
+ }
- public function searchAction()
- {
- if(!Pbs_Acl::checkRight('pso')) {
- $this->_redirect('/user');
- }
- $this->_redirect('/user/person/index/search/'.($_GET['search']));
- }
+ public function selectmembershipAction() {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if(isset($userIDsNamespace['membershipID'])) {
+ $this->_redirect('/user/');
+ } else {
+ if(count($this->memberships) == 1) {
+ $myMembership = $this->memberships[0];
+ $roleSession = new Zend_Session_Namespace('userIDs');
+ $roleSession->membershipID = $myMembership['membershipID'];
+ $roleSession->personID = $myMembership['personID'];
+ $roleSession->groupID = $myMembership['groupID'];
+ $roleSession->roleID = $myMembership['roleID'];
+ $this->_redirect('/user/');
+ }
+ elseif(count($this->memberships) > 1) {
+ if(isset($_POST['selectmembership'])) {
+ $roleSession = new Zend_Session_Namespace('userIDs');
+ $roleSession->membershipID = $_POST['membershipID'];
+ $roleSession->personID = $this->person->getID();
+ $membership = $this->membershipMapper->find($_POST['membershipID']);
+ $roleSession->groupID = $membership->getGroupID();
+ $roleSession->roleID = $membership->getRoleID();
+ $this->_redirect('/user/');
+ return;
+ } else {
+ $groupMapper = new Application_Model_GroupMapper();
+ $roleMapper = new Application_Model_RoleMapper();
+ if(isset($this->memberships)) {
+ $suspendlist = array();
+ foreach($this->memberships as $membership) {
+ $group = $groupMapper->find($membership['groupID']);
+ $role = $roleMapper->find($membership['roleID']);
+ if($membership['suspend'] == 0) {
+ $membershipList[] = array(
+ 'membershipID' => $membership['membershipID'],
+ 'group' => $group->getTitle(),
+ 'role' => $role->getTitle()
+ );
+ } else {
+ $suspendlist[] = array(
+ 'membershipID' => $membership['membershipID'],
+ 'group' => $group->getTitle(),
+ 'role' => $role->getTitle());
+ }
- public function showAction()
- {
- if(!Pbs_Acl::checkRight('psood')) {
- $this->_redirect('/user');
- }
- $personID = $this->_request->getParam('personID');
- if($personID) {
- $person = $this->personmapper->find($personID);
- $memberships = $this->membershipMapper->findBy(array("personID" => $person->getID()),true);
- if(isset($memberships)) {
- foreach($memberships as $membership) {
- $group = $this->groupMapper->find($membership['groupID']);
- $groups[] = array (
- 'groupID' => $group->getID(),
- 'title' => $group->getTitle(),
- 'description' => $group->getDescription(),
- 'membershipID' => $membership['membershipID']
- );
- }
- }
- $this->view->person = $person;
- $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $person->getID()),true);
- if(isset($groupRequests)) {
- foreach($groupRequests as $groupRequest) {
- $group = $this->groupMapper->find($groupRequest['groupID']);
- $groupRequestList[] = array(
- 'grouprequestID' => $groupRequest['grouprequestID'],
- 'group' => $group
- );
- }
- if(is_array($groupRequestList)) {
- $this->view->groupRequestList = $groupRequestList;
- }
- }
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($groups);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/person/show/personID/' . $personID .((isset($this->view->search))?'/search/'.$this->view->search:''));
+ }
+ if(count($suspendlist) >= 1) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify("Actually ".count($suspendlist)." Memberships are suspended", 'error' );
+ }
+ }
+ $membershipSelectForm = new user_Form_MembershipSelect(array('membershiplist' => $membershipList));
+ $this->view->membershipSelectForm = $membershipSelectForm;
+ }
+ }
+ else {
+ $this->_helper->redirector('request', 'person');
+ }
+ }
+ }
- $this->view->groups = $pagination->getElements();
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- $this->view->personID = $personID;
- $this->view->editRight = Pbs_Acl::checkRight('peoa');
- $this->view->deleteRight = Pbs_Acl::checkRight('pd');
- $this->view->suspendRight = Pbs_Acl::checkRight('psa');
- $this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- } else {
- $this->_helper->redirector('', 'person');
- return;
- }
- }
+ public function changemembershipAction() {
+ $this->_helper-> viewRenderer-> setNoRender();
+ Zend_Session::namespaceUnset('userIDs');
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ }
- public function deleterequestAction()
- {
- if(!Pbs_Acl::checkRight('gdm')) {
- $this->_redirect('/user');
- }
- $grouprequestID = $this->_request->getParam('grouprequestID');
- $grouprequest = $this->groupRequestMapper->find($grouprequestID);
- try {
- $this->groupRequestMapper->delete($grouprequest);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('owndetails', 'person');
- return;
- }
+ public function searchAction() {
+ if(!Pbs_Acl::checkRight('pso')) {
+ $this->_redirect('/user');
+ }
+ $this->_redirect('/user/person/index/search/'.($_GET['search']));
+ }
- public function suspendAction()
- {
- if(!Pbs_Acl::checkRight('psa')) {
- $this->_redirect('/user');
- }
- $this->_helper->viewRenderer->setNoRender();
- $personID = $this->_request->getParam('personID');
- if(isset($personID)) {
- $person = $this->personmapper->find($personID);
- $person->setSuspend(1);
- if(isset($person)) {
- try {
- $this->personmapper->save($person);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect("/user/person/");
- }
- }
- }
+ public function showAction() {
+ if(!Pbs_Acl::checkRight('psood')) {
+ $this->_redirect('/user');
+ }
+ $personID = $this->_request->getParam('personID');
+ if($personID) {
+ $person = $this->personmapper->find($personID);
+ $memberships = $this->membershipMapper->findBy(array("personID" => $person->getID()), true);
+ if(isset($memberships)) {
+ foreach($memberships as $membership) {
+ $group = $this->groupMapper->find($membership['groupID']);
+ $groups[] = array (
+ 'groupID' => $group->getID(),
+ 'title' => $group->getTitle(),
+ 'description' => $group->getDescription(),
+ 'membershipID' => $membership['membershipID']
+ );
+ }
+ }
+ $this->view->person = $person;
+ $groupRequests = $this->groupRequestMapper->findBy(array('personID' => $person->getID()), true);
+ if(isset($groupRequests)) {
+ foreach($groupRequests as $groupRequest) {
+ $group = $this->groupMapper->find($groupRequest['groupID']);
+ $groupRequestList[] = array(
+ 'grouprequestID' => $groupRequest['grouprequestID'],
+ 'group' => $group
+ );
+ }
+ if(is_array($groupRequestList)) {
+ $this->view->groupRequestList = $groupRequestList;
+ }
+ }
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($groups);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/person/show/personID/' . $personID .((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
- public function resumeAction()
- {
- if(!Pbs_Acl::checkRight('psa')) {
- $this->_redirect('/user');
- }
- $this->_helper->viewRenderer->setNoRender();
- $personID = $this->_request->getParam('personID');
- if(isset($personID)) {
- $person = $this->personmapper->find($personID);
- $person->setSuspend(0);
- if(isset($person)) {
- try {
- $this->personmapper->save($person);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_redirect("/user/person/");
- }
- }
- }
+ $this->view->groups = $pagination->getElements();
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->personID = $personID;
+ $this->view->editRight = Pbs_Acl::checkRight('peoa');
+ $this->view->deleteRight = Pbs_Acl::checkRight('pd');
+ $this->view->suspendRight = Pbs_Acl::checkRight('psa');
+ $this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ } else {
+ $this->_helper->redirector('', 'person');
+ return;
+ }
+ }
+
+ public function deleterequestAction() {
+ if(!Pbs_Acl::checkRight('gdm')) {
+ $this->_redirect('/user');
+ }
+ $grouprequestID = $this->_request->getParam('grouprequestID');
+ $grouprequest = $this->groupRequestMapper->find($grouprequestID);
+ try {
+ $this->groupRequestMapper->delete($grouprequest);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('owndetails', 'person');
+ return;
+ }
+
+ public function suspendAction() {
+ if(!Pbs_Acl::checkRight('psa')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $personID = $this->_request->getParam('personID');
+ if(isset($personID)) {
+ $person = $this->personmapper->find($personID);
+ $person->setSuspend(1);
+ if(isset($person)) {
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/person/");
+ }
+ }
+ }
+
+ public function resumeAction() {
+ if(!Pbs_Acl::checkRight('psa')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $personID = $this->_request->getParam('personID');
+ if(isset($personID)) {
+ $person = $this->personmapper->find($personID);
+ $person->setSuspend(0);
+ if(isset($person)) {
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/person/");
+ }
+ }
+ }
}
diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php
index d85bfdc..0f6636d 100644
--- a/application/modules/user/controllers/PoolController.php
+++ b/application/modules/user/controllers/PoolController.php
@@ -1,354 +1,341 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class User_PoolController extends Zend_Controller_Action
-{
- private $membership;
- protected $page;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($userIDsNamespace['membershipID'] ==''){
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('No membershipID set','forbidden');
- }
-
- $membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- $this->page = $this->_request->getParam('page');
- }
-
- public function indexAction()
- {
- // ACL: is he allowed to see the pools of a group
- if(!Pbs_Acl::checkRight('poo'))
- $this->_redirect('/user');
-
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
- $result = $this->_request->getParam('linkresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('link',$result);
- }
- $result = $this->_request->getParam('unlinkresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('unlink',$result);
- }
-
- // get all pools from this group
- $poolMapper = new Application_Model_PoolMapper();
- $pools = $poolMapper->findBy(array('groupID' => $this->membership->getGroupID()),true);
- foreach($pools as $pool){
- $ff = new Application_Model_Pool();
- $ff->setOptions($pool);
- $ff->setID($pool['poolID']);
- $yourpools[] = $ff;
- }
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search) ->setModule('pool');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $yourpools = $mySearch->search($yourpools);
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10)
- ->setElement($yourpools)
- ->setRequestPage($this->_request->getParam('page'))
- ->setPageUrl('/user/pool/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $yourpools = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- $this->view->pools = $yourpools;
-
-
- // Get all Clients from this group
- $clientmapper = new Application_Model_ClientMapper();
- $clientsArray = $clientmapper->findBy(array('groupID' => $this->membership->getGroupID()),true);
-
- // Get all assigned Clients
- $assignedclientmapper = new Application_Model_PoolEntriesMapper();
- $assignedclients = $assignedclientmapper->fetchAll();
- foreach($assignedclients as $c){
- $assignedclientsArray[] = $c->toArray();
- }
-
- $db = Zend_Db_Table::getDefaultAdapter();
- // extract the un-assigned clients from the clientlist of the group
- $stmt = $db->query("SELECT c.clientID, c.groupID, macadress,hardwarehash,created
- FROM pbs_poolentries pe RIGHT OUTER JOIN pbs_client c ON
- c.clientID = pe.clientID
- WHERE poolentriesID IS NULL
- AND c.groupID = '".$this->membership->getGroupID()."'");
-
- $freeclients = $stmt->fetchAll();
- // 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;
- }
-
- public function searchAction(){
- $this->_redirect('/user/pool/index/search/'.($_GET['search']));
- }
-
- public function createpoolAction()
- {
- // ACL: is he allowed to create a pool?
- if(!Pbs_Acl::checkRight('poc'))
- $this->_redirect('/user');
-
- if (!isset($_POST["add"])){
- $addfilterform = new user_Form_Pool(array(
- 'buttontext' => 'Create Pool',
- 'page' => $this->page));
- $this->view->addpool = $addfilterform;
- }else {
- $addpoolform = new user_Form_Pool(array(
- 'buttontext' => 'Create Pool',
- 'page' => $this->page),$_POST);
- if ($addpoolform->isValid($_POST)) {
- try{
- $pool = new Application_Model_Pool($_POST);
- $pool->setGroupID($this->membership->getGroupID());
- $poolmapper = new Application_Model_PoolMapper();
- $poolmapper->save($pool);
- $this->_redirect('/user/pool/index/addresult/ok');
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/pool/index/addresult/error');
- }
- }
- $this->view->addpool = $addpoolform;
- }
- }
-
- public function deletepoolAction()
- {
- $poolID = $this->_request->getParam('poolID');
-
- // ACL: is he allowed to delete a pool?
- if(!Pbs_Acl::checkRight('pod'))
- $this->_redirect('/user');
-
- if(is_numeric($poolID)){
- $poolmapper = new Application_Model_PoolMapper();
- $pool = new Application_Model_Pool();
- $poolmapper->find($poolID,$pool);
- if($this->membership->getGroupID() == $pool->getGroupID()){
- $deletepool = new Application_Model_Pool();
- $deletepool->setID($poolID);
- $poolmapper->delete($deletepool);
- $this->_redirect('/user/pool/index/page/'.$this->page.'/deleteresult/ok');
- }
- else{
- $this->_redirect('/user/pool/index/page/'.$this->page.'/deleteresult/forbidden');
- }
- }
- $this->_redirect('/user/pool/index/page/'.$this->page.'/deleteresult/error');
- }
-
- public function editpoolAction()
- {
- // ACL: is he allowed to edit a pool?
- if(!Pbs_Acl::checkRight('poe'))
- $this->_redirect('/user');
-
- if (!isset($_POST["add"])){
- $poolID = $this->_request->getParam('poolID');
- $pool = new Application_Model_Pool();
- $poolmapper = new Application_Model_PoolMapper();
- $poolmapper->find($poolID,$pool);
- if($pool->getGroupID() == $this->membership->getGroupID()){
- $poolArray = $pool->toArray();
- $editpool = new user_Form_Pool(array(
- 'buttontext' => 'Edit Pool',
- 'page' => $this->page));
- $editpool->populate($poolArray);
- $this->view->editpool = $editpool;
- }
- else{
- $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/forbidden');
- }
- }else {
- $editpoolform = new user_Form_Pool(array(
- 'buttontext' => 'Edit Pool',
- 'page' => $this->page),$_POST);
- if ($editpoolform->isValid($_POST)) {
- try{
- $poolmapper = new Application_Model_PoolMapper();
- $poolID = $this->_request->getParam('poolID');
- $pooldb = new Application_Model_Pool();
- $poolmapper->find($poolID,$pooldb);
- print_a($pooldb->getGroupID(), $this->membership->getGroupID());
- if($pooldb->getGroupID() == $this->membership->getGroupID()){
- $pool = new Application_Model_Pool($_POST);
- $pool->setID($poolID)
- ->setGroupID($this->membership->getGroupID());
- $poolmapper->save($pool);
- $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/ok');
- }
- else{
- $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/forbidden');
- }
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/error');
- }
- }
- $this->view->editpool = $editpoolform;
- }
- }
-
- public function linkclientAction()
- {
- $clientID = $this->_request->getParam('clientID');
- $poolID = $this->_request->getParam('poolID');
-
- // ACL: Is he allowed to link clients to pools?
- if(!Pbs_Acl::checkRight('polc'))
- $this->_redirect('/user');
-
- if(!isset($_POST['clientID']) && ($clientID == '')){
- $clientmapper = new Application_Model_ClientMapper();
- $clients = $clientmapper->findBy(array('groupID',$this->membership->getGroupID()),true);
- $assignedclientmapper = new Application_Model_PoolEntriesMapper();
- $assignedclients = $assignedclientmapper->fetchAll();
- foreach($assignedclients as $c){
- $assignedclientsArray[] = $c->toArray();
- }
- $freeclients = $this->arrayDiff($clients,$assignedclientsArray);
-
- $poolclient = new user_Form_PoolClient(array(
- 'buttontext' => 'Link Client',
- 'clients'=> $freeclients,
- 'page' => $this->page));
- $this->view->poolclient = $poolclient;
- }else {
- $poolclient = new user_Form_PoolClient(array(
- 'buttontext' => 'Link Client',
- 'page' => $this->page),$_POST);
- try{
- $poolID = $this->_request->getParam('poolID');
- $poolmapper = new Application_Model_PoolMapper();
- $pooldb = new Application_Model_Pool();
- $poolmapper->find($poolID,$pooldb);
- $clientmapper = new Application_Model_ClientMapper();
- $clientdb = new Application_Model_Client();
- $clientmapper->find($clientID,$clientdb);
-
- if($pooldb->getGroupID() == $this->membership->getGroupID() && $clientdb->getGroupID() == $this->membership->getGroupID()){
- $poolentriesmapper = new Application_Model_PoolEntriesMapper();
- $poolentry = new Application_Model_PoolEntries($_POST);
- $poolentry->setPoolID($poolID);
- if($poolentry->getClientID() == ''){
- $poolentry->setClientID($clientID);
- }
- $poolentriesmapper->save($poolentry);
- $this->_redirect('/user/pool/index/page/'.$this->page.'/linkresult/ok');
- }
- else{
- $this->_redirect('/user/pool/index/page/'.$this->page.'/linkresult/forbidden');
- }
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- $this->_redirect('/user/pool/index/page/'.$this->page.'/linkresult/error');
- }
- $this->view->poolclient = $poolclient;
- }
- }
-
- public function unlinkclientAction()
- {
- $poolentriesID = $this->_request->getParam('poolentriesID');
-
- // ACL: Is he allowed to unlink clients from pools?
- if(!Pbs_Acl::checkRight('pouc'))
- $this->_redirect('/user');
-
- if(is_numeric($poolentriesID)){
- $poolentriesMapper = new Application_Model_PoolEntriesMapper();
- $poolentry = new Application_Model_PoolEntries();
- $poolentriesMapper->find($poolentriesID,$poolentry);
- $clientMapper = new Application_Model_ClientMapper();
- $client = new Application_Model_Client();
-
- $poolMapper = new Application_Model_PoolMapper();
- $pool = new Application_Model_Pool();
-
- $clientMapper->find($poolentry->getClientID(),$client);
- $poolMapper->find($poolentry->getPoolID(),$pool);
-
-
- if($pool->getGroupID() == $this->membership->getGroupID() && $client->getGroupID() == $this->membership->getGroupID()){
- $deletepoolentries = new Application_Model_PoolEntries();
- $deletepoolentries->setID($poolentriesID);
- $deletepoolentriesmapper = new Application_Model_PoolEntriesMapper();
- $deletepoolentriesmapper->delete($deletepoolentries);
- $this->_redirect('/user/pool/index/page/'.$this->page.'/unlinkresult/ok');
- }
- else{
- $this->_redirect('/user/pool/index/page/'.$this->page.'/unlinkresult/forbidden');
- }
- }
- else{
- $this->_redirect('/user/pool/index/page/'.$this->page.'/unlinkresult/error');
- }
- }
-
- // creates an array of two arrays
- // first parameter is the list of all clients
- // second parameter is the list of clients which are already in a group
- // return value is a list of all clients, which are in no group
- private function arrayDiff($a, $b){
- foreach($a as $k1 => $i1){
- foreach($b as $k2 => $i2){
- if($i1['clientID'] == $i2['clientID']){
- unset($a[$k1]);
- }
- }
- }
- return $a;
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class User_PoolController extends Zend_Controller_Action {
+ private $membership;
+ protected $page;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] == '') {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('No membershipID set', 'forbidden');
+ }
+
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
+ public function indexAction() {
+ // ACL: is he allowed to see the pools of a group
+ if(!Pbs_Acl::checkRight('poo'))
+ { $this->_redirect('/user'); }
+
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+ $result = $this->_request->getParam('linkresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('link', $result);
+ }
+ $result = $this->_request->getParam('unlinkresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('unlink', $result);
+ }
+
+ // get all pools from this group
+ $poolMapper = new Application_Model_PoolMapper();
+ $pools = $poolMapper->findBy(array('groupID' => $this->membership->getGroupID()), true);
+ foreach($pools as $pool) {
+ $ff = new Application_Model_Pool();
+ $ff->setOptions($pool);
+ $ff->setID($pool['poolID']);
+ $yourpools[] = $ff;
+ }
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search) ->setModule('pool');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $yourpools = $mySearch->search($yourpools);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10)
+ ->setElement($yourpools)
+ ->setRequestPage($this->_request->getParam('page'))
+ ->setPageUrl('/user/pool/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ $yourpools = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->pools = $yourpools;
+
+
+ // Get all Clients from this group
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientsArray = $clientmapper->findBy(array('groupID' => $this->membership->getGroupID()), true);
+
+ // Get all assigned Clients
+ $assignedclientmapper = new Application_Model_PoolEntriesMapper();
+ $assignedclients = $assignedclientmapper->fetchAll();
+ foreach($assignedclients as $c) {
+ $assignedclientsArray[] = $c->toArray();
+ }
+
+ $db = Zend_Db_Table::getDefaultAdapter();
+ // extract the un-assigned clients from the clientlist of the group
+ $stmt = $db->query("SELECT c.clientID, c.groupID, macadress,hardwarehash,created
+ FROM pbs_poolentries pe RIGHT OUTER JOIN pbs_client c ON
+ c.clientID = pe.clientID
+ WHERE poolentriesID IS NULL
+ AND c.groupID = '".$this->membership->getGroupID()."'");
+
+ $freeclients = $stmt->fetchAll();
+ // 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; }
+ }
+
+ public function searchAction() {
+ $this->_redirect('/user/pool/index/search/'.($_GET['search']));
+ }
+
+ public function createpoolAction() {
+ // ACL: is he allowed to create a pool?
+ if(!Pbs_Acl::checkRight('poc'))
+ { $this->_redirect('/user'); }
+
+ if (!isset($_POST["add"])) {
+ $addfilterform = new user_Form_Pool(array(
+ 'buttontext' => 'Create Pool',
+ 'page' => $this->page));
+ $this->view->addpool = $addfilterform;
+ } else {
+ $addpoolform = new user_Form_Pool(array(
+ 'buttontext' => 'Create Pool',
+ 'page' => $this->page), $_POST);
+ if ($addpoolform->isValid($_POST)) {
+ try {
+ $pool = new Application_Model_Pool($_POST);
+ $pool->setGroupID($this->membership->getGroupID());
+ $poolmapper = new Application_Model_PoolMapper();
+ $poolmapper->save($pool);
+ $this->_redirect('/user/pool/index/addresult/ok');
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ $this->_redirect('/user/pool/index/addresult/error');
+ }
+ }
+ $this->view->addpool = $addpoolform;
+ }
+ }
+
+ public function deletepoolAction() {
+ $poolID = $this->_request->getParam('poolID');
+
+ // ACL: is he allowed to delete a pool?
+ if(!Pbs_Acl::checkRight('pod'))
+ { $this->_redirect('/user'); }
+
+ if(is_numeric($poolID)) {
+ $poolmapper = new Application_Model_PoolMapper();
+ $pool = new Application_Model_Pool();
+ $poolmapper->find($poolID, $pool);
+ if($this->membership->getGroupID() == $pool->getGroupID()) {
+ $deletepool = new Application_Model_Pool();
+ $deletepool->setID($poolID);
+ $poolmapper->delete($deletepool);
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/deleteresult/ok');
+ } else {
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/deleteresult/forbidden');
+ }
+ }
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/deleteresult/error');
+ }
+
+ public function editpoolAction() {
+ // ACL: is he allowed to edit a pool?
+ if(!Pbs_Acl::checkRight('poe'))
+ { $this->_redirect('/user'); }
+
+ if (!isset($_POST["add"])) {
+ $poolID = $this->_request->getParam('poolID');
+ $pool = new Application_Model_Pool();
+ $poolmapper = new Application_Model_PoolMapper();
+ $poolmapper->find($poolID, $pool);
+ if($pool->getGroupID() == $this->membership->getGroupID()) {
+ $poolArray = $pool->toArray();
+ $editpool = new user_Form_Pool(array(
+ 'buttontext' => 'Edit Pool',
+ 'page' => $this->page));
+ $editpool->populate($poolArray);
+ $this->view->editpool = $editpool;
+ } else {
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/forbidden');
+ }
+ } else {
+ $editpoolform = new user_Form_Pool(array(
+ 'buttontext' => 'Edit Pool',
+ 'page' => $this->page), $_POST);
+ if ($editpoolform->isValid($_POST)) {
+ try {
+ $poolmapper = new Application_Model_PoolMapper();
+ $poolID = $this->_request->getParam('poolID');
+ $pooldb = new Application_Model_Pool();
+ $poolmapper->find($poolID, $pooldb);
+ print_a($pooldb->getGroupID(), $this->membership->getGroupID());
+ if($pooldb->getGroupID() == $this->membership->getGroupID()) {
+ $pool = new Application_Model_Pool($_POST);
+ $pool->setID($poolID)
+ ->setGroupID($this->membership->getGroupID());
+ $poolmapper->save($pool);
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/ok');
+ } else {
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/forbidden');
+ }
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/modifyresult/error');
+ }
+ }
+ $this->view->editpool = $editpoolform;
+ }
+ }
+
+ public function linkclientAction() {
+ $clientID = $this->_request->getParam('clientID');
+ $poolID = $this->_request->getParam('poolID');
+
+ // ACL: Is he allowed to link clients to pools?
+ if(!Pbs_Acl::checkRight('polc'))
+ { $this->_redirect('/user'); }
+
+ if(!isset($_POST['clientID']) && ($clientID == '')) {
+ $clientmapper = new Application_Model_ClientMapper();
+ $clients = $clientmapper->findBy(array('groupID', $this->membership->getGroupID()), true);
+ $assignedclientmapper = new Application_Model_PoolEntriesMapper();
+ $assignedclients = $assignedclientmapper->fetchAll();
+ foreach($assignedclients as $c) {
+ $assignedclientsArray[] = $c->toArray();
+ }
+ $freeclients = $this->arrayDiff($clients, $assignedclientsArray);
+
+ $poolclient = new user_Form_PoolClient(array(
+ 'buttontext' => 'Link Client',
+ 'clients' => $freeclients,
+ 'page' => $this->page));
+ $this->view->poolclient = $poolclient;
+ } else {
+ $poolclient = new user_Form_PoolClient(array(
+ 'buttontext' => 'Link Client',
+ 'page' => $this->page), $_POST);
+ try {
+ $poolID = $this->_request->getParam('poolID');
+ $poolmapper = new Application_Model_PoolMapper();
+ $pooldb = new Application_Model_Pool();
+ $poolmapper->find($poolID, $pooldb);
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientdb = new Application_Model_Client();
+ $clientmapper->find($clientID, $clientdb);
+
+ if($pooldb->getGroupID() == $this->membership->getGroupID() && $clientdb->getGroupID() == $this->membership->getGroupID()) {
+ $poolentriesmapper = new Application_Model_PoolEntriesMapper();
+ $poolentry = new Application_Model_PoolEntries($_POST);
+ $poolentry->setPoolID($poolID);
+ if($poolentry->getClientID() == '') {
+ $poolentry->setClientID($clientID);
+ }
+ $poolentriesmapper->save($poolentry);
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/linkresult/ok');
+ } else {
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/linkresult/forbidden');
+ }
+ } catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/linkresult/error');
+ }
+ $this->view->poolclient = $poolclient;
+ }
+ }
+
+ public function unlinkclientAction() {
+ $poolentriesID = $this->_request->getParam('poolentriesID');
+
+ // ACL: Is he allowed to unlink clients from pools?
+ if(!Pbs_Acl::checkRight('pouc'))
+ { $this->_redirect('/user'); }
+
+ if(is_numeric($poolentriesID)) {
+ $poolentriesMapper = new Application_Model_PoolEntriesMapper();
+ $poolentry = new Application_Model_PoolEntries();
+ $poolentriesMapper->find($poolentriesID, $poolentry);
+ $clientMapper = new Application_Model_ClientMapper();
+ $client = new Application_Model_Client();
+
+ $poolMapper = new Application_Model_PoolMapper();
+ $pool = new Application_Model_Pool();
+
+ $clientMapper->find($poolentry->getClientID(), $client);
+ $poolMapper->find($poolentry->getPoolID(), $pool);
+
+
+ if($pool->getGroupID() == $this->membership->getGroupID() && $client->getGroupID() == $this->membership->getGroupID()) {
+ $deletepoolentries = new Application_Model_PoolEntries();
+ $deletepoolentries->setID($poolentriesID);
+ $deletepoolentriesmapper = new Application_Model_PoolEntriesMapper();
+ $deletepoolentriesmapper->delete($deletepoolentries);
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/unlinkresult/ok');
+ } else {
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/unlinkresult/forbidden');
+ }
+ } else {
+ $this->_redirect('/user/pool/index/page/'.$this->page.'/unlinkresult/error');
+ }
+ }
+
+ // creates an array of two arrays
+ // first parameter is the list of all clients
+ // second parameter is the list of clients which are already in a group
+ // return value is a list of all clients, which are in no group
+ private function arrayDiff($a, $b) {
+ foreach($a as $k1 => $i1) {
+ foreach($b as $k2 => $i2) {
+ if($i1['clientID'] == $i2['clientID']) {
+ unset($a[$k1]);
+ }
+ }
+ }
+ return $a;
+ }
}
diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php
index b0b1077..6e22e78 100644
--- a/application/modules/user/controllers/PrebootController.php
+++ b/application/modules/user/controllers/PrebootController.php
@@ -1,267 +1,260 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class User_PrebootController extends Zend_Controller_Action
-{
-
- protected $prebootMapper;
- protected $membershipMapper;
- protected $membership;
- protected $page;
-
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($userIDsNamespace['membershipID'] ==''){
- $this->_redirect('/user/index');
- }
-
- $this->prebootMapper = new Application_Model_PreBootMapper();
-
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
-
- $this->db = Zend_Db_Table::getDefaultAdapter();
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- $this->page = $this->_request->getParam('page');
- }
-
-
- public function indexAction()
- {
- $result = $this->_request->getParam('addresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('create',$result);
- }
- $result = $this->_request->getParam('deleteresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('delete',$result);
- }
- $result = $this->_request->getParam('modifyresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- $this->view->notification = $pbsNotifier->notify('modify',$result);
- }
-
- $groupID = $this->membership->getGroupID();
-
- //ACL Darf er PrebootMenu sehen?
- if(!Pbs_Acl::checkRight('pro'))
- $this->_redirect('/user/index');
-
- $this->view->prebootlist = $this->prebootMapper->findBy(array("groupID" => $groupID));
- foreach ($this->view->prebootlist as $preboot){
- $preboot->setCreated(date(Zend_Registry::get('dateformat'),$preboot->getCreated()));
- }
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('preboot');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->prebootlist = $mySearch->search($this->view->prebootlist);
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->view->prebootlist);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/preboot/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $this->view->prebootlist = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination();
-
- $this->view->page = $pagination->getRequestPage();
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class User_PrebootController extends Zend_Controller_Action {
+
+ protected $prebootMapper;
+ protected $membershipMapper;
+ protected $membership;
+ protected $page;
+
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] == '') {
+ $this->_redirect('/user/index');
+ }
+
+ $this->prebootMapper = new Application_Model_PreBootMapper();
+
+ $this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $this->membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ $this->page = $this->_request->getParam('page');
+ }
+
+
+ public function indexAction() {
+ $result = $this->_request->getParam('addresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('create', $result);
+ }
+ $result = $this->_request->getParam('deleteresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('delete', $result);
+ }
+ $result = $this->_request->getParam('modifyresult');
+ if($result != "") {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('modify', $result);
+ }
+
+ $groupID = $this->membership->getGroupID();
+
+ //ACL Darf er PrebootMenu sehen?
+ if(!Pbs_Acl::checkRight('pro'))
+ { $this->_redirect('/user/index'); }
+
+ $this->view->prebootlist = $this->prebootMapper->findBy(array("groupID" => $groupID));
+ foreach ($this->view->prebootlist as $preboot) {
+ $preboot->setCreated(date(Zend_Registry::get('dateformat'), $preboot->getCreated()));
+ }
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('preboot');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->prebootlist = $mySearch->search($this->view->prebootlist);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->view->prebootlist);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/preboot/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ $this->view->prebootlist = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
+
+ $this->view->page = $pagination->getRequestPage();
+
+ }
+
+ public function searchAction() {
+ $this->_redirect('/user/preboot/index/search/'.($_GET['search']));
+ }
+
+ public function createprebootAction() {
+
+ //ACL Is he allowed to create Preboots?
+ if(!Pbs_Acl::checkRight('prc'))
+ { $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/forbidden'); }
+
+ if (!isset($_POST["createpreboot"])) {
+ $prebootForm = new user_Form_Preboot(array(
+ 'action' => 'createpreboot',
+ 'page' => $this->page));
+ } else {
+
+ $prebootForm = new user_Form_Preboot(array(
+ 'action' => 'createpreboot',
+ 'page' => $this->page), $_POST);
+
+ if ($prebootForm->isValid($_POST)) {
+
+ $groupID = $this->membership->getGroupID();
+ $source = $_SERVER['REMOTE_ADDR'];
+
+ try {
+ if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != '') {
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/file');
+ }
+
+
+ $preboot = new Application_Model_PreBoot($_POST);
+
+ $preboot->setGroupID($groupID);
+ $preboot->setSource($source);
+ $preboot->setCreated(time());
+
+ $prebootID = $this->prebootMapper->save($preboot);
+
+ $prebootpath = "../resources/bootmedium/".$prebootID."/";
+ mkdir($prebootpath , 0777, true);
+
+ if($_FILES['preboot']['name'] != '') {
+ move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
+ }
+
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/error');
+ //TODO Delete folder + preboot in DB
+
+ }
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/ok');
+ }
+ }
+
+ $this->view->prebootForm = $prebootForm;
+ }
+
+ public function editprebootAction() {
+ //ACL Is he allowed to edit Preboots?
+ if(!Pbs_Acl::checkRight('pre') && !Pbs_Acl::checkRight('prem'))
+ { $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $prebootID = $this->_request->getParam('prebootID');
+
+ if (!is_numeric($prebootID))
+ { $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ $preboot = new Application_Model_PreBoot();
+ $this->prebootMapper->find($prebootID, $preboot);
+
+ if($this->membership->getGroupID() != $preboot->getGroupID())
+ { $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden'); }
+
+ if (!isset($_POST["editpreboot"])) {
+
+ $prebootForm = new user_Form_Preboot(array(
+ 'action' => 'editpreboot',
+ 'page' => $this->page));
+ $prebootForm->populate($preboot->toArray());
+
+ } else {
+
+ $prebootForm = new user_Form_Preboot(array(
+ 'action' => 'editpreboot',
+ 'page' => $this->page), $_POST);
+
+ if ($prebootForm->isValid($_POST)) {
+
+ $prebootold = $preboot;
+ $source = $_SERVER['REMOTE_ADDR'];
+
+ $preboot = new Application_Model_PreBoot($_POST);
+ $preboot->setGroupID($this->membership->getGroupID());
+ $preboot->setID($prebootID);
+ $preboot->setSource($prebootold->getSource());
+ $preboot->setCreated(time());
+
+ if($_FILES['preboot']['name'] != '') {
+ //ACL Is he allowed to edit other than Metadata?
+ if(!Pbs_Acl::checkRight('pre'))
+ { $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden'); }
+ }
+
+ if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != '') {
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/file');
+ }
+
+ $prebootpath = "../resources/bootmedium/$prebootID/";
+
+ mkdir($prebootpath , 0777, true);
+
+ if($_FILES['preboot']['name'] != '') {
+ $preboot->setSource($source);
+ move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
+ }
+
+ try {
+ $this->prebootMapper->save($preboot);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
+ //TODO Delete Folder + Preboot
+ }
+
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/ok');
+ }
+ }
+
+ $this->view->prebootForm = $prebootForm;
+ }
+
+ public function deleteprebootAction() {
+
+ //ACL Is he allowed to delete Preboots?
+ if(!Pbs_Acl::checkRight('prd'))
+ { $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ try {
+ $prebootID = $this->_request->getParam('prebootID');
+ if (!is_numeric($prebootID))
+ { $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ $preboot = new Application_Model_PreBoot();
+ $this->prebootMapper->find($prebootID, $preboot);
+
+ if($this->membership->getGroupID() != $preboot->getGroupID())
+ { $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden'); }
+
+ $this->prebootMapper->delete($preboot);
+ exec("rm -r ../resources/bootmedium/".$prebootID);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/error');
}
-
- public function searchAction(){
- $this->_redirect('/user/preboot/index/search/'.($_GET['search']));
- }
-
- public function createprebootAction()
- {
-
- //ACL Is he allowed to create Preboots?
- if(!Pbs_Acl::checkRight('prc'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/forbidden');
-
- if (!isset($_POST["createpreboot"])){
- $prebootForm = new user_Form_Preboot(array(
- 'action' => 'createpreboot',
- 'page' => $this->page));
- } else {
-
- $prebootForm = new user_Form_Preboot(array(
- 'action' => 'createpreboot',
- 'page' => $this->page),$_POST);
-
- if ($prebootForm->isValid($_POST)) {
-
- $groupID = $this->membership->getGroupID();
- $source = $_SERVER['REMOTE_ADDR'];
-
- try {
- if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != ''){
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/file');
- }
-
-
- $preboot = new Application_Model_PreBoot($_POST);
-
- $preboot->setGroupID($groupID);
- $preboot->setSource($source);
- $preboot->setCreated(time());
-
- $prebootID = $this->prebootMapper->save($preboot);
-
- $prebootpath = "../resources/bootmedium/".$prebootID."/";
- mkdir($prebootpath ,0777, true);
-
- if($_FILES['preboot']['name'] != ''){
- move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
- }
-
-
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/error');
- //TODO Delete folder + preboot in DB
-
- }
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/ok');
- }
- }
-
- $this->view->prebootForm = $prebootForm;
- }
-
- public function editprebootAction()
- {
- //ACL Is he allowed to edit Preboots?
- if(!Pbs_Acl::checkRight('pre') && !Pbs_Acl::checkRight('prem'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
-
- $prebootID = $this->_request->getParam('prebootID');
-
- if (!is_numeric($prebootID))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
-
- $preboot = new Application_Model_PreBoot();
- $this->prebootMapper->find($prebootID, $preboot);
-
- if($this->membership->getGroupID() != $preboot->getGroupID())
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
-
- if (!isset($_POST["editpreboot"])){
-
- $prebootForm = new user_Form_Preboot(array(
- 'action' => 'editpreboot',
- 'page' => $this->page));
- $prebootForm->populate($preboot->toArray());
-
- }else{
-
- $prebootForm = new user_Form_Preboot(array(
- 'action' => 'editpreboot',
- 'page' => $this->page),$_POST);
-
- if ($prebootForm->isValid($_POST)) {
-
- $prebootold = $preboot;
- $source = $_SERVER['REMOTE_ADDR'];
-
- $preboot = new Application_Model_PreBoot($_POST);
- $preboot->setGroupID($this->membership->getGroupID());
- $preboot->setID($prebootID);
- $preboot->setSource($prebootold->getSource());
- $preboot->setCreated(time());
-
- if($_FILES['preboot']['name'] != ''){
- //ACL Is he allowed to edit other than Metadata?
- if(!Pbs_Acl::checkRight('pre'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden');
- }
-
- if($_FILES['preboot']['size'] == 0 && $_FILES['preboot']['name'] != ''){
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/file');
- }
-
- $prebootpath = "../resources/bootmedium/$prebootID/";
-
- mkdir($prebootpath ,0777, true);
-
- if($_FILES['preboot']['name'] != ''){
- $preboot->setSource($source);
- move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
- }
-
- try {
- $this->prebootMapper->save($preboot);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/error');
- //TODO Delete Folder + Preboot
- }
-
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/ok');
- }
- }
-
- $this->view->prebootForm = $prebootForm;
- }
-
- public function deleteprebootAction()
- {
-
- //ACL Is he allowed to delete Preboots?
- if(!Pbs_Acl::checkRight('prd'))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
-
- try{
- $prebootID = $this->_request->getParam('prebootID');
- if (!is_numeric($prebootID))
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
-
- $preboot = new Application_Model_PreBoot();
- $this->prebootMapper->find($prebootID, $preboot);
-
- if($this->membership->getGroupID() != $preboot->getGroupID())
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden');
-
- $this->prebootMapper->delete($preboot);
- exec("rm -r ../resources/bootmedium/".$prebootID);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/error');
- }
- $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/ok');
- }
+ $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/ok');
+ }
}
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php
index 4a4640f..8d8c3c2 100644
--- a/application/modules/user/controllers/RoleController.php
+++ b/application/modules/user/controllers/RoleController.php
@@ -1,474 +1,458 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class User_RoleController extends Zend_Controller_Action
-{
- protected $userIDsNamespace = null;
- protected $membership;
- protected $membershipMapper;
+class User_RoleController extends Zend_Controller_Action {
+ protected $userIDsNamespace = null;
+ protected $membership;
+ protected $membershipMapper;
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($this->userIDsNamespace['roleID'] ==''){
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('No roleID set','forbidden');
- }
- $this->roleMapper = new Application_Model_RoleMapper();
- $this->rightMapper = new Application_Model_RightMapper();
- $this->rightRolesMapper = new Application_Model_RightRolesMapper();
- $this->membershipMapper = new Application_Model_MembershipMapper();
-
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- $this->membership = new Application_Model_Membership();
- $this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
- } else {
- $this->_helper->redirector('login', 'auth');
- }
- if($this->membership->getGroupID() == ''){
- $this->_helper->redirector('selectmembership', 'person');
- }
- }
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($this->userIDsNamespace['roleID'] == '') {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('No roleID set', 'forbidden');
+ }
+ $this->roleMapper = new Application_Model_RoleMapper();
+ $this->rightMapper = new Application_Model_RightMapper();
+ $this->rightRolesMapper = new Application_Model_RightRolesMapper();
+ $this->membershipMapper = new Application_Model_MembershipMapper();
- public function indexAction()
- {
- if(!Pbs_Acl::checkRight('ro')) {
- $this->_redirect('/user');
- }
- $this->view->membership = $this->membership;
- $groupID = $this->membership->getGroupID();
- $this->view->roleList = $this->roleMapper->findBy(array('groupID' => $groupID),true);
-
- $roles = array();
- $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
- $parents = $groupGroupsMapper->getParentGroups($groupID);
- $groupMapper = new Application_Model_GroupMapper();
- $roleMapper = new Application_Model_RoleMapper();
- $crawled = array();
- foreach($parents as $p){
- foreach($p as $a){
- if(!in_array($a,$crawled)){
- $crawled[] = $a;
- $group = $groupMapper->find($a);
- if($groupID != $a)
- $r = $roleMapper->findBy(array('groupID' => $a,'inheritance'=>"1"));
- else
- $r = $roleMapper->findBy(array('groupID' => $a));
- foreach($r as $d){
- $roles[$group->getTitle()][] = $d;
- }
- }
- }
- }
- $this->view->roleList = $roles;
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('role');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $this->view->roleList = $mySearch->search($this->view->roleList);
- }
- $this->view->searchform = $mySearch->searchForm();
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ $this->membership = new Application_Model_Membership();
+ $this->membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+ if($this->membership->getGroupID() == '') {
+ $this->_helper->redirector('selectmembership', 'person');
+ }
+ }
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10);
- $pagination->setElement($this->view->roleList);
- $pagination->setRequestPage($this->_request->getParam('page'));
- $pagination->setPageUrl('/user/role/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
+ public function indexAction() {
+ if(!Pbs_Acl::checkRight('ro')) {
+ $this->_redirect('/user');
+ }
+ $this->view->membership = $this->membership;
+ $groupID = $this->membership->getGroupID();
+ $this->view->roleList = $this->roleMapper->findBy(array('groupID' => $groupID), true);
- $this->view->roleList = $pagination->getElements();
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- $this->view->addRight = Pbs_Acl::checkRight('ra');
- $this->view->editRight = Pbs_Acl::checkRight('re');
- $this->view->deleteRight = Pbs_Acl::checkRight('rd');
- $this->view->detailsRight = Pbs_Acl::checkRight('rdd');
- $this->view->userIDsNamespace = $this->userIDsNamespace;
+ $roles = array();
+ $groupGroupsMapper = new Application_Model_GroupGroupsMapper();
+ $parents = $groupGroupsMapper->getParentGroups($groupID);
+ $groupMapper = new Application_Model_GroupMapper();
+ $roleMapper = new Application_Model_RoleMapper();
+ $crawled = array();
+ foreach($parents as $p) {
+ foreach($p as $a) {
+ if(!in_array($a, $crawled)) {
+ $crawled[] = $a;
+ $group = $groupMapper->find($a);
+ if($groupID != $a)
+ { $r = $roleMapper->findBy(array('groupID' => $a, 'inheritance' => "1")); }
+ else
+ { $r = $roleMapper->findBy(array('groupID' => $a)); }
+ foreach($r as $d) {
+ $roles[$group->getTitle()][] = $d;
+ }
+ }
+ }
+ }
+ $this->view->roleList = $roles;
- }
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('role');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $this->view->roleList = $mySearch->search($this->view->roleList);
+ }
+ $this->view->searchform = $mySearch->searchForm();
- public function searchAction(){
- if(!Pbs_Acl::checkRight('ro')) {
- $this->_redirect('/user');
- }
- $this->_redirect('/user/role/index/search/'.($_GET['search']));
- }
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10);
+ $pagination->setElement($this->view->roleList);
+ $pagination->setRequestPage($this->_request->getParam('page'));
+ $pagination->setPageUrl('/user/role/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
- public function addAction()
- {
- if(!Pbs_Acl::checkRight('ra')) {
- $this->_redirect('/user');
- }
+ $this->view->roleList = $pagination->getElements();
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->addRight = Pbs_Acl::checkRight('ra');
+ $this->view->editRight = Pbs_Acl::checkRight('re');
+ $this->view->deleteRight = Pbs_Acl::checkRight('rd');
+ $this->view->detailsRight = Pbs_Acl::checkRight('rdd');
+ $this->view->userIDsNamespace = $this->userIDsNamespace;
- $roleID = $this->userIDsNamespace['roleID'];
- $rights = $this->rightMapper->fetchAll();
- if(count($rights) > 0) {
- $rightCategoryMapper = new Application_Model_RightCategoryMapper();
- foreach($rights as $right) {
- $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
- $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
- }
- }
- if (!isset($_POST["add"])){
- $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')));
- } else {
- $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')),$_POST);
- if ($addForm->isValid($_POST)) {
- $_POST['groupID'] = $this->userIDsNamespace['groupID'];
- $role = new Application_Model_Role($_POST);
- try {
- $this->roleMapper->save($role);
- $db = Zend_Db_Table::getDefaultAdapter();
- $insertedRoleID = $db->lastInsertId();
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- foreach($_POST['rights'] as $rightID => $bool) {
- if($bool == 1) {
- $rightrole = new Application_Model_RightRoles();
- $rightrole->setRightID($rightID);
- $rightrole->setRoleID($insertedRoleID);
- try {
- $this->rightRolesMapper->save($rightrole);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- }
- }
- $this->_helper->redirector('', 'role');
- return;
- }
- }
- $this->view->addForm = $addForm;
- }
+ }
- public function editAction()
- {
- if(!Pbs_Acl::checkRight('re')) {
- $this->_redirect('/user');
- }
- $roleID = $this->_request->getParam('roleID');
- if(!isset($roleID)) {
- if(count($this->userIDsNamespace) > 0) {
- $roleID = $this->userIDsNamespace['roleID'];
- }
- }
- if(!isset($roleID)) {
- $this->_helper->redirector('add', 'role');
- return;
- } else {
- $roleMapper = new Application_Model_RoleMapper();
- $role = $roleMapper->find($roleID);
- $roleGroupID = $role->getGroupID();
- }
- if($this->userIDsNamespace['groupID'] == $roleGroupID) {
- if (!isset($_POST["save"])){
- $role = $this->roleMapper->find($roleID);
- $_POST['title'] = $role->getTitle();
- $_POST['description'] = $role->getDescription();
- $_POST['groupID'] = $role->getGroupID();
- $_POST['inheritance'] = $role->getInheritance();
- $editForm = new user_Form_RoleEdit(array('roleID' => $roleID, 'inheritanceright' => Pbs_Acl::checkRight('rir')));
- } else {
- $editForm = new user_Form_RoleEdit(array('roleID' => $roleID, 'inheritanceright' => Pbs_Acl::checkRight('rir')), $_POST);
- if ($editForm->isValid($_POST)) {
+ public function searchAction() {
+ if(!Pbs_Acl::checkRight('ro')) {
+ $this->_redirect('/user');
+ }
+ $this->_redirect('/user/role/index/search/'.($_GET['search']));
+ }
- $role = new Application_Model_Role($_POST);
- $role->setID($roleID);
- try {
- $this->roleMapper->save($role);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('', 'role');
- return;
- }
- }
- $this->view->editForm = $editForm;
- } else {
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('modify','forbidden');
- $this->_helper-> viewRenderer-> setNoRender();
- return;
- }
- }
+ public function addAction() {
+ if(!Pbs_Acl::checkRight('ra')) {
+ $this->_redirect('/user');
+ }
- public function showAction()
- {
- if(!Pbs_Acl::checkRight('rdd')) {
- $this->_redirect('/user');
- }
- $roleID = $this->_request->getParam('roleID');
- if(!isset($roleID)) {
- if(count($this->userIDsNamespace) > 0) {
- $roleID = $this->userIDsNamespace['roleID'];
- }
- }
- $this->view->membership = $this->membership;
- if($roleID) {
- $roleMapper = new Application_Model_RoleMapper();
- $role = $roleMapper->find($roleID);
- $roleGroupID = $role->getGroupID();
- if($this->userIDsNamespace['groupID'] == $roleGroupID || $role->getInheritance() == 1) {
- $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID),true);
- if(count($rightroles) > 0) {
- foreach($rightroles as $rightrole) {
- $right = $this->rightMapper->find($rightrole['rightID']);
- $rightsList[$right->getRightcategoryID()][] = $right;
- }
- if(is_array($rightsList)) {
- $this->view->rightsList = $rightsList;
- }
- }
- $rightCategoryMapper = new Application_Model_RightCategoryMapper();
- $rightCategories = $rightCategoryMapper->fetchAll();
- if(count($rightCategories) > 0) {
- foreach($rightCategories as $rightCategory) {
- $rightcategorieslist[$rightCategory->getID()] = $rightCategory->getTitle();
- }
- $this->view->rightcategorieslist = $rightcategorieslist;
- }
- $rights = $this->rightMapper->fetchAll();
- if(count($rights) == count($rightroles)) {
- $this->view->rightsAvailable = false;
- } else {
- $this->view->rightsAvailable = true;
- }
- $this->view->editRight = Pbs_Acl::checkRight('re');
- $this->view->deleteRight = Pbs_Acl::checkRight('rd');
- $this->view->addRightToRoleRight = Pbs_Acl::checkRight('rar');
- $this->view->removeRightOfRoleRight = Pbs_Acl::checkRight('rrr');
- $this->view->role = $this->roleMapper->find($roleID);
- $this->view->roleID = $roleID;
- $this->view->userIDsNamespace = $this->userIDsNamespace;
- } else {
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('view','forbidden');
- $this->_helper-> viewRenderer-> setNoRender();
- return;
- }
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
+ $roleID = $this->userIDsNamespace['roleID'];
+ $rights = $this->rightMapper->fetchAll();
+ if(count($rights) > 0) {
+ $rightCategoryMapper = new Application_Model_RightCategoryMapper();
+ foreach($rights as $right) {
+ $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
+ $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
+ }
+ }
+ if (!isset($_POST["add"])) {
+ $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')));
+ } else {
+ $addForm = new user_Form_RoleAdd(array('rightlist' => $rightlist, 'inheritanceright' => Pbs_Acl::checkRight('rir'), 'addrighttoroleright' => Pbs_Acl::checkRight('rar')), $_POST);
+ if ($addForm->isValid($_POST)) {
+ $_POST['groupID'] = $this->userIDsNamespace['groupID'];
+ $role = new Application_Model_Role($_POST);
+ try {
+ $this->roleMapper->save($role);
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $insertedRoleID = $db->lastInsertId();
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ foreach($_POST['rights'] as $rightID => $bool) {
+ if($bool == 1) {
+ $rightrole = new Application_Model_RightRoles();
+ $rightrole->setRightID($rightID);
+ $rightrole->setRoleID($insertedRoleID);
+ try {
+ $this->rightRolesMapper->save($rightrole);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ }
+ }
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
+ $this->view->addForm = $addForm;
+ }
- public function deleteAction()
- {
- if(!Pbs_Acl::checkRight('rd')) {
- $this->_redirect('/user');
- }
- $this->_helper->viewRenderer->setNoRender();
- $roleID = $this->_request->getParam('roleID');
- if(!isset($roleID)) {
- if(count($this->userIDsNamespace) > 0) {
- $roleID = $this->userIDsNamespace['roleID'];
- }
- }
- if (isset($roleID)){
- $roleMapper = new Application_Model_RoleMapper();
- $role = $roleMapper->find($roleID);
- $roleGroupID = $role->getGroupID();
- if($this->userIDsNamespace['groupID'] == $roleGroupID) {
- $role = $this->roleMapper->find($roleID);
- try {
- $this->roleMapper->delete($role);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- if($_SERVER['HTTP_REFERER']) {
- if(strpos($_SERVER['HTTP_REFERER'], '/user/role/show') !== false && strpos($_SERVER['HTTP_REFERER'], '/roleID/') === false) {
- $this->_helper->redirector('changemembership', 'person');
- } else {
- $this->_helper->redirector('', 'role');
- }
- } else {
- $this->_helper->redirector('', 'role');
- }
- return;
- } else {
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('delete','forbidden');
- $this->_helper-> viewRenderer-> setNoRender();
- return;
- }
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
+ public function editAction() {
+ if(!Pbs_Acl::checkRight('re')) {
+ $this->_redirect('/user');
+ }
+ $roleID = $this->_request->getParam('roleID');
+ if(!isset($roleID)) {
+ if(count($this->userIDsNamespace) > 0) {
+ $roleID = $this->userIDsNamespace['roleID'];
+ }
+ }
+ if(!isset($roleID)) {
+ $this->_helper->redirector('add', 'role');
+ return;
+ } else {
+ $roleMapper = new Application_Model_RoleMapper();
+ $role = $roleMapper->find($roleID);
+ $roleGroupID = $role->getGroupID();
+ }
+ if($this->userIDsNamespace['groupID'] == $roleGroupID) {
+ if (!isset($_POST["save"])) {
+ $role = $this->roleMapper->find($roleID);
+ $_POST['title'] = $role->getTitle();
+ $_POST['description'] = $role->getDescription();
+ $_POST['groupID'] = $role->getGroupID();
+ $_POST['inheritance'] = $role->getInheritance();
+ $editForm = new user_Form_RoleEdit(array('roleID' => $roleID, 'inheritanceright' => Pbs_Acl::checkRight('rir')));
+ } else {
+ $editForm = new user_Form_RoleEdit(array('roleID' => $roleID, 'inheritanceright' => Pbs_Acl::checkRight('rir')), $_POST);
+ if ($editForm->isValid($_POST)) {
- public function linkrightAction()
- {
- if(!Pbs_Acl::checkRight('rar')) {
- $this->_redirect('/user');
- }
- $roleID = $this->_request->getParam('roleID');
- if(!isset($roleID)) {
- if(count($this->userIDsNamespace) > 0) {
- $roleID = $this->userIDsNamespace['roleID'];
- }
- }
- if(isset($roleID)) {
- $roleMapper = new Application_Model_RoleMapper();
- $role = $roleMapper->find($roleID);
- $roleGroupID = $role->getGroupID();
- if($this->userIDsNamespace['groupID'] == $roleGroupID) {
- $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID),true);
- $rights = $this->rightMapper->fetchAll();
- if(count($rightroles) > 0) {
- if(count($rights) > 0) {
- $rightCategoryMapper = new Application_Model_RightCategoryMapper();
- foreach($rights as $right) {
- foreach($rightroles as $rightrole) {
- if($right->getID() == $rightrole['rightID']) {
- $found = true;
- break;
- }
- }
- if(!$found) {
- $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
- $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
- }
- $found = false;
- }
- }
- } else {
- $rightCategoryMapper = new Application_Model_RightCategoryMapper();
- foreach($rights as $right) {
- $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
- $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
- }
- }
- if(count($rightlist) > 0) {
- if (!isset($_POST["link"])){
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist));
- } else {
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, $_POST));
- if ($linkForm->isValid($_POST)) {
- foreach($_POST['rights'] as $rightID => $bool) {
- if($bool == 1) {
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRightID($rightID);
- $rightroles->setRoleID($roleID);
+ $role = new Application_Model_Role($_POST);
+ $role->setID($roleID);
+ try {
+ $this->roleMapper->save($role);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
+ $this->view->editForm = $editForm;
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('modify', 'forbidden');
+ $this->_helper-> viewRenderer-> setNoRender();
+ return;
+ }
+ }
- try {
- $this->rightRolesMapper->save($rightroles);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- }
- }
- $this->_redirect('/user/role/show/roleID/' . $roleID);
- return;
- }
- }
- $this->view->linkForm = $linkForm;
- } else {
- $this->_redirect('/user/role/show/roleID/' . $roleID);
- return;
- }
+ public function showAction() {
+ if(!Pbs_Acl::checkRight('rdd')) {
+ $this->_redirect('/user');
+ }
+ $roleID = $this->_request->getParam('roleID');
+ if(!isset($roleID)) {
+ if(count($this->userIDsNamespace) > 0) {
+ $roleID = $this->userIDsNamespace['roleID'];
+ }
+ }
+ $this->view->membership = $this->membership;
+ if($roleID) {
+ $roleMapper = new Application_Model_RoleMapper();
+ $role = $roleMapper->find($roleID);
+ $roleGroupID = $role->getGroupID();
+ if($this->userIDsNamespace['groupID'] == $roleGroupID || $role->getInheritance() == 1) {
+ $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID), true);
+ if(count($rightroles) > 0) {
+ foreach($rightroles as $rightrole) {
+ $right = $this->rightMapper->find($rightrole['rightID']);
+ $rightsList[$right->getRightcategoryID()][] = $right;
+ }
+ if(is_array($rightsList)) {
+ $this->view->rightsList = $rightsList;
+ }
+ }
+ $rightCategoryMapper = new Application_Model_RightCategoryMapper();
+ $rightCategories = $rightCategoryMapper->fetchAll();
+ if(count($rightCategories) > 0) {
+ foreach($rightCategories as $rightCategory) {
+ $rightcategorieslist[$rightCategory->getID()] = $rightCategory->getTitle();
+ }
+ $this->view->rightcategorieslist = $rightcategorieslist;
+ }
+ $rights = $this->rightMapper->fetchAll();
+ if(count($rights) == count($rightroles)) {
+ $this->view->rightsAvailable = false;
+ } else {
+ $this->view->rightsAvailable = true;
+ }
+ $this->view->editRight = Pbs_Acl::checkRight('re');
+ $this->view->deleteRight = Pbs_Acl::checkRight('rd');
+ $this->view->addRightToRoleRight = Pbs_Acl::checkRight('rar');
+ $this->view->removeRightOfRoleRight = Pbs_Acl::checkRight('rrr');
+ $this->view->role = $this->roleMapper->find($roleID);
+ $this->view->roleID = $roleID;
+ $this->view->userIDsNamespace = $this->userIDsNamespace;
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('view', 'forbidden');
+ $this->_helper-> viewRenderer-> setNoRender();
+ return;
+ }
+ } else {
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
- } else {
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('link','forbidden');
- $this->_helper-> viewRenderer-> setNoRender();
- return;
- }
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
+ public function deleteAction() {
+ if(!Pbs_Acl::checkRight('rd')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $roleID = $this->_request->getParam('roleID');
+ if(!isset($roleID)) {
+ if(count($this->userIDsNamespace) > 0) {
+ $roleID = $this->userIDsNamespace['roleID'];
+ }
+ }
+ if (isset($roleID)) {
+ $roleMapper = new Application_Model_RoleMapper();
+ $role = $roleMapper->find($roleID);
+ $roleGroupID = $role->getGroupID();
+ if($this->userIDsNamespace['groupID'] == $roleGroupID) {
+ $role = $this->roleMapper->find($roleID);
+ try {
+ $this->roleMapper->delete($role);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ if($_SERVER['HTTP_REFERER']) {
+ if(strpos($_SERVER['HTTP_REFERER'], '/user/role/show') != = false && strpos($_SERVER['HTTP_REFERER'], '/roleID/') == = false) {
+ $this->_helper->redirector('changemembership', 'person');
+ } else {
+ $this->_helper->redirector('', 'role');
+ }
+ } else {
+ $this->_helper->redirector('', 'role');
+ }
+ return;
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('delete', 'forbidden');
+ $this->_helper-> viewRenderer-> setNoRender();
+ return;
+ }
+ } else {
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
- public function unlinkrightAction()
- {
- if(!Pbs_Acl::checkRight('rrr')) {
- $this->_redirect('/user');
- }
- $this->_helper-> viewRenderer-> setNoRender();
- $rightRolesID = $this->_request->getParam('rightrolesID');
- if(isset($rightRolesID)) {
- $rightRolesID = explode('-',$rightRolesID);
- $roleID = $rightRolesID[0];
- if($rightRolesID[1] == 'all') {
- $rightRolesMapper = new Application_Model_RightRolesMapper();
- $rightroleslist = $rightRolesMapper->findBy(array('roleID' => $roleID));
- foreach($rightroleslist as $rightroles) {
- try {
- $this->rightRolesMapper->delete($rightroles);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- }
- $this->_redirect('/user/role/show/roleID/' . $roleID);
- return;
- } else {
- $rightID = $rightRolesID[1];
- if (isset($roleID) && isset($rightID)){
- $roleMapper = new Application_Model_RoleMapper();
- $role = $roleMapper->find($roleID);
- $roleGroupID = $role->getGroupID();
- if($this->userIDsNamespace['groupID'] == $roleGroupID) {
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRoleID($roleID);
- $rightroles->setRightID($rightID);
- try {
- $this->rightRolesMapper->delete($rightroles);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
+ public function linkrightAction() {
+ if(!Pbs_Acl::checkRight('rar')) {
+ $this->_redirect('/user');
+ }
+ $roleID = $this->_request->getParam('roleID');
+ if(!isset($roleID)) {
+ if(count($this->userIDsNamespace) > 0) {
+ $roleID = $this->userIDsNamespace['roleID'];
+ }
+ }
+ if(isset($roleID)) {
+ $roleMapper = new Application_Model_RoleMapper();
+ $role = $roleMapper->find($roleID);
+ $roleGroupID = $role->getGroupID();
+ if($this->userIDsNamespace['groupID'] == $roleGroupID) {
+ $rightroles = $this->rightRolesMapper->findBy(array('roleID' => $roleID), true);
+ $rights = $this->rightMapper->fetchAll();
+ if(count($rightroles) > 0) {
+ if(count($rights) > 0) {
+ $rightCategoryMapper = new Application_Model_RightCategoryMapper();
+ foreach($rights as $right) {
+ foreach($rightroles as $rightrole) {
+ if($right->getID() == $rightrole['rightID']) {
+ $found = true;
+ break;
+ }
+ }
+ if(!$found) {
+ $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
+ $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
+ }
+ $found = false;
+ }
+ }
+ } else {
+ $rightCategoryMapper = new Application_Model_RightCategoryMapper();
+ foreach($rights as $right) {
+ $rightCategory = $rightCategoryMapper->find($right->getRightcategoryID());
+ $rightlist[$rightCategory->getTitle()][$right->getID()] = $right->getTitle();
+ }
+ }
+ if(count($rightlist) > 0) {
+ if (!isset($_POST["link"])) {
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist));
+ } else {
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, $_POST));
+ if ($linkForm->isValid($_POST)) {
+ foreach($_POST['rights'] as $rightID => $bool) {
+ if($bool == 1) {
+ $rightroles = new Application_Model_RightRoles();
+ $rightroles->setRightID($rightID);
+ $rightroles->setRoleID($roleID);
- }
- $this->_redirect('/user/role/show/roleID/' . $roleID);
- return;
- } else {
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('unlink','forbidden');
- $this->_helper-> viewRenderer-> setNoRender();
- return;
- }
- }
- }
- } else {
- $this->_helper->redirector('', 'role');
- return;
- }
- }
+ try {
+ $this->rightRolesMapper->save($rightroles);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ }
+ }
+ $this->_redirect('/user/role/show/roleID/' . $roleID);
+ return;
+ }
+ }
+ $this->view->linkForm = $linkForm;
+ } else {
+ $this->_redirect('/user/role/show/roleID/' . $roleID);
+ return;
+ }
+
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('link', 'forbidden');
+ $this->_helper-> viewRenderer-> setNoRender();
+ return;
+ }
+ } else {
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
+
+ public function unlinkrightAction() {
+ if(!Pbs_Acl::checkRight('rrr')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper-> viewRenderer-> setNoRender();
+ $rightRolesID = $this->_request->getParam('rightrolesID');
+ if(isset($rightRolesID)) {
+ $rightRolesID = explode('-', $rightRolesID);
+ $roleID = $rightRolesID[0];
+ if($rightRolesID[1] == 'all') {
+ $rightRolesMapper = new Application_Model_RightRolesMapper();
+ $rightroleslist = $rightRolesMapper->findBy(array('roleID' => $roleID));
+ foreach($rightroleslist as $rightroles) {
+ try {
+ $this->rightRolesMapper->delete($rightroles);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ }
+ $this->_redirect('/user/role/show/roleID/' . $roleID);
+ return;
+ } else {
+ $rightID = $rightRolesID[1];
+ if (isset($roleID) && isset($rightID)) {
+ $roleMapper = new Application_Model_RoleMapper();
+ $role = $roleMapper->find($roleID);
+ $roleGroupID = $role->getGroupID();
+ if($this->userIDsNamespace['groupID'] == $roleGroupID) {
+ $rightroles = new Application_Model_RightRoles();
+ $rightroles->setRoleID($roleID);
+ $rightroles->setRightID($rightID);
+ try {
+ $this->rightRolesMapper->delete($rightroles);
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+
+ }
+ $this->_redirect('/user/role/show/roleID/' . $roleID);
+ return;
+ } else {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('unlink', 'forbidden');
+ $this->_helper-> viewRenderer-> setNoRender();
+ return;
+ }
+ }
+ }
+ } else {
+ $this->_helper->redirector('', 'role');
+ return;
+ }
+ }
}
diff --git a/application/modules/user/controllers/SessionController.php b/application/modules/user/controllers/SessionController.php
index 0e32e48..2d41f9e 100644
--- a/application/modules/user/controllers/SessionController.php
+++ b/application/modules/user/controllers/SessionController.php
@@ -1,119 +1,116 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class User_SessionController extends Zend_Controller_Action
-{
- private $membership;
- public function init()
- {
- if (Zend_Auth::getInstance()->hasIdentity()) {
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if($userIDsNamespace['membershipID'] ==''){
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('No membershipID set','forbidden');
- }
-
- $membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- $membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
- } else {
- $this->_helper->redirector('login', 'auth');
- }
-
- $this->page = $this->_request->getParam('page');
- }
-
- public function indexAction()
- {
- if(!Pbs_Acl::checkRight('so'))
- $this->_redirect('/user/index');
-
- $sessionMapper = new Application_Model_SessionMapper();
- $bootisoMapper = new Application_Model_BootIsoMapper();
- $bootosMapper = new Application_Model_BootOsMapper();
- $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $membershipMapper = new Application_Model_MembershipMapper();
- $personMapper = new Application_Model_PersonMapper();
-
- $bootisos = $bootisoMapper->findBy(array('groupID'=>$this->membership->getGroupID()));
- foreach($bootisos as $bootiso){
- $sessions = $sessionMapper->findBy(array('bootisoID'=>$bootiso->getID()));
- foreach($sessions as $session){
- #echo $session->getBootosID();
- if($session->getBootosID() != ''){
- $bo = $bootosMapper->find($session->getBootosID());
- if($bo != null)
- $session->setBootosID("[".$session->getBootosID()."] ".$bo->getTitle());
- }
-
- if($session->getBootmenuentryID() != ''){
- $bm = $bootmenuentriesMapper->find($session->getBootmenuentryID());
- if($bm != null)
- $session->setBootmenuentryID("[".$session->getBootmenuentryID()."] ".$bm->getTitle());
-
- }
-
- if($session->getBootisoID() != ''){
- $bi = $bootisoMapper->find($session->getBootisoID());
- if($bi != null)
- $session->setBootisoID("[".$session->getBootisoID()."] ".$bi->getTitle());
- }
-
- if($session->getMembershipID() != ''){
- $personID = $membershipMapper->find($session->getMembershipID())->getPersonID();
- $p = new Application_Model_Person();
- $personMapper->find($personID,$p);
- if($p != null)
- $session->setMembershipID("[".$session->getMembershipID()."] ".$p->getFirstname()." ".$p->getName());
- }
- $session->setTime(date(Zend_Registry::get('dateformat'),$session->getTime()));
- $mySessions[] =$session;
- }
- }
- // Sort after date/id
- usort($mySessions, 'sortFunc');
-
- // Search
- $search = $this->_request->getParam('search');
- $mySearch = new Pbs_Search();
- $mySearch->setSearchTerm($search);
- $mySearch->setModule('session');
- if($search != ''){
- $this->view->search = $mySearch->getSearchTerm();
- $mySessions = $mySearch->search($mySessions);
- }
- $this->view->searchform = $mySearch->searchForm();
-
- // Pagination
- $pagination = new Pbs_Pagination();
- $pagination->setPerPage(10)
- ->setElement($mySessions)
- ->setRequestPage($this->_request->getParam('page'))
- ->setPageUrl('/user/session/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $mySessions = $pagination->getElements();
-
- $this->view->pagination = $pagination->pagination();
- $this->view->page = $pagination->getRequestPage();
- $this->view->sessions = $mySessions;
-
- }
-
- public function searchAction(){
- $this->_redirect('/user/session/index/search/'.($_GET['search']));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class User_SessionController extends Zend_Controller_Action {
+ private $membership;
+ public function init() {
+ if (Zend_Auth::getInstance()->hasIdentity()) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if($userIDsNamespace['membershipID'] == '') {
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('No membershipID set', 'forbidden');
+ }
+
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ $membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+ } else {
+ $this->_helper->redirector('login', 'auth');
+ }
+
+ $this->page = $this->_request->getParam('page');
+ }
+
+ public function indexAction() {
+ if(!Pbs_Acl::checkRight('so'))
+ { $this->_redirect('/user/index'); }
+
+ $sessionMapper = new Application_Model_SessionMapper();
+ $bootisoMapper = new Application_Model_BootIsoMapper();
+ $bootosMapper = new Application_Model_BootOsMapper();
+ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $personMapper = new Application_Model_PersonMapper();
+
+ $bootisos = $bootisoMapper->findBy(array('groupID' => $this->membership->getGroupID()));
+ foreach($bootisos as $bootiso) {
+ $sessions = $sessionMapper->findBy(array('bootisoID' => $bootiso->getID()));
+ foreach($sessions as $session) {
+#echo $session->getBootosID();
+ if($session->getBootosID() != '') {
+ $bo = $bootosMapper->find($session->getBootosID());
+ if($bo != null)
+ { $session->setBootosID("[".$session->getBootosID()."] ".$bo->getTitle()); }
+ }
+
+ if($session->getBootmenuentryID() != '') {
+ $bm = $bootmenuentriesMapper->find($session->getBootmenuentryID());
+ if($bm != null)
+ { $session->setBootmenuentryID("[".$session->getBootmenuentryID()."] ".$bm->getTitle()); }
+
+ }
+
+ if($session->getBootisoID() != '') {
+ $bi = $bootisoMapper->find($session->getBootisoID());
+ if($bi != null)
+ { $session->setBootisoID("[".$session->getBootisoID()."] ".$bi->getTitle()); }
+ }
+
+ if($session->getMembershipID() != '') {
+ $personID = $membershipMapper->find($session->getMembershipID())->getPersonID();
+ $p = new Application_Model_Person();
+ $personMapper->find($personID, $p);
+ if($p != null)
+ { $session->setMembershipID("[".$session->getMembershipID()."] ".$p->getFirstname()." ".$p->getName()); }
+ }
+ $session->setTime(date(Zend_Registry::get('dateformat'), $session->getTime()));
+ $mySessions[] = $session;
+ }
+ }
+ // Sort after date/id
+ usort($mySessions, 'sortFunc');
+
+ // Search
+ $search = $this->_request->getParam('search');
+ $mySearch = new Pbs_Search();
+ $mySearch->setSearchTerm($search);
+ $mySearch->setModule('session');
+ if($search != '') {
+ $this->view->search = $mySearch->getSearchTerm();
+ $mySessions = $mySearch->search($mySessions);
+ }
+ $this->view->searchform = $mySearch->searchForm();
+
+ // Pagination
+ $pagination = new Pbs_Pagination();
+ $pagination->setPerPage(10)
+ ->setElement($mySessions)
+ ->setRequestPage($this->_request->getParam('page'))
+ ->setPageUrl('/user/session/index'.((isset($this->view->search)) ? '/search/'.$this->view->search : ''));
+ $mySessions = $pagination->getElements();
+
+ $this->view->pagination = $pagination->pagination();
+ $this->view->page = $pagination->getRequestPage();
+ $this->view->sessions = $mySessions;
+
+ }
+
+ public function searchAction() {
+ $this->_redirect('/user/session/index/search/'.($_GET['search']));
+ }
}
function sortFunc($func_a, $func_b) {
- if($func_a->getID() == $func_b->getID()) return 0;
- return ($func_a->getID() < $func_b->getID()) ? 1 : -1;
+ if($func_a->getID() == $func_b->getID()) { return 0; }
+ return ($func_a->getID() < $func_b->getID()) ? 1 : -1;
}
diff --git a/application/modules/user/forms/Bootiso.php b/application/modules/user/forms/Bootiso.php
index 091f448..1797e2d 100644
--- a/application/modules/user/forms/Bootiso.php
+++ b/application/modules/user/forms/Bootiso.php
@@ -1,161 +1,160 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_Bootiso extends Zend_Form
-{
-
- private $prebootlist;
- private $groupdepth;
- private $action;
- private $page;
-
- public function setAction($action){
- $this->action = $action;
- }
- public function setPrebootlist($prebootlist){
- $this->prebootlist = $prebootlist;
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_Bootiso extends Zend_Form {
+
+ private $prebootlist;
+ private $groupdepth;
+ private $action;
+ private $page;
+
+ public function setAction($action) {
+ $this->action = $action;
+ }
+ public function setPrebootlist($prebootlist) {
+ $this->prebootlist = $prebootlist;
+ }
+ public function setGroupdepth($groupdepth) {
+ $this->groupdepth = $groupdepth;
+ }
+ public function setPage($p) {
+ $this->page = $p;
+ }
+
+ public function init() {
+ $this->setName($this->action);
+ $this->setMethod('post');
+
+ if (!Pbs_Acl::checkRight('be') && $this->action == 'editbootiso')
+ { $meta = true; }
+ else
+ { $meta = null; }
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Description:',
+ ));
+
+ $prebootfield = $this->createElement('select', 'prebootID');
+ $prebootfield->setLabel('Preboot:');
+ $prebootfield->setAttrib('readOnly', $meta);
+
+ if(count($this->prebootlist) > 0) {
+ foreach($this->prebootlist as $preboot => $p) {
+ $prebootfield->addMultiOption($p->getID(), $p->getTitle());
+ }
}
- public function setGroupdepth($groupdepth){
- $this->groupdepth = $groupdepth;
+ $prebootfield->setRegisterInArrayValidator(false);
+ $this->addElement($prebootfield);
+
+ $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
+ ));
+
+ $date = new DateTime();
+ $date->add(new DateInterval('P1Y'));
+ $this->addElement('text', 'expires', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Expires:',
+ 'readOnly' => $meta,
+ 'value' => $date->format('Y-m-d'),
+ ));
+
+ $publicfield = $this->createElement('select', 'public');
+ $publicfield->setLabel('Public:');
+ $publicfield->addMultiOption(-1, 'X. Not Visible');
+ $publicfield->addMultiOption(0, '0. Eigene Gruppe');
+ $publicfield->setAttrib('readOnly', $meta);
+ $publicfield->setAttrib('id', 'depth');
+ $publicfield->setAttrib('onchange', "$('#groups .v1').show();changeDepth();");
+
+ for($i = 1; $i < $this->groupdepth; $i++) {
+ $publicfield->addMultiOption($i, "$i. Untergruppe");
}
- public function setPage($p){
- $this->page = $p;
- }
-
- public function init()
- {
- $this->setName($this->action);
- $this->setMethod('post');
-
- if (!Pbs_Acl::checkRight('be') && $this->action == 'editbootiso')
- $meta = true;
- else
- $meta = null;
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
-
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'rows' => 5,
- 'cols' => 50,
- 'label' => 'Description:',
- ));
-
- $prebootfield = $this->createElement('select','prebootID');
- $prebootfield->setLabel('Preboot:');
- $prebootfield->setAttrib('readOnly', $meta);
-
- if(count($this->prebootlist)>0){
- foreach($this->prebootlist as $preboot => $p){
- $prebootfield->addMultiOption($p->getID(), $p->getTitle());
- }
- }
- $prebootfield->setRegisterInArrayValidator(false);
- $this->addElement($prebootfield);
-
- $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
- ));
-
- $date = new DateTime();
- $date->add(new DateInterval('P1Y'));
- $this->addElement('text', 'expires', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Expires:',
- 'readOnly' => $meta,
- 'value' => $date->format('Y-m-d'),
- ));
-
- $publicfield = $this->createElement('select','public');
- $publicfield->setLabel('Public:');
- $publicfield->addMultiOption(-1, 'X. Not Visible');
- $publicfield->addMultiOption(0, '0. Eigene Gruppe');
- $publicfield->setAttrib('readOnly', $meta);
- $publicfield->setAttrib('id', 'depth');
- $publicfield->setAttrib('onchange', "$('#groups .v1').show();changeDepth();");
-
- for($i=1; $i<$this->groupdepth; $i++){
- $publicfield->addMultiOption($i, "$i. Untergruppe");
- }
-
- $publicfield->setRegisterInArrayValidator(false);
- $this->addElement($publicfield);
-
- if($this->action == "createbootiso")
- $label = "Create BootMedium";
- else
- $label = "Edit BootMedium";
-
- $this->addElement('submit', $this->action, array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $label,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/bootiso/index/page/'.$this->page.'"'
- ));
- ?>
-
- <script type="text/javascript">
- $(document).ready(function(){
- changeDepth();
- $('#groups .v1').show();
- });
- function changeDepth(){
- i = $("#depth option:selected").val();
- $('#depthimg').attr('src','/stats/graphgroup/level/' + i);
- }
- </script>
-
- <div id='groups' style='text-align: center;'>
- <div class='v1'>
- <img alt='Please select a public level' id='depthimg' src='/stats/graphgroup/level/0' />
- </div>
- </div>
-
-
-
-<?php
+
+ $publicfield->setRegisterInArrayValidator(false);
+ $this->addElement($publicfield);
+
+ if($this->action == "createbootiso")
+ { $label = "Create BootMedium"; }
+ else
+ { $label = "Edit BootMedium"; }
+
+ $this->addElement('submit', $this->action, array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $label,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/bootiso/index/page/'.$this->page.'"'
+ ));
+ ? >
+
+ < script type = "text/javascript" >
+ $(document).ready(function() {
+ changeDepth();
+ $('#groups .v1').show();
+ });
+ function changeDepth() {
+ i = $("#depth option:selected").val();
+ $('#depthimg').attr('src', '/stats/graphgroup/level/' + i);
}
+ < / script >
+
+ < div id = 'groups' style = 'text-align: center;' >
+ < div class = 'v1' >
+ < img alt = 'Please select a public level' id = 'depthimg'
+ src = '/stats/graphgroup/level/0' / >
+ < / div >
+ < / div >
+
+
+
+ <? php
+ }
+
-
}
-?>
+ ? >
diff --git a/application/modules/user/forms/Bootmenu.php b/application/modules/user/forms/Bootmenu.php
index 0a827d9..5a47313 100644
--- a/application/modules/user/forms/Bootmenu.php
+++ b/application/modules/user/forms/Bootmenu.php
@@ -1,80 +1,78 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_Bootmenu extends Zend_Form
-{
- private $action;
- private $page;
- private $type;
-
- public function setAction($action){
- $this->action = $action;
-
- }
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
- }
-
- public function setPage($page){
- $this->page = $page;
- }
- public function setType($type){
- $this->type = $type;
- }
-
- public function init()
- {
- $this->setName($this->action);
- $this->setMethod('post');
-
- if (!Pbs_Acl::checkRight('booee') && $this->action == 'editbootmenu')
- $meta = true;
- else
- $meta = null;
+class user_Form_Bootmenu extends Zend_Form {
+ private $action;
+ private $page;
+ private $type;
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
- $this->addElement('text', 'startcounter', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('Int'),
- ),
- 'required' => true,
- 'label' => 'Startcounter:',
- ));
-
- if($this->action == "createbootmenu")
- $label = "Create Bootmenu";
- else
- $label = "Edit Bootmenu";
-
- $this->addElement('submit', $this->action, array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $label,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'"'
- ));
+ public function setAction($action) {
+ $this->action = $action;
- }
+ }
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+ }
+
+ public function setPage($page) {
+ $this->page = $page;
+ }
+ public function setType($type) {
+ $this->type = $type;
+ }
+
+ public function init() {
+ $this->setName($this->action);
+ $this->setMethod('post');
+
+ if (!Pbs_Acl::checkRight('booee') && $this->action == 'editbootmenu')
+ { $meta = true; }
+ else
+ { $meta = null; }
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+ $this->addElement('text', 'startcounter', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('Int'),
+ ),
+ 'required' => true,
+ 'label' => 'Startcounter:',
+ ));
+
+ if($this->action == "createbootmenu")
+ { $label = "Create Bootmenu"; }
+ else
+ { $label = "Edit Bootmenu"; }
+
+ $this->addElement('submit', $this->action, array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $label,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'"'
+ ));
+
+ }
}
diff --git a/application/modules/user/forms/BootmenuEntries.php b/application/modules/user/forms/BootmenuEntries.php
index 93e3206..8c92cb1 100644
--- a/application/modules/user/forms/BootmenuEntries.php
+++ b/application/modules/user/forms/BootmenuEntries.php
@@ -1,176 +1,174 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_BootmenuEntries extends Zend_Form
-{
- private $bootoslist;
- private $bootosanzeige;
- private $configlist;
- private $maxorder;
- private $action;
- private $page;
- private $type;
-
- public function setAction($action){
- $this->action = $action;
-
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_BootmenuEntries extends Zend_Form {
+ private $bootoslist;
+ private $bootosanzeige;
+ private $configlist;
+ private $maxorder;
+ private $action;
+ private $page;
+ private $type;
+
+ public function setAction($action) {
+ $this->action = $action;
+
+ }
+
+ public function setBootoslist($bootoslist) {
+ $this->bootoslist = $bootoslist;
+ }
+ public function setBootosanzeige($bootosanzeige) {
+ $this->bootosanzeige = $bootosanzeige;
+ }
+
+ public function setMaxorder($maxorder) {
+ $this->maxorder = $maxorder;
+
+ }
+
+ public function setConfiglist($configlist) {
+ $this->configlist = $configlist;
+ }
+
+ public function setType($type) {
+ $this->type = $type;
+ }
+
+ public function setPage($page) {
+ $this->page = $page;
+ }
+
+
+ public function init() {
+
+ if(!isset($_POST['bootosID'])) {
+ list($key) = array_keys($this->bootoslist);
+ $firstbootos = $this->bootoslist[$key];
+ $_POST['bootosID'] = $firstbootos->getID();
- public function setBootoslist($bootoslist){
- $this->bootoslist = $bootoslist;
- }
- public function setBootosanzeige($bootosanzeige){
- $this->bootosanzeige = $bootosanzeige;
}
-
- public function setMaxorder($maxorder){
- $this->maxorder = $maxorder;
-
+
+ $this->setName($this->action);
+ $this->setMethod('post');
+
+ if (!Pbs_Acl::checkRight('booee') && $this->action == 'editbootmenuentry')
+ { $meta = true; }
+ else
+ { $meta = null; }
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $bootosfield = $this->createElement('select', 'bootosID');
+ $bootosfield ->setLabel('BootOs:');
+ $bootosfield->setAttrib('onChange', "document.getElementById('".$this->action."').submit();");
+ $bootosfield->setAttrib('readOnly', $meta);
+ $bootosfield->addMultiOptions($this->bootosanzeige);
+ $bootosfield->setRegisterInArrayValidator(false);
+ $this->addElement($bootosfield);
+
+ $kclactive = $this->createElement('checkbox', 'kcl');
+ $kclactive->setAttrib('onChange', "document.getElementById('".$this->action."').submit();");
+ $kclactive->setLabel('Use default KCL:');
+ $kclactive->setValue($_POST['kcl']);
+ $this->addElement($kclactive);
+
+
+ if($_POST['kcl']) {
+ $this->addElement('textarea', 'defaultkcl', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'cols' => 50,
+ 'rows' => 5,
+ 'label' => 'KCL:',
+ 'readOnly' => true,
+ 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl()
+
+ ));
}
-
- public function setConfiglist($configlist){
- $this->configlist = $configlist;
+
+ if($_POST['kcl'])
+ { $kcllength = 175 - strlen($this->bootoslist[$_POST['bootosID']]->getDefaultkcl()); }
+ else
+ { $kcllength = 175; }
+
+ $this->addElement('textarea', 'kclappend', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, $kcllength)),
+ ),
+ 'required' => false,
+ 'cols' => 50,
+ 'rows' => 5,
+ 'label' => 'KCL-Append:',
+ 'readOnly' => $meta,
+ 'description' => 'Chars left: ' . $kcllength
+ ));
+
+ $configfield = $this->createElement('select', 'configID');
+ $configfield->setLabel('Config:');
+ $configfield->setAttrib('readOnly', $meta);
+
+ $options = array('Preset' => array(), 'Custom' => array());
+
+ if(count($this->configlist) > 0) {
+ foreach($this->configlist as $k => $v) {
+ foreach($v[$_POST['bootosID']] as $c)
+ $options[$k][$c->getID()] = $c->getTitle();
+ }
}
-
- public function setType($type){
- $this->type = $type;
- }
-
- public function setPage($page){
- $this->page = $page;
- }
-
-
- public function init()
- {
-
- if(!isset($_POST['bootosID'])){
- list($key) = array_keys($this->bootoslist);
- $firstbootos = $this->bootoslist[$key];
- $_POST['bootosID'] = $firstbootos->getID();
-
- }
-
- $this->setName($this->action);
- $this->setMethod('post');
-
- if (!Pbs_Acl::checkRight('booee') && $this->action == 'editbootmenuentry')
- $meta = true;
- else
- $meta = null;
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $bootosfield = $this->createElement('select','bootosID');
- $bootosfield ->setLabel('BootOs:');
- $bootosfield->setAttrib('onChange', "document.getElementById('".$this->action."').submit();");
- $bootosfield->setAttrib('readOnly', $meta);
- $bootosfield->addMultiOptions($this->bootosanzeige);
- $bootosfield->setRegisterInArrayValidator(false);
- $this->addElement($bootosfield);
-
- $kclactive = $this->createElement('checkbox','kcl');
- $kclactive->setAttrib('onChange', "document.getElementById('".$this->action."').submit();");
- $kclactive->setLabel('Use default KCL:');
- $kclactive->setValue($_POST['kcl']);
- $this->addElement($kclactive);
-
-
- if($_POST['kcl']){
- $this->addElement('textarea', 'defaultkcl', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'cols' => 50,
- 'rows' => 5,
- 'label' => 'KCL:',
- 'readOnly' => true,
- 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl()
-
- ));
- }
-
- if($_POST['kcl'])
- $kcllength = 175 - strlen($this->bootoslist[$_POST['bootosID']]->getDefaultkcl());
- else
- $kcllength = 175;
-
- $this->addElement('textarea', 'kclappend', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, $kcllength)),
- ),
- 'required' => false,
- 'cols' => 50,
- 'rows' => 5,
- 'label' => 'KCL-Append:',
- 'readOnly' => $meta,
- 'description' => 'Chars left: ' . $kcllength
- ));
-
- $configfield = $this->createElement('select','configID');
- $configfield->setLabel('Config:');
- $configfield->setAttrib('readOnly', $meta);
-
- $options = array('Preset' => array(), 'Custom' => array());
-
- if(count($this->configlist)>0){
- foreach($this->configlist as $k => $v){
- foreach($v[$_POST['bootosID']] as $c)
- $options[$k][$c->getID()] = $c->getTitle();
- }
- }
- $configfield->addMultiOptions($options);
- $configfield->setRegisterInArrayValidator(false);
- $this->addElement($configfield);
-
- $orderfield = $this->createElement('select','order');
- $orderfield ->setLabel('Position:');
- $orderfield->setAttrib('readOnly', $meta);
-
- for ($i = 0; $i <= $this->maxorder; $i++) {
- $orderfield->addMultiOption($i, $i+1);
- }
- $orderfield->setRegisterInArrayValidator(false);
- $this->addElement($orderfield);
-
-
- if($this->action == "addbootmenuentry")
- $label = "Add Bootmenuentry";
- else
- $label = "Edit Bootmenuentry";
-
- $this->addElement('submit', $this->action, array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $label,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'"'
- ));
+ $configfield->addMultiOptions($options);
+ $configfield->setRegisterInArrayValidator(false);
+ $this->addElement($configfield);
+ $orderfield = $this->createElement('select', 'order');
+ $orderfield ->setLabel('Position:');
+ $orderfield->setAttrib('readOnly', $meta);
+
+ for ($i = 0; $i <= $this->maxorder; $i++) {
+ $orderfield->addMultiOption($i, $i + 1);
}
-
-
+ $orderfield->setRegisterInArrayValidator(false);
+ $this->addElement($orderfield);
+
+
+ if($this->action == "addbootmenuentry")
+ { $label = "Add Bootmenuentry"; }
+ else
+ { $label = "Edit Bootmenuentry"; }
+
+ $this->addElement('submit', $this->action, array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $label,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/bootmenu/index/type/'.$this->type.'/page/'.$this->page.'"'
+ ));
+
+ }
+
+
}
diff --git a/application/modules/user/forms/Bootos.php b/application/modules/user/forms/Bootos.php
index 432f0c7..02d865b 100644
--- a/application/modules/user/forms/Bootos.php
+++ b/application/modules/user/forms/Bootos.php
@@ -1,207 +1,205 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_Bootos extends Zend_Form
-{
-
- private $configlist;
- private $action;
- private $groupdepth;
- private $page;
-
- public function setAction($action){
- $this->action = $action;
-
- }
- public function setConfiglist($configlist){
- $this->configlist = $configlist;
-
- }
- public function setGroupdepth($groupdepth){
- $this->groupdepth = $groupdepth;
- }
- public function setPage($page){
- $this->page = $page;
- }
-
- public function init()
- {
- $this->setName("BootOsCreate");
- $this->setMethod('post');
- $this->setEnctype("multipart/form-data");
-
- if (!Pbs_Acl::checkRight('boe') && $this->action == 'editbootos')
- $meta = true;
- else
- $meta = null;
-
- if($this->action == 'editbootos')
- $filereq = false;
- else
- $filereq = true;
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'rows' => 5,
- 'cols' => 50,
- 'label' => 'Description:',
- ));
-
- $this->addElement('textarea', 'defaultkcl', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 175)),
- ),
- 'required' => false,
- 'rows' => 5,
- 'cols' => 50,
- 'readOnly' => $meta,
- 'label' => 'Default-KCL:',
- ));
-
- $this->addElement('text', 'distro', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'readOnly' => $meta,
- 'label' => 'Distro:',
- ));
-
- $this->addElement('text', 'distroversion', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'readOnly' => $meta,
- 'label' => 'Distroversion:',
- ));
-
- $this->addElement('text', 'shortname', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'readOnly' => $meta,
- 'label' => 'Shortname:',
- ));
-
- $this->addElement('text', 'share', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'readOnly' => $meta,
- 'label' => 'Share:',
- ));
-
- $this->addElement('file', 'kernel', array(
- 'readOnly' => $meta,
- 'label' => 'Kernel:',
- ));
-
- $this->addElement('file', 'init', array(
- 'readOnly' => $meta,
- 'label' => 'Initramfs:',
- ));
-
- $this->addElement('file', 'config', array(
- 'validators' => array(array('Extension', false, array('tgz'))),
- 'readOnly' => $meta,
- 'label' => 'Config:',
- ));
-
- $date = new DateTime();
- $date->add(new DateInterval('P1Y'));
- $this->addElement('text', 'expires', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Expires:',
- 'readOnly' => $meta,
- 'value' => $date->format('Y-m-d'),
- ));
-
- $publicfield = $this->createElement('select','public');
- $publicfield->setLabel('Public:');
- $publicfield->addMultiOption(-1, 'X. Not Visible');
- $publicfield->addMultiOption(0, '0. Own Group');
- $publicfield->setAttrib('readOnly', $meta);
- $publicfield->setAttrib('id', 'depth');
- $publicfield->setAttrib('onchange', "$('#groups .v1').show();changeDepth();");
-
- for($i=1; $i<$this->groupdepth; $i++){
- $publicfield->addMultiOption($i, "$i. Untergruppe");
- }
-
- $publicfield->setRegisterInArrayValidator(false);
- $this->addElement($publicfield);
-
- if($this->action == "createbootos")
- $label = "Create Bootos";
- else
- $label = "Edit Bootos";
-
- $this->addElement('submit', $this->action, array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $label,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/bootos/index/page/'.$this->page.'"'
- ));
-
- ?>
-
- <script type="text/javascript">
- $(document).ready(function(){
- changeDepth();
- $('#groups .v1').show();
- });
- function changeDepth(){
- i = $("#depth option:selected").val();
- $('#depthimg').attr('src','/stats/graphgroup/level/' + i);
- }</script>
-
- <div id='groups' style='text-align: center;'>
- <div class='v1' >
- <img id=depthimg src='/stats/graphgroup/'/>
- </div>
- </div>
-
-<?php
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_Bootos extends Zend_Form {
+
+ private $configlist;
+ private $action;
+ private $groupdepth;
+ private $page;
+
+ public function setAction($action) {
+ $this->action = $action;
+
+ }
+ public function setConfiglist($configlist) {
+ $this->configlist = $configlist;
+
+ }
+ public function setGroupdepth($groupdepth) {
+ $this->groupdepth = $groupdepth;
+ }
+ public function setPage($page) {
+ $this->page = $page;
+ }
+
+ public function init() {
+ $this->setName("BootOsCreate");
+ $this->setMethod('post');
+ $this->setEnctype("multipart/form-data");
+
+ if (!Pbs_Acl::checkRight('boe') && $this->action == 'editbootos')
+ { $meta = true; }
+ else
+ { $meta = null; }
+
+ if($this->action == 'editbootos')
+ { $filereq = false; }
+ else
+ { $filereq = true; }
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Description:',
+ ));
+
+ $this->addElement('textarea', 'defaultkcl', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 175)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'readOnly' => $meta,
+ 'label' => 'Default-KCL:',
+ ));
+
+ $this->addElement('text', 'distro', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'readOnly' => $meta,
+ 'label' => 'Distro:',
+ ));
+
+ $this->addElement('text', 'distroversion', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'readOnly' => $meta,
+ 'label' => 'Distroversion:',
+ ));
+
+ $this->addElement('text', 'shortname', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'readOnly' => $meta,
+ 'label' => 'Shortname:',
+ ));
+
+ $this->addElement('text', 'share', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'readOnly' => $meta,
+ 'label' => 'Share:',
+ ));
+
+ $this->addElement('file', 'kernel', array(
+ 'readOnly' => $meta,
+ 'label' => 'Kernel:',
+ ));
+
+ $this->addElement('file', 'init', array(
+ 'readOnly' => $meta,
+ 'label' => 'Initramfs:',
+ ));
+
+ $this->addElement('file', 'config', array(
+ 'validators' => array(array('Extension', false, array('tgz'))),
+ 'readOnly' => $meta,
+ 'label' => 'Config:',
+ ));
+
+ $date = new DateTime();
+ $date->add(new DateInterval('P1Y'));
+ $this->addElement('text', 'expires', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Expires:',
+ 'readOnly' => $meta,
+ 'value' => $date->format('Y-m-d'),
+ ));
+
+ $publicfield = $this->createElement('select', 'public');
+ $publicfield->setLabel('Public:');
+ $publicfield->addMultiOption(-1, 'X. Not Visible');
+ $publicfield->addMultiOption(0, '0. Own Group');
+ $publicfield->setAttrib('readOnly', $meta);
+ $publicfield->setAttrib('id', 'depth');
+ $publicfield->setAttrib('onchange', "$('#groups .v1').show();changeDepth();");
+
+ for($i = 1; $i < $this->groupdepth; $i++) {
+ $publicfield->addMultiOption($i, "$i. Untergruppe");
}
-
+ $publicfield->setRegisterInArrayValidator(false);
+ $this->addElement($publicfield);
+
+ if($this->action == "createbootos")
+ { $label = "Create Bootos"; }
+ else
+ { $label = "Edit Bootos"; }
+
+ $this->addElement('submit', $this->action, array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $label,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/bootos/index/page/'.$this->page.'"'
+ ));
+
+ ? >
+
+ < script type = "text/javascript" >
+ $(document).ready(function() {
+ changeDepth();
+ $('#groups .v1').show();
+ });
+ function changeDepth() {
+ i = $("#depth option:selected").val();
+ $('#depthimg').attr('src', '/stats/graphgroup/level/' + i);
+ } < / script >
+
+ < div id = 'groups' style = 'text-align: center;' >
+ < div class = 'v1' >
+ < img id = depthimg src = '/stats/graphgroup/' / >
+ < / div >
+ < / div >
+
+ <? php
+ }
+
+
}
-?>
+ ? >
diff --git a/application/modules/user/forms/BootosUser.php b/application/modules/user/forms/BootosUser.php
index d5700d5..e986104 100644
--- a/application/modules/user/forms/BootosUser.php
+++ b/application/modules/user/forms/BootosUser.php
@@ -1,161 +1,161 @@
- <?php
+
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_BootosUser extends Zend_Form
-{
-
- private $action;
- private $type;
- private $configID;
- private $hometype;
-
- public function setAction($action){
- $this->action = $action;
- }
- public function setType($type){
- $this->type = $type;
- }
- public function setConfigID($configID){
- $this->configID = $configID;
- }
- public function setHometype($hometype){
- $this->hometype = $hometype;
- }
-
-
- public function init()
- {
- $this->setName($this->action);
- $this->setMethod('post');
-
- if (!Pbs_Acl::checkRight('ce') && $this->action == 'editbootosuser')
- $meta = true;
- else
- $meta = null;
-
- if(!isset($_POST['hometypeID'])){
- $_POST['hometypeID'] = '0';
- }
-
- $this->addElement('text', 'login', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Login-Name:',
- 'value' => $_POST['login'],
- 'description' => 'Tip: Use %username% as a Wildcard'
- ));
-
- $this->addElement('password', 'password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(6)),
- ),
- 'required' => true,
- 'label' => 'Password:',
- 'errorMessages' => array('Please enter a password with more than 6 characters')
- ));
-
- $this->addElement('password', 'repeat_password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(6)),
- ),
- 'required' => true,
- 'label' => 'Repeat Password:',
- 'errorMessages' => array('Please repeat the password correctly'),
- 'description' => 'Tip: Use %password% as a Wildcard'
- ));
-
-
-
- $hometypefield = $this->createElement('select','hometypeID');
- $hometypefield->setLabel('Hometype:');
- $hometypefield->setAttrib('readOnly', $meta);
- $hometypefield->setAttrib('onChange', "document.getElementById('".$this->action."').submit();");
- $hometypefield->setValue($_POST['hometypeID']);
- foreach($this->hometype as $k => $ht){
- $hometypefield->addMultiOption($ht->getID(), $ht->getName());
- }
-
- $this->addElement($hometypefield);
-
- if($_POST['hometypeID'] == 0){
- $this->addElement('text', 'homepath', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Home-Path:',
- 'size' => '30',
- 'readOnly' => true,
- 'value' => '/home/%login-name%'
- ));
- }elseif($_POST['hometypeID'] == 1){
- $this->addElement('text', 'homepath', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Home-Path:',
- 'size' => '30',
- 'readOnly' => true,
- 'value' => 'usbstick://home/%login-name%'
- ));
- }else{
- $this->addElement('text', 'homepath', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'size' => '30',
- 'required' => true,
- 'label' => 'Home-Path:',
- 'readOnly' => $meta
- ));
- }
-
- if($this->action == "addbootosuser")
- $label = "Add User";
- else
- $label = "Edit User";
-
- $this->addElement('submit', $this->action, array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $label
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/config/showconfig/type/'.$this->type.'/configID/'.$this->configID.'"'
- ));
-
-
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('Use <b>%username%</b> and <b>%password%</b> as Wildcards for Login and Password.','info');
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_BootosUser extends Zend_Form {
+
+ private $action;
+ private $type;
+ private $configID;
+ private $hometype;
+
+ public function setAction($action) {
+ $this->action = $action;
+ }
+ public function setType($type) {
+ $this->type = $type;
+ }
+ public function setConfigID($configID) {
+ $this->configID = $configID;
+ }
+ public function setHometype($hometype) {
+ $this->hometype = $hometype;
+ }
+
+
+ public function init() {
+ $this->setName($this->action);
+ $this->setMethod('post');
+
+ if (!Pbs_Acl::checkRight('ce') && $this->action == 'editbootosuser')
+ { $meta = true; }
+ else
+ { $meta = null; }
+
+ if(!isset($_POST['hometypeID'])) {
+ $_POST['hometypeID'] = '0';
+ }
+
+ $this->addElement('text', 'login', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Login-Name:',
+ 'value' => $_POST['login'],
+ 'description' => 'Tip: Use %username% as a Wildcard'
+ ));
+
+ $this->addElement('password', 'password', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(6)),
+ ),
+ 'required' => true,
+ 'label' => 'Password:',
+ 'errorMessages' => array('Please enter a password with more than 6 characters')
+ ));
+
+ $this->addElement('password', 'repeat_password', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(6)),
+ ),
+ 'required' => true,
+ 'label' => 'Repeat Password:',
+ 'errorMessages' => array('Please repeat the password correctly'),
+ 'description' => 'Tip: Use %password% as a Wildcard'
+ ));
+
+
+
+ $hometypefield = $this->createElement('select', 'hometypeID');
+ $hometypefield->setLabel('Hometype:');
+ $hometypefield->setAttrib('readOnly', $meta);
+ $hometypefield->setAttrib('onChange', "document.getElementById('".$this->action."').submit();");
+ $hometypefield->setValue($_POST['hometypeID']);
+ foreach($this->hometype as $k => $ht) {
+ $hometypefield->addMultiOption($ht->getID(), $ht->getName());
+ }
+
+ $this->addElement($hometypefield);
+
+ if($_POST['hometypeID'] == 0) {
+ $this->addElement('text', 'homepath', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Home-Path:',
+ 'size' => '30',
+ 'readOnly' => true,
+ 'value' => '/home/%login-name%'
+ ));
+ }
+ elseif($_POST['hometypeID'] == 1) {
+ $this->addElement('text', 'homepath', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Home-Path:',
+ 'size' => '30',
+ 'readOnly' => true,
+ 'value' => 'usbstick://home/%login-name%'
+ ));
+ }
+ else {
+ $this->addElement('text', 'homepath', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'size' => '30',
+ 'required' => true,
+ 'label' => 'Home-Path:',
+ 'readOnly' => $meta
+ ));
}
-
- public function isValid($data)
- {
+
+ if($this->action == "addbootosuser")
+ { $label = "Add User"; }
+ else
+ { $label = "Edit User"; }
+
+ $this->addElement('submit', $this->action, array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $label
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/config/showconfig/type/'.$this->type.'/configID/'.$this->configID.'"'
+ ));
+
+
+ $pbsNotifier = new Pbs_Notifier();
+ echo $pbsNotifier->notify('Use <b>%username%</b> and <b>%password%</b> as Wildcards for Login and Password.', 'info');
+ }
+
+ public function isValid($data) {
$this->getElement('repeat_password')->
- addValidator(new Zend_Validate_Identical($data['password']));
-
+ addValidator(new Zend_Validate_Identical($data['password']));
+
return parent::isValid($data);
}
}
-?>
+? >
diff --git a/application/modules/user/forms/Client.php b/application/modules/user/forms/Client.php
index 33a6cf1..8e37d94 100644
--- a/application/modules/user/forms/Client.php
+++ b/application/modules/user/forms/Client.php
@@ -1,74 +1,72 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_Client extends Zend_Form
-{
+class user_Form_Client extends Zend_Form {
- private $buttontext = 'Save';
- private $groups;
- private $page;
-
- public function setButtontext($v){
- $this->buttontext = $v;
- }
- public function setPage($page){
- $this->page = $page;
- }
-
- public function init()
- {
- $this->setName("pool");
- $this->setMethod('post');
-
- $mac = $this->createElement('text', 'macadress', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array(
- 'regex',
- false,
- array(
- '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i',
- 'messages' => array(
- Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress",
- Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.'
- )
- )
- )
- ),
- 'required' => true,
- 'label' => 'MacAdress:',
- ));
- $this->addElement($mac);
-
-
- $this->addElement('text', 'hardwarehash', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(32, 32)),
- ),
- 'required' => true,
- 'label' => 'Hardwarehash:',
- ));
+ private $buttontext = 'Save';
+ private $groups;
+ private $page;
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $this->buttontext,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/client/index/page/'.$this->page.'"'
- ));
-
- }
+ public function setButtontext($v) {
+ $this->buttontext = $v;
+ }
+ public function setPage($page) {
+ $this->page = $page;
+ }
+
+ public function init() {
+ $this->setName("pool");
+ $this->setMethod('post');
+
+ $mac = $this->createElement('text', 'macadress', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array(
+ 'regex',
+ false,
+ array(
+ '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i',
+ 'messages' => array(
+ Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress",
+ Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.'
+ )
+ )
+ )
+ ),
+ 'required' => true,
+ 'label' => 'MacAdress:',
+ ));
+ $this->addElement($mac);
+
+
+ $this->addElement('text', 'hardwarehash', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(32, 32)),
+ ),
+ '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/index/page/'.$this->page.'"'
+ ));
+
+ }
}
diff --git a/application/modules/user/forms/Config.php b/application/modules/user/forms/Config.php
index 3b961b9..1d07e5a 100644
--- a/application/modules/user/forms/Config.php
+++ b/application/modules/user/forms/Config.php
@@ -1,86 +1,85 @@
- <?php
+
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_Config extends Zend_Form
-{
+class user_Form_Config extends Zend_Form {
- private $action;
- private $page;
- private $type;
-
- public function setAction($action){
- $this->action = $action;
- }
- public function setPage($p){
- $this->page = $p;
- }
- public function setType($type){
- $this->type = $type;
- }
-
- public function init()
- {
- $this->setName($this->action);
- $this->setMethod('post');
-
- if (!Pbs_Acl::checkRight('ce') && $this->action == 'editconfig')
- $meta = true;
- else
- $meta = null;
+ private $action;
+ private $page;
+ private $type;
+
+ public function setAction($action) {
+ $this->action = $action;
+ }
+ public function setPage($p) {
+ $this->page = $p;
+ }
+ public function setType($type) {
+ $this->type = $type;
+ }
+
+ public function init() {
+ $this->setName($this->action);
+ $this->setMethod('post');
+
+ if (!Pbs_Acl::checkRight('ce') && $this->action == 'editconfig')
+ { $meta = true; }
+ else
+ { $meta = null; }
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'rows' => 5,
- 'cols' => 50,
- 'label' => 'Description:',
- ));
-
- if($this->type == 'group'){
- $visible = $this->createElement('checkbox','visible');
- $visible->setLabel('Visible:');
- $visible->setAttrib('readOnly', $meta);
- $this->addElement($visible);
- }
-
- if($this->action == "createconfig")
- $label = "Create Config";
- else
- $label = "Edit Config";
-
- $this->addElement('submit', $this->action, array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $label
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/config/index/type/'.$this->type.'/page/'.$this->page.'"'
- ));
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Description:',
+ ));
+
+ if($this->type == 'group') {
+ $visible = $this->createElement('checkbox', 'visible');
+ $visible->setLabel('Visible:');
+ $visible->setAttrib('readOnly', $meta);
+ $this->addElement($visible);
}
+ if($this->action == "createconfig")
+ { $label = "Create Config"; }
+ else
+ { $label = "Edit Config"; }
+
+ $this->addElement('submit', $this->action, array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $label
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/config/index/type/'.$this->type.'/page/'.$this->page.'"'
+ ));
+
+ }
+
}
-?>
+? >
diff --git a/application/modules/user/forms/ConfirmDeleteAccount.php b/application/modules/user/forms/ConfirmDeleteAccount.php
index 70b261c..5fd3e82 100644
--- a/application/modules/user/forms/ConfirmDeleteAccount.php
+++ b/application/modules/user/forms/ConfirmDeleteAccount.php
@@ -1,36 +1,34 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_ConfirmDeleteAccount extends Zend_Form
-{
+class user_Form_ConfirmDeleteAccount extends Zend_Form {
- public function init()
- {
- $this->setName("ConfirmDeleteAccount");
- $this->setMethod('post');
-
- $this->addElement('submit', 'confirmdelete', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Confirm',
- ));
+ public function init() {
+ $this->setName("ConfirmDeleteAccount");
+ $this->setMethod('post');
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+ $this->addElement('submit', 'confirmdelete', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Confirm',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/user/forms/Filter.php b/application/modules/user/forms/Filter.php
index 5eabd60..f535cf1 100644
--- a/application/modules/user/forms/Filter.php
+++ b/application/modules/user/forms/Filter.php
@@ -1,98 +1,94 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_Filter extends Zend_Form
-{
-
- private $bootmenus;
-
- public function init()
- {
- $this->setName("Add Filter");
- $this->setMethod('post');
-
- if(stristr($_SERVER['REQUEST_URI'],'addfilter')){
- $edit = null;
- }
- else{
- if(!Pbs_Acl::checkRight('fe') && Pbs_Acl::checkRight('fefp') ){
- $edit = 'true';
- }
- else{
- $edit = null;
- }
- }
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'readOnly' => $edit,
- 'label' => 'Title:',
- ));
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'required' => false,
- 'readOnly' => $edit,
- 'label' => 'Description:',
- ));
-
- $bootmenufield = $this->createElement('select','bootmenuID');
- $bootmenufield->setLabel('Bootmenu:');
- $bootmenufield->setAttrib('readOnly', $edit);
-
- if(count($this->bootmenus)>0){
- foreach($this->bootmenus as $g){
- $bootmenufield->addMultiOption($g->getID(), $g->getTitle());
-
- }
- }
-
- $bootmenufield->setRegisterInArrayValidator(false);
- $this->addElement($bootmenufield);
-
- $this->addElement('text', 'priority', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Priority:',
- ));
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $this->buttontext,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"'
- ));
-
- $this->addElement('hidden', 'created', array(
- 'required' => false,
- 'ignore' => true
- ));
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_Filter extends Zend_Form {
+
+ private $bootmenus;
+
+ public function init() {
+ $this->setName("Add Filter");
+ $this->setMethod('post');
+
+ if(stristr($_SERVER['REQUEST_URI'], 'addfilter')) {
+ $edit = null;
+ } else {
+ if(!Pbs_Acl::checkRight('fe') && Pbs_Acl::checkRight('fefp') ) {
+ $edit = 'true';
+ } else {
+ $edit = null;
+ }
}
- function setBootmenus($val){
- $this->bootmenus = $val;
- return;
- }
- private $buttontext = 'Save';
- function setButtontext($v){
- $this->buttontext = $v;
- }
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'readOnly' => $edit,
+ 'label' => 'Title:',
+ ));
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'required' => false,
+ 'readOnly' => $edit,
+ 'label' => 'Description:',
+ ));
+
+ $bootmenufield = $this->createElement('select', 'bootmenuID');
+ $bootmenufield->setLabel('Bootmenu:');
+ $bootmenufield->setAttrib('readOnly', $edit);
+
+ if(count($this->bootmenus) > 0) {
+ foreach($this->bootmenus as $g) {
+ $bootmenufield->addMultiOption($g->getID(), $g->getTitle());
+
+ }
+ }
+
+ $bootmenufield->setRegisterInArrayValidator(false);
+ $this->addElement($bootmenufield);
+
+ $this->addElement('text', 'priority', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Priority:',
+ ));
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"'
+ ));
+
+ $this->addElement('hidden', 'created', array(
+ 'required' => false,
+ 'ignore' => true
+ ));
+ }
+ function setBootmenus($val) {
+ $this->bootmenus = $val;
+ return;
+ }
+ private $buttontext = 'Save';
+ function setButtontext($v) {
+ $this->buttontext = $v;
+ }
diff --git a/application/modules/user/forms/FilterEntry.php b/application/modules/user/forms/FilterEntry.php
index 12fd00c..bdadf59 100644
--- a/application/modules/user/forms/FilterEntry.php
+++ b/application/modules/user/forms/FilterEntry.php
@@ -1,424 +1,422 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_FilterEntry extends Zend_Form
-{
+class user_Form_FilterEntry extends Zend_Form {
- private $filterID = 0;
- private $data ;
- private $buttontext = 'Save';
- private $selectData;
- private $page;
+ private $filterID = 0;
+ private $data ;
+ private $buttontext = 'Save';
+ private $selectData;
+ private $page;
- public function setButtontext($v){
- $this->buttontext = $v;
- }
- public function setData($v){
- $this->data = $v;
- }
- public function setFilterID($v){
- $this->filterID = $v;
- }
- public function setSelectData($v){
- $this->selectData = $v;
- }
- public function setPage($page){
- $this->page = $page;
- }
+ public function setButtontext($v) {
+ $this->buttontext = $v;
+ }
+ public function setData($v) {
+ $this->data = $v;
+ }
+ public function setFilterID($v) {
+ $this->filterID = $v;
+ }
+ public function setSelectData($v) {
+ $this->selectData = $v;
+ }
+ public function setPage($page) {
+ $this->page = $page;
+ }
- public function init()
- {
- $this->setName("Add Filterentry");
- $this->setMethod('post');
- $this->setAttrib('id','filterentryform');
- #print_a($this->data);
- #print_a($this->selectData);
- try{
- $filtertypemapper = new Application_Model_FilterTypeMapper();
- $filtertype = $filtertypemapper->fetchAll();
-
- $filtertypes = $this->createElement('select','filtertypeID');
- $filtertypes ->setLabel('Type:');
- $filtertypes ->setAttrib('id','filtertype');
- $filtertypes->addMultiOption('','');
- foreach($filtertype as $f){
- $filtertypes->addMultiOption($f->getID(),$f->getFiltertypename());
- }
- $filterentry = $filtertypes->getMultiOption($this->data['filtertypeID']);
- $filterentryID = $this->data['filtertypeID'];
- }catch (Zend_Exception $e) {
- echo "Error message 1: " . $e->getMessage() . "\n";
- }
- switch($filterentryID){
- default:
- $desc = "Select the filtertype";
- $label1 = 'Value 1:';
- $label2 = 'Value 2:';
- $filtervalue1 = $this->createElement('text', 'filtervalue', array(
- 'label' => $label1,
- 'id' => 'val1'
- ));
- $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
- 'label' => $label2,
- 'id' => 'val2'
- ));
- break;
- case "1":
- $desc = "You can set one IP or an IP-Range";
- $label1 = 'Start:';
- $label2 = 'End:';
-
- $filtervalue1 = $this->createElement('text', 'filtervalue', array(
- 'label' => $label1,
- 'validators' => array(
- array(
- 'regex',
- false,
- array(
- '/^(([0-9]|[1-9][0-9]|0[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([[0-9]|[1-9][0-9]|0[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i',
- 'messages' => array(
- Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress",
- Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.'
- )
- )
- )
- ),
- 'required' => true,
- 'id' => 'val1'
- ));
- $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
- 'label' => $label2,
- 'validators' => array(
- array(
- 'regex',
- false,
- array(
- '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i',
- 'messages' => array(
- Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress",
- Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.'
- )
- )
- )
- ),
- 'required' => true,
- 'id' => 'val2'
- ));
- break;
- case "2":
- $desc = "You can set one Mac-Adress or an Mac-Range";
- $label1 = 'Start:';
- $label2 = 'End:';
-
- $filtervalue1 = $this->createElement('text', 'filtervalue', array(
- 'label' => $label1,
- 'validators' => array(
- array(
- 'regex',
- false,
- array(
- '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i',
- 'messages' => array(
- Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress",
- Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.'
- )
- )
- )
- ),
- 'required' => true,
- 'id' => 'val1'
- ));
- $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
- 'label' => $label2,
- 'validators' => array(
- array(
- 'regex',
- false,
- array(
- '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i',
- 'messages' => array(
- Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress",
- Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.'
- )
- )
- )
- ),
- 'required' => true,
- 'id' => 'val2'
- ));
- break;
- case "3":
- $desc = "Select your Pool";
- $label1 = 'PoolID:';
-
- $filtervalue1 = $this->createElement('select','filtervalue');
- $filtervalue1 ->setLabel($label1);
- if(count($this->selectData['pools'])>0){
- foreach($this->selectData['pools'] as $id => $g){
- $filtervalue1->addMultiOption($g['poolID'], $g['title']);
- }
- }
- $filtervalue1->setRegisterInArrayValidator(false);
- break;
- case "4":
- $desc = "Select your BootIso";
- $label1 = 'BootIsoID:';
-
- $filtervalue1 = $this->createElement('select','filtervalue');
- $filtervalue1 ->setLabel($label1);
- if(count($this->selectData['bootisos'])>0){
- foreach($this->selectData['bootisos'] as $id => $g){
- $filtervalue1->addMultiOption($g['bootisoID'], $g['title']);
- }
- }
- $filtervalue1->setRegisterInArrayValidator(false);
-
- break;
- case "5":
- $desc = "Select a Membership";
- $label1 = 'Membership:';
-
- $filtervalue1 = $this->createElement('select','filtervalue');
- $filtervalue1 ->setLabel($label1);
- if(count($this->selectData['memberships'])>0){
- $personMapper = new Application_Model_PersonMapper();
- foreach($this->selectData['memberships'] as $id => $g){
- // Display full name of Person
- $person = new Application_Model_Person();
- $personMapper->find($g['personID'],$person);
- $filtervalue1->addMultiOption($g['membershipID'], $person->getName().", ".$person->getFirstname());
- }
- }
- $filtervalue1->setRegisterInArrayValidator(false);
- break;
- case "6":
- $desc = "For all members in this Group";
- $label1 = 'Group:';
- // TODO: insert the child Groups
- $filtervalue1 = $this->createElement('select','filtervalue');
- $filtervalue1 ->setLabel($label1);
- if(count($this->selectData['groups'])>0){
- foreach($this->selectData['groups'] as $id => $g){
- $filtervalue1->addMultiOption($g['groupID'], $g['title']);
- }
- }
- $filtervalue1->setRegisterInArrayValidator(false);
- break;
- case "7":
- $desc = "Specify a time-range";
- $label1 = 'Start:';
- $label2 = 'End:';
-
- $filtervalue1 = $this->createElement('text', 'filtervalue', array(
- 'label' => $label1,
- 'validators' => array(
- array(
- 'regex',
- false,
- array(
- '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i',
- 'messages' => array(
- Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM",
- Zend_Validate_Regex::INVALID => 'Time contains invalid characters.'
- )
- )
- )
- ),
- 'required' => true,
- 'id' => 'val1'
- ));
- $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
- 'label' => $label2,
- 'validators' => array(
- array(
- 'regex',
- false,
- array(
- '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i',
- 'messages' => array(
- Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM",
- Zend_Validate_Regex::INVALID => 'Time contains invalid characters.'
- )
- )
- )
- ),
- 'required' => true,
- 'id' => 'val2'
- ));
- echo '<script type="text/javascript">
- $(function() {
- $( "#val1" ).timepicker({
- showPeriod: false,
- showPeriodLabels: false
- });
- $( "#val2" ).timepicker({
- showPeriod: false,
- showPeriodLabels: false
- });
- });
- </script>';
- break;
- case "8":
- $desc = "Select a Client";
- $label1 = 'Client:';
-
- $filtervalue1 = $this->createElement('select','filtervalue');
- $filtervalue1 ->setLabel($label1);
- if(count($this->selectData['clients'])>0){
- foreach($this->selectData['clients'] as $id => $g){
- $filtervalue1->addMultiOption($g['clientID'], $g['macadress']." - ".$g['hardwarehash']);
- }
- }
- $filtervalue1->setRegisterInArrayValidator(false);
- break;
- case "9":
- $desc = "Define a Hardwarehash";
- $label1 = 'Hardwarehash:';
- $filtervalue1 = $this->createElement('text', 'filtervalue', array(
- 'label' => $label1,
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(32, 32)),
- ),
- 'required' => true,
- 'id' => 'val1'
- ));
- break;
- case "10":
- $desc = "Specify the Weekday (Monday:1, Tuesday:2 ... Sunday:7) or a range";
- $label1 = 'Start Day:';
- $label2 = 'End Day:';
-
-
-
- $filtervalue1 = $this->createElement('select','filtervalue', array(
- 'label' => $label1,
- 'validators' => array(
- array(
- 'regex',
- false,
- array(
- '/^([1-7])$/i',
- 'messages' => array(
- Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7",
- Zend_Validate_Regex::INVALID => 'Day contains invalid characters.'
- )
- )
- )
- ),
- 'required' => true,
- 'id' => 'val1'
- ));
- $filtervalue1->addMultiOption(1, "Monday")
- ->addMultiOption(2, "Tuesday")
- ->addMultiOption(3, "Wednesday")
- ->addMultiOption(4, "Thursday")
- ->addMultiOption(5, "Friday")
- ->addMultiOption(6, "Saturday")
- ->addMultiOption(7, "Sunday");
-
-
- $filtervalue2 = $this->createElement('select', 'filtervalue2', array(
- 'label' => $label2,
- 'validators' => array(
- array(
- 'regex',
- false,
- array(
- '/^([1-7])$/i',
- 'messages' => array(
- Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7",
- Zend_Validate_Regex::INVALID => 'Day contains invalid characters.'
- )
- )
- )
- ),
- 'required' => true,
- 'id' => 'val2'
- ));
- $filtervalue2->addMultiOption(1, "Monday")
- ->addMultiOption(2, "Tuesday")
- ->addMultiOption(3, "Wednesday")
- ->addMultiOption(4, "Thursday")
- ->addMultiOption(5, "Friday")
- ->addMultiOption(6, "Saturday")
- ->addMultiOption(7, "Sunday");
- break;
- case "11":
- $desc = "Specify the date or a day range of the filter";
- $label1 = 'Start Date:';
- $label2 = 'End Date:';
-
- $filtervalue1 = $this->createElement('text', 'filtervalue', array(
- 'label' => $label1,
- 'required' => true,
- 'id' => 'val1'
- ));
- $filtervalue1->addValidator('Date',false, array('format'=>'dd.MM.yyyy'));
-
- $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
- 'label' => $label2,
- 'required' => true,
- 'id' => 'val2'
- ));
- $filtervalue2->addValidator('Date',false, array('format'=>'dd.MM.yyyy'));
- echo '<script type="text/javascript">
- $(function() {
- $( "#val1" ).datepicker({ dateFormat: "dd.mm.yy"});
- $( "#val2" ).datepicker({ dateFormat: "dd.mm.yy"});
- });
- </script>';
- break;
- }
- $filtertypes->setDescription($desc);
- $this->addElement($filtertypes);
-
-
-
- $this->addElement($filtervalue1);
- if(isset($filtervalue2 )){
- $this->addElement($filtervalue2);
- }
+ public function init() {
+ $this->setName("Add Filterentry");
+ $this->setMethod('post');
+ $this->setAttrib('id', 'filterentryform');
+#print_a($this->data);
+#print_a($this->selectData);
+ try {
+ $filtertypemapper = new Application_Model_FilterTypeMapper();
+ $filtertype = $filtertypemapper->fetchAll();
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $this->buttontext,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"'
- ));
-
- $this->addElement('hidden', 'filterID', array(
- 'value' => $this->filterID
- ));
-
-
+ $filtertypes = $this->createElement('select', 'filtertypeID');
+ $filtertypes ->setLabel('Type:');
+ $filtertypes ->setAttrib('id', 'filtertype');
+ $filtertypes->addMultiOption('', '');
+ foreach($filtertype as $f) {
+ $filtertypes->addMultiOption($f->getID(), $f->getFiltertypename());
+ }
+ $filterentry = $filtertypes->getMultiOption($this->data['filtertypeID']);
+ $filterentryID = $this->data['filtertypeID'];
+ } catch (Zend_Exception $e) {
+ echo "Error message 1: " . $e->getMessage() . "\n";
}
+ switch($filterentryID) {
+ default:
+ $desc = "Select the filtertype";
+ $label1 = 'Value 1:';
+ $label2 = 'Value 2:';
+ $filtervalue1 = $this->createElement('text', 'filtervalue', array(
+ 'label' => $label1,
+ 'id' => 'val1'
+ ));
+ $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
+ 'label' => $label2,
+ 'id' => 'val2'
+ ));
+ break;
+ case "1":
+ $desc = "You can set one IP or an IP-Range";
+ $label1 = 'Start:';
+ $label2 = 'End:';
+
+ $filtervalue1 = $this->createElement('text', 'filtervalue', array(
+ 'label' => $label1,
+ 'validators' => array(
+ array(
+ 'regex',
+ false,
+ array(
+ '/^(([0-9]|[1-9][0-9]|0[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([[0-9]|[1-9][0-9]|0[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i',
+ 'messages' => array(
+ Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress",
+ Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.'
+ )
+ )
+ )
+ ),
+ 'required' => true,
+ 'id' => 'val1'
+ ));
+ $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
+ 'label' => $label2,
+ 'validators' => array(
+ array(
+ 'regex',
+ false,
+ array(
+ '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i',
+ 'messages' => array(
+ Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress",
+ Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.'
+ )
+ )
+ )
+ ),
+ 'required' => true,
+ 'id' => 'val2'
+ ));
+ break;
+ case "2":
+ $desc = "You can set one Mac-Adress or an Mac-Range";
+ $label1 = 'Start:';
+ $label2 = 'End:';
+
+ $filtervalue1 = $this->createElement('text', 'filtervalue', array(
+ 'label' => $label1,
+ 'validators' => array(
+ array(
+ 'regex',
+ false,
+ array(
+ '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i',
+ 'messages' => array(
+ Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress",
+ Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.'
+ )
+ )
+ )
+ ),
+ 'required' => true,
+ 'id' => 'val1'
+ ));
+ $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
+ 'label' => $label2,
+ 'validators' => array(
+ array(
+ 'regex',
+ false,
+ array(
+ '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i',
+ 'messages' => array(
+ Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress",
+ Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.'
+ )
+ )
+ )
+ ),
+ 'required' => true,
+ 'id' => 'val2'
+ ));
+ break;
+ case "3":
+ $desc = "Select your Pool";
+ $label1 = 'PoolID:';
+
+ $filtervalue1 = $this->createElement('select', 'filtervalue');
+ $filtervalue1 ->setLabel($label1);
+ if(count($this->selectData['pools']) > 0) {
+ foreach($this->selectData['pools'] as $id => $g) {
+ $filtervalue1->addMultiOption($g['poolID'], $g['title']);
+ }
+ }
+ $filtervalue1->setRegisterInArrayValidator(false);
+ break;
+ case "4":
+ $desc = "Select your BootIso";
+ $label1 = 'BootIsoID:';
+
+ $filtervalue1 = $this->createElement('select', 'filtervalue');
+ $filtervalue1 ->setLabel($label1);
+ if(count($this->selectData['bootisos']) > 0) {
+ foreach($this->selectData['bootisos'] as $id => $g) {
+ $filtervalue1->addMultiOption($g['bootisoID'], $g['title']);
+ }
+ }
+ $filtervalue1->setRegisterInArrayValidator(false);
+
+ break;
+ case "5":
+ $desc = "Select a Membership";
+ $label1 = 'Membership:';
+
+ $filtervalue1 = $this->createElement('select', 'filtervalue');
+ $filtervalue1 ->setLabel($label1);
+ if(count($this->selectData['memberships']) > 0) {
+ $personMapper = new Application_Model_PersonMapper();
+ foreach($this->selectData['memberships'] as $id => $g) {
+ // Display full name of Person
+ $person = new Application_Model_Person();
+ $personMapper->find($g['personID'], $person);
+ $filtervalue1->addMultiOption($g['membershipID'], $person->getName().", ".$person->getFirstname());
+ }
+ }
+ $filtervalue1->setRegisterInArrayValidator(false);
+ break;
+ case "6":
+ $desc = "For all members in this Group";
+ $label1 = 'Group:';
+ // TODO: insert the child Groups
+ $filtervalue1 = $this->createElement('select', 'filtervalue');
+ $filtervalue1 ->setLabel($label1);
+ if(count($this->selectData['groups']) > 0) {
+ foreach($this->selectData['groups'] as $id => $g) {
+ $filtervalue1->addMultiOption($g['groupID'], $g['title']);
+ }
+ }
+ $filtervalue1->setRegisterInArrayValidator(false);
+ break;
+ case "7":
+ $desc = "Specify a time-range";
+ $label1 = 'Start:';
+ $label2 = 'End:';
+
+ $filtervalue1 = $this->createElement('text', 'filtervalue', array(
+ 'label' => $label1,
+ 'validators' => array(
+ array(
+ 'regex',
+ false,
+ array(
+ '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i',
+ 'messages' => array(
+ Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM",
+ Zend_Validate_Regex::INVALID => 'Time contains invalid characters.'
+ )
+ )
+ )
+ ),
+ 'required' => true,
+ 'id' => 'val1'
+ ));
+ $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
+ 'label' => $label2,
+ 'validators' => array(
+ array(
+ 'regex',
+ false,
+ array(
+ '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i',
+ 'messages' => array(
+ Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM",
+ Zend_Validate_Regex::INVALID => 'Time contains invalid characters.'
+ )
+ )
+ )
+ ),
+ 'required' => true,
+ 'id' => 'val2'
+ ));
+ echo '<script type="text/javascript">
+ $(function() {
+ $( "#val1" ).timepicker({
+ showPeriod: false,
+ showPeriodLabels: false
+ });
+ $( "#val2" ).timepicker({
+ showPeriod: false,
+ showPeriodLabels: false
+ });
+ });
+ </script>';
+ break;
+ case "8":
+ $desc = "Select a Client";
+ $label1 = 'Client:';
+
+ $filtervalue1 = $this->createElement('select', 'filtervalue');
+ $filtervalue1 ->setLabel($label1);
+ if(count($this->selectData['clients']) > 0) {
+ foreach($this->selectData['clients'] as $id => $g) {
+ $filtervalue1->addMultiOption($g['clientID'], $g['macadress']." - ".$g['hardwarehash']);
+ }
+ }
+ $filtervalue1->setRegisterInArrayValidator(false);
+ break;
+ case "9":
+ $desc = "Define a Hardwarehash";
+ $label1 = 'Hardwarehash:';
+ $filtervalue1 = $this->createElement('text', 'filtervalue', array(
+ 'label' => $label1,
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(32, 32)),
+ ),
+ 'required' => true,
+ 'id' => 'val1'
+ ));
+ break;
+ case "10":
+ $desc = "Specify the Weekday (Monday:1, Tuesday:2 ... Sunday:7) or a range";
+ $label1 = 'Start Day:';
+ $label2 = 'End Day:';
+
+
+
+ $filtervalue1 = $this->createElement('select', 'filtervalue', array(
+ 'label' => $label1,
+ 'validators' => array(
+ array(
+ 'regex',
+ false,
+ array(
+ '/^([1-7])$/i',
+ 'messages' => array(
+ Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7",
+ Zend_Validate_Regex::INVALID => 'Day contains invalid characters.'
+ )
+ )
+ )
+ ),
+ 'required' => true,
+ 'id' => 'val1'
+ ));
+ $filtervalue1->addMultiOption(1, "Monday")
+ ->addMultiOption(2, "Tuesday")
+ ->addMultiOption(3, "Wednesday")
+ ->addMultiOption(4, "Thursday")
+ ->addMultiOption(5, "Friday")
+ ->addMultiOption(6, "Saturday")
+ ->addMultiOption(7, "Sunday");
+
+
+ $filtervalue2 = $this->createElement('select', 'filtervalue2', array(
+ 'label' => $label2,
+ 'validators' => array(
+ array(
+ 'regex',
+ false,
+ array(
+ '/^([1-7])$/i',
+ 'messages' => array(
+ Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7",
+ Zend_Validate_Regex::INVALID => 'Day contains invalid characters.'
+ )
+ )
+ )
+ ),
+ 'required' => true,
+ 'id' => 'val2'
+ ));
+ $filtervalue2->addMultiOption(1, "Monday")
+ ->addMultiOption(2, "Tuesday")
+ ->addMultiOption(3, "Wednesday")
+ ->addMultiOption(4, "Thursday")
+ ->addMultiOption(5, "Friday")
+ ->addMultiOption(6, "Saturday")
+ ->addMultiOption(7, "Sunday");
+ break;
+ case "11":
+ $desc = "Specify the date or a day range of the filter";
+ $label1 = 'Start Date:';
+ $label2 = 'End Date:';
+
+ $filtervalue1 = $this->createElement('text', 'filtervalue', array(
+ 'label' => $label1,
+ 'required' => true,
+ 'id' => 'val1'
+ ));
+ $filtervalue1->addValidator('Date', false, array('format' => 'dd.MM.yyyy'));
+
+ $filtervalue2 = $this->createElement('text', 'filtervalue2', array(
+ 'label' => $label2,
+ 'required' => true,
+ 'id' => 'val2'
+ ));
+ $filtervalue2->addValidator('Date', false, array('format' => 'dd.MM.yyyy'));
+ echo '<script type="text/javascript">
+ $(function() {
+ $( "#val1" ).datepicker({ dateFormat: "dd.mm.yy"});
+ $( "#val2" ).datepicker({ dateFormat: "dd.mm.yy"});
+ });
+ </script>';
+ break;
+ }
+ $filtertypes->setDescription($desc);
+ $this->addElement($filtertypes);
+
+
+
+ $this->addElement($filtervalue1);
+ if(isset($filtervalue2 )) {
+ $this->addElement($filtervalue2);
+ }
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"'
+ ));
+
+ $this->addElement('hidden', 'filterID', array(
+ 'value' => $this->filterID
+ ));
+
+
+ }
}
-?>
-<script type="text/javascript">
- $('#filtertype').change(function(){
- //alert($("#filtertype option:selected").val());
- $('#filterentryform').submit();
- });
- $('#val1').focusout(function(){
- if($("#filtertype option:selected").val() == 1 && $('#val2').val() == ""){
- $('#val2').val($('#val1').val());
- }
- if($("#filtertype option:selected").val() == 2 && $('#val2').val() == ""){
- $('#val2').val($('#val1').val());
- }
- });
-</script>
+? >
+< script type = "text/javascript" >
+$('#filtertype').change(function() {
+ //alert($("#filtertype option:selected").val());
+ $('#filterentryform').submit();
+});
+$('#val1').focusout(function() {
+ if($("#filtertype option:selected").val() == 1 && $('#val2').val() == "") {
+ $('#val2').val($('#val1').val());
+ }
+ if($("#filtertype option:selected").val() == 2 && $('#val2').val() == "") {
+ $('#val2').val($('#val1').val());
+ }
+});
+< / script >
diff --git a/application/modules/user/forms/GroupAdd.php b/application/modules/user/forms/GroupAdd.php
index 9bf1e81..8ad3364 100644
--- a/application/modules/user/forms/GroupAdd.php
+++ b/application/modules/user/forms/GroupAdd.php
@@ -1,74 +1,72 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_GroupAdd extends Zend_Form
-{
- private $grouplist;
+class user_Form_GroupAdd extends Zend_Form {
+ private $grouplist;
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+ }
- public function init()
- {
- $this->setName("GroupAdd");
- $this->setMethod('post');
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
+ public function init() {
+ $this->setName("GroupAdd");
+ $this->setMethod('post');
- $this->addElement('text', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'label' => 'Description:',
- ));
- /*
- $groupfield = $this->createElement('select','superordinatedGroupID');
- $groupfield ->setLabel('superordinated Group:');
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
- $groupfield->addMultiOption('-1', '---- none ----');
+ $this->addElement('text', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ ));
+ /*
+ $groupfield = $this->createElement('select','superordinatedGroupID');
+ $groupfield ->setLabel('superordinated Group:');
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
- */
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Add',
- ));
+ $groupfield->addMultiOption('-1', '---- none ----');
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+ if(count($this->grouplist)>0){
+ foreach($this->grouplist as $group => $g){
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+ */
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/user/forms/GroupEdit.php b/application/modules/user/forms/GroupEdit.php
index 41924c3..d428f23 100644
--- a/application/modules/user/forms/GroupEdit.php
+++ b/application/modules/user/forms/GroupEdit.php
@@ -1,60 +1,58 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_GroupEdit extends Zend_Form
-{
- private $groupID;
-
- public function setGroupID($groupID){
- $this->groupID = $groupID;
-
- }
-
- public function init()
- {
- $this->setName("GroupEdit");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- 'value' => $_POST['title'],
- ));
-
- $this->addElement('text', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'label' => 'Description:',
- 'value' => $_POST['description'],
- ));
-
- $this->addElement('submit', 'save', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
-
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_GroupEdit extends Zend_Form {
+ private $groupID;
+
+ public function setGroupID($groupID) {
+ $this->groupID = $groupID;
+
+ }
+
+ public function init() {
+ $this->setName("GroupEdit");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ 'value' => $_POST['title'],
+ ));
+
+ $this->addElement('text', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ 'value' => $_POST['description'],
+ ));
+
+ $this->addElement('submit', 'save', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
} \ No newline at end of file
diff --git a/application/modules/user/forms/GroupLink.php b/application/modules/user/forms/GroupLink.php
index 9ff2fa2..0b82ed3 100644
--- a/application/modules/user/forms/GroupLink.php
+++ b/application/modules/user/forms/GroupLink.php
@@ -1,67 +1,65 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_GroupLink extends Zend_Form
-{
- private $grouplist;
+class user_Form_GroupLink extends Zend_Form {
+ private $grouplist;
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
- public function init()
- {
- $this->setName("GroupLink");
- $this->setMethod('post');
-
-/*
- $groupfield1 = $this->createElement('select','superordinatedGroupID');
- $groupfield1 ->setLabel('Parent Group:');
+ }
+
+ public function init() {
+ $this->setName("GroupLink");
+ $this->setMethod('post');
+
+ /*
+ $groupfield1 = $this->createElement('select','superordinatedGroupID');
+ $groupfield1 ->setLabel('Parent Group:');
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield1->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield1->setRegisterInArrayValidator(false);
- $this->addElement($groupfield1);
- */
+ if(count($this->grouplist)>0){
+ foreach($this->grouplist as $group => $g){
+ $groupfield1->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $groupfield1->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield1);
+ */
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
- $groupfield->setAttrib('onchange', "reloadGraph();");
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+ $groupfield->setAttrib('onchange', "reloadGraph();");
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
- $this->addElement('submit', 'link', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Link',
- ));
+ $this->addElement('submit', 'link', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Link',
+ ));
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/user/forms/GroupRequest.php b/application/modules/user/forms/GroupRequest.php
index 8cf033c..a5fe5ab 100644
--- a/application/modules/user/forms/GroupRequest.php
+++ b/application/modules/user/forms/GroupRequest.php
@@ -1,59 +1,57 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_GroupRequest extends Zend_Form
-{
- private $grouplist;
-
- public function setGrouplist($grouplist){
- $this->grouplist = $grouplist;
-
- }
-
- public function getGrouplist(){
- return $this->grouplist;
- }
-
- public function init()
- {
- $this->setName("GroupRequest");
- $this->setMethod('post');
-
- $groupfield = $this->createElement('select','groupID');
- $groupfield ->setLabel('Group:');
-
- if(count($this->grouplist)>0){
- foreach($this->grouplist as $group => $g){
- $groupfield->addMultiOption($g->getID(), $g->getTitle());
- }
- }
-
- $groupfield->setRegisterInArrayValidator(false);
- $this->addElement($groupfield);
-
- $this->addElement('submit', 'request', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Request',
- ));
-
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
-
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_GroupRequest extends Zend_Form {
+ private $grouplist;
+
+ public function setGrouplist($grouplist) {
+ $this->grouplist = $grouplist;
+
+ }
+
+ public function getGrouplist() {
+ return $this->grouplist;
+ }
+
+ public function init() {
+ $this->setName("GroupRequest");
+ $this->setMethod('post');
+
+ $groupfield = $this->createElement('select', 'groupID');
+ $groupfield ->setLabel('Group:');
+
+ if(count($this->grouplist) > 0) {
+ foreach($this->grouplist as $group => $g) {
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+
+ $this->addElement('submit', 'request', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Request',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+
+ }
}
diff --git a/application/modules/user/forms/LinkRight.php b/application/modules/user/forms/LinkRight.php
index 80d0402..ad4585b 100644
--- a/application/modules/user/forms/LinkRight.php
+++ b/application/modules/user/forms/LinkRight.php
@@ -1,75 +1,73 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_LinkRight extends Zend_Form
-{
- private $rightlist;
+class user_Form_LinkRight extends Zend_Form {
+ private $rightlist;
- public function setRightlist($rightlist){
- $this->rightlist = $rightlist;
- }
+ public function setRightlist($rightlist) {
+ $this->rightlist = $rightlist;
+ }
- public function init()
- {
- $this->setName("LinkRights");
- $this->setMethod('post');
+ public function init() {
+ $this->setName("LinkRights");
+ $this->setMethod('post');
- $sform = new Zend_Form_SubForm(array('legend' => 'Rights:'));
-
- $sform->addElement('button', 'checkAll', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Check All',
- 'class' => 'leftbutton',
- 'onclick' => "checkAllCheckBoxes();",
- ));
-
- $sform->addElement('button', 'uncheckAll', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Uncheck All',
- 'onclick' => "uncheckAllCheckBoxes();",
- ));
-
- if(count($this->rightlist) > 0) {
- foreach($this->rightlist as $rightcategory => $rights) {
- foreach($rights as $rightID => $rightTitle) {
- $element = $this->createElement('checkbox', "$rightID", array(
- 'label' => $rightTitle . ':',
- 'belongsTo' => 'rights',
- ));
- $elements[] = $rightID;
- $sform->addElement($element);
- }
- $sform->addDisplayGroup($elements, "$rightcategory", array("legend" => $rightcategory . ":"));
- unset($elements);
- }
- }
-
- $this->addSubForm($sform, 'rights');
+ $sform = new Zend_Form_SubForm(array('legend' => 'Rights:'));
- $this->addElement('submit', 'link', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Add Rights',
- ));
+ $sform->addElement('button', 'checkAll', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Check All',
+ 'class' => 'leftbutton',
+ 'onclick' => "checkAllCheckBoxes();",
+ ));
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+ $sform->addElement('button', 'uncheckAll', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Uncheck All',
+ 'onclick' => "uncheckAllCheckBoxes();",
+ ));
+
+ if(count($this->rightlist) > 0) {
+ foreach($this->rightlist as $rightcategory => $rights) {
+ foreach($rights as $rightID => $rightTitle) {
+ $element = $this->createElement('checkbox', "$rightID", array(
+ 'label' => $rightTitle . ':',
+ 'belongsTo' => 'rights',
+ ));
+ $elements[] = $rightID;
+ $sform->addElement($element);
+ }
+ $sform->addDisplayGroup($elements, "$rightcategory", array("legend" => $rightcategory . ":"));
+ unset($elements);
+ }
+ }
+
+ $this->addSubForm($sform, 'rights');
+
+ $this->addElement('submit', 'link', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add Rights',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/user/forms/Login.php b/application/modules/user/forms/Login.php
index d2dbd63..736841b 100644
--- a/application/modules/user/forms/Login.php
+++ b/application/modules/user/forms/Login.php
@@ -1,47 +1,45 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_Login extends Zend_Form
-{
-
- public function init()
- {
- $this->setName("LoginForm");
- $this->setMethod('post');
-
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim', 'StringToLower'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'E-Mail:',
- ));
-
- $this->addElement('password', 'password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Password:',
- ));
-
- $this->addElement('submit', 'login', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Login',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_Login extends Zend_Form {
+
+ public function init() {
+ $this->setName("LoginForm");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'email', array(
+ 'filters' => array('StringTrim', 'StringToLower'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'E-Mail:',
+ ));
+
+ $this->addElement('password', 'password', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Password:',
+ ));
+
+ $this->addElement('submit', 'login', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Login',
+ ));
+ }
}
diff --git a/application/modules/user/forms/MembershipSelect.php b/application/modules/user/forms/MembershipSelect.php
index ea2804c..39ee52b 100644
--- a/application/modules/user/forms/MembershipSelect.php
+++ b/application/modules/user/forms/MembershipSelect.php
@@ -1,51 +1,49 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_MembershipSelect extends Zend_Form
-{
- private $membershiplist;
-
- public function setMembershiplist($membershiplist){
- $this->membershiplist = $membershiplist;
-
- }
-
- public function getMembershiplist(){
- return $this->membershiplist;
- }
-
- public function init()
- {
- $this->setName("MembershipSelect");
- $this->setMethod('post');
-
- $membershipfield = $this->createElement('select','membershipID');
- $membershipfield ->setLabel('Membership:');
-
- if(count($this->membershiplist)>0){
- foreach($this->membershiplist as $membership => $m){
- $membershipfield->addMultiOption($m['membershipID'], $m['group'] . ' - ' . $m['role']);
- }
- }
-
- $membershipfield->setRegisterInArrayValidator(false);
- $this->addElement($membershipfield);
-
- $this->addElement('submit', 'selectmembership', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Select',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_MembershipSelect extends Zend_Form {
+ private $membershiplist;
+
+ public function setMembershiplist($membershiplist) {
+ $this->membershiplist = $membershiplist;
+
+ }
+
+ public function getMembershiplist() {
+ return $this->membershiplist;
+ }
+
+ public function init() {
+ $this->setName("MembershipSelect");
+ $this->setMethod('post');
+
+ $membershipfield = $this->createElement('select', 'membershipID');
+ $membershipfield ->setLabel('Membership:');
+
+ if(count($this->membershiplist) > 0) {
+ foreach($this->membershiplist as $membership => $m) {
+ $membershipfield->addMultiOption($m['membershipID'], $m['group'] . ' - ' . $m['role']);
+ }
+ }
+
+ $membershipfield->setRegisterInArrayValidator(false);
+ $this->addElement($membershipfield);
+
+ $this->addElement('submit', 'selectmembership', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Select',
+ ));
+ }
}
diff --git a/application/modules/user/forms/NewPassword.php b/application/modules/user/forms/NewPassword.php
index 915620d..3d84406 100644
--- a/application/modules/user/forms/NewPassword.php
+++ b/application/modules/user/forms/NewPassword.php
@@ -1,47 +1,45 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_NewPassword extends Zend_Form
-{
- private $personID;
-
- public function setPersonID($personID){
- $this->personID = $personID;
- }
-
- public function init()
- {
- $this->setName("NewPassword");
- $this->setMethod('post');
-
- $this->addElement('hidden', 'personID', array(
- 'value' => $this->personID
- ));
-
- $this->addElement('password', 'password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Password:',
- ));
-
- $this->addElement('submit', 'savePassword', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_NewPassword extends Zend_Form {
+ private $personID;
+
+ public function setPersonID($personID) {
+ $this->personID = $personID;
+ }
+
+ public function init() {
+ $this->setName("NewPassword");
+ $this->setMethod('post');
+
+ $this->addElement('hidden', 'personID', array(
+ 'value' => $this->personID
+ ));
+
+ $this->addElement('password', 'password', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Password:',
+ ));
+
+ $this->addElement('submit', 'savePassword', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+ }
}
diff --git a/application/modules/user/forms/PersonEdit.php b/application/modules/user/forms/PersonEdit.php
index 09d090a..2a5f40a 100644
--- a/application/modules/user/forms/PersonEdit.php
+++ b/application/modules/user/forms/PersonEdit.php
@@ -1,126 +1,124 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_PersonEdit extends Zend_Form
-{
-
- public function init()
- {
- $this->setName("PersonEdit");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- 'value' => $this->getView()->person->getTitle(),
- ));
-
-
- $this->addElement('text', 'name', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Name:',
- 'value' => $this->getView()->person->getName(),
- ));
-
- $this->addElement('text', 'firstname', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Firstname:',
- 'value' => $this->getView()->person->getFirstname(),
- ));
-
- $this->addElement('text', 'street', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Street:',
- 'value' => $this->getView()->person->getStreet(),
- ));
-
- $this->addElement('text', 'housenumber', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Housenumber:',
- 'value' => $this->getView()->person->getHousenumber(),
- ));
-
- $this->addElement('text', 'city', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'City:',
- 'value' => $this->getView()->person->getCity(),
- ));
-
- $this->addElement('text', 'postalcode', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Postalcode:',
- 'value' => $this->getView()->person->getPostalcode(),
- ));
-
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim', 'StringToLower'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),array('EmailAddress', "deep" => true, "mx" => true),
- ),
- 'required' => true,
- 'label' => 'Email:',
- 'value' => $this->getView()->person->getEmail(),
- ));
-
- $this->addElement('password', 'newpassword', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(5, 50)),
- ),
- 'required' => false,
- 'label' => 'Neues Password:',
- ));
-
- $this->addElement('submit', 'save', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
-
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_PersonEdit extends Zend_Form {
+
+ public function init() {
+ $this->setName("PersonEdit");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ 'value' => $this->getView()->person->getTitle(),
+ ));
+
+
+ $this->addElement('text', 'name', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Name:',
+ 'value' => $this->getView()->person->getName(),
+ ));
+
+ $this->addElement('text', 'firstname', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Firstname:',
+ 'value' => $this->getView()->person->getFirstname(),
+ ));
+
+ $this->addElement('text', 'street', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Street:',
+ 'value' => $this->getView()->person->getStreet(),
+ ));
+
+ $this->addElement('text', 'housenumber', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Housenumber:',
+ 'value' => $this->getView()->person->getHousenumber(),
+ ));
+
+ $this->addElement('text', 'city', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'City:',
+ 'value' => $this->getView()->person->getCity(),
+ ));
+
+ $this->addElement('text', 'postalcode', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Postalcode:',
+ 'value' => $this->getView()->person->getPostalcode(),
+ ));
+
+ $this->addElement('text', 'email', array(
+ 'filters' => array('StringTrim', 'StringToLower'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)), array('EmailAddress', "deep" => true, "mx" => true),
+ ),
+ 'required' => true,
+ 'label' => 'Email:',
+ 'value' => $this->getView()->person->getEmail(),
+ ));
+
+ $this->addElement('password', 'newpassword', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(5, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Neues Password:',
+ ));
+
+ $this->addElement('submit', 'save', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/user/forms/Pool.php b/application/modules/user/forms/Pool.php
index 4b30c9c..2fa05e1 100644
--- a/application/modules/user/forms/Pool.php
+++ b/application/modules/user/forms/Pool.php
@@ -1,68 +1,66 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_Pool extends Zend_Form
-{
- private $buttontext = 'Save';
- private $page;
-
- public function setButtontext($v){
- $this->buttontext = $v;
- }
- public function setPage($page){
- $this->page = $page;
- }
+class user_Form_Pool extends Zend_Form {
+ private $buttontext = 'Save';
+ private $page;
- public function init()
- {
- $this->setName("pool");
- $this->setMethod('post');
+ public function setButtontext($v) {
+ $this->buttontext = $v;
+ }
+ public function setPage($page) {
+ $this->page = $page;
+ }
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 30)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'label' => 'Description:',
- ));
+ public function init() {
+ $this->setName("pool");
+ $this->setMethod('post');
- $this->addElement('text', 'location', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 30)),
- ),
- 'required' => true,
- 'label' => 'Location:',
- ));
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 30)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ ));
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $this->buttontext,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/pool/index/page/'.$this->page.'"'
- ));
- }
+ $this->addElement('text', 'location', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 30)),
+ ),
+ 'required' => true,
+ 'label' => 'Location:',
+ ));
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $this->buttontext,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/pool/index/page/'.$this->page.'"'
+ ));
+ }
}
diff --git a/application/modules/user/forms/PoolClient.php b/application/modules/user/forms/PoolClient.php
index 9acf21b..17b8ae8 100644
--- a/application/modules/user/forms/PoolClient.php
+++ b/application/modules/user/forms/PoolClient.php
@@ -1,53 +1,51 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_PoolClient extends Zend_Form
-{
- private $clients;
- private $page;
- private $buttontext = 'Save';
-
- function setButtontext($v){
- $this->buttontext = $v;
- }
- public function setClients($clients){
- $this->clients = $clients;
- return $this;
- }
- public function setPage($page){
- $this->page = $page;
- }
-
- public function init()
- {
- $this->setName("addClientToPool");
- $this->setMethod('post');
-
- $clientfield = $this->createElement('select','clientID');
- $clientfield ->setLabel('Client:');
- foreach($this->clients as $c){
- $clientfield->addMultiOption($c['clientID'],$c['macadress']." - ".$c['hardwarehash']);
- }
- $this->addElement($clientfield);
-
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"'
- ));
+class user_Form_PoolClient extends Zend_Form {
+ private $clients;
+ private $page;
+ private $buttontext = 'Save';
+
+ function setButtontext($v) {
+ $this->buttontext = $v;
+ }
+ public function setClients($clients) {
+ $this->clients = $clients;
+ return $this;
+ }
+ public function setPage($page) {
+ $this->page = $page;
+ }
+
+ public function init() {
+ $this->setName("addClientToPool");
+ $this->setMethod('post');
+
+ $clientfield = $this->createElement('select', 'clientID');
+ $clientfield ->setLabel('Client:');
+ foreach($this->clients as $c) {
+ $clientfield->addMultiOption($c['clientID'], $c['macadress']." - ".$c['hardwarehash']);
}
-
+ $this->addElement($clientfield);
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"'
+ ));
+ }
+
}
diff --git a/application/modules/user/forms/Preboot.php b/application/modules/user/forms/Preboot.php
index f1a609f..a862fdf 100644
--- a/application/modules/user/forms/Preboot.php
+++ b/application/modules/user/forms/Preboot.php
@@ -1,89 +1,87 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_Preboot extends Zend_Form
-{
-
- private $action;
- private $page;
-
- public function setAction($action){
- $this->action = $action;
- }
- public function setPage($p){
- $this->page = $p;
- }
-
- public function init()
- {
- $this->setName($this->action);
- $this->setMethod('post');
- $this->setEnctype("multipart/form-data");
-
- if (!Pbs_Acl::checkRight('pre') && $this->action == 'editpreboot')
- $meta = true;
- else
- $meta = null;
-
- if($this->action == 'editpreboot')
- $filereq = false;
- else
- $filereq = true;
-
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $this->addElement('textarea', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'rows' => 5,
- 'cols' => 50,
- 'label' => 'Description:',
- ));
-
- $this->addElement('file', 'preboot', array(
- 'validators' => array(array('Extension', false, array('zip'))),
- 'required' => $filereq,
- 'readOnly' => $meta,
- 'label' => 'Preboot:',
- ));
-
- if($this->action == "createpreboot")
- $label = "Create Preboot";
- else
- $label = "Edit Preboot";
-
- $this->addElement('submit', $this->action, array(
- 'required' => false,
- 'ignore' => true,
- 'label' => $label,
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/user/preboot/index/page/'.$this->page.'"'
- ));
-
- }
-
-
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_Preboot extends Zend_Form {
+
+ private $action;
+ private $page;
+
+ public function setAction($action) {
+ $this->action = $action;
+ }
+ public function setPage($p) {
+ $this->page = $p;
+ }
+
+ public function init() {
+ $this->setName($this->action);
+ $this->setMethod('post');
+ $this->setEnctype("multipart/form-data");
+
+ if (!Pbs_Acl::checkRight('pre') && $this->action == 'editpreboot')
+ { $meta = true; }
+ else
+ { $meta = null; }
+
+ if($this->action == 'editpreboot')
+ { $filereq = false; }
+ else
+ { $filereq = true; }
+
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $this->addElement('textarea', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'rows' => 5,
+ 'cols' => 50,
+ 'label' => 'Description:',
+ ));
+
+ $this->addElement('file', 'preboot', array(
+ 'validators' => array(array('Extension', false, array('zip'))),
+ 'required' => $filereq,
+ 'readOnly' => $meta,
+ 'label' => 'Preboot:',
+ ));
+
+ if($this->action == "createpreboot")
+ { $label = "Create Preboot"; }
+ else
+ { $label = "Edit Preboot"; }
+
+ $this->addElement('submit', $this->action, array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => $label,
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/user/preboot/index/page/'.$this->page.'"'
+ ));
+
+ }
+
+
}
diff --git a/application/modules/user/forms/RecoverPassword.php b/application/modules/user/forms/RecoverPassword.php
index 0e064b0..28ce336 100644
--- a/application/modules/user/forms/RecoverPassword.php
+++ b/application/modules/user/forms/RecoverPassword.php
@@ -1,37 +1,35 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_RecoverPassword extends Zend_Form
-{
+class user_Form_RecoverPassword extends Zend_Form {
- public function init()
- {
- $this->setName("RecoverPassword");
- $this->setMethod('post');
+ public function init() {
+ $this->setName("RecoverPassword");
+ $this->setMethod('post');
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 30)),
- ),
- 'required' => true,
- 'label' => 'Email:',
- ));
- $this->addElement('submit', 'recoverPassword', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Recover',
- ));
- }
+ $this->addElement('text', 'email', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 30)),
+ ),
+ 'required' => true,
+ 'label' => 'Email:',
+ ));
+ $this->addElement('submit', 'recoverPassword', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Recover',
+ ));
+ }
}
diff --git a/application/modules/user/forms/Register.php b/application/modules/user/forms/Register.php
index 0808088..baa7cdd 100644
--- a/application/modules/user/forms/Register.php
+++ b/application/modules/user/forms/Register.php
@@ -1,113 +1,111 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_Register extends Zend_Form
-{
-
- public function init()
- {
- $this->setName("Register");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
-
- $this->addElement('text', 'name', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Name:',
- ));
-
- $this->addElement('text', 'firstname', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Firstname:',
- ));
-
- $this->addElement('text', 'street', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Street:',
- ));
-
- $this->addElement('text', 'housenumber', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Housenumber:',
- ));
-
- $this->addElement('text', 'city', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'City:',
- ));
-
- $this->addElement('text', 'postalcode', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Postalcode:',
- ));
-
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim', 'StringToLower'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),array('EmailAddress', "deep" => true, "mx" => true),
- ),
- 'required' => true,
- 'label' => 'Email:',
- ));
-
- $this->addElement('password', 'password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(5, 50)),
- ),
- 'required' => true,
- 'label' => 'Password:',
- ));
-
- $this->addElement('submit', 'register', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Register',
- ));
-
-
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_Register extends Zend_Form {
+
+ public function init() {
+ $this->setName("Register");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+
+ $this->addElement('text', 'name', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Name:',
+ ));
+
+ $this->addElement('text', 'firstname', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Firstname:',
+ ));
+
+ $this->addElement('text', 'street', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Street:',
+ ));
+
+ $this->addElement('text', 'housenumber', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Housenumber:',
+ ));
+
+ $this->addElement('text', 'city', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'City:',
+ ));
+
+ $this->addElement('text', 'postalcode', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Postalcode:',
+ ));
+
+ $this->addElement('text', 'email', array(
+ 'filters' => array('StringTrim', 'StringToLower'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)), array('EmailAddress', "deep" => true, "mx" => true),
+ ),
+ 'required' => true,
+ 'label' => 'Email:',
+ ));
+
+ $this->addElement('password', 'password', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(5, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Password:',
+ ));
+
+ $this->addElement('submit', 'register', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Register',
+ ));
+
+
+ }
diff --git a/application/modules/user/forms/RoleAdd.php b/application/modules/user/forms/RoleAdd.php
index e44c2a3..36f602e 100644
--- a/application/modules/user/forms/RoleAdd.php
+++ b/application/modules/user/forms/RoleAdd.php
@@ -1,120 +1,118 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class user_Form_RoleAdd extends Zend_Form
-{
- private $rightlist;
- private $inheritanceright;
- private $addrighttoroleright;
-
- public function setRightlist($rightlist){
- $this->rightlist = $rightlist;
- }
-
- public function setAddrighttoroleright($addrighttoroleright){
- $this->addrighttoroleright = $addrighttoroleright;
- }
-
- public function setInheritanceright($inheritanceright){
- $this->inheritanceright = $inheritanceright;
- }
-
- public function init()
- {
- $this->setName("RoleAdd");
- $this->setMethod('post');
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- ));
-
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => false,
- 'label' => 'Title:',
- ));
-
- $this->addElement('text', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'label' => 'Description:',
- 'value' => $_POST['description'],
- ));
-
- if($this->addrighttoroleright) {
- $sform = new Zend_Form_SubForm(array('legend' => 'Rights:'));
- $sform->addElement('button', 'checkAll', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Check All',
- 'class' => 'leftbutton',
- 'onclick' => "checkAllCheckBoxes(new Array('inheritance'));",
- ));
-
- $sform->addElement('button', 'uncheckAll', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Uncheck All',
- 'onclick' => "uncheckAllCheckBoxes(new Array('inheritance'));",
- ));
-
- if(count($this->rightlist) > 0) {
- foreach($this->rightlist as $rightcategory => $rights) {
- foreach($rights as $rightID => $rightTitle) {
- $element = $this->createElement('checkbox', "$rightID", array(
- 'label' => $rightTitle . ':',
- 'belongsTo' => 'rights',
- ));
- $elements[] = $rightID;
- $sform->addElement($element);
- }
- $sform->addDisplayGroup($elements, "$rightcategory", array("legend" => $rightcategory . ":"));
- unset($elements);
- }
- }
-
- $this->addSubForm($sform, 'rights');
- }
-
- if($this->inheritanceright) {
- $this->addElement('checkbox', 'inheritance', array(
- 'label' => 'Inheritance:',
- ));
- }
-
- $this->addElement('submit', 'add', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Add',
- ));
-
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
+
+class user_Form_RoleAdd extends Zend_Form {
+ private $rightlist;
+ private $inheritanceright;
+ private $addrighttoroleright;
+
+ public function setRightlist($rightlist) {
+ $this->rightlist = $rightlist;
+ }
+
+ public function setAddrighttoroleright($addrighttoroleright) {
+ $this->addrighttoroleright = $addrighttoroleright;
+ }
+
+ public function setInheritanceright($inheritanceright) {
+ $this->inheritanceright = $inheritanceright;
+ }
+
+ public function init() {
+ $this->setName("RoleAdd");
+ $this->setMethod('post');
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ ));
+
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Title:',
+ ));
+
+ $this->addElement('text', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ 'value' => $_POST['description'],
+ ));
+
+ if($this->addrighttoroleright) {
+ $sform = new Zend_Form_SubForm(array('legend' => 'Rights:'));
+ $sform->addElement('button', 'checkAll', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Check All',
+ 'class' => 'leftbutton',
+ 'onclick' => "checkAllCheckBoxes(new Array('inheritance'));",
+ ));
+
+ $sform->addElement('button', 'uncheckAll', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Uncheck All',
+ 'onclick' => "uncheckAllCheckBoxes(new Array('inheritance'));",
+ ));
+
+ if(count($this->rightlist) > 0) {
+ foreach($this->rightlist as $rightcategory => $rights) {
+ foreach($rights as $rightID => $rightTitle) {
+ $element = $this->createElement('checkbox', "$rightID", array(
+ 'label' => $rightTitle . ':',
+ 'belongsTo' => 'rights',
+ ));
+ $elements[] = $rightID;
+ $sform->addElement($element);
+ }
+ $sform->addDisplayGroup($elements, "$rightcategory", array("legend" => $rightcategory . ":"));
+ unset($elements);
+ }
+ }
+
+ $this->addSubForm($sform, 'rights');
+ }
+
+ if($this->inheritanceright) {
+ $this->addElement('checkbox', 'inheritance', array(
+ 'label' => 'Inheritance:',
+ ));
+ }
+
+ $this->addElement('submit', 'add', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add',
+ ));
+
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/application/modules/user/forms/RoleEdit.php b/application/modules/user/forms/RoleEdit.php
index 1505e78..68a740d 100644
--- a/application/modules/user/forms/RoleEdit.php
+++ b/application/modules/user/forms/RoleEdit.php
@@ -1,83 +1,81 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
+* This program is free software distributed under the GPL version 2.
+* See http://gpl.openslx.org/
+*
+* If you have any feedback please consult http://feedback.openslx.org/ and
+* send your suggestions, praise, or complaints to feedback@openslx.org
+*
+* General information about OpenSLX can be found at http://openslx.org/
+*/
-class user_Form_RoleEdit extends Zend_Form
-{
- private $roleID;
- private $inheritanceright;
+class user_Form_RoleEdit extends Zend_Form {
+ private $roleID;
+ private $inheritanceright;
- public function setRoleID($roleID){
- $this->roleID = $roleID;
- }
+ public function setRoleID($roleID) {
+ $this->roleID = $roleID;
+ }
- public function setInheritanceright($inheritanceright){
- $this->inheritanceright = $inheritanceright;
- }
+ public function setInheritanceright($inheritanceright) {
+ $this->inheritanceright = $inheritanceright;
+ }
- public function init()
- {
- $this->setName("RoleEdit");
- $this->setMethod('post');
+ public function init() {
+ $this->setName("RoleEdit");
+ $this->setMethod('post');
- $this->addElement('text', 'title', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Title:',
- 'value' => $_POST['title'],
- ));
+ $this->addElement('text', 'title', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => true,
+ 'label' => 'Title:',
+ 'value' => $_POST['title'],
+ ));
- $this->addElement('text', 'description', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 140)),
- ),
- 'required' => false,
- 'label' => 'Description:',
- 'value' => $_POST['description'],
- ));
+ $this->addElement('text', 'description', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 140)),
+ ),
+ 'required' => false,
+ 'label' => 'Description:',
+ 'value' => $_POST['description'],
+ ));
- if($this->inheritanceright) {
- if($_POST['inheritance'] == 1) {
- $this->addElement('checkbox', 'inheritance', array(
- 'label' => 'Inheritance:',
- 'checked' => 'checked',
- ));
- } else {
- $this->addElement('checkbox', 'inheritance', array(
- 'label' => 'Inheritance:',
- ));
- }
- }
+ if($this->inheritanceright) {
+ if($_POST['inheritance'] == 1) {
+ $this->addElement('checkbox', 'inheritance', array(
+ 'label' => 'Inheritance:',
+ 'checked' => 'checked',
+ ));
+ } else {
+ $this->addElement('checkbox', 'inheritance', array(
+ 'label' => 'Inheritance:',
+ ));
+ }
+ }
- $this->addElement('hidden', 'groupID', array(
- 'value' => $_POST['groupID'],
- ));
+ $this->addElement('hidden', 'groupID', array(
+ 'value' => $_POST['groupID'],
+ ));
- $this->addElement('submit', 'save', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
+ $this->addElement('submit', 'save', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Save',
+ ));
- $this->addElement('button', 'cancel', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Cancel',
- 'onclick' => 'location.href="javascript:history.back();"',
- ));
- }
+ $this->addElement('button', 'cancel', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Cancel',
+ 'onclick' => 'location.href="javascript:history.back();"',
+ ));
+ }
}
diff --git a/library/Pbs/Acl.php b/library/Pbs/Acl.php
index 766274a..a4b6e48 100644
--- a/library/Pbs/Acl.php
+++ b/library/Pbs/Acl.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,45 +10,44 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_Acl
-{
-
- public static function checkRight($rightShortcut) {
-
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if(!isset($userIDsNamespace['roleID']))
- return false;
- $roleID = $userIDsNamespace['roleID'];
-
- $rightMapper = new Application_Model_RightMapper();
- $element = $rightMapper->findBy(array('shortcut' => $rightShortcut),true);
-
- if($element == null)
- return false;
-
- $rightRolesMapper = new Application_Model_RightRolesMapper();
- $rightroles = $rightRolesMapper->findBy(array('roleID' => $roleID, 'rightID' => $element[0]['rightID']),true);
-
- if($rightroles != null)
- return true;
-
- return false;
-
- }
-
- public static function checkRightByMembershipID($membershipID, $rightShortcut) {
- $membershipMapper = new Application_Model_MembershipMapper();
- $membership = $membershipMapper->find($membershipID);
- $rightRolesMapper = new Application_Model_RightRolesMapper();
- $rightroles = $rightRolesMapper->findBy(array('roleID' => $membership->getRoleID()),true);
- $rightMapper = new Application_Model_RightMapper();
- foreach($rightroles as $rightrole) {
- $right = $rightMapper->find($rightrole['rightID']);
- if($right->getShortcut == $rightShortcut) {
- return true;
- }
- }
- return false;
- }
+class Pbs_Acl {
+
+ public static function checkRight($rightShortcut) {
+
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ if(!isset($userIDsNamespace['roleID']))
+ { return false; }
+ $roleID = $userIDsNamespace['roleID'];
+
+ $rightMapper = new Application_Model_RightMapper();
+ $element = $rightMapper->findBy(array('shortcut' => $rightShortcut), true);
+
+ if($element == null)
+ { return false; }
+
+ $rightRolesMapper = new Application_Model_RightRolesMapper();
+ $rightroles = $rightRolesMapper->findBy(array('roleID' => $roleID, 'rightID' => $element[0]['rightID']), true);
+
+ if($rightroles != null)
+ { return true; }
+
+ return false;
+
+ }
+
+ public static function checkRightByMembershipID($membershipID, $rightShortcut) {
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $membership = $membershipMapper->find($membershipID);
+ $rightRolesMapper = new Application_Model_RightRolesMapper();
+ $rightroles = $rightRolesMapper->findBy(array('roleID' => $membership->getRoleID()), true);
+ $rightMapper = new Application_Model_RightMapper();
+ foreach($rightroles as $rightrole) {
+ $right = $rightMapper->find($rightrole['rightID']);
+ if($right->getShortcut == $rightShortcut) {
+ return true;
+ }
+ }
+ return false;
+ }
}
diff --git a/library/Pbs/Controller/Plugin/Modularlayout.php b/library/Pbs/Controller/Plugin/Modularlayout.php
index fdde67c..69b0087 100644
--- a/library/Pbs/Controller/Plugin/Modularlayout.php
+++ b/library/Pbs/Controller/Plugin/Modularlayout.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,30 +10,28 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_Controller_Plugin_Modularlayout extends Zend_Controller_Plugin_Abstract
-{
-
- public function routeShutdown(Zend_Controller_Request_Abstract $request)
- {
- $config = Zend_Controller_Front::getInstance()
- ->getParam('bootstrap')->getOptions();
- $moduleName = $request->getModuleName();
- if($moduleName == 'default'){
- $path = $config['resources']['layout']['layoutPath'];
- $file = $config['resources']['layout']['layout'];
- Zend_Layout::getMvcInstance()->setLayoutPath($path/*. DIRECTORY_SEPARATOR .$layoutPath*/);
- Zend_Layout::getMvcInstance()->setLayout($file);
- }
- if (isset($config[$moduleName]['resources']['layout']['layoutPath']) && $moduleName != 'default') {
- $layoutPath = $config[$moduleName]['resources']['layout']['layoutPath'];
- $moduleDir = Zend_Controller_Front::getInstance()->getModuleDirectory();
- $moduleDir .= "/layouts";
- $layoutScript = $config[$moduleName]['resources']['layout']['layout'];
- $str = $moduleDir."/".$layoutScript;
- Zend_Layout::getMvcInstance()->setLayoutPath($moduleDir/*. DIRECTORY_SEPARATOR .$layoutPath*/);
- Zend_Layout::getMvcInstance()->setLayout($layoutScript);
-
- }
+class Pbs_Controller_Plugin_Modularlayout extends Zend_Controller_Plugin_Abstract {
+
+ public function routeShutdown(Zend_Controller_Request_Abstract $request) {
+ $config = Zend_Controller_Front::getInstance()
+ ->getParam('bootstrap')->getOptions();
+ $moduleName = $request->getModuleName();
+ if($moduleName == 'default') {
+ $path = $config['resources']['layout']['layoutPath'];
+ $file = $config['resources']['layout']['layout'];
+ Zend_Layout::getMvcInstance()->setLayoutPath($path/*. DIRECTORY_SEPARATOR .$layoutPath*/);
+ Zend_Layout::getMvcInstance()->setLayout($file);
+ }
+ if (isset($config[$moduleName]['resources']['layout']['layoutPath']) && $moduleName != 'default') {
+ $layoutPath = $config[$moduleName]['resources']['layout']['layoutPath'];
+ $moduleDir = Zend_Controller_Front::getInstance()->getModuleDirectory();
+ $moduleDir . = "/layouts";
+ $layoutScript = $config[$moduleName]['resources']['layout']['layout'];
+ $str = $moduleDir."/".$layoutScript;
+ Zend_Layout::getMvcInstance()->setLayoutPath($moduleDir/*. DIRECTORY_SEPARATOR .$layoutPath*/);
+ Zend_Layout::getMvcInstance()->setLayout($layoutScript);
+
}
+ }
}
diff --git a/library/Pbs/Debug.php b/library/Pbs/Debug.php
index c2031a1..8610ede 100644
--- a/library/Pbs/Debug.php
+++ b/library/Pbs/Debug.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -9,15 +9,15 @@
*
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_Debug{
+class Pbs_Debug {
- function debug($str){
- $path = "../resources/debugs/";
- @mkdir($path ,0777, true);
- $fp = fopen($path.'lastsession.txt', "a");
- if(is_array($str))
- $str = implode("\t",$str);
- fputs ($fp,date("Y-m-d H:i:s",time())."\t".$str."\n");
- fclose ($fp);
- }
+ function debug($str) {
+ $path = "../resources/debugs/";
+ @mkdir($path , 0777, true);
+ $fp = fopen($path.'lastsession.txt', "a");
+ if(is_array($str))
+ { $str = implode("\t", $str); }
+ fputs ($fp, date("Y-m-d H:i:s", time())."\t".$str."\n");
+ fclose ($fp);
+ }
}
diff --git a/library/Pbs/Filter.php b/library/Pbs/Filter.php
index ced0607..c8119ed 100644
--- a/library/Pbs/Filter.php
+++ b/library/Pbs/Filter.php
@@ -1,456 +1,438 @@
-<?php
-
-class Pbs_Filter{
-
- private $db = null;
- private $membership;
-
- public function evaluate()
- {
- $this->db = Zend_Db_Table::getDefaultAdapter();
- $db = $this->db;
- $debuglevel = 0;
-
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
-
- $membershipMapper = new Application_Model_MembershipMapper();
- $this->membership = new Application_Model_Membership();
- if(isset($userIDsNamespace['membershipID'])){
- $membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
- }
- else{
- $this->membership->setID(null);
- }
-
- // For Testing Filters
- $testFilter = (isset($_POST['submit']))?true:false;
-
- if($testFilter){
- $ipAdress = $_POST['ip'];
- $macAdress = $_POST['mac'];
- $poolID = $_POST['poolID'];
- $bootisoID = $_POST['bootisoID'];
- $membershipID = $_POST['membershipID'];
- $groupID = $_POST['groupID'];
- $time = ($_POST['time']);
- $clientID = $_POST['clientID'];
- $weekday = $_POST['weekday'];
- $date = $_POST['date'];
- print_a('Input',
- array('ipAdress'=>$ipAdress,
- 'macAdress'=>$macAdress,
- 'poolID' => $poolID,
- 'bootisoID' => $bootisoID,
- 'membershipID'=>$membershipID,
- 'groupID'=>$groupID,
- 'time'=> $time." - ".date('d.m.Y H:i:s',$time),
- 'clientID' => $clientID,
- 'hardwarehash' => $hardwarehash,
- 'weekday' => $weekday,
- 'date' => $date));
- }
-
-
- try{
- $set = array();
-
- $session = new Application_Model_Session();
- $sessionmapper = new Application_Model_SessionMapper();
- $sessionarray = $sessionmapper->findBy(array('alphasessionID' => $_SESSION['alphasessionID']),true);
- $session->setOptions($sessionarray[0]);
- $session->setID($sessionarray['sessionID']);
-
- if(!isset($userIDsNamespace['membershipID'])){
- $bootisoMapper = new Application_Model_BootIsoMapper();
- $bootiso = new Application_Model_BootIso();
- $bootisoMapper->find($session->getBootisoID(),$bootiso);
- $groupID = $bootiso->getGroupID();
- }else{
- $groupID = $userIDsNamespace['groupID'];
- }
-
- #########################################################
- // IP Adress
- $filtertypID = 1;
- // get it from session_table with session_id from the session
- if(!$testFilter){
- $ipAdress = $session->getIp();
- }
- $ipAdress = str_replace(".","",$this->fillIP($ipAdress));
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- REPLACE(fe.filtervalue,'.','') <= '".$ipAdress."' AND
- '".$ipAdress."' <= REPLACE(fe.filtervalue2,'.','') AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
-
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
-
- if($debuglevel >= 3 )
- print_a('ipAdress',$result,$set[$filtertypID]);
-
- #########################################################
- // Mac range
- $filtertypID = 2;
- // get it from session_table with session_id from the session
- if(!$testFilter){
- $client = new Application_Model_Client();
- $clientmapper = new Application_Model_ClientMapper();
- $clientmapper->find($session->getClientID(),$client);
- $macAdress = $client->getMacadress();
- }
- try{
- $macAdress = $this->fillMac($macAdress);
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- fe.filtervalue <= '".$macAdress."' AND
- '".$macAdress."' <= fe.filtervalue2 AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
-
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
- if($debuglevel >= 3)
- print_a('macAdress',$result,$set[$filtertypID]);
-
- #########################################################
- // PoolID
- $filtertypID = 3;
- // get PoolID from client_ID from session_id from the session
- if(!$testFilter){
- $poolentry = new Application_Model_PoolEntries();
- $poolentrymapper = new Application_Model_PoolEntriesMapper();
- $poolentry = $poolentrymapper->findby(array('clientID' => $client->getID()),true);
- @$poolentry = $poolentry[0];
-
- $poolID = $poolentry['poolID'];
- }
-
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- fe.filtervalue = ".$poolID." AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
- $result = $stmt->fetchAll();
- if(count($result)>0){
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- }
- catch(Exception $e){}
-
- if($debuglevel >= 3)
- print_a('poolID',$result,$set[$filtertypID]);
- #########################################################
- // ClientID
- $filtertypID = 8;
- // get client_ID from session_id from the session
-
- if(!$testFilter){
- $clientID = $session->getClientID();
- }
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- fe.filtervalue = ".$clientID." AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
-
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($debuglevel >= 3)
- print_a('clientID',$result,$set[$filtertypID]);
- #########################################################
- // BootIsoID
- $filtertypID = 4;
- // get BootIsoID from client_ID from session_id from the session
- if(!$testFilter){
- $bootisoID = $session->getBootisoID();
- }
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- fe.filtervalue = ".$bootisoID." AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($debuglevel >= 3)
- print_a('bootisoID',$result,$set[$filtertypID]);
- #########################################################
- // MembershipID
- $filtertypID = 5;
- if($this->membership->getID() != null){
- if(!$testFilter){
- // get membership from the session
- //TODO: GET MEMBERSHIP from SESSION
- $membershipID = $this->membership->getID();
- }
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- fe.filtervalue = ".$membershipID." AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($debuglevel >= 3)
- print_a('membership',$result,$set[$filtertypID]);
- }
- #########################################################
- // GroupID
- $filtertypID = 6;
- if($this->membership->getID() != null){
- if(!$testFilter){
- // get membership from the session
- $membergroupID = $this->membership->getGroupID();
- }
- }
-
- if(isset($membergroupID)){
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- fe.filtervalue = ".$membergroupID." AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($debuglevel >= 3)
- print_a('groupID',$result,$set[$filtertypID]);
- }
- #########################################################
- // Time
- $filtertypID = 7;
- if(!$testFilter){
- $nowShort = date("H:i");
- }
- else{
- $nowShort = date("H:i",$time);
- }
-
- $nowShort = str_replace(":","",$nowShort);
- try{
-
- $stmt = $db->query('SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = '.$filtertypID.' AND
- REPLACE(fe.filtervalue,":","") <= '.$nowShort.' AND
- REPLACE(fe.filtervalue2,":","") >= '.$nowShort." AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($debuglevel >= 3)
- print_a('time',$result,$set[$filtertypID]);
- #########################################################
- // Hardwarehash
- $filtertypID = 9;
- if(!$testFilter){
- // get hardwarehash from session
- $client = new Application_Model_Client();
- $clientmapper = new Application_Model_ClientMapper();
- $clientmapper->find($session->getClientID(),$client);
- $hardwarehash = $client->getHardwarehash();
- }
-
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- fe.filtervalue = ".$hardwarehash." AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
- $result = $stmt->fetchAll();
-
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($debuglevel >= 3)
- print_a('hardwarehash',$result,$set[$filtertypID]);
- #########################################################
- // weekday
- $filtertypID = 10;
- if(!$testFilter){
- $weekday = date('N');
- }
-
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- fe.filtervalue <= ".$weekday." AND
- ".$weekday." <= fe.filtervalue2 AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($debuglevel >= 3)
- print_a('weekday',$result,$set[$filtertypID]);
- #########################################################
- // date
- $filtertypID = 11;
- if(!$testFilter){
- $date = strtotime(date('d.m.Y'));
- }
-
- try{
- $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
- fe.filtertypeID = ".$filtertypID." AND
- fe.filtervalue <= ".$date." AND
- ".$date." <= fe.filtervalue2 AND
- fe.filterID = f.filterID AND
- f.groupID = '".$groupID."'");
- $result = $stmt->fetchAll();
- foreach($result as $r){
- $set[$filtertypID][] = $r['filterID'];
- }
- }
- catch(Exception $e){}
-
- if($debuglevel >= 3)
- print_a('date',$result,$set[$filtertypID],$date);
- ########################################
- $result = array();
- // ErgebnisSet auswerten
- if($debuglevel >= 2)
- print_a('the result sets of the filtertypes',$set);
-
- // Merging of the resultsets of the filter
- $kk = array();
- foreach($set as $myset){
- $kk = array_merge($kk,$myset);
- }
- $set = $kk;
- // counting how often a filter is evaluated at database
- $a = array();
- foreach($set as $k => $s){
- @$a[$s] += 1;
- }
- if($debuglevel >= 2)
- print_a('Übereinstimmungen pro Filter',$a);
- // Get the number of filtertypes every filter has
- $stmt = $db->query(
- "SELECT f.filterID,SUM(num) as num FROM (
- SELECT *, '1' as num
- FROM pbs_filterentries
- GROUP BY filterID, filtertypeID
- ) d RIGHT OUTER JOIN pbs_filter f ON d.filterID = f.filterID
- WHERE groupID = '".$groupID."' GROUP BY d.filterID");
- $resultset = $stmt->fetchAll();
- foreach($resultset as $d){
- if($d['num'] == NULL){
- $d['num'] = 0;
- // write filter with empty filterrules in resultset
- $result[] = $d['filterID'];
- }
-
- $database[$d['filterID']] = $d['num'];
- }
- if($debuglevel >= 2)
- print_a('Anzahl Filterentries in Datenbank',$database);
-
- // remove all filters from resultset, which to few filtertypes satisfied
-
- foreach($a as $i=>$b){
- if($a[$i] < $database[$i]){
- unset($a[$i]);
- }
- else{
- $result[] = $i;
- }
- }
- if($debuglevel >= 1)
- print_a('Valid Filters',$result);
-
- // now selecting the filter with the highest priority
- $query = 'SELECT filterID, bootmenuID, priority
- FROM pbs_filter WHERE ';
- foreach($result as $e){
- $queryTmp[] = "filterID = '$e'";
- }
- $query .= implode(" OR ", $queryTmp);
- $query .= 'ORDER BY priority DESC LIMIT 0,1';
- $bootmenuID = 'null';
- try{
- $stmt = $db->query($query);
- $resultset = $stmt->fetchAll();
- $bootmenuID = $resultset[0]['bootmenuID'];
- }
- catch(Exception $e){
- }
- if($bootmenuID != 'null'){
- $bm = new Application_Model_BootMenu();
- $bmmapper = new Application_Model_BootMenuMapper();
- $bmmapper->find($bootmenuID,$bm);
- return $bootmenuID;
- }
- else{
- return null;
- }
-
- }catch (Zend_Exception $e) {
- echo "class: ".get_class($e)."<br>\n";
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
- private function fillIP($ip)
- {
- $ar = explode(".",$ip);
- $representation = array();
- foreach($ar as $part){
- $representation[] = sprintf("%03s",$part);
- }
- return implode(".",$representation);
+<? php
+
+class Pbs_Filter {
+
+ private $db = null;
+ private $membership;
+
+ public function evaluate() {
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ $db = $this->db;
+ $debuglevel = 0;
+
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $this->membership = new Application_Model_Membership();
+ if(isset($userIDsNamespace['membershipID'])) {
+ $membershipMapper->find($userIDsNamespace['membershipID'], $this->membership);
+ } else {
+ $this->membership->setID(null);
+ }
+
+ // For Testing Filters
+ $testFilter = (isset($_POST['submit'])) ? true : false;
+
+ if($testFilter) {
+ $ipAdress = $_POST['ip'];
+ $macAdress = $_POST['mac'];
+ $poolID = $_POST['poolID'];
+ $bootisoID = $_POST['bootisoID'];
+ $membershipID = $_POST['membershipID'];
+ $groupID = $_POST['groupID'];
+ $time = ($_POST['time']);
+ $clientID = $_POST['clientID'];
+ $weekday = $_POST['weekday'];
+ $date = $_POST['date'];
+ print_a('Input',
+ array('ipAdress' => $ipAdress,
+ 'macAdress' => $macAdress,
+ 'poolID' => $poolID,
+ 'bootisoID' => $bootisoID,
+ 'membershipID' => $membershipID,
+ 'groupID' => $groupID,
+ 'time' => $time." - ".date('d.m.Y H:i:s', $time),
+ 'clientID' => $clientID,
+ 'hardwarehash' => $hardwarehash,
+ 'weekday' => $weekday,
+ 'date' => $date));
+ }
+
+
+ try {
+ $set = array();
+
+ $session = new Application_Model_Session();
+ $sessionmapper = new Application_Model_SessionMapper();
+ $sessionarray = $sessionmapper->findBy(array('alphasessionID' => $_SESSION['alphasessionID']), true);
+ $session->setOptions($sessionarray[0]);
+ $session->setID($sessionarray['sessionID']);
+
+ if(!isset($userIDsNamespace['membershipID'])) {
+ $bootisoMapper = new Application_Model_BootIsoMapper();
+ $bootiso = new Application_Model_BootIso();
+ $bootisoMapper->find($session->getBootisoID(), $bootiso);
+ $groupID = $bootiso->getGroupID();
+ } else {
+ $groupID = $userIDsNamespace['groupID'];
+ }
+
+#########################################################
+ // IP Adress
+ $filtertypID = 1;
+ // get it from session_table with session_id from the session
+ if(!$testFilter) {
+ $ipAdress = $session->getIp();
+ }
+ $ipAdress = str_replace(".", "", $this->fillIP($ipAdress));
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ REPLACE(fe.filtervalue,'.','') <= '".$ipAdress."' AND
+ '".$ipAdress."' <= REPLACE(fe.filtervalue2,'.','') AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+
+ if($debuglevel >= 3 )
+ { print_a('ipAdress', $result, $set[$filtertypID]); }
+
+#########################################################
+ // Mac range
+ $filtertypID = 2;
+ // get it from session_table with session_id from the session
+ if(!$testFilter) {
+ $client = new Application_Model_Client();
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->find($session->getClientID(), $client);
+ $macAdress = $client->getMacadress();
+ }
+ try {
+ $macAdress = $this->fillMac($macAdress);
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ fe.filtervalue <= '".$macAdress."' AND
+ '".$macAdress."' <= fe.filtervalue2 AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {}
+ if($debuglevel >= 3)
+ { print_a('macAdress', $result, $set[$filtertypID]); }
+
+#########################################################
+ // PoolID
+ $filtertypID = 3;
+ // get PoolID from client_ID from session_id from the session
+ if(!$testFilter) {
+ $poolentry = new Application_Model_PoolEntries();
+ $poolentrymapper = new Application_Model_PoolEntriesMapper();
+ $poolentry = $poolentrymapper->findby(array('clientID' => $client->getID()), true);
+ @$poolentry = $poolentry[0];
+
+ $poolID = $poolentry['poolID'];
+ }
+
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ fe.filtervalue = ".$poolID." AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+ $result = $stmt->fetchAll();
+ if(count($result) > 0) {
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ }
+ } catch(Exception $e) {}
+
+ if($debuglevel >= 3)
+ { print_a('poolID', $result, $set[$filtertypID]); }
+#########################################################
+ // ClientID
+ $filtertypID = 8;
+ // get client_ID from session_id from the session
+
+ if(!$testFilter) {
+ $clientID = $session->getClientID();
+ }
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ fe.filtervalue = ".$clientID." AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {}
+
+ if($debuglevel >= 3)
+ { print_a('clientID', $result, $set[$filtertypID]); }
+#########################################################
+ // BootIsoID
+ $filtertypID = 4;
+ // get BootIsoID from client_ID from session_id from the session
+ if(!$testFilter) {
+ $bootisoID = $session->getBootisoID();
+ }
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ fe.filtervalue = ".$bootisoID." AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {}
+
+ if($debuglevel >= 3)
+ { print_a('bootisoID', $result, $set[$filtertypID]); }
+#########################################################
+ // MembershipID
+ $filtertypID = 5;
+ if($this->membership->getID() != null) {
+ if(!$testFilter) {
+ // get membership from the session
+ //TODO: GET MEMBERSHIP from SESSION
+ $membershipID = $this->membership->getID();
+ }
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ fe.filtervalue = ".$membershipID." AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {}
+
+ if($debuglevel >= 3)
+ { print_a('membership', $result, $set[$filtertypID]); }
+ }
+#########################################################
+ // GroupID
+ $filtertypID = 6;
+ if($this->membership->getID() != null) {
+ if(!$testFilter) {
+ // get membership from the session
+ $membergroupID = $this->membership->getGroupID();
+ }
+ }
+
+ if(isset($membergroupID)) {
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ fe.filtervalue = ".$membergroupID." AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {}
+
+ if($debuglevel >= 3)
+ { print_a('groupID', $result, $set[$filtertypID]); }
+ }
+#########################################################
+ // Time
+ $filtertypID = 7;
+ if(!$testFilter) {
+ $nowShort = date("H:i");
+ } else {
+ $nowShort = date("H:i", $time);
+ }
+
+ $nowShort = str_replace(":", "", $nowShort);
+ try {
+
+ $stmt = $db->query('SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = '.$filtertypID.' AND
+ REPLACE(fe.filtervalue,":","") <= '.$nowShort.' AND
+ REPLACE(fe.filtervalue2,":","") >= '.$nowShort." AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {}
+
+ if($debuglevel >= 3)
+ { print_a('time', $result, $set[$filtertypID]); }
+#########################################################
+ // Hardwarehash
+ $filtertypID = 9;
+ if(!$testFilter) {
+ // get hardwarehash from session
+ $client = new Application_Model_Client();
+ $clientmapper = new Application_Model_ClientMapper();
+ $clientmapper->find($session->getClientID(), $client);
+ $hardwarehash = $client->getHardwarehash();
+ }
+
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ fe.filtervalue = ".$hardwarehash." AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+ $result = $stmt->fetchAll();
+
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {}
+
+ if($debuglevel >= 3)
+ { print_a('hardwarehash', $result, $set[$filtertypID]); }
+#########################################################
+ // weekday
+ $filtertypID = 10;
+ if(!$testFilter) {
+ $weekday = date('N');
+ }
+
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ fe.filtervalue <= ".$weekday." AND
+ ".$weekday." <= fe.filtervalue2 AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {}
+
+ if($debuglevel >= 3)
+ { print_a('weekday', $result, $set[$filtertypID]); }
+#########################################################
+ // date
+ $filtertypID = 11;
+ if(!$testFilter) {
+ $date = strtotime(date('d.m.Y'));
+ }
+
+ try {
+ $stmt = $db->query("SELECT * FROM pbs_filterentries fe, pbs_filter f WHERE
+ fe.filtertypeID = ".$filtertypID." AND
+ fe.filtervalue <= ".$date." AND
+ ".$date." <= fe.filtervalue2 AND
+ fe.filterID = f.filterID AND
+ f.groupID = '".$groupID."'");
+ $result = $stmt->fetchAll();
+ foreach($result as $r) {
+ $set[$filtertypID][] = $r['filterID'];
+ }
+ } catch(Exception $e) {}
+
+ if($debuglevel >= 3)
+ { print_a('date', $result, $set[$filtertypID], $date); }
+########################################
+ $result = array();
+ // ErgebnisSet auswerten
+ if($debuglevel >= 2)
+ { print_a('the result sets of the filtertypes', $set); }
+
+ // Merging of the resultsets of the filter
+ $kk = array();
+ foreach($set as $myset) {
+ $kk = array_merge($kk, $myset);
+ }
+ $set = $kk;
+ // counting how often a filter is evaluated at database
+ $a = array();
+ foreach($set as $k => $s) {
+ @$a[$s] += 1;
+ }
+ if($debuglevel >= 2)
+ { print_a('Übereinstimmungen pro Filter', $a); }
+ // Get the number of filtertypes every filter has
+ $stmt = $db->query(
+ "SELECT f.filterID,SUM(num) as num FROM (
+ SELECT *, '1' as num
+ FROM pbs_filterentries
+ GROUP BY filterID, filtertypeID
+ ) d RIGHT OUTER JOIN pbs_filter f ON d.filterID = f.filterID
+ WHERE groupID = '".$groupID."' GROUP BY d.filterID");
+ $resultset = $stmt->fetchAll();
+ foreach($resultset as $d) {
+ if($d['num'] == NULL) {
+ $d['num'] = 0;
+ // write filter with empty filterrules in resultset
+ $result[] = $d['filterID'];
+ }
+
+ $database[$d['filterID']] = $d['num'];
+ }
+ if($debuglevel >= 2)
+ { print_a('Anzahl Filterentries in Datenbank', $database); }
+
+ // remove all filters from resultset, which to few filtertypes satisfied
+
+ foreach($a as $i => $b) {
+ if($a[$i] < $database[$i]) {
+ unset($a[$i]);
+ } else {
+ $result[] = $i;
+ }
+ }
+ if($debuglevel >= 1)
+ { print_a('Valid Filters', $result); }
+
+ // now selecting the filter with the highest priority
+ $query = 'SELECT filterID, bootmenuID, priority
+ FROM pbs_filter WHERE ';
+ foreach($result as $e) {
+ $queryTmp[] = "filterID = '$e'";
+ }
+ $query . = implode(" OR ", $queryTmp);
+ $query . = 'ORDER BY priority DESC LIMIT 0,1';
+ $bootmenuID = 'null';
+ try {
+ $stmt = $db->query($query);
+ $resultset = $stmt->fetchAll();
+ $bootmenuID = $resultset[0]['bootmenuID'];
+ } catch(Exception $e) {
+ }
+ if($bootmenuID != 'null') {
+ $bm = new Application_Model_BootMenu();
+ $bmmapper = new Application_Model_BootMenuMapper();
+ $bmmapper->find($bootmenuID, $bm);
+ return $bootmenuID;
+ } else {
+ return null;
+ }
+
+ } catch (Zend_Exception $e) {
+ echo "class: ".get_class($e)."<br>\n";
+ echo "Error message 2: " . $e->getMessage() . "\n";
+ }
+ }
+ private function fillIP($ip) {
+ $ar = explode(".", $ip);
+ $representation = array();
+ foreach($ar as $part) {
+ $representation[] = sprintf("%03s", $part);
}
+ return implode(".", $representation);
+ }
- private function fillMac($ip)
- {
- $ar = explode(":",$ip);
- $representation = array();
- foreach($ar as $part){
- $representation[] = sprintf("%02s",$part);
- }
- return implode(":",$representation);
+ private function fillMac($ip) {
+ $ar = explode(":", $ip);
+ $representation = array();
+ foreach($ar as $part) {
+ $representation[] = sprintf("%02s", $part);
}
+ return implode(":", $representation);
+ }
}
-?>
+? >
diff --git a/library/Pbs/Graph.php b/library/Pbs/Graph.php
index f9b236a..a37af35 100644
--- a/library/Pbs/Graph.php
+++ b/library/Pbs/Graph.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,138 +10,137 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_Graph{
-
- private $db = null;
- private $membership;
- private $graphstring;
- private $level;
- private $edges;
- private $crawledNodes;
- private $childs = array();
-
- public function graph($groupID)
- {
- $this->db = Zend_Db_Table::getDefaultAdapter();
- $db = $this->db;
-
-
- $path = "../resources/groupgraphs/";
- @mkdir($path ,0777, true);
-
- $this->graphstring = 'digraph groups {
- size="7,5";
- pad=0.1;
- graph[ bgcolor=transparent ];
- node [ style=filled fillcolor="#ffffffff" ];';
- if($this->level <0)
- $this->graphstring .= '"'.$this->getGroupTitle($groupID).'"';
- else
- $this->graphstring .= '"'.$this->getGroupTitle($groupID).'" [ fontcolor="#ffffffff", style=filled, fillcolor="#004A99FF"];';
-
- if(count($this->childs) >=1){
- foreach($this->childs as $childID){
- $this->edges[$groupID][$childID] = 1;
- $this->graphstring .= '"'.$this->getGroupTitle($groupID).'" -> "'.$this->getGroupTitle($childID).'";'."\n";
- $this->getChildGroups($childID);
- }
- }
- $this->getParentGroups($groupID);
- $this->getChildGroups($groupID);
- $this->graphstring .= '}';
-
- // for debugging
- # $fp = fopen($path.'thisgraph.dot', "w");
- # fputs ($fp, $this->graphstring);
- # fclose ($fp);
-
-
- $this->graphstring = str_replace(array("\t","\n"),"",$this->graphstring);
- $this->graphstring = str_replace('"','\"',$this->graphstring);
-
- $md5 = md5($this->graphstring);
- $path = "../resources/groupgraphs/";
- @mkdir($path ,0777, true);
-
- // randomly delete cached files, old files are not needed
- // so delete it sometimes
- if(rand(0,20) == 1){
- $days = "14"; // delete all files older than this many days
- $seconds = ($days*24*60*60);
-
- $files = scandir($path);
- foreach ($files as $num => $fname){
- if (file_exists("{$path}{$fname}") && ((time() - filemtime("{$path}{$fname}")) > $seconds)) {
- $mod_time = filemtime("{$path}{$fname}");
- unlink("{$path}{$fname}");
- }
- }
- }
-
- if(!file_exists($path.$md5.".png")){
- $str = 'echo "';
- $str .= $this->graphstring;
- $str .= '" | dot -Tpng >'.$path.$md5.".png";
- exec($str);
- }
-
- passthru("cat ".$path.$md5.".png", $result);
- return $result;
- }
- private function getGroupTitle($groupID){
- $group = new Application_Model_Group();
- $groupmapper = new Application_Model_GroupMapper();
- $groupmapper->find($groupID,$group);
- return $group->getTitle();
- }
- public function newChild($id){
- $this->childs[] = $id;
- }
-
- private function getParentGroups($groupID, $level=1) {
- if($this->crawledNodes['parent'][$groupID] == 1)
- return;
- $this->crawledNodes['parent'][$groupID] = 1;
- $db = Zend_Db_Table::getDefaultAdapter();
- $query = 'SELECT parentID FROM pbs_groupgroups WHERE groupID="'.$groupID.'"';
- $stmt = $db->query($query);
- $result = $stmt->fetchAll();
- foreach($result as $row){
- // save the current groupID in level-list
- #$data[$level][] = $row['parentID'];
- if($this->edges[$row['parentID']][$groupID] != 1){
- $this->graphstring .= '"'.$this->getGroupTitle($row['parentID']).'" -> "'.$this->getGroupTitle($groupID).'";'."\n";
- $this->edges[$row['parentID']][$groupID] = 1;
- }
- // get the function recursive an increase the level
- $this->getParentGroups($row['parentID'], $level+1);
- }
- }
-
- // Gets all childs-groups from a given group
- private function getChildGroups($groupID, $level=1) {
- if(@$this->crawledNodes['child'][$groupID] == 1)
- return;
- $this->crawledNodes['child'][$groupID] = 1;
- $db = Zend_Db_Table::getDefaultAdapter();
- $query = 'SELECT groupID FROM pbs_groupgroups WHERE parentID="'.$groupID.'"';
- $stmt = $db->query($query);
- $result = $stmt->fetchAll();
- foreach($result as $row){
- // save the current groupID in level-list
- #$data[$level][] = $row['groupID'];
- if(@$this->edges[$groupID][$row['groupID']] != 1){
- $this->graphstring .= '"'.$this->getGroupTitle($groupID).'" -> "'.$this->getGroupTitle($row['groupID']).'";'."\n";
- $this->edges[$groupID][$row['groupID']] = 1;
- }
- if($this->level >= $level){
- $this->graphstring .= '"'.$this->getGroupTitle($row['groupID']).'"'.' [ fontcolor="#ffffffff", style=filled, fillcolor="#004A99FF"];'."\n";
- }
- // get the function recursive an increase the level
- $this->getChildGroups($row['groupID'], $level+1);
- }
- }
- public function setHiglightLevel($i){
- $this->level = $i;
- }
+class Pbs_Graph {
+
+ private $db = null;
+ private $membership;
+ private $graphstring;
+ private $level;
+ private $edges;
+ private $crawledNodes;
+ private $childs = array();
+
+ public function graph($groupID) {
+ $this->db = Zend_Db_Table::getDefaultAdapter();
+ $db = $this->db;
+
+
+ $path = "../resources/groupgraphs/";
+ @mkdir($path , 0777, true);
+
+ $this->graphstring = 'digraph groups {
+ size="7,5";
+ pad=0.1;
+ graph[ bgcolor=transparent ];
+ node [ style=filled fillcolor="#ffffffff" ];';
+ if($this->level < 0)
+ { $this->graphstring . = '"'.$this->getGroupTitle($groupID).'"'; }
+ else
+ { $this->graphstring . = '"'.$this->getGroupTitle($groupID).'" [ fontcolor="#ffffffff", style=filled, fillcolor="#004A99FF"];'; }
+
+ if(count($this->childs) >= 1) {
+ foreach($this->childs as $childID) {
+ $this->edges[$groupID][$childID] = 1;
+ $this->graphstring . = '"'.$this->getGroupTitle($groupID).'" -> "'.$this->getGroupTitle($childID).'";'."\n";
+ $this->getChildGroups($childID);
+ }
+ }
+ $this->getParentGroups($groupID);
+ $this->getChildGroups($groupID);
+ $this->graphstring . = '}';
+
+ // for debugging
+# $fp = fopen($path.'thisgraph.dot', "w");
+# fputs ($fp, $this->graphstring);
+# fclose ($fp);
+
+
+ $this->graphstring = str_replace(array("\t", "\n"), "", $this->graphstring);
+ $this->graphstring = str_replace('"', '\"', $this->graphstring);
+
+ $md5 = md5($this->graphstring);
+ $path = "../resources/groupgraphs/";
+ @mkdir($path , 0777, true);
+
+ // randomly delete cached files, old files are not needed
+ // so delete it sometimes
+ if(rand(0, 20) == 1) {
+ $days = "14"; // delete all files older than this many days
+ $seconds = ($days * 24 * 60 * 60);
+
+ $files = scandir($path);
+ foreach ($files as $num => $fname) {
+ if (file_exists("{$path}{$fname}") && ((time() - filemtime("{$path}{$fname}")) > $seconds)) {
+ $mod_time = filemtime("{$path}{$fname}");
+ unlink("{$path}{$fname}");
+ }
+ }
+ }
+
+ if(!file_exists($path.$md5.".png")) {
+ $str = 'echo "';
+ $str . = $this->graphstring;
+ $str . = '" | dot -Tpng >'.$path.$md5.".png";
+ exec($str);
+ }
+
+ passthru("cat ".$path.$md5.".png", $result);
+ return $result;
+ }
+ private function getGroupTitle($groupID) {
+ $group = new Application_Model_Group();
+ $groupmapper = new Application_Model_GroupMapper();
+ $groupmapper->find($groupID, $group);
+ return $group->getTitle();
+ }
+ public function newChild($id) {
+ $this->childs[] = $id;
+ }
+
+ private function getParentGroups($groupID, $level = 1) {
+ if($this->crawledNodes['parent'][$groupID] == 1)
+ { return; }
+ $this->crawledNodes['parent'][$groupID] = 1;
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $query = 'SELECT parentID FROM pbs_groupgroups WHERE groupID="'.$groupID.'"';
+ $stmt = $db->query($query);
+ $result = $stmt->fetchAll();
+ foreach($result as $row) {
+ // save the current groupID in level-list
+#$data[$level][] = $row['parentID'];
+ if($this->edges[$row['parentID']][$groupID] != 1) {
+ $this->graphstring . = '"'.$this->getGroupTitle($row['parentID']).'" -> "'.$this->getGroupTitle($groupID).'";'."\n";
+ $this->edges[$row['parentID']][$groupID] = 1;
+ }
+ // get the function recursive an increase the level
+ $this->getParentGroups($row['parentID'], $level + 1);
+ }
+ }
+
+ // Gets all childs-groups from a given group
+ private function getChildGroups($groupID, $level = 1) {
+ if(@$this->crawledNodes['child'][$groupID] == 1)
+ { return; }
+ $this->crawledNodes['child'][$groupID] = 1;
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $query = 'SELECT groupID FROM pbs_groupgroups WHERE parentID="'.$groupID.'"';
+ $stmt = $db->query($query);
+ $result = $stmt->fetchAll();
+ foreach($result as $row) {
+ // save the current groupID in level-list
+#$data[$level][] = $row['groupID'];
+ if(@$this->edges[$groupID][$row['groupID']] != 1) {
+ $this->graphstring . = '"'.$this->getGroupTitle($groupID).'" -> "'.$this->getGroupTitle($row['groupID']).'";'."\n";
+ $this->edges[$groupID][$row['groupID']] = 1;
+ }
+ if($this->level >= $level) {
+ $this->graphstring . = '"'.$this->getGroupTitle($row['groupID']).'"'.' [ fontcolor="#ffffffff", style=filled, fillcolor="#004A99FF"];'."\n";
+ }
+ // get the function recursive an increase the level
+ $this->getChildGroups($row['groupID'], $level + 1);
+ }
+ }
+ public function setHiglightLevel($i) {
+ $this->level = $i;
+ }
}
diff --git a/library/Pbs/NewConfig.php b/library/Pbs/NewConfig.php
index 2101bf9..7a832a1 100644
--- a/library/Pbs/NewConfig.php
+++ b/library/Pbs/NewConfig.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,61 +10,61 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_NewConfig{
-
- public function createDefaultConfig(Application_Model_BootOs $bootos){
-
- if($bootos == null)
- return;
-
- $config = new Application_Model_Config();
- $configMapper = new Application_Model_ConfigMapper();
- $bootosuser = new Application_Model_BootOsUser();
- $bootosuserkiosk = new Application_Model_BootOsUser();
- $bootosuserMapper = new Application_Model_BootOsUserMapper();
-
- try{
-
- $config->setTitle('Default')
- ->setDescription('This is the default Config for Bootos: '.$bootos->getTitle())
- ->setGroupID($bootos->getGroupID())
- ->setVisible('1')
- ->setCreated(time())
- ->setBootosID($bootos->getID());
-
- $configID = $configMapper->save($config);
-
- $bootosuser->setConfigID($configID)
- ->setLogin('%username%')
- ->setPassword('%password%')
- ->setHomepath('/home/%username%')
- ->setHometypeID('0');
-
- $bootosuserMapper->save($bootosuser);
-
- $bootosuserkiosk->setConfigID($configID)
- ->setLogin('kiosk')
- ->setPassword(crypt('kiosk', '$6$'.randomString(8).'$'))
- ->setHomepath('/home/kiosk')
- ->setHometypeID('0');
-
- $bootosuserMapper->save($bootosuserkiosk);
-
- }catch(Zend_Exception $e){
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
-
-
-
- }
-
- public function parseConfig($bootosID){
- $configpath = "../resources/bootos/".$bootosID."/config/";
- //Do something...
-
- }
+class Pbs_NewConfig {
+
+ public function createDefaultConfig(Application_Model_BootOs $bootos) {
+
+ if($bootos == null)
+ { return; }
+
+ $config = new Application_Model_Config();
+ $configMapper = new Application_Model_ConfigMapper();
+ $bootosuser = new Application_Model_BootOsUser();
+ $bootosuserkiosk = new Application_Model_BootOsUser();
+ $bootosuserMapper = new Application_Model_BootOsUserMapper();
+
+ try {
+
+ $config->setTitle('Default')
+ ->setDescription('This is the default Config for Bootos: '.$bootos->getTitle())
+ ->setGroupID($bootos->getGroupID())
+ ->setVisible('1')
+ ->setCreated(time())
+ ->setBootosID($bootos->getID());
+
+ $configID = $configMapper->save($config);
+
+ $bootosuser->setConfigID($configID)
+ ->setLogin('%username%')
+ ->setPassword('%password%')
+ ->setHomepath('/home/%username%')
+ ->setHometypeID('0');
+
+ $bootosuserMapper->save($bootosuser);
+
+ $bootosuserkiosk->setConfigID($configID)
+ ->setLogin('kiosk')
+ ->setPassword(crypt('kiosk', '$6$'.randomString(8).'$'))
+ ->setHomepath('/home/kiosk')
+ ->setHometypeID('0');
+
+ $bootosuserMapper->save($bootosuserkiosk);
+
+ } catch(Zend_Exception $e) {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+
+
+
+ }
+
+ public function parseConfig($bootosID) {
+ $configpath = "../resources/bootos/".$bootosID."/config/";
+ //Do something...
+
+ }
}
-?>
+? >
diff --git a/library/Pbs/NewMember.php b/library/Pbs/NewMember.php
index 3a1e868..4fe5776 100644
--- a/library/Pbs/NewMember.php
+++ b/library/Pbs/NewMember.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,66 +10,66 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_NewMember{
+class Pbs_NewMember {
- public function createDefaults(Application_Model_Membership $membership){
- $personMapper = new Application_Model_PersonMapper();
- $bootmenuMapper = new Application_Model_BootMenuMapper();
- $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $filterMapper = new Application_Model_FilterMapper();
- $filterentriesMapper = new Application_Model_FilterEntriesMapper();
-
- // First we copy the default bootmenu with all the entries
- $groupID = $membership->getGroupID();
- $person = $personMapper->find($membership->getPersonID());
- $personname = $person->getFirstName(). " " . $person->getName();
-
- $defaultBootmenu = $bootmenuMapper->findBy(array('groupID'=>$groupID, 'defaultbootmenu'=>'1'));
- $defaultBootmenu = $defaultBootmenu[0];
-
- $userBootmenu = new Application_Model_BootMenu();
- $userBootmenu->setID(null);
- $userBootmenu->setGroupID(null);
- $userBootmenu->setMembershipID($membership->getID());
- $userBootmenu->setTitle("BootMenu of ".$personname);
- $userBootmenu->setStartcounter(300);
- $userBootmenu->setCreated(time());
- $userBootmenu->setDefaultbootmenu(0);
- $userBootmenuID = $bootmenuMapper->save($userBootmenu);
- $userBootmenu->setID($userBootmenuID);
-
- # print_a('userbootmenu',$userBootmenu);
- if($defaultBootmenu != ''){
- $bootmenuentries = $bootmenuentriesMapper->findBy(array('bootmenuID'=>$defaultBootmenu->getID()));
- foreach($bootmenuentries as $bme){
- $bme->setID(null);
- $bme->setBootmenuID($userBootmenuID);
- $bootmenuentriesMapper->save($bme);
- #print_a('bootmenuentry',$bme);
- }
- }
-
- // Second we create a filter
- $filter = new Application_Model_Filter();
- $filter->setTitle("Filter of ".$personname);
- $filter->setDescription("This filter was automatically created to forward the user to his own bootmenu");
- $filter->setMembershipID($membership->getID());
- $filter->setGroupID($membership->getGroupID());
- $filter->setBootmenuID($userBootmenuID);
- $filter->setCreated(time());
- $filter->setPriority(25);
- $filterID = $filterMapper->save($filter);
- # print_a('filter',$filter);
-
- $filterentry = new Application_Model_FilterEntries();
- $filterentry->setFilterID($filterID);
- $filterentry->setFiltertypeID(5);
- $filterentry->setFiltervalue($membership->getID());
- $filterentriesMapper->save($filterentry);
- # print_a('filterentry',$filterentry);
-
-
- }
+ public function createDefaults(Application_Model_Membership $membership) {
+ $personMapper = new Application_Model_PersonMapper();
+ $bootmenuMapper = new Application_Model_BootMenuMapper();
+ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $filterMapper = new Application_Model_FilterMapper();
+ $filterentriesMapper = new Application_Model_FilterEntriesMapper();
+
+ // First we copy the default bootmenu with all the entries
+ $groupID = $membership->getGroupID();
+ $person = $personMapper->find($membership->getPersonID());
+ $personname = $person->getFirstName(). " " . $person->getName();
+
+ $defaultBootmenu = $bootmenuMapper->findBy(array('groupID' => $groupID, 'defaultbootmenu' => '1'));
+ $defaultBootmenu = $defaultBootmenu[0];
+
+ $userBootmenu = new Application_Model_BootMenu();
+ $userBootmenu->setID(null);
+ $userBootmenu->setGroupID(null);
+ $userBootmenu->setMembershipID($membership->getID());
+ $userBootmenu->setTitle("BootMenu of ".$personname);
+ $userBootmenu->setStartcounter(300);
+ $userBootmenu->setCreated(time());
+ $userBootmenu->setDefaultbootmenu(0);
+ $userBootmenuID = $bootmenuMapper->save($userBootmenu);
+ $userBootmenu->setID($userBootmenuID);
+
+# print_a('userbootmenu',$userBootmenu);
+ if($defaultBootmenu != '') {
+ $bootmenuentries = $bootmenuentriesMapper->findBy(array('bootmenuID' => $defaultBootmenu->getID()));
+ foreach($bootmenuentries as $bme) {
+ $bme->setID(null);
+ $bme->setBootmenuID($userBootmenuID);
+ $bootmenuentriesMapper->save($bme);
+#print_a('bootmenuentry',$bme);
+ }
+ }
+
+ // Second we create a filter
+ $filter = new Application_Model_Filter();
+ $filter->setTitle("Filter of ".$personname);
+ $filter->setDescription("This filter was automatically created to forward the user to his own bootmenu");
+ $filter->setMembershipID($membership->getID());
+ $filter->setGroupID($membership->getGroupID());
+ $filter->setBootmenuID($userBootmenuID);
+ $filter->setCreated(time());
+ $filter->setPriority(25);
+ $filterID = $filterMapper->save($filter);
+# print_a('filter',$filter);
+
+ $filterentry = new Application_Model_FilterEntries();
+ $filterentry->setFilterID($filterID);
+ $filterentry->setFiltertypeID(5);
+ $filterentry->setFiltervalue($membership->getID());
+ $filterentriesMapper->save($filterentry);
+# print_a('filterentry',$filterentry);
+
+
+ }
}
-?>
+? >
diff --git a/library/Pbs/Notifier.php b/library/Pbs/Notifier.php
index 509d7de..cfe2066 100644
--- a/library/Pbs/Notifier.php
+++ b/library/Pbs/Notifier.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,169 +10,169 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_Notifier{
+class Pbs_Notifier {
-
- public function notify($action,$result){
-
- switch($action){
- default:
- switch($result){
- case "forbidden":
- $result = "errorbox";
- break;
- case "ok":
- $result = "okbox";
- break;
- case "error":
- $result = "warningbox";
- break;
- case "info":
- $result = "infobox";
- break;
- }
- $result = "<div class='$result'>$action</div>";
- break;
- case "delete":
- switch($result){
- case "forbidden":
- $result = "<div class='errorbox'>Not allowed to delete this</div>";
- break;
- case "ok":
- $result = "<div class='okbox'>Delete sucessful</div>";
- break;
- case "error":
- $result = "<div class='warningbox'>Delete failed</div>";
- break;
- }
- break;
- case "view":
- switch($result){
- case "forbidden":
- $result = "<div class='errorbox'>Not allowed to see this</div>";
- break;
- }
- break;
- case "download":
- switch($result){
- case "forbidden":
- $result = "<div class='errorbox'>Not allowed to download this</div>";
- break;
- case "404":
- $result = "<div class='errorbox'>The Resource was not found on the Server</div>";
- break;
- case "error":
- $result = "<div class='errorbox'>Download failed</div>";
- break;
- }
- break;
- case "modify":
- switch($result){
- case "forbidden":
- $result = "<div class='errorbox'>Not allowed to modify this</div>";
- break;
- case "ok":
- $result = "<div class='okbox'>Modify sucessful</div>";
- break;
- case "error":
- $result = "<div class='warningbox'>Modify failed</div>";
- break;
- }
- break;
- case "create":
- switch($result){
- case "forbidden":
- $result = "<div class='errorbox'>Not allowed to create this</div>";
- break;
- case "ok":
- $result = "<div class='okbox'>Creation sucessful</div>";
- break;
- case "error":
- $result = "<div class='warningbox'>Creation failed</div>";
- break;
- case "file":
- $result = "<div class='errorbox'>The File must be greater than 0 bytes</div>";
- break;
- }
- break;
- case "update":
- switch($result){
- case "forbidden":
- $result = "<div class='errorbox'>Not allowed to update this</div>";
- break;
- case "404":
- $result = "<div class='errorbox'>The Resource was not found on the specified path</div>";
- break;
- case "ok":
- $result = "<div class='okbox'>Update sucessful</div>";
- break;
- case "error":
- $result = "<div class='warningbox'>Update failed</div>";
- break;
- }
- break;
- case "serial":
- switch($result){
- case "noserial":
- $result = "<div class='errorbox'>Your PreBoot is broken, please download a new Version or contact a PBS Administrator</div>";
- break;
- }
- break;
- case "link":
- switch($result){
- case "forbidden":
- $result = "<div class='errorbox'>Not allowed to link this</div>";
- break;
- case "ok":
- $result = "<div class='okbox'>Link sucessful</div>";
- break;
- case "error":
- $result = "<div class='warningbox'>Link failed</div>";
- break;
- }
- break;
- case "unlink":
- switch($result){
- case "forbidden":
- $result = "<div class='errorbox'>Not allowed to unlink this</div>";
- break;
- case "ok":
- $result = "<div class='okbox'>Unlink sucessful</div>";
- break;
- case "error":
- $result = "<div class='warningbox'>Unlink failed</div>";
- break;
- }
- break;
- case "json":
- switch($result){
- default:{
- $result = unserialize($result);
- $result2 = "<div class='infobox'>";
- $result2 .= "<table class='json'>";
- $result2 .= "<tr><td><b>info</b>: </td><td>".$result['info']."</td></tr>";
- $result2 .= "<tr><td><b>kernel</b>: </td><td><a href=".$result['kernel'].">".$result['kernel']."<a></td></tr>";
- $result2 .= "<tr><td><b>initramfs</b>: </td><td><a href=".$result['initramfs'].">".$result['initramfs']."<a></td></tr>";
- $result2 .= "<tr><td><b>kcl</b>: </td><td><a href=".$result['kcl'].">".$result['kcl']."<a></td></tr>";
- $result2 .= "<tr><td><b>config</b>: </td><td>".$result['config']."</td></tr>";
- $result2 .= "</table>";
- $result2 .= "</div>";
- $result = $result2;
- }
- break;
- case "forbidden":
- $result = "<div class='errorbox'>Not allowed to display ressources</div>";
- break;
- case "error":
- $result = "<div class='warningbox'>Displaying ressources failed</div>";
- break;
- }
- break;
- }
- return $result;
-
- }
+ public function notify($action, $result) {
+
+ switch($action) {
+ default:
+ switch($result) {
+ case "forbidden":
+ $result = "errorbox";
+ break;
+ case "ok":
+ $result = "okbox";
+ break;
+ case "error":
+ $result = "warningbox";
+ break;
+ case "info":
+ $result = "infobox";
+ break;
+ }
+ $result = "<div class='$result'>$action</div>";
+ break;
+ case "delete":
+ switch($result) {
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to delete this</div>";
+ break;
+ case "ok":
+ $result = "<div class='okbox'>Delete sucessful</div>";
+ break;
+ case "error":
+ $result = "<div class='warningbox'>Delete failed</div>";
+ break;
+ }
+ break;
+ case "view":
+ switch($result) {
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to see this</div>";
+ break;
+ }
+ break;
+ case "download":
+ switch($result) {
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to download this</div>";
+ break;
+ case "404":
+ $result = "<div class='errorbox'>The Resource was not found on the Server</div>";
+ break;
+ case "error":
+ $result = "<div class='errorbox'>Download failed</div>";
+ break;
+ }
+ break;
+ case "modify":
+ switch($result) {
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to modify this</div>";
+ break;
+ case "ok":
+ $result = "<div class='okbox'>Modify sucessful</div>";
+ break;
+ case "error":
+ $result = "<div class='warningbox'>Modify failed</div>";
+ break;
+ }
+ break;
+ case "create":
+ switch($result) {
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to create this</div>";
+ break;
+ case "ok":
+ $result = "<div class='okbox'>Creation sucessful</div>";
+ break;
+ case "error":
+ $result = "<div class='warningbox'>Creation failed</div>";
+ break;
+ case "file":
+ $result = "<div class='errorbox'>The File must be greater than 0 bytes</div>";
+ break;
+ }
+ break;
+ case "update":
+ switch($result) {
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to update this</div>";
+ break;
+ case "404":
+ $result = "<div class='errorbox'>The Resource was not found on the specified path</div>";
+ break;
+ case "ok":
+ $result = "<div class='okbox'>Update sucessful</div>";
+ break;
+ case "error":
+ $result = "<div class='warningbox'>Update failed</div>";
+ break;
+ }
+ break;
+ case "serial":
+ switch($result) {
+ case "noserial":
+ $result = "<div class='errorbox'>Your PreBoot is broken, please download a new Version or contact a PBS Administrator</div>";
+ break;
+ }
+ break;
+ case "link":
+ switch($result) {
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to link this</div>";
+ break;
+ case "ok":
+ $result = "<div class='okbox'>Link sucessful</div>";
+ break;
+ case "error":
+ $result = "<div class='warningbox'>Link failed</div>";
+ break;
+ }
+ break;
+ case "unlink":
+ switch($result) {
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to unlink this</div>";
+ break;
+ case "ok":
+ $result = "<div class='okbox'>Unlink sucessful</div>";
+ break;
+ case "error":
+ $result = "<div class='warningbox'>Unlink failed</div>";
+ break;
+ }
+ break;
+ case "json":
+ switch($result) {
+ default: {
+ $result = unserialize($result);
+
+ $result2 = "<div class='infobox'>";
+ $result2 . = "<table class='json'>";
+ $result2 . = "<tr><td><b>info</b>: </td><td>".$result['info']."</td></tr>";
+ $result2 . = "<tr><td><b>kernel</b>: </td><td><a href=".$result['kernel'].">".$result['kernel']."<a></td></tr>";
+ $result2 . = "<tr><td><b>initramfs</b>: </td><td><a href=".$result['initramfs'].">".$result['initramfs']."<a></td></tr>";
+ $result2 . = "<tr><td><b>kcl</b>: </td><td><a href=".$result['kcl'].">".$result['kcl']."<a></td></tr>";
+ $result2 . = "<tr><td><b>config</b>: </td><td>".$result['config']."</td></tr>";
+ $result2 . = "</table>";
+ $result2 . = "</div>";
+ $result = $result2;
+ }
+ break;
+ case "forbidden":
+ $result = "<div class='errorbox'>Not allowed to display ressources</div>";
+ break;
+ case "error":
+ $result = "<div class='warningbox'>Displaying ressources failed</div>";
+ break;
+ }
+ break;
+ }
+ return $result;
+
+ }
}
-?>
+? >
diff --git a/library/Pbs/Pagination.php b/library/Pbs/Pagination.php
index c83ec74..6468897 100644
--- a/library/Pbs/Pagination.php
+++ b/library/Pbs/Pagination.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,89 +10,89 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_Pagination{
+class Pbs_Pagination {
+
+ private $element;
+ private $perpage;
+ private $requestpage;
+ private $maxNumber;
+ private $numpages;
+ private $pageUrl;
+
+ public function pagination($url = null, $selected = null, $max = null) {
+ if($selected == null)
+ { $selected = $this->requestpage; }
+ if($max == null)
+ { $max = $this->numpages; }
+ if($url == null)
+ { $url = $this->pageUrl; }
+
+#print_a($url,$selected,$max);
+
+ $str = "<div class='pbs_pagination'>";
+ if ( 1 <= $selected) {
+ $str . = "<a href='$url/page/0' >&lt;&lt;</a>";
+ $str . = "<a href='$url/page/".(($selected) - 1)."' rel='next'>&lt;</a>";
+ } else {
+ $str . = "<span class='disabled'>&lt;&lt;</span>";
+ $str . = "<span class='disabled'>&lt;</span>";
+ }
+
+#
+ $rightleft = 2;
+ for($i = 0; $i < ($max); $i++) {
+ if($selected == $i)
+ { $str . = "<a class='active'>".($i + 1) ."</a> "; }
+ else if($i >= $selected - $rightleft && $i <= $selected + $rightleft)
+ { $str . = "<a href='$url/page/".($i)."'>".($i + 1) ."</a> "; }
+ }
+
+#
+ if ( $max - 2 >= $selected) {
+ $str . = "<a href='$url/page/".(($selected) + 1)."'>&gt;</a> ";
+ $str . = "<a href='$url/page/".($max - 1)."'>&gt;&gt;</a> ";
+ } else {
+ $str . = "<span class='disabled'>&gt;</span> ";
+ $str . = "<span class='disabled'>&gt;&gt;</span> ";
+ }
+
+ $str . = "</div>";
+ return $str;
+ }
+ public function setPerPage($perpage) {
+ $this->perpage = $perpage;
+ return $this;
+ }
+ public function getPerPage() {
+ return $this->perpage;
+ }
+ public function setRequestPage($requestpage) {
+ if($requestpage < 0 || !is_numeric($requestpage) )
+ { $requestpage = 0; }
+ if($requestpage >= $this->numpages)
+ { $requestpage = $this->numpages - 1; }
+ $this->requestpage = $requestpage;
+ return $this;
+ }
+ public function getRequestPage() {
+ return $this->requestpage;
+ }
+ public function setElement($element) {
+ $this->element = $element;
+ $this->maxNumber = count($element);
+ $this->numpages = ceil(count($element) / $this->perpage);
+ return $this;
+ }
+ public function getStartItem() {
+ return $this->requestpage * $this->perpage;
+ }
+ public function getElements() {
+ return array_slice($this->element, $this->getStartItem(), $this->getPerPage(), true);
+ }
+ public function setPageUrl($url) {
+ $this->pageUrl = $url;
+ return $this;
+ }
- private $element;
- private $perpage;
- private $requestpage;
- private $maxNumber;
- private $numpages;
- private $pageUrl;
-
- public function pagination($url=null,$selected=null,$max=null){
- if($selected == null)
- $selected = $this->requestpage;
- if($max == null)
- $max = $this->numpages;
- if($url == null)
- $url = $this->pageUrl;
-
- #print_a($url,$selected,$max);
-
- $str = "<div class='pbs_pagination'>";
- if ( 1 <= $selected){
- $str .= "<a href='$url/page/0' >&lt;&lt;</a>";
- $str .= "<a href='$url/page/".(($selected)-1)."' rel='next'>&lt;</a>";
- }else{
- $str .= "<span class='disabled'>&lt;&lt;</span>";
- $str .= "<span class='disabled'>&lt;</span>";
- }
-
- #
- $rightleft = 2;
- for($i=0;$i<($max);$i++){
- if($selected == $i)
- $str .= "<a class='active'>".($i+1) ."</a> ";
- else if($i >= $selected -$rightleft && $i <= $selected+$rightleft)
- $str .= "<a href='$url/page/".($i)."'>".($i+1) ."</a> ";
- }
-
- #
- if ( $max-2 >= $selected){
- $str .= "<a href='$url/page/".(($selected)+1)."'>&gt;</a> ";
- $str .= "<a href='$url/page/".($max-1)."'>&gt;&gt;</a> ";
- }else{
- $str .= "<span class='disabled'>&gt;</span> ";
- $str .= "<span class='disabled'>&gt;&gt;</span> ";
- }
-
- $str .= "</div>";
- return $str;
- }
- public function setPerPage($perpage){
- $this->perpage = $perpage;
- return $this;
- }
- public function getPerPage(){
- return $this->perpage;
- }
- public function setRequestPage($requestpage){
- if($requestpage < 0 || !is_numeric($requestpage) )
- $requestpage = 0;
- if($requestpage >= $this->numpages)
- $requestpage = $this->numpages-1;
- $this->requestpage = $requestpage;
- return $this;
- }
- public function getRequestPage(){
- return $this->requestpage;
- }
- public function setElement($element){
- $this->element = $element;
- $this->maxNumber = count($element);
- $this->numpages = ceil(count($element)/$this->perpage);
- return $this;
- }
- public function getStartItem(){
- return $this->requestpage * $this->perpage;
- }
- public function getElements(){
- return array_slice($this->element,$this->getStartItem(),$this->getPerPage(),true);
- }
- public function setPageUrl($url){
- $this->pageUrl = $url;
- return $this;
- }
-
}
diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php
index 587b656..7959775 100644
--- a/library/Pbs/Search.php
+++ b/library/Pbs/Search.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,160 +10,158 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_Search{
+class Pbs_Search {
- private $searchTerm = '';
- private $searcha;
- private $searchb;
- private $module;
- private $countall;
- private $countresult;
- private $type;
-
- public function searchForm(){
- $str = "<form style='float:left;' action='";
- if($this->type == ''){
- $str .= "/user/".$this->module."/search";
- }
- else{
- $str .= "/user/".$this->module."/search/type/".$this->type;
- }
- $str .= "'>
- <div><input type='text' id='search' name='search' ".(($this->searchTerm != '')?'value="'.htmlentities($this->searchTerm, ENT_QUOTES).'"':'')." />
- <button type='submit' class='searchbutton' value='search'> Search</button></div>";
-
- $highlight = array();
- if($this->searchTerm != ''){
- $str .= "<a href='/user/".$this->module."/'><img src='/media/img/delete.png' alt='Delete Client'/></a>";
- $str .= "<div class='searchsub'>$this->countresult result".(($this->countresult==1)?'':'s')." found</div>";
- $str .="<script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script>";
- foreach($this->getSearchTerms() as $term){
- $highlight[] = "$('table').highlight('".$term."');";
- $highlight[] = "$('.element .number').highlight('".$term."');";
- $highlight[] = "$('.element .title').highlight('".$term."');";
- $highlight[] = "$('.element .subtitle').highlight('".$term."');";
- $highlight[] = "$('.element .item').highlight('".$term."');";
- }
-
- }
- $str .= "<div class='searchsub dsf'>Display searchfilter</div>";
- $str .= "<script type='text/javascript'>
- $(document).ready(function(){";
- $str .= implode("\n",$highlight);
- $str .= "$('.searchvars').data('m','0');\n";
-
- $str .= "$('.dsf')
- .click(function(){
- if($('.searchvars').is(':visible') == false){
- $('.searchvars').data('m','1').slideDown();
- }
- else{
- $('.searchvars').data('m','0').slideUp();
- }
- });";
- $str .= "$('.searchvars .code').click(function(){
- $('#search').val($('#search').val()+' '+$(this).text()+':');
- });";
- $str .= "$('#search')
- .focus(function() {
- $('table th .code').show();
- $('.searchvars').slideDown();
- }).focusout(function() {
- $('table th .code').hide();
- if($('.searchvars').data('m') == '0'){
- $('.searchvars').slideUp();
- }
- });
- $('table th').click(function(){
- $('#search').val($('#search').val()+' '+$(this).find('.code').text()+':');
- });";
- $str .= "});
- </script>";
- $str .= "</form>";
- return $str;
- }
- public function setModule($m){
- $this->module = $m;
- return $this;
- }
- public function setType($t){
- $this->type = $t;
- return $this;
- }
- public function setSearchTerm($search){
- $this->searchTerm = trim($search);
-
- // search for "text"
- preg_match_all("!\"(.*?)\"!is",$this->searchTerm,$matches);
- $tmpsearch = $this->searchTerm;
- for($i=0;$i<=count($matches[0]);$i++){
- @$replace = str_replace(" ","<|>",$matches[0][$i]);
- @$tmpsearch = str_replace($matches[0][$i],$replace,$tmpsearch);
- }
- $parts = explode(" ",$tmpsearch);
- foreach($parts as $search){
- if(stristr($search,":") && preg_match('/^[a-z_A-Z]+$/',$search) >= 0){
- $key = substr($search,0,strpos($search,":"));
- $value = substr($search,strpos($search,":")+1);
- if(stristr($value,'"')){
- $value = substr(str_replace('<|>',' ',$value),1,-1);
- }
- $searcha[$key] = $value;
- }
- else{
- if(stristr($search,'"')){
- $search = substr(str_replace('<|>',' ',$search),1,-1);
- }
- $searchb[] = $search;
- }
- }
- $this->searcha = @$searcha;
- $this->searchb = @$searchb;
- return $this;
- }
- public function getSearchTerm(){
- return $this->searchTerm;
- }
- public function getSearchTerms(){
- $beta = $this->searcha;
- foreach($this->searchb as $b)
- $beta[] = $b;
- return $beta;
- }
- public function search($array){
- $this->countall = count($array);
- foreach($array as $counter => $cig){
- if(is_object($cig)){
- $cig = $cig->toArray();
- }
- foreach($cig as $k => $v){
- if(count($this->searcha) > 0){
- foreach($this->searcha as $sk => $sv){
- if($k == $sk){
- if(stristr($v,$sv) || $v == $sv){
- $com1[$counter] += 1;
- }
- }
- }
- }
- if(count($this->searchb) >= 0){
- foreach($this->searchb as $sk => $sv){
- $comm = stristr($v,$sv);
- if($comm != false || $v == $sv){
- $com2[$counter] += 1;
- }
- }
- }
- }
- #print_a($com2[$counter]." >= ".count($this->searchb)." && ".$com1[$counter]." >= ".count($this->searcha));
- if($com2[$counter] >= count($this->searchb) && $com1[$counter] >= count($this->searcha)){
- // add item in resultlist
- $data[] = $counter;
- }
- }
- foreach( $data as $c)
- $ges[] = $array[$c];
- $this->countresult = count($ges);
- return $ges;
- }
+ private $searchTerm = '';
+ private $searcha;
+ private $searchb;
+ private $module;
+ private $countall;
+ private $countresult;
+ private $type;
+
+ public function searchForm() {
+ $str = "<form style='float:left;' action='";
+ if($this->type == '') {
+ $str . = "/user/".$this->module."/search";
+ } else {
+ $str . = "/user/".$this->module."/search/type/".$this->type;
+ }
+ $str . = "'>
+ <div><input type='text' id='search' name='search' ".(($this->searchTerm != '') ? 'value="'.htmlentities($this->searchTerm, ENT_QUOTES).'"' : '')." />
+ <button type='submit' class='searchbutton' value='search'> Search</button></div>";
+
+ $highlight = array();
+ if($this->searchTerm != '') {
+ $str . = "<a href='/user/".$this->module."/'><img src='/media/img/delete.png' alt='Delete Client'/></a>";
+ $str . = "<div class='searchsub'>$this->countresult result".(($this->countresult == 1) ? '' : 's')." found</div>";
+ $str . = "<script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script>";
+ foreach($this->getSearchTerms() as $term) {
+ $highlight[] = "$('table').highlight('".$term."');";
+ $highlight[] = "$('.element .number').highlight('".$term."');";
+ $highlight[] = "$('.element .title').highlight('".$term."');";
+ $highlight[] = "$('.element .subtitle').highlight('".$term."');";
+ $highlight[] = "$('.element .item').highlight('".$term."');";
+ }
+
+ }
+ $str . = "<div class='searchsub dsf'>Display searchfilter</div>";
+ $str . = "<script type='text/javascript'>
+ $(document).ready(function(){";
+ $str . = implode("\n", $highlight);
+ $str . = "$('.searchvars').data('m','0');\n";
+
+ $str . = "$('.dsf')
+ .click(function(){
+ if($('.searchvars').is(':visible') == false){
+ $('.searchvars').data('m','1').slideDown();
+ }
+ else{
+ $('.searchvars').data('m','0').slideUp();
+ }
+ });";
+ $str . = "$('.searchvars .code').click(function(){
+ $('#search').val($('#search').val()+' '+$(this).text()+':');
+ });";
+ $str . = "$('#search')
+ .focus(function() {
+ $('table th .code').show();
+ $('.searchvars').slideDown();
+ }).focusout(function() {
+ $('table th .code').hide();
+ if($('.searchvars').data('m') == '0'){
+ $('.searchvars').slideUp();
+ }
+ });
+ $('table th').click(function(){
+ $('#search').val($('#search').val()+' '+$(this).find('.code').text()+':');
+ });";
+ $str . = "});
+ </script>";
+ $str . = "</form>";
+ return $str;
+ }
+ public function setModule($m) {
+ $this->module = $m;
+ return $this;
+ }
+ public function setType($t) {
+ $this->type = $t;
+ return $this;
+ }
+ public function setSearchTerm($search) {
+ $this->searchTerm = trim($search);
+
+ // search for "text"
+ preg_match_all("!\"(.*?)\"!is", $this->searchTerm, $matches);
+ $tmpsearch = $this->searchTerm;
+ for($i = 0; $i <= count($matches[0]); $i++) {
+ @$replace = str_replace(" ", "<|>", $matches[0][$i]);
+ @$tmpsearch = str_replace($matches[0][$i], $replace, $tmpsearch);
+ }
+ $parts = explode(" ", $tmpsearch);
+ foreach($parts as $search) {
+ if(stristr($search, ":") && preg_match('/^[a-z_A-Z]+$/', $search) >= 0) {
+ $key = substr($search, 0, strpos($search, ":"));
+ $value = substr($search, strpos($search, ":") + 1);
+ if(stristr($value, '"')) {
+ $value = substr(str_replace('<|>', ' ', $value), 1, -1);
+ }
+ $searcha[$key] = $value;
+ } else {
+ if(stristr($search, '"')) {
+ $search = substr(str_replace('<|>', ' ', $search), 1, -1);
+ }
+ $searchb[] = $search;
+ }
+ }
+ $this->searcha = @$searcha;
+ $this->searchb = @$searchb;
+ return $this;
+ }
+ public function getSearchTerm() {
+ return $this->searchTerm;
+ }
+ public function getSearchTerms() {
+ $beta = $this->searcha;
+ foreach($this->searchb as $b)
+ $beta[] = $b;
+ return $beta;
+ }
+ public function search($array) {
+ $this->countall = count($array);
+ foreach($array as $counter => $cig) {
+ if(is_object($cig)) {
+ $cig = $cig->toArray();
+ }
+ foreach($cig as $k => $v) {
+ if(count($this->searcha) > 0) {
+ foreach($this->searcha as $sk => $sv) {
+ if($k == $sk) {
+ if(stristr($v, $sv) || $v == $sv) {
+ $com1[$counter] += 1;
+ }
+ }
+ }
+ }
+ if(count($this->searchb) >= 0) {
+ foreach($this->searchb as $sk => $sv) {
+ $comm = stristr($v, $sv);
+ if($comm != false || $v == $sv) {
+ $com2[$counter] += 1;
+ }
+ }
+ }
+ }
+#print_a($com2[$counter]." >= ".count($this->searchb)." && ".$com1[$counter]." >= ".count($this->searcha));
+ if($com2[$counter] >= count($this->searchb) && $com1[$counter] >= count($this->searcha)) {
+ // add item in resultlist
+ $data[] = $counter;
+ }
+ }
+ foreach( $data as $c)
+ $ges[] = $array[$c];
+ $this->countresult = count($ges);
+ return $ges;
+ }
}
diff --git a/library/Pbs/Session.php b/library/Pbs/Session.php
index 12e6738..bc4587e 100644
--- a/library/Pbs/Session.php
+++ b/library/Pbs/Session.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,41 +10,39 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Pbs_Session{
+class Pbs_Session {
- public function createSession(Application_Model_Session $session){
- $sessionmapper = new Application_Model_SessionMapper();
- $uniqid = $this->getUniqueCode(10);
- $sm = new Application_Model_SessionMapper();
- while(count($sm->findBy(array('alphasessionID' => $uniqid),true))>0){
- $uniqid = $this->getUniqueCode(16);
- }
-
- $session->setAlphasessionID($uniqid);
-
- $id = $sessionmapper->save($session);
- $sessionmapper->find($id, $session);
- return $session;
- }
- public function createClient(Application_Model_Client $client){
- $clientmapper = new Application_Model_ClientMapper();
- $result = $clientmapper->findBy(array('macadress' => $client->getMacadress(),'groupID'=>$client->getGroupID()),true);
- if(count($result)>0){
- $client->setOptions($result[0]);
- $client->setID($result[0]['clientID']);
- }
- else{
- $id = $clientmapper->save($client);
- $clientmapper->find($id, $client);
- }
- return $client;
- }
- private function getUniqueCode($length = "")
- {
- $code = md5(uniqid(rand(), true));
- if ($length != "") return substr($code, 0, $length);
- else return $code;
- }
+ public function createSession(Application_Model_Session $session) {
+ $sessionmapper = new Application_Model_SessionMapper();
+ $uniqid = $this->getUniqueCode(10);
+ $sm = new Application_Model_SessionMapper();
+ while(count($sm->findBy(array('alphasessionID' => $uniqid), true)) > 0) {
+ $uniqid = $this->getUniqueCode(16);
+ }
+
+ $session->setAlphasessionID($uniqid);
+
+ $id = $sessionmapper->save($session);
+ $sessionmapper->find($id, $session);
+ return $session;
+ }
+ public function createClient(Application_Model_Client $client) {
+ $clientmapper = new Application_Model_ClientMapper();
+ $result = $clientmapper->findBy(array('macadress' => $client->getMacadress(), 'groupID' => $client->getGroupID()), true);
+ if(count($result) > 0) {
+ $client->setOptions($result[0]);
+ $client->setID($result[0]['clientID']);
+ } else {
+ $id = $clientmapper->save($client);
+ $clientmapper->find($id, $client);
+ }
+ return $client;
+ }
+ private function getUniqueCode($length = "") {
+ $code = md5(uniqid(rand(), true));
+ if ($length != "") { return substr($code, 0, $length); }
+ else { return $code; }
+ }
}
-?>
+? >
diff --git a/public/index.php b/public/index.php
index fe1701f..b12a55e 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -19,25 +19,25 @@ defined('APPLICATION_ENV')
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
-realpath(APPLICATION_PATH . '/../library'),
-get_include_path(),
-)));
+ realpath(APPLICATION_PATH . '/../library'),
+ get_include_path(),
+ )));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application
$application = new Zend_Application(
-APPLICATION_ENV,
-APPLICATION_PATH . '/configs/application.ini'
+ APPLICATION_ENV,
+ APPLICATION_PATH . '/configs/application.ini'
);
// Set Session lifetime
-if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI'))
- Zend_Session::setOptions(array('cookie_lifetime' => null));
-else{
- Zend_Session::setOptions(array('cookie_lifetime' => null));
- Zend_Session::setOptions(array('gc_maxlifetime' => '1800'));
+if(stristr($_SERVER['HTTP_USER_AGENT'], 'prebootGUI'))
+ { Zend_Session::setOptions(array('cookie_lifetime' => null)); }
+else {
+ Zend_Session::setOptions(array('cookie_lifetime' => null));
+ Zend_Session::setOptions(array('gc_maxlifetime' => '1800'));
}
// Run bootstrap
$application->bootstrap()
diff --git a/public/settergetter.php b/public/settergetter.php
index 9b603d7..ac7ce8a 100644
--- a/public/settergetter.php
+++ b/public/settergetter.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -9,40 +9,40 @@
*
* General information about OpenSLX can be found at http://openslx.org/
*/
-function print_a($v){echo"<pre style='background-color:#FFCC33'>";print_r($v);echo"</pre>";}
-function setget($name){
- $withdash = $name;
- $withoutdash = substr($name,1);
- return
-' public function get'.ucfirst($withoutdash).'()
- {
- return $this->'.$withdash.';
- }
- public function set'.ucfirst($withoutdash).'($'.$withdash.')
- {
- $this->'.$withdash.' = $'.$withdash.';
- }
-';
+function print_a($v) {echo"<pre style='background-color:#FFCC33'>"; print_r($v); echo"</pre>";}
+function setget($name) {
+ $withdash = $name;
+ $withoutdash = substr($name, 1);
+ return
+ ' public function get'.ucfirst($withoutdash).'()
+ {
+ return $this->'.$withdash.';
+ }
+ public function set'.ucfirst($withoutdash).'($'.$withdash.')
+ {
+ $this->'.$withdash.' = $'.$withdash.';
+ }
+ ';
}
-if(isset($_POST['submit'])){
- $ar = explode("\n",trim($_POST['variables']));
+if(isset($_POST['submit'])) {
+ $ar = explode("\n", trim($_POST['variables']));
- $output = "";
- foreach($ar as $item){
- $output .= setget("_".trim($item));
- }
- print_a($output);
- echo "<a href='".$_SERVER['PHP_SELF']."'>back</a>";
+ $output = "";
+ foreach($ar as $item) {
+ $output . = setget("_".trim($item));
+ }
+ print_a($output);
+ echo "<a href='".$_SERVER['PHP_SELF']."'>back</a>";
}
-else{
-?>
-Jeweils ein Variablenname pro Zeile:<br>
-<form method='post' action='<?php $_SERVER['PHP_SELF'];?>'>
-<textarea name='variables'>
-</textarea><br>
-<input type='submit' name='submit' value='setter und getter generieren'>
-</form>
-<?php
+else {
+ ? >
+ Jeweils ein Variablenname pro Zeile : <br>
+ < form method = 'post' action = '<?php $_SERVER['PHP_SELF'];?>' >
+ < textarea name = 'variables' >
+ < / textarea > <br>
+ < input type = 'submit' name = 'submit' value = 'setter und getter generieren' >
+ < / form >
+ <? php
}
diff --git a/scripts/dbContent.php b/scripts/dbContent.php
index a704ec2..7ee8502 100644
--- a/scripts/dbContent.php
+++ b/scripts/dbContent.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -10,207 +10,206 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
// generate mysql graph
-$name = substr(str_replace("/","",$_SERVER['SCRIPT_NAME']),0,-4);
+$name = substr(str_replace("/", "", $_SERVER['SCRIPT_NAME']), 0, -4);
$dotname = $name . '.dot';
$pngname = $name . '.png';
echo "Opening Database Connection...\n";
$link = mysql_connect('localhost', 'root', '123456');
if (!$link) {
- die('keine Verbindung möglich: ' . mysql_error());
+ die('keine Verbindung möglich: ' . mysql_error());
}
mysql_select_db('pbs');
error_reporting(1);
-
-
-$format['groupnode'] = '"%s" [shape=trapezium, fontcolor="#ffffffff", style=filled, fillcolor="#004A99FF"];'."\n";
-$format['personnode'] = '"%s" [shape=ellipse, fontcolor="#ffffffff", style=filled, fillcolor="#FF0000FF"];'."\n";
-$format['poolnode'] = '"%s" [shape=ellipse, fontcolor="#000000ff", style=filled, fillcolor="#00FF00FF"];'."\n";
+
+
+$format['groupnode'] = '"%s" [shape=trapezium, fontcolor="#ffffffff", style=filled, fillcolor="#004A99FF"];'."\n";
+$format['personnode'] = '"%s" [shape=ellipse, fontcolor="#ffffffff", style=filled, fillcolor="#FF0000FF"];'."\n";
+$format['poolnode'] = '"%s" [shape=ellipse, fontcolor="#000000ff", style=filled, fillcolor="#00FF00FF"];'."\n";
$format['membershipnode'] = '"%s" [shape=ellipse, fontcolor="#ffffffff", style=filled, fillcolor="#990000FF"];'."\n";
-$format['clientnode'] = '"%s" [shape=ellipse, fontcolor="#000000ff", style=filled, fillcolor="#FFFF00FF"];'."\n";
-$format['rolenode'] = '"%s" [fontcolor="#000000ff", style=filled, fillcolor="#FF0099FF"];'."\n";
+$format['clientnode'] = '"%s" [shape=ellipse, fontcolor="#000000ff", style=filled, fillcolor="#FFFF00FF"];'."\n";
+$format['rolenode'] = '"%s" [fontcolor="#000000ff", style=filled, fillcolor="#FF0099FF"];'."\n";
$format['bootmenunode'] = '"%s" [shape=ellipse, fontcolor="#000000ff", style=filled, fillcolor="#009999FF"];'."\n";
-$format['bootisonode'] = '"%s" [shape=ellipse, fontcolor="#000000ff", style=filled, fillcolor="#FF9900FF"];'."\n";
-$format['bootosnode'] = '"%s" [fontcolor="#000000ff", style=filled, fillcolor="#99FF99FF"];'."\n";
-
-$format['groupgroup'] = '"%s" -> "%s";'."\n";
-$format['personmember'] = '"%s" -> "%s";'."\n";
-$format['rolemember'] = '"%s" -> "%s";'."\n";
-$format['membergroup'] = '"%s" -> "%s";'."\n";
-$format['personrequest'] = '"%s" -> "%s" [style=dotted];'."\n";
-$format['poolgroup'] = '"%s" -> "%s";'."\n";
-$format['clientgroup'] = '"%s" -> "%s";'."\n";
-$format['clientpool'] = '"%s" -> "%s";'."\n";
-$format['bootisogroup'] = '"%s" -> "%s";'."\n";
-$format['bootmenugroup'] = '"%s" -> "%s";'."\n";
-$format['bootosbootmenu'] = '"%s" -> "%s";'."\n";
-$format['bootosgroup'] = '"%s" -> "%s";'."\n";
-
-
-
-
-function getGroups(){
- global $format;
- $q = "SELECT groupID,title FROM pbs_group";
- $groups = "subgraph cluster_0 {";
- $groups .= "label=Groups;";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $groups .= sprintf($format['groupnode'] ,"Group".$data['groupID']);
- }
- $groups .= "}";
- return $groups;
+$format['bootisonode'] = '"%s" [shape=ellipse, fontcolor="#000000ff", style=filled, fillcolor="#FF9900FF"];'."\n";
+$format['bootosnode'] = '"%s" [fontcolor="#000000ff", style=filled, fillcolor="#99FF99FF"];'."\n";
+
+$format['groupgroup'] = '"%s" -> "%s";'."\n";
+$format['personmember'] = '"%s" -> "%s";'."\n";
+$format['rolemember'] = '"%s" -> "%s";'."\n";
+$format['membergroup'] = '"%s" -> "%s";'."\n";
+$format['personrequest'] = '"%s" -> "%s" [style=dotted];'."\n";
+$format['poolgroup'] = '"%s" -> "%s";'."\n";
+$format['clientgroup'] = '"%s" -> "%s";'."\n";
+$format['clientpool'] = '"%s" -> "%s";'."\n";
+$format['bootisogroup'] = '"%s" -> "%s";'."\n";
+$format['bootmenugroup'] = '"%s" -> "%s";'."\n";
+$format['bootosbootmenu'] = '"%s" -> "%s";'."\n";
+$format['bootosgroup'] = '"%s" -> "%s";'."\n";
+
+
+
+
+function getGroups() {
+ global $format;
+ $q = "SELECT groupID,title FROM pbs_group";
+ $groups = "subgraph cluster_0 {";
+ $groups . = "label=Groups;";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $groups . = sprintf($format['groupnode'] , "Group".$data['groupID']);
+ }
+ $groups . = "}";
+ return $groups;
}
-function recGroups($groupID,$level=0,$data=''){
- global $format;
- $q = "SELECT groupID FROM pbs_groupgroups WHERE parentID = $groupID";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $groups .= sprintf($format['groupgroup'],"Group".$groupID, "Group".$data['groupID']);
- $groups .= recGroups($data['groupID']);
- }
- return $groups;
+function recGroups($groupID, $level = 0, $data = '') {
+ global $format;
+ $q = "SELECT groupID FROM pbs_groupgroups WHERE parentID = $groupID";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $groups . = sprintf($format['groupgroup'], "Group".$groupID, "Group".$data['groupID']);
+ $groups . = recGroups($data['groupID']);
+ }
+ return $groups;
}
-function getPersons(){
- global $format;
- $q = "SELECT personID,title FROM pbs_person";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $persons .= sprintf($format['personnode'] ,"Person". $data['personID']);
-
- }
- return $persons;
+function getPersons() {
+ global $format;
+ $q = "SELECT personID,title FROM pbs_person";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $persons . = sprintf($format['personnode'] , "Person". $data['personID']);
+
+ }
+ return $persons;
}
-function getMemberships(){
- global $format;
- $q = "SELECT personID,groupID,membershipID,roleID FROM pbs_membership";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $memberships .= sprintf($format['membershipnode'],"Member".$data['membershipID']);
- $memberships .= sprintf($format['personmember'],"Person".$data['personID'],"Member".$data['membershipID']);
- $memberships .= sprintf($format['rolemember'],"Role".$data['roleID'], "Member".$data['membershipID']);
- $memberships .= sprintf($format['membergroup'],"Member".$data['membershipID'], "Group".$data['groupID']);
- }
- return $memberships;
+function getMemberships() {
+ global $format;
+ $q = "SELECT personID,groupID,membershipID,roleID FROM pbs_membership";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $memberships . = sprintf($format['membershipnode'], "Member".$data['membershipID']);
+ $memberships . = sprintf($format['personmember'], "Person".$data['personID'], "Member".$data['membershipID']);
+ $memberships . = sprintf($format['rolemember'], "Role".$data['roleID'], "Member".$data['membershipID']);
+ $memberships . = sprintf($format['membergroup'], "Member".$data['membershipID'], "Group".$data['groupID']);
+ }
+ return $memberships;
}
-function getRequests(){
- global $format;
- $q = "SELECT personID,groupID FROM pbs_grouprequest";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $memberships .= sprintf($format['peronrequests'],"Group".$data['groupID'], "Person".$data['personID']);
- }
- return $memberships;
+function getRequests() {
+ global $format;
+ $q = "SELECT personID,groupID FROM pbs_grouprequest";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $memberships . = sprintf($format['peronrequests'], "Group".$data['groupID'], "Person".$data['personID']);
+ }
+ return $memberships;
}
-function getPools(){
- global $format;
- $q = "SELECT poolID,groupID FROM pbs_pool";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $pools .= sprintf($format['poolnode'] ,"Pool".$data['poolID']);
- $pools .= sprintf($format['poolgroup'],"Pool".$data['poolID'], "Group".$data['groupID']);
-
- }
- return $pools;
+function getPools() {
+ global $format;
+ $q = "SELECT poolID,groupID FROM pbs_pool";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $pools . = sprintf($format['poolnode'] , "Pool".$data['poolID']);
+ $pools . = sprintf($format['poolgroup'], "Pool".$data['poolID'], "Group".$data['groupID']);
+
+ }
+ return $pools;
}
-function getClients(){
- global $format;
- $q = "SELECT clientID,groupID FROM pbs_client";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $clients .= sprintf($format['clientnode'] ,"Client".$data['clientID']);
- $query2 = "SELECT clientID, poolID FROM pbs_poolentries WHERE clientID = '".$data['clientID']."'";
- $result2 = mysql_query($query2);
- if(mysql_num_rows($result2) == 0)
- $clients .= sprintf($format['clientgroup'],"Client".$data['clientID'], "Group".$data['groupID']);
- }
-
- return $clients;
+function getClients() {
+ global $format;
+ $q = "SELECT clientID,groupID FROM pbs_client";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $clients . = sprintf($format['clientnode'] , "Client".$data['clientID']);
+ $query2 = "SELECT clientID, poolID FROM pbs_poolentries WHERE clientID = '".$data['clientID']."'";
+ $result2 = mysql_query($query2);
+ if(mysql_num_rows($result2) == 0)
+ { $clients . = sprintf($format['clientgroup'], "Client".$data['clientID'], "Group".$data['groupID']); }
+ }
+
+ return $clients;
}
-function clientPools(){
- global $format;
- $q = "SELECT clientID,poolID FROM pbs_poolentries";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $clientpools .= sprintf($format['clientpool'],"Client".$data['clientID'], "Pool".$data['poolID']);
- }
- return $clientpools;
+function clientPools() {
+ global $format;
+ $q = "SELECT clientID,poolID FROM pbs_poolentries";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $clientpools . = sprintf($format['clientpool'], "Client".$data['clientID'], "Pool".$data['poolID']);
+ }
+ return $clientpools;
}
-function getRoles(){
- global $format;
- $q = "SELECT roleID,groupID FROM pbs_role";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $roles .= sprintf($format['rolenode'] ,"Role".$data['roleID']);
- # $roles .= "Role".$data['roleID'] ." -> " . "Group".$data['groupID'].";\n";
- }
- return $roles;
+function getRoles() {
+ global $format;
+ $q = "SELECT roleID,groupID FROM pbs_role";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $roles . = sprintf($format['rolenode'] , "Role".$data['roleID']);
+# $roles .= "Role".$data['roleID'] ." -> " . "Group".$data['groupID'].";\n";
+ }
+ return $roles;
}
-function getBootiso(){
- global $format;
- $q = "SELECT bootisoID,groupID FROM pbs_bootiso";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $bootiso .= sprintf($format['bootisonode'] ,"BootIso".$data['bootisoID']);
- $bootiso .= sprintf($format['bootisogroup'],"BootIso".$data['bootisoID'], "Group".$data['groupID']);
-
- }
- return $bootiso;
+function getBootiso() {
+ global $format;
+ $q = "SELECT bootisoID,groupID FROM pbs_bootiso";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $bootiso . = sprintf($format['bootisonode'] , "BootIso".$data['bootisoID']);
+ $bootiso . = sprintf($format['bootisogroup'], "BootIso".$data['bootisoID'], "Group".$data['groupID']);
+
+ }
+ return $bootiso;
}
-function getBootMenus(){
- global $format;
- $q = "SELECT bootmenuID,groupID FROM pbs_bootmenu";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $bootmenu .= sprintf($format['bootmenunode'] ,"BootMenu".$data['bootmenuID']);
- $bootmenu .= sprintf($format['bootmenugroup'],"BootMenu".$data['bootmenuID'], "Group".$data['groupID']);
- }
- return $bootmenu;
+function getBootMenus() {
+ global $format;
+ $q = "SELECT bootmenuID,groupID FROM pbs_bootmenu";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $bootmenu . = sprintf($format['bootmenunode'] , "BootMenu".$data['bootmenuID']);
+ $bootmenu . = sprintf($format['bootmenugroup'], "BootMenu".$data['bootmenuID'], "Group".$data['groupID']);
+ }
+ return $bootmenu;
}
-function getBootos(){
- global $format;
- $q = "SELECT bootosID,groupID FROM pbs_bootos";
- $result = mysql_query($q);
- while($data = mysql_fetch_array($result)){
- $bootos .= sprintf($format['bootosnode'] ,"BootOs".$data['bootosID']);
-
- $q2 = "SELECT * FROM pbs_bootmenuentries WHERE bootosID = ".$data['bootosID']."";
- $result2 = mysql_query($q2);
- if(mysql_num_rows($result2)){
- while($data2 = mysql_fetch_array($result2))
- $bootos .= sprintf($format['bootosbootmenu'],"BootOs".$data['bootosID'], "BootMenu".$data2['bootmenuID']);
- }
- else
- $bootos .= sprintf($format['bootosgroup'],"BootOs".$data['bootosID'], "Group".$data['groupID']);
- }
- return $bootos;
+function getBootos() {
+ global $format;
+ $q = "SELECT bootosID,groupID FROM pbs_bootos";
+ $result = mysql_query($q);
+ while($data = mysql_fetch_array($result)) {
+ $bootos . = sprintf($format['bootosnode'] , "BootOs".$data['bootosID']);
+
+ $q2 = "SELECT * FROM pbs_bootmenuentries WHERE bootosID = ".$data['bootosID']."";
+ $result2 = mysql_query($q2);
+ if(mysql_num_rows($result2)) {
+ while($data2 = mysql_fetch_array($result2))
+ { $bootos . = sprintf($format['bootosbootmenu'], "BootOs".$data['bootosID'], "BootMenu".$data2['bootmenuID']); }
+ } else
+ { $bootos . = sprintf($format['bootosgroup'], "BootOs".$data['bootosID'], "Group".$data['groupID']); }
+ }
+ return $bootos;
}
-
+
## Concatenation
$defs = '';
-$defs .= getGroups();
-$defs .= recGroups(1);
-$defs .= getPersons();
-$defs .= getMemberships();
-$defs .= getRoles();
-$defs .= getRequests();
-$defs .= getPools();
-$defs .= getClients();
-$defs .= clientPools();
-$defs .= getBootiso();
-$defs .= getBootMenus();
-$defs .= getBootos();
-
-
-
+$defs . = getGroups();
+$defs . = recGroups(1);
+$defs . = getPersons();
+$defs . = getMemberships();
+$defs . = getRoles();
+$defs . = getRequests();
+$defs . = getPools();
+$defs . = getClients();
+$defs . = clientPools();
+$defs . = getBootiso();
+$defs . = getBootMenus();
+$defs . = getBootos();
+
+
+
$str = 'digraph x {
- node [];
- ranksep=3;
- size="20,20";
- overlap="0:true"'."\n";
-$str .= str_replace("\n","\n\t",$defs);
-$str .= "}";
-
+ node [];
+ ranksep=3;
+ size="20,20";
+ overlap="0:true"'."\n";
+$str . = str_replace("\n", "\n\t", $defs);
+$str . = "}";
+
echo "Write to file ...\n";
// Create the dot file
$fp = fopen($dotname, "w");
diff --git a/scripts/mysqlGraph.php b/scripts/mysqlGraph.php
index b9012b2..0c0e9cb 100644
--- a/scripts/mysqlGraph.php
+++ b/scripts/mysqlGraph.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -13,7 +13,7 @@
echo "Opening Database Connection...\n";
$link = mysql_connect('localhost', 'root', '123456');
if (!$link) {
- die('keine Verbindung möglich: ' . mysql_error());
+ die('keine Verbindung möglich: ' . mysql_error());
}
#mysql_close($link);
mysql_select_db('pbs');
@@ -22,57 +22,57 @@ mysql_select_db('pbs');
$result = mysql_list_tables('pbs');
echo "Get Tables ...\n";
while ($row = mysql_fetch_row($result)) {
- $tables[$row[0]] = array();
+ $tables[$row[0]] = array();
}
mysql_free_result($result);
// Save all table-names
-foreach($tables as $tablename => $data){
- $result = mysql_query("SHOW COLUMNS FROM $tablename");
- while ($row = mysql_fetch_assoc($result)) {
- $tables[$tablename][] = $row;
- }
+foreach($tables as $tablename => $data) {
+ $result = mysql_query("SHOW COLUMNS FROM $tablename");
+ while ($row = mysql_fetch_assoc($result)) {
+ $tables[$tablename][] = $row;
+ }
}
mysql_free_result($result);
echo "Get Fieldlist from tables ...\n";
// Prepare dot-string
$b = "\n";
$str = 'digraph x {
- node [shape=record];
- ranksep=3;
- size="20,20";'.$b;
-
+ node [shape=record];
+ ranksep=3;
+ size="20,20";'.$b;
+
// get all table-fields
-foreach($tables as $tablename => $data){
- $str .= $tablename .' [label= "{';
- $array = array();
- $array[] = strtoupper($tablename);
- foreach($data as $d){
- $array[] = "<".$d['Field'].">".$d['Field'];
- }
- $str .= implode("|",$array);
- $str .= '}",width=3];'.$b;
+foreach($tables as $tablename => $data) {
+ $str . = $tablename .' [label= "{';
+ $array = array();
+ $array[] = strtoupper($tablename);
+ foreach($data as $d) {
+ $array[] = "<".$d['Field'].">".$d['Field'];
+ }
+ $str . = implode("|", $array);
+ $str . = '}",width=3];'.$b;
}
echo "Generate the Links ...\n";
// link the database-items (foreign-keys)
-foreach($tables as $tablename1 => $table1){
- foreach($table1 as $field1){
- $f1 = $field1['Field'];
- foreach($tables as $tablename2 => $table2){
- foreach($table2 as $field2){
- $f2 = $field2['Field'];
- if( $tablename1 != $tablename2 && $f1 == $f2 && strstr($f1,'ID') && "pbs_".str_replace("ID",'',$f1) == $tablename1){
- // Draw lines to tables
- $str .= $tablename1 ." -> ".$tablename2.";".$b;
- // draw lines to table-items
- #$str .= $tablename1.":".$f1 ." -> ".$tablename2.":".$f2 .";".$b;
- }
- }
- }
- }
+foreach($tables as $tablename1 => $table1) {
+ foreach($table1 as $field1) {
+ $f1 = $field1['Field'];
+ foreach($tables as $tablename2 => $table2) {
+ foreach($table2 as $field2) {
+ $f2 = $field2['Field'];
+ if( $tablename1 != $tablename2 && $f1 == $f2 && strstr($f1, 'ID') && "pbs_".str_replace("ID", '', $f1) == $tablename1) {
+ // Draw lines to tables
+ $str . = $tablename1 ." -> ".$tablename2.";".$b;
+ // draw lines to table-items
+#$str .= $tablename1.":".$f1 ." -> ".$tablename2.":".$f2 .";".$b;
+ }
+ }
+ }
+ }
}
-$str .= "}";
+$str . = "}";
echo "Write to file ...\n";
// Create the dot file
$fp = fopen("mysqlGraph.dot", "w");
diff --git a/tests/application/controllers/AuthControllerTest.php b/tests/application/controllers/AuthControllerTest.php
index 7c15185..77ee606 100644
--- a/tests/application/controllers/AuthControllerTest.php
+++ b/tests/application/controllers/AuthControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class AuthControllerTest extends PHPUnit_Framework_TestCase
-{
+class AuthControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/BootisoControllerTest.php b/tests/application/controllers/BootisoControllerTest.php
index c27426b..2232c8b 100644
--- a/tests/application/controllers/BootisoControllerTest.php
+++ b/tests/application/controllers/BootisoControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class BootisoControllerTest extends PHPUnit_Framework_TestCase
-{
+class BootisoControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/BootmenuControllerTest.php b/tests/application/controllers/BootmenuControllerTest.php
index 3c2a1d3..54130a6 100644
--- a/tests/application/controllers/BootmenuControllerTest.php
+++ b/tests/application/controllers/BootmenuControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class BootmenuControllerTest extends PHPUnit_Framework_TestCase
-{
+class BootmenuControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/BootosControllerTest.php b/tests/application/controllers/BootosControllerTest.php
index d52bc62..083d571 100644
--- a/tests/application/controllers/BootosControllerTest.php
+++ b/tests/application/controllers/BootosControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class BootosControllerTest extends PHPUnit_Framework_TestCase
-{
+class BootosControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/ClientControllerTest.php b/tests/application/controllers/ClientControllerTest.php
index 0045778..54047b2 100644
--- a/tests/application/controllers/ClientControllerTest.php
+++ b/tests/application/controllers/ClientControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class ClientControllerTest extends PHPUnit_Framework_TestCase
-{
+class ClientControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/ConfigControllerTest.php b/tests/application/controllers/ConfigControllerTest.php
index 9ac4b16..2ebed8e 100644
--- a/tests/application/controllers/ConfigControllerTest.php
+++ b/tests/application/controllers/ConfigControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class ConfigControllerTest extends PHPUnit_Framework_TestCase
-{
+class ConfigControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/FilterControllerTest.php b/tests/application/controllers/FilterControllerTest.php
index 60a5995..55b6306 100644
--- a/tests/application/controllers/FilterControllerTest.php
+++ b/tests/application/controllers/FilterControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class FilterControllerTest extends PHPUnit_Framework_TestCase
-{
+class FilterControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/GroupControllerTest.php b/tests/application/controllers/GroupControllerTest.php
index 7244352..86ee980 100644
--- a/tests/application/controllers/GroupControllerTest.php
+++ b/tests/application/controllers/GroupControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class GroupControllerTest extends PHPUnit_Framework_TestCase
-{
+class GroupControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/IndexControllerTest.php b/tests/application/controllers/IndexControllerTest.php
index f534396..d738625 100644
--- a/tests/application/controllers/IndexControllerTest.php
+++ b/tests/application/controllers/IndexControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class IndexControllerTest extends PHPUnit_Framework_TestCase
-{
+class IndexControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/PersonControllerTest.php b/tests/application/controllers/PersonControllerTest.php
index 1abb273..cee0f29 100644
--- a/tests/application/controllers/PersonControllerTest.php
+++ b/tests/application/controllers/PersonControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class PersonControllerTest extends PHPUnit_Framework_TestCase
-{
+class PersonControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/PoolControllerTest.php b/tests/application/controllers/PoolControllerTest.php
index 2c6a906..caabade 100644
--- a/tests/application/controllers/PoolControllerTest.php
+++ b/tests/application/controllers/PoolControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class PoolControllerTest extends PHPUnit_Framework_TestCase
-{
+class PoolControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/PrebootControllerTest.php b/tests/application/controllers/PrebootControllerTest.php
index ecfcbee..a1b216e 100644
--- a/tests/application/controllers/PrebootControllerTest.php
+++ b/tests/application/controllers/PrebootControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class PrebootControllerTest extends PHPUnit_Framework_TestCase
-{
+class PrebootControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/RessourceControllerTest.php b/tests/application/controllers/RessourceControllerTest.php
index 9784b5b..ad58612 100644
--- a/tests/application/controllers/RessourceControllerTest.php
+++ b/tests/application/controllers/RessourceControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class RessourceControllerTest extends PHPUnit_Framework_TestCase
-{
+class RessourceControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/RoleControllerTest.php b/tests/application/controllers/RoleControllerTest.php
index 20adfaa..3ce6b2c 100644
--- a/tests/application/controllers/RoleControllerTest.php
+++ b/tests/application/controllers/RoleControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class RoleControllerTest extends PHPUnit_Framework_TestCase
-{
+class RoleControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/SessionControllerTest.php b/tests/application/controllers/SessionControllerTest.php
index 5a83220..3c4d6e6 100644
--- a/tests/application/controllers/SessionControllerTest.php
+++ b/tests/application/controllers/SessionControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class SessionControllerTest extends PHPUnit_Framework_TestCase
-{
+class SessionControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}
diff --git a/tests/application/controllers/StatsControllerTest.php b/tests/application/controllers/StatsControllerTest.php
index c205d4b..6addba0 100644
--- a/tests/application/controllers/StatsControllerTest.php
+++ b/tests/application/controllers/StatsControllerTest.php
@@ -1,4 +1,4 @@
-<?php
+<? php
/*
* Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
* This program is free software distributed under the GPL version 2.
@@ -12,18 +12,15 @@
require_once 'PHPUnit/Framework/TestCase.php';
-class StatsControllerTest extends PHPUnit_Framework_TestCase
-{
+class StatsControllerTest extends PHPUnit_Framework_TestCase {
- public function setUp()
- {
- /* Setup Routine */
- }
+ public function setUp() {
+ /* Setup Routine */
+ }
- public function tearDown()
- {
- /* Tear Down Routine */
- }
+ public function tearDown() {
+ /* Tear Down Routine */
+ }
}