Skip to content
Snippets Groups Projects

Dev #13657 Newsletter Pagination Batch Mail

Merged Patrick Barroca requested to merge dev_#13657_newsletter_pagination_batch_mail into master
Compare and
+ 1620
876
Preferences
Compare changes
Files
@@ -62,6 +62,7 @@ class Admin_FormationController extends Zend_Controller_Action {
$formation = new Class_Formation();
if ($this->_setupFormationFormAndSave($formation, 'add'))
$this->_redirect('admin/formation/session_add/formation_id/'.$formation->getId());
return;
}
@@ -97,8 +98,8 @@ class Admin_FormationController extends Zend_Controller_Action {
protected function _setupFormationFormAndSave($formation, $action) {
$saved = false;
$form = $this->_formationForm($formation, $action);
if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
$formation
->updateAttributes($this->_request->getPost())
@@ -118,17 +119,17 @@ class Admin_FormationController extends Zend_Controller_Action {
->setMethod('post')
->setAction($this->view->url(array('action' => $action)))
->addElement('text', 'libelle', array(
'label' => 'Libellé *',
'size' => 50,
'required' => true,
'allowEmpty' => false ))
'label' => 'Libellé *',
'size' => 50,
'required' => true,
'allowEmpty' => false ))
->addElement('ckeditor', 'description', array(
'label' => 'Description',
'allowEmpty' => true))
'label' => 'Description',
'allowEmpty' => true))
->addDisplayGroup(
array('libelle', 'description'),
'formation',
array('legend' => 'Formation'))
array('libelle', 'description'),
'formation',
array('legend' => 'Formation'))
->populate($formation->toArray());
}
@@ -220,32 +221,36 @@ class Admin_FormationController extends Zend_Controller_Action {
public function sessionimpressionsAction() {
$session = Class_SessionFormation::getLoader()->find((int)$this->_getParam('id'));
$session = Class_SessionFormation::find((int)$this->_getParam('id'));
if(!$session){
$this->_redirect('admin/formation');
return;
}
$this->view->titre = sprintf('Impressions pour la session du %s de la formation "%s"',
$this->view->humanDate($session->getDateDebut(), 'd MMMM YYYY'),
$session->getLibelleFormation());
$this->view->session = $session;
$this->view->impressions = array(
'Liste des stagiaires' => array('action' => 'liste_stagiaires',
'form' => $this->_modeleFusionForm('FORMATION_LISTE_STAGIAIRES',
$session)),
'Liste des stagiaires' => array('action' => 'liste_stagiaires',
'form' => $this->_modeleFusionForm('FORMATION_LISTE_STAGIAIRES',
$session)),
'Fiche d\'émargement' => array('action' => 'fiche_emargement',
'form' => $this->_modeleFusionForm('FORMATION_EMARGEMENT',
$session)),
'Convocations' => array('action' => 'convocations',
'form' => $this->_modeleFusionForm('FORMATION_CONVOCATION',
$session)),
'Fiche d\'émargement' => array('action' => 'fiche_emargement',
'form' => $this->_modeleFusionForm('FORMATION_EMARGEMENT',
$session)),
'Convocations' => array('action' => 'convocations',
'form' => $this->_modeleFusionForm('FORMATION_CONVOCATION',
$session)),
'Attestations' => array('action' => 'attestations',
'form' => $this->_modeleFusionForm('FORMATION_ATTESTATION',
$session)),
'Attestations' => array('action' => 'attestations',
'form' => $this->_modeleFusionForm('FORMATION_ATTESTATION',
$session)),
'Refus' => array('action' => 'refus',
'form' => $this->_modeleFusionForm('FORMATION_REFUS',
$session)));
'Refus' => array('action' => 'refus',
'form' => $this->_modeleFusionForm('FORMATION_REFUS',
$session)));
}
@@ -327,7 +332,10 @@ class Admin_FormationController extends Zend_Controller_Action {
->setFormation($formation);
$this->view->formation = $formation;
$this->_setupSessionFormAndSave($session, 'sessionadd');
$this->_setupSessionFormAndSave($session, 'sessionadd')
? $formation->addSession($session)->save()
: '';
}
@@ -356,17 +364,12 @@ class Admin_FormationController extends Zend_Controller_Action {
}
$this->view->session = $session;
$this->view->getHelper('SubscribeUsers')
->setUsers($session->getStagiairesSortedByNom())
->setSearch($this->_getParam('search'))
->filterByRight(Class_UserGroup::RIGHT_SUIVRE_FORMATION)
->setSearchLabel($this->view->_('Rechercher des stagiaires'))
->setSubmitLabel($this->view->_('Inscrire les stagiaires sélectionnés'));
$this->view->titre = sprintf('Liste des participants à la session du %s de la formation "%s"',
$this->view->humanDate($session->getDateDebut(), 'd MMMM YYYY'),
$session->getFormation()->getLibelle());
$this->view->page = $this->_request->getParam('page');
$this->view->search = $this->_getParam('search');
$this->view->titre = sprintf(
'Liste des participants à la session du %s de la formation "%s"',
$this->view->humanDate($session->getDateDebut(), 'd MMMM YYYY'),
$session->getFormation()->getLibelle());
}
@@ -379,7 +382,7 @@ class Admin_FormationController extends Zend_Controller_Action {
if (is_array($intervenant_ids = $this->_request->getPost('intervenant_ids'))) {
foreach($intervenant_ids as $intervenant_id)
$intervenants []= Class_Users::getLoader()->find($intervenant_id);
$intervenants []= Class_Users::find($intervenant_id);
unset($post['intervenant_ids']);
}
@@ -424,83 +427,83 @@ class Admin_FormationController extends Zend_Controller_Action {
->setMethod('post')
->setAction($this->view->url(array('action' => $action)))
->addElement('datePicker', 'date_debut', array(
'label' => 'Date début *',
'size' => 10,
'required' => true,
'allowEmpty' => false ))
'label' => 'Date début *',
'size' => 10,
'required' => true,
'allowEmpty' => false ))
->addElement('datePicker', 'date_fin', array(
'label' => 'Date fin',
'size' => 10 ))
'label' => 'Date fin',
'size' => 10 ))
->addElement('datePicker', 'date_limite_inscription', array(
'label' => 'Date limite d\'inscription *',
'size' => 10 ))
'label' => 'Date limite d\'inscription *',
'size' => 10 ))
->addElement('text', 'effectif_min', array(
'label' => 'Effectif minimum *',
'size' => 2,
'required' => true,
'allowEmpty' => false,
'validators' => array('int')))
'label' => 'Effectif minimum *',
'size' => 2,
'required' => true,
'allowEmpty' => false,
'validators' => array('int')))
->addElement('text', 'effectif_max', array(
'label' => 'Effectif maximum *',
'size' => 2,
'required' => true,
'allowEmpty' => false,
'validators' => array('int')))
'label' => 'Effectif maximum *',
'size' => 2,
'required' => true,
'allowEmpty' => false,
'validators' => array('int')))
->addElement('text', 'duree', array(
'label' => 'Durée (h)',
'size' => 2,
'validators' => array('int')))
'label' => 'Durée (h)',
'size' => 2,
'validators' => array('int')))
->addElement('text', 'horaires', array(
'label' => 'Horaires *',
'size' => 50,
'required' => true,
'allowEmpty' => false))
'label' => 'Horaires *',
'size' => 50,
'required' => true,
'allowEmpty' => false))
->addElement('select', 'lieu_id', array('label' => 'Lieu',
'multiOptions' => Class_Lieu::getAllLibelles()))
->addElement('text', 'cout', array(
'label' => 'Coût',
'size' => 6,
'validators' => array('int')))
'label' => 'Coût',
'size' => 6,
'validators' => array('int')))
->addElement('checkbox', 'is_annule', array('label' => 'Session annulée'))
->addElement($intervenants_checkboxes)
->addElement('ckeditor', 'contenu', array(
'label' => '',
'required' => true,
'allowEmpty' => false))
'label' => '',
'required' => true,
'allowEmpty' => false))
->addElement('ckeditor', 'compte_rendu', array('label' => ''))
->addDisplayGroup(
array('date_debut',
'date_fin',
'date_limite_inscription',
'effectif_min',
'effectif_max',
'lieu_id',
'horaires',
'duree',
'cout',
'is_annule'),
'session',
array('legend' => 'Session'))
array('date_debut',
'date_fin',
'date_limite_inscription',
'effectif_min',
'effectif_max',
'lieu_id',
'horaires',
'duree',
'cout',
'is_annule'),
'session',
array('legend' => 'Session'))
->addDisplayGroup(
array('intervenant_ids'),
'intervenants',
array('legend' => 'Intervenants'))
array('intervenant_ids'),
'intervenants',
array('legend' => 'Intervenants'))
->addDisplayGroup(
array('contenu'),
'programme',
array('legend' => 'Contenu *'))
array('contenu'),
'programme',
array('legend' => 'Contenu *'))
->addDisplayGroup(
array('compte_rendu'),
'bilan',
array('legend' => 'Compte-rendu'))
array('compte_rendu'),
'bilan',
array('legend' => 'Compte-rendu'))
->populate($session->toArray());
}
@@ -516,10 +519,10 @@ class Admin_FormationController extends Zend_Controller_Action {
->addElement('ckeditor',
$modele_fusion->getNom(),
array(
'label' => '',
'value' => $modele_fusion->getContenu(),
'required' => true,
'allowEmpty' => false));
'label' => '',
'value' => $modele_fusion->getContenu(),
'required' => true,
'allowEmpty' => false));
}
}
@@ -611,14 +614,14 @@ class FusionDateContext {
class SessionStagiairesFusionStrategy extends AbstractSessionFusionStrategy{
public function getContenuFusionne($session_formation) {
$lettres = array();
$lettres = [];
$stagiaires = $session_formation->getStagiaires();
foreach($stagiaires as $stagiaire)
$lettres []= $this->_modele_fusion
->setDataSource(array('session_formation' => $session_formation,
'stagiaire' => $stagiaire,
"date_jour" => new FusionDateContext()))
->getContenuFusionne();
->setDataSource(array('session_formation' => $session_formation,
'stagiaire' => $stagiaire,
"date_jour" => new FusionDateContext()))
->getContenuFusionne();
return implode('<div style="page-break-after: always"></div>', $lettres);