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


PHP AlphaUserPointsHelper::displayMessageSystem方法代码示例

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


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

示例1: checkChangeLevel

 public static function checkChangeLevel($referrerid, $newtotal)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $ok = 0;
     $lang = JFactory::getLanguage();
     $lang->load('com_alphauserpoints', JPATH_SITE);
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'tables');
     $resultChangeLevel1 = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_changelevel1', 0, $referrerid);
     $resultChangeLevel2 = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_changelevel2', 0, $referrerid);
     $resultChangeLevel3 = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_changelevel3', 0, $referrerid);
     if ($resultChangeLevel1) {
         $checkAlreadyDone1 = explode(',', $resultChangeLevel1[0]->exclude_items);
     }
     if ($resultChangeLevel2) {
         $checkAlreadyDone2 = explode(',', $resultChangeLevel2[0]->exclude_items);
     }
     if ($resultChangeLevel3) {
         $checkAlreadyDone3 = explode(',', $resultChangeLevel3[0]->exclude_items);
     }
     $userid = AlphaUserPointsHelper::getUserID($referrerid);
     // get actual group fot this user
     jimport('joomla.user.helper');
     $authorizedLevels = JAccess::getAuthorisedViewLevels($userid);
     $result = array_keys(JUserHelper::getUserGroups($userid));
     $actualgroup = end($result);
     if ($resultChangeLevel1 && $newtotal >= $resultChangeLevel1[0]->points2 && !in_array(intval($resultChangeLevel1[0]->content_items), $authorizedLevels) && !in_array($userid, $checkAlreadyDone1)) {
         // delete old group
         $query = "DELETE FROM `#__user_usergroup_map` WHERE `user_id`='{$userid}'";
         $db->setQuery($query);
         $db->query();
         JUserHelper::addUserToGroup($userid, intval($resultChangeLevel1[0]->content_items));
         $user = JUser::getInstance((int) $userid);
         $ok = 1;
         $resultChangeLevel = $resultChangeLevel1;
         $result = JUserHelper::getUserGroups($userid);
         $actualnamegroup = end($result);
         // insert done for this user in this rule
         if ($resultChangeLevel1[0]->exclude_items != '') {
             $insertUserId = $resultChangeLevel1[0]->exclude_items . ',' . $userid;
         } else {
             $insertUserId = $userid;
         }
         $row = JTable::getInstance('rules');
         $row->load(intval($resultChangeLevel1[0]->id));
         $row->exclude_items = $insertUserId;
         $db->updateObject('#__alpha_userpoints_rules', $row, 'id');
     }
     if ($resultChangeLevel2 && $newtotal >= $resultChangeLevel2[0]->points2 && !in_array(intval($resultChangeLevel2[0]->content_items), $authorizedLevels) && !in_array($userid, $checkAlreadyDone2)) {
         $query = "DELETE FROM `#__user_usergroup_map` WHERE `user_id`='{$userid}'";
         $db->setQuery($query);
         $db->query();
         JUserHelper::addUserToGroup($userid, intval($resultChangeLevel2[0]->content_items));
         $user = JUser::getInstance((int) $userid);
         $ok = 1;
         $resultChangeLevel = $resultChangeLevel2;
         $result = JUserHelper::getUserGroups($userid);
         $actualnamegroup = end($result);
         $row = JTable::getInstance('rules');
         $row->load(intval($resultChangeLevel2[0]->id));
         $row->exclude_items = $insertUserId;
         $db->updateObject('#__alpha_userpoints_rules', $row, 'id');
     }
     if ($resultChangeLevel3 && $newtotal >= $resultChangeLevel3[0]->points2 && !in_array(intval($resultChangeLevel3[0]->content_items), $authorizedLevels) && !in_array($userid, $checkAlreadyDone3)) {
         $query = "DELETE FROM `#__user_usergroup_map` WHERE `user_id`='{$userid}'";
         $db->setQuery($query);
         $db->query();
         JUserHelper::addUserToGroup($userid, intval($resultChangeLevel3[0]->content_items));
         $user = JUser::getInstance((int) $userid);
         $ok = 1;
         $resultChangeLevel = $resultChangeLevel3;
         $result = JUserHelper::getUserGroups($userid);
         $actualnamegroup = end($result);
         $row = JTable::getInstance('rules');
         $row->load(intval($resultChangeLevel3[0]->id));
         $row->exclude_items = $insertUserId;
         $db->updateObject('#__alpha_userpoints_rules', $row, 'id');
     }
     if ($ok) {
         // refresh session if user online
         $temp = JFactory::getUser((int) $userid);
         $temp->groups = $user->groups;
         $temp = JFactory::getUser((int) $userid);
         if ($temp->id == $userid) {
             $temp->groups = $user->groups;
         }
     }
     // show message only for current user and if frontend site
     if ($referrerid == @$_SESSION['referrerid'] && $app->isSite() && $ok) {
         // display message for the current user
         if ($resultChangeLevel[0]->displaymsg && $resultChangeLevel[0]->msg != '') {
             $msg = str_replace('{username}', $user->username, $resultChangeLevel[0]->msg);
             $msg = str_replace('{points}', AlphaUserPointsHelper::getFPoints($resultChangeLevel[0]->points), $msg);
             $msg = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $msg);
             AlphaUserPointsHelper::displayMessageSystem($msg);
         } elseif ($resultChangeLevel[0]->displaymsg && $resultChangeLevel[0]->msg == '') {
             AlphaUserPointsHelper::displayMessageSystem(sprintf(JText::_('AUP_MSG_YOUHAVENEWUSERRIGHTS'), AlphaUserPointsHelper::getFPoints($resultChangeLevel[0]->points2), $actualnamegroup));
         }
     }
     if ($ok) {
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:helper.php


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