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()
 {
     $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()
 {
     $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('Administrátor');
     $field_email = new editorFieldText();
     $field_email->setField('email')->setFieldLabel('E-mail')->setFieldHint('Zadajte e-mailovú adresu administrátora, ktorá bude slúžiť aj ako jeho prihlasovacie meno.');
     $field_email->setRules(array('required' => TRUE, 'email' => TRUE, 'remote_check' => createUri('admin', 'check_email'), 'messages' => array('required' => 'E-mailová adresa musí byť vyplnená.', 'email' => 'Zadaná adresa nie je platná e-mailová adresa.', 'remote_check' => 'E-mailovú adresu už používa iný účet.')));
     $general->addField($field_email);
     $field_password = new editorFieldPassword();
     $field_password->setField('password')->setFieldLabel('Heslo')->setFieldHint('Vyplnte heslo. Pokial vytvárate nový účet, je nutné heslo vyplniť. Inak heslo vyplňte iba ak ho chcete zmeniť.');
     $field_password->setRules(array('required_if_new' => TRUE, 'rangelength' => array(6, 20), 'messages' => array('required_if_new' => 'Je nutné vyplniť heslo.', 'rangelength' => 'Heslo musí byť v rozsahu {0} až {1} znakov.')));
     $general->addField($field_password);
     $field_password_check = new editorFieldPassword();
     $field_password_check->setField('_password')->setFieldLabel('Heslo')->setFieldHint('Kontrola hore zadaného hesla.');
     $field_password_check->setRules(array('equalTo' => '#' . $field_password->getFieldHtmlID(), 'messages' => array('equalTo' => 'Heslá sa nezhodujú.')));
     $general->addField($field_password_check);
     $this->addEditorTab($general);
 }
 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()
 {
     $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);
 }
 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);
 }
 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);
 }