当前位置: 首页>>代码示例>>PHP>>正文


PHP Datatable类代码示例

本文整理汇总了PHP中Datatable的典型用法代码示例。如果您正苦于以下问题:PHP Datatable类的具体用法?PHP Datatable怎么用?PHP Datatable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Datatable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_datatables_ajax

 /**
  * ajax-based serverside processed datatables example action
  */
 public function action_datatables_ajax()
 {
     // Column definition
     $columns = array("test1" => "Testcolumn #1", "test2" => "Testcolumn #2");
     // Generate random data
     $data = Session::instance()->get('dattables_example', array());
     if (empty($data)) {
         for ($i = 0; $i < 5000; $i++) {
             $data[] = array('test1' => $this->generateRandomString(25), 'test2' => $this->generateRandomString(25));
         }
     }
     // Create datatable
     $datatable = new Datatable($columns);
     // Here you could also pass in a orm model like this: $datatable->add_entries(ORM::factory('Model'));
     // Then the model needs to have columns named like the keys in the column definition, so in this example
     // test1 and test2 are needed properties on the model.
     $datatable->add_entries($data);
     $datatable->set_serverside(URL::base() . 'UIFWExamples/datatables_ajax');
     // Render html code from datatable->render() with the html layout
     if (Request::$current->is_ajax()) {
         echo $datatable->ajax_render();
     } else {
         $this->renderHtml($datatable->render());
     }
 }
开发者ID:kennux,项目名称:kohana-uifw,代码行数:28,代码来源:UIFWExamples.php

示例2: getUsersDataTable

 public function getUsersDataTable()
 {
     $query = UserModel::select('username', 'roles', 'id')->get();
     return Datatable::collection($query)->addColumn('id', function ($model) {
         return '<a href="/users/' . $model->id . '">view</a>';
     })->searchColumns('username', 'roles')->orderColumns('username', 'roles')->make();
 }
开发者ID:shineirvin,项目名称:projectinv.github.io,代码行数:7,代码来源:AdminController.php

示例3: getDatatable

 public function getDatatable($clientPublicId = null)
 {
     $credits = $this->creditRepo->find($clientPublicId, Input::get('sSearch'));
     $table = Datatable::query($credits);
     if (!$clientPublicId) {
         $table->addColumn('checkbox', function ($model) {
             return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
         })->addColumn('client_name', function ($model) {
             return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model));
         });
     }
     return $table->addColumn('amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id);
     })->addColumn('balance', function ($model) {
         return Utils::formatMoney($model->balance, $model->currency_id);
     })->addColumn('credit_date', function ($model) {
         return Utils::fromSqlDate($model->credit_date);
     })->addColumn('private_notes', function ($model) {
         return $model->private_notes;
     })->addColumn('dropdown', function ($model) {
         return '<div class="btn-group tr-action" style="visibility:hidden;">
                         <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
                             ' . trans('texts.select') . ' <span class="caret"></span>
                         </button>
                         <ul class="dropdown-menu" role="menu">
                         <li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_credit') . '</a></li>
                         <li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_credit') . '</a></li>                          
                       </ul>
                     </div>';
     })->make();
 }
开发者ID:poseidonjm,项目名称:invoice-ninja,代码行数:31,代码来源:CreditController.php

示例4: getDatatable

 /**
  * getDatatable
  */
 public function getDatatable()
 {
     $collection = Department::all();
     return Datatable::collection($collection)->showColumns('name', 'right')->orderColumns('name')->searchColumns('name')->addColumn('actions', function ($model) {
         return $str = '<button data-id="' . $model->id . '" class="btn btn-info btn-department">查看部门</button>';
     })->make();
 }
开发者ID:yanguanglan,项目名称:sz,代码行数:10,代码来源:DepartmentsController.php

示例5: getDatatable

 /**
  * getHistroy(入库历史)
  */
 public function getDatatable()
 {
     $collection = HistoryWarehouse::all();
     return Datatable::collection($collection)->showColumns('date', 'identity', 'item', 'batch', 'quantity', 'position', 'operator')->searchColumns('date')->orderColumns('date', 'identity', 'item', 'batch', 'quantity', 'position', 'operator')->addColumn('date', function ($model) {
         return date('Y-m-d H:i', strtotime($model->created_at));
     })->make();
 }
