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


PHP AlphaUserPointsHelper::insertUserPoints方法代码示例

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


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

示例1: userpoints

 public static function userpoints($plugin_function, $referrerid = '', $referraluserpoints = 0, $keyreference = '', $datareference = '', $randompoints = 0, $feedback = false, $force = 0, $frontmessage = '')
 {
     $lang = JFactory::getLanguage();
     $lang->load('com_alphauserpoints', JPATH_SITE);
     // get params definitions
     $params = JComponentHelper::getParams('com_alphauserpoints');
     $allowNegativeAccount = $params->get('allowNegativeAccount', 0);
     $checkReference = 0;
     if ($plugin_function == 'sysplgaup_recommend' && $referrerid != '' && $keyreference != '' && $datareference != '') {
         $force = 1;
     }
     if (!$referraluserpoints) {
         if (!$referrerid) {
             $referrerid = @$_SESSION['referrerid'];
         }
     }
     if (!$referrerid) {
         return;
     }
     if (!AlphaUserPointsHelper::checkExcludeUsers($referrerid)) {
         return;
     }
     $result = AlphaUserPointsHelper::checkRuleEnabled($plugin_function, $force, $referrerid);
     // check reference if not exist
     if ($keyreference != '' && $result) {
         $checkReference = AlphaUserPointsHelper::checkReference($referrerid, $keyreference, $result[0]->id);
     }
     if ($result && !$checkReference) {
         // force specific points -> overwriting rule points or if rule points is 0
         // This points can be negative (example : single rule in backend rule manager for several products on frontend, each products with different prices...)
         if ($randompoints) {
             $result[0]->points = $randompoints;
         }
         // check if limit daily points
         if ($result[0]->points > 0 && $referraluserpoints == 0) {
             $result[0]->points = AlphaUserPointsHelper::checkMaxDailyPoints($referrerid, $result[0]->points, $plugin_function);
         }
         if (AlphaUserPointsHelper::operationIsFeasible($referrerid, $result[0]->points) || $allowNegativeAccount) {
             // check account
             AlphaUserPointsHelper::insertUserPoints($referrerid, $result[0], $referraluserpoints, $keyreference, $datareference, $frontmessage);
             if ($feedback == true) {
                 return true;
             }
         } else {
             // used for negative operation,
             $error = JText::_('AUP_YOUDONOTHAVEENOUGHPOINTSTOPERFORMTHISOPERATION');
             JError::raiseNotice(0, $error);
             if ($feedback == true) {
                 return false;
             } else {
                 return;
             }
         }
     } else {
         return true;
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:57,代码来源:helper.php

示例2: reduceUserpoints

 /**
  * Updates alpha user points
  * 
  * @param $assignpoints int
  * @return void
  */
 function reduceUserpoints($amount_points)
 {
     // reduce number of points for the payment
     $api_AUP = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
     if (file_exists($api_AUP)) {
         require_once $api_AUP;
         // create the rule for Tienda payment if not exists
         $this->checkTiendaPaymentRule();
         $referrerid = $this->getReferreid(JFactory::getUser()->id);
         $jnow = JFactory::getDate();
         $now = $jnow->toMySQL();
         //AlphaUserPointsHelper::newpoints( 'function_name', '', '', '', -$amount_points);
         AlphaUserPointsHelper::insertUserPoints($referrerid, -$amount_points, $rule_expire = '0000-00-00 00:00:00', AlphaUserPointsHelper::getRuleID($this->_element), 0, '', 'Tienda order paid by points');
     }
 }
开发者ID:annggeel,项目名称:tienda,代码行数:21,代码来源:payment_alphauserpoints.php

示例3: reader2author

 public function reader2author($authorid = 0, $author = '', $articleid = 0, $title = '', $url = '')
 {
     $app = JFactory::getApplication();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
     if (!$authorid || !$articleid) {
         return;
     }
     // get referrerid of author
     $referrerUserAuthor = AlphaUserPointsHelper::getAnyUserReferreID($authorid);
     if (!AlphaUserPointsHelper::checkExcludeUsers($referrerUserAuthor)) {
         return;
     }
     $ip = getenv('REMOTE_ADDR');
     $db = JFactory::getDBO();
     $keyreference = $articleid . "|" . $ip;
     $keyreference = AlphaUserPointsHelper::buildKeyreference('sysplgaup_reader2author', $keyreference);
     // check if not already view by active user
     $query = "SELECT `id` FROM #__alpha_userpoints_details WHERE `keyreference`='" . $keyreference . "'";
     $db->setQuery($query);
     $alreadyView = $db->loadResult();
     if (!$alreadyView) {
         $user = JFactory::getUser();
         $jnow = JFactory::getDate();
         $now = $jnow->toSql();
         $authorizedLevels = JAccess::getAuthorisedViewLevels($user->id);
         $query = "SELECT * FROM #__alpha_userpoints_rules WHERE `plugin_function`='sysplgaup_reader2author' AND `published`='1' AND `access` IN (" . implode(",", $authorizedLevels) . ") AND (`rule_expire`>'{$now}' OR `rule_expire`='0000-00-00 00:00:00')";
         $db->setQuery($query);
         $result = $db->loadObjectList();
         if ($result && $referrerUserAuthor) {
             $datareference = '<a href="' . $url . '">' . $title . '</a> (' . $author . ')';
             AlphaUserPointsHelper::insertUserPoints($referrerUserAuthor, $result[0], 0, $keyreference, $datareference);
         }
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:34,代码来源:sysplgaup_reader2author.php


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