/** * @return Datagrid */ public function getDatagrid() { $user = $this->user; $datagrid = new Datagrid('talks', $this->talks, array(new DatagridColumn('Título', 'title', 'col-md-4'), new DatagridColumn('Tipo', 'type.description', 'col-md-2'), new DatagridColumn('Nível', 'complexity', 'col-md-2', function ($complexity) { switch ($complexity) { case Talk::HIGH_COMPLEXITY: return 'Avançado'; case Talk::MEDIUM_COMPLEXITY: return 'Intermediário'; case Talk::LOW_COMPLEXITY: return 'Básico'; } }), new DatagridColumn('Data submissão', 'creationTime.format("d/m/Y H:i:s")', 'col-md-2'), new DatagridColumn('', 'id', 'col-md-2', function ($id, Talk $talk) use($user) { if ($talk->getEvent()->isEvaluator($user)) { return new EvaluatorButtons($id); } return new AdministratorButtons($id); }))); $datagrid->setStyleClass('table table-striped'); return $datagrid; }
/** * @return Datagrid */ public function getDatagrid() { $datagrid = new Datagrid('attendees', $this->attendees, array(new DatagridColumn('Nome', 'user.name', 'col-md-3'), new DatagridColumn('Email', 'user.email', 'col-md-3'), new DatagridColumn('Tipo', 'canAttendAllDays()', 'col-md-2', function ($canAttendAllDays) { return $canAttendAllDays ? 'Minicursos e paletras' : 'Somente palestras'; }), new DatagridColumn('Status', 'getStatusDescription()', 'col-md-2', function ($description, Attendee $attendee) { return '<span id="desc-' . $attendee->getId() . '">' . $description . '</span>'; }), new DatagridColumn('', 'id', 'col-md-2', function ($id, Attendee $attendee) { if ($attendee->hasArrived()) { return ''; } if ($attendee->isPaymentNotVerified() || $attendee->isWaitingForPayment()) { return '<div class="pull-right" id="buttons-' . $id . '"> <a href="#" id="approve-' . $id . '" class="btn btn-xs btn-info" title="Confirmar presença"> <span class="glyphicon glyphicon-check"></span> </a> <a href="#" id="pay-' . $id . '" class="btn btn-xs btn-warning" title="Realizar pagamento"> <span class="glyphicon glyphicon-shopping-cart"></span> </a> </div>'; } return '<div class="pull-right" id="buttons-' . $id . '"> <a href="#" id="approve-' . $id . '" class="btn btn-xs btn-info" title="Confirmar presença"> <span class="glyphicon glyphicon-check"></span> </a> </div>'; }))); $datagrid->setStyleClass('table table-striped'); return $datagrid; }
/** * @return Datagrid */ public function getDatagrid() { $datagrid = new Datagrid('supporters', $this->supporters, array(new DatagridColumn('Nome', 'company.name', 'col-md-3'), new DatagridColumn('CNPJ', 'company.socialId', 'col-md-2', function ($socialId) { return sprintf('%s.%s.%s/%s-%s', substr($socialId, 0, 2), substr($socialId, 2, 3), substr($socialId, 5, 3), substr($socialId, 8, 4), substr($socialId, 12)); }), new DatagridColumn('Email', 'company.email', 'col-md-3'), new DatagridColumn('Site', 'company.website', 'col-md-2'), new DatagridColumn('', 'id', 'col-md-2', function ($id) { return '<div class="pull-right"> <a href="#" id="edit-' . $id . '" class="btn btn-xs btn-info disabled" title="Editar"> <span class="glyphicon glyphicon-pencil"></span> </a> <a href="#" id="remove-' . $id . '" class="btn btn-xs btn-danger disabled" title="Remover"> <span class="glyphicon glyphicon-trash"></span> </a> </div>'; }))); $datagrid->setStyleClass('table table-striped'); return $datagrid; }
/** * @return string|\Lcobucci\DisplayObjects\Components\Datagrid\Datagrid */ public function getDatagrid() { $readOnly = !$this->allowSubmission(); $datagrid = new Datagrid('talks', $this->getTalks(), array(new DatagridColumn('Nome', 'title', 'col-md-5'), new DatagridColumn('Tipo', 'type.description', 'col-md-2'), new DatagridColumn('Nível', 'complexity', 'col-md-2', function ($complexity) { switch ($complexity) { case Talk::HIGH_COMPLEXITY: return 'Avançado'; case Talk::MEDIUM_COMPLEXITY: return 'Intermediário'; default: return 'Básico'; } }), new DatagridColumn('Aprovada', 'approved', 'col-md-2', function ($approved) { if ($approved === null) { return 'Não avaliada'; } return $approved ? 'Sim' : 'Não'; }), new DatagridColumn('', 'id', 'col-md-1', function ($id) use($readOnly) { $title = 'Editar'; $icon = 'pencil'; if ($readOnly) { $title = 'Ver informações'; $icon = 'eye-open'; } return '<div class="pull-right"> <a href="#" id="action-' . $id . '" class="btn btn-xs btn-info" title="' . $title . '"> <span class="glyphicon glyphicon-' . $icon . '"></span> </a> </div>'; }))); $datagrid->setStyleClass('table table-striped'); return $datagrid; }
/** * @param DatatableColumnFilter $filter */ public function appendFilter(DatatableColumnFilter $filter) { $this->table->setDisplayFooterLabels(true); $this->filters[] = $filter; }