开发者ID:yanguanglan,项目名称:sz,代码行数:10,代码来源:WareHouseController.php

示例6: getClientDatatable

 public function getClientDatatable()
 {
     $search = Input::get('sSearch');
     $invitationKey = Session::get('invitation_key');
     $invitation = Invitation::where('invitation_key', '=', $invitationKey)->with('contact.client')->first();
     if (!$invitation) {
         return [];
     }
     $invoice = $invitation->invoice;
     if (!$invoice || $invoice->is_deleted) {
         return [];
     }
     $payments = $this->paymentRepo->findForContact($invitation->contact->id, Input::get('sSearch'));
     return Datatable::query($payments)->addColumn('invoice_number', function ($model) {
         return $model->invitation_key ? link_to('/view/' . $model->invitation_key, $model->invoice_number) : $model->invoice_number;
     })->addColumn('transaction_reference', function ($model) {
         return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>';
     })->addColumn('payment_type', function ($model) {
         return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : '');
     })->addColumn('amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id);
     })->addColumn('payment_date', function ($model) {
         return Utils::dateToString($model->payment_date);
     })->make();
 }
开发者ID:stewartadam,项目名称:invoice-ninja,代码行数:25,代码来源:PaymentController.php

示例7: org_list

    /**
     * This function is used to display the list of Organizations
     * @return datatable
     */
    public function org_list()
    {
        return \Datatable::collection(Organization::all())->searchColumns('name')->orderColumns('name', 'website')->addColumn('name', function ($model) {
            return $model->name;
        })->addColumn('website', function ($model) {
            $website = $model->website;
            return $website;
        })->addColumn('phone', function ($model) {
            $phone = $model->phone;
            return $phone;
        })->addColumn('Actions', function ($model) {
            //return '<a href=article/delete/ ' . $model->id . ' class="btn btn-danger btn-flat" onclick="myFunction()">Delete</a>&nbsp;<a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
            //return '<form action="article/delete/ ' . $model->id . '" method="post" onclick="alert()"><button type="sumbit" value="Delete"></button></form><a href=article/' . $model->id . '/edit class="btn btn-warning btn-flat">Edit</a>&nbsp;<a href=show/' . $model->id . ' class="btn btn-warning btn-flat">View</a>';
            return '<span  data-toggle="modal" data-target="#deletearticle' . $model->id . '"><a href="#" ><button class="btn btn-danger btn-xs"></a> ' . \Lang::get('lang.delete') . ' </button></span>&nbsp;<a href="' . route('organizations.edit', $model->id) . '" class="btn btn-warning btn-xs">' . \Lang::get('lang.edit') . '</a>&nbsp;<a href="' . route('organizations.show', $model->id) . '" class="btn btn-primary btn-xs">' . \Lang::get('lang.view') . '</a>
				<div class="modal fade" id="deletearticle' . $model->id . '">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">Are You Sure ?</h4>
                </div>
                <div class="modal-body">
                ' . $model->user_name . '
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal" id="dismis2">Close</button>
                    <a href="' . route('org.delete', $model->id) . '"><button class="btn btn-danger">delete</button></a>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>';
        })->make();
    }
开发者ID:kasirye,项目名称:faveo-helpdesk,代码行数:37,代码来源:OrganizationController.php

示例8: Create

 public static function Create($config)
 {
     if (empty($config)) {
         throw new \Exception(__CLASS__ . '. Config not found.');
     }
     $dt = Datatable::make();
     $dt->id($config['id']);
     // Table id in the DOM
     $dt->displayStart($config['display-start']);
     // DT offset parameter
     $dt->displayLength($config['display-length']);
     // DT page length parameter
     $dt->rowSourceUrl($config['row-source']);
     // DT row source URL
     $dt->columns($config['columns']);
     // DT columns
     $dt->dom($config['dom']);
     // DT dom
     $dt->name($config['name']);
     $dt->caption($config['caption']);
     $dt->icon($config['icon']);
     $dt->defaultOrder($config['default-order']);
     if ($config['custom_styles']) {
         $dt->custom_styles($config['custom_styles']);
     }
     if ($config['custom_scripts']) {
         $dt->custom_scripts($config['custom_scripts']);
     }
     return $dt;
 }
