Exemple #1
0
 /**
  * Test data definition method
  */
 function testDataDefinition()
 {
     $dataset1 = array('object1' => array('name' => 'Bob'), 'object2' => array('name' => 'Ben'));
     $dataset2 = array('object3' => array('name' => 'Bud'));
     $SUT = new Grid();
     $SUT->column()->field('name')->title('Name');
     $SUT->data($dataset1);
     $grid = $SUT->render();
     $this->assertRegExp('/Bob/', $grid);
     $this->assertNotRegExp('/Bud/', $grid);
     $SUT->data($dataset2);
     $grid = $SUT->__tostring();
     $this->assertRegExp('/Ben/', $grid);
     $this->assertRegExp('/Bud/', $grid);
 }
<h2><?php 
echo __(':dir directory', array(':dir' => $folder));
?>
 
	<small>
		<?php 
echo HTML::anchor(Route::get('admin/resource')->uri(array('action' => 'create', 'path' => $folder->parent . '/' . $folder->name)), 'Create Folder');
?>
		<?php 
echo HTML::anchor(Route::get('admin/resource')->uri(array('action' => 'upload', 'path' => $folder->parent . '/' . $folder->name)), 'Upload File');
?>
	</small>
</h2>

<?php 
// Create directory listing
$grid = new Grid();
$grid->column('action')->field('path')->title('File/Folder Name')->text('{name}')->route(Route::get('admin/resource'))->params(array('action' => 'read'))->param('path');
$grid->column()->field('size')->title('Size');
$grid->column()->field('date')->title('Date Modified');
$grid->column('action')->field('path')->title('Actions')->text('Delete')->class('delete')->route(Route::get('admin/resource'))->params(array('action' => 'delete'))->param('path');
$grid->data($folder->folders);
$grid->data($folder->files);
echo $grid->render();
Exemple #3
0
<h2><?php 
echo __('":title" History', array(':title' => $page->title));
?>
	<small><?php 
echo HTML::anchor(Request::$current->uri(array('action' => 'list')), 'back');
?>
</small>
</h2>
<?php 
echo form::open();
echo '<p class="submit">';
echo Form::submit('submit', __('View Diff'));
echo '</p>';
// Create revision list
$grid = new Grid();
$grid->column('radio')->field('version')->title('Version 1')->name('ver1');
$grid->column('radio')->field('version')->title('Version 2')->name('ver2');
$grid->column()->field('version')->title('Revision');
$grid->column()->field('editor')->title('Editor');
$grid->column('date')->field('date')->title('Date');
$grid->column()->field('comments')->title('Comments');
$grid->data($revisions);
echo $grid;
echo form::close();
Exemple #4
0
<h2><?php 
echo __('Users List');
?>
</h2>

<?php 
if (count($users) == 0) {
    ?>
<p>
	There are no users at this time
	(<?php 
    echo HTML::anchor(Route::$current->uri(array('action' => 'new')), 'create one');
    ?>
).
</p>
<?php 
} else {
    // Create user list
    $grid = new Grid();
    $grid->column()->field('id')->title('ID');
    $grid->column('action')->title('Username')->text('{username}')->route(Route::get('admin'))->params(array('controller' => 'users', 'action' => 'view'));
    $grid->column()->field('role')->title('Role');
    $grid->column()->field('email')->title('Email');
    $grid->column('action')->title('Actions')->text('Edit')->class('edit')->route(Route::get('admin'))->params(array('controller' => 'users', 'action' => 'edit'));
    $grid->column('action')->title('')->text('Delete')->class('delete')->route(Route::get('admin'))->params(array('controller' => 'users', 'action' => 'delete'));
    $grid->data($users);
    echo $grid;
}
<h2><?php 
echo __('Tag List');
?>
</h2>

<?php 
if (count($tags) == 0) {
    ?>
<p>
	There are no tags at this time
	(<?php 
    echo HTML::anchor($request->uri(array('action' => 'new')), 'create one');
    ?>
).
</p>
<?php 
} else {
    // Create tag list
    $grid = new Grid();
    $grid->column()->field('id')->title('ID');
    $grid->column()->field('name')->title('Name');
    $grid->column('action')->title('Actions')->text('Edit')->class('edit')->route($request)->params(array('action' => 'edit'));
    $grid->column('action')->title('')->text('Delete')->class('delete')->route($request)->params(array('action' => 'delete'));
    $grid->data($tags);
    echo $grid->render();
}
<h2><?php 
echo $legend;
?>
</h2>
<?php 
if (count($articles) == 0) {
    ?>
<p>
	There are no posts as this time
	(<?php 
    echo HTML::anchor(Route::$current->uri(array('action' => 'new')), 'create one');
    ?>
).
</p>
<?php 
} else {
    // Create article list
    $grid = new Grid();
    $grid->column()->field('id')->title('ID');
    $grid->column()->field('title')->title('Title');
    $grid->column()->field('state')->title('State');
    $grid->column('action')->title('Actions')->text('Edit')->class('edit')->route($request)->params(array('action' => 'edit'));
    $grid->column('action')->title('')->text('History')->class('history')->route($request)->params(array('action' => 'history'));
    $grid->data($articles);
    echo $pagination;
    echo $grid->render();
    echo $pagination;
}
Exemple #7
0
<h2><?php 
echo __('Page List');
?>
</h2>

<?php 
if (count($pages) == 0) {
    ?>
<p>
	There are no pages at this time
	(<?php 
    echo HTML::anchor(Route::$current->uri(array('action' => 'new')), 'create one');
    ?>
).
</p>
<?php 
} else {
    // Create page list
    $grid = new Grid();
    $grid->column()->field('id')->title('ID');
    $grid->column()->field('title')->title('Title');
    $grid->column()->field('version')->title('Ver');
    $grid->column('action')->title('Actions')->text('Edit')->class('edit')->route(Route::get('admin/cms'))->params(array('action' => 'edit'));
    $grid->column('action')->title('')->text('History')->class('history')->route(Route::get('admin/cms'))->params(array('action' => 'history'));
    $grid->data($pages);
    echo $grid;
}