Add position property to field object

This commit is contained in:
Nicolas Le Goff
2013-05-12 19:52:42 +02:00
committed by Romain Neutron
parent 05dc3659af
commit 7423c42a66

View File

@@ -63,6 +63,12 @@ class databox_field implements cache_cacheableInterface
*/ */
protected $readonly; protected $readonly;
/**
*
* @var <type>
*/
protected $position;
/** /**
* *
* @var <type> * @var <type>
@@ -169,11 +175,7 @@ class databox_field implements cache_cacheableInterface
$connbas = $this->get_connection(); $connbas = $this->get_connection();
$sql = "SELECT `thumbtitle`, `separator` $sql = "SELECT * FROM metadatas_structure WHERE id=:id";
, `dces_element`, `tbranch`, `type`, `report`, `multi`, `required`
, `readonly`, `indexable`, `name`, `src`, `business`
, `VocabularyControlType`, `RestrictToVocabularyControl`
FROM metadatas_structure WHERE id=:id";
$stmt = $connbas->prepare($sql); $stmt = $connbas->prepare($sql);
$stmt->execute(array(':id' => $id)); $stmt->execute(array(':id' => $id));
@@ -199,6 +201,7 @@ class databox_field implements cache_cacheableInterface
$this->multi = (Boolean) $row['multi']; $this->multi = (Boolean) $row['multi'];
$this->Business = (Boolean) $row['business']; $this->Business = (Boolean) $row['business'];
$this->report = (Boolean) $row['report']; $this->report = (Boolean) $row['report'];
$this->position = (Int) $row['sorter'];
$this->type = $row['type'] ? : self::TYPE_STRING; $this->type = $row['type'] ? : self::TYPE_STRING;
$this->tbranch = $row['tbranch']; $this->tbranch = $row['tbranch'];
@@ -810,10 +813,12 @@ class databox_field implements cache_cacheableInterface
{ {
return array( return array(
'id' => $this->id, 'id' => $this->id,
'sbas-id' => $this->sbas_id,
'name' => $this->name, 'name' => $this->name,
'tag' => $this->tag->getTagname(), 'tag' => $this->tag->getTagname(),
'business' => $this->Business, 'business' => $this->Business,
'type' => $this->type, 'type' => $this->type,
'sorter' => $this->position,
'thumbtitle' => $this->thumbtitle, 'thumbtitle' => $this->thumbtitle,
'tbranch' => $this->tbranch, 'tbranch' => $this->tbranch,
'separator' => $this->separator, 'separator' => $this->separator,