/** * Check that the service is used and the plugin is allowed for project $project * if it is not the case then exit with an error * * @param Project $project * @param Codendi_Request $request * * @return bool true if success. Otherwise the process terminates. */ public function checkServiceEnabled(Project $project, Codendi_Request $request) { if ($project->usesService('plugin_tracker')) { return true; } header("HTTP/1.0 404 Not Found"); if (!$request->isAjax()) { $GLOBALS['Response']->addFeedback('error', "The project doesn't use the 'tracker v5' service"); $GLOBALS['HTML']->redirect('/projects/' . $project->getUnixName() . '/'); } exit; }
private function isSearchEntryAvailable(Project $project = null) { if ($project && !$project->isError()) { return $project->usesService(self::SERVICE_SHORTNAME); } return false; }
private function isSearchEntryAvailable(Project $project = null) { if ($project && !$project->isError()) { return $project->usesService('plugin_phpwiki'); } return false; }
private function getAdditionnalProjectWidePresentersIfNeeded(Project $project, $words, $redirect_to_services) { $additionnal_presenters = array(); if ($project->usesService('wiki') && !$this->useFulltextSearch()) { $search_wiki = new Search_SearchWiki(new WikiDao()); $additionnal_presenters[] = $search_wiki->getFacets($project->getID(), $words); } if ($project->usesService('tracker')) { $search_tracker = new Search_SearchTrackerV3(new ArtifactDao()); $additionnal_presenters[] = $search_tracker->getFacets($project); } return $additionnal_presenters; }
private function getTrackersV3ForProject(Project $project) { if ($project->usesService('tracker')) { require_once 'common/tracker/ArtifactTypeFactory.class.php'; $atf = new ArtifactTypeFactory($project); return $atf->getArtifactTypes(); } return null; }
/** * getTrackerList - returns an array of TrackerDesc (short description of trackers) that belongs to the project identified by group_id * * @param string $sessionKey the session hash associated with the session opened by the person who calls the service * @param int $group_id the ID of the group we want to retrieve the list of trackers * @return array the array of SOAPTrackerDesc that belongs to the project identified by $group_id, or a soap fault if group_id does not match with a valid project. */ function getTrackerList($sessionKey, $group_id) { if (session_continue($sessionKey)) { try { $pm = ProjectManager::instance(); $group = $pm->getGroupByIdForSoap($group_id, 'getTrackerList'); } catch (SoapFault $e) { return $e; } $project = new Project($group_id); if (!$project->usesService('tracker')) { return new SoapFault(get_service_fault, 'Tracker service is not used for this project.', 'getTrackerList'); } $atf = new ArtifactTypeFactory($group); if (!$atf || !is_object($atf)) { return new SoapFault(get_artifact_type_factory_fault, 'Could Not Get ArtifactTypeFactory', 'getTrackerList'); } elseif ($atf->isError()) { return new SoapFault(get_artifact_type_factory_fault, $atf->getErrorMessage(), 'getTrackerList'); } // The function getArtifactTypes returns only the trackers the user is allowed to view return trackerlist_to_soap($atf->getArtifactTypes()); } else { return new SoapFault(invalid_session_fault, 'Invalid Session', 'getTrackerList'); } }