summaryrefslogtreecommitdiffstats
path: root/application/models
diff options
context:
space:
mode:
authorBjörn Geiger2011-08-05 12:22:52 +0200
committerBjörn Geiger2011-08-05 12:22:52 +0200
commitc8b354b1e9f02a23c06060ed4bf86931b90239aa (patch)
tree25782493588f98d581682787fb88bee63ea3b4f7 /application/models
parentverschiedene Fehler korrigiert (diff)
downloadpoolctrl-c8b354b1e9f02a23c06060ed4bf86931b90239aa.tar.gz
poolctrl-c8b354b1e9f02a23c06060ed4bf86931b90239aa.tar.xz
poolctrl-c8b354b1e9f02a23c06060ed4bf86931b90239aa.zip
Event Action wieder entfernt
Diffstat (limited to 'application/models')
-rw-r--r--application/models/DbTable/Eventaction.php19
-rw-r--r--application/models/Eventaction.php110
-rw-r--r--application/models/EventactionMapper.php148
3 files changed, 0 insertions, 277 deletions
diff --git a/application/models/DbTable/Eventaction.php b/application/models/DbTable/Eventaction.php
deleted file mode 100644
index 6fe9c03..0000000
--- a/application/models/DbTable/Eventaction.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?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_DbTable_Eventaction extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'poolctrl_eventaction';
-
-
-} \ No newline at end of file
diff --git a/application/models/Eventaction.php b/application/models/Eventaction.php
deleted file mode 100644
index 8d48593..0000000
--- a/application/models/Eventaction.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?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_Eventaction
-{
- protected $_eventactionID;
- protected $_title;
-
- 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 eventaction property');
- }
- $this->$method($value);
- }
-
- public function __get($name)
- {
- $method = 'get' . $name;
- if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid eventaction 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;
- }
-
- /**
- * 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->_eventactionID;
- }
- public function setID($_eventactionID)
- {
- $this->_eventactionID = $_eventactionID;
- return $this;
- }
-
- public function getTitle()
- {
- return $this->_title;
- }
-
- public function setTitle($_title)
- {
- $this->_title = $_title;
- return $this;
- }
-} \ No newline at end of file
diff --git a/application/models/EventactionMapper.php b/application/models/EventactionMapper.php
deleted file mode 100644
index af319a4..0000000
--- a/application/models/EventactionMapper.php
+++ /dev/null
@@ -1,148 +0,0 @@
-<?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_EventactionMapper
-{
-
- 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();
- if(count($result) > 0) {
- foreach ($result as $row) {
- $entry = new Application_Model_Event($row);
- $entry->setID($row['eventactionID']);
- $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_Eventaction');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Eventaction $eventaction)
- {
- $data = array('eventactionID'=> $eventaction->getID() ,'title'=> $eventaction->getTitle() );
- if (null === ($id = $eventaction->getID()) ) {
- unset($data['eventactionID']);
- return $this->getDbTable(F)->insert($data);
- } else {
- $this->getDbTable()->update($data, array('eventactionID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Eventaction $eventaction)
- {
- if (null === ($id = $eventaction->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('eventactionID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_Eventaction $eventaction = null)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- if($eventaction == null){
- $eventaction = new Application_Model_Eventaction();
- }
-
- $eventaction
- ->setID($row->eventactionID)
- ->setTitle($row->title);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Eventaction();
-
- $entry
- ->setID($row->eventactionID)
- ->setTitle($row->title);
-
- $entries[$row->eventactionID] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Eventaction $v1,Application_Model_Eventaction $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
-} \ No newline at end of file