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


PHP AlphaUserPointsHelper::getUserID方法代码示例

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


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

示例1: checkRuleEnabled

 public static function checkRuleEnabled($plugin_function = '', $force = 0, $referrerid = '')
 {
     if (!$plugin_function) {
         return false;
     }
     $user = JFactory::getUser();
     $jnow = JFactory::getDate();
     $now = $jnow->toSql();
     $userID = 0;
     $accessrule = "";
     if (!$referrerid) {
         $referrerid = @$_SESSION['referrerid'];
         if (!$referrerid) {
             $userID = $user->id;
         } else {
             $userID = AlphaUserPointsHelper::getUserID($referrerid);
         }
     } else {
         $userID = AlphaUserPointsHelper::getUserID($referrerid);
     }
     $authorizedLevels = JAccess::getAuthorisedViewLevels($userID);
     switch ($plugin_function) {
         case 'sysplgaup_referralpoints':
             // assign to all referral users level
         // assign to all referral users level
         case 'sysplgaup_emailnotification':
         case 'sysplgaup_winnernotification':
         case 'sysplgaup_newregistered':
         case 'sysplgaup_invitewithsuccess':
         case 'sysplgaup_archive':
         case 'sysplgaup_changelevel1':
         case 'sysplgaup_changelevel2':
         case 'sysplgaup_changelevel3':
             $accessrule = "";
             break;
         default:
             $accessrule = "AND `access` IN (" . implode(",", $authorizedLevels) . ")";
             break;
     }
     if ($force) {
         $accessrule = "";
     }
     $db = JFactory::getDBO();
     $query = "SELECT * FROM #__alpha_userpoints_rules WHERE `plugin_function`='{$plugin_function}' AND `published`='1' {$accessrule} AND (`rule_expire`>'{$now}' OR `rule_expire`='0000-00-00 00:00:00')";
     $db->setQuery($query);
     $result = $db->loadObjectList();
     return $result;
 }
开发者ID:q0821,项目名称:esportshop,代码行数:48,代码来源:helper.php

