require_once $gfcommon.'include/Error.class.php';
- /**
- * Fetches a ProjectGroup object from the database
- *
- * @param int the projectgroup id
- * @param array whether or not the db result handle is passed in
- * @return object the ProjectGroup object
- */
+/**
+ * Fetches a ProjectGroup object from the database
+ *
+ * @param array $group_project_id whether or not the db result handle is passed in
+ * @param bool $data
+ * @return object the ProjectGroup object
+ */
function &projectgroup_get_object($group_project_id, $data = false) {
global $PROJECTGROUP_OBJ;
if (!isset($PROJECTGROUP_OBJ["_".$group_project_id."_"])) {
/**
* The Group object.
*
- * @var object $Group.
+ * @var Group $Group.
*/
var $Group;
var $statuses;
var $categories;
var $technicians;
- /**
- * Constructor.
- *
- * @param object The Group object to which this forum is associated.
- * @param int The group_project_id.
- * @param array The associative array of data.
- * @return boolean success.
- */
+ /**
+ * Constructor.
+ *
+ * @param $Group
+ * @param bool $group_project_id
+ * @param bool $arr
+ * @internal param \The $object Group object to which this forum is associated.
+ * @internal param \The $int group_project_id.
+ * @internal param \The $array associative array of data.
+ * @return \ProjectGroup
+ */
function ProjectGroup(&$Group, $group_project_id = false, $arr = false) {
$this->Error();
if (!$Group || !is_object($Group)) {
- $this->setError('ProjectGroup:: No Valid Group Object');
- return false;
+ $this->setError(_('No Valid Group Object'));
+ return;
}
if ($Group->isError()) {
- $this->setError('ProjectGroup:: '.$Group->getErrorMessage());
- return false;
+ $this->setError('ProjectGroup: '.$Group->getErrorMessage());
+ return;
}
$this->Group =& $Group;
if ($group_project_id) {
if (!$arr || !is_array($arr)) {
if (!$this->fetchData($group_project_id)) {
- return false;
+ return;
}
} else {
$this->data_array =& $arr;
if ($this->data_array['group_id'] != $this->Group->getID()) {
$this->setError('Group_id in db result does not match Group Object');
- return false;
+ return;
}
}
//
if (!forge_check_perm ('pm', $this->getID(), 'read')) {
$this->setPermissionDeniedError();
$this->data_array = null;
- return false;
+ return;
}
}
- return true;
}
/**
* create - create a new ProjectGroup in the database.
*
- * @param string The project name.
- * @param string The project description.
- * @param string The email address to send new notifications to.
- * @return boolean success.
+ * @param string $project_name The project name.
+ * @param string $description The project description. * @param string The email address to send new notifications to.
+ * @param string $send_all_posts_to The email address to send new notifications to.
+ * @return bool success.
*/
function create($project_name,$description,$send_all_posts_to='') {
if (strlen($project_name) < 3) {
/**
* fetchData - re-fetch the data for this ProjectGroup from the database.
*
- * @param int The project group ID.
- * @return boolean success.
+ * @param int $group_project_id The project group ID.
+ * @return bool success.
*/
function fetchData($group_project_id) {
$res = db_query_params ('SELECT * FROM project_group_list_vw WHERE group_project_id=$1 AND group_id=$2',
array ($group_project_id,
$this->Group->getID())) ;
if (!$res || db_numrows($res) < 1) {
- $this->setError('ProjectGroup:: Invalid group_project_id');
+ $this->setError(_('Invalid group_project_id'));
return false;
}
$this->data_array = db_fetch_array($res);
/**
* getGroup - get the Group object this ProjectGroup is associated with.
*
- * @return object The Group object.
+ * @return Group The Group object.
*/
function &getGroup() {
return $this->Group;
$this->getID()));
if (!$res || db_affected_rows($res) < 1) {
- $this->setError('Error On Update: '.db_error().$sql);
+ $this->setError(sprintf(_('Error On Update: %s'), db_error()));
return false;
}
return true;
/**
* delete - delete this subproject and all its related data.
*
- * @param bool I'm Sure.
- * @param bool I'm REALLY sure.
+ * @param bool $sure I'm Sure.
+ * @param bool $really_sure I'm REALLY sure.
* @return bool true/false;
*/
function delete($sure, $really_sure) {
db_commit();
$this->Group->normalizeAllRoles();
-
return true;
}
}