Example #1
0
 protected static function actionDefault()
 {
     // Получение списка товаров
     $products = new Collection('Product', 1);
     $products->link('category');
     $products->link('brand');
     $products->link('cover');
     $products->order('`add` DESC');
     $list = new TemplateList();
     $list->fields = array('id' => array('type' => 'id', 'title' => 'Номер'), 'cover->file' => array('type' => 'image', 'title' => 'Изображение', 'directory' => 'products', 'size' => '85x84'), 'name' => array('type' => 'text', 'title' => 'Название'), 'category->name' => array('type' => 'text', 'title' => 'Категория'), 'brand->name' => array('type' => 'text', 'title' => 'Производитель'), 'price' => array('type' => 'text', 'title' => 'Цена'), 'active' => array('type' => 'active', 'title' => 'Вкл/Выкл', 'action' => 'active', 'controller' => 'admin-products'));
     $list->itemActions = array('edit' => array('hint' => 'Изменить', 'icon' => 'edit', 'controller' => 'admin-products'), 'delete' => array('hint' => 'Удалить', 'icon' => 'delete', 'controller' => 'admin-products'));
     $list->actions = array('new' => array('hint' => 'Добавить', 'icon' => 'add', 'controller' => 'AdminProducts'));
     $list->items = Model::setModelsAutoload($products->items(), false, true);
     $list->classes = 'center-list';
     self::templateVar('title', App::t('Товары'));
     self::templateVar('content', $list);
     return self::displayPage('admin');
 }