dblayeroo: display the titles with the table name if the funll option is set or if a joinObject is defined

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3572 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-05-04 08:03:40 +00:00
parent 8da8666dbb
commit 4e65cbe987

View File

@@ -1013,7 +1013,7 @@ class dblayeroo
/** Get all the fields with the table name if needed. /** Get all the fields with the table name if needed.
* If the objectJoin is set, return the fields name too * If the objectJoin is set, return the fields name too
* @param boolean $full Add the table name if the $full is set * @param boolean|null $full Add the table name if the $full is set
*/ */
public function fieldsAll ($full = false) public function fieldsAll ($full = false)
/* {{{ */ /* {{{ */
@@ -1185,13 +1185,30 @@ class dblayeroo
/** Get/Set the titles property /** Get/Set the titles property
* @param array|null $titles The titles of the fields * @param array|null $titles The titles of the fields
* @param boolean|null $full Add the table name if the $full is set
*/ */
public function titles ($titles=null) public function titles ($titles=null, $full = false)
/* {{{ */ /* {{{ */
{ {
$this->debugLog ("Entering titles (VALUE)"); $this->debugLog ("Entering titles (VALUE)");
if ($titles === null) if ($titles === null)
return $this->titles; {
if ($full === false && $this->joinObject === null)
return $this->titles;
$titles = array ();
foreach ($this->titles as $key=>$val)
{
$titles[$this->tableprefix.$this->table.".".$key] = $val;
}
if ($this->joinObject !== null)
{
foreach ($this->joinObject as $obj)
{
$titles = array_merge ($titles, $obj->titles (null, true));
}
}
return $titles;
}
if (! is_array ($titles)) if (! is_array ($titles))
$this->DBException ("Parameter titles invalid: not an array"); $this->DBException ("Parameter titles invalid: not an array");
foreach ($titles as $title=>$translation) foreach ($titles as $title=>$translation)