本文整理汇总了PHP中SiteHelpers::gridDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP SiteHelpers::gridDisplay方法的具体用法?PHP SiteHelpers::gridDisplay怎么用?PHP SiteHelpers::gridDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SiteHelpers
的用法示例。
在下文中一共展示了SiteHelpers::gridDisplay方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download
function download()
{
$info = $this->model->makeInfo($this->module);
// Take param master detail if any
$results = $this->model->getRows(array());
$fields = $info['config']['grid'];
$rows = $results['rows'];
$content = $this->data['pageTitle'];
$content .= '<table border="1">';
$content .= '<tr>';
foreach ($fields as $f) {
if ($f['download'] == '1') {
$content .= '<th style="background:#f9f9f9;">' . $f['label'] . '</th>';
}
}
$content .= '</tr>';
foreach ($rows as $row) {
$content .= '<tr>';
foreach ($fields as $f) {
if ($f['download'] == '1') {
$conn = isset($f['conn']) ? $f['conn'] : array();
$content .= '<td>' . SiteHelpers::gridDisplay($row->{$f}['field'], $f['field'], $conn) . '</td>';
}
}
$content .= '</tr>';
}
$content .= '</table>';
@header('Content-Type: application/ms-excel');
@header('Content-Length: ' . strlen($content));
@header('Content-disposition: inline; filename="' . $title . ' ' . date("d/m/Y") . '.xls"');
echo $content;
exit;
}
示例2: index
public function index(Request $request)
{
$check = self::authentication($request);
if (is_array($check)) {
return \Response::json($check);
} else {
$class = ucwords($request->input('module'));
$config = $this->model->makeInfo($class);
$tables = $config['config']['grid'];
$page = (!is_null($request->input('page')) or $request->input('page') != 0) ? $request->input('page') : 1;
$param = array('page' => $page, 'sort' => '', 'order' => 'asc', 'limit' => '');
if (!is_null($request->input('limit')) or $request->input('limit') != 0) {
$param['limit'] = $request->input('limit');
}
if (!is_null($request->input('order'))) {
$param['order'] = $request->input('order');
}
if (!is_null($request->input('sort'))) {
$param['sort'] = $request->input('sort');
}
$results = $this->model->getRows($param);
$json = array();
foreach ($results['rows'] as $row) {
$rows = array();
foreach ($tables as $table) {
$conn = isset($table['conn']) ? $table['conn'] : array();
$rows[$table['field']] = \SiteHelpers::gridDisplay($row->{$table}['field'], $table['field'], $conn);
//$rows[$table['field']] = '';
}
$json[] = $rows;
}
$jsonData = array('total' => $results['total'], 'rows' => $json, 'control' => $param, 'key' => $config['key']);
if (!is_null($request->input('option')) && $request->input('option') == 'true') {
$label = array();
foreach ($tables as $table) {
$label[] = $table['label'];
}
$field = array();
foreach ($tables as $table) {
$field[] = $table['field'];
}
$jsonData['option'] = array('label' => $label, 'field' => $field);
}
return \Response::json($jsonData, 200);
}
}
示例3: getDownload
function getDownload()
{
if ($this->access['is_excel'] == 0) {
return Redirect::to('')->with('message', SiteHelpers::alert('error', Lang::get('core.note_restric')));
}
$info = $this->model->makeInfo($this->module);
// Take param master detail if any
$filter = !is_null(Input::get('search')) ? $this->buildSearch() : '';
$master = $this->buildMasterDetail();
$filter .= $master['masterFilter'];
$masterParam = $this->masterDetailParam();
$params = array('params' => $filter);
$results = $this->model->getRows($params);
$fields = $info['config']['grid'];
$rows = $results['rows'];
$content = $this->data['pageTitle'];
$content .= '<table border="1">';
$content .= '<tr>';
foreach ($fields as $f) {
if ($f['download'] == '1') {
$content .= '<th style="background:#f9f9f9;">' . $f['label'] . '</th>';
}
}
$content .= '</tr>';
foreach ($rows as $row) {
$content .= '<tr>';
foreach ($fields as $f) {
if ($f['download'] == '1') {
$conn = isset($f['conn']) ? $f['conn'] : array();
$content .= '<td>' . SiteHelpers::gridDisplay($row->{$f}['field'], $f['field'], $conn) . '</td>';
}
}
$content .= '</tr>';
}
$content .= '</table>';
@header('Content-Type: application/ms-excel');
@header('Content-Length: ' . strlen($content));
@header('Content-disposition: inline; filename="' . $title . ' ' . date("d/m/Y") . '.xls"');
echo $content;
exit;
//return View::make('excel',$this->data);
}
示例4: isset
@endif
@endforeach
<th width="75">{{ Lang::get('core.btn_action') }}</th>
</tr>
</thead>
<tbody>
@foreach ($rowData as $r)
<tr>
<td width="50"> {{ ++$i}}</td>
@foreach ($tableGrid as $field)
@if($field['view'] =='1')
<td>
<?php
$conn = isset($field['conn']) ? $field['conn'] : array();
//echo SiteHelpers::gridDisplay($r->$field['field'], $r , $field['attribute'],$conn);
echo SiteHelpers::gridDisplay($r->{$field}['field'], $field['field'], $conn);
?>
</td>
@endif
@endforeach
<td>
{{--*/ $id = $r->$key /*--}}
<a href="?task=view&id={{ $id }}" class="tips btn btn-xs btn-primary" title="{{ Lang::get('core.btn_view') }}"><i class="fa fa-search"></i> </a>
</td>
</tr>
@endforeach
</tbody>
示例5: header
<?php
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=' . $title . ' ' . date("d/m/Y") . '.csv');
// create a file pointer connected to the output stream
$fp = fopen('php://output', 'w');
// loop over the rows, outputting them
foreach ($rows as $row) {
$content = array();
foreach ($fields as $f) {
if ($f['download'] == '1') {
$conn = isset($f['conn']) ? $f['conn'] : array();
$content[] = SiteHelpers::gridDisplay($row->{$f}['field'], $f['field'], $conn);
}
}
fputcsv($fp, $content);
}
fclose($fp);
exit;