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


PHP AlphaUserPointsHelper::sendnotification方法代码示例

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


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

示例1: checkChangeLevel


//.........这里部分代码省略.........
         $checkAlreadyDone3 = explode(',', $resultChangeLevel3[0]->exclude_items);
     }
     $userid = AlphaUserPointsHelper::getUserID($referrerid);
     // get actual group fot this user
     jimport('joomla.user.helper');
     $authorizedLevels = JAccess::getAuthorisedViewLevels($userid);
     $result = array_keys(JUserHelper::getUserGroups($userid));
     $actualgroup = end($result);
     if ($resultChangeLevel1 && $newtotal >= $resultChangeLevel1[0]->points2 && !in_array(intval($resultChangeLevel1[0]->content_items), $authorizedLevels) && !in_array($userid, $checkAlreadyDone1)) {
         // delete old group
         $query = "DELETE FROM `#__user_usergroup_map` WHERE `user_id`='{$userid}'";
         $db->setQuery($query);
         $db->query();
         JUserHelper::addUserToGroup($userid, intval($resultChangeLevel1[0]->content_items));
         $user = JUser::getInstance((int) $userid);
         $ok = 1;
         $resultChangeLevel = $resultChangeLevel1;
         $result = JUserHelper::getUserGroups($userid);
         $actualnamegroup = end($result);
         // insert done for this user in this rule
         if ($resultChangeLevel1[0]->exclude_items != '') {
             $insertUserId = $resultChangeLevel1[0]->exclude_items . ',' . $userid;
         } else {
             $insertUserId = $userid;
         }
         $row = JTable::getInstance('rules');
         $row->load(intval($resultChangeLevel1[0]->id));
         $row->exclude_items = $insertUserId;
         $db->updateObject('#__alpha_userpoints_rules', $row, 'id');
     }
     if ($resultChangeLevel2 && $newtotal >= $resultChangeLevel2[0]->points2 && !in_array(intval($resultChangeLevel2[0]->content_items), $authorizedLevels) && !in_array($userid, $checkAlreadyDone2)) {
         $query = "DELETE FROM `#__user_usergroup_map` WHERE `user_id`='{$userid}'";
         $db->setQuery($query);
         $db->query();
         JUserHelper::addUserToGroup($userid, intval($resultChangeLevel2[0]->content_items));
         $user = JUser::getInstance((int) $userid);
         $ok = 1;
         $resultChangeLevel = $resultChangeLevel2;
         $result = JUserHelper::getUserGroups($userid);
         $actualnamegroup = end($result);
         $row = JTable::getInstance('rules');
         $row->load(intval($resultChangeLevel2[0]->id));
         $row->exclude_items = $insertUserId;
         $db->updateObject('#__alpha_userpoints_rules', $row, 'id');
     }
     if ($resultChangeLevel3 && $newtotal >= $resultChangeLevel3[0]->points2 && !in_array(intval($resultChangeLevel3[0]->content_items), $authorizedLevels) && !in_array($userid, $checkAlreadyDone3)) {
         $query = "DELETE FROM `#__user_usergroup_map` WHERE `user_id`='{$userid}'";
         $db->setQuery($query);
         $db->query();
         JUserHelper::addUserToGroup($userid, intval($resultChangeLevel3[0]->content_items));
         $user = JUser::getInstance((int) $userid);
         $ok = 1;
         $resultChangeLevel = $resultChangeLevel3;
         $result = JUserHelper::getUserGroups($userid);
         $actualnamegroup = end($result);
         $row = JTable::getInstance('rules');
         $row->load(intval($resultChangeLevel3[0]->id));
         $row->exclude_items = $insertUserId;
         $db->updateObject('#__alpha_userpoints_rules', $row, 'id');
     }
     if ($ok) {
         // refresh session if user online
         $temp = JFactory::getUser((int) $userid);
         $temp->groups = $user->groups;
         $temp = JFactory::getUser((int) $userid);
         if ($temp->id == $userid) {
             $temp->groups = $user->groups;
         }
     }
     // show message only for current user and if frontend site
     if ($referrerid == @$_SESSION['referrerid'] && $app->isSite() && $ok) {
         // display message for the current user
         if ($resultChangeLevel[0]->displaymsg && $resultChangeLevel[0]->msg != '') {
             $msg = str_replace('{username}', $user->username, $resultChangeLevel[0]->msg);
             $msg = str_replace('{points}', AlphaUserPointsHelper::getFPoints($resultChangeLevel[0]->points), $msg);
             $msg = str_replace('{newtotal}', AlphaUserPointsHelper::getFPoints($newtotal), $msg);
             AlphaUserPointsHelper::displayMessageSystem($msg);
         } elseif ($resultChangeLevel[0]->displaymsg && $resultChangeLevel[0]->msg == '') {
             AlphaUserPointsHelper::displayMessageSystem(sprintf(JText::_('AUP_MSG_YOUHAVENEWUSERRIGHTS'), AlphaUserPointsHelper::getFPoints($resultChangeLevel[0]->points2), $actualnamegroup));
         }
     }
     if ($ok) {
         // insert this new activity in database
         $datareference = sprintf(JText::_('AUP_DESCRIPTIONACTIVITYONCHANGELEVEL'), AlphaUserPointsHelper::getFPoints($resultChangeLevel[0]->points2), $actualnamegroup);
         //AlphaUserPointsHelper::insertUserPoints( $referrerid, $resultChangeLevel[0], 0, '', $datareference );
         //Send notification
         if ($resultChangeLevel[0]->notification) {
             AlphaUserPointsHelper::sendnotification($referrerid, $resultChangeLevel[0]->points2, $newtotal, $resultChangeLevel[0]);
             // load external plugins
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('alphauserpoints');
             $rule_name = JText::_($resultChangeLevel[0]->rule_name);
             $results = $dispatcher->trigger('onSendNotificationAlphaUserPoints', array(&$resultChangeLevel[0], $rule_name, $resultChangeLevel[0]->points2, $newtotal, $referrerid, $userid));
         }
         // load external plugins
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('alphauserpoints');
         $results = $dispatcher->trigger('onChangeLevelAlphaUserPoints', array(&$resultChangeLevel[0], $actualnamegroup, $userid, $referrerid));
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:101,代码来源:helper.php

示例2: onUserAfterSave

 public function onUserAfterSave($user, $isnew, $succes, $msg)
 {
     if ($isnew) {
         $app = JFactory::getApplication();
         $lang = JFactory::getLanguage();
         $lang->load('com_alphauserpoints', JPATH_SITE);
         $jnow = JFactory::getDate();
         $now = $jnow->toSql();
         require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         // get params definitions
         $params = JComponentHelper::getParams('com_alphauserpoints');
         $prefixSelfRegister = $params->get('prefix_selfregister');
         $prefixReferralRegister = $params->get('prefix_referralregister');
         $referrerid = trim(@$_SESSION['referrerid']);
         unset($_SESSION['referrerid']);
         $db = JFactory::getDBO();
         $query = "SELECT * FROM #__alpha_userpoints_rules WHERE `plugin_function`='sysplgaup_newregistered' AND `published`='1'";
         $db->setQuery($query);
         $result = $db->loadObjectList();
         $prefixNewReferreid = $referrerid != '' ? strtoupper($prefixReferralRegister) : strtoupper($prefixSelfRegister);
         // if rule enabled
         if ($result) {
             if (!$params->get('referralIDtype')) {
                 $newreferreid = strtoupper(uniqid($prefixNewReferreid, false));
             } else {
                 $newreferreid = $prefixNewReferreid . strtoupper($user['username']);
                 $newreferreid = str_replace(' ', '-', $newreferreid);
                 $newreferreid = str_replace(',', '-', $newreferreid);
                 $newreferreid = str_replace("'", "-", $newreferreid);
             }
             JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'tables');
             $row = JTable::getInstance('userspoints');
             // insert this new user into alphauserpoints table
             $row->id = NULL;
             $row->userid = $user['id'];
             $row->referreid = $newreferreid;
             $row->points = $result[0]->points;
             $row->max_points = 0;
             $row->last_update = $now;
             $row->referraluser = $referrerid;
             $row->published = 1;
             $row->shareinfos = 1;
             if (isset($user['profile']) && count($user['profile'])) {
                 foreach ($user['profile'] as $k => $v) {
                     $value = str_replace('"', '', $v);
                     $row = $this->checkProfileField($k, $row, $value);
                 }
             }
             if (!$row->store()) {
                 JError::raiseError(500, $row->getError());
             }
             // save new points into alphauserpoints table details
             $row2 = JTable::getInstance('userspointsdetails');
             $row2->id = NULL;
             $row2->referreid = $newreferreid;
             $row2->points = $result[0]->points;
             $row2->insert_date = $now;
             $row2->expire_date = $result[0]->rule_expire;
             $row2->status = $result[0]->autoapproved;
             $row2->rule = $result[0]->id;
             $row2->approved = $result[0]->autoapproved;
             $row2->datareference = JText::_('AUP_WELCOME');
             if (!$row2->store()) {
                 JError::raiseError(500, $row2->getError());
             }
             // frontend message
             if ($result[0]->displaymsg) {
                 $msg = str_replace('{username}', $user['username'], $result[0]->msg);
                 if ($msg != '') {
                     $app->enqueueMessage(str_replace('{points}', AlphaUserPointsHelper::getFPoints($result[0]->points), JText::_($msg)));
                 } else {
                     $app->enqueueMessage(sprintf(JText::_('AUP_CONGRATULATION'), $result[0]->points));
                 }
             }
             // send notification
             if ($result[0]->notification) {
                 AlphaUserPointsHelper::sendnotification($newreferreid, $result[0]->points, $result[0]->points, $result[0], 1);
             }
             if ($referrerid) {
                 $data = htmlspecialchars($user['name'], ENT_QUOTES, 'UTF-8') . " (" . $user['username'] . ") ";
                 $data = sprintf(JText::_('AUP_X_HASJOINEDTHEWEBSITE'), $data);
                 $this->sysplgaup_invitewithsuccess($referrerid, $data);
             }
             return true;
         } else {
             return false;
         }
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:89,代码来源:sysplgaup_newregistered.php


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