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


PHP cmsUser::getAutoAwards方法代码示例

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


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

示例1: users


//.........这里部分代码省略.........
        if (!cmsCore::inRequest('gosend')) {
            cmsPage::initTemplate('components', 'com_users_awards_give')->assign('usr', $usr)->assign('awardslist', cmsUser::getAwardsImages())->display('com_users_awards_give.tpl');
        } else {
            $award['title'] = cmsCore::request('title', 'str', $_LANG['AWRD']);
            $award['description'] = cmsCore::request('description', 'str', '');
            $award['imageurl'] = cmsCore::request('imageurl', 'str', '');
            $award['from_id'] = $inUser->id;
            $award['id'] = 0;
            cmsUser::giveAward($award, $id);
            cmsCore::redirect(cmsUser::getProfileURL($usr['login']));
        }
    }
    //============================================================================//
    //============================= Удаление награды  ============================//
    //============================================================================//
    if ($do == 'delaward') {
        $aw = $inDB->get_fields('cms_user_awards', "id = '{$id}'", '*');
        if (!$aw) {
            cmsCore::error404();
        }
        if (!$inUser->id || $inUser->id != $aw['user_id'] && !$inUser->is_admin) {
            cmsCore::error404();
        }
        $inDB->delete('cms_user_awards', "id = '{$id}'", 1);
        cmsActions::removeObjectLog('add_award', $id);
        cmsCore::redirectBack();
    }
    //============================================================================//
    //============================= Награды на сайте  ============================//
    //============================================================================//
    if ($do == 'awardslist') {
        $inPage->setTitle($_LANG['SITE_AWARDS']);
        $inPage->addPathway($_LANG['SITE_AWARDS']);
        $awards = cmsUser::getAutoAwards();
        if (!$awards) {
            cmsCore::error404();
        }
        foreach ($awards as $aw) {
            //Перебираем все награды и ищем пользователей с текущей наградой
            $sql = "SELECT u.id as id, u.nickname as nickname, u.login as login, IFNULL(p.gender, 'm') as gender\r\n                 FROM cms_user_awards aw\r\n                 LEFT JOIN cms_users u ON u.id = aw.user_id\r\n                 LEFT JOIN cms_user_profiles p ON p.user_id = u.id\r\n                 WHERE aw.award_id = '{$aw['id']}'";
            $rs = $inDB->query($sql);
            $aw['uhtml'] = '';
            if ($inDB->num_rows($rs)) {
                while ($user = $inDB->fetch_assoc($rs)) {
                    $aw['uhtml'] .= cmsUser::getGenderLink($user['id'], $user['nickname'], $user['gender'], $user['login']) . ', ';
                }
                $aw['uhtml'] = rtrim($aw['uhtml'], ', ');
            } else {
                $aw['uhtml'] = $_LANG['NOT_USERS_WITH_THIS_AWARD'];
            }
            $aws[] = $aw;
        }
        cmsPage::initTemplate('components', 'com_users_awards_site')->assign('aws', $aws)->display('com_users_awards_site.tpl');
    }
    //============================================================================//
    //============================= Удаление профиля  ============================//
    //============================================================================//
    if ($do == 'delprofile') {
        // неавторизованным тут делать нечего
        if (!$inUser->id) {
            cmsCore::error404();
        }
        // есть ли удаляемый профиль
        $data = cmsUser::getShortUserData($id);
        if (!$data) {
            cmsCore::error404();
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php


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