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);
 }
 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);
 }
 protected function editorSettings()
 {
     $general = editorTab::getNewEditorTab();
     $general->setName('Všeobecné informácie');
     $field_displayed = new editorFieldSingleCheckbox();
     $field_displayed->setField('displayed')->setFieldLabel('Zobraziteľný')->setFieldHint('Zaškrtnite, ak má byť fyzik zobrazený na stránke.')->setDefaultChecked(FALSE)->setDefaultValue(TRUE);
     $general->addField($field_displayed);
     $field_name = new editorFieldText();
     $field_name->setField('name')->setFieldLabel('Meno')->setFieldHint('Zadajte celé meno fyzika.')->setRules(array('required' => TRUE, 'messages' => array('required' => 'Meno fyzika je vyžadované.')));
     $general->addField($field_name);
     $field_birth_year = new editorFieldText();
     $field_birth_year->setField('birth_year')->setFieldLabel('Rok narodenia')->setFieldHint('Zadajte rok narodenia fyzika.')->setRules(array('required' => true, 'range' => array(-9999, 9999), 'messages' => array('required' => 'Rok narodenia je vyžadovaný.', 'range' => 'Rok musí byť číselná hodnota od {0} do {1}.')));
     $general->addField($field_birth_year);
     $field_is_dead = new editorFieldSingleCheckbox();
     $field_is_dead->setField('_is_dead')->setFieldLabel('Fyzik už zomrel')->setFieldHint('Označte, ak fyzik už zomrel.')->setDefaultChecked(FALSE)->setCheckboxText('Áno')->setDefaultValue(1);
     $general->addField($field_is_dead);
     $field_death_year = new editorFieldText();
     $field_death_year->setField('death_year')->setFieldLabel('Rok úmrtia')->setFieldHint('Zadajte rok úmrtia fyzika.')->setRules(array('required' => '#' . $field_is_dead->getFieldHtmlID() . ':checked', 'range' => array(-9999, 9998), 'greater_than' => '#' . $field_birth_year->getFieldHtmlID(), 'messages' => array('required' => 'Ak fyzik už zomrel, je treba vyplniť rok jeho úmrtia.', 'range' => 'Rok musí byť číselná hodnota od {0} do {1}.', 'greater_than' => 'Rok úmrtia musí byť väčšie číslo ako rok narodenia.')));
     $general->addField($field_death_year);
     $this->addEditorTab($general);
     $texts = editorTab::getNewEditorTab();
     $texts->setName('Textové informácie');
     $field_description = new editorFieldTinymce();
     $field_description->setField('description')->setFieldLabel('Detailný text o fyzikovi')->setFieldHint('Sem vložte text popisujúci fyzikov život a prácu.')->setRules(array('required' => true, 'messages' => array('required' => 'Je potrebné vyplniť túto položku.')))->setNumberOfRows(10);
     $texts->addField($field_description);
     $field_short_description = new editorFieldTinymce();
     $field_short_description->setField('short_description')->setFieldLabel('Skrátený text o fyzikovi')->setFieldHint('Sem vložte skrátený popis fyzika (bude na časovej osi).')->setRules(array('required' => true, 'messages' => array('required' => 'Je potrebné vyplniť túto položku.')));
     $texts->addField($field_short_description);
     $this->addEditorTab($texts);
     $photo_images = editorTab::getNewEditorTab();
     $photo_images->setName('Fotka a obrázky');
     $field_photo = new editorFieldMMRelation();
     $field_photo->setField('photo')->setFieldLabel('Fotografia')->setFieldHint('Vyberte jeden obrázok ako fotografiu tohoto fyzika.');
     $field_photo->setFilterInFields(array('description', 'file'))->setForeignTable('images');
     $photo_field_file = gridField::newGridField();
     $photo_field_file->setField('file')->setType(GRID_FIELD_TYPE_IMAGE)->setName('Obrázok')->setWidth('100px');
     $field_photo->addGridField($photo_field_file);
     $photo_field_description = gridField::newGridField();
     $photo_field_description->setField('description')->setType(GRID_FIELD_TYPE_TEXT)->setName('Popis');
     $field_photo->addGridField($photo_field_description);
     $field_photo->setRules(array('min_mm_items' => 1, 'max_mm_items' => 1, 'messages' => array('min_mm_items' => 'Je potrebné vybrať jednu fotografiu.', 'max_mm_items' => 'Je potrebné vybrať jednu fotografiu.')));
     $field_photo->setEditOnly(FALSE);
     $photo_images->addField($field_photo);
     $field_images = new editorFieldMMRelation();
     $field_images->setField('images')->setFieldLabel('Obrázky')->setFieldHint('Vyberte obrázky pre tohoto fyzika.');
     $field_images->setFilterInFields(array('description', 'file'))->setForeignTable('images');
     $images_field_file = gridField::newGridField();
     $images_field_file->setField('file')->setType(GRID_FIELD_TYPE_IMAGE)->setName('Obrázok')->setWidth('100px');
     $field_images->addGridField($images_field_file);
     $images_field_description = gridField::newGridField();
     $images_field_description->setField('description')->setType(GRID_FIELD_TYPE_TEXT)->setName('Popis');
     $field_images->addGridField($images_field_description);
     $photo_images->addField($field_images);
     $this->addEditorTab($photo_images);
     $inventions = editorTab::getNewEditorTab();
     $inventions->setName('Objavy');
     $field_inventions = new editorFieldMMRelation();
     $field_inventions->setField('inventions')->setFieldLabel('Objavy')->setFieldHint('Vyberte objavy, na ktorých sa tento fyzik podielal.');
     $field_inventions->setFilterInFields(array('name', 'short_description'));
     $field_inventions->setForeignTable('inventions');
     $inentions_field_name = gridField::newGridField();
     $inentions_field_name->setField('name')->setType(GRID_FIELD_TYPE_TEXT)->setName('Názov')->setWidth('20%');
     $field_inventions->addGridField($inentions_field_name);
     $inentions_field_short_description = gridField::newGridField();
     $inentions_field_short_description->setField('short_description')->setType(GRID_FIELD_TYPE_HTML)->setName('Krátky popis');
     $field_inventions->addGridField($inentions_field_short_description);
     $inentions_field_year = gridField::newGridField();
     $inentions_field_year->setField('year')->setType(GRID_FIELD_TYPE_NUMBER)->setName('Rok')->setWidth('5%');
     $field_inventions->addGridField($inentions_field_year);
     $inventions->addField($field_inventions);
     $this->addEditorTab($inventions);
     $questions = editorTab::getNewEditorTab();
     $questions->setName('Otázky');
     $field_questionscount = new editorFieldText();
     $field_questionscount->setField('questionscount')->setFieldLabel('Počet otázok v teste')->setFieldHint('Zadajte počet otázok, ktoré budú zobrazené v teste. Ak je nižšie vytvorených viacej otázok, vždy sa vyberie maximálne tolko, kolko je tu nastavené (otázky sa vyberajú náhodne).');
     $field_questionscount->setDefaultText('10');
     $field_questionscount->setRules(array('digits' => TRUE, 'min' => 1, 'required' => TRUE, 'messages' => array('digits' => 'Zadajte len číselnú hodnotu', 'min' => 'Minimálna možná hodnota je {0}', 'required' => 'Prosím zadajte hodnotu.')));
     $questions->addField($field_questionscount);
     $field_questions = new editorFieldIframeForeignRelation();
     $field_questions->setField('questions')->setFieldLabel('Otázky')->setFieldHint('Vytvorte otázky pre test k tomuto fyzikovi.');
     $field_questions->setForeignTable('questions');
     $field_questions->setMinimumHeight(610);
     $questions->addField($field_questions);
     $this->addEditorTab($questions);
     $miniapps = editorTab::getNewEditorTab();
     $miniapps->setName('Miniaplikácie');
     $field_miniapps = new editorFieldMMRelation();
     $field_miniapps->setField('miniapps')->setFieldLabel('Miniaplikácie')->setFieldHint('Vyberte miniaplikácie k tomuto fyzikovi.');
     $field_miniapps->setForeignTable('miniapps');
     $field_miniapps->setEditOnly(TRUE);
     $field_miniapps_name = gridField::newGridField();
     $field_miniapps_name->setField('name')->setName('Názov miniaplikácie')->setType(GRID_FIELD_TYPE_TEXT);
     $field_miniapps->addGridField($field_miniapps_name);
     $field_miniapps->setFilterInFields(array('name'));
     $miniapps->addField($field_miniapps);
     $this->addEditorTab($miniapps);
     $links = editorTab::getNewEditorTab();
     $links->setName('Externé odkazy');
     $field_links = new editorFieldMultilineText();
     $field_links->setField('links')->setFieldLabel('Zoznam odkazov')->setFieldHint('Zadajte URL externých odkazov, vždy iba jedno URL na riadok!');
     $field_links->setNumberOfRows(7);
     $links->addField($field_links);
     $field_links_labels = new editorFieldMultilineText();
     $field_links_labels->setField('links_labels')->setFieldLabel('Texty odkazov')->setFieldHint('Zadajte texty externých odkazov, vždy iba jeden text na riadok! Každý riadok tu zodpovedá jednému riadku v zozname URL.');
     $field_links_labels->setNumberOfRows(7);
     $links->addField($field_links_labels);
     $this->addEditorTab($links);
 }
 public function editorSettings()
 {
     $general = editorTab::getNewEditorTab();
     $general->setName('Všeobecné informácie');
     $field_displayed = new editorFieldSingleCheckbox();
     $field_displayed->setField('displayed')->setFieldLabel('Zobraziteľný')->setFieldHint('Zaškrtnite, ak má byť fyzik zobrazený na stránke.')->setDefaultChecked(FALSE)->setDefaultValue(TRUE);
     $general->addField($field_displayed);
     $field_name = new editorFieldText();
     $field_name->setField('name')->setFieldLabel('Názov objavu')->setFieldHint('Zadajte názov objavu.');
     $field_name->setRules(array('required' => true, 'messages' => array('required' => 'Je nutné zadať názov objavu.')));
     $general->addField($field_name);
     $field_year = new editorFieldText();
     $field_year->setField('year')->setFieldLabel('Rok objavu')->setFieldHint('Zadajte rok, v ktorom bol objav uskutočnený.');
     $field_year->setRules(array('required' => true, 'range' => array(-9999, 9999), 'messages' => array('required' => 'Je nutné zadať rok objavu.', 'range' => 'Rok musí byť číslo v rozsahu od {0} do {1}.')));
     $general->addField($field_year);
     $this->addEditorTab($general);
     $texts = editorTab::getNewEditorTab();
     $texts->setName('Informácie');
     $field_description = new editorFieldTinymce();
     $field_description->setField('description')->setFieldLabel('Detailný text o objave')->setFieldHint('Sem vložte text popisujúci objav.')->setRules(array('required' => true, 'messages' => array('required' => 'Je potrebné vyplniť túto položku.')));
     $texts->addField($field_description);
     $field_short_description = new editorFieldTinymce();
     $field_short_description->setField('short_description')->setFieldLabel('Skrátený text o objave')->setFieldHint('Sem vložte skrátený popis objavu (bude na časovej osi).')->setRules(array('required' => true, 'messages' => array('required' => 'Je potrebné vyplniť túto položku.')));
     $texts->addField($field_short_description);
     $this->addEditorTab($texts);
     $photo_images = editorTab::getNewEditorTab();
     $photo_images->setName('Fotka a obrázky');
     $field_photo = new editorFieldMMRelation();
     $field_photo->setField('photo')->setFieldLabel('Fotografia')->setFieldHint('Vyberte jeden obrázok ako fotografiu tohoto objavu.');
     $field_photo->setFilterInFields(array('description', 'file'))->setForeignTable('images');
     $photo_field_file = gridField::newGridField();
     $photo_field_file->setField('file')->setType(GRID_FIELD_TYPE_IMAGE)->setName('Obrázok')->setWidth('100px');
     $field_photo->addGridField($photo_field_file);
     $photo_field_description = gridField::newGridField();
     $photo_field_description->setField('description')->setType(GRID_FIELD_TYPE_TEXT)->setName('Popis');
     $field_photo->addGridField($photo_field_description);
     $field_photo->setRules(array('min_mm_items' => 1, 'max_mm_items' => 1, 'messages' => array('min_mm_items' => 'Je potrebné vybrať jednu fotografiu.', 'max_mm_items' => 'Je potrebné vybrať jednu fotografiu.')));
     $field_photo->setEditOnly(FALSE);
     $photo_images->addField($field_photo);
     $field_images = new editorFieldMMRelation();
     $field_images->setField('images')->setFieldLabel('Obrázky')->setFieldHint('Vyberte obrázky pre tento objav.');
     $field_images->setFilterInFields(array('description', 'file'))->setForeignTable('images');
     $images_field_file = gridField::newGridField();
     $images_field_file->setField('file')->setType(GRID_FIELD_TYPE_IMAGE)->setName('Obrázok')->setWidth('100px');
     $field_images->addGridField($images_field_file);
     $images_field_description = gridField::newGridField();
     $images_field_description->setField('description')->setType(GRID_FIELD_TYPE_TEXT)->setName('Popis');
     $field_images->addGridField($images_field_description);
     $photo_images->addField($field_images);
     $this->addEditorTab($photo_images);
     $miniapps = editorTab::getNewEditorTab();
     $miniapps->setName('Miniaplikácie');
     $field_miniapps = new editorFieldMMRelation();
     $field_miniapps->setField('miniapps')->setFieldLabel('Miniaplikácie')->setFieldHint('Vyberte miniaplikácie k tomuto objavu.');
     $field_miniapps->setForeignTable('miniapps');
     $field_miniapps->setEditOnly(TRUE);
     $field_miniapps_name = gridField::newGridField();
     $field_miniapps_name->setField('name')->setName('Názov miniaplikácie')->setType(GRID_FIELD_TYPE_TEXT);
     $field_miniapps->addGridField($field_miniapps_name);
     $field_miniapps->setFilterInFields(array('name'));
     $miniapps->addField($field_miniapps);
     $this->addEditorTab($miniapps);
     $links = editorTab::getNewEditorTab();
     $links->setName('Externé odkazy');
     $field_links = new editorFieldMultilineText();
     $field_links->setField('links')->setFieldLabel('Zoznam odkazov')->setFieldHint('Zadajte URL externých odkazov, vždy iba jedno URL na riadok!');
     $field_links->setNumberOfRows(7);
     $links->addField($field_links);
     $field_links_labels = new editorFieldMultilineText();
     $field_links_labels->setField('links_labels')->setFieldLabel('Texty odkazov')->setFieldHint('Zadajte texty externých odkazov, vždy iba jeden text na riadok! Každý riadok tu zodpovedá jednému riadku v zozname URL.');
     $field_links_labels->setNumberOfRows(7);
     $links->addField($field_links_labels);
     $this->addEditorTab($links);
 }