コード例 #1
0
ファイル: mightytouch.php プロジェクト: Tommar/vino2
 /**
  * Sets the karma point for the respective user when certain action is performed.
  *
  * @param	int $userId The user id
  * @param	string $action This action should map with the config's action string.
  */
 public function setKarma($userId, $action)
 {
     $config = EasyBlogHelper::getConfig();
     if (!$config->get('integrations_mighty_karma_' . $action)) {
         return false;
     }
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'api.php';
     if (!JFile::exists($file)) {
         return false;
     }
     require_once $file;
     $points = $config->get('integrations_mighty_karma_' . $action . '_points');
     JSCommunityApi::increaseKarma($userId, $points);
     return true;
 }
コード例 #2
0
ファイル: mightytouch.php プロジェクト: vuchannguyen/dayhoc
 function onAfterVote($poll, $option_id)
 {
     $user =& JFactory::getUser();
     $api = JPATH_ROOT . '/components/com_community/api.php';
     if ($this->params->get('points', '0') == '1' && file_exists($api)) {
         require_once $api;
         JSCommunityApi::increaseKarma($user->id, $this->params->get('points_value', '0'));
     }
     if ($this->params->get('activity', '0') == '1' && file_exists($api)) {
         require_once $api;
         $icon = 'media/acepolls/images/acepolls.png';
         $link = JRoute::_('index.php?option=com_acepolls&view=poll&id=' . $poll->id . ":" . $poll->alias . self::getItemid($poll->id));
         $text = JText::_('COM_ACEPOLLS_ACTIVITY_TEXT') . ' <a href="' . $link . '">' . $poll->title . '</a>';
         $capi = new JSCommunityApi();
         $capi->registerActivity(0, $text, $user->id, $icon, 'user', null, 'com_acepolls', '', 'Polls');
     }
 }
コード例 #3
0
ファイル: functions.php プロジェクト: pguilford/vcomcc
 /**
  * Award points to the user using selected points system. The user id and required parameters should be passed based on points system selected.
  *
  * Parameters array should be an associative array which can include
  * <ul>
  * 	<li>function: the function name used to award points.</li>
  * 	<li>points: points awarded to the user. For jomsocial this has no effect as the points are taken from xml rule.</li>
  * 	<li>reference: the reference string for AUP rule</li>
  * 	<li>info: Brief information about this point.</li>
  * </ul>
  *
  * @param string $system
  * @param int $userid
  * @param array $params
  */
 public static function award_points($system, $userid, $params = array())
 {
     switch ($system) {
         case 'cjblog':
             $api = JPATH_ROOT . DS . 'components' . DS . 'com_cjblog' . DS . 'api.php';
             if (file_exists($api)) {
                 include_once $api;
                 $points = !empty($params['points']) ? $params['points'] : 0;
                 $reference = !empty($params['reference']) ? $params['reference'] : null;
                 $description = !empty($params['info']) ? $params['info'] : null;
                 CjBlogApi::award_points($params['function'], $userid, $points, $reference, $description);
             }
             break;
         case 'jomsocial':
             $api = JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php';
             if (file_exists($api) && !empty($params['function'])) {
                 include_once $api;
                 CuserPoints::assignPoint($params['function'], $userid);
             }
             break;
         case 'aup':
             $api = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             if (file_exists($api) && !empty($params['function']) && isset($params['info'])) {
                 require_once $api;
                 $reference = !empty($params['reference']) ? $params['reference'] : null;
                 $aupid = AlphaUserPointsHelper::getAnyUserReferreID($userid);
                 AlphaUserPointsHelper::newpoints($params['function'], $aupid, $reference, $params['info'], $params['points']);
             }
             break;
         case 'touch':
             $api = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'api.php';
             if (file_exists($api) && !empty($params['points'])) {
                 require_once $api;
                 JSCommunityApi::increaseKarma($userid, $params['points']);
             }
             break;
         case 'easysocial':
             $api = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_easysocial' . DS . 'includes' . DS . 'foundry.php';
             if (file_exists($api)) {
                 require_once $api;
                 Foundry::points()->assign($params['function'], $params['component'], $userid);
             }
             break;
     }
 }
コード例 #4
0
 function awardPoints($userid, $function, $referrence, $info)
 {
     $app =& JFactory::getApplication();
     $cwConfig =& $app->getUserState(SESSION_CONFIG);
     if (strcasecmp($cwConfig[POINTS_SYSTEM], COMPONENT_AUP) == 0) {
         $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         if (file_exists($api_AUP)) {
             require_once $api_AUP;
             $aupid = AlphaUserPointsHelper::getAnyUserReferreID($userid);
             if ($aupid) {
                 switch ($function) {
                     case 1:
                         //New Question
                         AlphaUserPointsHelper::newpoints(AUP_NEW_QUESTION, $aupid, $referrence, $info);
                         break;
                     case 2:
                         // Solved crossword
                         AlphaUserPointsHelper::newpoints(AUP_SOLVE_CROSSWORD, $aupid, $referrence, $info);
                         break;
                 }
             }
         }
     } else {
         if (strcasecmp($cwConfig[POINTS_SYSTEM], COMPONENT_JOMSOCIAL) == 0) {
             include_once JPATH_SITE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'userpoints.php';
             switch ($function) {
                 case 1:
                     //New Question
                     CuserPoints::assignPoint(JSP_NEW_QUESTION, $userid);
                     break;
                 case 2:
                     // New Answer
                     CuserPoints::assignPoint(JSP_SOLVED_CROSSWORD, $userid);
                     break;
             }
         } else {
             if (strcasecmp($cwConfig[POINTS_SYSTEM], COMPONENT_TOUCH) == 0) {
                 $API = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'api.php';
                 if (file_exists($API)) {
                     require_once $API;
                     switch ($function) {
                         case 1:
                             //New Question
                             JSCommunityApi::increaseKarma($userid, $cwConfig[TOUCH_POINTS_NEW_QUESTION]);
                             break;
                         case 2:
                             // New Answer
                             JSCommunityApi::increaseKarma($userid, $cwConfig[TOUCH_POINTS_SOLVED_CROSSWORD]);
                             break;
                     }
                 }
             }
         }
     }
 }