Esempio n. 1
0
 private function formNewEditFields(AppForm $form)
 {
     $form->addGroup('Content')->setOption('container', Html::el('fieldset')->id('contents'));
     $form->addText('title', 'Title')->addRule(Form::FILLED, 'Fill title');
     $form->addTextarea('content', 'Text');
     $templates = $this->model('contentTemplates')->get('page');
     $form->addGroup('Properties')->setOption('container', Html::el('fieldset')->id('properties'));
     $categories = $this->model('categories')->getPairs();
     $categories = array('0' => 'none') + $categories;
     $form->addSelect('category', 'Category', $categories);
     $form->addCheckBox('homepage', 'Set as homepage?');
     $form->addSelect('template', 'Template', $templates);
     $form->addCheckBox('has_widgets', 'Has widgets');
     $form->addText('publish_time', 'Publish time');
     //$form->addText('time', '');
     $form->addText('keywords', 'keywords');
     $form->addTextarea('description', 'description');
     $form->addHidden('content_type')->setValue('page');
     if ($form->name == 'formNewPage') {
         //$form->addGroup('Link')->setOption('container', Html::el('fieldset')->id('link'));
         $menus = $this->model('menu')->getPairs();
         $menus = array(0 => 'none') + $menus;
         $form->addSelect('link', 'Link in menu', $menus);
     }
     $form->addTextArea('css_files', 'Css files')->getControlPrototype()->{'data-ext'} = 'css';
     $form->addTextArea('js_files', 'Js files')->getControlPrototype()->{'data-ext'} = 'js';
     $form->addGroup('')->setOption('container', Html::el('fieldset')->id('buttons'));
     $form->addButton('btnClose', 'Close');
     $form->addSubmit('btnPreview', 'Preview')->onClick[] = array($this, 'formNewPagePreview');
     $form['btnPreview']->getControlPrototype()->class('ajax');
     return $form;
 }