Skip to content
Snippets Groups Projects
Commit dbb299df authored by Ασπασία Κατσή's avatar Ασπασία Κατσή
Browse files

Merge branch 'ereunitika' into 'master'

Ereunitika

See merge request !26
parents 3820b2c3 9be8c800
No related branches found
No related tags found
1 merge request!26Ereunitika
......@@ -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'),
......
ALTER TABLE `univ`
DROP COLUMN `ereunitiko`,
DROP COLUMN `institute` ,
DROP COLUMN `other` ;
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
-- 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;
......@@ -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();
......
......@@ -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)
......
<?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);
}
}
......@@ -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']);
......
......@@ -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 }}">
......
......@@ -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>');
}
});
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment