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


PHP Companies::getCompaniesWithUsers方法代码示例

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


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

示例1: new_list_tasks


//.........这里部分代码省略.........
         case 2:
             // All tasks
             break;
         default:
             throw new Exception('Task status "' . $status . '" not recognised');
     }
     if (!$tag) {
         $tagstr = "";
     } else {
         $tagstr = " AND (select count(*) from " . TABLE_PREFIX . "tags where " . TABLE_PREFIX . "project_tasks.id = " . TABLE_PREFIX . "tags.rel_object_id and " . TABLE_PREFIX . "tags.tag = " . DB::escape($tag) . " and " . TABLE_PREFIX . "tags.rel_object_manager ='ProjectTasks' ) > 0 ";
     }
     $conditions = $template_condition . $task_filter_condition . $task_status_condition . $permissions . $tagstr . $projectstr . " AND `trashed_by_id` = 0 AND `archived_by_id` = 0";
     //Now get the tasks
     $tasks = ProjectTasks::findAll(array('conditions' => $conditions, 'order' => 'created_on DESC', 'limit' => user_config_option('task_display_limit') > 0 ? user_config_option('task_display_limit') + 1 : null));
     ProjectTasks::populateData($tasks);
     //Find all internal milestones for these tasks
     $internalMilestones = ProjectMilestones::getProjectMilestones(active_or_personal_project(), null, 'DESC', "", null, null, null, $status == 0, false);
     ProjectMilestones::populateData($internalMilestones);
     //Find all external milestones for these tasks
     $milestone_ids = array();
     if ($tasks) {
         foreach ($tasks as $task) {
             if ($task->getMilestoneId() != 0) {
                 $milestone_ids[$task->getMilestoneId()] = $task->getMilestoneId();
             }
         }
     }
     $milestone_ids_condition = '';
     if (count($milestone_ids) > 0) {
         $milestone_ids_condition = ' OR id in (' . implode(',', $milestone_ids) . ')';
     }
     if ($status == 0) {
         $pendingstr = " AND `completed_on` = " . DB::escape(EMPTY_DATETIME) . " ";
     } else {
         $pendingstr = "";
     }
     if (!$tag) {
         $tagstr = "";
     } else {
         $tagstr = " AND (select count(*) from " . TABLE_PREFIX . "tags where " . TABLE_PREFIX . "project_milestones.id = " . TABLE_PREFIX . "tags.rel_object_id and " . TABLE_PREFIX . "tags.tag = " . DB::escape($tag) . " and " . TABLE_PREFIX . "tags.rel_object_manager ='ProjectMilestones' ) > 0 ";
     }
     $projectstr = " AND (" . ProjectMilestones::getWorkspaceString($pids) . $milestone_ids_condition . ")";
     $archivedstr = " AND `archived_by_id` = 0 ";
     $milestone_conditions = " `is_template` = false " . $archivedstr . $projectstr . $pendingstr;
     $externalMilestonesTemp = ProjectMilestones::findAll(array('conditions' => $milestone_conditions));
     $externalMilestones = array();
     if ($externalMilestonesTemp) {
         foreach ($externalMilestonesTemp as $em) {
             $found = false;
             if ($internalMilestones) {
                 foreach ($internalMilestones as $im) {
                     if ($im->getId() == $em->getId()) {
                         $found = true;
                         break;
                     }
                 }
             }
             if (!$found) {
                 $externalMilestones[] = $em;
             }
         }
     }
     ProjectMilestones::populateData($externalMilestones);
     //Get Users Info
     if (logged_user()->isMemberOfOwnerCompany()) {
         $users = Users::getAll();
         $allUsers = array();
     } else {
         $users = logged_user()->getAssignableUsers();
         $allUsers = Users::getAll();
     }
     //Get Companies Info
     if (logged_user()->isMemberOfOwnerCompany()) {
         $companies = Companies::getCompaniesWithUsers();
     } else {
         $companies = logged_user()->getAssignableCompanies();
     }
     if (!$isJson) {
         if (active_project() instanceof Project) {
             $task_templates = WorkspaceTemplates::getTemplatesByWorkspace(active_project()->getId());
         } else {
             $task_templates = array();
         }
         tpl_assign('project_templates', $task_templates);
         tpl_assign('all_templates', COTemplates::findAll());
         if (user_config_option('task_display_limit') > 0 && count($tasks) > user_config_option('task_display_limit')) {
             tpl_assign('displayTooManyTasks', true);
             array_pop($tasks);
         }
         tpl_assign('tasks', $tasks);
         tpl_assign('object_subtypes', ProjectCoTypes::getObjectTypesByManager('ProjectTasks'));
         tpl_assign('internalMilestones', $internalMilestones);
         tpl_assign('externalMilestones', $externalMilestones);
         tpl_assign('users', $users);
         tpl_assign('allUsers', $allUsers);
         tpl_assign('companies', $companies);
         tpl_assign('userPreferences', array('filterValue' => isset($filter_value) ? $filter_value : '', 'filter' => $filter, 'status' => $status, 'showWorkspaces' => user_config_option('tasksShowWorkspaces', 1), 'showTime' => user_config_option('tasksShowTime', 0), 'showDates' => user_config_option('tasksShowDates', 0), 'showTags' => user_config_option('tasksShowTags', 0), 'showEmptyMilestones' => user_config_option('tasksShowEmptyMilestones', 0), 'groupBy' => user_config_option('tasksGroupBy', 'milestone'), 'orderBy' => user_config_option('tasksOrderBy', 'priority'), 'defaultNotifyValue' => user_config_option('can notify from quick add')));
         ajx_set_no_toolbar(true);
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:TaskController.class.php

示例2: index

 function index()
 {
     if (!can_manage_time(logged_user(), true)) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $tasksUserId = array_var($_GET, 'tu');
     if (is_null($tasksUserId)) {
         $tasksUserId = user_config_option('TM tasks user filter', logged_user()->getId());
     } else {
         if (user_config_option('TM tasks user filter') != $tasksUserId) {
             set_user_config_option('TM tasks user filter', $tasksUserId, logged_user()->getId());
         }
     }
     $timeslotsUserId = array_var($_GET, 'tsu');
     if (is_null($timeslotsUserId)) {
         $timeslotsUserId = user_config_option('TM user filter', 0);
     } else {
         if (user_config_option('TM user filter') != $timeslotsUserId) {
             set_user_config_option('TM user filter', $timeslotsUserId, logged_user()->getId());
         }
     }
     $showTimeType = array_var($_GET, 'stt');
     if (is_null($showTimeType)) {
         $showTimeType = user_config_option('TM show time type', 0);
     } else {
         if (user_config_option('TM show time type') != $showTimeType) {
             set_user_config_option('TM show time type', $showTimeType, logged_user()->getId());
         }
     }
     $start = array_var($_GET, 'start', 0);
     $limit = 20;
     $tasksUser = Users::findById($tasksUserId);
     $timeslotsUser = Users::findById($timeslotsUserId);
     //Active tasks view
     $tasks = ProjectTasks::getOpenTimeslotTasks($tasksUser, logged_user());
     ProjectTasks::populateData($tasks);
     $tasks_array = array();
     //Timeslots view
     $total = 0;
     switch ($showTimeType) {
         case 0:
             //Show only timeslots added through the time panel
             $timeslots = Timeslots::getProjectTimeslots(logged_user()->getWorkspacesQuery(), $timeslotsUser, active_project(), $start, $limit);
             $total = Timeslots::countProjectTimeslots(logged_user()->getWorkspacesQuery(), $timeslotsUser, active_project());
             break;
         case 1:
             //Show only timeslots added through the tasks panel / tasks
             throw new Error('not yet implemented' . $showTimeType);
             /*if (active_project() instanceof Project){
             			$workspacesCSV = active_project()->getAllSubWorkspacesQuery(false,logged_user());
             		} else {
             			$workspacesCSV = logged_user()->getWorkspacesQuery();
             		}
             		$taskTimeslots = Timeslots::getTaskTimeslots(null, $timeslotsUser, $workspacesCSV, null , null, null, null,0,20);*/
             //break;
         /*if (active_project() instanceof Project){
         			$workspacesCSV = active_project()->getAllSubWorkspacesQuery(false,logged_user());
         		} else {
         			$workspacesCSV = logged_user()->getWorkspacesQuery();
         		}
         		$taskTimeslots = Timeslots::getTaskTimeslots(null, $timeslotsUser, $workspacesCSV, null , null, null, null,0,20);*/
         //break;
         case 2:
             //Show timeslots added through both the time and tasks panel / tasks
             throw new Error('not yet implemented' . $showTimeType);
             //break;
         //break;
         default:
             throw new Error('Unrecognised TM show time type: ' . $showTimeType);
     }
     //Get Users Info
     if (logged_user()->isMemberOfOwnerCompany()) {
         $users = Users::getAll();
     } else {
         $users = logged_user()->getCompany()->getUsers();
     }
     //Get Companies Info
     if (logged_user()->isMemberOfOwnerCompany()) {
         $companies = Companies::getCompaniesWithUsers();
     } else {
         $companies = array(logged_user()->getCompany());
     }
     tpl_assign('timeslots', $timeslots);
     tpl_assign('tasks', $tasks);
     tpl_assign('users', $users);
     tpl_assign('start', $start);
     tpl_assign('limit', $limit);
     tpl_assign('total', $total);
     tpl_assign('companies', $companies);
     ajx_set_no_toolbar(true);
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:93,代码来源:TimeController.class.php

示例3: getGroupedByCompany

 /**
  * Return users grouped by company
  *
  * @param void
  * @return array
  */
 static function getGroupedByCompany()
 {
     $companies = Companies::getCompaniesWithUsers();
     if (!is_array($companies) || !count($companies)) {
         return null;
     }
     // if
     $result = array();
     foreach ($companies as $company) {
         $users = $company->getUsers();
         if (is_array($users) && count($users)) {
             $result[$company->getName()] = array('details' => $company, 'users' => $users);
             // array
         }
         // if
     }
     // foreach
     return count($result) ? $result : null;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:25,代码来源:Users.class.php

示例4: setViewVariables

 function setViewVariables($view_type, $user_filter, $status_filter)
 {
     //Get Users Info
     if (logged_user()->isMemberOfOwnerCompany()) {
         $users = Users::getAll();
     } else {
         $users = logged_user()->getCompany()->getUsers();
     }
     //Get Companies Info
     if (logged_user()->isMemberOfOwnerCompany()) {
         $companies = Companies::getCompaniesWithUsers();
     } else {
         $companies = array(logged_user()->getCompany());
     }
     $usr = Users::findById($user_filter);
     $user_filter_comp = $usr != null ? $usr->getCompanyId() : 0;
     tpl_assign('users', $users);
     tpl_assign('companies', $companies);
     tpl_assign('userPreferences', array('view_type' => $view_type, 'user_filter' => $user_filter, 'status_filter' => $status_filter, 'user_filter_comp' => $user_filter_comp));
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:20,代码来源:EventController.class.php

示例5: getAssignableCompanies

 function getAssignableCompanies($project = null)
 {
     if ($this->isMemberOfOwnerCompany()) {
         return Companies::getCompaniesWithUsers();
     }
     TimeIt::start('get assignable companies');
     if ($project instanceof Project) {
         $ws = $project->getAllSubWorkspacesQuery(true);
     }
     $uid = $this->getId();
     $cid = $this->getCompany()->getId();
     $tp = TABLE_PREFIX;
     $gids = "SELECT `group_id` FROM `{$tp}group_users` WHERE `user_id` = {$uid}";
     $q1 = "SELECT `project_id` FROM `{$tp}project_users` WHERE (`user_id` = {$uid} OR `user_id` IN ({$gids})) AND `can_assign_to_other` = '1'";
     $q2 = "SELECT `project_id` FROM `{$tp}project_users` WHERE (`user_id` = {$uid} OR `user_id` IN ({$gids})) AND `can_assign_to_owners` = '1'";
     if (isset($ws)) {
         $q1 .= " AND `project_id` IN ({$ws})";
         $q2 .= " AND `project_id` IN ({$ws})";
     }
     $query1 = "SELECT `user_id` FROM `{$tp}project_users` WHERE `project_id` IN ({$q1})";
     $query2 = "SELECT `user_id` FROM `{$tp}project_users` WHERE `project_id` IN ({$q2})";
     $query = "SELECT `company_id` FROM `{$tp}users` WHERE `id` IN ({$query1}) AND `company_id` <> 1 AND `company_id` <> {$cid} OR `id` IN ({$query2}) AND `company_id` = 1";
     // get companies for assignable users (see getAssignableUsers)
     $companies = Companies::findAll(array('conditions' => "`id` = {$cid} OR `id` IN ({$query})"));
     TimeIt::stop();
     return $companies;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:27,代码来源:User.class.php


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