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


PHP CUserPoints::_getActionPoint方法代码示例

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


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

示例1: assignPoint

 /**
  * add points to user based on the action.
  */
 function assignPoint($action, $userId = null)
 {
     //get the rule points
     //must use the JFactory::getUser to get the aid
     $juser =& JFactory::getUser($userId);
     if ($juser->id != 0) {
         $aid = $juser->aid;
         // if the aid is null, means this is not the current logged-in user.
         // so we need to manually get this aid for this user.
         if (is_null($aid)) {
             $aid = 0;
             //defautl to 0
             // Get an ACL object
             $acl =& JFactory::getACL();
             $grp = $acl->getAroGroup($juser->id);
             $group = 'USERS';
             if ($acl->is_group_child_of($grp->name, $group)) {
                 $aid = 1;
                 // Fudge Authors, Editors, Publishers and Super Administrators into the special access group
                 if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
                     $aid = 2;
                 }
             }
         }
         $points = CUserPoints::_getActionPoint($action, $aid);
         $user = CFactory::getUser($userId);
         $points += $user->getKarmaPoint();
         $user->_points = $points;
         $user->save();
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:34,代码来源:userpoints.php

示例2: assignPoint

 /**
  * add points to user based on the action.
  * @param $action
  * @param null $userId
  */
 public static function assignPoint($action, $userId = null)
 {
     //get the rule points
     //must use the JFactory::getUser to get the aid
     $juser = JFactory::getUser($userId);
     //since 4.0, check if this action is published, else return false (boolean)
     $userPointModel = CFactory::getModel('Userpoints');
     $point = $userPointModel->getPointData($action);
     if (!isset($point->published) || !$point->published) {
         return false;
     }
     if ($juser->id != 0) {
         if (!method_exists($juser, 'getAuthorisedViewLevels')) {
             $aid = $juser->aid;
             // if the aid is null, means this is not the current logged-in user.
             // so we need to manually get this aid for this user.
             if (is_null($aid)) {
                 $aid = 0;
                 //defautl to 0
                 // Get an ACL object
                 $acl = JFactory::getACL();
                 $grp = $acl->getAroGroup($juser->id);
                 $group = 'USERS';
                 if ($acl->is_group_child_of($grp->name, $group)) {
                     $aid = 1;
                     // Fudge Authors, Editors, Publishers and Super Administrators into the special access group
                     if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
                         $aid = 2;
                     }
                 }
             }
         } else {
             //joomla 1.6
             $aid = $juser->getAuthorisedViewLevels();
         }
         $points = CUserPoints::_getActionPoint($action, $aid);
         $user = CFactory::getUser($userId);
         $points += $user->getKarmaPoint();
         $user->_points = $points;
         $profile = JTable::getInstance('Profile', 'CTable');
         $profile->load($user->id);
         $user->_thumb = $profile->thumb;
         $user->_avatar = $profile->avatar;
         $user->save();
         //Event trigger
         $appsLib = CAppPlugins::getInstance();
         $appsLib->loadApplications();
         $params = array('action' => $action, 'points' => $points, 'userId' => $user->id);
         $appsLib->triggerEvent('onAfterAssignPoint', $params);
         return true;
     }
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:57,代码来源:userpoints.php


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