Commit 2134f6fb authored by Patrick Barroca's avatar Patrick Barroca 😁
Browse files

tabs to spaces

parent b4117ca3

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -20,49 +20,49 @@
*/
class Admin_AjaxController extends Zend_Controller_Action {
public function preDispatch() {
$this->getHelper('ViewRenderer')->setNoRender();
}
public function preDispatch() {
$this->getHelper('ViewRenderer')->setNoRender();
}
public function listesuggestionAction() {
$autorite = $this->_getParam('type_autorite');
$id_champ = $this->_getParam('id_champ');
$mode_recherche = $this->_getParam('mode');
$recherche = $this->_getParam('valeur');
$limite_resultat = 100;
public function listesuggestionAction() {
$autorite = $this->_getParam('type_autorite');
$id_champ = $this->_getParam('id_champ');
$mode_recherche = $this->_getParam('mode');
$recherche = $this->_getParam('valeur');
$limite_resultat = 100;
if (!$authority = $this->getAuthorityFor($autorite)) {
print('mauvais code rubrique');
return;
}
if (!$authority = $this->getAuthorityFor($autorite)) {
print('mauvais code rubrique');
return;
}
$params = [$recherche, $mode_recherche, $limite_resultat];
if ('thesaurus' == $autorite)
$params[] = $id_champ;
$params = [$recherche, $mode_recherche, $limite_resultat];
if ('thesaurus' == $autorite)
$params[] = $id_champ;
if (!$liste = call_user_func_array([$authority, 'getListeSuggestion'], $params)) {
echo '';
return;
}
if (!$liste = call_user_func_array([$authority, 'getListeSuggestion'], $params)) {
echo '';
return;
}
foreach($liste as $item) {
echo '<div class="tag_liste" clef="'.$item[0].'" onclick="selectSuggest(\''.$id_champ.'\',this)">'.$item[1].'</div>';
}
}
foreach($liste as $item) {
echo '<div class="tag_liste" clef="'.$item[0].'" onclick="selectSuggest(\''.$id_champ.'\',this)">'.$item[1].'</div>';
}
}
protected function getAuthorityFor($code) {
$authorities = ['auteur' => new Class_Auteur(),
'matiere' => new Class_Matiere(),
'interet' => new Class_CodifCentreInteret(),
'dewey' => new Class_CodifDewey(),
'pcdm4' => new Class_CodifPcdm4(),
'thesaurus' => new Class_CodifThesaurus(),
'tag' => new Class_TagNotice()];
protected function getAuthorityFor($code) {
$authorities = ['auteur' => new Class_Auteur(),
'matiere' => new Class_Matiere(),
'interet' => new Class_CodifCentreInteret(),
'dewey' => new Class_CodifDewey(),
'pcdm4' => new Class_CodifPcdm4(),
'thesaurus' => new Class_CodifThesaurus(),
'tag' => new Class_TagNotice()];
if (isset($authorities[$code]))
return $authorities[$code];
}
if (isset($authorities[$code]))
return $authorities[$code];
}
}
?>
\ No newline at end of file
......@@ -19,57 +19,57 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Admin_AmberController extends Zend_Controller_Action {
use Trait_StaticFileWriter;
use Trait_StaticFileWriter;
public function init() {
$this->getHelper('ViewRenderer')->setNoRender();
}
public function init() {
$this->getHelper('ViewRenderer')->setNoRender();
}
protected function _writeContents($commit_path, $contents) {
if (self::getFileWriter()->putContents($commit_path, $contents)==0)
$this->getResponse()->setHttpResponseCode(500);
protected function _writeContents($commit_path, $contents) {
if (self::getFileWriter()->putContents($commit_path, $contents)==0)
$this->getResponse()->setHttpResponseCode(500);
}
}
protected function commitTo($commit_subpath) {
if (Class_ScriptLoader::getInstance()->isAmberModeDeploy())
return $this;
protected function commitTo($commit_subpath) {
if (Class_ScriptLoader::getInstance()->isAmberModeDeploy())
return $this;
if (!Class_Users::getIdentity()->isSuperAdmin())
return $this;
if (!Class_Users::getIdentity()->isSuperAdmin())
return $this;
$request_uri = $this->_request->getRequestUri();
$filename = array_last(explode('/', $request_uri));
$contents = $this->_request->getRawBody();
$request_uri = $this->_request->getRequestUri();
$filename = array_last(explode('/', $request_uri));
$contents = $this->_request->getRawBody();
$commit_path = './amber/';
if ($this->isAFIPackage($filename))
$commit_path .= 'afi/';
else
$commit_path .= 'src/';
$commit_path = './amber/';
if ($this->isAFIPackage($filename))
$commit_path .= 'afi/';
else
$commit_path .= 'src/';
$commit_path .= $commit_subpath.'/'.$filename;
$this->_writeContents($commit_path, $contents);
$commit_path .= $commit_subpath.'/'.$filename;
$this->_writeContents($commit_path, $contents);
return $this;
}
return $this;
}
public function isAFIPackage($filename) {
return (0 === strpos($filename, 'A'));
}
public function isAFIPackage($filename) {
return (0 === strpos($filename, 'A'));
}
public function commitjsAction() {
$this->commitTo('js');
}
public function commitjsAction() {
$this->commitTo('js');
}
public function commitstAction() {
$this->commitTo('st');
}
public function commitstAction() {
$this->commitTo('st');
}
}
?>
\ No newline at end of file
......@@ -20,51 +20,51 @@
*/
class Admin_AuthController extends Zend_Controller_Action {
use Trait_Translator;
use Trait_Translator;
function init() {
$viewRenderer = $this->getHelper('ViewRenderer');
$viewRenderer->setLayoutScript('sansMenuGauche.phtml');
}
function init() {
$viewRenderer = $this->getHelper('ViewRenderer');
$viewRenderer->setLayoutScript('sansMenuGauche.phtml');
}
//----------------------------------------------------------------------------------
// Retour à l'accueil apres authentification
//----------------------------------------------------------------------------------
function indexAction() {
$this->_redirect('admin/');
}
//----------------------------------------------------------------------------------
// Retour à l'accueil apres authentification
//----------------------------------------------------------------------------------
function indexAction() {
$this->_redirect('admin/');
}
function loginAction() {
$this->view->message = '';
if (!$this->_request->isPost())
return;
function loginAction() {
$this->view->message = '';
if (!$this->_request->isPost())
return;
// Champs de saisie
$f = new Zend_Filter_StripTags();
$username = $f->filter($this->_request->getPost('username'));
$password = $f->filter($this->_request->getPost('password'));
// Champs de saisie
$f = new Zend_Filter_StripTags();
$username = $f->filter($this->_request->getPost('username'));
$password = $f->filter($this->_request->getPost('password'));
if (empty($username)) {
$this->view->message = $this->_("Entrez votre nom d'utilisateur puis validez S.V.P.");
return;
}
if (empty($username)) {
$this->view->message = $this->_("Entrez votre nom d'utilisateur puis validez S.V.P.");
return;
}
$auth = ZendAfi_Auth::getInstance();
if (!$auth->authenticateLoginPassword($username, $password, [$auth->newAuthDb()]))
return;
$auth = ZendAfi_Auth::getInstance();
if (!$auth->authenticateLoginPassword($username, $password, [$auth->newAuthDb()]))
return;
$this->_redirect(
Class_Profil::getCurrentProfil()->isPublic()
? 'admin/'
: 'opac/index/index/id_profil/'.Class_Profil::getCurrentProfil()->getId());
}
$this->_redirect(
Class_Profil::getCurrentProfil()->isPublic()
? 'admin/'
: 'opac/index/index/id_profil/'.Class_Profil::getCurrentProfil()->getId());
}
function logoutAction() {
ZendAfi_Auth::getInstance()->clearIdentity();
$this->_redirect('admin/');
}
function logoutAction() {
ZendAfi_Auth::getInstance()->clearIdentity();
$this->_redirect('admin/');
}
}
......
......@@ -20,46 +20,46 @@
*/
class Admin_BatchController extends ZendAfi_Controller_Action {
public function getRessourceDefinitions() {
return [
'model' => ['class' => 'Class_Batch',
'name' => 'batch',
'order' => 'type'],
public function getRessourceDefinitions() {
return [
'model' => ['class' => 'Class_Batch',
'name' => 'batch',
'order' => 'type'],
'messages' => ['successful_add' => $this->_('Tâche ajoutée'),
'successful_delete' => $this->_('Tâche supprimée')],
'messages' => ['successful_add' => $this->_('Tâche ajoutée'),
'successful_delete' => $this->_('Tâche supprimée')],
'actions' => ['add' => ['title' => $this->_('Nouvelle Tâche')],
'index' => ['title' => $this->_('Tâches')]],
'actions' => ['add' => ['title' => $this->_('Nouvelle Tâche')],
'index' => ['title' => $this->_('Tâches')]],
'display_groups' => ['ajout_tache' => ['legend' => 'Ajouter une tâche',
'elements' => ['type' => ['element' => 'select',
'options' => ['multiOptions' => Class_Batch::getAvailableType(),
'required' => true]] ]]],
'after_add' => function() {$this->_redirect('/admin/batch');}
];
}
'display_groups' => ['ajout_tache' => ['legend' => 'Ajouter une tâche',
'elements' => ['type' => ['element' => 'select',
'options' => ['multiOptions' => Class_Batch::getAvailableType(),
'required' => true]] ]]],
'after_add' => function() {$this->_redirect('/admin/batch');}
];
}
public function runAction() {
Class_Batch::find($this->_getParam('id'))->run();
$this->_helper->notify($this->_('Tâche executée'));
$this->_redirect('/admin/batch');
}
public function runAction() {
Class_Batch::find($this->_getParam('id'))->run();
$this->_helper->notify($this->_('Tâche executée'));
$this->_redirect('/admin/batch');
}
public function runAjaxAction() {
$batch = Class_Batch::find($this->_getParam('id'));
$this->view->titre = $this->view->_('Exécution du traitement "%s"', $batch->getLibelle());
$this->view->batch = $batch;
}
public function runAjaxAction() {
$batch = Class_Batch::find($this->_getParam('id'));
$this->view->titre = $this->view->_('Exécution du traitement "%s"', $batch->getLibelle());
$this->view->batch = $batch;
}
public function runStepAction() {
$this->_helper->json(
Class_Batch::find($this->_getParam('id'))
->runStep($this->_request->getParams()));
}
public function runStepAction() {
$this->_helper->json(
Class_Batch::find($this->_getParam('id'))
->runStep($this->_request->getParams()));
}
}
?>
\ No newline at end of file
......@@ -21,236 +21,236 @@
class Admin_CatalogueController extends ZendAfi_Controller_Action {
protected $_user;
protected $_user;
public function preDispatch() {
parent::preDispatch();
public function preDispatch() {
parent::preDispatch();
$this->_user = Class_Users::getIdentity();
$this->_user = Class_Users::getIdentity();
if (!($this->_user->hasRightConfigFront() || $this->_user->hasRightAccessDomaines()))
$this->_redirect('/admin/index');
if (!($this->_user->hasRightConfigFront() || $this->_user->hasRightAccessDomaines()))
$this->_redirect('/admin/index');
$this->view->user = $this->_user;
}
$this->view->user = $this->_user;
}
public function indexAction() {
if (!$this->view->catalogues = Class_Catalogue::findTopCatalogues())
$this->view->message = $this->_('Aucun domaine n\'a été trouvé');
$this->view->titre = $this->_('Définition des domaines');
}
public function indexAction() {
if (!$this->view->catalogues = Class_Catalogue::findTopCatalogues())
$this->view->message = $this->_('Aucun domaine n\'a été trouvé');
$this->view->titre = $this->_('Définition des domaines');
}
public function testerAction() {
if (!$id_catalogue = (int)$this->_getParam("id_catalogue"))
$this->_redirect("admin/catalogue/index");
public function testerAction() {
if (!$id_catalogue = (int)$this->_getParam("id_catalogue"))
$this->_redirect("admin/catalogue/index");
if (!$catalogue = Class_Catalogue::find($id_catalogue))
$this->_redirect("admin/catalogue/index");
if (!$catalogue = Class_Catalogue::find($id_catalogue))
$this->_redirect("admin/catalogue/index");
$ret = ['requete' => '',
'temps_execution' => '',
'nb_notices' => 0,
'avec_vignettes' => 0,
'notices' => ''];
$ret = ['requete' => '',
'temps_execution' => '',
'nb_notices' => 0,
'avec_vignettes' => 0,
'notices' => ''];
$ret = array_merge($ret, $catalogue->getTestCatalogue());
if (defined('DEVELOPMENT')) {
$page=0;
if ($catalogue->getIndexer()) {
while ($catalogue->updateNoticesWithFacette(1000,$page)) {
$page++;
}
}
}
$ret = array_merge($ret, $catalogue->getTestCatalogue());
if (defined('DEVELOPMENT')) {
$page=0;
if ($catalogue->getIndexer()) {
while ($catalogue->updateNoticesWithFacette(1000,$page)) {
$page++;
}
}
}
$this->view->requete = $ret["requete"];
$this->view->temps_execution = $ret["temps_execution"] . " secs.";
$this->view->nb_notices = $ret["nb_notices"];
$this->view->avec_vignettes = $ret["avec_vignettes"];
$this->view->notices = $ret["notices"];
$this->view->id_catalogue = $id_catalogue;
$this->view->titre = 'Test du domaine: ' . $catalogue->getLibelle();
}
$this->view->requete = $ret["requete"];
$this->view->temps_execution = $ret["temps_execution"] . " secs.";
$this->view->nb_notices = $ret["nb_notices"];
$this->view->avec_vignettes = $ret["avec_vignettes"];
$this->view->notices = $ret["notices"];
$this->view->id_catalogue = $id_catalogue;
$this->view->titre = 'Test du domaine: ' . $catalogue->getLibelle();
}
public function addAction() {
$catalogue = $this->_newCatalogue();
public function addAction() {
$catalogue = $this->_newCatalogue();
if ($this->isSaved($catalogue)) {
if ($id_module = $this->_getParam('id_module'))
$this->updateConfigKiosque($id_module, $catalogue);
if ($this->isSaved($catalogue)) {
if ($id_module = $this->_getParam('id_module'))
$this->updateConfigKiosque($id_module, $catalogue);
$this->_helper->notify($this->_('Domaine %s ajouté', $catalogue->getLibelle()));
$this->_redirectClose('admin/catalogue/edit/id_catalogue/' . $catalogue->getId());
return;
}
$this->_helper->notify($this->_('Domaine %s ajouté', $catalogue->getLibelle()));
$this->_redirectClose('admin/catalogue/edit/id_catalogue/' . $catalogue->getId());
return;
}
$this->view->catalogue = $catalogue;
$this->view->titre = $this->_('Ajout de domaine');
$this->getHelper('ViewRenderer')->renderScript('catalogue/form.phtml');
}
$this->view->catalogue = $catalogue;
$this->view->titre = $this->_('Ajout de domaine');
$this->getHelper('ViewRenderer')->renderScript('catalogue/form.phtml');
}
protected function updateConfigKiosque($id_module, $catalogue){
$profil = Class_Profil::getCurrentProfil();
$module_config = $profil->getModuleAccueilConfig($id_module, 'KIOSQUE');
$module_config['preferences']['id_catalogue'] = $catalogue->getId();
$profil->updateModuleConfigAccueil($id_module, $module_config);
$profil->save();
return $this;
}
protected function updateConfigKiosque($id_module, $catalogue){
$profil = Class_Profil::getCurrentProfil();
$module_config = $profil->getModuleAccueilConfig($id_module, 'KIOSQUE');
$module_config['preferences']['id_catalogue'] = $catalogue->getId();
$profil->updateModuleConfigAccueil($id_module, $module_config);
$profil->save();
return $this;
}
public function editAction() {
if ((!$catalogue = Class_Catalogue::find((int)$this->_getParam('id_catalogue')))
|| (!$catalogue->canBeDeletedOrModifyByUser($this->_user))) {
$this->_redirect('admin/catalogue/index');
return;
}
public function editAction() {
if ((!$catalogue = Class_Catalogue::find((int)$this->_getParam('id_catalogue')))
|| (!$catalogue->canBeDeletedOrModifyByUser($this->_user))) {
$this->_redirect('admin/catalogue/index');
return;
}
if ($this->isSaved($catalogue)) {
$this->_helper->notify($this->_('Domaine %s sauvegardé', $catalogue->getLibelle()));
$this->_redirectClose('admin/catalogue/edit/id_catalogue/' . $catalogue->getId());
return;
}
if ($this->isSaved($catalogue)) {
$this->_helper->notify($this->_('Domaine %s sauvegardé', $catalogue->getLibelle()));
$this->_redirectClose('admin/catalogue/edit/id_catalogue/' . $catalogue->getId());
return;
}
$this->view->titre = $this->_('Modification du domaine: %s', $catalogue->getLibelle());
$this->view->catalogue=$catalogue;
$this->view->titre = $this->_('Modification du domaine: %s', $catalogue->getLibelle());
$this->view->catalogue=$catalogue;
$this->getHelper('ViewRenderer')->renderScript('catalogue/form.phtml');
}
$this->getHelper('ViewRenderer')->renderScript('catalogue/form.phtml');
}
public function duplicateAction() {
if (!$catalogue = Class_Catalogue::find((int)$this->_getParam("id_catalogue"))) {
$this->_redirect("admin/catalogue/index");
return;
}
$new_catalogue = $this->_newCatalogue();
if ($this->isSaved($new_catalogue)) {
$this->_helper->notify($this->_('Domaine %s sauvegardé', $catalogue->getLibelle()));
$this->_redirect("admin/catalogue/index");
return;
}
$new_catalogue = $catalogue->copy();
$this->view->titre = $this->_('Duplication du domaine: %s', $catalogue->getLibelle());
$this->view->catalogue = $new_catalogue;
$this->getHelper('ViewRenderer')->renderScript('catalogue/form.phtml');
}
protected function _newCatalogue() {
return Class_Catalogue::newInstance(['libelle' => '** nouveau domaine **',
'parent_id' => $this->_getParam('id_catalogue', null),
'user' => $this->_user]);
}
public function isSaved($catalogue) {
if (!$this->_request->isPost())