view.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * This is the template for generating the 'view' 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. $nameColumn=$this->guessNameColumn($columns);
  13. $label=$this->class2name($modelClass,true);
  14. echo "\$this->breadcrumbs=array(
  15. '$label'=>array('index'),
  16. \$model->{$nameColumn},
  17. );\n";
  18. ?>
  19. $this->menu=array(
  20. array('label'=>'List <?php echo $modelClass; ?>', 'url'=>array('index')),
  21. array('label'=>'Create <?php echo $modelClass; ?>', 'url'=>array('create')),
  22. array('label'=>'Update <?php echo $modelClass; ?>', 'url'=>array('update', 'id'=>$model-><?php echo $ID; ?>)),
  23. array('label'=>'Delete <?php echo $modelClass; ?>', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model-><?php echo $ID; ?>),'confirm'=>Yii::t('zii','Are you sure you want to delete this item?'))),
  24. array('label'=>'Manage <?php echo $modelClass; ?>', 'url'=>array('admin')),
  25. );
  26. ?>
  27. <h1>View <?php echo $modelClass." #<?php echo \$model->{$ID}; ?>"; ?></h1>
  28. <?php echo "<?php"; ?> $this->widget('zii.widgets.CDetailView', array(
  29. 'data'=>$model,
  30. 'attributes'=>array(
  31. <?php
  32. foreach($columns as $column)
  33. echo "\t\t'".$column->name."',\n";
  34. ?>
  35. ),
  36. )); ?>