本文整理汇总了PHP中Datatables类的典型用法代码示例。如果您正苦于以下问题:PHP Datatables类的具体用法?PHP Datatables怎么用?PHP Datatables使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Datatables类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of reportgroupings
*
* @return Response
*/
public function index($report_id)
{
if (!ReportGrouping::canList()) {
return $this->_access_denied();
}
if (Request::ajax()) {
$users_under_me = Auth::user()->getAuthorizedUserids(ReportGrouping::$show_authorize_flag);
if (empty($users_under_me)) {
$reportgroupings = ReportGrouping::whereNotNull('report_groupings.created_at');
} else {
$reportgroupings = ReportGrouping::whereIn('report_groupings.user_id', $users_under_me);
}
$reportgroupings->where('report_id', $report_id);
$reportgroupings = $reportgroupings->select(['report_groupings.id', 'report_groupings.name', 'report_groupings.label', 'report_groupings.id as actions']);
return Datatables::of($reportgroupings)->edit_column('actions', function ($reportgrouping) use($report_id) {
$actions = [];
$actions[] = $reportgrouping->canShow() ? link_to_action('ReportGroupingsController@show', 'Show', [$report_id, $reportgrouping->id], ['class' => 'btn btn-xs btn-primary']) : '';
$actions[] = $reportgrouping->canUpdate() ? link_to_action('ReportGroupingsController@edit', 'Update', [$report_id, $reportgrouping->id], ['class' => 'btn btn-xs btn-default']) : '';
$actions[] = $reportgrouping->canDelete() ? Former::open(action('ReportGroupingsController@destroy', [$report_id, $reportgrouping->id]))->class('form-inline') . Former::hidden('_method', 'DELETE') . '<button type="button" class="btn btn-xs btn-danger confirm-delete">Delete</button>' . Former::close() : '';
return implode(' ', $actions);
})->remove_column('id')->make();
return Datatables::of($reportgroupings)->make();
}
Asset::push('js', 'datatables');
return View::make('reportgroupings.index', compact('report_id'));
}
示例2: search
public function search()
{
$roles = Role::select(array('roles.id', 'roles.name', 'roles.id as users', 'roles.created_at'));
return Datatables::of($roles)->edit_column('users', '{{{ DB::table(\'assigned_roles\')->where(\'role_id\', \'=\', $id)->count() }}}')->add_column('actions', '<a href="javascript:void(0)" id="role_edit" role_id="{{{ $id }}}" class="btn_table btn btn-info"><i class="fa fa-share-square-o"></i> Edit</a>
<a href="javascript:void(0)" id="role_delete" role_id="{{{ $id }}}" class="btn_table btn btn-danger"><i class="fa fa-trash-o"></i> Delete</a>
')->remove_column('id')->make();
}
示例3: response
public function response()
{
if (Request::ajax()) {
$obj_cmos = Cmo::select(array('cmos.id', 'cmos.nama', 'cmos.perusahaan', 'cmos.jabatan', 'cmos.alamat', 'cmos.telepon', 'cmos.email'));
return Datatables::of($obj_cmos)->add_column('Operations', '<a href="cmos/{{ $id }}/edit">edit</a>')->remove_column('id')->make();
}
}
示例4: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show(Request $request)
{
$fromDate = $request['fromDate'] . " 00:00:00";
$toDate = $request['toDate'] . " 23:59:59";
$precinct = $request['precinct'];
if ($precinct == "0") {
$precinct = "%";
}
$department = $request['department'];
if ($department == "0") {
$department = "%";
}
$category = $request['category'];
if ($category == "0") {
$category = "%";
}
$status = $request['status'];
if ($status == "0") {
$status = "%";
}
$reporter = $request['reporter'];
if ($reporter == "0") {
$reporter = "%";
}
$cases = \DB::table('cases')->join('departments', 'cases.department', '=', 'departments.id')->join('municipalities', 'cases.precinct', '=', 'municipalities.id')->join('users', 'cases.reporter', '=', 'users.id')->join('categories', 'cases.category', '=', 'categories.id')->select(\DB::raw("\n cases.id,\n cases.created_at,\n cases.description,\n cases.status,\n cases.priority,\n cases.severity,\n departments.name as department,\n municipalities.name as precinct,\n IF(`cases`.`addressbook` = 1,(SELECT CONCAT(`FirstName`, ' ', `Surname`) FROM `addressbook` WHERE `addressbook`.`id`= `cases`.`reporter`), (SELECT CONCAT(users.`name`, ' ', users.`surname`) FROM `users` WHERE `users`.`id`= `cases`.`reporter`)) as reporterName,\n categories.name as category\n "))->whereBetween('cases.created_at', array($fromDate, $toDate))->where('municipalities.slug', 'LIKE', $precinct)->where('departments.slug', 'LIKE', $department)->where('categories.slug', 'LIKE', $category)->where('cases.status', 'LIKE', $status)->whereRaw("CONCAT(`users`.`name`, ' ', `users`.`surname`) LIKE '{$reporter}'")->groupBy('cases.id');
return \Datatables::of($cases)->addColumn('actions', '<a class="btn btn-xs btn-alt" data-toggle="modal" onClick="launchCaseModal({{$id}});" data-target=".modalCase">View</a>')->make(true);
}
示例5: listAjax
public function listAjax()
{
$data = DB::table('pegawai')->join('satker', 'pegawai.id_satker', '=', 'satker.id_satker')->select('satker.nama_satker', 'pegawai.nama', 'pegawai.nip', 'pegawai.alamat', 'pegawai.level', 'pegawai.golongan', 'pegawai.phone', 'pegawai.mobile_phone');
return Datatables::of($data)->remove_column('nama_satker')->remove_column('alamat')->remove_column('phone')->remove_column('mobile_phone')->edit_column('level', '
@if($level == "1")
Pejabat Pembuat Komitmen
@elseif($level =="2")
Sekretariat ULP
@elseif($level =="3")
Kepala ULP
@elseif($level =="4")
POKJA
@elseif($level =="5")
Pengguna Anggaran
@elseif($level =="0")
Administrator
@endif
')->edit_column('nama', '
<strong>{{$nama}}</strong><br>
<strong>{{$nama_satker}}</strong><br>
<small>{{$alamat}}</small><br>
<small>{{$phone}} {{$mobile_phone}}</small>
')->add_column(null, '
<a href="{{ URL::to("admin/pegawai/edit/".$nip) }}" id="tooltip" class="btn btn-warning btn-circle" data-toggle="tooltip" data-placement="bottom" title="Edit data"><i class="fa fa-pencil" ></i></a>
<a href="{{ URL::to("admin/pegawai/delete/".$nip) }}" id="del" class="btn btn-danger btn-circle" data-toggle="tooltip" data-placement="bottom" title="Hapus data"><i class="fa fa-times" ></i></a>
<a href="{{ URL::to("admin/pegawai/detil/".$nip) }}" class="btn btn-primary btn-circle" data-toggle="tooltip" data-placement="bottom" title="Detil Pegawai"><i class="fa fa-th-list" ></i></a>
')->make();
}
示例6: getData
public function getData()
{
$roles = $this->role->select(['id', 'name', 'display_name'])->orderBy('id', 'desc');
return \Datatables::of($roles)->addColumn('operation', function ($row) {
return adminbuttons($row->id, 'admin/role', 2);
})->removeColumn('id')->make();
}
示例7: listPengurus
function listPengurus($id_rkn)
{
$data = DB::table('rekanan_pengurus')->select('id_pengurus', 'id_rekanan', 'alamat', 'nama_pengurus', 'jabatan', 'telp', 'prosentase_shm')->where('id_rekanan', '=', $id_rkn);
return Datatables::of($data)->remove_column('id_pengurus')->remove_column('id_rekanan')->remove_column('alamat')->remove_column('telp')->edit_column('nama_pengurus', '
<p>{{ $nama_pengurus }} <br><small>Alamat : {{ $alamat }}</small><br><small>No Handphone / Telp : {{ $telp }}</p>
')->edit_column('jabatan', '<b> {{ $jabatan }} </b>')->edit_column('prosentase_shm', '<p> {{ $prosentase_shm }} % </p>')->make();
}
示例8: index
/**
* Display a listing of users
*
* @return Response
*/
public function index()
{
if (!User::canList()) {
return $this->_access_denied();
}
if (Request::ajax()) {
$users_under_me = Auth::user()->getAuthorizedUserids(User::$show_authorize_flag);
if (empty($users_under_me)) {
$users = User::with('roles')->whereNotNull('users.created_at');
} else {
$users = User::with('roles')->whereIn('users.user_id', $users_under_me);
}
$users = $users->select(['users.id', 'users.last_name', 'users.id as roles_column', 'users.confirmed', 'users.id as actions', 'users.first_name']);
return Datatables::of($users)->edit_column('last_name', function ($user) {
return $user->first_name . ' ' . $user->last_name;
})->edit_column('roles_column', function ($user) {
return '<ul>' . implode('', array_map(function ($name) {
return '<li>' . $name . '</li>';
}, $user->roles->lists('name'))) . '</ul>';
})->edit_column('confirmed', function ($user) {
return $user->status();
})->edit_column('actions', function ($data) {
$actions = [];
$actions[] = $data->canShow() ? link_to_action('users.show', 'Show', $data->id, ['class' => 'btn btn-xs btn-primary']) : '';
$actions[] = $data->canUpdate() ? link_to_action('users.edit', 'Update', $data->id, ['class' => 'btn btn-xs btn-default']) : '';
$actions[] = $data->canDelete() ? Former::open(action('users.destroy', $data->id))->class('form-inline') . Former::hidden('_method', 'DELETE') . '<button type="button" class="btn btn-danger btn-xs confirm-delete">Delete</button>' . Former::close() : '';
return implode(' ', $actions);
})->remove_column('id')->make();
}
Asset::push('js', 'datatables');
return View::make('users.index');
}
示例9: ajax_ayudas
public function ajax_ayudas()
{
$result = Ayuda::select('ayudas.id', 'beneficiarios.apellidos', 'personal.nombres', 'requerimiento', 'ayudas.gastos', 'nit', 'numfactura', 'ayudas.created_at')->join('beneficiarios', 'ayudas.beneficiarioID', '=', 'beneficiarios.beneficiarioID')->join('personal', 'ayudas.aportanteID', '=', 'personal.personalID')->orderBy('ayudas.created_at', 'desc');
return Datatables::of($result)->add_column('edit', '
<a class="btn purple" href="{{ route(\'admin.ayudas.edit\',$id)}}" ><i class="fa fa-edit"></i></a>
<a href="javascript:;" onclick="del(\'{{ $id }}\',\'{{ $apellidos}}\',\'{{ $requerimiento }}\');return false;" class="btn red">
<i class="fa fa-trash"></i></a>')->make();
}
示例10: get
public function get()
{
if (Api::Enabled()) {
return Api::make($this->comment->all()->get()->toArray());
} else {
return Datatables::of($this->comment->all())->edit_column('content', '<a href="{{{ URL::to(\'admin/comments/\'. $id .\'/edit\') }}}" class="modalfy cboxElement">{{{ Str::limit($content, 40, \'...\') }}}</a>')->edit_column('post_name', '<a href="{{{ URL::to(\'admin/slugs/\'. $postid .\'/edit\') }}}" class="modalfy cboxElement">{{{ Str::limit($post_name, 40, \'...\') }}}</a>')->edit_column('poster_name', '<a href="{{{ URL::to(\'admin/users/\'. $userid .\'/edit\') }}}" class="modalfy cboxElement">{{{ $poster_name }}}</a>')->add_column('actions', '<div class="btn-group"><a href="{{{ URL::to(\'admin/comments/\' . $id . \'/edit\' ) }}}" class="modalfy btn btn-primary btn-sm"><span class="glyphicon glyphicon-pencil"></span></a> <a data-row="{{{ $id }}}" data-method="delete" data-table="comments" href="{{{ URL::to(\'admin/comments/\' . $id . \'\' ) }}}" class="confirm-ajax-update btn btn-sm btn-danger"><span class="glyphicon glyphicon-remove"></span></a></div>')->remove_column('postid')->remove_column('userid')->make();
}
}
示例11: ajax_donaciones
public function ajax_donaciones()
{
$result = Donacion::select('donaciones.id', DB::raw('CONCAT(personal.nombres, personal.apellidos) AS nombre_aportante'), 'montodonacion', DB::raw('CONCAT(beneficiarios.nombres," ", beneficiarios.apellidos)'), 'donaciones.created_at', 'descripcion')->join('personal', 'donaciones.aportanteID', '=', 'personal.personalID')->join('beneficiarios', 'donaciones.beneficiarioID', '=', 'beneficiarios.beneficiarioID')->orderBy('donaciones.created_at', 'desc');
return Datatables::of($result)->add_column('edit', '
<a class="btn purple" href="{{ route(\'admin.donaciones.edit\',$id)}}" ><i class="fa fa-edit"></i></a>
<a href="javascript:;" onclick="del(\'{{ $id }}\',\'{{ $descripcion}}\',\'{{ $montodonacion }}\');return false;" class="btn red">
<i class="fa fa-trash"></i></a>')->make();
}
示例12: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$users = User::select(array('id', 'created_at', 'name', 'surname', 'email', 'username', 'cellphone'));
return \Datatables::of($users)->addColumn('actions', '<a class="btn btn-xs btn-alt" data-toggle="modal" onClick="launchUpdateUserModal({{$id}});" data-target=".modalEditUser" >Edit</a>
')->make(true);
}
示例13: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$users = User::select(array('id', 'created_at', 'name', 'surname', 'email', 'username'));
return \Datatables::of($users)->addColumn('actions', '
')->make(true);
}
示例14: listAjax
public function listAjax()
{
$data = DB::table('kategori')->select('id_cat', 'cat_nama');
return Datatables::of($data)->remove_column('id_cat')->edit_column('cat_nama', '
<span data="{{ $id_cat }}">{{$cat_nama}}</span>
')->add_column(null, '
<a href="{{ URL::to("admin/kategori/edit/".$id_cat) }}" id="edit" class="btn btn-warning" data-toggle="tooltip" data-placement="bottom" title="Edit data"><i class="fa fa-pencil" ></i></a>
')->make();
}
示例15: npwpAjax
function npwpAjax($id)
{
$data = DB::table('pajak')->select('id_pajak', 'id_pengadaan', 'no_pajak', 'jenis_pajak', 'tgl_pajak', 'file_pajak')->where('id_pengadaan', '=', $id);
return Datatables::of($data)->remove_column('id_pajak')->remove_column('id_pengadaan')->remove_column('no_pajak')->edit_column('tgl_pajak', '
{{ $no_pajak }}<br>{{ date("d F Y",strtotime($tgl_pajak)) }}
')->edit_column('file_pajak', '
<a href="{{ URL::to("asset/img/pajak/".$id_pengadaan."/".$file_pajak) }}" class="btn btn-primary"><i class="fa fa-file-picture-o" style="margin-right:10px;"></i>lihat Gambar</a>
')->make();
}