diff options
author | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
---|---|---|
committer | ctrlaltca <> | 2012-07-12 11:21:01 +0000 |
commit | 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 (patch) | |
tree | e08bf04f0823650a231227ac3499121270172a23 /demos/time-tracker/protected/App_Code/Dao/ProjectDao.php | |
parent | 3e4e6e66aeb3f8fea4e1eb4237498ef9d2358f63 (diff) |
standardize the use of unix eol; use svn properties to enforce native eol
Diffstat (limited to 'demos/time-tracker/protected/App_Code/Dao/ProjectDao.php')
-rw-r--r-- | demos/time-tracker/protected/App_Code/Dao/ProjectDao.php | 208 |
1 files changed, 104 insertions, 104 deletions
diff --git a/demos/time-tracker/protected/App_Code/Dao/ProjectDao.php b/demos/time-tracker/protected/App_Code/Dao/ProjectDao.php index 9e8867bc..1d085b47 100644 --- a/demos/time-tracker/protected/App_Code/Dao/ProjectDao.php +++ b/demos/time-tracker/protected/App_Code/Dao/ProjectDao.php @@ -1,105 +1,105 @@ -<?php
-/**
- * Project DAO class file.
- *
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright © 2005-2006 PradoSoft
- * @license http://www.pradosoft.com/license/
- * @version $Id$
- * @package Demos
- */
-
-/**
- * Project DAO class.
- *
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @version $Id$
- * @package Demos
- * @since 3.1
- */
-class ProjectDao extends BaseDao
-{
- public function projectNameExists($projectName)
- {
- $sqlmap = $this->getSqlMap();
- return $sqlmap->queryForObject('ProjectNameExists', $projectName);
- }
-
- public function addNewProject($project)
- {
- $sqlmap = $this->getSqlMap();
- $sqlmap->insert('CreateNewProject', $project);
- }
-
- public function getProjectByID($projectID)
- {
- $sqlmap = $this->getSqlMap();
- return $sqlmap->queryForObject('GetProjectByID', $projectID);
- }
-
- public function deleteProject($projectID)
- {
- $sqlmap = $this->getSqlMap();
- $sqlmap->update('DeleteProject',$projectID);
- }
-
- public function addUserToProject($projectID, $username)
- {
- $sqlmap = $this->getSqlMap();
- $members = $this->getProjectMembers($projectID);
- if(!in_array($username, $members))
- {
- $param['username'] = $username;
- $param['project'] = $projectID;
- $sqlmap->insert('AddUserToProject',$param);
- }
- }
-
- public function getProjectMembers($projectID)
- {
- $sqlmap = $this->getSqlMap();
- return $sqlmap->queryForList('GetProjectMembers', $projectID);
- }
-
- public function getAllProjects($sort='', $order='ASC')
- {
- $sqlmap = $this->getSqlMap();
- if($sort === '')
- return $sqlmap->queryForList('GetAllProjects');
- else
- {
- $param['sort'] = $sort;
- $param['order'] = $order;
- return $sqlmap->queryForList('GetAllProjectsOrdered', $param);
- }
- }
-
- public function getProjectsByManagerName($manager)
- {
- $sqlmap = $this->getSqlMap();
- return $sqlmap->queryForList('GetProjectsByManagerName', $manager);
- }
-
- public function getProjectsByUserName($username)
- {
- $sqlmap = $this->getSqlMap();
- return $sqlmap->queryForList('GetProjectsByUserName', $username);
- }
-
- public function removeUserFromProject($projectID, $username)
- {
- $sqlmap = $this->getSqlMap();
- $param['username'] = $username;
- $param['project'] = $projectID;
- $sqlmap->delete('RemoveUserFromProject', $param);
- }
-
- public function updateProject($project)
- {
- $sqlmap = $this->getSqlMap();
- $sqlmap->update('UpdateProject', $project);
- }
-}
-
+<?php +/** + * Project DAO class file. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @package Demos + */ + +/** + * Project DAO class. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @version $Id$ + * @package Demos + * @since 3.1 + */ +class ProjectDao extends BaseDao +{ + public function projectNameExists($projectName) + { + $sqlmap = $this->getSqlMap(); + return $sqlmap->queryForObject('ProjectNameExists', $projectName); + } + + public function addNewProject($project) + { + $sqlmap = $this->getSqlMap(); + $sqlmap->insert('CreateNewProject', $project); + } + + public function getProjectByID($projectID) + { + $sqlmap = $this->getSqlMap(); + return $sqlmap->queryForObject('GetProjectByID', $projectID); + } + + public function deleteProject($projectID) + { + $sqlmap = $this->getSqlMap(); + $sqlmap->update('DeleteProject',$projectID); + } + + public function addUserToProject($projectID, $username) + { + $sqlmap = $this->getSqlMap(); + $members = $this->getProjectMembers($projectID); + if(!in_array($username, $members)) + { + $param['username'] = $username; + $param['project'] = $projectID; + $sqlmap->insert('AddUserToProject',$param); + } + } + + public function getProjectMembers($projectID) + { + $sqlmap = $this->getSqlMap(); + return $sqlmap->queryForList('GetProjectMembers', $projectID); + } + + public function getAllProjects($sort='', $order='ASC') + { + $sqlmap = $this->getSqlMap(); + if($sort === '') + return $sqlmap->queryForList('GetAllProjects'); + else + { + $param['sort'] = $sort; + $param['order'] = $order; + return $sqlmap->queryForList('GetAllProjectsOrdered', $param); + } + } + + public function getProjectsByManagerName($manager) + { + $sqlmap = $this->getSqlMap(); + return $sqlmap->queryForList('GetProjectsByManagerName', $manager); + } + + public function getProjectsByUserName($username) + { + $sqlmap = $this->getSqlMap(); + return $sqlmap->queryForList('GetProjectsByUserName', $username); + } + + public function removeUserFromProject($projectID, $username) + { + $sqlmap = $this->getSqlMap(); + $param['username'] = $username; + $param['project'] = $projectID; + $sqlmap->delete('RemoveUserFromProject', $param); + } + + public function updateProject($project) + { + $sqlmap = $this->getSqlMap(); + $sqlmap->update('UpdateProject', $project); + } +} + ?>
\ No newline at end of file |