Пример #1
0
 /**
  * Generates grid table colums head
  *
  * @param \Engine\Crud\Grid $grid
  * @return string
  */
 public static function _(Grid $grid)
 {
     $code = '
         <thead>
             <tr>';
     foreach ($grid->getFields() as $column) {
         if ($column instanceof Field) {
             $columnCode = '
             <th width="' . $column->getWidth() . '">';
             if ($column->isSortable()) {
                 $columnCode .= self::sortLink($column);
             } elseif ($column->isHidden()) {
                 $columnCode .= '';
             } else {
                 $columnCode .= $column->getTitle();
             }
         } else {
             $columnCode = '
             <th>';
         }
         $columnCode .= '
             </th>';
         $code .= $columnCode;
     }
     $code .= '
             </tr>
         </thead>';
     return $code;
 }