PHRAS-368 #time 3d

wip
This commit is contained in:
Jean-Yves Gaulier
2015-06-08 19:39:36 +02:00
parent 249334c7ed
commit 90c2cb5f5d
13 changed files with 650 additions and 168 deletions

View File

@@ -0,0 +1,29 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
class CandidateAccepted extends ThesaurusEvent
{
private $new_id;
public function __construct(\databox $databox, $new_id)
{
parent::__construct($databox);
$this->new_id = $new_id;
}
public function getID()
{
return $this->new_id;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
class ConceptDeleted extends ThesaurusEvent
{
private $parent_id; // the former parent
private $deleted_synonyms; // the former synonyms (deleted)
public function __construct(\databox $databox, $parent_id, array $deleted_synonyms)
{
parent::__construct($databox);
$this->parent_id = $parent_id;
$this->deleted_synonyms = $deleted_synonyms;
}
public function getParentID()
{
return $this->parent_id;
}
public function getSynonyms()
{
return $this->deleted_synonyms;
}
}

View File

@@ -0,0 +1,17 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
class FieldLinked extends ThesaurusEvent
{
}

View File

@@ -0,0 +1,17 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
class Imported extends ThesaurusEvent
{
}

View File

@@ -0,0 +1,30 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
class ItemAdded extends ThesaurusEvent
{
private $new_id; // the new id
public function __construct(\databox $databox, $new_id)
{
parent::__construct($databox);
$this->new_id = $new_id;
}
public function getID()
{
return $this->new_id;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
class ItemTrashed extends ThesaurusEvent
{
private $parent_id; // the former parent
private $trash_id; // the new id in cterms
public function __construct(\databox $databox, $parent_id, $trash_id)
{
parent::__construct($databox);
$this->parent_id = $parent_id;
$this->trash_id = $trash_id;
}
public function getParentID()
{
return $this->parent_id;
}
public function getNewID()
{
return $this->trash_id;
}
}

View File

@@ -0,0 +1,29 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
class SynonymLngChanged extends ThesaurusEvent
{
private $synonym_id;
public function __construct(\databox $databox, $synonym_id)
{
parent::__construct($databox);
$this->synonym_id = $synonym_id;
}
public function getID()
{
return $this->synonym_id;
}
}

View File

@@ -0,0 +1,47 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
/**
* Class SynonymParm
* @package Alchemy\Phrasea\Core\Event\Thesaurus
*
* a small object passed as parameter to thesaurus events.
* usefull when the synonym does not exists anymore in the thesaurus (after deletion)
*/
class SynonymParm
{
private $value; // as the <sy> 'v' attribute in xml
private $lng; // the 'lng' attribute
public function __construct($value, $lng)
{
$this->value = $value;
$this->lng = $lng;
}
/**
* @return \string
*/
public function getValue()
{
return $this->value;
}
/**
* @return \string
*/
public function getLng()
{
return $this->lng;
}
}

View File

@@ -0,0 +1,29 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
class SynonymPositionChanged extends ThesaurusEvent
{
private $synonym_id;
public function __construct(\databox $databox, $synonym_id)
{
parent::__construct($databox);
$this->synonym_id = $synonym_id;
}
public function getID()
{
return $this->synonym_id;
}
}

View File

@@ -0,0 +1,32 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Event\Thesaurus;
use Symfony\Component\EventDispatcher\Event;
abstract class ThesaurusEvent extends Event
{
private $databox;
public function __construct(\databox $databox)
{
$this->databox = $databox;
}
/**
* @return \databox
*/
public function getDatabox()
{
return $this->databox;
}
}

View File

@@ -50,4 +50,16 @@ final class PhraseaEvents
const RECORD_EDIT = 'record.edit';
const RECORD_UPLOAD = 'record.upload';
const THESAURUS_IMPORTED = 'thesaurus.imported';
const THESAURUS_FIELD_LINKED = 'thesaurus.field-linked';
const THESAURUS_CANDIDATE_ACCEPTED_AS_CONCEPT = 'thesaurus.candidate-accepted-as-concept';
const THESAURUS_CANDIDATE_ACCEPTED_AS_SYNONYM = 'thesaurus.candidate-accepted-as-synonym';
const THESAURUS_SYNONYM_LNG_CHANGED = 'thesaurus.synonym-lng-changed';
const THESAURUS_SYNONYM_POSITION_CHANGED = 'thesaurus.synonym-position-changed';
const THESAURUS_SYNONYM_TRASHED = 'thesaurus.synonym-trashed';
const THESAURUS_CONCEPT_TRASHED = 'thesaurus.concept-trashed';
const THESAURUS_CONCEPT_DELETED = 'thesaurus.concept-deleted';
const THESAURUS_SYNONYM_ADDED = 'thesaurus.synonym-added';
const THESAURUS_CONCEPT_ADDED = 'thesaurus.concept-added';
}

View File

@@ -57,11 +57,7 @@
{% else %}
{% if nb_candidates_bad > 0 %}
// present dans les candidats, mais aucun champ acceptable : on informe
{% if nb_candidates_bad == 1 %}
{% set prop_label = 'thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus' | trans %}
{% else %}
{% set prop_label = 'thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus' | trans %}
{% endif %}
{% set prop_label = 'thesaurus:: est candidat en provenance des champs mais ne peut etre accepte a cet emplacement du thesaurus' | trans %}
{% else %}
// pas present dans les candidats
{% set prop_label = 'thesaurus:: n\'est pas present dans les candidats' | trans %}