| | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot |
Structures_DataGrid_Renderer_FlexyStructures_DataGrid_Renderer_Flexy – Flexy レンダリングドライバ
注意このドライバは 実験的な もので、まだ正式にはリリースされていません。 CVS 版 でしか使用できません。 サポートする操作モードこのドライバは次の操作モードをサポートしています。
オプションこのドライバは、以下のオプションを受け付けます。
全般的な注意このドライバは render() メソッドをサポートしていません。 コンテナを現在の Flexy インスタンスにアタッチすることのみが可能となっています。 レンダラに対するオプションは setOptions() メソッドで渡さなければなりません。 Flexy の出力のバッファリングには、DataGrid の getOutput() メソッドを使用します。 このドライバは、次のような Flexy テンプレート変数を代入します。 - columnSet: カラムのラベルおよび並べ替えリンクの配列 - columnHeader: カラムのラベルおよび並べ替えリンクのオブジェクト - recordSet: レコードの値を表す連想配列 - numberedSet: レコードの値を表す数値添字配列 - currentPage: 現在のページ (1 から数えます) - recordLimit: 1 ページあたりの行数 - pagesNum: ページ数 - columnsNum: カラム数 - recordsNum: 現在のページのレコード数 - totalRecordsNum: レコードの総数 - firstRecord: 最初のレコードの番号 (1 から数えます) - lastRecord: 最後のレコードの番号 (1 から数えます) このドライバは、getPaging という名前の Smarty カスタム関数も登録します。 これは Smarty テンプレート内で {getPaging} としてコール可能で、 ページ処理用のリンクを表示します。この関数は、Pager::factory() と同じ形式のオプションをパラメータとして受け付けます。 動的なテンプレートの例です。並べ替えおよびページ処理を含みます。
<!-- カスタム関数 getPaging でページ移動リンクを表示します -->
{getPaging():h}
<p>Showing records {firstRecord} to {lastRecord}
from {totalRecordsNum}, page {currentPage} of {pagesNum}</p>
<table cellspacing="0">
<!-- ヘッダを作成します -->
<tr>
<th>
{foreach:columnSet,column}
<td><a href="{column[link]:h}">{column[label]:h}</a></td>
{end:}
</th>
</tr>
<!-- 本体を作成します -->
<tr class="{getRowCSS()}" flexy:foreach="numberedSet,k,row">
{foreach:row,field}
<td>{field}</td>
{end:}
</tr>
</table>
静的なテンプレートの例です。並べ替えおよびページ処理を含みます。
<table cellspacing="0">
<!-- ヘッダを作成します -->
<tr>
<th>
<td>
<a href="{columnHeader.name[link]:h}">{columnHeader.field1[label]:h}</a>
</td>
<td>
<a href="{columnHeader.surname[link]:h}">{columnHeader.field2[label]:h}</a>
</td>
</th>
</tr>
<!-- 本体を作成します -->
<tr class="{getRowCSS()}" flexy:foreach="recordSet,k,row">
<td>{row[field1]}</td>
<td>{row[field2]}</td>
</tr>
</table>
require_once 'HTML/Template/Flexy.php';
require_once 'Structures/DataGrid.php';
require_once 'Structures/DataGrid/Renderer/Flexy.php';
$tpl = new HTML_Template_Flexy($config['HTML_Template_Flexy']);
$dg =& new Structures_DataGrid($_GET['setPerPage'] ? $_GET['setPerPage']
: 10,$_GET['page']
? $_GET['page'] : 1);
$dg->bind($dataObject);
$renderer = new Structures_DataGrid_Renderer_Flexy();
$renderer->setContainer($tpl);
$renderer->setOptions($config['Structures_DataGrid']);
$dg->attachRenderer($renderer);
$this->tpl->compile($template);
echo $dg->getOutput();
|
|
各種マニュアル:
PHPマニュアル |
PEARマニュアル |
Smarty(英語)マニュアル |
PHP-GTKマニュアル |
「Structures_DataGrid_Renderer_Flexy」をGoogle検索
|