Commit c5d10876 authored by continuum's avatar continuum

Resolve conflicts

Conflicts:
	.gitattributes
	.gitignore
	application/modules/admin/controllers/AlbumController.php
	application/modules/admin/controllers/HarvestController.php
	application/modules/admin/controllers/SystemeController.php
	cosmogramme/php/classes/classe_notice_avenio.php
	cosmogramme/php/classes/classe_notice_integration.php
	cosmogramme/php/classes/classe_unimarc.php
	cosmogramme/tests/php/classes/NoticeIntegrationTest.php
	library/Class/Album.php
	library/Class/FRBR/Link.php
	library/Class/Indexation.php
	library/Class/NatureDoc.php
	library/Class/Notice.php
	library/Class/Profil.php
	library/Class/WebService/BibNumerique/RessourceNumerique.php
	library/ZendAfi/Controller/Plugin/AdminAuth.php
	scripts/emacs/phafi-autoload.el
	tests/application/modules/admin/controllers/AdminAuthControllerTest.php
	tests/application/modules/admin/controllers/AlbumControllerTest.php
	tests/application/modules/admin/controllers/HarvestControllerTest.php
	tests/application/modules/opac/controllers/IndexControllerTest.php
	tests/library/Class/FRBR/LinkTest.php
	tests/library/Class/ProfilTest.php
