summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon2011-03-25 17:51:50 +0100
committerSimon2011-03-25 17:51:50 +0100
commit28f45e155a12db3b27682e84896b3f6a6b1c794a (patch)
tree2238c5a430d5928cb6dddb11f717f8edbfa9d66c
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-28f45e155a12db3b27682e84896b3f6a6b1c794a.tar.gz
pbs2-28f45e155a12db3b27682e84896b3f6a6b1c794a.tar.xz
pbs2-28f45e155a12db3b27682e84896b3f6a6b1c794a.zip
Nicht Benötigte Tabellen, Models, Mapper und Dateien entfernt
-rw-r--r--application/models/DbTable/MembershipFilters.php10
-rw-r--r--application/models/DbTable/PoolFilters.php10
-rw-r--r--application/models/MembershipFilters.php65
-rw-r--r--application/models/MembershipFiltersMapper.php98
-rw-r--r--application/models/PoolFilters.php99
-rw-r--r--application/models/PoolFiltersMapper.php98
-rw-r--r--filterTests.sql6
-rw-r--r--pbs-randomDelete.php65
-rw-r--r--pbs-randomInsert.php192
9 files changed, 0 insertions, 643 deletions
diff --git a/application/models/DbTable/MembershipFilters.php b/application/models/DbTable/MembershipFilters.php
deleted file mode 100644
index 59276f6..0000000
--- a/application/models/DbTable/MembershipFilters.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-class Application_Model_DbTable_MembershipFilters extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_membershipfilters';
-
-
-}
-
diff --git a/application/models/DbTable/PoolFilters.php b/application/models/DbTable/PoolFilters.php
deleted file mode 100644
index 2f6dd4f..0000000
--- a/application/models/DbTable/PoolFilters.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-class Application_Model_DbTable_PoolFilters extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_poolfilters';
-
-
-}
-
diff --git a/application/models/MembershipFilters.php b/application/models/MembershipFilters.php
deleted file mode 100644
index 37add69..0000000
--- a/application/models/MembershipFilters.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-
-class Application_Model_MembershipFilters
-{
- protected $_membershipID;
- protected $_filterID;
-
- 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 membershipfilters property');
- }
- $this->$method($value);
- }
-
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid membershipfilters 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 getMembershipID()
- {
- return $this->_membershipID;
- }
- public function setMembershipID($_membershipID)
- {
- $this->_membershipID = $_membershipID;
- return $this;
- }
- public function getFilterID()
- {
- return $this->_filterID;
- }
- public function setFilterID($_filterID)
- {
- $this->_filterID = $_filterID;
- return $this;
- }
-}
-
diff --git a/application/models/MembershipFiltersMapper.php b/application/models/MembershipFiltersMapper.php
deleted file mode 100644
index 353eea1..0000000
--- a/application/models/MembershipFiltersMapper.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-class Application_Model_MembershipFiltersMapper
-{
-
- protected $_dbTable;
-
- public function findBy($criteria, $value)
- {
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($criteria . ' = ?', $value);
- $stmt = $select->query();
- $result = $stmt->fetchAll();
- 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_MembershipFilters');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_MembershipFilters $membershipfilters)
- {
-
- $data = array('membershipID'=> $membershipfilters->getMembershipID() ,'filterID'=> $membershipfilters->getFilterID() );
-
- if (null === ($id = $membershipfilters->getID()) ) {
- unset($data['membershipfiltersID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('membershipfiltersID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_MembershipFilters $membershipfilters)
- {
- if (null === ($id = $membershipfilters->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('membershipfiltersID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_MembershipFilters $membershipfilters)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $membershipfilters->setMembershipID($row->membershipID)->setFilterID($row->filterID);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_MembershipFilters();
-
- $entry->setMembershipID($row->membershipID)->setFilterID($row->filterID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
-
-
-}
-
diff --git a/application/models/PoolFilters.php b/application/models/PoolFilters.php
deleted file mode 100644
index 8ce21fc..0000000
--- a/application/models/PoolFilters.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-
-class Application_Model_PoolFilters
-{
- protected $_poolID;
- protected $_filterID;
-
- 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 poolfilters property');
- }
- $this->$method($value);
- }
-
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid poolfilters 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 getPoolID()
- {
- return $this->_poolID;
- }
- public function setPoolID($_poolID)
- {
- $this->_poolID = $_poolID;
- return $this;
- }
- public function getFilterID()
- {
- return $this->_filterID;
- }
- public function setFilterID($_filterID)
- {
- $this->_filterID = $_filterID;
- 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/PoolFiltersMapper.php b/application/models/PoolFiltersMapper.php
deleted file mode 100644
index 7cc20bb..0000000
--- a/application/models/PoolFiltersMapper.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-class Application_Model_PoolFiltersMapper
-{
-
- protected $_dbTable;
-
- public function findBy($criteria, $value)
- {
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($criteria . ' = ?', $value);
- $stmt = $select->query();
- $result = $stmt->fetchAll();
- 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_PoolFilters');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_PoolFilters $polfilters)
- {
-
- $data = array('poolID'=> $polfilters->getPoolID() ,'filterID'=> $polfilters->getFilterID() );
-
- if (null === ($id = $polfilters->getID()) ) {
- unset($data['polfiltersID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('polfiltersID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_PoolFilters $polfilters)
- {
- if (null === ($id = $polfilters->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('polfiltersID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_PoolFilters $polfilters)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $polfilters->setPoolID($row->poolID)->setFilterID($row->filterID);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_PoolFilters();
-
- $entry->setPoolID($row->poolID)->setFilterID($row->filterID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
-
-
-}
-
diff --git a/filterTests.sql b/filterTests.sql
deleted file mode 100644
index 95d15ab..0000000
--- a/filterTests.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-INSERT INTO `pbs`.`pbs_group` (`groupID` ,`title` ,`description`)VALUES (NULL , 'testgruppe1', NULL);
-INSERT INTO `pbs`.`pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`) VALUES (NULL, 'Mr.Test', 'te', 'st', NULL, NULL, NULL, NULL, NULL, '', '', 'test', '', '');
-INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (NULL, '1', 'Testrolle', NULL);
-INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (NULL, '1', '1', '1');
-INSERT INTO `pbs`.`pbs_bootmenu` (`bootmenuID`, `membershipID`, `title`, `time`) VALUES (NULL, '1', 'TestBootMenu', '');
-INSERT INTO `pbs`.`pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES (NULL, '1', '1', '1', 'TestFilter', NULL, '', '1');
diff --git a/pbs-randomDelete.php b/pbs-randomDelete.php
deleted file mode 100644
index c3a7014..0000000
--- a/pbs-randomDelete.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-class deleteClass{
- private $link;
-
- public function __construct() {
- $this->link = mysql_connect('localhost', 'root', 'lsfks-openslx');
- if (!$this->link) {
- die('keine Verbindung möglich: ' . mysql_error());
- }
- echo 'Verbindung erfolgreich'."\n";
- mysql_select_db('pbs');
- }
-
- public function __destruct() {
- mysql_close($this->link);
- unset($this->link);
- }
-
- public function deletePerson($i){
- $anz = mysql_num_rows(mysql_query('SELECT * FROM pbs_membership WHERE personID = $i'));
- mysql_query('DELETE FROM pbs_person WHERE personID = $i;');
- if(mysql_num_rows(mysql_query("SELECT * FROM pbs_person WHERE personID = $i;") < 1)){
- if($anz > 0) {
- if(mysql_num_rows(mysql_query("SELECT * FROM pbs_membership WHERE personID = $i;")) < 1) {
- echo "Löschen erfolgreich";
- } else {
- echo "Löschen nicht erfolgreich";
- }
- } else {
- echo "Löschen erfolgreich";
- }
- } else {
- echo "Löschen nicht erfolgreich";
- }
- }
-
- public function deleteGroup($i){
-
- }
-
- public function deleteRight($i){
-
- }
-
- public function deleteRole($i){
-
- }
-
- public function deleteMemberships(){
-
- }
-
- public function deleteAll(){
- $this->deletePerson(20);
- $this->deleteGroup(10);
- $this->deleteRight(20);
- $this->deleteRole(20);
- $this->deleteMemberships();
- }
-}
-
-$u = new deleteClass();
-$u->deleteAll();
-
-
diff --git a/pbs-randomInsert.php b/pbs-randomInsert.php
deleted file mode 100644
index af3b141..0000000
--- a/pbs-randomInsert.php
+++ /dev/null
@@ -1,192 +0,0 @@
-<?php
-$link = mysql_connect('localhost', 'root', 'lsfks-openslx');
-if (!$link) {
- die('keine Verbindung möglich: ' . mysql_error());
-}
-echo 'Verbindung erfolgreich'."\n";
-mysql_select_db('pbs');
-
-
-class insertClass{
- function insertPerson($i){
- $anz = mysql_num_rows(mysql_query("SELECT * FROM pbs_person"))+1;
- for($n=$anz;$n<$anz+$i;$n++){
- mysql_query("INSERT INTO pbs_person (name,firstname,registerdate,email,login,password) VALUES ('test$n','test$n',$n,'mail@mail.com','test$n','test$n');");
- }
- echo "$i Personen eingefügt\n";
- }
- function insertGroup($i){
- $anz = mysql_num_rows(mysql_query("SELECT * FROM pbs_group"))+1;
- for($n=$anz;$n<$anz+$i;$n++){
- mysql_query("INSERT INTO pbs_group (title) VALUES ('testgruppe$n');");
- }
- echo "$i Gruppen eingefügt\n";
- }
- function linkGroups(){
- $r = mysql_query("SELECT * FROM pbs_group");
- $anz = mysql_num_rows($r);
- while ($d = mysql_fetch_array($r,MYSQL_BOTH)){
- $data[] = $d;
- }
- $firstElement = array_shift($data);
- $startParent = $firstElement['groupID'];
- while(count($data)>0){
- $now = array_shift($data);
- mysql_query("INSERT INTO pbs_groupgroups (parentID,groupID) VALUES ($startParent,".$now['groupID'].")");
-
- if(count($data)%4 == 1){
- $startParent = $now['groupID'];
- }
- }
- echo "Gruppen untereinander verbunden\n";
- }
- function insertRight($i){
- $anz = mysql_num_rows(mysql_query("SELECT * FROM pbs_right"))+1;
- for($n=$anz;$n<$anz+$i;$n++){
- mysql_query("INSERT INTO `pbs_right` (`rightID`, `title`, `description`) VALUES (NULL, 'recht$n', NULL)");
- }
- echo "$i Rechte eingefügt\n";
- }
-
- function insertRole($i){
- $anzRight = mysql_num_rows(mysql_query("SELECT * FROM pbs_right"))+1;
-
- $r = mysql_query("SELECT * FROM pbs_group");
- $anzGroup = mysql_num_rows($r);
-
- $linkGroup = 1;
- $anz = mysql_num_rows(mysql_query("SELECT * FROM pbs_role"));
-
- for($n=$anz;$n<=$anz+$i;$n++){
- if($n>4){
- $linkGroup = rand(0,$anzGroup);
- }
- mysql_query("INSERT INTO `pbs_role` (
- `roleID` ,`groupID` ,`title` ,`description` )
- VALUES (
- NULL , '$linkGroup', 'testgruppe$n', NULL)");
- }
- echo "$i Rollen eingefügt\n";
- }
- function linkRightRole(){
- $anzRight = mysql_num_rows(mysql_query("SELECT * FROM pbs_right"));
- $anzRole = mysql_num_rows(mysql_query("SELECT * FROM pbs_role"));
- $anz = rand(max($anzRight,$anzRole),floor($anzRight+$anzRole));
- $anz2 = $anz;
- while($anz >0){
- $rightID = rand(1,$anzRight);
- $roleID = rand(1,$anzRole);
- $r = mysql_query("INSERT INTO `pbs_rightroles` (`roleID`, `rightID`) VALUES ('$roleID','$rightID')");
- $anz--;
- }
- echo "Rechte mit Rollen verbunden ($anz2 Verbindungen)\n";
- }
- function createMemberships(){
- $anzPersonen = mysql_num_rows(mysql_query("SELECT * FROM pbs_person"));
- $anzRole = mysql_num_rows(mysql_query("SELECT * FROM pbs_role"));
-
- $r = mysql_query("SELECT * FROM pbs_role");
- while ($d = mysql_fetch_array($r,MYSQL_BOTH)){
- $roles[] = $d;
- }
-
- $verbindungen = rand($anzPersonen,$anzPersonen*2);
- $verbindungen2 = $verbindungen;
- while ($verbindungen>0){
- $personID = rand(1,$anzPersonen);
- $roleID = rand(1,$anzRole);
- $r = mysql_query("INSERT INTO `pbs_membership` (`roleID`, `groupID`,`personID`) VALUES ('$roleID','".$roles[$roleID-1]['groupID']."','$personID')");
- $verbindungen--;
- }
- echo "Personen in Gruppen in bestimmten Rollen hinzugefügt ($verbindungen2 Verbindungen)\n";
- }
- function createGroupRequest($i){
- $anzPersonen = mysql_num_rows(mysql_query("SELECT * FROM pbs_person"));
- $anzGruppen = mysql_num_rows(mysql_query("SELECT * FROM pbs_group"));
-
- $anz = floor($anzPersonen*$i);
- $anz2=$anz;
- while($anz>0){
- $randomPerson = rand(1,$anzPersonen);
- $randomGruppe = rand(1,$anzGruppen);
- $q = "SELECT * FROM `pbs_membership` WHERE `groupID` = '$randomGruppe' AND `personID` = '$randomPerson'";
- if(mysql_num_rows(mysql_query($q)) == 0){
- mysql_query("INSERT INTO pbs_grouprequest (`groupID`,`personID`,`time`) VALUES ('$randomGruppe','$randomPerson',".rand(time()-7*24*60*60,time()).")");
- $anz--;
- }
- }
- echo "$anz2 Gruppenanfragen wurden von Personen zu gruppen erstellt\n";
- }
- function insertBootOS($i){
- $anz = mysql_num_rows(mysql_query("SELECT * FROM pbs_bootos"))+1;
- $anzGruppen = mysql_num_rows(mysql_query("SELECT * FROM pbs_group"));
- for($n=$anz;$n<$anz+$i;$n++){
- $randomGruppe = rand(1,$anzGruppen);
- mysql_query("INSERT INTO `pbs`.`pbs_bootos` (`bootosID`, `configID`, `groupID`, `title`, `description`, `path_init`, `path_kernel`, `defaultkcl`, `created`, `expires`, `public`) VALUES (NULL, NULL, '$randomGruppe', 'BootOS $n', NULL, '', '', '', '', NULL, '1')");
- }
- echo "$i BootOS eingefügt\n";
- }
- function getBootOS($membershipID){
- $q = "SELECT * FROM pbs_membership WHERE membershipID = $membershipID";
- echo "42";
- // TODO rekursive auflistung aller zur verfügung stehenden BootOS eines Mitglieds
-
- }
-
- function insertAll(){
- /*$this->clearAll();
- $this->insertGroup(10); # Gruppen hinzufügen
- $this->linkGroups(); # Gruppen untereinander verbinden
- $this->insertPerson(20); # Personen hinzufügen
- $this->insertRight(20); # Rechte hinzufügen
- $this->insertRole(20); # Rollen hinzufügen
- $this->linkRightRole(); # Recht den Rollen zuweisen
- $this->createMemberships(); # Personen mit Rollen den Gruppen zuweisen
- $this->createGroupRequest(0.3); # Prozent der Personen die Requesten
- $this->insertBootOS(15); # BootOS zu den Gruppen hinzugefügt
- */
- $this->getBootOS(16);
- }
-
- function clearAll()
- {
- mysql_query("TRUNCATE `pbs_bootiso`");
- mysql_query("TRUNCATE `pbs_bootmenu`");
- mysql_query("TRUNCATE `pbs_bootmenuentries`");
- mysql_query("TRUNCATE `pbs_bootos`");
- mysql_query("TRUNCATE `pbs_client`");
- mysql_query("TRUNCATE `pbs_config`");
- mysql_query("TRUNCATE `pbs_filter`");
- mysql_query("TRUNCATE `pbs_filterentries`");
- mysql_query("TRUNCATE `pbs_filtertype`");
- mysql_query("TRUNCATE `pbs_group`");
- mysql_query("TRUNCATE `pbs_groupgroups`");
- mysql_query("TRUNCATE `pbs_grouprequest`");
- mysql_query("TRUNCATE `pbs_membership`");
- mysql_query("TRUNCATE `pbs_membershipfilters`");
- mysql_query("TRUNCATE `pbs_person`");
- mysql_query("TRUNCATE `pbs_pool`");
- mysql_query("TRUNCATE `pbs_poolentries`");
- mysql_query("TRUNCATE `pbs_poolfilters`");
- mysql_query("TRUNCATE `pbs_right`");
- mysql_query("TRUNCATE `pbs_rightroles`");
- mysql_query("TRUNCATE `pbs_role`");
- mysql_query("TRUNCATE `pbs_session`");
- }
-}
-
-$u = new insertClass();
-$u->insertAll();
-
-
-
-
-
-
-
-
-
-
-mysql_close($link);
-
-