예제 #1
0
     $action = '';
 }
 if ($action == 'add' || $action == 'edit' && dyn::get('user')->hasPerm('page[edit]')) {
     layout::addJsCode("\n\tvar button = \$('#allcat-button');\n\tvar content = \$('#allcat-content');\n\t\n\tbutton.change(function() {\n\t\t\tif(button.is(':checked')) {\n\t\t\t\tcontent.stop().slideUp(300);\n\t\t\t} else {\n\t\t\t\tcontent.stop().slideDown(300);\n\t\t\t}\n\t});");
     $form = form::factory('slots', 'id=' . $id, 'index.php');
     $field = $form->addTextField('name', $form->get('name'));
     $field->fieldName(lang::get('name'));
     $field->autofocus();
     $field = $form->addTextField('description', $form->get('description'));
     $field->fieldName(lang::get('description'));
     $field = $form->addRawField('<select name="modul" class="form-control">' . pageAreaHtml::moduleList($form->get('modul')) . '</select>');
     $field->fieldName(lang::get('module'));
     $field = $form->addCheckboxField('is-structure', $form->get('is-structure'));
     $field->fieldName(lang::get('slots_show'));
     $field->add('1', lang::get('all_categories'), ['id' => 'allcat-button']);
     $select = pageMisc::getTreeStructure(true, $form->get('structure'));
     if ($form->get('is-structure') == 1) {
         $select->addAttribute('style', 'display:none;');
     }
     $select->setMultiple();
     $select->setSize(10);
     $select->setId('allcat-content');
     $form->addElement('pages', $select);
     if ($action == 'edit') {
         $form->addHiddenField('id', $id);
     }
     if ($form->isSubmit()) {
         $form->addPost('modul', $form->get('modul'));
         $form->addPost('template', dyn::get('template'));
     }
     ?>