diff --git a/module/university_form/bootstrap.php b/module/university_form/bootstrap.php index a2a93fe2fe826fa251b00855b96f874f9e2379d7..ee99f7349431203cbff4cfced13bcd47f3d7b793 100644 --- a/module/university_form/bootstrap.php +++ b/module/university_form/bootstrap.php @@ -32,15 +32,23 @@ $events('on', 'app.services', function ($container) { return new GrEduLabs\UniversityForm\InputFilter\UniversityForm(); }; + $container[GrEduLabs\UniversityForm\InputFilter\UniversityForm1::class] = function ($c) { + return new GrEduLabs\UniversityForm\InputFilter\UniversityForm1(); + }; + $container[GrEduLabs\UniversityForm\Action\UniversityForm::class] = function ($c) { return new GrEduLabs\UniversityForm\Action\UniversityForm( $c->get('view'), $c->get(GrEduLabs\UniversityForm\Service\UniversityFormServiceInterface::class), $c->get(GrEduLabs\UniversityForm\InputFilter\UniversityForm::class), + $c->get(GrEduLabs\UniversityForm\InputFilter\UniversityForm1::class), $c->get('router')->pathFor('university_form.submit_success'), $c); }; + + + $container[GrEduLabs\UniversityForm\Action\SubmitSuccess::class] = function ($c) { return new GrEduLabs\UniversityForm\Action\SubmitSuccess( $c->get('view'), diff --git a/module/university_form/data/migration-03-down.mysql.sql b/module/university_form/data/migration-03-down.mysql.sql new file mode 100644 index 0000000000000000000000000000000000000000..b6baa0081fb21b8764b974d2acc8afcfca426db9 --- /dev/null +++ b/module/university_form/data/migration-03-down.mysql.sql @@ -0,0 +1,5 @@ + +ALTER TABLE `univ` +DROP COLUMN `ereunitiko`, +DROP COLUMN `institute` , +DROP COLUMN `other` ; diff --git a/module/university_form/data/migration-03-up.mysql.sql b/module/university_form/data/migration-03-up.mysql.sql new file mode 100644 index 0000000000000000000000000000000000000000..98bb5422741ff79c3be8a92357200244a502bf01 --- /dev/null +++ b/module/university_form/data/migration-03-up.mysql.sql @@ -0,0 +1,6 @@ +ALTER TABLE `univ` +ADD COLUMN `ereunitiko` varchar(191), +ADD COLUMN `institute` varchar(191), +ADD COLUMN `other` varchar(191); + +ALTER TABLE univ MODIFY COLUMN idrima VARCHAR(191); \ No newline at end of file diff --git a/module/university_form/data/migrations.sql b/module/university_form/data/migrations.sql new file mode 100644 index 0000000000000000000000000000000000000000..43e0de38bc5079c8b3dc2c0e759c07937d07cfef --- /dev/null +++ b/module/university_form/data/migrations.sql @@ -0,0 +1,41 @@ +-- Table structure for table `univ` +-- + +DROP TABLE IF EXISTS `univ`; +-- +-- Table structure for table `univ` +-- + +CREATE TABLE IF NOT EXISTS `univ` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `idrima` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `sxolh` varchar(191) COLLATE utf8mb4_unicode_ci, + `tmhma` varchar(191) COLLATE utf8mb4_unicode_ci, + `person` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `telef` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL, + `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, + `comments` text COLLATE utf8mb4_unicode_ci NOT NULL, + `erga` varchar(191)COLLATE utf8mb4_unicode_ci, + `projectdescription` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1 ; + + + +DROP TABLE IF EXISTS `volunteerteachers`; +CREATE TABLE IF NOT EXISTS `volunteerteachers` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `surname` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `eidikothta` int(11) NOT NULL, + `arithmitroou` int(11) NOT NULL, + `telef` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `school` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `schooltelef` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, + `comments` text NOT NULL, + `projectdescription` text, + PRIMARY KEY (`id`) +)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + + diff --git a/module/university_form/src/Action/UniversityForm.php b/module/university_form/src/Action/UniversityForm.php index bd2c56e5c1ac6e89e4abc2319c293d4c7406d5c8..6b0d5cb04c0b8c9a2ce8f347d93c630fbff0b1d1 100644 --- a/module/university_form/src/Action/UniversityForm.php +++ b/module/university_form/src/Action/UniversityForm.php @@ -49,12 +49,14 @@ class UniversityForm protected $successUrl; public function __construct( - Twig $view, UniversityFormServiceInterface $UniversityFormService, InputFilterInterface $UniversityFormInputFilter, $successUrl,$container + Twig $view, UniversityFormServiceInterface $UniversityFormService, InputFilterInterface $UniversityFormInputFilter2,InputFilterInterface $UniversityFormInputFilter1, $successUrl,$container ) { $this->view = $view; $this->UniversityFormService = $UniversityFormService; - $this->UniversityFormInputFilter = $UniversityFormInputFilter; + $this->UniversityFormInputFilter = $UniversityFormInputFilter1; + $this->UniversityFormInputFilter2 = $UniversityFormInputFilter2; + $this->UniversityFormInputFilter1 = $UniversityFormInputFilter1; $this->successUrl = $successUrl; $this->container = $container; } @@ -66,9 +68,18 @@ class UniversityForm if ($req->isPost()) { $reqParams = $req->getParams(); + if (isset($reqParams['newselect'])&& $reqParams['newselect']=='ereunitika') + { + $this->UniversityFormInputFilter = $this->UniversityFormInputFilter2; + } + else + { + $this->UniversityFormInputFilter = $this->UniversityFormInputFilter1; + } + $this->UniversityFormInputFilter->setData($reqParams); - $isValid = $this->UniversityFormInputFilter->isValid(); + if ($isValid) { $data = $this->UniversityFormInputFilter->getValues(); diff --git a/module/university_form/src/InputFilter/UniversityForm.php b/module/university_form/src/InputFilter/UniversityForm.php index 48dfc75f1fffbfa089395970da4fdf0d435228a9..6bb43e59c2406a1ea3f06aea8cb2e2ee88426e04 100644 --- a/module/university_form/src/InputFilter/UniversityForm.php +++ b/module/university_form/src/InputFilter/UniversityForm.php @@ -20,23 +20,43 @@ class UniversityForm extends InputFilter public function __construct() { + + $newselect = new Input('newselect'); + $newselect->setRequired(false) + ->getFilterChain(); + + + + $ereunitiko = new Input('ereunitiko'); + $ereunitiko->setRequired(true) + ->getFilterChain(); + - - $idrima = new Input('idrima'); - $idrima->setRequired(true) - ->getFilterChain(); + $institute = new Input('institute'); + $institute->setRequired(false) + ->getFilterChain(); - - $sxolh = new Input('sxolh'); - $sxolh->setRequired(false) - ->getFilterChain(); + $other = new Input('other'); + $other->setRequired(false) + ->getFilterChain(); - $tmhma = new Input('tmhma'); - $tmhma->setRequired(false) - ->getFilterChain(); - + + $idrima = new Input('idrima'); + $idrima->setRequired(false) + ->getFilterChain(); + + + $sxolh = new Input('sxolh'); + $sxolh->setRequired(false) + ->getFilterChain(); + + $tmhma = new Input('tmhma'); + $tmhma->setRequired(false) + ->getFilterChain(); + + $erga = new Input('erga'); $erga->setRequired(false) ->getFilterChain() @@ -82,7 +102,11 @@ class UniversityForm extends InputFilter ->attach(new Filter\StringTrim()); - $this ->add($idrima) + $this->add($newselect) + ->add($ereunitiko) + ->add($institute) + ->add($other) + ->add($idrima) ->add($sxolh) ->add($tmhma) ->add($erga) diff --git a/module/university_form/src/InputFilter/UniversityForm1.php b/module/university_form/src/InputFilter/UniversityForm1.php new file mode 100644 index 0000000000000000000000000000000000000000..467902dc25ac7f9e9ea6f8a433314e638505ba32 --- /dev/null +++ b/module/university_form/src/InputFilter/UniversityForm1.php @@ -0,0 +1,118 @@ +<?php +/** + * gredu_labs + * + * @link https://github.com/eellak/gredu_labs for the canonical source repository + * @copyright Copyright (c) 2008-2015 Greek Free/Open Source Software Society (https://gfoss.ellak.gr/) + * @license GNU GPLv3 http://www.gnu.org/licenses/gpl-3.0-standalone.html + */ + +namespace GrEduLabs\UniversityForm\InputFilter; + +use GrEduLabs\UniversityForm\Service; +use Zend\Filter; +use Zend\InputFilter\Input; +use Zend\InputFilter\InputFilter; +use Zend\Validator; + +class UniversityForm1 extends InputFilter +{ + + public function __construct() + { + + $newselect = new Input('newselect'); + $newselect->setRequired(false) + ->getFilterChain(); + + + + $ereunitiko = new Input('ereunitiko'); + $ereunitiko->setRequired(false) + ->getFilterChain(); + + + $institute = new Input('institute'); + $institute->setRequired(false) + ->getFilterChain(); + + $other = new Input('other'); + $other->setRequired(false) + ->getFilterChain(); + + + $idrima = new Input('idrima'); + $idrima->setRequired(true) + ->getFilterChain(); + + + $sxolh = new Input('sxolh'); + $sxolh->setRequired(false) + ->getFilterChain(); + + + $tmhma = new Input('tmhma'); + $tmhma->setRequired(false) + ->getFilterChain(); + + + $erga = new Input('erga'); + $erga->setRequired(false) + ->getFilterChain() + ->attach(new Filter\StringTrim()); + + $person = new Input('person'); + $person->setRequired(true) + ->getFilterChain() + ->attach(new Filter\StringTrim()); + $person->getValidatorChain() + ->attach(new Validator\NotEmpty()) + ->attach(new Validator\StringLength(['min' => 3])); + + + $email = new Input('email'); + $email->setRequired(true) + ->getValidatorChain() + ->attach(new Validator\NotEmpty()) + ->attach(new Validator\EmailAddress([ + 'useDomainCheck' => false, + ])); + + $telef = new Input('telef'); + $telef->setRequired(true) + ->getFilterChain() + ->attach(new Filter\Digits()); + $telef->getValidatorChain() + ->attach(new Validator\NotEmpty()) + ->attach(new Validator\StringLength(['min' => 10])) + ->attach(new Validator\StringLength(['max' => 13])); + + + $projectdescription = new Input('projectdescription'); + $projectdescription->setRequired(false) + ->getFilterChain() + ->attach(new Filter\StringTrim()); + + + + $comments = new Input('comments'); + $comments->setRequired(false) + ->getFilterChain() + ->attach(new Filter\StringTrim()); + + + $this->add($newselect) + ->add($ereunitiko) + ->add($institute) + ->add($other) + ->add($idrima) + ->add($sxolh) + ->add($tmhma) + ->add($erga) + ->add($person) + ->add($telef) + ->add($email) + ->add($projectdescription) + ->add($comments); + } +} diff --git a/module/university_form/src/Service/UniversityFormService.php b/module/university_form/src/Service/UniversityFormService.php index 4b8ae3e71e05d2beb98e1cee8beacbdbfc9d37e9..48b0a5224a5acf6b68e574f5bc33ad052402c0f8 100644 --- a/module/university_form/src/Service/UniversityFormService.php +++ b/module/university_form/src/Service/UniversityFormService.php @@ -23,6 +23,9 @@ class UniversityFormService implements UniversityFormServiceInterface $appForm->idrima = $data['idrima']; $appForm->sxolh = $data['sxolh']; $appForm->tmhma = $data['tmhma']; + $appForm->ereunitiko = $data['ereunitiko']; + $appForm->institute = $data['istitute']; + $appForm->other = $data['other']; $appForm->erga = $data['erga']; $appForm->person = $data['person']; $appForm->telef = trim($data['telef']); diff --git a/module/university_form/templates/university_form/form.twig b/module/university_form/templates/university_form/form.twig index 180c3d577c51a7b2d24359a51b63011543c6045a..3e0074492175cd7fb845e1153dcb209a73a528e1 100644 --- a/module/university_form/templates/university_form/form.twig +++ b/module/university_form/templates/university_form/form.twig @@ -29,16 +29,24 @@ input[type=text] { <div class="table-responsive"> <fieldset> - <div id="items-list"> - {{ macros.select('idrima', 'ΞΞ΄ΟΟ ΞΌΞ±', '', form.values.idrima, { 'id': 'idrima'} )}} + <div id="items-list"> + <strong>ΞΟΞΉΞ»ΞΞΎΟΞ΅ ΟΞ·Ξ½ ιδιΟΟΞ·ΟΞ¬ ΟΞ±Ο:</strong> + <select name='newselect' id="newselect"> + <option value="space" id = "space" selected ></option> + <option value="idrimata" id = "idrimata">ΞΞΞ/ΞΞ€ΞΞ</option> + <option value="ereunitika" id="ereunitika">ΞΟΞ΅Ο Ξ½Ξ·ΟΞΉΞΊΞ¬ ΞΞΞ½ΟΟΞ±</option> + </select> + {{ macros.select('idrima','ΞΞ΄ΟΟ ΞΌΞ±','', form.values.idrima, { 'id': 'idrima'} )}} {{ macros.select('sxolh', 'Ξ£ΟΞΏΞ»Ξ�','', form.values.sxolh,{ 'id': 'sxolh'} ) }} {{ macros.select('tmhma', '΀μΞ�ΞΌΞ±','', form.values.tmhma, { 'id': 'tmhma'}) }} + {{ macros.select('ereunitiko', 'ΞΟΞ΅Ο Ξ½Ξ·ΟΞΉΞΊΟ ΞΞΞ½ΟΟΞΏ', '', form.values.ereunitiko, { 'id': 'ereunitiko'} )}} + {{ macros.select('institute', 'ΞΞ½ΟΟΞΉΟΞΏΟΟΞΏ','', form.values.institute,{ 'id': 'institute'} ) }} + {{ macros.input('other', 'Ξλλο',form.values.other,{ 'id': 'other'} ) }} {{ macros.input('erga', 'ΞΟΞ³Ξ±ΟΟΞ�ΟΞΉΞΏ',form.values.erga ) }} {{ macros.input('person', 'Ξ₯ΟΞ΅ΟΞΈΟ Ξ½ΞΏΟ ΞΟΞΉΞΊΞΏΞΉΞ½ΟΞ½Ξ―Ξ±Ο',form.values.person ) }} {{ macros.input('telef', '΀ηλΞΟΟΞ½ΞΏ',form.values.telef ) }} {{ macros.input('email', 'Email',form.values.email ) }} - <br> <br> <br> @@ -68,6 +76,11 @@ input[type=text] { <input type="hidden" name="hididrima" id="hididrima" value="{{form.values.idrima}}"> <input type="hidden" name="hidsxolh" id="hidsxolh" value="{{form.values.sxolh}}"> <input type="hidden" name="hidtmhma" id="hidtmhma" value="{{form.values.tmhma}}"> + <input type="hidden" name="hidereunitiko" id="hidereunitiko" value="{{form.values.ereunitiko}}"> + <input type="hidden" name="hidinstitute" id="hidinstitute" value="{{form.values.institute}}"> + + + <input type="hidden" name="hidnewselect" id="hidnewselect" > </div> <input type="hidden" name="{{ csrf.name_key }}" value="{{ csrf.name }}"> <input type="hidden" name="{{ csrf.value_key }}" value="{{ csrf.value }}"> diff --git a/public/js/university_form/index.js b/public/js/university_form/index.js index f794f281dab8af0a16848755aa5fee8eb245615e..5bec8d5b12bf8d0a47dfa6dc1ce0773a3cd1bfe5 100644 --- a/public/js/university_form/index.js +++ b/public/js/university_form/index.js @@ -9,120 +9,49 @@ }(window.jQuery, _, window.EDULABS.utils)); -window.onload = function() { - $.post({ - url: 'http://relabs1.minedu.gov.gr/mypoint/taxonomy_vocabulary/getTree.json', - type: 'POST', - data: { vid: "13"} , - dataType: 'json', - - }).done(function(data, statusText, resObject) { - for ( var index = 0; index < data.length; index++ ) { - if (data[ index ].depth == 0){ - - if (index == parseInt(document.getElementById("hididrima").value)){ - $('#el-idrima') - .append($("<option selected ></option>") - .attr("value",index) - .text(data[ index ].name)); - - refresh(index); -} - else - { - $('#el-idrima') - .append($("<option></option>") - .attr("value",index) - .text(data[ index ].name)); - - } - -} -} - - }); - - -} - - - function refresh(key) { - - - $.post({ - url: 'http://relabs1.minedu.gov.gr/mypoint/taxonomy_vocabulary/getTree.json', - type: 'POST', - data: { vid: "13"} , - dataType: 'json', - - }).done(function(data, statusText, resObject) { - - - - for ( var index = 0; index < data.length; index++ ) { - if (data[ index ].parents == data[key].tid && data[ index ].depth == 1) - if (index == parseInt(document.getElementById("hidsxolh").value)){ - - $('#el-sxolh') - .append($("<option selected></option>") - .attr("value",index) - .text(data[ index ].name)); - - - - - - - - - - for ( var index1 = 0; index1 < data.length; index1++ ) { - if (data[ index1 ].parents == data[index].tid && data[ index1 ].depth == 2) - if (index1 == parseInt(document.getElementById("hidtmhma").value)){ - - $('#el-tmhma') - .append($("<option selected></option>") - .attr("value",index1) - .text(data[ index1 ].name)); - } - else - { - - $('#el-tmhma') - .append($("<option ></option>") - .attr("value",index1) - .text(data[ index1].name)); - - } - - } - +window.onload = function() { + $('#el-idrima').attr("disabled", true); + $('#el-sxolh').attr("disabled", true); + $('#el-tmhma').attr("disabled", true); + $('#el-ereunitiko').attr("disabled", true); + $('#el-institute').attr("disabled", true); + $('#el-other').attr("disabled", true); + + $('label[for="el-ereunitiko"]').attr("disabled", true); + $('label[for="el-institute"]').attr("disabled", true); + $('label[for="el-other"]').attr("disabled", true); + $('label[for="el-idrima"]').attr("disabled", true); + $('label[for="el-sxolh"]').attr("disabled", true); + $('label[for="el-tmhma"]').attr("disabled", true); + + if(isNaN(parseInt(document.getElementById("hididrima").value))){ + + } + else + { + $("#newselect").prop("selectedIndex", 1); + $("#newselect").change(); + } + + if(isNaN(parseInt(document.getElementById("hidereunitiko").value))){ + + } + else + { + $("#newselect").prop("selectedIndex", 2); + $("#newselect").change(); + } + } - } - - else -{ - $('#el-sxolh') - .append($("<option ></option>") - .attr("value",index) - .text(data[ index ].name)); - - -} - - } - }); -} - @@ -168,6 +97,10 @@ $('#el-idrima').on('change', function() { }); + + + + $('#el-sxolh').on('change', function() { var key = this.value; @@ -223,8 +156,17 @@ $(document).ready(function() { }) + + + + $("#submit").click(function(){ - var projects = $("input[id='projects']") + + + $('#hidnewselect').val(document.getElementById("newselect").value); + + + var projects = $("input[id='projects']") .map(function(){return $(this).val();}).get(); var urlproject = $("input[id='urlproject']") @@ -240,3 +182,306 @@ $(document).ready(function() { }) }); + + + + + + + +$('#newselect').on('change', function() { + + selection = $("#newselect").val(); + + switch(selection) + { + case 'idrimata': + $('#el-ereunitiko').attr("disabled", true); + $('#el-ereunitiko').val(''); + $('#el-institute').attr("disabled", true); + $('#el-institute').val(''); + $('#el-other').attr("disabled", true); + $('#el-other').val(''); + $('label[for="el-ereunitiko"]').attr("disabled", true); + $('label[for="el-institute"]').attr("disabled", true); + $('label[for="el-other"]').attr("disabled", true); + $('#el-idrima').attr("disabled", false); + $('#el-sxolh').attr("disabled", false); + $('#el-tmhma').attr("disabled", false); + $('label[for="el-sxolh"]').attr("disabled", false); + $('label[for="el-tmhma"]').attr("disabled", false); + $('label[for="el-idrima"]').attr("disabled", false); + + $.post({ + url: 'http://relabs1.minedu.gov.gr/mypoint/taxonomy_vocabulary/getTree.json', + type: 'POST', + data: { vid: "13"} , + dataType: 'json', + + }).done(function(data, statusText, resObject) { + + + + for ( var index = 0; index < data.length; index++ ) { + if (data[ index ].depth == 0) + { + if (index == parseInt(document.getElementById("hididrima").value)){ + $('#el-idrima') + .append($("<option selected ></option>") + .attr("value",index) + .text(data[ index ].name)); + + refresh(index); + } + else + { + $('#el-idrima') + .append($("<option></option>") + .attr("value",index) + .text(data[ index ].name)); + } + } + } + }); + + break; + case 'ereunitika': + $('#el-idrima').val(''); + $('#el-sxolh').val(''); + $('#el-tmhma').val(''); + $('#el-idrima').attr("disabled", true); + $('#el-sxolh').attr("disabled", true); + $('#el-tmhma').attr("disabled", true); + $('#el-ereunitiko').attr("disabled", false); + $('#el-institute').attr("disabled", false); + $('#el-other').attr("disabled", true); + $('label[for="el-ereunitiko"]').attr("disabled", false); + $('label[for="el-institute"]').attr("disabled", false); + $('label[for="el-other"]').attr("disabled", false); + $('label[for="el-idrima"]').attr("disabled", true); + $('label[for="el-sxolh"]').attr("disabled", true); + $('label[for="el-tmhma"]').attr("disabled", true); + $.post({ + url: 'http://relabs1.minedu.gov.gr/mypoint/taxonomy_vocabulary/getTree.json', + type: 'POST', + data: { vid: "15"} , + dataType: 'json', + + }).done(function(data1, statusText, resObject) { + + for ( var index1 = 0; index1 < data1.length; index1++ ) { + if (data1[ index1 ].depth == 0) + { + + if (index1 == parseInt(document.getElementById("hidereunitiko").value)) + { + $('#el-ereunitiko') + .append($("<option selected ></option>") + .attr("value",index1) + .text(data1[ index1 ].name)); + + + refresh1(index1); + } + else + { + $('#el-ereunitiko') + .append($("<option></option>") + .attr("value",index1) + .text(data1[ index1 ].name)); + + } + } + } + }); + break; + } +}); + + + + + + + $('#el-ereunitiko').on('change', function() { + var key = this.value; + + $.post({ + url: 'http://relabs1.minedu.gov.gr/mypoint/taxonomy_vocabulary/getTree.json', + type: 'POST', + data: { vid: "15"} , + dataType: 'json', + + }).done(function(data1, statusText, resObject) { + if (document.getElementById("el-institute").options.length != 0) + { + var i; + for(i = document.getElementById("el-institute").options.length-1;i >= 1; i--) + { + document.getElementById("el-institute").remove(i); + } + $("#el-institute").append('<option value=1></option>'); + } + for ( var index1 = 0; index1 < data1.length; index1++ ) + { + if (data1[ index1 ].parents == data1[key].tid && data1[ index1 ].depth == 1) + $('#el-institute') + .append($("<option></option>") + .attr("value",index1) + .text(data1[ index1 ].name)); + } + $("#el-institute").append('<option value=1000>ΞΞΞΞ</option>'); + }); + + val1= document.getElementById("el-ereunitiko").value; + + if (document.getElementById("el-idrima").options.length != 0) { + var i; + for(i = document.getElementById("el-idrima").options.length-1;i >= 1; i--) + { + document.getElementById("el-idrima").remove(i); + } + } + }); + + + + + + $('#el-institute').on('change', function() { + + sel = $("#el-institute").val(); + switch(sel) + { + case '1000': + $('#el-other').attr("disabled", false); + $('#lother').attr("disabled", false); + break; + default: + $('#el-other').val(""); + $('#el-other').attr("disabled",true); + + } + }); + + + + + function refresh(key) { + + + $.post({ + url: 'http://relabs1.minedu.gov.gr/mypoint/taxonomy_vocabulary/getTree.json', + type: 'POST', + data: { vid: "13"} , + dataType: 'json', + + }).done(function(data, statusText, resObject) { + + for ( var index = 0; index < data.length; index++ ) + { + if (data[ index ].parents == data[key].tid && data[ index ].depth == 1) + if (index == parseInt(document.getElementById("hidsxolh").value)) + { + $('#el-sxolh') + .append($("<option selected></option>") + .attr("value",index) + .text(data[ index ].name)); + + for ( var index1 = 0; index1 < data.length; index1++ ) + { + if (data[ index1 ].parents == data[index].tid && data[ index1 ].depth == 2) + if (index1 == parseInt(document.getElementById("hidtmhma").value)) + { + + $('#el-tmhma') + .append($("<option selected></option>") + .attr("value",index1) + .text(data[ index1 ].name)); + } + else + { + + $('#el-tmhma') + .append($("<option ></option>") + .attr("value",index1) + .text(data[ index1].name)); + + } + + } + + } + + else + { + $('#el-sxolh') + .append($("<option ></option>") + .attr("value",index) + .text(data[ index ].name)); + + + } + + } + }); +} + + + + +function refresh1(key) { + + + $.post({ + url: 'http://relabs1.minedu.gov.gr/mypoint/taxonomy_vocabulary/getTree.json', + type: 'POST', + data: { vid: "15"} , + dataType: 'json', + + }).done(function(data1, statusText, resObject) { + + + for ( var index1 = 0; index1 < data1.length; index1++ ) { + if (data1[index1].parents == data1[key].tid && data1[ index1 ].depth == 1) + if (index1 == parseInt(document.getElementById("hidinstitute").value)){ + + + $('#el-institute') + .append($("<option selected></option>") + .attr("value",index1) + .text(data1[ index1 ].name)); + + } + + else + { + $('#el-institute') + .append($("<option ></option>") + .attr("value",index1) + .text(data1[ index1 ].name)); + + + } + + } + + + + if (parseInt(document.getElementById("hidinstitute").value)== 1000) + { + + $('#el-institute') + .append($("<option selected></option>") + .attr("value",1000) + .text("ΞΞΞΞ")); + + $('#el-other').attr("disabled", false); + } + else + { + $("#el-institute").append('<option value=1000>ΞΞΞΞ</option>'); + } + + }); +}