开发者ID:binaryk,项目名称:credite,代码行数:30,代码来源:Table.php

示例9: buscar_registros_dt

 public function buscar_registros_dt()
 {
     return \Datatable::query($this->repo_main->buscar_todos_dt())->addColumn('descripcion', function ($model) {
         return $model->denominacion;
     })->addColumn('esta_vigente', function ($model) {
         if ($model->esta_vigente == 1) {
             return '<i class="fa fa-check-square-o"></i>';
         } else {
             return '<i class="fa fa-square-o"></i>';
         }
     })->addColumn('nivel_nacional', function ($model) {
         if ($model->nivel_nacional == 1) {
             return '<i class="fa fa-check-square-o"></i>';
         } else {
             return '<i class="fa fa-square-o"></i>';
         }
     })->addColumn('nivel_zonal', function ($model) {
         if ($model->nivel_zonal == 1) {
             return '<i class="fa fa-check-square-o"></i>';
         } else {
             return '<i class="fa fa-square-o"></i>';
         }
     })->addColumn('nivel_distrital', function ($model) {
         if ($model->nivel_distrital == 1) {
             return '<i class="fa fa-check-square-o"></i>';
         } else {
             return '<i class="fa fa-square-o"></i>';
         }
     })->addColumn('commands', function ($model) {
         return '<div class="btn-group">' . '<a href="' . url('seguridades/roles/editar') . '/' . Crypt::encrypt($model->id_rol) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('seguridades/roles/eliminar') . '/' . Crypt::encrypt($model->id_rol) . '" class="btn btn-dark btn-xs btn-mini"><i class="fa fa-trash-o"></i></a>' . '<a href="' . url('seguridades/roles/permisos/listar') . '/' . Crypt::encrypt($model->id_rol) . '" class="btn btn-primary btn-xs btn-mini"><i class="fa fa-bars"></i> permisos</a>' . '</div>';
     })->searchColumns('denominacion', 'denominacion_visual', 'esta_vigente', 'nivel_nacional', 'nivel_zonal', 'nivel_distrital')->orderColumns('denominacion', 'denominacion_visual', 'esta_vigente', 'nivel_nacional', 'nivel_zonal', 'nivel_distrital')->make();
 }
开发者ID:eddrems,项目名称:mogac,代码行数:32,代码来源:RolesController.php

示例10: getDatatable

    public function getDatatable()
    {
        $clients = $this->clientRepo->find(Input::get('sSearch'));
        return Datatable::query($clients)->addColumn('checkbox', function ($model) {
            return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
        })->addColumn('name', function ($model) {
            return link_to('clients/' . $model->public_id, $model->name);
        })->addColumn('first_name', function ($model) {
            return link_to('clients/' . $model->public_id, $model->first_name . ' ' . $model->last_name);
        })->addColumn('email', function ($model) {
            return link_to('clients/' . $model->public_id, $model->email);
        })->addColumn('created_at', function ($model) {
            return Utils::timestampToDateString(strtotime($model->created_at));
        })->addColumn('last_login', function ($model) {
            return Utils::timestampToDateString(strtotime($model->last_login));
        })->addColumn('balance', function ($model) {
            return Utils::formatMoney($model->balance, $model->currency_id);
        })->addColumn('dropdown', function ($model) {
            return '<div class="btn-group tr-action" style="visibility:hidden;">
  							<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
    							' . trans('texts.select') . ' <span class="caret"></span>
  							</button>
  							<ul class="dropdown-menu" role="menu">
  							<li><a href="' . URL::to('clients/' . $model->public_id . '/edit') . '">' . trans('texts.edit_client') . '</a></li>
						    <li class="divider"></li>
						    <li><a href="' . URL::to('invoices/create/' . $model->public_id) . '">' . trans('texts.new_invoice') . '</a></li>						    
						    <li><a href="' . URL::to('payments/create/' . $model->public_id) . '">' . trans('texts.new_payment') . '</a></li>						    
						    <li><a href="' . URL::to('credits/create/' . $model->public_id) . '">' . trans('texts.new_credit') . '</a></li>						    
						    <li class="divider"></li>
						    <li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_client') . '</a></li>
						    <li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_client') . '</a></li>						    
						  </ul>
						</div>';
        })->make();
    }
开发者ID:poseidonjm,项目名称:invoice-ninja,代码行数:35,代码来源:ClientController.php

示例11: getDatatable

 public function getDatatable()
 {
     $products = $this->ProductRepo->find(Input::get('sSearch'));
     return Datatable::query($products)->addColumn('checkbox', function ($model) {
         return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
     })->addColumn('product_key', function ($model) {
         return link_to('products/' . $model->public_id, $model->product_key);
     })->addColumn('notes', function ($model) {
         return nl2br(Str::limit($model->notes, 50));
     })->addColumn('cost', function ($model) {
         return Utils::formatMoney($model->cost, 1);
     })->addColumn('name', function ($model) {
         return nl2br($model->category_name);
     })->addColumn('dropdown', function ($model) {
         return '<div class="btn-group tr-action" style="visibility:hidden;">
             <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
               ' . trans('texts.select') . ' <span class="caret"></span>
             </button>
             <ul class="dropdown-menu" role="menu">
             <li><a href="' . URL::to('products/' . $model->public_id) . '/edit">' . uctrans('texts.edit_product') . '</a></li>                
             <li class="divider"></li>
             <li><a href="' . URL::to('products/' . $model->public_id) . '/archive">' . uctrans('texts.delete_product') . '</a></li>
           </ul>
         </div>';
     })->make();
 }
开发者ID:aleguisf,项目名称:fvdev1,代码行数:26,代码来源:ProductController.php

示例12: getDatatable

 public function getDatatable($accountId, $clientPublicId = null, $entityType, $search)
 {
     $query = $this->getInvoices($accountId, $clientPublicId, $search)->where('invoices.is_quote', '=', $entityType == ENTITY_QUOTE ? true : false);
     $table = \Datatable::query($query);
     if (!$clientPublicId) {
         $table->addColumn('checkbox', function ($model) {
             return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
         });
     }
     $table->addColumn("invoice_number", function ($model) use($entityType) {
         return link_to("{$entityType}s/" . $model->public_id . '/edit', $model->invoice_number);
     });
     if (!$clientPublicId) {
         $table->addColumn('client_name', function ($model) {
             return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model));
         });
     }
     $table->addColumn("invoice_date", function ($model) {
         return Utils::fromSqlDate($model->invoice_date);
     })->addColumn('amount', function ($model) {
         return Utils::formatMoney($model->amount, $model->currency_id);
     });
     if ($entityType == ENTITY_INVOICE) {
         $table->addColumn('balance', function ($model) {
             return Utils::formatMoney($model->balance, $model->currency_id);
         });
     }
     return $table->addColumn('due_date', function ($model) {
         return Utils::fromSqlDate($model->due_date);
     })->addColumn('invoice_status_name', function ($model) {
         return $model->invoice_status_name;
     })->addColumn('dropdown', function ($model) use($entityType) {
         $str = '<div class="btn-group tr-action" style="visibility:hidden;">
           <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
             ' . trans('texts.select') . ' <span class="caret"></span>
           </button>
           <ul class="dropdown-menu" role="menu">
           <li><a href="' . \URL::to("{$entityType}s/" . $model->public_id . '/edit') . '">' . trans("texts.edit_{$entityType}") . '</a></li>
           <li><a href="' . \URL::to("{$entityType}s/" . $model->public_id . '/clone') . '">' . trans("texts.clone_{$entityType}") . '</a></li>
           <li class="divider"></li><li>';
         if ($entityType == ENTITY_INVOICE) {
             $str .= '<a href="' . \URL::to('payments/create/' . $model->client_public_id . '/' . $model->public_id) . '">' . trans('texts.enter_payment') . '</a></li>';
             if ($model->quote_id) {
                 $str .= '<li><a href="' . \URL::to("quotes/{$model->quote_id}/edit") . '">' . trans("texts.view_quote") . '</a></li>';
             }
         } else {
             if ($entityType == ENTITY_QUOTE) {
                 if ($model->quote_invoice_id) {
                     $str .= '<li><a href="' . \URL::to("invoices/{$model->quote_invoice_id}/edit") . '">' . trans("texts.view_invoice") . '</a></li>';
                 }
             }
         }
         return $str . '<li class="divider"></li>
           <li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans("texts.archive_{$entityType}") . '</a></li>
           <li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans("texts.delete_{$entityType}") . '</a></li>               
         </ul>
       </div>';
     })->make();
 }
