示例#1
0
文件: issue.php 项目: eliasyanni/bugs
 public function activity($activity_limit = 5)
 {
     $users = $comments = $activity_type = array();
     $issue = $this;
     $project_id = $this->project_id;
     $project = \Project::find($project_id);
     foreach (\Activity::all() as $row) {
         $activity_type[$row->id] = $row;
     }
     $activities = array();
     foreach (\User\Activity::where('item_id', '=', $issue->id)->order_by('created_at', 'ASC')->get() as $activity) {
         $activities[] = $activity;
         switch ($activity->type_id) {
             case 2:
                 if (!isset($users[$activity->user_id])) {
                     $users[$activity->user_id] = \User::find($activity->user_id);
                 }
                 if (!isset($comments[$activity->action_id])) {
                     $comments[$activity->action_id] = \Project\Issue\Comment::find($activity->action_id);
                 }
                 break;
             case 5:
                 if (!isset($users[$activity->user_id])) {
                     $users[$activity->user_id] = \User::find($activity->user_id);
                 }
                 if (!isset($users[$activity->action_id])) {
                     $users[$activity->action_id] = \User::find($activity->action_id);
                 }
                 break;
             default:
                 if (!isset($users[$activity->user_id])) {
                     $users[$activity->user_id] = \User::find($activity->user_id);
                 }
                 break;
         }
     }
     /* Loop through the projects and activity again, building the views for each activity */
     $return = array();
     foreach ($activities as $row) {
         switch ($row->type_id) {
             case 2:
                 $return[] = \View::make('project/issue/activity/' . $activity_type[$row->type_id]->activity, array('issue' => $issue, 'project' => $project, 'user' => $users[$row->user_id], 'comment' => $comments[$row->action_id], 'activity' => $row));
                 break;
             case 3:
                 $return[] = \View::make('project/issue/activity/' . $activity_type[$row->type_id]->activity, array('issue' => $issue, 'project' => $project, 'user' => $users[$row->user_id], 'activity' => $row));
                 break;
             case 5:
                 $return[] = \View::make('project/issue/activity/' . $activity_type[$row->type_id]->activity, array('issue' => $issue, 'project' => $project, 'user' => $users[$row->user_id], 'assigned' => $users[$row->action_id], 'activity' => $row));
                 break;
             case 6:
                 $tag_diff = json_decode($row->data, true);
                 $return[] = \View::make('project/issue/activity/' . $activity_type[$row->type_id]->activity, array('issue' => $issue, 'project' => $project, 'user' => $users[$row->user_id], 'tag_diff' => $tag_diff, 'tag_counts' => array('added' => sizeof($tag_diff['added_tags']), 'removed' => sizeof($tag_diff['removed_tags'])), 'activity' => $row));
                 break;
             default:
                 $return[] = \View::make('project/issue/activity/' . $activity_type[$row->type_id]->activity, array('issue' => $issue, 'project' => $project, 'user' => $users[$row->user_id], 'activity' => $row));
                 break;
         }
     }
     return $return;
 }
示例#2
0
文件: issue.php 项目: eliasyanni/bugs
 /**
  * Post a comment to a issue
  *
  * @return Redirect
  */
 public function post_index()
 {
     if (!Input::get('comment')) {
         return Redirect::to(Project\Issue::current()->to() . '#new-comment')->with('notice-error', __('tinyissue.you_put_no_comment'));
     }
     $comment = \Project\Issue\Comment::create_comment(Input::all(), Project::current(), Project\Issue::current());
     return Redirect::to(Project\Issue::current()->to() . '#comment' . $comment->id)->with('notice', __('tinyissue.your_comment_added'));
 }
示例#3
0
 /**
  * Post a comment to a issue
  *
  * @return Redirect
  */
 public function post_index()
 {
     if (!Input::get('comment')) {
         return Redirect::to(Project\Issue::current()->to() . '#new-comment')->with('notice-error', 'You did not put in a comment!');
     }
     $comment = \Project\Issue\Comment::create_comment(Input::all(), Project::current(), Project\Issue::current());
     return Redirect::to(Project\Issue::current()->to() . '#comment' . $comment->id)->with('notice', 'Your comment has been added!');
 }
示例#4
0
 public function post_savecomment()
 {
     $input = Input::all();
     $issue = new Project\Issue();
     $issue::load_issue($input['issue_id']);
     $project = new Project();
     $project::load_project($input['project_id']);
     \Project\Issue\Comment::create_comment(Input::all(), $project::current(), $issue::current());
     echo '1';
     die;
 }