From 4e65cbe98798cdf27928b7d265901bf067f0cf3c Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Thu, 4 May 2017 08:03:40 +0000 Subject: [PATCH] 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 --- dblayeroo.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/dblayeroo.php b/dblayeroo.php index c0055b3..1331f6e 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -1013,7 +1013,7 @@ class dblayeroo /** Get all the fields with the table name if needed. * 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) /* {{{ */ @@ -1185,13 +1185,30 @@ class dblayeroo /** Get/Set the titles property * @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)"); 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)) $this->DBException ("Parameter titles invalid: not an array"); foreach ($titles as $title=>$translation)