public function editorSettings() { $answer = editorTab::getNewEditorTab(); $answer->setName('Odpoveď'); $field_answer = new editorFieldTinymce(); $field_answer->setField('answer')->setFieldLabel('Text odpovede')->setFieldHint('Sem zadajte text odpovede.'); $field_answer->setRules(array('required_html' => true, 'messages' => array('required_html' => 'Je nutné aby bola odpoveď vyplnená.'))); $answer->addField($field_answer); $field_image = new editorFieldFileUpload(); $field_image->setField('image')->setFieldLabel('Obrázok k odpovedi')->setFieldHint('Vložte obrázok ak ho odpoveď vyžaduje.'); $field_image->setMaxSize('2MB')->setUploadPath('public/uploads/question_images')->setAllowedTypes('*.jpg; *.png; *.gif'); $answer->addField($field_image); $field_correct = new editorFieldSingleCheckbox(); $field_correct->setField('correct')->setFieldLabel('Je odpoveď správna?')->setFieldHint('Označte toto políčko ak má byť táto odpoveď správna.'); $field_correct->setDefaultValue('1'); $answer->addField($field_correct); $field_question_id = new editorFieldParentIdRecord(); $field_question_id->setField('question_id')->setParentTable('questions'); $field_question_id_else = new editorFieldMMRelation(); $field_question_id_else->setField('question_id')->setFieldLabel('Otázka')->setFieldHint('Vyberte otázku, ktorej patrí táto odpoveď.'); $field_question_id_else->setForeignTable('answers')->setFilterInFields(array('answer'))->setRules(array('min_mm_items' => 1, 'max_mm_items' => 1, 'messages' => array('min_mm_items' => 'Je nutné zvoliť jednu otázku.', 'max_mm_items' => 'Je nutné zvoliť jednu otázku.'))); $field_question_id_else->setEditOnly(FALSE); $field_question_id_else_field_question = gridField::newGridField(); $field_question_id_else_field_question->setField('question')->setName('Text otázky')->setType(GRID_FIELD_TYPE_HTML); $field_question_id_else->addGridField($field_question_id_else_field_question); $field_question_id->setElseField($field_question_id_else); $answer->addField($field_question_id); $this->addEditorTab($answer); }
protected function editorSettings() { $file = editorTab::getNewEditorTab(); $file->setName('Súbor'); $field_file = new editorFieldFileUpload(); $field_file->setField('file')->setFieldLabel('Súbor')->setFieldHint('Nahrajte súbor potrebný pre miniaplikáciu.'); $field_file->setAllowedTypes('*.jar; *.swf; *.css; *.js; *.jpg; *.jpeg; *.gif; *.png; *.xml'); $field_file->setShowFilePath(TRUE); $field_file->setRules(array('required' => TRUE, 'messages' => array('required' => 'Súbor je potrebné nahrať.'))); $field_file->setMaxSize('10MB'); $field_file->setUploadPath('public/uploads/miniapps'); $file->addField($field_file); $field_miniapp_id = new editorFieldParentIdRecord(); $field_miniapp_id->setField('miniapp_id'); $field_miniapp_id->setParentTable('miniapps'); $field_miniapp_id_else = new editorFieldMMRelation(); $field_miniapp_id_else->setFilterInFields(array('name'))->setForeignTable('miniapps')->setField('miniapp_id')->setFieldLabel('Miniaplikácia')->setFieldHint('Vyberte miniaplikáciu, ktorej patrí tento súbor.'); $field_miniapp_id_else->setEditOnly(FALSE); $field_miniapp_id_else_name = gridField::newGridField(); $field_miniapp_id_else_name->setField('name')->setName('Názov miniaplikácie')->setType(GRID_FIELD_TYPE_TEXT); $field_miniapp_id_else->addGridField($field_miniapp_id_else_name); $field_miniapp_id_else->setRules(array('required' => TRUE, 'min_mm_items' => 1, 'max_mm_items' => 1, 'messages' => array('requited' => 'Je nutná vybrať cieľovú miniaplikáciu', 'min_mm_items' => 'Musí byť zvolená jedna cieľová miniaplikácia.', 'max_mm_items' => 'Cieľová miniaplikácia môže byť iba jedna.'))); $field_miniapp_id->setElseField($field_miniapp_id_else); $file->addField($field_miniapp_id); $this->addEditorTab($file); }
public function editorSettings() { $question = editorTab::getNewEditorTab(); $question->setName('Otázka'); $field_question = new editorFieldTinymce(); $field_question->setField('question')->setFieldLabel('Text otázky')->setFieldHint('Sem zadajte text otázky.'); $field_question->setRules(array('required_html' => true, 'messages' => array('required_html' => 'Je nutné aby bola otázka vyplnená.'))); $question->addField($field_question); $field_image = new editorFieldFileUpload(); $field_image->setField('image')->setFieldLabel('Obrázok k otázke')->setFieldHint('Vložte obrázok ak ho otázka vyžaduje.'); $field_image->setMaxSize('2MB')->setUploadPath('public/uploads/question_images')->setAllowedTypes('*.jpg; *.png; *.gif'); $question->addField($field_image); $field_value = new editorFieldText(); $field_value->setField('value')->setFieldLabel('Počet bodov za otázku')->setFieldHint('Zadajte počet bodov v rozsahu 1 až 10.'); $field_value->setRules(array('range' => array(1, 10), 'required' => true, 'digits' => true, 'messages' => array('range' => 'Rozsah bodov musí byť {0} až {1}.', 'required' => 'Počet bodov je vyžadované zadať.', 'digits' => 'Počet bodov môže byť iba číselná hodnota.'))); $question->addField($field_value); $field_physicist_id = new editorFieldParentIdRecord(); $field_physicist_id->setField('physicist_id')->setParentTable('physicists'); $field_physicist_id_else = new editorFieldMMRelation(); $field_physicist_id_else->setField('physicist_id')->setFieldLabel('Fyzik')->setFieldHint('Vyberte fyzika, ktorému patrí táto otázka.'); $field_physicist_id_else->setForeignTable('physicists')->setFilterInFields(array('name'))->setRules(array('min_mm_items' => 1, 'max_mm_items' => 1, 'messages' => array('min_mm_items' => 'Je nutné zvoliť jedného fyzika.', 'max_mm_items' => 'Je nutné zvoliť jedného fyzika.'))); $field_physicist_id_else->setEditOnly(FALSE); $field_physicist_id_else_field_name = gridField::newGridField(); $field_physicist_id_else_field_name->setField('name')->setName('Meno')->setType(GRID_FIELD_TYPE_TEXT); $field_physicist_id_else->addGridField($field_physicist_id_else_field_name); $field_physicist_id->setElseField($field_physicist_id_else); $question->addField($field_physicist_id); $this->addEditorTab($question); $answers = editorTab::getNewEditorTab(); $answers->setName('Odpovede'); $field_answers = new editorFieldIframeForeignRelation(); $field_answers->setField('answers')->setFieldLabel('Odpovede')->setFieldHint('Vytvorte či upravde odpovede pre túto otázku.'); $field_answers->setForeignTable('answers'); $field_answers->setMinimumHeight(485); $answers->addField($field_answers); $this->addEditorTab($answers); }
protected function editorSettings() { $image = editorTab::getNewEditorTab(); $image->setName('Obrázok'); $field_description = new editorFieldText(); $field_description->setField('description')->setFieldLabel('Popis')->setFieldHint('Sem zadajte popis pre obrázok.'); $image->addField($field_description); $field_file = new editorFieldFileUpload(); $field_file->setField('file')->setFieldLabel('Obrázok')->setFieldHint('Vyberte súbor s obrázkom a nahrajte ho na server.'); $field_file->setAllowedTypes('*.jpg;*.jpeg;*.png;*.gif'); $field_file->setMaxSize('3MB'); $field_file->setUploadPath('public/uploads/images/'); $field_file->setRules(array('required' => TRUE, 'messages' => array('required' => 'Je nutné vybrať nejaký súbor s obrázkom.'))); $field_file->setUseFancybox(TRUE); $image->addField($field_file); $this->addEditorTab($image); }
protected function editorSettings() { $general = editorTab::getNewEditorTab(); $general->setName('Všeobecné informácie'); $field_name = new editorFieldText(); $field_name->setField('name')->setFieldLabel('Názov obdobia')->setFieldHint('Zadajte názov obdobia.'); $field_name->setRules(array('required' => true, 'messages' => array('required' => 'Je nutné zadať názov obdobia.'))); $general->addField($field_name); $field_start_year = new editorFieldText(); $field_start_year->setField('start_year')->setFieldLabel('Začiatok obdobia (rok)')->setFieldHint('Zadajte rok, v ktorom sa začalo toto obdobie.'); $field_start_year->setRules(array('required' => true, 'range' => array(-9999, 9999), 'messages' => array('required' => 'Je nutné zadať rok začiatku obdobia.', 'range' => 'Rok musí byť číslo v rozsahu od {0} do {1}.'))); $general->addField($field_start_year); $field_is_over = new editorFieldSingleCheckbox(); $field_is_over->setField('_is_over')->setFieldLabel('Obdobie už skončilo')->setFieldHint('Označte, ak obdobie už skončilo.')->setDefaultChecked(FALSE)->setCheckboxText('Áno')->setDefaultValue(1); $general->addField($field_is_over); $field_end_year = new editorFieldText(); $field_end_year->setField('end_year')->setFieldLabel('Koniec obdobia (rok)')->setFieldHint('Zadajte rok, v ktorom sa skončilo toto obdobie.'); $field_end_year->setRules(array('required' => '#' . $field_is_over->getFieldHtmlID() . ':checked', 'range' => array(-9999, 9999), 'greater_than' => '#' . $field_start_year->getFieldHtmlID(), 'messages' => array('required' => 'Je nutné zadať rok konca obdobia.', 'range' => 'Rok musí byť číslo v rozsahu od {0} do {1}.', 'greater_than' => 'Rok konca musí byť väčšie číslo ako rok začiatku.'))); $general->addField($field_end_year); $this->addEditorTab($general); $texts = editorTab::getNewEditorTab(); $texts->setName('Informácie'); $field_description = new editorFieldTinymce(); $field_description->setField('description')->setFieldLabel('Detailný text o období')->setFieldHint('Sem vložte text popisujúci obdobie.')->setRules(array('required' => true, 'messages' => array('required' => 'Je potrebné vyplniť túto položku.'))); $texts->addField($field_description); $this->addEditorTab($texts); $img = editorTab::getNewEditorTab(); $img->setName('Pozadie'); $field_image = new editorFieldFileUpload(); $field_image->setField('image')->setFieldLabel('Obrázok pozadia')->setFieldHint('Vyberte súbor s obrázkom a nahrajte ho na server.'); $field_image->setAllowedTypes('*.jpg;*.jpeg;*.png'); $field_image->setMaxSize('1MB'); $field_image->setUploadPath('public/uploads/periods/'); $field_image->setUseFancybox(TRUE); $field_image->setRules(array('required' => TRUE, 'messages' => array('required' => 'Je nutné vybrať nejaký súbor s obrázkom.'))); $img->addField($field_image); $field_bg_color = new editorFieldColorPicker(); $field_bg_color->setField('bg_color')->setFieldLabel('Farba pozadia')->setFieldHint('Zadajte farbu pozadia posuvníka časovej osi.'); $field_bg_color->setDefaultColor('#000000'); $img->addField($field_bg_color); $field_number_color = new editorFieldColorPicker(); $field_number_color->setField('number_color')->setFieldLabel('Farba číselnej osi')->setFieldHint('Zadajte farbu číselnej osi na časovej osi.'); $field_number_color->setDefaultColor('#ffffff'); $img->addField($field_number_color); $field_border_color = new editorFieldColorPicker(); $field_border_color->setField('border_color')->setFieldLabel('Farba orámovania')->setFieldHint('Zadajte farbu orámovania časovej osi.'); $field_border_color->setDefaultColor('#000000'); $img->addField($field_border_color); $this->addEditorTab($img); $physicists = editorTab::getNewEditorTab(); $physicists->setName('Fyzici'); $field_physicists = new editorFieldMMRelation(); $field_physicists->setField('physicists')->setFieldLabel('Fyzici tohoto obdobia')->setFieldHint('Vyberte fyzikov tohoto obdobia.'); $field_physicists->setEditOnly(TRUE); $field_physicists->setForeignTable('physicists'); $field_physicists->setFilterInFields(array('name', 'description', 'short_description')); $field_physicists_photo = gridField::newGridField(); $field_physicists_photo_sub = gridField::newGridField(); $field_physicists_photo_sub->setField('file'); $field_physicists_photo->setField('PhotoObject')->setType(GRID_FIELD_TYPE_IMAGE)->setName('Fotka')->setWidth('25%'); $field_physicists_photo->setSubField($field_physicists_photo_sub); $field_physicists->addGridField($field_physicists_photo); $field_physicists_name = gridField::newGridField(); $field_physicists_name->setField('name')->setType(GRID_FIELD_TYPE_TEXT)->setName('Meno'); $field_physicists->addGridField($field_physicists_name); $physicists->addField($field_physicists); $this->addEditorTab($physicists); $inventions = editorTab::getNewEditorTab(); $inventions->setName('Objavy'); $field_inventions = new editorFieldMMRelation(); $field_inventions->setField('inventions')->setFieldLabel('Fyzici tohoto obdobia')->setFieldHint('Vyberte fyzikov tohoto obdobia.'); $field_inventions->setEditOnly(TRUE); $field_inventions->setForeignTable('inventions'); $field_inventions->setFilterInFields(array('name', 'description', 'short_description')); $field_inventions_photo = gridField::newGridField(); $field_inventions_photo_sub = gridField::newGridField(); $field_inventions_photo_sub->setField('file'); $field_inventions_photo->setField('PhotoObject')->setType(GRID_FIELD_TYPE_IMAGE)->setName('Obrázok')->setWidth('25%'); $field_inventions_photo->setSubField($field_inventions_photo_sub); $field_inventions->addGridField($field_inventions_photo); $field_inventions_name = gridField::newGridField(); $field_inventions_name->setField('name')->setType(GRID_FIELD_TYPE_TEXT)->setName('Názov'); $field_inventions->addGridField($field_inventions_name); $inventions->addField($field_inventions); $this->addEditorTab($inventions); }