summaryrefslogtreecommitdiff
path: root/demos/time-tracker/protected/App_Code
diff options
context:
space:
mode:
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)