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


PHP AppController::_findProject方法代码示例

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


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

示例1: add

 function add()
 {
     if ($this->RequestHandler->isPost() && !empty($this->data['Watcher']['user_id'])) {
         $Model =& ClassRegistry::init($this->params['named']['object_type']);
         if ($Model->read(null, $this->params['named']['object_id']) && $this->Watcher->User->read(null, $this->data['Watcher']['user_id'])) {
             $Model->add_watcher($this->Watcher->User->data);
         }
     }
     Configure::write('debug', 0);
     extract($this->params['named']);
     $Model =& ClassRegistry::init(Inflector::camelize($object_type));
     $data = $Model->read(null, $object_id);
     $project_id = $Model->get_watched_project_id();
     $project = $this->Project->read('identifier', $project_id);
     $this->params['project_id'] = $project['Project']['identifier'];
     parent::_findProject();
     $members = $this->Project->members($project_id);
     if (!empty($data['Watcher'])) {
         foreach ($data['Watcher'] as $value) {
             if (array_key_exists($value['user_id'], $members)) {
                 unset($members[$value['user_id']]);
             }
         }
     }
     $this->set(array_merge(compact('members', 'object_type', 'object_id', 'data')));
     if ($this->RequestHandler->isAjax()) {
         $this->render('_watchers');
         $this->layout = 'ajax';
     } else {
         $this->redirect(env('HTTP_REFERER'));
     }
 }
开发者ID:predominant,项目名称:candycane,代码行数:32,代码来源:watchers_controller.php

示例2: array

 function _findProject()
 {
     $this->version = $this->Version->find('first', array('conditions' => array('Version.id' => $this->params['pass'][0])));
     $this->params['project_id'] = $this->version['Project']['identifier'];
     return parent::_findProject();
     #    @version = Version.find(params[:id])
     #    @project = @version.project
     #  rescue ActiveRecord::RecordNotFound
     #    render_404
     #  end
 }
开发者ID:predominant,项目名称:candycane,代码行数:11,代码来源:versions_controller.php

示例3:

 function _find_project()
 {
     $this->Attachment->read(null, $this->params['id']);
     $this->set('attachment', $this->Attachment->data[$this->Attachment->alias]);
     $this->set('author', $this->Attachment->data['Author']);
     # Show 404 if the filename in the url is wrong
     if (!empty($this->params['filename']) && $this->params['filename'] != $this->Attachment->data[$this->Attachment->name]['filename']) {
         $this->cakeError('error404');
     }
     $project = $this->Attachment->project();
     if (!empty($project['Project']['identifier'])) {
         $this->params['project_id'] = $project['Project']['identifier'];
         parent::_findProject();
     } else {
         $this->cakeError('error404');
     }
 }
开发者ID:nachtschatt3n,项目名称:candycane,代码行数:17,代码来源:attachments_controller.php

示例4: elseif

 function _find_optional_project()
 {
     if ($this->_get_param('issue_id')) {
         $issue_id = $this->_get_param('issue_id');
         $this->Issue->read(null, $issue_id);
         $this->params['project_id'] = $this->Issue->data['Project']['identifier'];
     } elseif (!empty($this->params['project_id'])) {
         // parent::beforeFilter
     }
     parent::_findProject();
     parent::user_setup();
     if (!$this->TimeEntry->User->is_allowed_to($this->current_user, 'view_time_entries', $this->_project, array('global' => true))) {
         return parent::deny_access();
     }
 }
开发者ID:predominant,项目名称:candycane,代码行数:15,代码来源:timelog_controller.php

示例5: NotFoundException

 /**
  * Find a project
  *
  * @return void
  * @access private
  */
 function _find_project()
 {
     $attachment = $this->Attachment->read(null, $this->request->params['id']);
     $this->set('attachment', $attachment[$this->Attachment->alias]);
     $this->set('author', $attachment[$this->Attachment->Author->alias]);
     // Show 404 if the filename in the url is wrong
     if (!empty($this->request->params['filename']) && $this->request->params['filename'] != $attachment[$this->Attachment->alias]['filename']) {
         throw new NotFoundException();
     }
     $project = $this->Attachment->project();
     if (!empty($project['Project']['identifier'])) {
         $this->request->params['project_id'] = $project['Project']['identifier'];
         parent::_findProject();
     } else {
         throw new NotFoundException();
     }
 }
开发者ID:gildonei,项目名称:candycane,代码行数:23,代码来源:AttachmentsController.php

