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


PHP JUDirectoryHelper::rebuildRating方法代码示例

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


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

示例1: approve

 function approve($comment_ids)
 {
     if (!is_array($comment_ids) || empty($comment_ids)) {
         $this->setError('COM_JUDIRECTORY_NO_ITEM_SELECTED');
         return false;
     }
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judirectory/tables');
     $comment_table = JTable::getInstance("Comment", "JUDirectoryTable");
     $count = 0;
     $comment_ids = (array) $comment_ids;
     $rootComment = JUDirectoryFrontHelperComment::getRootComment();
     $listingIds = array();
     foreach ($comment_ids as $comment_id) {
         $comment_table->reset();
         if ($comment_table->load($comment_id) && $comment_table->parent_id == $rootComment->id && $comment_table->approved == 0) {
             $listingIds[$comment_table->listing_id] = $comment_table->listing_id;
         }
         $user = JFactory::getUser();
         $date = JFactory::getDate();
         $comment_table->approved = 1;
         $comment_table->published = 1;
         $comment_table->approved_by = $user->id;
         $comment_table->approved_time = $date->toSql();
         $comment_table->store();
         $count++;
         JUDirectoryFrontHelperMail::sendEmailByEvent('comment.approve', $comment_id);
         $logData = array('user_id' => $comment_table->user_id, 'event' => 'comment.approve', 'item_id' => $comment_id, 'listing_id' => $comment_table->listing_id, 'value' => 0, 'reference' => '');
         JUDirectoryFrontHelperLog::addLog($logData);
     }
     foreach ($listingIds as $listingId) {
         JUDirectoryHelper::rebuildRating($listingId);
     }
     return $count;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:34,代码来源:pendingcomment.php

示例2: reBuildRating

 public function reBuildRating()
 {
     $app = JFactory::getApplication();
     $start = $app->input->getInt("start", 0);
     $limit = $app->input->getInt("limit", 5);
     if ($start == 0) {
         $cats = $app->input->get('cats', array(), 'array');
         $criteriaGroups = $app->input->get('criteriagroups', array(), 'array');
         $app->setUserState('cats', $cats);
         $app->setUserState('criteria_groups', $criteriaGroups);
     } else {
         $cats = $app->getUserState('cats', array());
         $criteriaGroups = $app->getUserState('criteria_groups', array());
     }
     $listingIds = $this->getListingsForRating($cats, $criteriaGroups, $limit, $start);
     if (!empty($listingIds)) {
         foreach ($listingIds as $listingId) {
             JUDirectoryHelper::rebuildRating($listingId);
         }
         $result = array('processed' => count($listingIds) + $start, 'total' => $app->getUserState('total_listings', 0));
     } else {
         $result = array('processed' => 100, 'total' => $app->getUserState('total_listings', 0));
     }
     return json_encode($result);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:25,代码来源:tools.php


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