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


PHP ocp_tempcode::to_assembly方法代码示例

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


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

示例1: generate_notifications

/**
 * Calculate OCF notifications and render.
 *
 * @param  string		Cache identifier that we'll use.
 * @return array		A pair: Number of notifications, Rendered notifications.
 */
function generate_notifications($cache_identifier)
{
    $nql_backup = $GLOBALS['NO_QUERY_LIMIT'];
    $GLOBALS['NO_QUERY_LIMIT'] = true;
    $unread_pps = ocf_get_pp_rows();
    $notifications = new ocp_tempcode();
    $num_unread_pps = 0;
    foreach ($unread_pps as $unread_pp) {
        $by_id = is_null($unread_pp['t_cache_first_member_id']) || !is_null($unread_pp['t_forum_id']) ? $unread_pp['p_poster'] : $unread_pp['t_cache_first_member_id'];
        $by = $GLOBALS['OCF_DRIVER']->get_username($by_id);
        if (is_null($by)) {
            $by = do_lang('UNKNOWN');
        }
        $u_title = $unread_pp['t_cache_first_title'];
        if (is_null($unread_pp['t_forum_id'])) {
            $type = do_lang_tempcode($unread_pp['t_cache_first_post_id'] == $unread_pp['id'] ? 'NEW_PT_NOTIFICATION' : 'NEW_PP_NOTIFICATION');
            $num_unread_pps++;
            $reply_url = build_url(array('page' => 'topics', 'type' => 'new_post', 'id' => $unread_pp['p_topic_id'], 'quote' => $unread_pp['id']), get_module_zone('topics'));
            $additional_posts = $GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT COUNT(*) AS cnt FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_posts WHERE p_topic_id=' . strval($unread_pp['p_topic_id']) . ' AND id>' . strval($unread_pp['id']));
        } else {
            $type = do_lang_tempcode('ADD_INLINE_PERSONAL_POST');
            if ($unread_pp['p_title'] != '') {
                $u_title = $unread_pp['p_title'];
            }
            $reply_url = build_url(array('page' => 'topics', 'type' => 'new_post', 'id' => $unread_pp['p_topic_id'], 'quote' => $unread_pp['id'], 'intended_solely_for' => $unread_pp['p_poster']), get_module_zone('topics'));
            $additional_posts = 0;
        }
        $time_raw = $unread_pp['p_time'];
        $time = get_timezoned_date($unread_pp['p_time']);
        $topic = $GLOBALS['OCF_DRIVER']->post_url($unread_pp['id'], NULL);
        $post = get_translated_tempcode($unread_pp['p_post'], $GLOBALS['FORUM_DB']);
        $description = $unread_pp['t_description'];
        if ($description != '') {
            $description = ' (' . $description . ')';
        }
        $profile_link = is_guest($by_id) ? new ocp_tempcode() : $GLOBALS['OCF_DRIVER']->member_profile_url($by_id, false, true);
        $redirect = get_self_url(true, true);
        $ignore_url = build_url(array('page' => 'topics', 'type' => 'mark_read_topic', 'id' => $unread_pp['p_topic_id'], 'redirect' => $redirect), get_module_zone('topics'));
        $ignore_url_2 = build_url(array('page' => 'topics', 'type' => 'mark_read_topic', 'id' => $unread_pp['p_topic_id'], 'redirect' => $redirect, 'ajax' => 1), get_module_zone('topics'));
        require_javascript('javascript_ajax');
        $notifications->attach(do_template('OCF_NOTIFICATION', array('_GUID' => '3b224ea3f4da2f8f869a505b9756970a', 'ADDITIONAL_POSTS' => integer_format($additional_posts), '_ADDITIONAL_POSTS' => strval($additional_posts), 'ID' => strval($unread_pp['id']), 'U_TITLE' => $u_title, 'IGNORE_URL' => $ignore_url, 'IGNORE_URL_2' => $ignore_url_2, 'REPLY_URL' => $reply_url, 'TOPIC_URL' => $topic, 'POST' => $post, 'DESCRIPTION' => $description, 'TIME' => $time, 'TIME_RAW' => strval($time_raw), 'BY' => $by, 'PROFILE_LINK' => $profile_link, 'TYPE' => $type)));
    }
    require_code('caches2');
    put_into_cache('_new_pp', 60 * 60 * 24, $cache_identifier, array($notifications->to_assembly(), $num_unread_pps));
    $GLOBALS['NO_QUERY_LIMIT'] = $nql_backup;
    return array($notifications, $num_unread_pps);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:53,代码来源:ocf_notifications.php


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