Skip to content
Snippets Groups Projects
Commit d2378f1e authored by efalcy's avatar efalcy
Browse files

hotline #78216 : tout apprendre ajout de la duree , des matieres et des tags

parent 0af87c95
Branches
Tags
4 merge requests!2806Master,!2776Master,!2772Hotline,!2763Hotline#78216 liens vers les ressources numeriques ko
Pipeline #4701 failed with stage
in 46 minutes and 15 seconds
- ticket #78216 : Amélioration de la catégorisation des ressources Tout Apprendre
\ No newline at end of file
......@@ -56,9 +56,10 @@ class Class_WebService_BibNumerique_ToutApprendre extends Class_WebService_BibNu
$ids = [];
foreach($this->_albums as $album)
$ids []= $album->getIdOrigine();
if (is_empy($ids))
return ;
Class_Album::deleteBy(['where' => 'url_origine="'.self::BASE_URL.'" and id_origine not in (\''. implode("', '", $ids) . '\')']);
}
......
......@@ -82,6 +82,9 @@ class Class_WebService_BibNumerique_ToutApprendre_CatalogueParser {
$this->_current_formation->setExternalUri($data);
}
public function endCategorie($data) {
$this->_current_formation->addMatiere($data);
}
public function endDescription($data) {
$this->_current_formation->setDescription($data);
......@@ -92,6 +95,14 @@ class Class_WebService_BibNumerique_ToutApprendre_CatalogueParser {
$this->_current_formation->setEditeur($data);
}
public function endTheme($data) {
$this->_current_formation->addTag($data);
}
public function endDureeCours($data) {
$this->_current_formation->setDuration($data);
}
public function endThumbnail($data) {
$this->_current_formation->addPoster($data);
......
......@@ -20,6 +20,8 @@
*/
class Class_WebService_BibNumerique_ToutApprendre_Formation extends Class_WebService_BibNumerique_RessourceNumerique {
protected $_tags = [],
$_duration = '';
public function fillAlbum($album) {
$album
......@@ -27,7 +29,9 @@ class Class_WebService_BibNumerique_ToutApprendre_Formation extends Class_WebSer
->addAuthor('Tout Apprendre')
->setDateMaj($this->getDateMaj())
->setAnnee($this->getAnnee())
->setDescription($this->getDescription());
->setDuration($this->_duration)
->setDescription($this->getDescription())
->setTags(implode(';',array_filter(array_merge(explode(';',$album->getTags()),$this->_tags))));;
}
......@@ -39,5 +43,15 @@ class Class_WebService_BibNumerique_ToutApprendre_Formation extends Class_WebSer
public function getBaseUrl(){
return Class_WebService_BibNumerique_ToutApprendre::BASE_URL;
}
public function addTag($tag) {
$this->_tags[] = $tag;
}
public function setDuration($text) {
$this->_duration = $text;
}
}
?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<toutapprendre><cours>
<pk>4742</pk>
p<pk>4742</pk>
<titre>LibreOffice Database - Module 1</titre>
<editeur>ToutApprendre.com - EduPerformance</editeur>
<categorie catId="2">Bureautique / Internet</categorie>
<rubrique>Toutapprendre</rubrique>
<rubrique>Multimedia</rubrique>
<theme>Tableur / Excel</theme>
<description>Accéder aux données de LibreOffice Database et les imprimer</description>
<dureeCours>3 heures</dureeCours>
<demo>http%3A%2F%2Fwww%2Etoutapprendre%2Ecom%2FDemonstration%2FeduV2%2FeduPerformanceDemo%2Easp%3Fc%3Dac02</demo>
......
......@@ -134,6 +134,25 @@ class ToutApprendreTest extends ModelTestCase {
}
/** @test */
public function matiereShouldBeImport() {
$this->assertEquals('Bureautique / Internet',Class_CodifMatiere::find($this->_first_album->getMatiere())->getLibelle());
}
/** @test */
public function tagsShouldBeImportAsTheme() {
$this->assertEquals('Tableur / Excel',$this->_first_album->getTags());
}
/** @test */
public function durationBeImported() {
$this->assertEquals('3 heures',$this->_first_album->getDuration());
}
/** @test */
public function oldRessourceShouldHaveBeenDelete() {
$old_resource = $this->fixture('Class_AlbumRessource',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment