[ Index ]
 

Code source de CakePHP 1.1.13.4450

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/cake/libs/view/templates/scaffolds/ -> index.thtml (source)

   1  <?php
   2  /* SVN FILE: $Id: index.thtml 4409 2007-02-02 13:20:59Z phpnut $ */
   3  /**
   4   *
   5   * PHP versions 4 and 5
   6   *
   7   * CakePHP(tm) :  Rapid Development Framework <http://www.cakephp.org/>
   8   * Copyright 2005-2007, Cake Software Foundation, Inc.
   9   *                                1785 E. Sahara Avenue, Suite 490-204
  10   *                                Las Vegas, Nevada 89104
  11   *
  12   * Licensed under The MIT License
  13   * Redistributions of files must retain the above copyright notice.
  14   *
  15   * @filesource
  16   * @copyright        Copyright 2005-2007, Cake Software Foundation, Inc.
  17   * @link                http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
  18   * @package            cake
  19   * @subpackage        cake.cake.libs.view.templates.scaffolds
  20   * @since            CakePHP(tm) v 0.10.0.1076
  21   * @version            $Revision: 4409 $
  22   * @modifiedby        $LastChangedBy: phpnut $
  23   * @lastmodified    $Date: 2007-02-02 07:20:59 -0600 (Fri, 02 Feb 2007) $
  24   * @license            http://www.opensource.org/licenses/mit-license.php The MIT License
  25   */
  26  ?>
  27  <h1>List <?php echo Inflector::humanize($this->name)?></h1>
  28  <?php
  29  $model = ucwords(Inflector::singularize($this->name));
  30  $modelKey = $model;
  31  $humanName = Inflector::humanize($this->name);
  32  $humanSingularName = Inflector::singularize( $humanName );
  33  if(is_null($this->plugin)) {
  34      $path = '/';
  35  } else {
  36      $path = '/'.$this->plugin.'/';
  37  }
  38  if(!empty($this->controller->{$model}->alias)) {
  39      foreach ($this->controller->{$model}->alias as $key => $value) {
  40          $alias[] = $key;
  41      }
  42  }?>
  43  <table class="inav" cellpadding="0" cellspacing="0">
  44  <thead>
  45  <tr>
  46  <?php
  47  foreach ($fieldNames as $fieldName) {?>
  48      <th><?php echo $fieldName['prompt'];?></th>
  49  <?php }?>
  50  <th>Actions</th>
  51  </tr>
  52  </thead>
  53  <tbody>
  54  <?php
  55  $iRowIndex = 0;
  56  if(is_array($data)) {
  57      foreach ($data as $row) {
  58          if($iRowIndex++ % 2 == 0) {
  59              echo "<tr>";
  60          } else {
  61              echo "<tr class='altRow'>";
  62          }
  63          $count = 0;
  64          foreach($fieldNames as $field=>$value) { ?>
  65              <td>
  66  <?php
  67              if(isset($value['foreignKey'])) {
  68                  $otherModelKey = Inflector::underscore($value['modelKey']);
  69                  $otherControllerName = $value['controller'];
  70                  $otherModelObject =& ClassRegistry::getObject( $otherModelKey );
  71                  if(is_object($otherModelObject)) {
  72                      $displayText = $row[$alias[$count]][ $otherModelObject->getDisplayField() ];
  73                  } else {
  74                      $displayText = $row[$alias[$count]][$field];
  75                  }
  76                  echo $html->link( $displayText, $path.Inflector::underscore($otherControllerName)."/view/".$row[$modelKey][$field] );
  77                  $count++;
  78              } else {
  79                  echo $row[$modelKey][$field];
  80              }?>
  81              </td>
  82  <?php } ?>
  83          <td class="listactions"><?php echo $html->link('View',$path.$this->viewPath."/view/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
  84              <?php echo $html->link('Edit',$path.$this->viewPath."/edit/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
  85              <?php echo $html->link('Delete',$path.$this->viewPath."/delete/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/", null, 'Are you sure you want to delete id '.$row[$modelKey][$this->controller->{$model}->primaryKey].' ?')?>
  86          </td>
  87          </tr>
  88  <?php
  89      }
  90  }?>
  91  </tbody>
  92  </table>
  93  <ul class="actions">
  94      <li><?php echo $html->link('New '.$humanSingularName, $path.$this->viewPath.'/add'); ?></li>
  95  </ul>


Généré le : Sun Feb 25 19:27:47 2007 par Balluche grâce à PHPXref 0.7