MTrackWeb/Project.php
[web.mtrack] / MTrackWeb / Project.php
1 <?php
2 require_once 'MTrackWeb.php';
3
4 class MTrackWeb_Project extends MTrackWeb
5 {
6     
7     //function getAuth-- inherit
8     
9     function get($code='') {
10         
11         if (isset($_REQUEST['active_project_id'])) {
12             $this->currentProject($_REQUEST['active_project_id']);
13             return $this->jok($this->currentProject());
14         }
15         
16         if (!isset($_REQUEST['ajax_body'])) {
17             return;
18         }
19         $this->masterTemplate = 'project.html';
20          
21         $p = DB_DataObject::factory('Projects');
22         $p->get( $this->currentProject());
23         $this->project = $p;
24         
25         /// milestones..
26         
27         $this->milestones = $this->project->milestones();
28         
29         
30         
31         // compoennts...
32         
33         
34         // permissions..
35         if (!$this->authUser) {
36             return;
37         }
38         
39         
40         
41         
42         // members... (might be large one day)
43         $pr = DB_DataObject::Factory('ProjectDirectory');
44         $pr->project_id = $this->currentProject();
45         //$pr->autoJoin();
46         
47         if ($this->authUser->company()->comptype !='OWNER') {
48             $pr->whereAdd("role=''");
49         }
50         $ar  = $pr->fetchAll();
51         foreach($ar as $pd) {
52             $pd->person = $pd->person();
53             $pd->person->perms = $pd->person->getPerms();
54             $pd->person->groups = $pd->person->groups();
55             $this->people[] = $pd;
56         }
57         
58         
59         
60     }
61     
62 }