case 'restore': if ($group = $pm->getProject($request->getValidated('group_id', 'GroupId'))) { $ath = new ArtifactType($group, $atid); if (!$ath->restore()) { $feedback = $Language->getText('tracker_admin_restore', 'restore_failed'); } else { $feedback = $Language->getText('tracker_admin_restore', 'tracker_restored'); } } break; case 'delay': if ($group = $pm->getProject($request->getValidated('group_id', 'GroupId'))) { $ath = new ArtifactType($group, $request->getValidated('atid', 'uint')); // just check date >= today if (!$ath->delay($delay_date)) { if ($ath->isError()) { exit_error($Language->getText('global', 'error'), $ath->getErrorMessage() . " | " . $Language->getText('tracker_admin_restore', 'delay_failed')); } exit_error($Language->getText('global', 'error'), $Language->getText('tracker_admin_restore', 'delay_failed')); } else { $feedback = $Language->getText('tracker_admin_restore', 'delayed_deletion'); } } break; case 'delete': // Create field factory if ($group = $pm->getProject($request->getValidated('group_id', 'GroupId'))) { $atid = $request->getValidated('atid', 'uint'); $ath = new ArtifactType($group, $atid); $atf = new ArtifactTypeFactory($group); $art_field_fact = new ArtifactFieldFactory($ath);
/** * Create a tracker v5 from a tracker v3 * * @param PFUser $user the user who requested the creation * @param int $atid the id of the tracker v3 * @param Project $project the Id of the project to create the tracker * @param string $name the name of the tracker (label) * @param string $description the description of the tracker * @param string $itemname the short name of the tracker * * @throws Tracker_Exception_Migration_GetTv3Exception * * @return Tracker */ public function createFromTV3(PFUser $user, $atid, Project $project, $name, $description, $itemname) { require_once 'common/tracker/ArtifactType.class.php'; $tv3 = new ArtifactType($project, $atid); if ($tv3->isError()) { throw new Tracker_Exception_Migration_GetTv3Exception($tv3->getErrorMessage()); } // Check if this tracker is valid (not deleted) if (!$tv3->isValid()) { throw new Tracker_Exception_Migration_GetTv3Exception($GLOBALS['Language']->getText('tracker_add', 'invalid')); } //Check if the user can view the artifact if (!$tv3->userCanView($user->getId())) { throw new Tracker_Exception_Migration_GetTv3Exception($GLOBALS['Language']->getText('include_exit', 'no_perm')); } $tracker = null; if ($this->validMandatoryInfoOnCreate($name, $description, $itemname, $project->getId())) { $migration_v3 = new Tracker_Migration_V3($this); $tracker = $migration_v3->createTV5FromTV3($project, $name, $description, $itemname, $tv3); $this->postCreateActions($tracker); } return $tracker; }
/** * getArtifactTypes - return an array of ArtifactType objects. * * @return array The array of ArtifactType objects. */ function &getArtifactTypes() { if ($this->ArtifactTypes) { return $this->ArtifactTypes; } if (session_loggedin()) { $perm =& $this->Group->getPermission(session_get_user()); if (!$perm || !is_object($perm) || !$perm->isMember()) { $public_flag = '=1'; $exists = ''; } else { $public_flag = '<3'; if ($perm->isArtifactAdmin()) { $exists = ''; } else { $exists = " AND group_artifact_id IN (SELECT role_setting.ref_id\n\t\t\t\t\tFROM role_setting, user_group\n\t\t\t\t\tWHERE role_setting.value::integer >= 0\n AND role_setting.section_name = 'tracker'\n AND role_setting.ref_id=artifact_group_list_vw.group_artifact_id\n \n \t\t\t\t\t AND user_group.role_id = role_setting.role_id\n\t\t\t\t\t AND user_group.user_id='" . user_getid() . "') "; } } } else { $public_flag = '=1'; $exists = ''; } $sql = "SELECT * FROM artifact_group_list_vw\n\t\t\tWHERE group_id='" . $this->Group->getID() . "'\n\t\t\tAND is_public {$public_flag}\n\t\t\t{$exists}\n\t\t\tORDER BY group_artifact_id ASC"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { $this->setError('None Found ' . db_error()); $this->ArtifactTypes = NULL; } else { while ($arr =& db_fetch_array($result)) { $artifactType = new ArtifactType($this->Group, $arr['group_artifact_id'], $arr); if ($artifactType->isError()) { $this->setError($artifactType->getErrorMessage()); } else { $this->ArtifactTypes[] = $artifactType; } } } return $this->ArtifactTypes; }