function currentProject($val = false)
{
// we do need the option for me to look at all projects...
+
+
static $currentProject = false;
if (empty($_SESSION[__CLASS__])) {
$_SESSION[__CLASS__] = array();
}
+
if ($val !== false) {
// attempt to set it..
$_SESSION[__CLASS__]['active_project_id'] = $val ;
$currentProject = false;
// reset to ensure not cached..
}
+ $ar = $this->userProjects();
+ if (!isset($ar[$currentProject])) {
+ $currentProject = false;
+ $_SESSION[__CLASS__]['active_project_id'] = false;
+ }
if ($currentProject !== false) {
return $currentProject;
}
- $p = DB_DataObject::factory('Projects');
- $ar = array();
- if ($this->authUser) {
- $p->applyFilters(array(), $this->authUser);
- $p->whereAdd('id in (SELECT distinct(project_id) FROM mtrack_repos)');
- unset($p->client_id);
- $ar = $p->fetchAll('id', 'name');
- }
-
+
//print_r($ar);
if (empty($_SESSION[__CLASS__]['active_project_id']) ||
}
- function loadProjectList()
+ function userProjects()
{
- // DB_DataObject::debugLevel(1);
-
+
$p = DB_DataObject::factory('Projects');
if (!$this->authUser) {
$p->code = '*PUBLIC';
unset($p->client_id); // default projects serach enforces this..
$ar = $p->fetchAll('id', 'name');
}
+
+ }
+
+
+ function loadProjectList()
+ {
+ // DB_DataObject::debugLevel(1);
+
+ $ar = $this->userProjects();
$this->elements['active_project_id'] = new HTML_Template_Flexy_Element();
$this->elements['active_project_id']->setOptions($ar);