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


PHP PFUser::getProjects方法代码示例

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


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

示例1: getDynamicUgroupsForUser

 /**
  * @param PFUser $user
  * @return ProjectUGroup[]
  */
 private function getDynamicUgroupsForUser(PFUser $user)
 {
     $project_ids = $user->getProjects();
     $ugroups = array();
     foreach ($project_ids as $group_id) {
         $ugroups[] = new ProjectUGroup(array('ugroup_id' => ProjectUGroup::PROJECT_MEMBERS, 'group_id' => $group_id));
         if ($user->isAdmin($group_id)) {
             $ugroups[] = new ProjectUGroup(array('ugroup_id' => ProjectUGroup::PROJECT_ADMIN, 'group_id' => $group_id));
         }
     }
     return $ugroups;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:16,代码来源:MembershipManager.class.php

示例2: appendDynamicUGroups

 /**
  * Append project dynamic ugroups of user
  *
  * @param PFUser  $user
  * @param array $user_ugroups
  *
  * @return array the new array of user's ugroup
  */
 private function appendDynamicUGroups(PFUser $user, array $user_ugroups = array())
 {
     $user_projects = $user->getProjects(true);
     foreach ($user_projects as $user_project) {
         $project_name = strtolower($user_project['unix_group_name']);
         $group_id = $user_project['group_id'];
         $user_ugroups[] = $this->ugroupIdToStringWithoutArobase(ProjectUGroup::PROJECT_MEMBERS, $project_name);
         if ($user->isMember($group_id, 'A')) {
             $user_ugroups[] = $this->ugroupIdToStringWithoutArobase(ProjectUGroup::PROJECT_ADMIN, $project_name);
         }
     }
     return $user_ugroups;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:21,代码来源:UGroupLiteralizer.class.php

示例3: 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;
 }
开发者ID:blestab,项目名称:tuleap,代码行数:52,代码来源:TrackerManager.class.php

示例4: getUserProjectList

 /**
  * Generates project list of the given user
  *
  * @param PFUser $user
  *
  * @return Array
  */
 function getUserProjectList($user)
 {
     $res = $user->getProjects();
     $projects = array();
     foreach ($res as $groupId) {
         if ($this->isWebDAVAllowedForProject($groupId)) {
             $project = $this->getWebDAVProject($groupId);
             if ($project->userCanRead()) {
                 $projects[] = $project;
             }
         }
     }
     return $projects;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:21,代码来源:WebDAVRoot.class.php

示例5: updateCVSWritersForGivenMember

 /**
  * Update CVS writers into all projects that given user belongs to
  *
  * @param PFUser $user member to add as committer
  *
  * @return Boolean
  */
 public function updateCVSWritersForGivenMember($user)
 {
     $projects = $user->getProjects();
     if (isset($projects)) {
         $pm = $this->getProjectManager();
         foreach ($projects as $groupId) {
             $project = $pm->getProject($groupId);
             if ($this->repositoryExists($project)) {
                 if (!$this->updateCVSwriters($groupId)) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:rinodung,项目名称:tuleap,代码行数:23,代码来源:BackendCVS.class.php


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