示例6: edit

 /**
  * Edit action
  *
  * Attributes that can be updated on workflow transition (without :edit permission)
  *
  * /projects/test/issues/edit/25?backto=url&issue[status_id]=3
  * Array
  * (
  *     [url] => projects/test/issues/edit/25
  *     [backto] => url
  *     [issue] => Array
  *        (
  *           [status_id] => 3
  *       )
  * )
  *
  * @return void
  * @todo Make it configurable (at least per role)
  */
 public function edit()
 {
     static $UPDATABLE_ATTRS_ON_TRANSITION = array('status_id', 'assigned_to_id', 'fixed_version_id', 'done_ratio');
     if (empty($this->request->params['issue_id'])) {
         return $this->cakeError('error', array('message' => "Not exists issue."));
     }
     $issue = $this->_find_issue($this->request->params['issue_id']);
     if (empty($this->_project)) {
         $this->request->params['project_id'] = $issue['Project']['identifier'];
         parent::_findProject();
     }
     $statuses = $this->Issue->findStatusList($this->User->role_for_project($this->current_user, $this->_project));
     if (empty($statuses)) {
         $this->Session->setFlash(__('No default issue status is defined. Please check your configuration (Go to "Administration -> Issue statuses").'), 'default', array('class' => 'flash flash_error'));
         $this->redirect('index');
     }
     $this->request->data['Issue']['tracker_id'] = $issue['Issue']['tracker_id'];
     $this->set(compact('statuses'));
     $this->_set_edit_form_values();
     $notes = "";
     if ($this->_get_param('notes')) {
         $notes = $this->_get_param('notes');
     }
     unset($this->request->data['Issue']['notes']);
     $journal = $this->Issue->init_journal($issue, $this->current_user, $notes);
     $this->Issue->Journal->available_custom_fields = $this->Issue->cached_available_custom_fields();
     # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed
     $edit_allowed = $this->User->is_allowed_to($this->current_user, ':edit_issues', $this->_project);
     if ($edit_allowed || !empty($statuses) && (!empty($this->request->params['url']['issue']) || !empty($this->request->data['Issue']))) {
         $attrs = empty($this->request->params['url']['issue']) ? $this->request->data['Issue'] : $this->request->params['url']['issue'];
         if (!$edit_allowed) {
             foreach ($attrs as $k => $v) {
                 if (!in_array($k, $UPDATABLE_ATTRS_ON_TRANSITION)) {
                     unset($attrs[$k]);
                 }
             }
         }
         if (!empty($attrs['status_id'])) {
             if (!array_key_exists($attrs['status_id'], $statuses)) {
                 unset($attrs['status_id']);
             }
         }
         $issue['Issue'] = array_merge($issue['Issue'], $attrs);
     }
     if (($this->RequestHandler->isPost() || $this->RequestHandler->isPut()) && !empty($this->request->data)) {
         $this->Issue->TimeEntry->create();
         $time_entry = array('project_id' => $this->_project['Project']['id'], 'issue_id' => $issue['Issue']['id'], 'user_id' => $this->current_user['id'], 'spent_on' => date('Y-m-d'));
         if (isset($this->request->data['TimeEntry'])) {
             $time_entry = array_merge($time_entry, $this->request->data['TimeEntry']);
         }
         $this->Issue->TimeEntry->set($time_entry);
         if (!empty($this->request->data['custom_field_values'])) {
             $this->Issue->TimeEntry->data['TimeEntry']['custom_field_values'] = $this->Issue->TimeEntry->filterCustomFieldValue($this->request->data['custom_field_values']);
         }
         $save_data = array();
         $save_data['Issue'] = $this->request->data['Issue'];
         $save_data['Issue']['id'] = $issue['Issue']['id'];
         $save_data['Issue']['project_id'] = $this->_project['Project']['id'];
         $save_data['Issue']['tracker_id'] = $issue['Issue']['tracker_id'];
         if (!empty($this->request->data['custom_field_values'])) {
             $save_data['Issue']['custom_field_values'] = $this->Issue->filterCustomFieldValue($this->request->data['custom_field_values']);
         }
         if ($this->User->is_allowed_to($this->current_user, ':log_time', $this->_project) && !empty($this->Issue->TimeEntry->data['TimeEntry']['hours']) && $this->Issue->TimeEntry->validates()) {
             # Log spend time
             $save_data['TimeEntry'] = array($this->Issue->TimeEntry->data['TimeEntry']);
         }
         if (!empty($this->request->params['form'])) {
             $attachments = $this->Issue->attach_files($this->request->params['form'], $this->current_user);
             if (!empty($attachments['unsaved'])) {
                 $this->Session->setFlash(sprintf(__("%d file(s) could not be saved."), count($attachments['unsaved'])), 'default', array('class' => 'flash flash_warning'));
             }
             foreach ($attachments['attached'] as $a) {
                 $this->Issue->attachJournalDetails[] = array('property' => 'attachment', 'prop_key' => $a['id'], 'value' => $a['filename']);
             }
         }
         $event = new CakeEvent('Controller.Candy.issuesEditBeforeSave', $this, array('issue' => $this->Issue, 'journal' => $journal));
         $this->getEventManager()->dispatch($event);
         if ($this->Issue->saveAll($save_data)) {
             if ($this->Issue->actually_changed) {
                 $event = new CakeEvent('Controller.Candy.issuesEditAfterSave', $this, array('project' => $this->_project, 'issue' => $this->Issue, 'save_data' => $save_data, 'journal' => $journal, 'notes' => $notes));
                 $this->getEventManager()->dispatch($event);
//.........这里部分代码省略.........
开发者ID:ha1t,项目名称:candycane,代码行数:101,代码来源:IssuesController.php


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