开发者ID:poseidonjm,项目名称:invoice-ninja,代码行数:59,代码来源:InvoiceRepository.php

示例13: buscar_registros_dt

 public function buscar_registros_dt($id_proceso)
 {
     return \Datatable::query($this->repo_main->buscar_todos_dt(Crypt::decrypt($id_proceso)))->addColumn('nombre', function ($model) {
         return $model->nombre;
     })->addColumn('commands', function ($model) {
         return '<div class="btn-group">' . '<a href="' . url('catalogos/procesos_ac/requisitos/editar') . '/' . Crypt::encrypt($model->id_requisitos) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('catalogos/procesos_ac/requisitos/eliminar') . '/' . Crypt::encrypt($model->id_requisitos) . '" class="btn btn-danger btn-xs btn-mini"><i class="fa fa-trash-o"></i></a>' . '</div>';
     })->searchColumns('id_proceso', 'nombre', 'observaciones')->orderColumns('id_proceso', 'nombre', 'observaciones')->make();
 }
开发者ID:eddrems,项目名称:mogac,代码行数:8,代码来源:AtencionCiudadanaProcesosReuqerimientosController.php

示例14: buscar_registros_dt

 public function buscar_registros_dt()
 {
     return \Datatable::query($this->repo_servicios->buscar_todos_dt())->addColumn('denominacion', function ($model) {
         return $model->denominacion;
     })->addColumn('commands', function ($model) {
         return '<div class="btn-group">' . '<a href="' . url('catalogos/servicios_ac/editar') . '/' . Crypt::encrypt($model->id_servicio) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('catalogos/servicios_ac/eliminar') . '/' . Crypt::encrypt($model->id_servicio) . '" class="btn btn-dark btn-xs btn-mini"><i class="fa fa-trash-o"></i></a>&nbsp;' . '</div>';
     })->searchColumns('denominacion')->orderColumns('denominacion')->make();
 }
开发者ID:eddrems,项目名称:mogac,代码行数:8,代码来源:AtencionCiudadanaServiciosController.php

示例15: getBannerstatistics

 /**
  * Another example method that returns a data table.
  * @param int    $idSite
  * @param string $period
  * @param string $date
  * @param bool|string $segment
  * @return DataTable
  */
 public function getBannerstatistics($idSite, $period, $date, $segment = false, $idSubtable = false, $filter_limit = 10, $filter_sort_column = 'impressions', $filter_sort_order = 'desc', $filter_pattern = null)
 {
     $params = array('idSite' => $idSite, 'period' => $period, 'date' => $date, 'segment' => $segment, 'filter_limit' => $filter_limit, 'filter_sort_column' => $filter_sort_column, 'filter_sort_order' => $filter_sort_order, 'filter_pattern' => $filter_pattern);
     if ($idSubtable) {
         return $this->bannerStats($idSubtable, $params);
     }
     $contentNames = \Piwik\API\Request::processRequest('Contents.getContentNames', $params);
     $bannerTable = new Datatable();
     //$period = $dataTable->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX);
     //$bannerTable->setMetadataValues($contentNames->getAllTableMetadata());
     foreach ($contentNames->getRows() as $contentName) {
         $bannerName = $contentName->getColumn('label');
         $row = new Row(array(Row::COLUMNS => array('Name' => $bannerName, 'Visits' => $contentName->getColumn('nb_visits'), 'Impressions' => $contentName->getColumn('nb_impressions'), 'Interactions' => $contentName->getColumn('nb_interactions'), 'Conversion rate' => $contentName->getColumn('interaction_rate')), Row::DATATABLE_ASSOCIATED => $bannerName));
         $bannerTable->addRow($row);
     }
     return $bannerTable;
 }
开发者ID:ronaldbaltus,项目名称:VPSCashPiwikBannerPlugin,代码行数:25,代码来源:API.php


注:本文中的Datatable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。