summaryrefslogtreecommitdiffstats
path: root/application/models
diff options
context:
space:
mode:
authorBjörn Geiger2011-08-19 12:05:20 +0200
committerBjörn Geiger2011-08-19 12:05:20 +0200
commit325dce6d86164df90ccd47bc7d3d56af8992456f (patch)
treeb0c8bba8c8df1f0e35f7efe5c6323acba21fe613 /application/models
parentDatenbankänderungen (diff)
downloadpoolctrl-325dce6d86164df90ccd47bc7d3d56af8992456f.tar.gz
poolctrl-325dce6d86164df90ccd47bc7d3d56af8992456f.tar.xz
poolctrl-325dce6d86164df90ccd47bc7d3d56af8992456f.zip
minor
Diffstat (limited to 'application/models')
-rw-r--r--application/models/DbTable/Runningtype.php20
-rw-r--r--application/models/RunningtypeMapper.php45
2 files changed, 64 insertions, 1 deletions
diff --git a/application/models/DbTable/Runningtype.php b/application/models/DbTable/Runningtype.php
new file mode 100644
index 0000000..0ed5638
--- /dev/null
+++ b/application/models/DbTable/Runningtype.php
@@ -0,0 +1,20 @@
+<?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_Runningtype extends Zend_Db_Table_Abstract
+{
+
+ protected $_name = 'poolctrl_runningtype';
+
+
+}
+
diff --git a/application/models/RunningtypeMapper.php b/application/models/RunningtypeMapper.php
index b73d943..1739aa4 100644
--- a/application/models/RunningtypeMapper.php
+++ b/application/models/RunningtypeMapper.php
@@ -2,9 +2,52 @@
class Application_Model_RunningtypeMapper
{
-
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['reporttypeID']);
+ $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)) {