Commit e68c0e9f authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch...

Merge branch 'dev#73233_planif_contractuel_minsoc_formulaire_gerer_le_rendu_cote_front' into 'master'

Dev#73233 planif contractuel minsoc formulaire gerer le rendu cote front

See merge request afi/opacce!2655
parents b7fe9151 7819f893
......@@ -13,3 +13,6 @@
[submodule "library/iCal"]
path = library/iCal
url = http://git.afi-sa.net/afi/iCal.git
[submodule "library/PhpParser"]
path = library/PhpParser
url = http://git.afi-sa.net/afi/PHP-Parser.git
'73233' =>
['Label' => $this->_('Personnalisatio de la recherche avanacée'),
'Desc' => $this->_('Possibilité de personnaliser des formulaires de recherche avancées.'),
'Image' => '',
'Video' => '',
'Category' => '',
'Right' => function($feature_description, $user) {return true;},
'Wiki' => '',
'Test' => '',
'Date' => '2018-05-02'],
\ No newline at end of file
- ticket #74761 : Recherche avancée : possibilité d'utiliser les formulaires créés en administration dans la partie publique.
\ No newline at end of file
......@@ -183,27 +183,32 @@ class Admin_ModulesController extends ZendAfi_Controller_Action {
if ('resultat' == $this->_getParam('action1'))
return $this->_forward('search-result');
if('viewnotice' == $this->_getParam('action1'))
if ('viewnotice' == $this->_getParam('action1'))
return $this->_forward('record');
if ('avancee' == $this->_getParam('action1'))
return $this->_forward('advanced');
if ($this->isValidPostNotice())
return $this->updateEtRetour($this->getPostNotice());
if ($this->_request->isPost()
&& 'viewnotice' != $this->_getParam('action1'))
if ($this->_request->isPost())
return $this->updateEtRetour($this->_request->getPost());
$this->view->titre = $this->_('Recherche');
if ('viewnotice' == $this->_getParam('action1')) {
$this->view->type_doc = $this->_getParam('action2');
$this->view->preferences = $this->noticeConsolidationOnglets($this->preferences);
}
$this->render->renderScript('modules/recherche_' . $this->_getParam('action1') . '.phtml');
}
public function advancedAction() {
$this->view->form = ZendAfi_Form_Configuration_AdvancedSearch::newWith($this->preferences);
$this->view->form->setAction($this->view->url());
if ($this->_request->isPost())
$this->updateEtRetour($this->_request->getPost());
}
protected function isValidPostNotice() {
$this->preferences['links_zones_errors'] = '';
$this->preferences['thumbnail_fields_errors'] = '';
......
......@@ -52,12 +52,6 @@ class Admin_StatController extends ZendAfi_Controller_Action {
}
public function palmaresreservationnoticeAction() {
$this->view->titre = $this->_('Palmarès des réservations de notices');
$this->view->table_stat = $this->cls_stat->getPalmaresReservation($this->_getParam('type_doc'));
}
public function piwikAction() {
$this->view->titre = $this->_('Tableau de bord PIWIK');
if(!(new Class_AdminVar_Piwik())->isEnabled())
......
<?php
echo $this->renderForm($this->form);
?>
<?php echo $this->render('modules/_debut.phtml');?>
<br>
<fieldset>
<legend>Généralités</legend>
<table cellspacing="2">
<tr>
<td class="droite">Titre&nbsp;</td>
<td class="gauche"><input type="text" name="titre" size="55" value="<?php print($this->preferences["titre"]); ?>"></td>
</tr>
<tr>
<td class="droite">Proposer la sélection de bibliothèques&nbsp;</td>
<td class="gauche"><?php echo $this->formSelect("select_bib",$this->preferences["select_bib"],"",array("1" => "oui","0"=>"non")) ?></td>
</tr>
</table>
</fieldset>
<?php echo $this->render('modules/_fin.phtml');?>
<table>
<tr>
<td style="text-align:right">Type de document : </td>
<td style="text-align:left" width="70%"><?php echo $this->ComboCodification('type_doc', $_REQUEST["type_doc"],'onchange="window.location.replace(\''.BASE_URL.'/admin/stat/palmaresreservationnotice?type_doc=\' + this.value);"'); ?></td>
</tr>
</table>
<br/>
<table class="stat">
<tr>
<th class="stat" width="1%">Rang</th>
<th class="stat" width="1%">&nbsp;</th>
<th class="stat" width="50%">Titre</th>
<th class="stat" width="40%">Auteur</th>
<th class="stat" width="9%">Réservée</th>
</tr>
<?php
$rang=0;
$last_nombre=0;
if($this->table_stat)
{
foreach($this->table_stat as $notice)
{
// Calcul n° de rang
if($notice["nombre"] != $last_nombre)
{
$last_nombre=$notice["nombre"];
$rang++;
}
// Html
print('<tr>');
print('<td class="stat_nombre" style="text-align:center"><B>'.$rang.'</b></td>');
print('<td class="stat_libelle"><img src="'.URL_ADMIN_IMG.'supports/support_'.$notice["type_doc"].'.gif" border="0"></td>');
print('<td class="stat_libelle">'.$notice["titre"].'</td>');
print('<td class="stat_libelle">'.$notice["auteur"].'</td>');
print('<td class="stat_nombre">'.$notice["nombre"].'&nbsp;fois</td>');
print('</tr>');
}
}
print('</table>');
;
?>
<br>
......@@ -262,15 +262,13 @@ class RechercheController extends ZendAfi_Controller_Action {
public function avanceeAction() {
$annexes = Class_CodifAnnexe::findAllBy(['invisible' => 0,
'order' => 'libelle']);
if (!empty($annexes))
$this->view->annexes = ['' => 'tous'];
foreach($annexes as $annexe)
$this->view->annexes[$annexe->getCode()] = $annexe->getLibelle();
$this->view->annexes = Class_CodifAnnexe::getMultiOptions();
$this->view->criteres_recherche = $this->newCriteresRecherches($this->_request->getParams());
$this->view->search_forms =
Class_SearchForm::findAllByPrefs(isset($this->preferences['forms'])
? $this->preferences['forms']
: '');
}
......
<?php
$this->openBoite($this->_current_module["preferences"]["titre"]);
?>
<form method="get" action="<?php echo $this->url(['controller'=>'recherche','action'=>'simple'], null, true); ?>" name="recherche_avancee" class="recherche_avancee">
<div class="contenu">
<table style="border-collapse: collapse;">
<tr>
<td>
<?php
if (isset($this->_current_module["preferences"]["select_bib"]) && ($this->_current_module["preferences"]["select_bib"] == 1))
echo $_SESSION["selection_bib"]["html"];
?>
</td>
</tr>
<tr><td>
<table style="width: 600px;">
<tr>
<td>
<select name="operateur_titres" style="width:50px">
<option value="and" <?php if ($this->criteres_recherche->getParam('operateur_titres') == "and") print('selected="selected"'); ?>><?php echo $this->_('et'); ?></option>
<option value="or" <?php if ($this->criteres_recherche->getParam('operateur_titres') == "or") print('selected="selected"'); ?>><?php echo $this->_('ou'); ?></option>
<option value="and not" <?php if ($this->criteres_recherche->getParam('operateur_titres') == "and not") print('selected="selected"'); ?>><?php echo $this->_('sauf'); ?></option>
</select>
</td>
<td><?php echo $this->_('Titres') ?></td>
<td><input type="text" name="rech_titres" size="50" value="<?php echo $this->criteres_recherche->getParam('rech_titres',''); ?>"/></td>
</tr>
<tr>
<td>
<select name="operateur_auteurs" style="width:50px">
<option value="and" <?php if ($this->criteres_recherche->getParam('operateur_auteurs') == "and") print('selected="selected"'); ?>><?php echo $this->_('et'); ?></option>
<option value="or" <?php if ($this->criteres_recherche->getParam('operateur_auteurs') == "or") print('selected="selected"'); ?>><?php echo $this->_('ou'); ?></option>
<option value="and not" <?php if ($this->criteres_recherche->getParam('operateur_auteurs') == "and not") print('selected="selected"'); ?>><?php echo $this->_('sauf'); ?></option>
</select>
</td>
<td><?php echo $this->_('Auteurs'); ?></td>
<td><input type="text" name="rech_auteurs" size="50" value="<?php echo $this->criteres_recherche->getParam('rech_auteurs',''); ?>"/></td>
</tr>
<tr>
<td>
<select name="operateur_matieres" style="width:50px">
<option value="and" <?php if ($this->criteres_recherche->getParam('operateur_matieres') == "and") print('selected="selected"'); ?>><?php echo $this->_('et'); ?></option>
<option value="or" <?php if ($this->criteres_recherche->getParam('operateur_matieres') == "or") print('selected="selected"'); ?>><?php echo $this->_('ou'); ?></option>
<option value="and not" <?php if ($this->criteres_recherche->getParam('operateur_matieres') == "and not") print('selected="selected"'); ?>><?php echo $this->_('sauf'); ?></option>
</select>
</td>
<td><?php echo $this->_('Sujets'); ?></td>
<td><input type="text" name="rech_matieres" size="50" value="<?php echo $this->criteres_recherche->getParam('rech_matieres','');?>"/></td>
</tr>
<tr>
<td>
<select name="operateur_dewey" style="width:50px">
<option value="and" <?php if ($this->criteres_recherche->getParam('operateur_dewey') == "and") print('selected="selected"'); ?>><?php echo $this->_('et'); ?></option>
<option value="or" <?php if ($this->criteres_recherche->getParam('operateur_dewey') == "or") print('selected="selected"'); ?>><?php echo $this->_('ou'); ?></option>
<option value="and not" <?php if ($this->criteres_recherche->getParam('operateur_dewey') == "and not") print('selected="selected"'); ?>><?php echo $this->_('sauf'); ?></option>
</select>
</td>
<td><?php echo $this->_("Centres d'intérêt"); ?></td>
<td><input type="text" name="rech_dewey" size="50" value="<?php echo $this->criteres_recherche->getParam('rech_dewey',''); ?>"/></td>
</tr>
<tr>
<td>
<select name="operateur_editeur" style="width:50px">
<option value="and" <?php if ($this->criteres_recherche->getParam('operateur_editeur') == "and") print('selected="selected"'); ?>><?php echo $this->_('et'); ?></option>
<option value="or" <?php if ($this->criteres_recherche->getParam('operateur_editeur') == "or") print('selected="selected"'); ?>><?php echo $this->_('ou'); ?></option>
<option value="and not" <?php if ($this->criteres_recherche->getParam('operateur_editeur') == "and not") print('selected="selected"'); ?>><?php echo $this->_('sauf'); ?></option>
</select>
</td>
<td><?php echo $this->_('Editeur'); ?></td>
<td><input type="text" name="rech_editeur" size="50" value="<?php echo $this->criteres_recherche->getParam('rech_editeur'); ?>"/></td>
</tr>
<tr>
<td>
<select name="operateur_collection" style="width:50px">
<option value="and" <?php if ($this->criteres_recherche->getParam('operateur_collection') == "and") print('selected="selected"'); ?>><?php echo $this->_('et'); ?></option>
<option value="or" <?php if ($this->criteres_recherche->getParam('operateur_collection') == "or") print('selected="selected"'); ?>><?php echo $this->_('ou'); ?></option>
<option value="and not" <?php if ($this->criteres_recherche->getParam('operateur_collection') == "and not") print('selected="selected"'); ?>><?php echo $this->_('sauf'); ?></option>
</select>
</td>
<td><?php echo $this->_('Collection'); ?></td>
<td><input type="text" name="rech_collection" size="50" value="<?php echo $this->criteres_recherche->getParam('rech_collection'); ?>"/></td>
</tr>
</table>
<br />
<h2><?php echo $this->_('Options de la recherche :')?></h2>
<table style="width: 600px;">
<tr>
<td style="width: 200px;"><?php echo $this->_('Type de recherche'); ?></td>
<td><select name="type_recherche" style="width:190px">
<option value="fulltext" <?php if ($this->type_recherche == "fulltext") print('selected="selected"'); ?>><?php echo $this->_('Recherche par mots contenus');?></option>
<option value="commence" <?php if ($this->type_recherche == "commence") print('selected="selected"'); ?>><?php echo $this->_('Commence par');?></option>
</select></td>
</tr>
<tr>
<td><?php echo $this->_('Trier par');?></td>
<td><?php echo $this->formSelect('tri',
$this->tri,
'',
$this->criteres_recherche->getListeTris()); ?></td>
</tr>
</table>
<table style="width: 600px;">
<tr>
<td style="width: 200px;"><?php echo $this->_('Publié entre (Année sous forme 1980)');?></td>
<td><input type="text" name="annee_debut" value="<?php echo $this->criteres_recherche->getParam('annee_debut',''); ?>" maxlength="4" size="5" onkeyup="chiffres(this)" onkeydown="chiffres(this)"/>
&nbsp;&nbsp;<?php echo $this->_('et');?>&nbsp;&nbsp;
<input type="text" name="annee_fin" value="<?php echo $this->criteres_recherche->getParam('annee_fin',''); ?>" maxlength="4" size="5" onkeyup="chiffres(this)" onkeydown="chiffres(this)"/></td>
</tr>
<tr>
<td><?php echo $this->_('Nouveautés de moins de');?></td>
<td>
<select name="nouveaute" id="nouveaute" style="width:200px;">
<option value=""></option>
<option value="1" <?php if ($this->criteres_recherche->getNouveaute()==1) echo 'selected'; ?>
><?php echo $this->_('1 mois');?></option>
<option value="3" <?php if ($this->criteres_recherche->getNouveaute()==3) echo 'selected'; ?>
><?php echo $this->_('3 mois');?></option>
<option value="6" <?php if ($this->criteres_recherche->getNouveaute()==6) echo 'selected'; ?>
><?php echo $this->_('6 mois');?></option>
<option value="12" <?php if ($this->criteres_recherche->getNouveaute()==12) echo 'selected'; ?>
><?php echo $this->_('1 an');?></option>
<option value="60" <?php if ($this->criteres_recherche->getNouveaute()==60) echo 'selected'; ?>
><?php echo $this->_('5 ans');?></option>
</select>
</td>
</tr>
<tr>
<td><?php echo $this->_('Type de document');?></td>
<td><?php echo $this->ComboCodification('type_doc',
$this->criteres_recherche->getTypeDoc()); ?></td>
</tr>
<?php
if($this->annexes)
{
echo '<tr>';
echo '<td>'.$this->_('Site').'</td>';
echo '<td>'.$this->formSelect('annexe',$this->criteres_recherche->getAnnexe(),'',$this->annexes).'</td>';
echo '</tr>';
}
?>
<tr>
<td><?php echo $this->_('Section');?></td>
<td><?php echo $this->ComboCodification('section', $this->criteres_recherche->getSection()); ?></td>
</tr>
<tr>
<td class="droite" valign="top"><?php echo $this->traduire('Genres'); ?></td>
<td class="gauche"><?php echo $this->TagListeCoches("genre","genre"); ?></td>
</tr>
</table>
</td></tr>
</table>
<div style="text-align: right;width: 600px;padding-right:20px;padding-top:10px;">
<table style="width: 100%">
<tr>
<td style="text-align:center">
<input style="cursor:pointer" type="submit" class="bouton" value="<?php echo $this->_('Lancer la recherche');?>" javascript=";setFlagMaj(false);"/></td>
</tr>
</table></div>
</div>
</form>
<?php
$this->closeBoite();
// Historique des recherches
echo '<div class="conteneur_simple">';
echo $this->historiqueRecherche();
echo '</div>';
?>
echo
$this->openBoite($this->_current_module['preferences']['titre'])
. $this->advancedSearch($this->search_forms)
. $this->closeBoite()
. $this->tag('div', $this->historiqueRecherche(), ['class' => 'conteneur_simple']);
\ No newline at end of file
'73233' =>
['Label' => $this->_('Recherches configurables'),
'Desc' => $this->_('Bokeh vous permet de proposer des formulaires de recherche adaptés à vos besoins.'),
'Image' => '',
'Video' => '',
'Category' => '',
'Right' => function($feature_description, $user) {return true;},
'Wiki' => '',
'Test' => '',
'Date' => '2018-04-24'],
\ No newline at end of file
- ticket #73233 : Recherche : Ajout de la possibilité de configurer plusieurs formulaires de recherches avancée
\ No newline at end of file
This diff is collapsed.
......@@ -20,6 +20,8 @@
*/
class CodifAnnexeLoader extends Storm_Model_Loader {
use Trait_Translator;
public function findAllByPickup() {
return Class_CodifAnnexe::findAllBy(['no_pickup' => '0',
'order' => 'libelle']);
......@@ -33,6 +35,16 @@ class CodifAnnexeLoader extends Storm_Model_Loader {
: '';
}
public function getMultiOptions() {
$annexes = Class_CodifAnnexe::findAllBy(['invisible' => 0,
'order' => 'libelle']);
$options = ['' => $this->_('tous')];
foreach($annexes as $annexe)
$options[$annexe->getCode()] = $annexe->getLibelle();
return $options;
}
}
......@@ -114,4 +126,3 @@ class Class_CodifAnnexe extends Storm_Model_Abstract {
return static::CODE_FACETTE.$this->getCode();
}
}
?>
......@@ -20,13 +20,32 @@
*/
class Class_CodifSectionLoader extends Storm_Model_Loader {
use Trait_Translator;
public function labelsOfIds($ids) {
return (new Storm_Model_Collection(Class_CodifSection::findAllBy(['id_section' => $ids])))
->collect('libelle');
}
public function getMultiOptions() {
$datas = Class_CodifSection::findAllBy(['invisible' => 0, 'order' => 'libelle']);
$items = ['' => $this->_('toutes')];
$controle = '';
foreach ($datas as $data) {
if (!$code = $data->getId())
continue;
$items[$code] = $data->getLibelle();
}
return $items;
}
}
class Class_CodifSection extends Storm_Model_Abstract {
use Trait_Facetable;
......@@ -38,4 +57,3 @@ class Class_CodifSection extends Storm_Model_Abstract {
protected $_default_attribute_values = ['invisible' => 0];
}
?>
......@@ -304,6 +304,19 @@ class Class_FileManager extends Class_Entity {
}
public function isDownloadable() {
if(!$this->isFile())
return false;
return !$this->isPhp();
}
public function isPhp() {
return 'php' == strtolower($this->getExtension());
}
public function isDot() {
return $this->getDot();
}
......@@ -494,4 +507,9 @@ class Class_FileManager extends Class_Entity {
public function getMTime() {
return $this->_attribs['MTime'];
}
public function getContent() {
return static::getFileSystem()->getContent($this->getRealpath());
}
}
\ No newline at end of file
......@@ -359,4 +359,9 @@ class Class_FileManager_FileSystem {
public function createImage($path, $content) {
return file_put_contents($path, $content);
}
public function getContent($path) {
return file_get_contents($path);
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_Profil_Preferences_AdvancedSearch {
use Trait_Translator;
public function getDefaults() {
return
['barre_nav' => $this->_('Recherche avancée'), // Barre de nav
'titre' => $this->_('Recherche avancée'), // Titre de la boite
'select_bib' => 1, // Afficher le lien de sélection des bibliothèques
'liste_nb_par_page' => 10, // Nombre de notices par page
'liste_codes' => implode(';', // Champs à afficher
[Class_TypeDoc::CODE_FACETTE,
Class_CodifAuteur::CODE_FACETTE,
Class_Codification::CODE_EDITEUR]),
'forms' => '', // selected custom search forms list
];
}
}
......@@ -20,16 +20,59 @@
*/
class Class_SearchFormLoader extends Storm_Model_Loader {
public function getMultiOptions() {
$multi_options = [];
foreach (Class_SearchForm::findAllBy(['order' => 'label']) as $form) {
$multi_options[$form->getId()]=$form->getLabel();
}
return $multi_options;
}
public function findAllByPrefs($ids) {
if(!$ids)
return [];
if(!$ids = array_filter(explode(';', $ids)))
return [];
return Class_SearchForm::findAllBy(['id' => $ids,
'order' => sprintf('FIELD(id, %s)', implode(',', $ids))]);
}
}
class Class_SearchForm extends Storm_Model_Abstract {
use Trait_TimeSource;
protected $_table_name = 'search_form';
protected static $_includer;
protected
$_table_name = 'search_form',
$_loader_class = 'Class_SearchFormLoader';
protected $_default_attribute_values = ['label' => '',
'filename' => '',
'display_order' => 1,
'visible' => false,
'created_at' => ''];
/** @category testing */
public static function setIncluder($includer) {
static::$_includer = $includer;
}