当前位置: 首页>>代码示例>>PHP>>正文


PHP JUDirectoryHelper::deleteLogs方法代码示例

本文整理汇总了PHP中JUDirectoryHelper::deleteLogs方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDirectoryHelper::deleteLogs方法的具体用法?PHP JUDirectoryHelper::deleteLogs怎么用?PHP JUDirectoryHelper::deleteLogs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JUDirectoryHelper的用法示例。


在下文中一共展示了JUDirectoryHelper::deleteLogs方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete($pk = null)
 {
     $k = $this->_tbl_key;
     $pk = is_null($pk) ? $this->{$k} : $pk;
     if (parent::delete($pk)) {
         $db = JFactory::getDbo();
         $query = "DELETE FROM #__judirectory_criterias_values WHERE rating_id = {$pk}";
         $db->setQuery($query);
         $db->execute();
         JUDirectoryHelper::deleteLogs('rating', $pk);
         return true;
     }
     return false;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:14,代码来源:rating.php

示例2: _delete

 protected function _delete($comment)
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables');
     $db = $this->_db;
     $query = "DELETE FROM #__judirectory_subscriptions WHERE item_id = " . $comment->id . " AND type = 'comment'";
     $db->setQuery($query);
     $db->execute();
     $query = "DELETE FROM #__judirectory_reports WHERE item_id = " . $comment->id . " AND type = 'comment'";
     $db->setQuery($query);
     $db->execute();
     $query = "SELECT r.id FROM #__judirectory_rating AS r JOIN #__judirectory_comments AS cm ON r.id = cm.rating_id WHERE cm.id = " . $comment->id;
     $db->setQuery($query);
     $ratingIds = $db->loadColumn();
     if ($ratingIds) {
         $ratingTable = JTable::getInstance("Rating", "JUDirectoryTable");
         foreach ($ratingIds as $ratingId) {
             $ratingTable->delete($ratingId);
         }
     }
     if ($comment->parent_id == 0 && $comment->approved == 1) {
         $query = "SELECT SUM(score) AS total_ratings, COUNT(*) AS total_votes FROM #__judirectory_rating AS rating LEFT JOIN #__judirectory_comments AS comment ON (comment.rating_id = rating.id AND comment.approved = 1) WHERE rating.listing_id = " . $comment->listing_id;
         $db->setQuery($query);
         $score = $db->loadObject();
         $listing_table = JTable::getInstance("Listing", "JUDirectoryTable");
         if ($listing_table->load($comment->listing_id)) {
             if ($score->total_votes > 0) {
                 $listing_table->rating = (double) $score->total_ratings / $score->total_votes;
             } else {
                 $listing_table->rating = 0;
             }
             $listing_table->total_votes = $score->total_votes;
             $listing_table->store();
         }
     }
     $query = "DELETE FROM #__judirectory_mailqs\n\t\t\t      WHERE item_id =" . $comment->id . "\n\t\t\t\t\t\tAND email_id IN (SELECT id FROM #__judirectory_emails WHERE (`event` LIKE 'comment.%' and `event` != 'comment.delete'))";
     $db->setQuery($query);
     $db->execute();
     JUDirectoryHelper::deleteLogs('comment', $comment->id);
     return true;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:40,代码来源:comment.php

示例3: delete

 public function delete($pk = null)
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables');
     $k = $this->_tbl_key;
     $pk = is_null($pk) ? $this->{$k} : $pk;
     $db = JFactory::getDbo();
     $query = "DELETE FROM #__judirectory_subscriptions WHERE item_id = {$pk} AND type = 'listing'";
     $db->setQuery($query);
     $db->execute();
     $query = "SELECT * FROM #__judirectory_comments WHERE listing_id = " . $pk;
     $db->setQuery($query);
     $commentIds = $db->loadColumn();
     if ($commentIds) {
         $commentTable = JTable::getInstance("Comment", "JUDirectoryTable");
         foreach ($commentIds as $commentId) {
             $commentTable->delete($commentId);
         }
     }
     $query = "SELECT id FROM #__judirectory_rating WHERE listing_id = {$pk}";
     $db->setQuery($query);
     $ratingItemIds = $db->loadColumn();
     if ($ratingItemIds) {
         $ratingTable = JTable::getInstance("Rating", "JUDirectoryTable");
         foreach ($ratingItemIds as $ratingItemId) {
             $ratingTable->delete($ratingItemId);
         }
     }
     $query = "DELETE FROM #__judirectory_reports WHERE item_id = {$pk} AND type = 'listing'";
     $db->setQuery($query);
     $db->execute();
     $query = "SELECT id FROM #__judirectory_collections_items WHERE listing_id = {$pk}";
     $db->setQuery($query);
     $collectionItemIds = $db->loadColumn();
     if ($collectionItemIds) {
         $collectionItemTable = JTable::getInstance("CollectionItem", "JUDirectoryTable");
         foreach ($collectionItemIds as $collectionItemId) {
             $collectionItemTable->delete($collectionItemId);
         }
     }
     JUDirectoryHelper::deleteLogs('listing', $pk);
     $query = "DELETE FROM #__judirectory_mailqs\n\t\t\t      WHERE item_id =" . $pk . "\n\t\t\t\t\t\tAND email_id IN (SELECT id FROM #__judirectory_emails WHERE (`event` LIKE 'listing.%' AND `event` != 'listing.delete'))";
     $db->setQuery($query);
     $db->execute();
     $query = $db->getQuery(true);
     $query->select('id');
     $query->from('#__judirectory_listings');
     $query->where('approved=' . -$pk);
     $db->setQuery($query);
     $tempListingIds = $db->loadColumn();
     if (count($tempListingIds)) {
         foreach ($tempListingIds as $tempListingId) {
             $this->deleteMainData($tempListingId, true);
         }
     }
     $cat_id = JUDirectoryFrontHelperCategory::getMainCategoryId($this->id);
     $this->deleteMainData($pk);
     if (parent::delete($pk)) {
         $app = JFactory::getApplication();
         if ($app->isSite()) {
             $registry = new JRegistry();
             $registry->loadObject($this);
             $mailData = $registry->toArray();
             $mailData['cat_id'] = $cat_id;
             if ($this->approved < 1) {
                 JUDirectoryFrontHelperMail::sendEmailByEvent('listing.reject', $this->id, $mailData);
             } else {
                 JUDirectoryFrontHelperMail::sendEmailByEvent('listing.delete', $this->id, $mailData);
             }
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:74,代码来源:listing.php

示例4: delete


//.........这里部分代码省略.........
     if ($canDeleteListingIds) {
         foreach ($canDeleteListingIds as $listingId) {
             if (!$listingTable->delete($listingId)) {
                 $this->setError($listingTable->getError());
                 return false;
             }
         }
     }
     $canDeleteCatIds = array_unique($canDeleteCatIds);
     if ($canDeleteCatIds) {
         foreach ($canDeleteCatIds as $pk) {
             if ($table->load($pk)) {
                 $context = $this->option . '.' . $this->name;
                 $result = $dispatcher->trigger($this->event_before_delete, array($context, $table));
                 if (in_array(false, $result, true)) {
                     $this->setError($table->getError());
                     return false;
                 }
                 if (!$table->delete($pk, false)) {
                     $this->setError($table->getError());
                     return false;
                 } else {
                     $query = "DELETE FROM #__judirectory_categories_relations WHERE cat_id=" . $pk;
                     $db->setQuery($query);
                     $db->execute();
                     $query = "DELETE FROM #__judirectory_listings_xref WHERE main=0 AND cat_id=" . $pk;
                     $db->setQuery($query);
                     $db->execute();
                     $query = "SELECT mod_id FROM #__judirectory_moderators_xref WHERE cat_id = " . $pk;
                     $db->setQuery($query);
                     $moderatorIds = $db->loadColumn();
                     $query = "DELETE FROM #__judirectory_moderators_xref WHERE cat_id=" . $pk;
                     $db->setQuery($query);
                     $db->execute();
                     if ($moderatorIds) {
                         $modTable = JTable::getInstance("Moderator", "JUDirectoryTable");
                         foreach ($moderatorIds as $moderatorId) {
                             $query = $db->getQuery(true);
                             $query->select('COUNT(*)');
                             $query->from('#__judirectory_moderators AS m');
                             $query->join('', '#__judirectory_moderators_xref AS mxref ON m.id = mxref.mod_id');
                             $query->where('m.id =' . $moderatorId);
                             $db->setQuery($query);
                             $totalModeratedCats = $db->loadResult();
                             if ($totalModeratedCats <= 0) {
                                 $modTable->reset();
                                 if ($modTable->load(array($moderatorId))) {
                                     $modTable->delete();
                                 }
                             }
                         }
                     }
                     $images = json_decode($table->images);
                     if (is_object($images)) {
                         if ($images->intro_image) {
                             $intro_image = JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/') . $images->intro_image;
                             $ori_intro_image = JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/') . "original/" . $images->intro_image;
                             if (JFile::exists(JPATH_ROOT . "/" . $ori_intro_image)) {
                                 JFile::delete(JPATH_ROOT . "/" . $ori_intro_image);
                             }
                             if (JFile::exists(JPATH_ROOT . "/" . $intro_image)) {
                                 JFile::delete(JPATH_ROOT . "/" . $intro_image);
                             }
                         }
                         if ($images->detail_image) {
                             $detail_image = JUDirectoryFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judirectory/images/category/detail/') . $images->detail_image;
                             $ori_detail_image = JUDirectoryFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judirectory/images/category/detail/') . "original/" . $images->detail_image;
                             if (JFile::exists(JPATH_ROOT . "/" . $detail_image)) {
                                 JFile::delete(JPATH_ROOT . "/" . $detail_image);
                             }
                             if (JFile::exists(JPATH_ROOT . "/" . $ori_detail_image)) {
                                 JFile::delete(JPATH_ROOT . "/" . $ori_detail_image);
                             }
                         }
                     }
                     if ($table->level == 0 || $table->level == 1) {
                         $query = "DELETE FROM #__judirectory_emails_xref WHERE cat_id = " . $table->id;
                         $db->setQuery($query);
                         $db->execute();
                     }
                     JUDirectoryHelper::deleteLogs('category', $pk);
                     $query = "DELETE FROM #__judirectory_fields_ordering WHERE `item_id` = " . $table->id . " AND `type` = 'category'";
                     $db->setQuery($query);
                     $db->execute();
                     $dispatcher->trigger($this->event_after_delete, array($context, $table));
                 }
             }
         }
     }
     if ($canDeleteCatIds) {
         $app = JFactory::getApplication();
         $app->enqueueMessage(JText::plural('COM_JUDIRECTORY_CATEGORIES_N_ITEMS_DELETED', count($canDeleteCatIds)));
     }
     $canNotDeleteCatIds = array_unique($canNotDeleteCatIds);
     if ($canNotDeleteCatIds) {
         JError::raiseWarning(500, JText::plural('COM_JUDIRECTORY_CATEGORIES_N_ITEMS_NOT_DELETED', count($canNotDeleteCatIds)));
     }
     $this->cleanCache();
     return true;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:category.php


注:本文中的JUDirectoryHelper::deleteLogs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。