v7‰PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT getTable()->getName(); $max = $this->getAdapter()->selectCell("SELECT MAX(sort_order) FROM {$table_name}"); $this->sort_order = $max + 1; return parent::insert($reload); } public function delete() { $ret = parent::delete(); $table_name = $this->getTable()->getName(); $this->getAdapter()->query("UPDATE {$table_name} SET sort_order=sort_order-1 WHERE sort_order>?", $this->sort_order); return $ret; } } class AffBannerTable extends Am_Table { protected $_key = 'banner_id'; protected $_table = '?_aff_banner'; protected $_recordClass = 'AffBanner'; function findActive($category = null){ return $this->selectObjects("SELECT * FROM ?_aff_banner WHERE is_disabled=0 AND {category = ?} {category IS NULL AND ?d=?d} ORDER BY sort_order", is_null($category) ? DBSIMPLE_SKIP : $category, !is_null($category) ? DBSIMPLE_SKIP : 1, 1); } function getCategories($onlyEnabled = false) { return $this->_db->selectCol("SELECT DISTINCT category, category AS ? FROM ?_aff_banner WHERE category IS NOT NULL {AND is_disabled = ?} ORDER BY category", DBSIMPLE_ARRAY_KEY, $onlyEnabled ? 0 : DBSIMPLE_SKIP); } }