diff --git a/application/modules/admin/controllers/PremierChapitreController.php b/application/modules/admin/controllers/PremierChapitreController.php index b1eb36da781525114177b3e61b976fb3edf1e906..985090fac7138fdcaa56cbd8473d379b42f0119f 100644 --- a/application/modules/admin/controllers/PremierChapitreController.php +++ b/application/modules/admin/controllers/PremierChapitreController.php @@ -39,9 +39,12 @@ class Admin_PremierChapitreController extends Zend_Controller_Action { public function preDispatch() { $no_front_actions = array(); - + if (!$this->active && $action != 'inactive') { + $request->setActionName('inactive'); + $request->setDispatched(false); //force le rechargement du controller avec la nouvelle action + } // Desactiver le view renderer normal - if (in_array($this->_request->getParam("action"),$no_front_actions)) { + else if (in_array($this->_request->getParam("action"),$no_front_actions)) { $viewRenderer = $this->getHelper('ViewRenderer'); $viewRenderer->setNoRender(); } @@ -49,9 +52,12 @@ class Admin_PremierChapitreController extends Zend_Controller_Action { public function indexAction() { $this->view->titre .= ' :: Index des fonctions'; - } - + + function inactiveAction() { + $this->render('inactive'); + } + function majRefAction() { $data = false; $pc_ws = new Class_WebService_PremierChapitre(); @@ -90,7 +96,6 @@ class Admin_PremierChapitreController extends Zend_Controller_Action { $this->view->contenu = '<pre>'.$contenu.'</pre>'; $this->view->contenu .= "<br/><a href='/admin/premier-chapitre/'>Retour à l'index du service Premier-chapitre</a>"; $this->view->titre .= ' :: Mise à jour de la base'; - $this->renderScript('premier-chapitre/index.phtml'); } function linkNoticesAction() { diff --git a/application/modules/admin/views/scripts/premier-chapitre/inactive.phtml b/application/modules/admin/views/scripts/premier-chapitre/inactive.phtml new file mode 100644 index 0000000000000000000000000000000000000000..c15b626f412c7b40f8d5d9864d513115da3f91b1 --- /dev/null +++ b/application/modules/admin/views/scripts/premier-chapitre/inactive.phtml @@ -0,0 +1 @@ +Service inactif diff --git a/application/modules/admin/views/scripts/premier-chapitre/maj-db.phtml b/application/modules/admin/views/scripts/premier-chapitre/maj-db.phtml new file mode 100644 index 0000000000000000000000000000000000000000..46aa9e51e2bc1ad5e482da5e934d8adaaff008e0 --- /dev/null +++ b/application/modules/admin/views/scripts/premier-chapitre/maj-db.phtml @@ -0,0 +1,23 @@ +<div class="titre"> + <div class="titreInner"> + <h1><?php echo $this->escape($this->title);?></h1> + <div class="rss"></div> + </div> +</div> +<div class="contenu"> + <div class="contenuInner"> + <div class="news-3 news"> +<pre> + <?php + + + +echo $this->contenu; + + + +?></pre> + + </div> + </div> +</div> diff --git a/cosmogramme/sql/patch/patch_260.php b/cosmogramme/sql/patch/patch_260.php deleted file mode 100644 index d4938cdb2eda41094d78e486942edf74d550607e..0000000000000000000000000000000000000000 --- a/cosmogramme/sql/patch/patch_260.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -$adapter = Zend_Registry::get('sql'); -$adapter->query('CREATE TABLE IF NOT EXISTS `pc_database` ( ' - .'`ean` varchar(17) NOT NULL, ' - .'`url` varchar(250) NOT NULL, ' - .'`titre` text NOT NULL, ' - .'`auteur` text NOT NULL, ' - .'`couverture` varchar(250) NOT NULL, ' - .'`couverture_mini` varchar(250) NOT NULL, ' - .'`clef_oeuvre` varchar(200) NOT NULL ' - .') engine=MyISAM default charset=utf8;'); -$adapter->query('ALTER TABLE `pc_database` ADD PRIMARY KEY (`ean`), ADD UNIQUE KEY `ean` (`ean`);'); -?> \ No newline at end of file diff --git a/library/Class/AdminVar.php b/library/Class/AdminVar.php index 7fce21c52f9d1060227e834a72ea79cef6380b58..b4a9c0b16c9a86069bb373d00f16a2b1f48dbaf0 100644 --- a/library/Class/AdminVar.php +++ b/library/Class/AdminVar.php @@ -211,9 +211,8 @@ class Class_AdminVarLoader extends Storm_Model_Loader { 'NEWSLETTER_UNSUBSCRIBE_HTML' => Class_AdminVar_Meta::newDefault($this->_('Texte de désinscription version HTML<br/>Le lien de désinscription est appliqué sur tout ce texte<br/>Par défaut : Je ne veux plus recevoir cette lettre d\'information'), ['value' => $this->_('Je ne veux plus recevoir cette lettre d\'information')]), 'PREMIERCHAPITRE_BIB_ID' => Class_Adminvar_Meta::newDefault($this->_('Premier Chapitre : identifiant de la bibliothèque')), - 'PREMIERCHAPITRE_BMID' => Class_Adminvar_Meta::newDefault($this->_('Premier Chapitre : identifiant de la bibliothèque')), - 'PREMIERCHAPITRE_BMKEY' => Class_Adminvar_Meta::newDefault($this->_('Premier Chapitre : clé')), - + 'PREMIERCHAPITRE_BMID' => Class_Adminvar_Meta::newDefault($this->_('Premier Chapitre : identifiant de connexion')), + 'PREMIERCHAPITRE_BMKEY' => Class_Adminvar_Meta::newDefault($this->_('Premier Chapitre : mot de passe')) ]; return $this->_knownVars; diff --git a/library/Class/Batch.php b/library/Class/Batch.php index 85b5d2ecae0db2bd362c4684db9843d8c7191a80..5425bb8394545364ca18e32a6ee1b81f7ce98c8f 100644 --- a/library/Class/Batch.php +++ b/library/Class/Batch.php @@ -31,6 +31,7 @@ class Class_BatchLoader extends Storm_Model_Loader{ 'AUTOCOMPLETE_RECORD_TITLE' => new Class_Batch_AutocompleteRecordTitle(), 'AUTOCOMPLETE_RECORD_AUTHOR' => new Class_Batch_AutocompleteRecordAuthor(), 'BUILD_SITE_MAP' => new Class_Batch_BuildSiteMap(), + 'UPDATE_PREMIER_CHAPITRE' => new Class_Batch_PremierChapitre(), ]); } diff --git a/library/Class/Batch/PremierChapitre.php b/library/Class/Batch/PremierChapitre.php index cbfc2bc81b3d4abb0937868a90f1545650b9d78b..4dbfbc9431c0386c6d61dab89155d05e2294d454 100644 --- a/library/Class/Batch/PremierChapitre.php +++ b/library/Class/Batch/PremierChapitre.php @@ -20,9 +20,40 @@ */ -class Class_Batch_PremierChapitre extends Class_Batch_RessourceNumerique{ - protected function _getService() { - return new Class_WebService_PremierChapitre(); +class Class_Batch_PremierChapitre extends Class_Batch_Abstract { + public function getLabel() { + return $this->_('Mise à jour des données Premier-Chapitre'); + } + public function run() { + $pc_ws = new Class_WebService_PremierChapitre(); + $contenu = ''; + $data = $pc_ws->generate(); + if ($data) { + $contenu .= date('H:i:s')." Le référentiel a bien été mise à jour\n"; + $data = $pc_ws->getDatafile(); + if ($data){ + $contenu .= date('H:i:s')." Le référentiel a bien été téléchargé sur le serveur\nIl est possible de procéder à la mise à jour de la base\n"; + $data = $pc_ws->updateDatabase(); + if ($data) { + $contenu .= date('H:i:s')." La base a bien été mise à jour\n"; + $contenu .= '* '.$data['total']." oeuvres ont été lues\n"; + if ($data['new']) $contenu .= '* '.$data['new'].(($data['new']>1)?" ont été ajoutées":" a été ajoutée")."\n"; + if ($data['maj']) $contenu .= '* '.$data['maj'].(($data['maj']>1)?" ont été mises":" a été mise")." à jour\n"; + if ($data['err']) $contenu .= '* '.$data['err'].(($data['err']>1)?" erreurs n'ont pas été traitées":" erreur n'a pas été traitée")."\n"; + $data = $pc_ws->linkToNotices(); + if ($data) { + $contenu .= date('H:i:s')." Les premiers-chapitres ont bien été liés aux notices\n"; + $contenu .= '* '.$data['total']." oeuvres ont été traités\n"; + $contenu .= '* '.$data['maj'].(($data['maj']>1)?" ont été mises":" a été mise")." à jour\n"; + } + else $contenu .= "Une erreur est survenue\nLes liaisons n'ont pu être faites\nVeuillez réessayer ultérieurement"; + } + else $contenu .= "Une erreur est survenue\nLa base n'a pu être mise à jour\nVeuillez réessayer ultérieurement"; + } + else $contenu .= "Une erreur est survenue\nle référentiel n'a pas pu être téléchargé\nVeuillez réessayer ultérieurement"; + } + else $contenu .= "Une erreur est survenue\nle référentiel n'a pas pu être mis a jour\nVeuillez réessayer ultérieurement"; + $this->content = $contenu; } } ?> \ No newline at end of file diff --git a/library/Class/WebService/PremierChapitre.php b/library/Class/WebService/PremierChapitre.php index 2e13a733ec83eb0b9f9055076bf695cf8fcd8256..ceba52568ee1171f244c11f9e9d923db5b45d9d1 100644 --- a/library/Class/WebService/PremierChapitre.php +++ b/library/Class/WebService/PremierChapitre.php @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class Class_WebService_PremierChapitre {// extends Class_WebService_Abstract { - on redefini l'ensemble du modele a l'identique +class Class_WebService_PremierChapitre { protected $_message; protected static $_http_client; protected static $_auth = false;