_grid.php 2.02 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
<?php
/**
 * The following variables are available in this template:
 * - $this: the CrudCode object
 */
?>
<?php echo '<?php'; ?> $provider = $model->search(); ?>
<div class="inner" id="<?php echo $this->class2id($this->modelClass); ?>-grid-inner">
	<?php echo '<?php'; ?> $this->widget('zii.widgets.grid.CGridView', array(
		'id' => '<?php echo $this->class2id($this->modelClass); ?>-grid',
		'summaryText' => '<?php echo $this->pluralize($this->class2name($this->modelClass)); ?> {start} - {end} of {count}',
		'emptyText' => 'There are no data to display',
		'updateSelector' => '#<?php echo $this->class2id($this->modelClass); ?>-grid-actions .pagination a, #<?php echo $this->class2id($this->modelClass); ?>-grid .table thead th a',
		'afterAjaxUpdate' => "js:function(id, data){var id = '#' + id + '-actions'; \$(id).replaceWith(\$(id, '<div>' + data + '</div>'))}",
		'selectableRows' => 0,
		'showTableOnEmpty' => false,
		'dataProvider' => $provider,
		'cssFile' => false,
		'itemsCssClass' => 'table',
		'pagerCssClass' => 'pagination',
		'template' => '{items}',
		'columns' => array(
<?php
$count = 0;
foreach ($this->tableSchema->columns as $column)
{
	if (++$count == 7)
	{
		echo "\t\t\t/*\n";
	}
	echo "\t\t\t'" . $column->name . "',\n";
}
if ($count >= 7)
{
	echo "\t\t\t*/\n";
}
?>
			array(
				'class' => 'EButtonColumn',
				'deleteConfirmation' => 'Do you really want to delete this <?php echo strtolower($this->class2name($this->modelClass)); ?>?',
			),
		),
	)); ?>
	<div class="actions-bar wat-cf" id="<?php echo $this->class2id($this->modelClass); ?>-grid-actions">
		<div class="actions">
			<button class="button action-create" type="button">
				<?php echo '<?php'; ?> echo CHtml::image(Yii::app()->request->baseUrl . '/images/create.png', 'Create'); ?> Create <?php echo strtolower($this->class2name($this->modelClass)) . "\n"; ?>
			</button>
		</div>
		<?php echo '<?php'; ?> $this->widget('application.components.widgets.ELinkPager', array(
			'cssFile' => false,
			'pages' => $provider->getPagination(),
		)); ?>
	</div>
</div>