parent 2908f1fd
This diff is collapsed.
......@@ -520,10 +520,11 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
$droits_precision : 'Domaine public';
$album->updateAttributes($values);
if ($album->save()
&& $album->receiveFile()
&& $album->receivePDF()) {
&& $album->receivePDF()
&& $album->index()) {
(new Storm_Cache())->clean();
$this->_helper->notify('Album sauvegardé');
$this->_redirect('admin/album/edit_album/id/' . $album->getId());
}
......
......@@ -20,23 +20,12 @@
*/
class Admin_HarvestController extends Zend_Controller_Action {
public function arteVodAction() {
if (!Class_AdminVar::isArteVodEnabled())
$this->_redirect('/admin/index');
$logger = new Zend_Log();
$logger->addWriter(new Zend_Log_Writer_Stream('php://output'));
ob_start();
$logger->info('Début du moissonnage');
$service = new Class_WebService_BibNumerique_ArteVOD();
$service->setLogger($logger);
$service->harvest('');
public function arteVodAction() {
$this->_withServiceDo(new Class_WebService_BibNumerique_ArteVOD(),
$this->view->_('Moissonnage ArteVOD'),
Class_AdminVar::isArteVodEnabled());
$logger->info('Fin du moissonnage');
$this->view->log = ob_get_clean();
}
......@@ -46,44 +35,16 @@ class Admin_HarvestController extends Zend_Controller_Action {
public function vodeclicAction() {
if (!Class_AdminVar::isVodeclicEnabled())
$this->_redirect('/admin/index');
$this->view->titre = $this->view->_('Moissonnage Vodeclic');
$logger = new Zend_Log();
$logger->addWriter(new Zend_Log_Writer_Stream('php://output'));
ob_start();
$logger->info('Début du moissonnage');
$service = new Class_WebService_BibNumerique_Vodeclic();
$service->setLogger($logger);
$service->harvest(['partenaire_id'=>Class_AdminVar::get('VODECLIC_ID'),
'key'=>Class_AdminVar::get('VODECLIC_KEY'),
'bib_id'=>Class_AdminVar::get('VODECLIC_BIB_ID')]);
$logger->info('Fin du moissonnage');
$this->view->log = ob_get_clean();
$this->_withServiceDo(new Class_WebService_BibNumerique_Vodeclic(),
$this->view->_('Moissonnage Vodeclic'),
Class_AdminVar::isVodeclicEnabled());
}
public function toutapprendreAction() {
if (!Class_AdminVar::isToutApprendreEnabled())
$this->_redirect('/admin/index');
$this->view->titre = $this->view->_('Moissonnage Tout Apprendre');
$logger = new Zend_Log();
$logger->addWriter(new Zend_Log_Writer_Stream('php://output'));
ob_start();
$logger->info('Début du moissonnage');
$service = new Class_WebService_BibNumerique_ToutApprendre();
$service->setLogger($logger);
$service->harvest();
$logger->info('Fin du moissonnage');
$this->view->log = ob_get_clean();
$this->_withServiceDo(new Class_WebService_BibNumerique_ToutApprendre(),
$this->view->_('Moissonnage Tout Apprendre'),
Class_AdminVar::isToutApprendreEnabled());
}
......@@ -95,29 +56,16 @@ class Admin_HarvestController extends Zend_Controller_Action {
$this->view->titre = $this->view->_('Moissonnage Tout Apprendre');
}
public function numilogAction() {
if (!Class_AdminVar::isNumilogEnabled())
$this->_redirect('/admin/index');
$logger = new Zend_Log();
$logger->addWriter(new Zend_Log_Writer_Stream('php://output'));
ob_start();
$logger->info('Début du moissonnage');
$service = new Class_WebService_BibNumerique_Numilog();
$service->setLogger($logger);
$service->harvest('');
$logger->info('Fin du moissonnage');
$this->view->log = ob_get_clean();
public function numilogAction() {
$this->_withServiceDo(new Class_WebService_BibNumerique_Numilog(),
$this->view->_('Moissonnage Numilog'),
Class_AdminVar::isNumilogEnabled());
}
public function numilogBrowseAction() {
$this->view->titre = $this->view->_('Moissonnage Numilog');
$this->view->titre = $this->view->_('Moissonnage Numilog');
}
......@@ -132,4 +80,26 @@ class Admin_HarvestController extends Zend_Controller_Action {
protected function _withServiceDo($service, $titre, $enabled) {
if (!$enabled) {
$this->_redirect('/admin/index');
return;
}
$this->view->titre = $titre;
$logger = new Zend_Log();
$logger->addWriter(new Zend_Log_Writer_Stream('php://output'));
ob_start();
$logger->info('Début du moissonnage');
$service->setLogger($logger);
$service->harvest();
(new Storm_Cache())->clean();
$logger->info('Fin du moissonnage');
$this->view->log = ob_get_clean();
}
}
......@@ -63,7 +63,14 @@ class Admin_SystemeController extends Zend_Controller_Action {
$this->view->nb_pas_reconnu=fetchOne("select count(*) from notices where url_vignette ='NO'");
// Calcul de l'espace occupé
$dir=opendir($path);
if (!file_exists($path))
mkdir($path);
if (!$dir=opendir($path)) {
$this->view->taille_cache = 0;
return;
}
while(false !== ($file = readdir($dir)))
{
$extension=substr($file,-4);
......
<?xml version="1.0" encoding="UTF-8"?>
<project name="opacce" default="build">
<target name="build"
depends="prepare,phpunit"/>
<target name="build-parallel"
depends="prepare,lint,tools-parallel,phpunit,phpcb"/>
<target name="tools-parallel"
description="Run tools in parallel">
<parallel threadCount="2">
<sequential>
<antcall target="pdepend"/>
<antcall target="phpmd-ci"/>
</sequential>
<antcall target="phpcpd"/>
<antcall target="phpcs-ci"/>
<antcall target="phploc"/>
<antcall target="phpdoc"/>
</parallel>
</target>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
</target>
<target name="prepare" depends="clean"
description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
</target>
<target name="lint">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}">
<include name="**/*.php" />
<modified />
</fileset>
<fileset dir="${basedir}/tests">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${basedir}" />
</exec>
</target>
<target name="pdepend"
description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpmd"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpmd">
<arg path="${basedir}" />
<arg value="text" />
<arg value="${basedir}/build/phpmd.xml" />
</exec>
</target>
<target name="phpmd-ci"
description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="phpmd">
<arg path="${basedir}" />
<arg value="xml" />
<arg value="${basedir}/build/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>
<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpcs">
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpcs-ci"
description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="phpcs" output="/dev/null">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="phpcpd">
<arg value="--log-pmd" />
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
<arg path="${basedir}" />
</exec>
</target>
<target name="phpdoc"
description="Generate API documentation using PHPDocumentor">
<exec executable="phpdoc">
<arg value="--directory" />
<arg path="${basedir}" />
<arg value="--target" />
<arg path="${basedir}/build/api" />
</exec>
</target>
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec dir="${basedir}/tests" executable="phpunit" failonerror="true">
<arg line="--log-junit ${basedir}/build/logs/junit.xml" />
<arg line="--coverage-html ${basedir}/build/coverage" />
</exec>
</target>
<target name="phpcb"
description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg value="--log" />
<arg path="${basedir}/build/logs" />
<arg value="--source" />
<arg path="${basedir}" />
<arg value="--output" />
<arg path="${basedir}/build/code-browser" />
</exec>
</target>
</project>
......@@ -176,8 +176,7 @@ class notice_avenio
{
$elems=explode("(",$enreg);
$nom=$elems[0];
$prenom=trim($elems[1]);
$prenom=substr($prenom,0,(strlen($prenom)-1));
$prenom=substr(trim($elems[1],0,(strlen(trim($elems[1]))-1)));
$auteurs[]=$nom . "|" .$prenom;
}
return $auteurs;
......@@ -288,9 +287,9 @@ class notice_avenio
{
if(!trim($auteur)) continue;
$elems=explode("|",$auteur);
$data_auteur[0]=array('a',$elems[0]);
if($elems[1]>'') $data_auteur[1]=array('b',$elems[1]);
$notice_sgbd->add_field("700","01",$data_auteur);
$notice_sgbd->add_field("700","1 ","a".trim($elems[0]." ".trim($elems[1])));
}
}
$unimarc=$notice_sgbd->update();
......
......@@ -366,7 +366,8 @@ class notice_integration
if (!$enreg['id_bib'])
$enreg['id_bib'] = $sql->fetchOne('select min(id_bib) from int_bib');
$notice = Pseudo_Notice::newWith($type_doc, $enreg);
$notice = Class_Indexation_PseudoNotice::newWith($type_doc, $enreg);
if (!$notice->isValid() || !$notice->save())
return ['statut' => 0, 'id_notice' => 0];
......@@ -1311,6 +1312,7 @@ class notice_integration
}
}
<<<<<<< HEAD
class Pseudo_Notice {
const TYPE_CMS = 8;
......@@ -1735,4 +1737,6 @@ class Pseudo_Notice_Null extends Pseudo_Notice{
return false;
}
}
?>
\ No newline at end of file
......@@ -266,7 +266,9 @@ class notice_unimarc extends iso2709_record
$chapeau=$this->get_subfield("461","t");
$ret["clef_chapeau"]=$this->indexation->codeAlphaTitre($chapeau[0]);
$numero=$this->get_subfield("461","v");
if(!$numero) $numero=$this->get_subfield("200","h");
$ret["clef_numero"]=$this->indexation->alphaMaj($numero[0]);
}
if(!$ret["clef_chapeau"] or !$ret["clef_numero"]) return false;
......
......@@ -142,7 +142,8 @@ abstract class NoticeIntegrationSacramentariumTestCase extends NoticeIntegration
public function setUp() {
parent::setUp();
Codif_matiere::getInstance()->setCodif(['62115' => ['libelle' => 'Douzième siècle']]);
$this->fixture('Class_CodifMatiere', ['id' => 62115,
'libelle' => 'Douzième siècle']);
$sacramentarium = $this->fixture(
'Class_Album',
......
......@@ -21,17 +21,17 @@
/**
* utlisation Storm :
* - récupérer tous les Albums
* $albums = Class_Album::getLoader()->findAll();
* $albums = Class_Album::findAll();
*
* - récupérer album avec l'id 2
* $album = Class_Album::getLoader()->find(2);
* $album = Class_Album::find(2);
*
* - tous les albums de la catégorie 3
* $albums = Class_Album::getLoader()->findAllBy(array('cat_id' => 3));
* $albums = Class_Album::findAllBy(array('cat_id' => 3));
*
* ou bien
*
* $albums = Class_AlbumCategorie::getLoader()->find(3)->getAlbums()
* $albums = Class_AlbumCategorie::find(3)->getAlbums()
*
* - modifier le libelle d'un album et sauver:
* $album->setLibelle('Mon album')->save();
......@@ -41,14 +41,12 @@
* $album->updateAttributes($post)->save()
*
* - Récupérer l'album id 4 et afficher son libelle
* echo Class_Album::getLoader()->find(4)->getLibelle();
* echo Class_Album::find(4)->getLibelle();
*
* - Créer une nouvelle catégorie, son album et sauvegarder.
* Class_AlbumCategorie::getLoader()
* ->newInstance()
* Class_AlbumCategorie::newInstance()
* ->setLibelle('Mes Favoris')
* ->addAlbum(Class_Album::getLoader()
* ->newInstance()
* ->addAlbum(Class_Album::newInstance()
* ->setLibelle('Mes BD')
* ->setCommentaire('bla bla'))
* ->save();
......@@ -59,7 +57,6 @@ class AlbumLoader extends Storm_Model_Loader {
public function getItemsOf($categoryId) {
return Class_Album::findAllBy(['cat_id' => $categoryId,
'order' => 'titre']);
//return $this->findAll('select id, titre, type_doc_id from album where cat_id=' . $categoryId .' order by titre');
}
}
......@@ -85,56 +82,51 @@ class Class_Album extends Storm_Model_Abstract {
protected $_table_name = 'album';
protected $_table_primary = 'id';
protected $_loader_class = 'AlbumLoader';
protected $_belongs_to = array(
'categorie' => array(
'model' => 'Class_AlbumCategorie',
'referenced_in' => 'cat_id'),
'type_doc' => array('model' => 'Class_TypeDoc'),
'langue' => array('model' => 'Class_CodifLangue',
'referenced_in' => 'id_langue')
);
protected $_has_many = array(
'ressources' => array(
'model' => 'Class_AlbumRessource',
'role' => 'album',
'dependents' => 'delete',
'order' => 'ordre'
)
);
protected $_default_attribute_values = array('titre' => '',
'sous_titre' => '',
'editeur' => '',
'fichier' => '',
'pdf' => '',
'auteur' => '',
'description' => '',
'date_maj' => '',
'genre' => '',
'matiere' => '',
'type_doc_id' => 0,
'annee' => '',
'id_langue' => self::DEFAULT_CODE_LANGUE,
'id_origine' => '',
'cat_id' => 0,
'cfg_thumbnails' => '',
'provenance' => '',
'cote' => '',
'notes' => '',
'visible' => true,
'droits' => '',
'nature_doc' => '',
'bibliotheques' => '',
'annexes' => '',
'sections' => '');
protected $_belongs_to = ['categorie' => ['model' => 'Class_AlbumCategorie',
'referenced_in' => 'cat_id'],
'type_doc' => ['model' => 'Class_TypeDoc'],
'langue' => ['model' => 'Class_CodifLangue',
'referenced_in' => 'id_langue'],
'notice' => ['model' => 'Class_Notice',
'referenced_in' => 'notice_id']];
protected $_has_many = ['ressources' => ['model' => 'Class_AlbumRessource',
'role' => 'album',
'dependents' => 'delete',
'order' => 'ordre']];
protected $_default_attribute_values = ['titre' => '',
'sous_titre' => '',
'editeur' => '',
'fichier' => '',
'pdf' => '',
'auteur' => '',
'description' => '',
'date_maj' => '',
'genre' => '',
'matiere' => '',
'type_doc_id' => Class_TypeDoc::DIAPORAMA,
'annee' => '',
'id_langue' => self::DEFAULT_CODE_LANGUE,
'id_origine' => '',
'cat_id' => 0,
'cfg_thumbnails' => '',
'provenance' => '',
'cote' => '',
'notes' => '',
'visible' => true,
'droits' => '',
'nature_doc' => '',
'bibliotheques' => '',
'annexes' => '',
'sections' => ''];
/** @var Class_Upload */
protected $_uploadHandler;
protected $path_flash; // Path pour le modèle de settings
protected $path_flash;
public $arbre_array;
......@@ -159,20 +151,20 @@ class Class_Album extends Storm_Model_Abstract {
*/
public static function getDefaultThumbnailValues() {
if (!isset(self::$DEFAULT_THUMBNAIL_VALUES))
self::$DEFAULT_THUMBNAIL_VALUES = array('thumbnail_width' => 400,
'thumbnail_left_page_crop_top' => 0,
'thumbnail_left_page_crop_right' => 0,
'thumbnail_left_page_crop_bottom' => 0,
'thumbnail_left_page_crop_left' => 0,
'thumbnail_right_page_crop_top' => 0,
'thumbnail_right_page_crop_right' => 0,
'thumbnail_right_page_crop_bottom' => 0,
'thumbnail_right_page_crop_left' => 0,
'thumbnail_crop_top' => 0,
'thumbnail_crop_right' => 0,
'thumbnail_crop_bottom' => 0,
'thumbnail_crop_left' => 0,
'display_one_page' => false);
self::$DEFAULT_THUMBNAIL_VALUES = ['thumbnail_width' => 400,
'thumbnail_left_page_crop_top' => 0,
'thumbnail_left_page_crop_right' => 0,
'thumbnail_left_page_crop_bottom' => 0,
'thumbnail_left_page_crop_left' => 0,
'thumbnail_right_page_crop_top' => 0,
'thumbnail_right_page_crop_right' => 0,
'thumbnail_right_page_crop_bottom' => 0,
'thumbnail_right_page_crop_left' => 0,
'thumbnail_crop_top' => 0,
'thumbnail_crop_right' => 0,
'thumbnail_crop_bottom' => 0,
'thumbnail_crop_left' => 0,
'display_one_page' => false];
return self::$DEFAULT_THUMBNAIL_VALUES;
}
......@@ -225,9 +217,11 @@ class Class_Album extends Storm_Model_Abstract {
* @return array
*/
public function getPermalink() {
$permalink = array('module' => 'opac',
'controller' => 'bib-numerique',
'action' => 'notice');
$permalink = ['module' => 'opac',
'controller' => 'bib-numerique',
'action' => 'notice'];