コード例 #1
0
ファイル: auction.php プロジェクト: kosmosby/medicine-prof
 function delete($oid = null)
 {
     jimport('joomla.filesystem.file');
     if ($oid) {
         $this->load($oid);
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('picture');
     $query->from('#__bid_pictures');
     $query->where('auction_id = ' . $db->quote($this->id));
     $db->setQuery($query);
     $images = $db->loadObjectList();
     if (count($images)) {
         foreach ($images as $image) {
             if (JFile::exists(AUCTION_PICTURES_PATH . DS . $image->picture)) {
                 JFile::delete(AUCTION_PICTURES_PATH . DS . $image->picture);
                 JFile::delete(AUCTION_PICTURES_PATH . DS . "middle_" . $image->picture);
                 JFile::delete(AUCTION_PICTURES_PATH . DS . "resize_" . $image->picture);
             }
         }
     }
     //all the records dependent on auctions will be deleted through foreign keys
     return parent::delete();
 }