コード例 #1
0
 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);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }