Пример #1
0
 public function initialize()
 {
     $type = new Select('type', Publication::$types, array());
     $type->setLabel('Тип пубикации');
     $this->add($type);
     $title = new Text('title', array('required' => true));
     $title->setLabel('Название');
     $this->add($title);
     $slug = new Text('slug');
     $slug->setLabel('Транслитерация');
     $this->add($slug);
     $date = new Text('date');
     $date->setLabel('Дата публикации');
     $this->add($date);
     $text = new TextArea('text');
     $text->setLabel('Текст');
     $this->add($text);
     $meta_title = new Text('meta_title', array('required' => true));
     $meta_title->setLabel('meta-title');
     $this->add($meta_title);
     $meta_description = new TextArea('meta_description');
     $meta_description->setLabel('meta-description');
     $this->add($meta_description);
     $meta_keywords = new TextArea('meta_keywords');
     $meta_keywords->setLabel('meta-keywords');
     $this->add($meta_keywords);
     $preview_inner = new Check('preview_inner');
     $preview_inner->setLabel('Превью внутри публикации');
     $preview_inner->setDefault(1);
     $this->add($preview_inner);
     $image = new File('image');
     $image->setLabel('Загрузить превью');
     $this->add($image);
 }
Пример #2
0
 public function initialize()
 {
     $title = new Text('title', array('required' => true));
     $title->setLabel('Название объекта');
     $this->add($title);
     $location = new Text('location', array('required' => true));
     $location->setLabel('Расположение, адрес');
     $this->add($location);
     $description = new TextArea('description');
     $description->setLabel('Описание, системы');
     $this->add($description);
     $visible = new Check('visible');
     $visible->setLabel('Отображать');
     $visible->setDefault(1);
     $this->add($visible);
     $sortorder = new Text('sortorder');
     $sortorder->setLabel('Сортировка');
     $this->add($sortorder);
     $image = new File('image');
     $image->setLabel('Загрузить изображение');
     $this->add($image);
 }
Пример #3
0
 public function initialize($entity = null, $options = null)
 {
     //In edition the id is hidden
     if (isset($options['edit']) && $options['edit']) {
         $id = new Hidden('id');
     } else {
         $id = new Text('id');
     }
     $this->add($id);
     $fileCaption = new Text('fileCaption', array('placeholder' => $this->request->getPost('fileCaption')));
     $fileCaption->setLabel(_('Caption'));
     $fileCaption->addValidators(array(new PresenceOf(array('message' => _('Document caption not null')))));
     $this->add($fileCaption);
     $fileData = new File('fileData');
     $fileData->setLabel('Document upload');
     /*$fileData->addValidators(array(
     			new PresenceOf(array(
     				'message' =>_('Document file required')
     				))
     		));*/
     $this->add($fileData);
     //render if action is edit
     $fileDataEdit = new File('fileDataEdit');
     $fileDataEdit->setLabel('Document upload');
     /*$fileData->addValidators(array(
     			new PresenceOf(array(
     				'message' =>_('Document file required')
     				))
     		));*/
     $this->add($fileDataEdit);
     $categories = new Select('categoriesId', Categories::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '----', 'emptyValue' => ''));
     $categories->setLabel('Categories');
     $this->add($categories);
     $description = new TextArea('description', array('placeholder' => ' Enter text ...', 'class' => 'span8', 'rows' => '6'));
     $description->addValidator(new PresenceOf(array('message' => _('The description is required'))));
     $description->setLabel('Description');
     $this->add($description);
     $this->add(new Text('q', array('placeholder' => $this->request->getPost('q', 'striptags'))));
 }
Пример #4
0
 public function initialize($entity = null, $options = array())
 {
     if (!isset($options['edit'])) {
         $element = new Text("id");
         $this->add($element->setLabel("Id"));
     } else {
         $this->add(new Hidden("id"));
     }
     $name = new Text("name");
     $name->addValidator(new PresenceOf(array('message' => 'The name is required')));
     $name->setLabel("名称");
     $this->add($name);
     $category = new Select('category_id', Category::find("isParent=0 and status=1"), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...', 'emptyValue' => ''));
     $category->setLabel('类型');
     $this->add($category);
     $country = new Select('country_id', Country::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...', 'emptyValue' => ''));
     $country->setLabel('国家');
     $this->add($country);
     $price = new Text("price");
     $price->setLabel("价格");
     $this->add($price);
     $stock = new Text("stock");
     $stock->setLabel("库存");
     $this->add($stock);
     $color = new Text("color");
     $color->addValidator(new PresenceOf(array('message' => 'The color is required')));
     $color->setLabel("颜色");
     $this->add($color);
     $size = new Text("size");
     $size->addValidator(new PresenceOf(array('message' => 'The size is required')));
     $size->setLabel("尺码");
     $this->add($size);
     $covImg = new File("covImg");
     $covImg->setLabel("主图");
     $this->add($covImg);
 }