diff options
author | wei <> | 2006-07-23 11:11:21 +0000 |
---|---|---|
committer | wei <> | 2006-07-23 11:11:21 +0000 |
commit | cbb7a11179b9c1c46e35f04d07d6386a44e400b2 (patch) | |
tree | dacfc2a5fdbcce3973e228eaca8002ff799e45d1 /demos/time-tracker/protected/pages/TimeTracker/ProjectList.php | |
parent | c0d9d27f16bae2e428225302da144e9cc6d4adc8 (diff) |
Update time-tracker demo and add simple dynamic SQLMap
Diffstat (limited to 'demos/time-tracker/protected/pages/TimeTracker/ProjectList.php')
-rw-r--r-- | demos/time-tracker/protected/pages/TimeTracker/ProjectList.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/demos/time-tracker/protected/pages/TimeTracker/ProjectList.php b/demos/time-tracker/protected/pages/TimeTracker/ProjectList.php new file mode 100644 index 00000000..eb92dcb7 --- /dev/null +++ b/demos/time-tracker/protected/pages/TimeTracker/ProjectList.php @@ -0,0 +1,34 @@ +<?php
+
+class ProjectList extends TPage
+{
+ protected function showProjects($sort='', $order='')
+ {
+ $dao = $this->Application->Modules['daos']->getDao('ProjectDao');
+ $this->projectList->DataSource = $dao->getAllProjects($sort, $order);
+ $this->projectList->dataBind();
+ }
+
+ protected function getSortOrder($sort)
+ {
+ $ordering = $this->getViewState('SortOrder', array());
+ $order = isset($ordering[$sort]) ? $ordering[$sort] : 'DESC';
+ $ordering[$sort] = $order == 'DESC' ? 'ASC' : 'DESC';
+ $this->setViewState('SortOrder', $ordering);
+ return $ordering[$sort];
+ }
+
+ protected function sortProjects($sender, $param)
+ {
+ $sort = $param->SortExpression;
+ $this->showProjects($sort, $this->getSortOrder($sort));
+ }
+
+ public function onLoad($param)
+ {
+ if(!$this->IsPostBack)
+ $this->showProjects();
+ }
+}
+
+?>
\ No newline at end of file |