/** * getTplObjects * * @param CriteriaElement|null $criteria criteria to match * @param bool $getsource include the source * @param bool $id_as_key use the object id as array key * * @return array */ public function getTplObjects(CriteriaElement $criteria = null, $getsource = false, $id_as_key = false) { $qb = $this->db2->createXoopsQueryBuilder(); $eb = $qb->expr(); $ret = array(); if (!$getsource) { $qb->select('*')->fromPrefix('system_tplfile', 'f'); } else { $qb->select('f.*')->addSelect('s.tpl_source')->fromPrefix('system_tplfile', 'f')->leftJoinPrefix('f', 'system_tplsource', 's', $eb->eq('s.tpl_id', 'f.tpl_id')); } if (isset($criteria) && $criteria instanceof CriteriaElement) { $criteria->renderQb($qb); } $result = $qb->execute(); if (!$result) { return $ret; } while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) { $tplfile = new XoopsTplFile(); $tplfile->assignVars($myrow); if (!$id_as_key) { $ret[] = $tplfile; } else { $ret[$myrow['tpl_id']] = $tplfile; } unset($tplfile); } return $ret; }