Error(); if (!$Group || !is_object($Group)) { $this->setError('ProjectGroup:: No Valid Group Object'); return false; } if ($Group->isError()) { $this->setError('ProjectGroup:: '.$Group->getErrorMessage()); return false; } $this->Group =& $Group; return true; } /** * getGroup - get the Group object this ProjectGroupFactory is associated with. * * @return object The Group object. */ function &getGroup() { return $this->Group; } /** * getProjectGroups - get an array of ProjectGroup objects. * * @return array The array of ProjectGroups. */ function &getProjectGroups() { global $Language; if ($this->projectGroups) { return $this->projectGroups; } if (session_loggedin()) { $perm =& $this->Group->getPermission( session_get_user() ); if (!$perm || !is_object($perm) || !$perm->isMember()) { $public_flag='=1'; } else { $public_flag='<3'; if ($perm->isPMAdmin()) { $exists=''; } else { $exists=" AND group_project_id IN (SELECT group_project_ID FROM project_perm WHERE perm_level >= 0 AND group_project_id=project_group_list_vw.group_project_id AND user_id='".user_getid()."') "; } } } else { $public_flag='=1'; } $sql="SELECT * FROM project_group_list_vw WHERE group_id='". $this->Group->getID() ."' AND is_public $public_flag $exists ORDER BY group_project_id;"; $result = db_query ($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { $this->setError(_('No ProjectGroups Found').db_error()); $this->projectGroups=NULL; } else { while ($arr = db_fetch_array($result)) { $this->projectGroups[] = new ProjectGroup($this->Group, $arr['group_project_id'], $arr); } } return $this->projectGroups; } } ?>