public static function gridForAdmins(&$filter, &$grid)
 {
     $filter = \DataFilter::source(News::with('createdBy', 'approvedBy', 'status'));
     //->where('status_id', '<>', 1)
     $filter->add('title', 'Title', 'text');
     $filter->add('content', 'Content', 'text');
     $filter->add('createdBy.name', 'created_by', 'text');
     $filter->add('approvedBy.name', 'approved_by', 'text');
     $filter->add('updated_at', 'Last update date', 'daterange')->format('m/d/Y', 'en');
     $filter->add('created_at', 'Create date', 'daterange')->format('m/d/Y', 'en');
     $filter->submit('search');
     $filter->reset('reset');
     $filter->build();
     $grid = DataGrid::source($filter);
     $grid->attributes(array("class" => "table table-striped"));
     $grid->add('title', 'Title', true);
     $grid->add('updated_at|strtotime|date[m/d/Y]', 'Last update date', true);
     $grid->add('created_at|strtotime|date[m/d/Y]', 'Create date', true);
     $grid->add('content|strip_tags|substr[0,20]', 'Content');
     $grid->add('createdBy.name', 'created_by');
     $grid->add('approvedBy.name', 'approved_by');
     $grid->add('status.title', 'Status');
     $grid->add('view', 'View')->cell(function ($value, $row) {
         return '<a class="btn btn-responsive" href="' . url('admin-news/view') . "/" . $row->id . '"><i class="glyphicon glyphicon-eye-open"></i></a>';
     });
     $grid->add('status.id', 'Approve')->cell(function ($value, $row) {
         if ($value == 2) {
             return '<a class="btn btn-success btn-responsive" href="' . url('admin-news/approve') . "/" . $row->id . '"><i class="glyphicon glyphicon-ok"></i> Approve</a>';
         }
         return '';
     });
     $grid->orderBy('id', 'desc');
     $grid->paginate(10);
 }
Пример #2
0
 public static function source($source)
 {
     if (!$source instanceof Node) {
         throw new \InvalidArgumentException('DataTree only works with Baum\\Node instances');
     }
     $instance = parent::source($source);
     $instance->attr('data-instance-id', spl_object_hash($instance));
     \Rapyd::css('datatree/css/datatree.css');
     \Rapyd::js('datatree/js/nestable/jquery.nestable.js');
     \Rapyd::js('datatree/js/datatree.js');
     return $instance;
 }
Пример #3
0
 /**
  * return a form with a nested action button
  *
  * @param $url
  * @param $method
  * @param $name
  * @param string $position
  * @param array $attributes
  * @return $this 
  * @static 
  */
 public static function formButton($url, $method, $name, $position = 'BL', $attributes = array())
 {
     //Method inherited from \Zofe\Rapyd\Widget
     return \Zofe\Rapyd\DataGrid\DataGrid::formButton($url, $method, $name, $position, $attributes);
 }
Пример #4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $info = $this->info;
     $data = DataGrid::source(new TahunAkademik());
     return View::make('jurusan::tahun_akademik.index', compact('info', 'data'));
 }