admin.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * This is the template for generating the admin view for crud.
  4. * The following variables are available in this template:
  5. * - $ID: the primary key name
  6. * - $modelClass: the model class name
  7. * - $columns: a list of column schema objects
  8. */
  9. ?>
  10. <?php
  11. echo "<?php\n";
  12. $label=$this->class2name($modelClass,true);
  13. echo "\$this->breadcrumbs=array(
  14. '$label'=>array('index'),
  15. 'Manage',
  16. );\n";
  17. ?>
  18. $this->menu=array(
  19. array('label'=>'List <?php echo $modelClass; ?>', 'url'=>array('index')),
  20. array('label'=>'Create <?php echo $modelClass; ?>', 'url'=>array('create')),
  21. );
  22. Yii::app()->clientScript->registerScript('search', "
  23. $('.search-button').click(function(){
  24. $('.search-form').toggle();
  25. return false;
  26. });
  27. $('.search-form form').submit(function(){
  28. $('#<?php echo $this->class2id($modelClass); ?>-grid').yiiGridView('update', {
  29. data: $(this).serialize()
  30. });
  31. return false;
  32. });
  33. ");
  34. ?>
  35. <h1>Manage <?php echo $this->class2name($modelClass,true); ?></h1>
  36. <p>
  37. You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
  38. or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
  39. </p>
  40. <?php echo "<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>"; ?>
  41. <div class="search-form" style="display:none">
  42. <?php echo "<?php \$this->renderPartial('_search',array(
  43. 'model'=>\$model,
  44. )); ?>\n"; ?>
  45. </div><!-- search-form -->
  46. <?php echo "<?php"; ?> $this->widget('zii.widgets.grid.CGridView', array(
  47. 'id'=>'<?php echo $this->class2id($modelClass); ?>-grid',
  48. 'dataProvider'=>$model->search(),
  49. 'filter'=>$model,
  50. 'columns'=>array(
  51. <?php
  52. $count=0;
  53. foreach($columns as $column)
  54. {
  55. if(++$count==7)
  56. echo "\t\t/*\n";
  57. echo "\t\t'".$column->name."',\n";
  58. }
  59. if($count>=7)
  60. echo "\t\t*/\n";
  61. ?>
  62. array(
  63. 'class'=>'CButtonColumn',
  64. ),
  65. ),
  66. )); ?>