1: <?php
2: 3: 4: 5:
6: class projectConfigHandler extends baseModel {
7:
8: public $viewhandler;
9: public $dbhandler;
10:
11: public function __construct($appid = null){
12: $this->db = null;
13: $this->instance = $this;
14: $this->createObjInstance(array("viewhandler","projectConfigViewHandler",$this->instance));
15: $this->viewhandler->setHeaderIdent('project','administration');
16: $this->initialize();
17: }
18:
19: public function setDataSource(&$db){
20: $this->dbhandler = new projectDbHandler($db,$this->getColumnTypesAll(),$this->column_method_pointers);
21: }
22:
23: public function &getDataSource(){
24: return $this->dbhandler;
25: }
26:
27: public function destructDbInstances(){
28: unset($this->db);
29: }
30:
31: public function &getDataObject($ident){
32: switch($ident){
33: default:
34: return $this->instance;
35: break;
36: }
37: }
38:
39: public function initialize(){
40:
41: }
42:
43: public function addTaskTypeItem(&$mainhandler,$type,$project_id){
44: if (!$this->dbhandler->getProjectTaskTypeId($type,$project_id)){
45: $this->dbhandler->addProjectTaskTypeItem($type,$project_id);
46: $this->dbhandler->updateSystemData();
47: }
48: }
49:
50: public function addStatusItem(&$mainhandler,$status,$project_id){
51: global $STATUS_LIST;
52:
53: $this->dbhandler->addStatusListItem($status,'PROJECT_TASK',$project_id,PROJECT_APP);
54: $this->dbhandler->updateSystemData();
55: $STATUS_LIST = $this->dbhandler->createStatusLists();
56: $mainhandler->setStatusList($STATUS_LIST);
57: }
58:
59: public function deleteStatusItem(&$mainhandler,$status_id){
60: global $STATUS_LIST;
61:
62: $status_key = $mainhandler->getStatusListKey('PROJECT_TASK',$status_id);
63: if ($status_key == null)
64: return false;
65:
66:
67: $this->dbhandler->deleteStatusListItem($status_id);
68: $this->dbhandler->updateSystemData();
69:
70: $STATUS_LIST = $this->dbhandler->createStatusLists();
71: $mainhandler->setStatusList($STATUS_LIST);
72: }
73:
74: public function addStatusFLowItem(&$mainhandler,$status_id,$parent_id,$project_id){
75: global $STATUS_LIST;
76:
77: $flow_list_arr = $mainhandler->getStatusFlowList();
78: if (in_array($status_id,$flow_list_arr[$parent_id]))
79: throw new Exception("status item exists");
80:
81: $this->dbhandler->addStatusFLowItem($parent_id,$status_id,$project_id,$mainhandler->getAppId());
82: $this->dbhandler->updateSystemData();
83:
84: $FLOW_LIST = $this->dbhandler->createStatusFlowLists();
85: $mainhandler->setStatusFlowList($FLOW_LIST);
86: }
87:
88: public function deleteStatusFlowItem(&$mainhandler,$status_id,$parent_id,$project_id){
89:
90: $flow_list_arr = $mainhandler->getStatusFlowList();
91: if (!in_array($status_id,$flow_list_arr[$parent_id]))
92: throw new Exception("status item not exists");
93:
94: $this->dbhandler->deleteStatusFLowItem($parent_id,$status_id,$project_id,$mainhandler->getAppId());
95: $this->dbhandler->updateSystemData();
96:
97: $FLOW_LIST = $this->dbhandler->createStatusFlowLists();
98: $mainhandler->setStatusFlowList($FLOW_LIST);
99: }
100: }
101: ?>
102: