Commit 99b83e2a authored by Aspasia Katsi's avatar Aspasia Katsi

rebase

parent 3820b2c3
...@@ -32,15 +32,23 @@ $events('on', 'app.services', function ($container) { ...@@ -32,15 +32,23 @@ $events('on', 'app.services', function ($container) {
return new GrEduLabs\UniversityForm\InputFilter\UniversityForm(); 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) { $container[GrEduLabs\UniversityForm\Action\UniversityForm::class] = function ($c) {
return new GrEduLabs\UniversityForm\Action\UniversityForm( return new GrEduLabs\UniversityForm\Action\UniversityForm(
$c->get('view'), $c->get('view'),
$c->get(GrEduLabs\UniversityForm\Service\UniversityFormServiceInterface::class), $c->get(GrEduLabs\UniversityForm\Service\UniversityFormServiceInterface::class),
$c->get(GrEduLabs\UniversityForm\InputFilter\UniversityForm::class), $c->get(GrEduLabs\UniversityForm\InputFilter\UniversityForm::class),
$c->get(GrEduLabs\UniversityForm\InputFilter\UniversityForm1::class),
$c->get('router')->pathFor('university_form.submit_success'), $c->get('router')->pathFor('university_form.submit_success'),
$c); $c);
}; };
$container[GrEduLabs\UniversityForm\Action\SubmitSuccess::class] = function ($c) { $container[GrEduLabs\UniversityForm\Action\SubmitSuccess::class] = function ($c) {
return new GrEduLabs\UniversityForm\Action\SubmitSuccess( return new GrEduLabs\UniversityForm\Action\SubmitSuccess(
$c->get('view'), $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);
-- 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 ...@@ -49,12 +49,14 @@ class UniversityForm
protected $successUrl; protected $successUrl;
public function __construct( 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->view = $view;
$this->UniversityFormService = $UniversityFormService; $this->UniversityFormService = $UniversityFormService;
$this->UniversityFormInputFilter = $UniversityFormInputFilter; $this->UniversityFormInputFilter = $UniversityFormInputFilter1;
$this->UniversityFormInputFilter2 = $UniversityFormInputFilter2;
$this->UniversityFormInputFilter1 = $UniversityFormInputFilter1;
$this->successUrl = $successUrl; $this->successUrl = $successUrl;
$this->container = $container; $this->container = $container;
} }
...@@ -66,9 +68,18 @@ class UniversityForm ...@@ -66,9 +68,18 @@ class UniversityForm
if ($req->isPost()) { if ($req->isPost()) {
$reqParams = $req->getParams(); $reqParams = $req->getParams();
if (isset($reqParams['newselect'])&& $reqParams['newselect']=='ereunitika')
{
$this->UniversityFormInputFilter = $this->UniversityFormInputFilter2;
}
else
{
$this->UniversityFormInputFilter = $this->UniversityFormInputFilter1;
}
$this->UniversityFormInputFilter->setData($reqParams); $this->UniversityFormInputFilter->setData($reqParams);
$isValid = $this->UniversityFormInputFilter->isValid(); $isValid = $this->UniversityFormInputFilter->isValid();
if ($isValid) { if ($isValid) {
$data = $this->UniversityFormInputFilter->getValues(); $data = $this->UniversityFormInputFilter->getValues();
......
...@@ -20,23 +20,43 @@ class UniversityForm extends InputFilter ...@@ -20,23 +20,43 @@ class UniversityForm extends InputFilter
public function __construct() public function __construct()
{ {
$newselect = new Input('newselect');
$newselect->setRequired(false)
->getFilterChain();
$ereunitiko = new Input('ereunitiko');
$ereunitiko->setRequired(true)
->getFilterChain();
$institute = new Input('institute');
$idrima = new Input('idrima'); $institute->setRequired(false)
$idrima->setRequired(true) ->getFilterChain();
->getFilterChain();
$other = new Input('other');
$sxolh = new Input('sxolh'); $other->setRequired(false)
$sxolh->setRequired(false) ->getFilterChain();
->getFilterChain();
$tmhma = new Input('tmhma');
$tmhma->setRequired(false) $idrima = new Input('idrima');
->getFilterChain(); $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 = new Input('erga');
$erga->setRequired(false) $erga->setRequired(false)
->getFilterChain() ->getFilterChain()
...@@ -82,7 +102,11 @@ class UniversityForm extends InputFilter ...@@ -82,7 +102,11 @@ class UniversityForm extends InputFilter
->attach(new Filter\StringTrim()); ->attach(new Filter\StringTrim());
$this ->add($idrima) $this->add($newselect)
->add($ereunitiko)
->add($institute)
->add($other)
->add($idrima)
->add($sxolh) ->add($sxolh)
->add($tmhma) ->add($tmhma)
->add($erga) ->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 ...@@ -23,6 +23,9 @@ class UniversityFormService implements UniversityFormServiceInterface
$appForm->idrima = $data['idrima']; $appForm->idrima = $data['idrima'];
$appForm->sxolh = $data['sxolh']; $appForm->sxolh = $data['sxolh'];
$appForm->tmhma = $data['tmhma']; $appForm->tmhma = $data['tmhma'];
$appForm->ereunitiko = $data['ereunitiko'];
$appForm->institute = $data['istitute'];
$appForm->other = $data['other'];
$appForm->erga = $data['erga']; $appForm->erga = $data['erga'];
$appForm->person = $data['person']; $appForm->person = $data['person'];
$appForm->telef = trim($data['telef']); $appForm->telef = trim($data['telef']);
......
...@@ -29,16 +29,24 @@ input[type=text] { ...@@ -29,16 +29,24 @@ input[type=text] {
<div class="table-responsive"> <div class="table-responsive">
<fieldset> <fieldset>
<div id="items-list"> <div id="items-list">
{{ macros.select('idrima', 'Ίδρυμα', '', form.values.idrima, { 'id': 'idrima'} )}} <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('sxolh', 'Σχολή','', form.values.sxolh,{ 'id': 'sxolh'} ) }}
{{ macros.select('tmhma', 'Τμήμα','', form.values.tmhma, { 'id': 'tmhma'}) }} {{ 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('erga', 'Εργαστήριο',form.values.erga ) }}
{{ macros.input('person', 'Υπεύθυνος Επικοινωνίας',form.values.person ) }} {{ macros.input('person', 'Υπεύθυνος Επικοινωνίας',form.values.person ) }}
{{ macros.input('telef', 'Τηλέφωνο',form.values.telef ) }} {{ macros.input('telef', 'Τηλέφωνο',form.values.telef ) }}
{{ macros.input('email', 'Email',form.values.email ) }} {{ macros.input('email', 'Email',form.values.email ) }}
<br> <br>
<br> <br>
<br> <br>
...@@ -68,6 +76,11 @@ input[type=text] { ...@@ -68,6 +76,11 @@ input[type=text] {
<input type="hidden" name="hididrima" id="hididrima" value="{{form.values.idrima}}"> <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="hidsxolh" id="hidsxolh" value="{{form.values.sxolh}}">
<input type="hidden" name="hidtmhma" id="hidtmhma" value="{{form.values.tmhma}}"> <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> </div>
<input type="hidden" name="{{ csrf.name_key }}" value="{{ csrf.name }}"> <input type="hidden" name="{{ csrf.name_key }}" value="{{ csrf.name }}">
<input type="hidden" name="{{ csrf.value_key }}" value="{{ csrf.value }}"> <input type="hidden" name="{{ csrf.value_key }}" value="{{ csrf.value }}">
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment