summaryrefslogtreecommitdiff
path: root/demos/time-tracker/protected/App_Code
diff options
context:
space:
mode:
authorwei <>2006-07-23 11:11:21 +0000
committerwei <>2006-07-23 11:11:21 +0000
commitcbb7a11179b9c1c46e35f04d07d6386a44e400b2 (patch)
treedacfc2a5fdbcce3973e228eaca8002ff799e45d1 /demos/time-tracker/protected/App_Code
parentc0d9d27f16bae2e428225302da144e9cc6d4adc8 (diff)
Update time-tracker demo and add simple dynamic SQLMap
Diffstat (limited to 'demos/time-tracker/protected/App_Code')
-rw-r--r--demos/time-tracker/protected/App_Code/CategoryDao.php5
-rw-r--r--demos/time-tracker/protected/App_Code/ProjectDao.php11
2 files changed, 13 insertions, 3 deletions
diff --git a/demos/time-tracker/protected/App_Code/CategoryDao.php b/demos/time-tracker/protected/App_Code/CategoryDao.php
index f0149f0b..cb1b6399 100644
--- a/demos/time-tracker/protected/App_Code/CategoryDao.php
+++ b/demos/time-tracker/protected/App_Code/CategoryDao.php
@@ -5,7 +5,10 @@ class CategoryDao extends BaseDao
function addNewCategory($category)
{
$sqlmap = $this->getConnection();
- $sqlmap->insert('AddNewCategory', $category);
+ $exists = $this->getCategoryByNameInProject(
+ $category->Name, $category->ProjectID);
+ if(!$exists)
+ $sqlmap->insert('AddNewCategory', $category);
}
function getCategoryByID($categoryID)
diff --git a/demos/time-tracker/protected/App_Code/ProjectDao.php b/demos/time-tracker/protected/App_Code/ProjectDao.php
index 416c6540..0a0771e3 100644
--- a/demos/time-tracker/protected/App_Code/ProjectDao.php
+++ b/demos/time-tracker/protected/App_Code/ProjectDao.php
@@ -62,10 +62,17 @@ class ProjectDao extends BaseDao
return $sqlmap->queryForList('GetProjectMembers', $projectID);
}
- public function getAllProjects()
+ public function getAllProjects($sort='', $order='ASC')
{
$sqlmap = $this->getConnection();
- return $sqlmap->queryForList('GetAllProjects');
+ if($sort === '')
+ return $sqlmap->queryForList('GetAllProjects');
+ else
+ {
+ $param['sort'] = $sort;
+ $param['order'] = $order;
+ return $sqlmap->queryForList('GetAllProjectsOrdered', $param);
+ }
}
public function getProjectsByManagerName($manager)