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


PHP Comments::get_comment_forum_id方法代码示例

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


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

示例1: foreach

 function action_toggle($input)
 {
     global $user, $tikilib, $prefs, $artlib;
     if (!$user) {
         throw new Services_Exception(tr('Must be authenticated'), 403);
     }
     $type = $input->type->none();
     $object = $input->object->none();
     $target = $input->target->int();
     if (!$type || !$object) {
         throw new Services_Exception(tr('Invalid input'), 400);
     }
     $relationlib = TikiLib::lib('relation');
     $relations = $this->action_list($input);
     if ($target) {
         if (!in_array("{$type}:{$object}", $relations) && ($relationId = $relationlib->add_relation('tiki.user.favorite', 'user', $user, $type, $object))) {
             $relations[$relationId] = "{$type}:{$object}";
             TikiLib::lib('tiki')->refresh_index($type, $object);
         }
     } else {
         foreach ($relations as $id => $key) {
             if ($key === "{$type}:{$object}") {
                 $relationlib->remove_relation($id);
                 unset($relations[$id]);
                 TikiLib::lib('tiki')->refresh_index($type, $object);
             }
         }
     }
     if ($prefs['feature_score'] == 'y' && $target) {
         if ($type == 'forum post') {
             require_once 'lib/comments/commentslib.php';
             $commentslib = new Comments();
             $forum_id = $commentslib->get_comment_forum_id($object);
             $forum_info = $commentslib->get_forum($forum_id);
             $thread_info = $commentslib->get_comment($object, null, $forum_info);
             $item_user = $thread_info['userName'];
         } elseif ($type == 'article') {
             require_once 'lib/articles/artlib.php';
             $artlib = new ArtLib();
             $res = $artlib->get_article($object);
             $item_user = $res['author'];
         }
         $tikilib->score_event($user, 'item_favorited', "{$type}:{$object}");
         $tikilib->score_event($item_user, 'item_is_favorited', "{$user}:{$type}:{$object}");
     }
     return array('list' => $relations);
 }
开发者ID:hurcane,项目名称:tiki-azure,代码行数:47,代码来源:Controller.php

示例2: smarty_modifier_forumname

function smarty_modifier_forumname($commentid, $retrun_forumid = 'n')
{
    global $tikilib, $cachelib;
    require_once 'lib/comments/commentslib.php';
    $comments = new Comments();
    if ($retrun_forumid == 'y') {
        $cacheItem = "retrun_forumid" . $commentid;
    } else {
        $cacheItem = "retrun_forumname" . $commentid;
    }
    if ($cached = $cachelib->getCached($cacheItem)) {
        return $cached;
    }
    $forum_id = $comments->get_comment_forum_id($commentid);
    $cachelib->cacheItem($cacheItem, $forum_id);
    if ($retrun_forumid == 'y') {
        return $forum_id;
    }
    $ret = $comments->get_forum($forum_id);
    $cachelib->cacheItem($cacheItem, $ret['name']);
    return $ret['name'];
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:22,代码来源:modifier.forumname.php

示例3: smarty_function_rating

function smarty_function_rating($params, $smarty)
{
    global $prefs, $ratinglib;
    require_once 'lib/rating/ratinglib.php';
    if (!isset($params['type'], $params['id'])) {
        return tra('No object information provided for rating.');
    }
    $type = $params['type'];
    $id = $params['id'];
    if (isset($params['changemandated']) && $params['changemandated'] == 'y') {
        $changemandated = true;
        // needed to fix multiple submission problem in comments
    } else {
        $changemandated = false;
    }
    if (isset($_REQUEST['rating_value'][$type][$id], $_REQUEST['rating_prev'][$type][$id])) {
        $value = $_REQUEST['rating_value'][$type][$id];
        $prev = $_REQUEST['rating_prev'][$type][$id];
        if ((!$changemandated || $value != $prev) && $ratinglib->record_vote($type, $id, $value)) {
            // Handle type-specific actions
            if ($type == 'comment') {
                global $user;
                require_once 'lib/comments/commentslib.php';
                if ($user) {
                    $commentslib = new Comments();
                    $commentslib->vote_comment($id, $user, $value);
                }
            } elseif ($type == 'article') {
                global $artlib, $user;
                require_once 'lib/articles/artlib.php';
                if ($user) {
                    $artlib->vote_comment($id, $user, $value);
                }
            }
            if ($prefs['feature_score'] == 'y' && $id) {
                global $tikilib;
                if ($type == 'comment') {
                    $forum_id = $commentslib->get_comment_forum_id($id);
                    $forum_info = $commentslib->get_forum($forum_id);
                    $thread_info = $commentslib->get_comment($id, null, $forum_info);
                    $item_user = $thread_info['userName'];
                } elseif ($type == 'article') {
                    require_once 'lib/articles/artlib.php';
                    $artlib = new ArtLib();
                    $res = $artlib->get_article($id);
                    $item_user = $res['author'];
                }
                if ($value == '1') {
                    $tikilib->score_event($item_user, 'item_is_rated', "{$user}:{$type}:{$id}");
                } elseif ($value == '2') {
                    $tikilib->score_event($item_user, 'item_is_unrated', "{$user}:{$type}:{$id}");
                }
            }
        } elseif ($value != $prev) {
            return tra('An error occurred.');
        }
    }
    $vote = $ratinglib->get_vote($type, $id);
    $options = $ratinglib->get_options($type, $id);
    if ($prefs['rating_smileys'] == 'y') {
        $smiles = $ratinglib->get_options_smiles($type, $id);
        $smarty->assign('rating_smiles', $smiles);
    }
    $smarty->assign('rating_type', $type);
    $smarty->assign('rating_id', $id);
    $smarty->assign('rating_options', $options);
    $smarty->assign('current_rating', $vote);
    return $smarty->fetch('rating.tpl');
}
开发者ID:hurcane,项目名称:tiki-azure,代码行数:69,代码来源:function.rating.php


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