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


PHP AlphaUserPointsHelper::checkRankMedal方法代码示例

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


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

示例1: Recalc

function Recalc($start, $tempsExec)
{
    global $mainframe;
    global $base;
    // check time execute
    list($usec, $sec) = explode(' ', microtime());
    $start_time = (double) $usec + (double) $sec;
    $new_time = $start_time;
    $db = JFactory::getDBO();
    $jnow = JFactory::getDate();
    $now = $jnow->toSql();
    // get params definitions
    $params = JComponentHelper::getParams('com_alphauserpoints');
    $prefixNewReferreid = strtoupper($params->get('prefix_selfregister'));
    //$prefixNewReferreid = "AUPRS-";
    if ($start) {
        $i = $start;
    } else {
        $i = 0;
    }
    $query = "SELECT referreid FROM #__alpha_userpoints WHERE referreid!='GUEST'";
    $db->setQuery($query);
    $users = $db->loadObjectList();
    $numusers = count($users);
    if ($users) {
        require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
        $allowNegativeAccount = $params->get('allowNegativeAccount', 0);
        for ($i, $n = $numusers; $i < $n; $i++) {
            if ($new_time - $start_time < $tempsExec) {
                $user = $users[$i];
                // real sum for each user
                $query = "SELECT SUM(points) FROM #__alpha_userpoints_details WHERE `referreid`='" . $user->referreid . "' AND `approved`='1' AND (`expire_date`>'{$now}' OR `expire_date`='0000-00-00 00:00:00')";
                $db->setQuery($query);
                $newtotal = $db->loadResult();
                if (!$allowNegativeAccount && $newtotal < 0) {
                    $newtotal = 0;
                }
                $query = "UPDATE #__alpha_userpoints SET `points`='" . $newtotal . "', `last_update`='{$now}' WHERE `referreid`='" . $user->referreid . "'";
                $db->setQuery($query);
                if (!$db->query()) {
                    $error = 'ERROR : update not complete';
                    echo '<script language="Javascript">
					<!--
					parent.document.location.replace("' . $base . 'index.php?option=com_alphauserpoints&task=cpanel&recalculate=' . $error . '");							
					// -->
					</script>';
                    exit;
                }
                // update Ranks / Medals if necessary
                AlphaUserPointsHelper::checkRankMedal($user->referreid);
            } else {
                // time ?
                break;
            }
            list($usec, $sec) = explode(" ", microtime());
            $new_time = (double) $usec + (double) $sec;
        }
        // for $i=
        if ($i == $numusers) {
            $start = -1;
        } else {
            $start = $i;
        }
        return $start;
    }
    // if users
}
开发者ID:q0821,项目名称:esportshop,代码行数:67,代码来源:recalculate.php

示例2: checkNewTotal

 function checkNewTotal($referreid, $rule_id)
 {
     $db = JFactory::getDBO();
     $jnow = JFactory::getDate();
     $now = $jnow->toSql();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     // recalculate for this user
     $query = "SELECT SUM(points) FROM #__alpha_userpoints_details WHERE `referreid`='" . $referreid . "' AND `approved`='1' AND (`expire_date`>'{$now}' OR `expire_date`='0000-00-00 00:00:00')";
     $db->setQuery($query);
     $newtotal = $db->loadResult();
     $query = "UPDATE #__alpha_userpoints SET `points`='" . $newtotal . "', `last_update`='{$now}' WHERE `referreid`='" . $referreid . "'";
     $db->setQuery($query);
     $db->query();
     // update Ranks / Medals if necessary
     AlphaUserPointsHelper::checkRankMedal($referreid, $rule_id);
 }
开发者ID:q0821,项目名称:esportshop,代码行数:16,代码来源:alphauserpoints.php

示例3: updateUserPoints


