Skip to content
Snippets Groups Projects

Dev #15264 upgrade contact form

Closed Ghislain Loas requested to merge dev_#15264_upgrade_contact_form into WIP
Compare and
+ 512
261
Preferences
Compare changes
Files
@@ -16,12 +16,12 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Admin_ModulesController extends ZendAfi_Controller_Action {
protected
protected
$profil,
$curent_profil,
$preferences,
@@ -38,17 +38,17 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
$this->initParams();
if (array_key_exists('type_module', $this->_request->getParams()))
$this->initViewParams();
}
public function preDispatch() {
parent::preDispatch();
if ($this->_request->getActionName()!='kiosque-change-data' &&
if ($this->_request->getActionName()!='kiosque-change-data' &&
$this->_request->getActionName()!='search-result')
Zend_Layout::startMvc();
}
protected function initParams() {
$this->profil = Class_Profil::getCurrentProfil();
@@ -66,23 +66,25 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
$this->view->preferences = $this->preferences;
$this->view->url=$this->_request->getRequestUri();
$this->view->combo_templates =
ZendAfi_View_Helper_Accueil_Base::getComboTemplates($this->preferences['boite'],
$this->view->combo_templates =
ZendAfi_View_Helper_Accueil_Base::getComboTemplates($this->preferences['boite'],
$this->profil);
$this->view->id_profil = $this->profil->getId();
$this->view->id_bib = $this->profil->getIdSite();
$this->view->action = $this->_getParam('type_module').'_'.$this->_getParam('action1');
}
protected function _simpleAction($script) {
if ($this->_request->isPost())
return $this->updateEtRetour($this->_request->getPost());
$this->render->renderScript('modules/' . $script . '.phtml');
}
public function indexAction() {
if($this->_getParam('action1') === 'formulairecontact')
return $this->_simpleAction('formulaire_contact');
return $this->_simpleAction('index_all');
}
@@ -98,7 +100,7 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
public function cmsAction() {
return $this->_simpleAction(($this->_getParam('action1') == 'articleviewbydate')
return $this->_simpleAction(($this->_getParam('action1') == 'articleviewbydate')
? 'cms_articleviewbydate' : 'cms_all');
}
@@ -122,7 +124,9 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
return $this->_simpleAction('blog_all');
}
public function formulairecontactAction() {
return $this->_simpleAction('formulaire_contact');
}
public function catalogueAction() {
$this->view->titre = 'Domaines';
@@ -142,12 +146,12 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
return $this->_forward('search-result');
if ($this->_request->isPost())
return $this->updateEtRetour((('viewnotice' == $this->_getParam('action1'))
? $this->getPostNotice()
return $this->updateEtRetour((('viewnotice' == $this->_getParam('action1'))
? $this->getPostNotice()
: $this->_request->getPost()));
$this->view->titre = 'Recherche';
if ('viewnotice' == $this->_getParam('action1')) {
$this->view->type_doc = $this->_getParam('action2');
$this->view->preferences = $this->noticeConsolidationOnglets($this->preferences);
@@ -159,8 +163,8 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
public function searchResultAction() {
$post_values = $this->_request->getPost();
$form =
$form =
ZendAfi_Form_Configuration_SearchResult::newConfigurationWith(
array_merge(Class_Profil::getCurrentProfil()
->getConfigurationOf('recherche', 'resultat', 'simple'),
@@ -173,27 +177,27 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
}
protected function getPostListe() {
protected function getPostListe() {
$liste_nb_par_page = (int)$liste_nb_par_page;
$facettes_nombre = (int)$facettes_nombre;
$tags_nombre = (int)$tags_nombre;
if ($liste_nb_par_page < 3 or $liste_nb_par_page > 50)
if ($liste_nb_par_page < 3 or $liste_nb_par_page > 50)
return "Le nombre de notices par page doit être compris entre 3 et 50";
if(!trim($liste_codes))
if(!trim($liste_codes))
return "Indiquez au moins 1 champ à afficher pour la liste";
if($facettes_actif == 1 and $facettes_nombre < 2 or $facettes_nombre > 10)
if($facettes_actif == 1 and $facettes_nombre < 2 or $facettes_nombre > 10)
return "Le nombre de facettes doit être compris entre 2 et 10";
if($facettes_actif == 1 and !trim($facettes_codes))
if($facettes_actif == 1 and !trim($facettes_codes))
return "Indiquez au moins 1 facette à afficher";
if($tags_actif == 1 and $tags_nombre < 5 or $tags_nombre > 1000)
if($tags_actif == 1 and $tags_nombre < 5 or $tags_nombre > 1000)
return "Le nombre de tags doit être compris entre 5 et 1000";
if($tags_actif == 1 and !trim($tags_codes))
if($tags_actif == 1 and !trim($tags_codes))
return "Indiquez au moins 1 type de tag à afficher";
return 'ok';
@@ -224,14 +228,14 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
$preferences["onglets"][$key]["aff"] = 0;
$preferences["onglets"][$key]["ordre"] = 100;
$preferences["onglets"][$key]["largeur"] = 0;
}
}
}
foreach($preferences["onglets"] as $key => $valeur) {
if (!array_key_exists($key, $onglets))
unset($preferences["onglets"][$key]);
}
return $preferences;
}
@@ -257,14 +261,14 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
$champ = substr($clef, $pos + 1);
if ($champ == 'ordre') {
$valeur = (int)$valeur;
if($valeur < 1 or $valeur > 100)
$valeur = (int)$valeur;
if($valeur < 1 or $valeur > 100)
$valeur = '1';
}
if ($champ == 'largeur') {
$valeur = (int)$valeur;
if($valeur < 5 or $valeur > 50)
$valeur = (int)$valeur;
if($valeur < 5 or $valeur > 50)
$valeur = '0';
}
@@ -294,10 +298,10 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
$this->view->preferences = $this->_request->getPost();
}
public function kiosqueChangeDataAction() {
$this->id_module = $this->_getParam('id_module');
$module_config = $this->profil
->getModuleAccueilConfig($this->_getParam('id_module'), 'KIOSQUE');
@@ -323,7 +327,7 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
$enreg[$clef] = addslashes($valeur);
$module_config['preferences'][$clef]=addslashes($valeur);
}
$this->profil
->updateModuleConfigAccueil($this->id_module, $module_config)
->save();