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


PHP UserProfile::setCahceForUsers方法代码示例

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


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

示例1: message

function message()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.tags.php';
    $tags = new Tags('lms_forum');
    $tags->setupJs('a[id^=handler-tags-]', 'a[id^=private-handler-tags-]');
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delmessage]');
    $lang =& DoceboLanguage::createInstance('forum', 'lms');
    $id_thread = importVar('idThread', true, 0);
    $sema_perm = checkPerm('sema', true);
    $moderate = checkPerm('moderate', true);
    $mod_perm = checkPerm('mod', true);
    $write_perm = checkPerm('write', true);
    $acl_man =& Docebo::user()->getAclManager();
    $profile_man = new UserProfile(0);
    $profile_man->init('profile', 'framework', 'index.php?modname=forum&op=forum');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink('index.php?modname=forum&op=message&idThread=' . $id_thread);
    $ini = $tb->getSelectedElement();
    $ini_page = $tb->getSelectedPage();
    $first_unread_message = importVar('firstunread', true, 0);
    $ini_first_unread_message = importVar('ini', true, 0);
    $set_important = importVar('important', true, 0);
    if ($set_important == 1) {
        $query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 1" . " WHERE idThread = '" . $id_thread . "'";
        $result_set_important = sql_query($query_set_important);
    }
    if ($set_important == 2) {
        $query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 0" . " WHERE idThread = '" . $id_thread . "'";
        $result_set_important = sql_query($query_set_important);
    }
    // Some info about forum and thread
    $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased, rilevantForum\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'";
    list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t, $is_important) = sql_fetch_row(sql_query($thread_query));
    $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'";
    list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query));
    ++$tot_message;
    //set as readed if needed
    if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) {
        unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]);
    }
    if ($ini == 0 && !isset($_GET['result'])) {
        sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'");
    }
    $page_title = array('index.php?modname=forum&op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&op=thread&idForum=' . $id_forum => $forum_title, $thread_title);
    if ($erased_t && !$mod_perm && !$moderate) {
        $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content');
        return;
    }
    // Who have semantic evaluation
    $re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema");
    while (list($msg_sema) = sql_fetch_row($re_sema)) {
        $forum_sema[$msg_sema] = 1;
    }
    // Find post
    $messages = array();
    $authors = array();
    $authors_names = array();
    $authors_info = array();
    $re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem'));
    while ($record = mysql_fetch_assoc($re_message)) {
        $messages[$record['idMessage']] = $record;
        $authors[$record['author']] = $record['author'];
        if ($record['modified_by'] != 0) {
            $authors[$record['modified_by']] = $record['modified_by'];
        }
        $tag_resource_list[] = $record['idMessage'];
    }
    $authors_names =& $acl_man->getUsers($authors);
    $level_name = CourseLevel::getLevels();
    //tags
    $tags->loadResourcesTags($tag_resource_list);
    // Retriving level and number of post of the authors
    if (!empty($authors)) {
        $re_num_post = sql_query("\r\n\t\tSELECT u.idUser, u.level, COUNT(*)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\t\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\t\tGROUP BY u.idUser, u.level");
        while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) {
            $authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]);
        }
        $profile_man->setCahceForUsers($authors);
    }
    $type_h = array('forum_sender', 'forum_text');
    $cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    // Compose messagges display
    $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
    $counter = 0;
    while (list($id_message, $message_info) = each($messages)) {
        $counter++;
        // sender info
        $m_author = $message_info['author'];
        //if(isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') $img_size = @getimagesize($path.$authors_names[$m_author][ACL_INFO_AVATAR]);
        $profile_man->setIdUser($m_author);
        $author = $profile_man->getUserPanelData(false, 'normal');
        $sender = '';
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:forma_app,代码行数:101,代码来源:forum.php


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