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