2 require_once 'MTrackWeb.php';
4 class MTrackWeb_Project extends MTrackWeb
7 //function getAuth-- inherit
9 function get($code='') {
11 if (isset($_REQUEST['active_project_id'])) {
12 $this->currentProject($_REQUEST['active_project_id']);
13 return $this->jok($this->currentProject());
16 if (!isset($_REQUEST['ajax_body'])) {
19 $this->masterTemplate = 'project.html';
21 $p = DB_DataObject::factory('Projects');
22 $p->get( $this->currentProject());
27 $this->milestones = $this->project->milestones();
35 if (!$this->authUser) {
38 ///DB_DataObject::debugLevel(1);
40 $gr = DB_DataObject::factory('Group_Rights');
41 $ar = $gr->defaultPermData();
42 //echo '<PRE>';print_r($ar);
44 foreach($ar as $nm=>$data) {
45 if (!preg_match('/^MTrack\./', $nm)) {
51 $gr = DB_DataObject::factory('Group_Rights');
52 $gr->whereAddIn('rightname', $perms, 'string');
55 $gr->selectAdd('distinct(group_id) as group_id');
56 $gr->whereAdd("AccessMask != ''");
57 $gids = $gr->fetchAll('group_id');
60 $g = DB_DataObject::Factory('groups');
61 $g->whereAddIn('id',$gids, 'int');
62 $this->groups = $g->fetchAll( );
65 // find out which groups are using those perms... so that we can offer membership to people..
70 // members... (might be large one day)
71 $pr = DB_DataObject::Factory('ProjectDirectory');
72 $pr->project_id = $this->currentProject();
75 if ($this->authUser->company()->comptype !='OWNER') {
76 $pr->whereAdd("role=''");
78 $ar = $pr->fetchAll();
79 $e = new HTML_Template_Flexy_Element('input',
80 array('type'=>'checkbox', 'value'=>"1"));
82 $pd->person = $pd->person();
83 $pd->person->perms = $pd->person->getPerms();
85 $g = DB_DataObject::Factory('Group_Members');
86 $pd->person->groups = $g->listGroupMembership($pd->person);
88 foreach($this->groups as $g) {
90 $ee->name = $pd->person->id .'_'. $g->id;
93 if (in_array($g->id, $pd->person->groups)) {
96 $this->elements[$ee->name] = $ee;
102 $this->people[] = $pd;
111 function checkGroupPerson($p,$g)
114 $str = '<input class="mtrack-perm" type="checkbox" name="'. $p->id . '_'. $g->id. '" value="1"';
116 if (in_array($g->id, $p->person->groups)) {
117 $str .= ' checked="checked"';
123 * Things that can change...
124 * - permission updates