當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。