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


PHP Users::hasAccess方法代码示例

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


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

示例1: executeGoto

 public function executeGoto(sfWebRequest $request)
 {
     $q = Doctrine_Core::getTable('Discussions')->createQuery('d')->leftJoin('d.DiscussionsStatus ds')->leftJoin('d.Projects p')->leftJoin('d.Users');
     $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
     if (Users::hasAccess('view_own', 'discussions', $this->getUser(), $request->getParameter('projects_id'))) {
         $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',d.assigned_to) or d.users_id='" . $this->getUser()->getAttribute('id') . "'");
     }
     $q = Discussions::addFiltersToQuery($q, $this->getUser()->getAttribute('discussions_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
     $q = app::addListingOrder($q, 'discussions', $this->getUser(), (int) $request->getParameter('projects_id'));
     $this->menu = array();
     $ids = array();
     foreach ($q->fetchArray() as $v) {
         if (strlen($sn = app::getArrayName($v, 'DiscussionsStatus')) > 0) {
             $sn = $sn . ': ';
         } else {
             $sn = '';
         }
         if ($request->getParameter('discussions_id') == $v['id']) {
             $v['name'] = '<b>' . $v['name'] . '</b>';
         }
         $this->menu[] = array('title' => $sn . $v['name'], 'url' => 'discussionsComments/index?projects_id=' . $request->getParameter('projects_id') . '&discussions_id=' . $v['id']);
         $ids[] = $v['id'];
     }
     $current_key = array_search($request->getParameter('discussions_id'), $ids);
     $this->previous_item_id = false;
     $this->next_item_id = false;
     if (isset($ids[$current_key - 1])) {
         $this->previous_item_id = $ids[$current_key - 1];
     }
     if (isset($ids[$current_key + 1])) {
         $this->next_item_id = $ids[$current_key + 1];
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:33,代码来源:components.class.php

示例2: executeGoto

 public function executeGoto(sfWebRequest $request)
 {
     $q = Doctrine_Core::getTable('Tasks')->createQuery('t')->leftJoin('t.TasksPriority tp')->leftJoin('t.TasksStatus ts')->leftJoin('t.TasksLabels tl')->leftJoin('t.TasksTypes tt')->leftJoin('t.TasksGroups tg')->leftJoin('t.ProjectsPhases pp')->leftJoin('t.Versions v')->leftJoin('t.Projects p')->leftJoin('t.Users');
     $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
     if (Users::hasAccess('view_own', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
         $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
     }
     $q = Tasks::addFiltersToQuery($q, $this->getUser()->getAttribute('tasks_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
     $q = app::addListingOrder($q, 'tasks', $this->getUser(), (int) $request->getParameter('projects_id'));
     $this->menu = array();
     $tasks_ids = array();
     foreach ($q->fetchArray() as $tasks) {
         if (strlen($sn = app::getArrayName($tasks, 'TasksStatus')) > 0) {
             $sn = $sn . ': ';
         } else {
             $sn = '';
         }
         if ($request->getParameter('tasks_id') == $tasks['id']) {
             $tasks['name'] = '<b>' . $tasks['name'] . '</b>';
         }
         $this->menu[] = array('title' => $sn . $tasks['name'], 'url' => 'tasksComments/index?projects_id=' . $request->getParameter('projects_id') . '&tasks_id=' . $tasks['id']);
         $tasks_ids[] = $tasks['id'];
     }
     $current_key = array_search($request->getParameter('tasks_id'), $tasks_ids);
     $this->previous_tasks_id = false;
     $this->next_tasks_id = false;
     if (isset($tasks_ids[$current_key - 1])) {
         $this->previous_tasks_id = $tasks_ids[$current_key - 1];
     }
     if (isset($tasks_ids[$current_key + 1])) {
         $this->next_tasks_id = $tasks_ids[$current_key + 1];
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:33,代码来源:components.class.php

示例3: executeGoto

 public function executeGoto(sfWebRequest $request)
 {
     $q = Doctrine_Core::getTable('Tickets')->createQuery('t')->leftJoin('t.TicketsStatus ts')->leftJoin('t.TicketsTypes tt')->leftJoin('t.Departments td')->leftJoin('t.Projects p')->leftJoin('t.Users');
     $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
     if (Users::hasAccess('view_own', 'tickets', $this->getUser(), $request->getParameter('projects_id'))) {
         $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
     }
     $q = Tickets::addFiltersToQuery($q, $this->getUser()->getAttribute('tickets_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
     $q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
     $this->menu = array();
     $ids = array();
     foreach ($q->fetchArray() as $v) {
         if (strlen($sn = app::getArrayName($v, 'TicketsStatus')) > 0) {
             $sn = $sn . ': ';
         } else {
             $sn = '';
         }
         if ($request->getParameter('tickets_id') == $v['id']) {
             $v['name'] = '<b>' . $v['name'] . '</b>';
         }
         $this->menu[] = array('title' => $sn . $v['name'], 'url' => 'ticketsComments/index?projects_id=' . $request->getParameter('projects_id') . '&tickets_id=' . $v['id']);
         $ids[] = $v['id'];
     }
     $current_key = array_search($request->getParameter('tickets_id'), $ids);
     $this->previous_item_id = false;
     $this->next_item_id = false;
     if (isset($ids[$current_key - 1])) {
         $this->previous_item_id = $ids[$current_key - 1];
     }
     if (isset($ids[$current_key + 1])) {
         $this->next_item_id = $ids[$current_key + 1];
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:33,代码来源:components.class.php

示例4: buildProjectsMenu

 public function buildProjectsMenu()
 {
     $s = array();
     $reports = Doctrine_Core::getTable('ProjectsReports')->createQuery()->addWhere('(users_id="' . $this->sf_user->getAttribute('id') . '")')->addWhere('display_in_menu=1')->orderBy('sort_order, name')->execute();
     $is_hr = false;
     foreach ($reports as $r) {
         $is_hr = true;
         $q = Doctrine_Core::getTable('Projects')->createQuery('p')->leftJoin('p.ProjectsStatus ps')->leftJoin('p.ProjectsTypes pt')->leftJoin('p.Users');
         $q = ProjectsReports::addFiltersToQuery($q, $r->getId(), $this->sf_user);
         if (Users::hasAccess('view_own', 'projects', $this->sf_user)) {
             $q->addWhere("find_in_set('" . $this->sf_user->getAttribute('id') . "',p.team) or p.created_by='" . $this->sf_user->getAttribute('id') . "'");
         }
         $pm = array();
         foreach ($q->fetchArray() as $p) {
             $pm[] = array('title' => $p['name'], 'url' => 'projects/open?projects_id=' . $p['id']);
         }
         $s[] = array('title' => $r->getName(), 'url' => 'projectsReports/view?id=' . $r->getId(), 'submenu' => $pm);
     }
     if ($this->access['projects']['insert']) {
         $s[] = array('title' => __('Add Project'), 'url' => 'projects/new', 'modalbox' => true, 'is_hr' => $is_hr);
         $is_hr = false;
     }
     $s[] = array('title' => __('View All'), 'url' => 'projects/index', 'is_hr' => $is_hr);
     return array('title' => __('Projects'), 'url' => 'projects/index', 'submenu' => $s);
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:25,代码来源:menuController.php

示例5: checkViewOwnAccess

 function checkViewOwnAccess($comments, $projects)
 {
     if (Users::hasAccess('view_own', 'projectsComments', $this->getUser(), $projects->getId())) {
         if ($comments->getCreatedBy() != $this->getUser()->getAttribute('id')) {
             $this->redirect('accessForbidden/index');
         }
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:8,代码来源:actions.class.php

示例6: checkViewOwnAccess

 public static function checkViewOwnAccess($c, $sf_user, $discussions, $project)
 {
     if (Users::hasAccess('view_own', 'discussions', $sf_user, $project->getId())) {
         if (!in_array($sf_user->getAttribute('id'), explode(',', $discussions->getAssignedTo())) and $discussions->getUsersId() != $sf_user->getAttribute('id')) {
             $c->redirect('accessForbidden/index');
         }
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:8,代码来源:Discussions.class.php

示例7: checkViewOwnAccess

 public static function checkViewOwnAccess($c, $sf_user, $project)
 {
     if (Users::hasAccess('view_own', 'projects', $sf_user)) {
         if (!in_array($sf_user->getAttribute('id'), explode(',', $project->getTeam())) and $project->getCreatedBy() != $sf_user->getAttribute('id')) {
             $c->redirect('accessForbidden/index');
         }
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:8,代码来源:Projects.class.php

示例8: executeListing

 public function executeListing(sfWebRequest $request)
 {
     if (!isset($this->reports_id)) {
         $this->reports_id = false;
     }
     $q = Doctrine_Core::getTable('Tasks')->createQuery('t')->leftJoin('t.TasksPriority tp')->leftJoin('t.TasksStatus ts')->leftJoin('t.TasksLabels tl')->leftJoin('t.TasksTypes tt')->leftJoin('t.TasksGroups tg')->leftJoin('t.ProjectsPhases pp')->leftJoin('t.Versions v')->leftJoin('t.Projects p')->leftJoin('t.Users');
     if ($request->hasParameter('projects_id')) {
         $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
         if (Users::hasAccess('view_own', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
     } else {
         if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
         if (Users::hasAccess('view_own', 'tasks', $this->getUser())) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
     }
     if ($this->reports_id > 0) {
         $q = UserReports::addFiltersToQuery($q, $this->reports_id, $this->getUser()->getAttribute('id'));
     } elseif ($request->hasParameter('search')) {
         $q = app::addSearchQuery($q, $request->getParameter('search'), 'TasksComments', 't', $request->getParameter('search_by_extrafields'));
         $q = app::addListingOrder($q, 'tasks', $this->getUser());
     } else {
         $q = Tasks::addFiltersToQuery($q, $this->getUser()->getAttribute('tasks_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
         $q = app::addListingOrder($q, 'tasks', $this->getUser(), (int) $request->getParameter('projects_id'));
     }
     $this->pager = false;
     if (sfConfig::get('app_rows_limit') > 0) {
         $this->pager = new sfDoctrinePager('Tasks', sfConfig::get('app_rows_limit'));
         $this->pager->setQuery($q);
         $this->pager->setPage($request->getParameter('page', 1));
         $this->pager->init();
     }
     $this->tasks_list = $q->fetchArray();
     if (isset($this->is_dashboard)) {
         $this->url_params = 'redirect_to=dashboard';
         $this->display_insert_button = true;
     } elseif ($this->reports_id > 0) {
         $this->url_params = 'redirect_to=userReports' . $this->reports_id;
         $this->display_insert_button = true;
     } else {
         $this->url_params = 'redirect_to=tasksList';
         if ($request->hasParameter('projects_id')) {
             $this->url_params = 'projects_id=' . $request->getParameter('projects_id');
         }
         $this->display_insert_button = true;
     }
     $this->tlId = rand(1111111, 9999999);
     $this->users_schema = Users::getSchema();
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:52,代码来源:components.class.php

示例9: checkViewOwnAccess

 public static function checkViewOwnAccess($c, $sf_user, $tickets, $project = false)
 {
     if ($project) {
         $has_access = Users::hasAccess('view_own', 'tickets', $sf_user, $project->getId());
     } else {
         $has_access = Users::hasAccess('view_own', 'tickets', $sf_user);
     }
     if ($has_access) {
         if (!in_array($tickets->getDepartmentsId(), Departments::getDepartmentIdByUserId($sf_user->getAttribute('id'))) and $tickets->getUsersId() != $sf_user->getAttribute('id')) {
             $c->redirect('accessForbidden/index');
         }
     }
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:13,代码来源:Tickets.class.php

示例10: executeListing

 public function executeListing(sfWebRequest $request)
 {
     if (!isset($this->reports_id)) {
         $this->reports_id = false;
     }
     $q = Doctrine_Core::getTable('Tickets')->createQuery('t')->leftJoin('t.TicketsStatus ts')->leftJoin('t.TicketsTypes tt')->leftJoin('t.Departments td')->leftJoin('t.Projects p')->leftJoin('t.Users');
     if ($request->hasParameter('projects_id')) {
         $q->addWhere('projects_id=?', $request->getParameter('projects_id'));
         if (Users::hasAccess('view_own', 'tickets', $this->getUser(), $request->getParameter('projects_id'))) {
             $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
         }
     } else {
         if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
             $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
         }
         if (Users::hasAccess('view_own', 'tickets', $this->getUser())) {
             $q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
         }
     }
     if ($this->reports_id > 0) {
         $q = TicketsReports::addFiltersToQuery($q, $this->reports_id, $this->getUser());
     } elseif ($request->hasParameter('search')) {
         $q = app::addSearchQuery($q, $request->getParameter('search'), 'TicketsComments', 't', $request->getParameter('search_by_extrafields'));
         $q = app::addListingOrder($q, 'tickets', $this->getUser());
     } else {
         $q = Tickets::addFiltersToQuery($q, $this->getUser()->getAttribute('tickets_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
         $q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
     }
     if (sfConfig::get('app_rows_limit') > 0) {
         $this->pager = new sfDoctrinePager('Tickets', sfConfig::get('app_rows_limit'));
         $this->pager->setQuery($q);
         $this->pager->setPage($request->getParameter('page', 1));
         $this->pager->init();
     }
     $this->tickets_list = $q->fetchArray();
     if (isset($this->is_dashboard)) {
         $this->url_params = 'redirect_to=dashboard';
         $this->display_insert_button = true;
     } elseif ($this->reports_id > 0) {
         $this->url_params = 'redirect_to=ticketsReports' . $this->reports_id;
         $this->display_insert_button = true;
     } else {
         $this->url_params = 'redirect_to=ticketsList';
         if ($request->hasParameter('projects_id')) {
             $this->url_params = 'projects_id=' . $request->getParameter('projects_id');
         }
         $this->display_insert_button = true;
     }
     $this->tlId = rand(1111111, 9999999);
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:50,代码来源:components.class.php

示例11: getMoreActions

 protected function getMoreActions(sfWebRequest $request)
 {
     $more_actions = array();
     $s = array();
     if (Users::hasAccess('edit', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
         $s[] = array('title' => t::__('Move To'), 'url' => 'tasks/moveTo?tasks_id=' . $request->getParameter('tasks_id') . '&projects_id=' . $request->getParameter('projects_id') . '&redirect_to=tasksComments', 'modalbox' => true);
     }
     if (Users::hasAccess('delete', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
         $s[] = array('title' => t::__('Delete'), 'url' => 'tasks/delete?id=' . $request->getParameter('tasks_id') . '&projects_id=' . $request->getParameter('projects_id'), 'confirm' => true);
     }
     if (count($s) > 0) {
         $more_actions[] = array('title' => t::__('More Actions'), 'submenu' => $s);
     }
     return $more_actions;
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:15,代码来源:actions.class.php

示例12: configure

 public function configure()
 {
     $projects = $this->getOption('projects');
     $sf_user = $this->getOption('sf_user');
     $this->widgetSchema['discussions_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('DiscussionsStatus')));
     $this->setDefault('discussions_status_id', app::getDefaultValueByTable('DiscussionsStatus'));
     $this->widgetSchema['assigned_to'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'discussions'), 'expanded' => true, 'multiple' => true));
     if (Users::hasAccess('edit', 'projects', $sf_user, $projects->getId())) {
         $this->widgetSchema['users_id'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'discussions_insert')));
     } else {
         $this->widgetSchema['users_id'] = new sfWidgetFormInputHidden();
     }
     $this->widgetSchema['name']->setAttributes(array('size' => '60', 'class' => 'required'));
     $this->widgetSchema['description']->setAttributes(array('class' => 'editor'));
     $this->widgetSchema['projects_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema->setLabels(array('discussions_status_id' => 'Status', 'assigned_to' => 'Assigned To', 'users_id' => 'Created By'));
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:17,代码来源:DiscussionsForm.class.php

示例13: configure

 public function configure()
 {
     $projects = $this->getOption('projects');
     $sf_user = $this->getOption('sf_user');
     $this->widgetSchema['tasks_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksStatus')));
     $this->setDefault('tasks_status_id', app::getDefaultValueByTable('TasksStatus'));
     $this->widgetSchema['tasks_priority_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksPriority')));
     $this->setDefault('tasks_priority_id', app::getDefaultValueByTable('TasksPriority'));
     $this->widgetSchema['tasks_type_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksTypes')));
     $this->setDefault('tasks_type_id', app::getDefaultValueByTable('TasksTypes'));
     $this->widgetSchema['tasks_label_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksLabels')));
     $this->setDefault('tasks_label_id', app::getDefaultValueByTable('TasksLabels'));
     $this->widgetSchema['tasks_groups_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TasksGroups', true, $projects->getId())));
     $this->widgetSchema['projects_phases_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('ProjectsPhases', true, $projects->getId())));
     $this->widgetSchema['versions_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('Versions', true, $projects->getId())));
     $this->widgetSchema['progress'] = new sfWidgetFormChoice(array('choices' => Tasks::getProgressChoices()));
     $this->widgetSchema['assigned_to'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'tasks'), 'expanded' => true, 'multiple' => true));
     if (Users::hasAccess('edit', 'projects', $sf_user, $projects->getId())) {
         $this->widgetSchema['created_by'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'tasks_insert')));
     } else {
         $this->widgetSchema['created_by'] = new sfWidgetFormInputHidden();
     }
     $this->widgetSchema['name']->setAttributes(array('size' => '60', 'class' => 'required'));
     $this->widgetSchema['description']->setAttributes(array('class' => 'editor'));
     $this->widgetSchema['estimated_time']->setAttributes(array('size' => '4'));
     $this->widgetSchema['start_date'] = new sfWidgetFormInput(array(), array('class' => 'datetimepicker'));
     $this->widgetSchema['due_date'] = new sfWidgetFormInput(array(), array('class' => 'datetimepicker'));
     $this->widgetSchema['projects_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['closed_date'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['created_at'] = new sfWidgetFormInputHidden();
     $this->setDefault('created_at', date('Y-m-d H:i:s'));
     $this->widgetSchema->setLabels(array('tasks_priority_id' => 'Priority', 'tasks_type_id' => 'Type', 'tasks_label_id' => 'Label', 'projects_phases_id' => 'Phase', 'versions_id' => 'Version', 'tasks_groups_id' => 'Group', 'tasks_status_id' => 'Status', 'estimated_time' => 'Estimated Time', 'start_date' => 'Start Date', 'due_date' => 'Due Date', 'created_by' => 'Created By'));
     unset($this->widgetSchema['discussion_id']);
     unset($this->widgetSchema['tickets_id']);
     unset($this->widgetSchema['work_hours']);
     unset($this->validatorSchema['discussion_id']);
     unset($this->validatorSchema['tickets_id']);
     unset($this->validatorSchema['work_hours']);
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:39,代码来源:TasksForm.class.php

示例14: configure

 public function configure()
 {
     $projects = $this->getOption('projects');
     $sf_user = $this->getOption('sf_user');
     $this->widgetSchema['departments_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('Departments')), array('class' => 'required'));
     $this->widgetSchema['tickets_status_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TicketsStatus')));
     $this->setDefault('tickets_status_id', app::getDefaultValueByTable('TicketsStatus'));
     $this->widgetSchema['tickets_types_id'] = new sfWidgetFormChoice(array('choices' => app::getItemsChoicesByTable('TicketsTypes')));
     $this->setDefault('tickets_types_id', app::getDefaultValueByTable('TicketsTypes'));
     if ($projects) {
         if (Users::hasAccess('edit', 'projects', $sf_user, $projects->getId())) {
             $this->widgetSchema['users_id'] = new sfWidgetFormChoice(array('choices' => Users::getChoices(array_merge(array($sf_user->getAttribute('id')), array_filter(explode(',', $projects->getTeam()))), 'tickets_insert')));
         } else {
             $this->widgetSchema['users_id'] = new sfWidgetFormInputHidden();
         }
     }
     $this->widgetSchema['name']->setAttributes(array('size' => '60', 'class' => 'required'));
     $this->widgetSchema['description']->setAttributes(array('class' => 'editor'));
     $this->widgetSchema['projects_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['created_at'] = new sfWidgetFormInputHidden();
     $this->setDefault('created_at', date('Y-m-d H:i:s'));
     $this->widgetSchema->setLabels(array('tickets_types_id' => 'Type', 'tickets_status_id' => 'Status', 'departments_id' => 'Department', 'name' => 'Subject', 'users_id' => 'Created By'));
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:23,代码来源:TicketsForm.class.php

示例15: executeListing

 public function executeListing(sfWebRequest $request)
 {
     if (!isset($this->reports_id)) {
         $this->reports_id = false;
     }
     $q = Doctrine_Core::getTable('Projects')->createQuery('p')->leftJoin('p.ProjectsStatus ps')->leftJoin('p.ProjectsTypes pt')->leftJoin('p.Users');
     if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
         $q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',p.team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
     }
     if ($this->reports_id > 0) {
         $q = ProjectsReports::addFiltersToQuery($q, $this->reports_id, $this->getUser());
     } elseif ($request->hasParameter('search')) {
         $q = app::addSearchQuery($q, $request->getParameter('search'), 'ProjectsComments', 'p', $request->getParameter('search_by_extrafields'));
         $q = app::addListingOrder($q, 'projects', $this->getUser());
     } else {
         $q = Projects::addFiltersToQuery($q, $this->getUser()->getAttribute('projects_filter'));
         $q = app::addListingOrder($q, 'projects', $this->getUser());
     }
     if (sfConfig::get('app_rows_limit') > 0) {
         $this->pager = new sfDoctrinePager('Projects', sfConfig::get('app_rows_limit'));
         $this->pager->setQuery($q);
         $this->pager->setPage($request->getParameter('page', 1));
         $this->pager->init();
     }
     $this->projects_list = $q->fetchArray();
     if (isset($this->is_dashboard)) {
         $this->url_params = 'redirect_to=dashboard';
         $this->display_insert_button = true;
     } elseif ($this->reports_id > 0) {
         $this->url_params = 'redirect_to=projectsReports' . $this->reports_id;
         $this->display_insert_button = true;
     } else {
         $this->url_params = '';
         $this->display_insert_button = true;
     }
     $this->tlId = rand(1111111, 9999999);
 }
开发者ID:noikiy,项目名称:qdpm,代码行数:37,代码来源:components.class.php


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