コード例 #1
0
ファイル: group.php プロジェクト: kidaa30/lojinha
 public function delete(&$cid)
 {
     if (count($cid)) {
         $cids = implode(',', $cid);
         $this->_db->setQuery("SELECT COUNT(*) FROM #__djrevs_rating_fields WHERE group_id IN ( " . $cids . " )");
         if ($this->_db->loadResult() > 0) {
             $this->setError(JText::_('COM_DJREVIEWS_ERROR_RECORDS_HAVE_ITEMS_GROUP'));
             return false;
         }
     }
     return parent::delete($cid);
 }
コード例 #2
0
ファイル: field.php プロジェクト: kidaa30/lojinha
 public function delete(&$cid)
 {
     $deleted = parent::delete($cid);
     if (!$deleted) {
         return false;
     }
     // mark to recalculate first
     $query = ' UPDATE #__djrevs_reviews AS r ' . ' INNER JOIN #__djrevs_reviews_items as ri ON ri.review_id = r.id AND ri.field_id IN (' . implode(',', $cid) . ')' . ' SET r.recalculate = 1 ';
     $this->_db->setQuery($query);
     $this->_db->query();
     $this->_db->setQuery('DELETE FROM #__djrevs_reviews_items WHERE field_id IN (' . implode(',', $cid) . ')');
     if ($this->_db->query() == false) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     $this->_db->setQuery('DELETE FROM #__djrevs_objects_items WHERE field_id IN (' . implode(',', $cid) . ')');
     if ($this->_db->query() == false) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     return true;
 }
コード例 #3
0
ファイル: review.php プロジェクト: kidaa30/lojinha
 public function delete(&$cid)
 {
     if (count($cid)) {
         // mark other reviews to be recalculated first
         $query = ' UPDATE #__djrevs_reviews AS r ' . ' INNER JOIN (SELECT DISTINCT object_id FROM #__djrevs_reviews WHERE id IN (' . implode(',', $cid) . ')) as r2 ON r2.object_id = r.object_id' . ' SET r.recalculate = 2 ';
         $this->_db->setQuery($query);
         $this->_db->query();
         $this->_db->setQuery('DELETE FROM #__djrevs_reviews_items WHERE review_id IN (' . implode(',', $cid) . ')');
         if ($this->_db->query() == false) {
             $this->setError($this->_db->getErrorMsg());
             return false;
         }
     }
     require_once JPath::clean(JPATH_ROOT . '/components/com_djreviews/lib/api.php');
     DJReviewsAPI::recalculate();
     $deleted = parent::delete($cid);
     return $deleted;
 }