//.........这里部分代码省略.........
             case 'sysplgaup_recommend':
             case 'sysplgaup_reader2author':
             case 'sysplgaup_buypointswithpaypal':
             case 'sysplgaup_invite':
                 // No need congratulation...
                 break;
             case 'sysplgaup_invitewithsuccess':
                 // number points in message = assign points to new user
                 $numpoints = AlphaUserPointsHelper::getPointsRule('sysplgaup_newregistered');
                 if ($numpoints && $user->id) {
                     if ($msg != '') {
                         $msg = str_replace('{points}', AlphaUserPointsHelper::getFPoints($numpoints), JText::_($msg));
                         $msg = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $msg);
                         $app->enqueueMessage($msg);
                     } else {
                         $app->enqueueMessage(sprintf(JText::_('AUP_CONGRATULATION'), AlphaUserPointsHelper::getFPoints($numpoints)));
                     }
                 }
                 break;
             default:
                 if ($referrerid == $realcurrentreferrerid && $user->id) {
                     if ($assignpoints > 0) {
                         if ($msg != '') {
                             $msg = str_replace('{points}', AlphaUserPointsHelper::getFPoints($assignpoints), JText::_($msg));
                             $msg = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $msg);
                             $app->enqueueMessage($msg);
                         } else {
                             $app->enqueueMessage(sprintf(JText::_('AUP_CONGRATULATION'), AlphaUserPointsHelper::getFPoints($assignpoints)));
                             if ($rule_plugin == 'sysplgaup_happybirthday') {
                                 $frontmessage = JText::_('AUP_HAPPYBIRTHDAY');
                             }
                         }
                     } elseif ($assignpoints < 0) {
                         if ($msg != '') {
                             $msg = str_replace('{points}', AlphaUserPointsHelper::getFPoints(abs($assignpoints)), JText::_($msg));
                             $msg = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $msg);
                             $app->enqueueMessage($msg);
                         } else {
                             $app->enqueueMessage(sprintf(JText::_('AUP_X_POINTS_HAS_BEEN_DEDUCTED_FROM_YOUR_ACCOUNT'), AlphaUserPointsHelper::getFPoints(abs($assignpoints))));
                         }
                     }
                 }
         }
     }
     if ($rule_plugin == 'sysplgaup_custom' && $datareference) {
         $rule_name = JText::_($datareference);
     }
     // email notification
     if ($result->notification && !$checkWinner) {
         $result->datareference = JText::_($datareference);
         AlphaUserPointsHelper::sendnotification($referrerid, $assignpoints, $newtotal, $result);
         // load external plugins
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('alphauserpoints');
         $results = $dispatcher->trigger('onSendNotificationAlphaUserPoints', array(&$result, $rule_name, $assignpoints, $newtotal, $referrerid, $user->id));
     }
     // Uddeim notification integration
     if ($params->get('sendMsgUddeim', 0) && !$checkWinner) {
         AlphaUserPointsHelper::sendUddeimNotification($referrerid, $assignpoints, $newtotal, $rule_name);
     }
     // load external plugins
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('alphauserpoints');
     $results = $dispatcher->trigger('onUpdateAlphaUserPoints', array(&$result, $rule_name, $assignpoints, $referrerid, $user->id));
     // checking rank and medals and update if necessary
     if ($rule_id == '') {
         $rule_id = AlphaUserPointsHelper::getRuleID($rule_plugin);
     }
     AlphaUserPointsHelper::checkRankMedal($referrerid, $rule_id);
     // referral points rule
     if ($referraluser != '' && $rule_plugin != 'sysplgaup_buypointswithpaypal' && $rule_plugin != 'sysplgaup_raffle' && $assignpoints > 0) {
         // if not already assigned
         $query = "SELECT * FROM #__alpha_userpoints_rules WHERE `plugin_function`='sysplgaup_referralpoints' AND `published`='1' AND (`rule_expire`>'{$now}' OR `rule_expire`='0000-00-00 00:00:00')";
         $db->setQuery($query);
         $referralpoints = $db->loadObjectList();
         if ($referralpoints) {
             $referraluserpoints = round($assignpoints * $referralpoints[0]->points / 100, 2);
             if ($referraluserpoints > 0) {
                 AlphaUserPointsHelper::userpoints('sysplgaup_referralpoints', $referraluser, $referraluserpoints);
             }
         }
     }
     // check change user group rule
     //if ( $rule_plugin!='sysplgaup_changelevel1' && $rule_plugin!='sysplgaup_changelevel2' && $rule_plugin!='sysplgaup_changelevel3' )
     //{
     AlphaUserPointsHelper::checkChangeLevel($referrerid, AlphaUserPointsHelper::getCurrentTotalPoints($referrerid));
     //}
     if ($frontmessage != '') {
         AlphaUserPointsHelper::displayMessageSystem($frontmessage);
     }
     // load external plugins
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('alphauserpoints');
     $results = $dispatcher->trigger('onAfterUpdateAlphaUserPoints', array(&$result, $rule_name, $assignpoints, $referrerid, $user->id));
     // link up rule
     if ($result->linkup) {
         $plugin_function_linkup = AlphaUserPointsHelper::getPluginFunction($result->linkup);
         AlphaUserPointsHelper::newpoints($plugin_function_linkup, $referrerid);
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:helper.php

示例4: savecustompoints

 public function savecustompoints()
 {
     // specific user
     $app = JFactory::getApplication();
     $referrerid = JFactory::getApplication()->input->get('cid', '', 'string');
     $name = JFactory::getApplication()->input->get('name', '', 'string');
     $points = JFactory::getApplication()->input->get('points', 0, 'float');
     $reason = JFactory::getApplication()->input->get('reason', '', 'SAFE_HTML ');
     if ($referrerid) {
         require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         AlphaUserPointsHelper::userpoints('sysplgaup_custom', $referrerid, 0, '', $reason, $points);
         AlphaUserPointsHelper::checkRankMedal($referrerid);
     }
     $this->setRedirect('index.php?option=com_alphauserpoints&task=showdetails&cid=' . $referrerid . '&name=' . $name);
     $this->redirect();
 }
开发者ID:q0821,项目名称:esportshop,代码行数:16,代码来源:controller.php


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