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


PHP JUDownloadHelper::rebuildRating方法代码示例

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


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

示例1: approve

 function approve($comment_ids)
 {
     if (!is_array($comment_ids) || empty($comment_ids)) {
         $this->setError('COM_JUDOWNLOAD_NO_ITEM_SELECTED');
         return false;
     }
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_judownload/tables');
     $comment_table = JTable::getInstance("Comment", "JUDownloadTable");
     $count = 0;
     $comment_ids = (array) $comment_ids;
     $rootComment = JUDownloadFrontHelperComment::getRootComment();
     $docIds = 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) {
             $docIds[$comment_table->doc_id] = $comment_table->doc_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++;
         JUDownloadFrontHelperMail::sendEmailByEvent('comment.approve', $comment_id);
         $logData = array('user_id' => $comment_table->user_id, 'event' => 'comment.approve', 'item_id' => $comment_id, 'doc_id' => $comment_table->doc_id, 'value' => 0, 'reference' => '');
         JUDownloadFrontHelperLog::addLog($logData);
     }
     foreach ($docIds as $docId) {
         JUDownloadHelper::rebuildRating($docId);
     }
     return $count;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数: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());
     }
     $docIds = $this->getDocsForRating($cats, $criteriaGroups, $limit, $start);
     if (!empty($docIds)) {
         foreach ($docIds as $docId) {
             JUDownloadHelper::rebuildRating($docId);
         }
         $result = array('processed' => count($docIds) + $start, 'total' => $app->getUserState('total_documents', 0));
     } else {
         $result = array('processed' => 100, 'total' => $app->getUserState('total_documents', 0));
     }
     return json_encode($result);
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:25,代码来源:tools.php


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