Minahito
minah****@users*****
2005年 12月 16日 (金) 18:05:43 JST
Index: xoops2jp/html/kernel/tplfile.php diff -u xoops2jp/html/kernel/tplfile.php:1.2.8.1 xoops2jp/html/kernel/tplfile.php:1.2.8.2 --- xoops2jp/html/kernel/tplfile.php:1.2.8.1 Wed Oct 19 02:21:03 2005 +++ xoops2jp/html/kernel/tplfile.php Fri Dec 16 18:05:43 2005 @@ -1,5 +1,5 @@ <?php -// $Id: tplfile.php,v 1.2.8.1 2005/10/18 17:21:03 minahito Exp $ +// $Id: tplfile.php,v 1.2.8.2 2005/12/16 09:05:43 minahito Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -211,6 +211,28 @@ return true; } + /** + * Delete the plural of record by a cetain criteria. + * + * @return bool + */ + function deleteAll($criteria = null) + { + $sql = sprintf("SELECT tpl_id FROM %s", $this->db->prefix('tplfile')); + $sql .= ' ' . $criteria->renderWhere(); + + $result = $this->db->query($sql); + while ($row = $this->db->fetchArray($result)) { + $sql = sprintf("DELETE FROM %s WHERE tpl_id=%u", $this->db->prefix('tplsource'), $row['tpl_id']); + $this->db->query($sql); + } + + $sql = sprintf("DELETE FROM %s", $this->db->prefix('tplfile')); + $sql .= ' ' . $criteria->renderWhere(); + + return $this->db->query($sql); + } + function &getObjects($criteria = null, $getsource = false, $id_as_key = false) { $ret = array();