当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorProject::getID方法代码示例

本文整理汇总了PHP中PhabricatorProject::getID方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorProject::getID方法的具体用法?PHP PhabricatorProject::getID怎么用?PHP PhabricatorProject::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorProject的用法示例。


在下文中一共展示了PhabricatorProject::getID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: materializeProject

 private function materializeProject(PhabricatorProject $project)
 {
     if ($project->isMilestone()) {
         return;
     }
     $material_type = PhabricatorProjectMaterializedMemberEdgeType::EDGECONST;
     $member_type = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
     $project_phid = $project->getPHID();
     $descendants = id(new PhabricatorProjectQuery())->setViewer($this->getViewer())->withAncestorProjectPHIDs(array($project->getPHID()))->withIsMilestone(false)->withHasSubprojects(false)->execute();
     $descendant_phids = mpull($descendants, 'getPHID');
     if ($descendant_phids) {
         $source_phids = $descendant_phids;
         $has_subprojects = true;
     } else {
         $source_phids = array($project->getPHID());
         $has_subprojects = false;
     }
     $conn_w = $project->establishConnection('w');
     $any_milestone = queryfx_one($conn_w, 'SELECT id FROM %T
     WHERE parentProjectPHID = %s AND milestoneNumber IS NOT NULL
     LIMIT 1', $project->getTableName(), $project_phid);
     $has_milestones = (bool) $any_milestone;
     $project->openTransaction();
     // Delete any existing materialized member edges.
     queryfx($conn_w, 'DELETE FROM %T WHERE src = %s AND type = %s', PhabricatorEdgeConfig::TABLE_NAME_EDGE, $project_phid, $material_type);
     // Copy current member edges to create new materialized edges.
     queryfx($conn_w, 'INSERT IGNORE INTO %T (src, type, dst, dateCreated, seq)
       SELECT %s, %d, dst, dateCreated, seq FROM %T
       WHERE src IN (%Ls) AND type = %d', PhabricatorEdgeConfig::TABLE_NAME_EDGE, $project_phid, $material_type, PhabricatorEdgeConfig::TABLE_NAME_EDGE, $source_phids, $member_type);
     // Update the hasSubprojects flag.
     queryfx($conn_w, 'UPDATE %T SET hasSubprojects = %d WHERE id = %d', $project->getTableName(), (int) $has_subprojects, $project->getID());
     // Update the hasMilestones flag.
     queryfx($conn_w, 'UPDATE %T SET hasMilestones = %d WHERE id = %d', $project->getTableName(), (int) $has_milestones, $project->getID());
     $project->saveTransaction();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:35,代码来源:PhabricatorProjectsMembershipIndexEngineExtension.php

示例2: buildActionList

 private function buildActionList(PhabricatorProject $project, array $milestones, array $subprojects)
 {
     $viewer = $this->getViewer();
     $id = $project->getID();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $project, PhabricatorPolicyCapability::CAN_EDIT);
     $allows_milestones = $project->supportsMilestones();
     $allows_subprojects = $project->supportsSubprojects();
     $view = id(new PhabricatorActionListView())->setUser($viewer);
     if ($allows_milestones && $milestones) {
         $milestone_text = pht('Create Next Milestone');
     } else {
         $milestone_text = pht('Create Milestone');
     }
     $can_milestone = $can_edit && $allows_milestones;
     $milestone_href = "/project/edit/?milestone={$id}";
     $view->addAction(id(new PhabricatorActionView())->setName($milestone_text)->setIcon('fa-plus')->setHref($milestone_href)->setDisabled(!$can_milestone)->setWorkflow(!$can_milestone));
     $can_subproject = $can_edit && $allows_subprojects;
     // If we're offering to create the first subproject, we're going to warn
     // the user about the effects before moving forward.
     if ($can_subproject && !$subprojects) {
         $subproject_href = "/project/warning/{$id}/";
         $subproject_disabled = false;
         $subproject_workflow = true;
     } else {
         $subproject_href = "/project/edit/?parent={$id}";
         $subproject_disabled = !$can_subproject;
         $subproject_workflow = !$can_subproject;
     }
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Create Subproject'))->setIcon('fa-plus')->setHref($subproject_href)->setDisabled($subproject_disabled)->setWorkflow($subproject_workflow));
     return $view;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:31,代码来源:PhabricatorProjectSubprojectsController.php

示例3: buildLocalNavigation

 protected function buildLocalNavigation(PhabricatorProject $project)
 {
     $id = $project->getID();
     $nav_view = new AphrontSideNavFilterView();
     $uri = new PhutilURI('/project/view/' . $id . '/');
     $nav_view->setBaseURI($uri);
     $external_arrow = "↗";
     $tasks_uri = '/maniphest/view/all/?projects=' . $project->getPHID();
     $slug = PhabricatorSlug::normalize($project->getName());
     $phriction_uri = '/w/projects/' . $slug;
     $edit_uri = '/project/edit/' . $id . '/';
     $members_uri = '/project/members/' . $id . '/';
     $nav_view->addFilter('dashboard', 'Dashboard');
     $nav_view->addSpacer();
     $nav_view->addFilter('feed', 'Feed');
     $nav_view->addFilter(null, 'Tasks ' . $external_arrow, $tasks_uri);
     $nav_view->addFilter(null, 'Wiki ' . $external_arrow, $phriction_uri);
     $nav_view->addFilter('people', 'People');
     $nav_view->addFilter('about', 'About');
     $user = $this->getRequest()->getUser();
     $can_edit = PhabricatorPolicyCapability::CAN_EDIT;
     $nav_view->addSpacer();
     if (PhabricatorPolicyFilter::hasCapability($user, $project, $can_edit)) {
         $nav_view->addFilter('edit', "Edit Project…", $edit_uri);
         $nav_view->addFilter('members', "Edit Members…", $members_uri);
     } else {
         $nav_view->addFilter('edit', "Edit Project…", $edit_uri, $relative = false, 'disabled');
         $nav_view->addFilter('members', "Edit Members…", $members_uri, $relative = false, 'disabled');
     }
     return $nav_view;
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:31,代码来源:PhabricatorProjectController.php

示例4: buildIconNavView

 public function buildIconNavView(PhabricatorProject $project)
 {
     $id = $project->getID();
     $nav = parent::buildIconNavView($project);
     $nav->selectFilter("board/{$id}/");
     return $nav;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:7,代码来源:PhabricatorProjectBoardController.php

示例5: buildActionListView

 private function buildActionListView(PhabricatorProject $project)
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $id = $project->getID();
     $view = id(new PhabricatorActionListView())->setUser($viewer)->setObject($project)->setObjectURI($request->getRequestURI());
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $project, PhabricatorPolicyCapability::CAN_EDIT);
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Details'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("details/{$id}/"))->setDisabled(!$can_edit));
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Picture'))->setIcon('fa-picture-o')->setHref($this->getApplicationURI("picture/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     if ($project->isArchived()) {
         $view->addAction(id(new PhabricatorActionView())->setName(pht('Activate Project'))->setIcon('fa-check')->setHref($this->getApplicationURI("archive/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(true));
     } else {
         $view->addAction(id(new PhabricatorActionView())->setName(pht('Archive Project'))->setIcon('fa-ban')->setHref($this->getApplicationURI("archive/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(true));
     }
     $action = null;
     if (!$project->isUserMember($viewer->getPHID())) {
         $can_join = PhabricatorPolicyFilter::hasCapability($viewer, $project, PhabricatorPolicyCapability::CAN_JOIN);
         $action = id(new PhabricatorActionView())->setUser($viewer)->setRenderAsForm(true)->setHref('/project/update/' . $project->getID() . '/join/')->setIcon('fa-plus')->setDisabled(!$can_join)->setName(pht('Join Project'));
         $view->addAction($action);
     } else {
         $action = id(new PhabricatorActionView())->setWorkflow(true)->setHref('/project/update/' . $project->getID() . '/leave/')->setIcon('fa-times')->setName(pht('Leave Project...'));
         $view->addAction($action);
         if (!$project->isUserWatcher($viewer->getPHID())) {
             $action = id(new PhabricatorActionView())->setWorkflow(true)->setHref('/project/watch/' . $project->getID() . '/')->setIcon('fa-eye')->setName(pht('Watch Project'));
             $view->addAction($action);
         } else {
             $action = id(new PhabricatorActionView())->setWorkflow(true)->setHref('/project/unwatch/' . $project->getID() . '/')->setIcon('fa-eye-slash')->setName(pht('Unwatch Project'));
             $view->addAction($action);
         }
     }
     return $view;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:32,代码来源:PhabricatorProjectProfileController.php

示例6: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $project = new PhabricatorProject();
     $project->setAuthorPHID($user->getPHID());
     $profile = new PhabricatorProjectProfile();
     $e_name = true;
     $errors = array();
     if ($request->isFormPost()) {
         try {
             $editor = new PhabricatorProjectEditor($project);
             $editor->setUser($user);
             $editor->setName($request->getStr('name'));
             $editor->save();
         } catch (PhabricatorProjectNameCollisionException $ex) {
             $e_name = 'Not Unique';
             $errors[] = $ex->getMessage();
         }
         $project->setStatus(PhabricatorProjectStatus::ONGOING);
         $profile->setBlurb($request->getStr('blurb'));
         if (!$errors) {
             $project->save();
             $profile->setProjectPHID($project->getPHID());
             $profile->save();
             id(new PhabricatorProjectAffiliation())->setUserPHID($user->getPHID())->setProjectPHID($project->getPHID())->setRole('Owner')->setIsOwner(true)->save();
             if ($request->isAjax()) {
                 return id(new AphrontAjaxResponse())->setContent(array('phid' => $project->getPHID(), 'name' => $project->getName()));
             } else {
                 return id(new AphrontRedirectResponse())->setURI('/project/view/' . $project->getID() . '/');
             }
         }
     }
     $error_view = null;
     if ($errors) {
         $error_view = new AphrontErrorView();
         $error_view->setTitle('Form Errors');
         $error_view->setErrors($errors);
     }
     if ($request->isAjax()) {
         $form = new AphrontFormLayoutView();
     } else {
         $form = new AphrontFormView();
         $form->setUser($user);
     }
     $form->appendChild(id(new AphrontFormTextControl())->setLabel('Name')->setName('name')->setValue($project->getName())->setError($e_name))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Blurb')->setName('blurb')->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT)->setValue($profile->getBlurb()));
     if ($request->isAjax()) {
         if ($error_view) {
             $error_view->setWidth(AphrontErrorView::WIDTH_DIALOG);
         }
         $dialog = id(new AphrontDialogView())->setUser($user)->setWidth(AphrontDialogView::WIDTH_FORM)->setTitle('Create a New Project')->appendChild($error_view)->appendChild($form)->addSubmitButton('Create Project')->addCancelButton('/project/');
         return id(new AphrontDialogResponse())->setDialog($dialog);
     } else {
         $form->appendChild(id(new AphrontFormSubmitControl())->setValue('Create')->addCancelButton('/project/'));
         $panel = new AphrontPanelView();
         $panel->setWidth(AphrontPanelView::WIDTH_FORM)->setHeader('Create a New Project')->appendChild($form);
         return $this->buildStandardPageResponse(array($error_view, $panel), array('title' => 'Create new Project'));
     }
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:59,代码来源:PhabricatorProjectCreateController.php

示例7: renderMemberList

 private function renderMemberList(PhabricatorProject $project, array $handles)
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $list = id(new PHUIObjectItemListView())->setNoDataString(pht('This project does not have any members.'));
     foreach ($handles as $handle) {
         $remove_uri = $this->getApplicationURI('/members/' . $project->getID() . '/remove/?phid=' . $handle->getPHID());
         $item = id(new PHUIObjectItemView())->setHeader($handle->getFullName())->setHref($handle->getURI())->setImageURI($handle->getImageURI());
         $item->addAction(id(new PHUIListItemView())->setIcon('fa-times')->setName(pht('Remove'))->setHref($remove_uri)->setWorkflow(true));
         $list->addItem($item);
     }
     return $list;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:13,代码来源:PhabricatorProjectMembersEditController.php

示例8: validateName

 private function validateName(PhabricatorProject $project)
 {
     $slug = $project->getPhrictionSlug();
     $name = $project->getName();
     if ($slug == '/') {
         throw new PhabricatorProjectNameCollisionException("Project names must be unique and contain some letters or numbers.");
     }
     $id = $project->getID();
     $collision = id(new PhabricatorProject())->loadOneWhere('(name = %s OR phrictionSlug = %s) AND id %Q %nd', $name, $slug, $id ? '!=' : 'IS NOT', $id ? $id : null);
     if ($collision) {
         $other_name = $collision->getName();
         $other_id = $collision->getID();
         throw new PhabricatorProjectNameCollisionException("Project names must be unique. The name '{$name}' is too similar to " . "the name of another project, '{$other_name}' (Project ID: " . "{$other_id}). Choose a unique name.");
     }
 }
开发者ID:netcomtec,项目名称:phabricator,代码行数:15,代码来源:PhabricatorProjectEditor.php

示例9: buildCurtain

 private function buildCurtain(PhabricatorProject $project)
 {
     $viewer = $this->getViewer();
     $id = $project->getID();
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $project, PhabricatorPolicyCapability::CAN_EDIT);
     $curtain = $this->newCurtainView($project);
     $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Edit Details'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("edit/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Edit Menu'))->setIcon('fa-th-list')->setHref($this->getApplicationURI("{$id}/panel/configure/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Edit Picture'))->setIcon('fa-picture-o')->setHref($this->getApplicationURI("picture/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     if ($project->isArchived()) {
         $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Activate Project'))->setIcon('fa-check')->setHref($this->getApplicationURI("archive/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(true));
     } else {
         $curtain->addAction(id(new PhabricatorActionView())->setName(pht('Archive Project'))->setIcon('fa-ban')->setHref($this->getApplicationURI("archive/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(true));
     }
     return $curtain;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:16,代码来源:PhabricatorProjectManageController.php

示例10: buildColumnsList

 private function buildColumnsList(PhabricatorProject $board, array $columns)
 {
     assert_instances_of($columns, 'PhabricatorProjectColumn');
     $board_id = $board->getID();
     $view = id(new PHUIObjectItemListView())->setNoDataString(pht('This board has no columns.'));
     foreach ($columns as $column) {
         $column_id = $column->getID();
         $detail_uri = "/project/board/{$board_id}/column/{$column_id}/";
         $item = id(new PHUIObjectItemView())->setHeader($column->getDisplayName())->setHref($detail_uri);
         if ($column->isHidden()) {
             $item->setDisabled(true);
         }
         $view->addItem($item);
     }
     return id(new PHUIObjectBoxView())->setHeaderText(pht('Columns'))->setObjectList($view);
 }
开发者ID:psyclone241,项目名称:phabricator,代码行数:16,代码来源:PhabricatorProjectBoardManageController.php

示例11: buildActionListView

 private function buildActionListView(PhabricatorProject $project)
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $id = $project->getID();
     $view = id(new PhabricatorActionListView())->setUser($viewer)->setObjectURI($request->getRequestURI());
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $project, PhabricatorPolicyCapability::CAN_EDIT);
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Details'))->setIcon('fa-pencil')->setHref($this->getApplicationURI("details/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $view->addAction(id(new PhabricatorActionView())->setName(pht('Edit Picture'))->setIcon('fa-picture-o')->setHref($this->getApplicationURI("picture/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     if ($project->isArchived()) {
         $view->addAction(id(new PhabricatorActionView())->setName(pht('Unarchive Project'))->setIcon('fa-check')->setHref($this->getApplicationURI("archive/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(true));
     } else {
         $view->addAction(id(new PhabricatorActionView())->setName(pht('Archive Project'))->setIcon('fa-ban')->setHref($this->getApplicationURI("archive/{$id}/"))->setDisabled(!$can_edit)->setWorkflow(true));
     }
     return $view;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:16,代码来源:PhabricatorProjectEditMainController.php

示例12: renderWatchAction

 private function renderWatchAction(PhabricatorProject $project)
 {
     $viewer = $this->getViewer();
     $viewer_phid = $viewer->getPHID();
     $id = $project->getID();
     $is_watcher = $viewer_phid && $project->isUserWatcher($viewer_phid);
     if (!$is_watcher) {
         $watch_icon = 'fa-eye';
         $watch_text = pht('Watch Project');
         $watch_href = "/project/watch/{$id}/?via=profile";
     } else {
         $watch_icon = 'fa-eye-slash';
         $watch_text = pht('Unwatch Project');
         $watch_href = "/project/unwatch/{$id}/?via=profile";
     }
     $watch_icon = id(new PHUIIconView())->setIcon($watch_icon);
     return id(new PHUIButtonView())->setTag('a')->setWorkflow(true)->setIcon($watch_icon)->setText($watch_text)->setHref($watch_href);
 }
开发者ID:fairyeye,项目名称:phabricator,代码行数:18,代码来源:PhabricatorProjectProfileController.php

示例13: noAccessDialog

 private function noAccessDialog(PhabricatorProject $project)
 {
     $instructions = pht('This workboard has not been setup yet.');
     $dialog = id(new AphrontDialogView())->setUser($this->getRequest()->getUser())->setTitle(pht('No Workboard'))->addCancelButton($this->getApplicationURI('view/' . $project->getID() . '/'))->appendParagraph($instructions);
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:6,代码来源:PhabricatorProjectBoardViewController.php

示例14: initializeWorkboardDialog

 private function initializeWorkboardDialog(PhabricatorProject $project)
 {
     $instructions = pht('This workboard has not been setup yet.');
     $new_selector = id(new AphrontFormRadioButtonControl())->setName('initialize-type')->setValue('backlog-only')->addButton('backlog-only', pht('New Empty Board'), pht('Create a new board with just a backlog column.'))->addButton('import', pht('Import Columns'), pht('Import board columns from another project.'));
     $dialog = id(new AphrontDialogView())->setUser($this->getRequest()->getUser())->setTitle(pht('New Workboard'))->addSubmitButton('Continue')->addCancelButton($this->getApplicationURI('view/' . $project->getID() . '/'))->appendParagraph($instructions)->appendChild($new_selector);
     return id(new AphrontDialogResponse())->setDialog($dialog);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:PhabricatorProjectBoardViewController.php

示例15: buildSubprojectList

 private function buildSubprojectList(PhabricatorProject $project)
 {
     if (!$project->getHasSubprojects()) {
         return null;
     }
     $viewer = $this->getViewer();
     $id = $project->getID();
     $limit = 25;
     $subprojects = id(new PhabricatorProjectQuery())->setViewer($viewer)->withParentProjectPHIDs(array($project->getPHID()))->needImages(true)->withStatuses(array(PhabricatorProjectStatus::STATUS_ACTIVE))->withIsMilestone(false)->setLimit($limit)->execute();
     if (!$subprojects) {
         return null;
     }
     $subproject_list = id(new PhabricatorProjectListView())->setUser($viewer)->setProjects($subprojects)->renderList();
     $view_all = id(new PHUIButtonView())->setTag('a')->setIcon(id(new PHUIIconView())->setIcon('fa-list-ul'))->setText(pht('View All'))->setHref("/project/subprojects/{$id}/");
     $header = id(new PHUIHeaderView())->setHeader(pht('Subprojects'))->addActionLink($view_all);
     return id(new PHUIObjectBoxView())->setHeader($header)->setBackground(PHUIBoxView::GREY)->setObjectList($subproject_list);
 }
开发者ID:psyclone241,项目名称:phabricator,代码行数:17,代码来源:PhabricatorProjectProfileController.php


注:本文中的PhabricatorProject::getID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。