Пример #1
0
 /**
  * @param Exporter $exporter
  *
  * @return void
  */
 public function handle(Exporter $exporter)
 {
     $params = $exporter->getParams();
     $this->setProject($exporter->getParams('route.project'));
     $query = $this->project->issues()->select(array_keys($this->columns));
     // Filter issues
     $this->project->filterTitleOrBody($query, $params['keyword']);
     $this->project->filterAssignTo($query, $params['keyword']);
     $this->project->filterTitleOrBody($query, $params['keyword']);
     // Fetch issues
     $this->issues = $query->get();
     // Create CSV file
     $exporter->sheet($this->project->name, function (LaravelExcelWorksheet $sheet) {
         // Global sheet styles
         $this->globalStyle($sheet);
         // Title
         $sheet->mergeCells('A1:G1');
         $sheet->setHeight(1, 50);
         $sheet->cell('A1', function (CellWriter $cell) {
             $this->sheetTitle($cell);
         });
         // Header
         $sheet->row(2, array_map('trans', $this->header));
         // Rows
         $index = 3;
         foreach ($this->issues as $issue) {
             $this->sheetRow($sheet, $index, $issue);
             ++$index;
         }
     });
 }
Пример #2
0
 /**
  * Returns all projects with open issue count
  *
  * @param int $status
  *
  * @return $this
  */
 public function projectsWithCountOpenIssues($status = Project::STATUS_OPEN)
 {
     if ($this->permission('project-all')) {
         return Project::with('openIssuesCount')->where('status', '=', $status);
     }
     return $this->projects($status)->with('openIssuesCount');
 }
Пример #3
0
 /**
  * @return string
  */
 public function getRedirectUrl()
 {
     return $this->project->to('notes');
 }
Пример #4
0
 /**
  * Fetch a project by column
  *
  * @param string          $field
  * @param int|string|bool $value
  *
  * @return Model\Project
  */
 public function fetchProjectBy($field, $value)
 {
     return Model\Project::where($field, '=', $value)->first();
 }
Пример #5
0
 /**
  * Ajax: generate the issues export file
  *
  * @param Project  $project
  * @param Exporter $exporter
  * @param Request  $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function postExportIssues(Project $project, Exporter $exporter, Request $request)
 {
     // Generate export file
     $info = $exporter->exportFile('Project\\Issue', $request->input('format', Exporter::TYPE_CSV), $request->all());
     // Download link
     $link = link_to($project->to('download_export/' . $info['file']), trans('tinyissue.download_export'), ['class' => 'btn btn-link']);
     return response()->json(['link' => $link, 'title' => $info['title'], 'file' => $info['file'], 'ext' => $info['ext']]);
 }
 /**
  * Show general application stats
  *
  * @param Tag     $tag
  * @param Project $project
  * @param User    $user
  *
  * @return \Illuminate\View\View
  */
 public function getIndex(Tag $tag, Project $project, User $user)
 {
     return view('administration.index', ['users' => $user->countUsers(), 'active_projects' => $project->countOpenProjects(), 'archived_projects' => $project->countArchivedProjects(), 'open_issues' => $project->countOpenIssues(), 'closed_issues' => $project->countClosedIssues(), 'projects' => $this->auth->user()->projects()->get(), 'tags' => $tag->count()]);
 }
Пример #7
0
 /**
  * Returns assigned to field
  *
  * @return array
  */
 protected function fieldAssignedTo()
 {
     return ['assigned_to' => ['type' => 'select', 'label' => 'assigned_to', 'options' => [0 => ''] + $this->project->users()->get()->lists('fullname', 'id')->all(), 'value' => (int) $this->project->default_assignee]];
 }
Пример #8
0
 /**
  * To create a new issue
  *
  * @param Project\Issue           $issue
  * @param FormRequest\GlobalIssue $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postNewIssue(Project\Issue $issue, FormRequest\GlobalIssue $request)
 {
     $project = Project::find((int) $request->input('project'));
     $issue->setRelation('project', $project);
     $issue->setRelation('user', $this->auth->user());
     $issue->createIssue(['title' => $request->input('title'), 'body' => $request->input('body'), 'tag' => $request->input('tag'), 'upload_token' => $request->input('upload_token'), 'assigned_to' => (int) $project->default_assignee, 'time_quote' => 0]);
     return redirect($issue->to())->with('notice', trans('tinyissue.issue_has_been_created'));
 }