php8
[web.mtrack] / MTrackWeb / Projects.php
index 05b4ddd..744b274 100644 (file)
@@ -17,72 +17,37 @@ class MTrackWeb_Projects extends MTrackWeb
 {
     
     //function getAuth-- inherit
+    var $authUserArray;
     
-    function get() {
+    function get($pi='') {
         
         
         $kv = $this->userProjects();
         $ret = array();
-        foreach($kv as $kv) {
+        foreach($kv as $k=>$v) {
             $ret[] = array('id'=>$k, 'name' => $v);
         }
         $this->jdata($ret); 
         
     }
-    
-    function checkGroupPerson($p,$g)
-    {
-        
-        $str = '<input class="mtrack-perm" type="checkbox" name="'. $p->id . '_'. $g->id. '" value="1"';
-            
-        if (in_array($g->id, $p->groups)) {
-            $str .= ' checked="checked"';
-        }
-        return $str. '>';
-    
-    }
+     
     /**
      *
      * Things that can change...
      * - permission updates 
      *
      */
-    function post()
+    function post($id)
     {
-         
+          if (isset($id)) {
+            $this->currentProject($id);
+            return $this->jok($this->currentProject());
+        }
         
         
-    }
-    
-    /***
-     * this is the future version of user Projects...
-     * 
-     */
-    function userProjects()
-    {
-         
-        $p = DB_DataObject::factory('Projects');
-        if (!$this->authUser) {
-            $p->code = '*PUBLIC';
-           
-            $ar = $p->fetchAll('id', 'name');
-        } else {
-            //DB_DAtaObject::debugLevel(1);
-            $p->applyFilters(array(), $this->authUser);
-            if (!$this->authUser->hasPerm('Core.Projects_All', 'S')) { 
-                $p->whereAdd("Projects.id in (SELECT ProjectDirectory.project_id FROM ProjectDirectory WHERE
-                        person_id = ". $this->authUser->id . " and role != '')");
-            }
-            $p->whereAdd('id in (SELECT distinct(project_id) FROM mtrack_repos)');
-            // $pd->whereAdd("role != ''");
-            
-            $p->orderBy('Projects.name ASC');
-            unset($p->client_id); // default projects serach enforces this..
-            $ar = $p->fetchAll('id', 'name');
-        }
-        return $ar;
         
     }
+