本文整理汇总了PHP中Project::getGroupId方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getGroupId方法的具体用法?PHP Project::getGroupId怎么用?PHP Project::getGroupId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::getGroupId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* Update project
*
* @param void
* @return null
*/
function edit()
{
$this->wireframe->print_button = false;
if ($this->request->isApiCall() && !$this->request->isSubmitted()) {
$this->httpError(HTTP_ERR_BAD_REQUEST, null, true, true);
}
// if
if ($this->active_project->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if (!$this->active_project->canEdit($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
$project_data = $this->request->post('project');
if (!is_array($project_data)) {
$project_data = array('name' => $this->active_project->getName(), 'overview' => $this->active_project->getOverview(), 'default_visibility' => $this->active_project->getDefaultVisibility(), 'leader_id' => $this->active_project->getLeaderId(), 'group_id' => $this->active_project->getGroupId(), 'company_id' => $this->active_project->getCompanyId(), 'default_visibility' => $this->active_project->getDefaultVisibility(), 'starts_on' => $this->active_project->getStartsOn());
}
// if
$this->smarty->assign('project_data', $project_data);
if ($this->request->isSubmitted()) {
db_begin_work();
$old_name = $this->active_project->getName();
$this->active_project->setAttributes($project_data);
if ($this->active_project->isModified('leader_id') && $this->active_project->getLeaderId()) {
$leader = Users::findById($this->active_project->getLeaderId());
if (instance_of($leader, 'User')) {
$this->active_project->setLeader($leader);
}
// if
}
// if
if ($this->active_project->isModified('company_id')) {
cache_remove('project_icons');
}
// if
$save = $this->active_project->save();
if ($save && !is_error($save)) {
db_commit();
if ($this->request->isApiCall()) {
$this->serveData($this->active_project, 'project');
} else {
flash_success('Project :name has been updated', array('name' => $old_name));
$this->redirectToUrl($this->active_project->getOverviewUrl());
}
// if
} else {
db_rollback();
if ($this->request->isApiCall()) {
$this->serveData($save);
} else {
$this->smarty->assign('errors', $save);
}
// if
}
// if
}
// if
}
示例2: __construct
public function __construct(Project $project, $count, $selected)
{
$this->label = util_unconvert_htmlspecialchars($project->getPublicName());
$this->count = $count;
$this->value = $project->getGroupId();
$this->selected = $selected;
}
示例3: service_replace_template_name_in_link
/**
* @return string
*/
function service_replace_template_name_in_link($link, array $template, Project $project)
{
$link = preg_replace('#(/www/|/projects/|group=)' . $template['name'] . '(/|&|$)#', '$1' . $project->getUnixName() . '$2', $link);
$link = preg_replace('/group_id=' . $template['id'] . '([^\\d]|$)/', 'group_id=' . $project->getGroupId() . '$1', $link);
EventManager::instance()->processEvent(Event::SERVICE_REPLACE_TEMPLATE_NAME_IN_LINK, array('link' => &$link, 'template' => $template, 'project' => $project));
return $link;
}
示例4: getRedirectToParameters
/**
* Get the parameters to redirect to proper pane on the AgileDashboard
* @param Codendi_Request $request
* @param Project $project
* @return array || null
*/
public function getRedirectToParameters(Codendi_Request $request, Project $project)
{
$request_parameters = $this->extractParametersFromRequest($request);
if ($request_parameters) {
$request_parameters['group_id'] = $project->getGroupId();
}
return $request_parameters;
}
示例5: askForMigration
/**
* Launch the migration of a TV3 to a TV5
*
* @param Project $project
* @param $tracker_id
* @param $name
* @param $description
* @param $short_name
*
* @return bool true if everything seems right
*/
public function askForMigration(Project $project, $tracker_id, $name, $description, $short_name)
{
if (!$this->tracker_factory->validMandatoryInfoOnCreate($name, $description, $short_name, $project->getGroupId())) {
return false;
}
$this->system_event_manager->queueTV3Migration($this->user_manager->getCurrentUser(), $project, $tracker_id, $name, $description, $short_name);
return true;
}
示例6: isAllowed
/**
* Say if the service is allowed for the project
*
* @param Project $project
*
* @return bool
*/
protected function isAllowed($project)
{
$plugin_manager = PluginManager::instance();
$p = $plugin_manager->getPluginByName('tracker');
if ($p && $plugin_manager->isPluginAvailable($p) && $p->isAllowed($project->getGroupId())) {
return true;
}
return false;
}
示例7: __construct
public function __construct(Project $project, $count, $checked)
{
$this->label = $project->getUnixName();
$this->count = $count;
$this->value = $project->getGroupId();
if ($checked) {
$this->checked = 'checked="checked"';
}
}
示例8: getDocmanAdminUgroups
/**
* Returns docman admin ugroups
*
* @param Project $project
*
* @return DataAccessResult
*/
function getDocmanAdminUgroups(Project $project)
{
$sql = "SELECT ugroup_id\n FROM permissions\n WHERE permission_type = 'PLUGIN_DOCMAN_ADMIN'\n AND object_id = " . $this->da->escapeInt($project->getGroupId()) . "\n ORDER BY ugroup_id";
$res = $this->retrieve($sql);
if ($res && !$res->isError()) {
return $res;
} else {
return false;
}
}
示例9: solveInconsistencies
public function solveInconsistencies()
{
$milestone_artifact = Tracker_ArtifactFactory::instance()->getArtifactById($this->request->get('aid'));
$milestone = $this->milestone_factory->getMilestoneFromArtifact($milestone_artifact);
$artifact_ids = $this->request->get('inconsistent-artifacts-ids');
$extractor = new AgileDashboard_PaneRedirectionExtractor();
if (!($this->inconsistentArtifactsIdsAreValid($artifact_ids) && $milestone->solveInconsistencies($this->getCurrentUser(), $artifact_ids))) {
$this->addFeedback(Feedback::ERROR, $GLOBALS['Language']->getText('plugin_agiledashboard', 'error_on_inconsistencies_solving'));
}
$this->addFeedback(Feedback::INFO, $GLOBALS['Language']->getText('plugin_agiledashboard', 'successful_inconsistencies_solving'));
if (!($request_has_redirect = $extractor->getRedirectToParameters($this->request, $this->project))) {
$this->redirect(array('group_id' => $this->project->getGroupId()));
}
$this->redirect($extractor->getRedirectToParameters($this->request, $this->project));
}
示例10: svn_get_revisions
function svn_get_revisions(Project $project, $offset, $chunksz, $_rev_id = '', $_commiter = '', $_srch = '', $order_by = '', $pv = 0, $foundRows = true)
{
global $_path;
$um = UserManager::instance();
//check user access rights
$forbidden = svn_utils_get_forbidden_paths($um->getCurrentUser()->getName(), $project->getSVNRootPath());
$select = 'SELECT';
$group_by = '';
if ($foundRows) {
$select .= ' SQL_CALC_FOUND_ROWS';
}
$select .= ' svn_commits.revision as revision, svn_commits.id as commit_id, svn_commits.description as description, svn_commits.date as date, svn_commits.whoid';
$from = " FROM svn_commits";
$where = " WHERE svn_commits.group_id=" . db_ei($project->getGroupId());
//check user access rights
if (!empty($forbidden)) {
$from .= " INNER JOIN svn_checkins ON (svn_checkins.commitid = svn_commits.id)";
$from .= " INNER JOIN svn_dirs ON (svn_dirs.id = svn_checkins.dirid)";
$where_forbidden = "";
foreach ($forbidden as $no_access => $v) {
if ($no_access == $_path) {
$_path = '';
}
$where_forbidden .= " AND svn_dirs.dir not like '" . db_es(substr($no_access, 1)) . "%'";
}
$where .= $where_forbidden;
$group_by .= ' GROUP BY revision';
}
//if status selected, and more to where clause
if ($_path != '') {
$path_str = " AND svn_dirs.dir like '%" . db_es($_path) . "%'";
if (!isset($forbidden) || empty($forbidden)) {
$from .= " INNER JOIN svn_checkins ON (svn_checkins.commitid = svn_commits.id)";
$from .= " INNER JOIN svn_dirs ON (svn_dirs.id = svn_checkins.dirid)";
$group_by .= ' GROUP BY revision';
}
} else {
$path_str = "";
}
//if revision selected, and more to where clause
if (isset($_rev_id) && $_rev_id != '') {
$commit_str = " AND svn_commits.revision='" . db_ei($_rev_id) . "' ";
} else {
$commit_str = '';
}
if (isset($_commiter) && $_commiter && $_commiter != 100) {
$commiter_str = " AND svn_commits.whoid='" . db_ei($um->getUserByUserName($_commiter)->getId()) . "' ";
} else {
//no assigned to was chosen, so don't add it to where clause
$commiter_str = '';
}
if (isset($_srch) && $_srch != '') {
$srch_str = " AND svn_commits.description like '%" . db_es(htmlspecialchars($_srch)) . "%'";
} else {
$srch_str = "";
}
$where .= $commiter_str . $commit_str . $srch_str . $path_str;
if (!isset($pv) || !$pv) {
$limit = " LIMIT " . db_ei($offset) . "," . db_ei($chunksz);
}
// SQLi Warning: no real possibility to escape $order_by here.
// We rely on a proper filtering of user input by calling methods.
if (!isset($order_by) || $order_by == '') {
$order_by = " ORDER BY revision DESC ";
}
$sql = $select . $from . $where . $group_by . $order_by . $limit;
//echo $sql."<br>\n";
$result = db_query($sql);
// Compute the number of rows.
$totalrows = -1;
if ($foundRows) {
$sql1 = 'SELECT FOUND_ROWS() as nb';
$result1 = db_query($sql1);
if ($result1 && !db_error($result1)) {
$row1 = db_fetch_array($result1);
$totalrows = $row1['nb'];
}
}
return array($result, $totalrows);
}
示例11: fetchTrackerSwitcher
public function fetchTrackerSwitcher(PFUser $user, $separator, Project $include_project = null, Tracker $current_tracker = null)
{
$hp = Codendi_HTMLPurifier::instance();
$html = '';
//Projects/trackers
$projects = $user->getProjects(true);
if ($include_project) {
$found = false;
foreach ($projects as $data) {
if ($data['group_id'] == $include_project->getGroupId()) {
$found = true;
break;
}
}
if (!$found) {
$projects[] = array('group_id' => $include_project->getGroupId(), 'group_name' => $include_project->getPublicName());
}
}
$html .= '<strong>';
if ($current_tracker) {
$html .= $hp->purify($current_tracker->getProject()->getPublicName(), CODENDI_PURIFIER_CONVERT_HTML);
} else {
$html .= $GLOBALS['Language']->getText('plugin_tracker', 'tracker_switcher');
}
$html .= '</strong>' . $separator;
$html .= '<select id="tracker_select_tracker">';
if (!$current_tracker) {
$html .= '<option selected="selected">--</option>';
}
$factory = TrackerFactory::instance();
foreach ($projects as $data) {
if ($trackers = $factory->getTrackersByGroupId($data['group_id'])) {
foreach ($trackers as $key => $v) {
if (!$v->userCanView($user)) {
unset($trackers[$key]);
}
}
if ($trackers) {
$html .= '<optgroup label="' . $hp->purify($data['group_name'], CODENDI_PURIFIER_CONVERT_HTML) . '">';
foreach ($trackers as $t) {
$selected = $current_tracker && $t->getId() == $current_tracker->getId() ? 'selected="selected"' : '';
$html .= '<option ' . $selected . ' value="' . $t->getId() . '">';
$html .= $hp->purify($t->getName(), CODENDI_PURIFIER_CONVERT_HTML);
$html .= '</option>';
}
$html .= '</optgroup>';
}
}
}
$html .= '</select>';
return $html;
}
示例12: getAddToProjectDashboardURL
private function getAddToProjectDashboardURL(Project $project)
{
return $this->getAddToDashboardURL('g' . $project->getGroupId(), Tracker_Widget_ProjectRenderer::ID);
}
示例13: assertUserCanAccessProject
public function assertUserCanAccessProject(User $user, Project $project)
{
if ($project->isPublic() && $user->isRestricted() && !$user->isMember($project->getGroupId()) || !$project->isPublic() && !$user->isMember($project->getGroupId())) {
throw new Exception('User do not have access to the project', '3002');
}
}
示例14: isThereAMigrationQueuedForProject
public function isThereAMigrationQueuedForProject(Project $project)
{
return $this->system_event_manager->isThereAnEventAlreadyOnGoingMatchingParameter(SystemEvent_TRACKER_V3_MIGRATION::NAME, $project->getGroupId());
}
示例15: dumpProjectRepoConfForAGivenMirror
private function dumpProjectRepoConfForAGivenMirror(Project $project, Git_Mirror_Mirror $mirror, Git_Gitolite_GitModifications $git_modifications)
{
if (empty($mirror->hostname)) {
return;
}
$repositories = $this->mirror_data_mapper->fetchAllProjectRepositoriesForMirror($mirror, array($project->getGroupId()));
$this->createConfFolderForMirrorIfNeeded($mirror);
$config_file = $this->getProjectPermissionConfFileForMirror($project, $mirror);
$this->writeGitConfig($config_file, $this->project_serializer->dumpPartialProjectRepoConf($project, $repositories), $git_modifications);
}