示例2: onContentPrepare

 public function onContentPrepare($context, &$article, &$params, $limitstart)
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $print = JFactory::getApplication()->input->get('print', '');
     $format = JFactory::getApplication()->input->get('format', '');
     $aupraffleid = JFactory::getApplication()->input->get('aupraffleid', 0, 'int');
     $aupraffleuserid = JFactory::getApplication()->input->get('aupraffleuserid', 0, 'int');
     $auprafflepoints = JFactory::getApplication()->input->get('auprafflepoints', 0, 'FLOAT');
     $auprafflepointsremove = JFactory::getApplication()->input->get('auprafflepointsremove', 0, 'FLOAT');
     $multipleentries = JFactory::getApplication()->input->get('multipleentries', 0, 'int');
     // ---
     // if referral draw system
     $referredraw2 = JFactory::getApplication()->input->get('referredraw2', 0, 'int');
     $draw2 = JFactory::getApplication()->input->get('draw2', 0, 'int');
     //$showlink					= JFactory::getApplication()->input->get('showlink', 0, 'int');
     // ---
     $uri = JURI::getInstance();
     @$uri->delVar('referrer');
     @$uri->delVar('draw');
     $url = $uri->toString();
     $inscription = 0;
     $pointstoparticipate = 0;
     $removepointstoparticipate = 0;
     if ($print || $format == 'pdf') {
         $article->text = preg_replace(" |{AUP::RAFFLE=(.*)}| ", "", $article->text);
         return;
     }
     if ($app->isAdmin()) {
         return;
     }
     $lang = JFactory::getLanguage();
     $lang->load('com_alphauserpoints', JPATH_SITE);
     $jnow = JFactory::getDate();
     $now = $jnow->toSql();
     $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     require_once $api_AUP;
     if (preg_match('#{AUP::RAFFLE=(.*)}#Uis', $article->text, $m) && !$aupraffleid) {
         $raffleid = $m[1];
         if ($raffleid == 'ID') {
             // default sample
             return;
         }
         $query = "SELECT * FROM #__alpha_userpoints_raffle WHERE `id`='{$raffleid}' AND `published`='1'";
         $db->setQuery($query);
         $result = $db->loadObjectList();
         if ($result) {
             $inscription = $result[0]->inscription;
             $pointstoparticipate = $result[0]->pointstoparticipate;
             $removepointstoparticipate = $result[0]->removepointstoparticipate;
             $multipleentries = $result[0]->multipleentries;
             $alreadyProceeded = $result[0]->winner1;
             $limitdate = $result[0]->raffledate;
             if ($now > $limitdate) {
                 $alreadyProceeded = 1;
             }
         }
         // You can choose number subscriptions members
         //$query = "SELECT COUNT(DISTINCT userid) FROM #__alpha_userpoints_raffle_inscriptions WHERE `raffleid`='$raffleid'";
         // You can choose number of tickets sold!
         $query = "SELECT COUNT(id) FROM #__alpha_userpoints_raffle_inscriptions WHERE `raffleid`='{$raffleid}'";
         $db->setQuery($query);
         $num_subscription = $db->loadResult();
         $article->text .= "\n<p>" . JText::_('AUP_NUMBER_SUBSCRIPTION_CURRENT_RAFFLE') . " " . $num_subscription . "</p>\n";
         if ($inscription && $user->id && $alreadyProceeded == 0) {
             if (!$multipleentries) {
                 $query = "SELECT userid FROM #__alpha_userpoints_raffle_inscriptions WHERE `userid`='{$user->id}' AND `raffleid`='{$raffleid}'";
                 $db->setQuery($query);
                 $userid = $db->loadResult();
             } else {
                 $userid = 0;
             }
             if (!$userid) {
                 $referredraw = '';
                 $draw = 0;
                 if (isset($_COOKIE['referredraw'])) {
                     $referredraw = $_COOKIE['referredraw'];
                     $referredraw = AlphaUserPointsHelper::getUserID($referredraw);
                 }
                 if (isset($_COOKIE['draw'])) {
                     $draw = $_COOKIE['draw'];
                 }
                 $registrationForm = "\n<form action=\"{$url}\" method=\"post\" name=\"RaffleForm\">\n" . "<input type=\"hidden\" name=\"aupraffleid\" id=\"aupraffleid\" value=\"" . $raffleid . "\" />\n" . "<input type=\"hidden\" name=\"aupraffleuserid\" id=\"aupraffleuserid\" value=\"" . $user->id . "\" />\n" . "<input type=\"hidden\" name=\"auprafflepoints\" id=\"auprafflepoints\" value=\"" . $pointstoparticipate . "\" />\n" . "<input type=\"hidden\" name=\"auprafflepointsremove\" id=\"auprafflepointsremove\" value=\"" . $removepointstoparticipate . "\" />\n" . "<input type=\"hidden\" name=\"multipleentries\" id=\"multipleentries\" value=\"" . $multipleentries . "\" />\n" . "<input type=\"hidden\" name=\"referredraw2\" id=\"referredraw2\" value=\"" . $referredraw . "\" />\n" . "<input type=\"hidden\" name=\"draw2\" id=\"draw2\" value=\"" . $draw . "\" />\n" . "<input class=\"button\" type=\"submit\" name=\"Submit\" value=\"" . JText::_('AUP_SIGNUP_FOR_THIS_RAFFLE_NOW') . "\" />\n" . "</form>\n";
                 if ($pointstoparticipate) {
                     $referreid = AlphaUserPointsHelper::getAnyUserReferreID($user->id);
                     $currentpoints = AlphaUserPointsHelper::getCurrentTotalPoints($referreid);
                     if ($currentpoints >= $pointstoparticipate) {
                         $article->text .= $registrationForm;
                     } else {
                         $article->text .= "<p>" . JText::_('AUP_YOUDONOTHAVEENOUGHPOINTSTOPERFORMTHISOPERATION') . "</p>";
                     }
                 } else {
                     $article->text .= $registrationForm;
                 }
             } else {
                 $article->text .= "<p>" . JText::_('AUP_ALREADY_REGISTERED_FOR_THIS_RAFFLE') . "</p>";
             }
         } elseif ($inscription && $user->id && $alreadyProceeded > 0) {
             $article->text .= "<p>" . JText::_('AUP_DRAW_HAS_BEEN_MADE_YOU_CANT_REGISTER') . "</p>";
//.........这里部分代码省略.........
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:sysplgaup_raffle.php


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