php8
[web.mtrack] / MTrackWeb / Projects.php
index 3221f7a..0de9013 100644 (file)
@@ -18,12 +18,12 @@ class MTrackWeb_Projects extends MTrackWeb
     
     //function getAuth-- inherit
     
-    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); 
@@ -36,42 +36,17 @@ class MTrackWeb_Projects extends MTrackWeb
      * - 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;
         
     }
+