本文整理汇总了PHP中AlphaUserPointsHelper类的典型用法代码示例。如果您正苦于以下问题:PHP AlphaUserPointsHelper类的具体用法?PHP AlphaUserPointsHelper怎么用?PHP AlphaUserPointsHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AlphaUserPointsHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assign
public function assign($rule, $userId, $title)
{
if (!$this->exists || !isset($this->rules[$rule])) {
return false;
}
JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT);
// TODO: Fixed strict standard issue.
$aup = new AlphaUserPointsHelper();
$id = $aup->getAnyUserReferreID($userId);
//$id = AlphaUserPointsHelper::getAnyUserReferreID( $userId );
$rule = $this->rules[$rule];
$aup->newpoints('plgaup_easydiscuss_' . strtolower($rule), $id, '', JText::sprintf('COM_EASYDISCUSS_AUP_' . strtoupper($rule), $title));
}
示例2: getList
public static function getList($params)
{
$db = JFactory::getDBO();
$user = JFactory::getUser();
$count = intval($params->get('count', 5));
$usrname = trim($params->get('usrname', 'name'));
$allmembers = intval($params->get('showallmembers', 1));
$nullDate = $db->getNullDate();
$date = JFactory::getDate();
$now = $date->toSql();
$currentuser = $user->id;
$selecteduser = "";
if ($currentuser && !$allmembers) {
$selecteduser = "AND u.id='" . $currentuser . "' ";
}
$displayactivity = '';
require_once JPATH_ROOT . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
$version = AlphaUserPointsHelper::getAupVersion();
if (version_compare($version, '2.0.2', '>=')) {
$displayactivity = " AND r.displayactivity='1'";
}
$query = "SELECT a.insert_date, a.referreid, aup.userid, a.points AS last_points, a.datareference, u." . $usrname . " AS usrname, r.rule_name, r.plugin_function, r.category" . " FROM #__alpha_userpoints_details AS a, #__alpha_userpoints AS aup, #__users AS u, #__alpha_userpoints_rules AS r" . " WHERE aup.referreid=a.referreid " . $selecteduser . "AND aup.userid=u.id AND aup.published='1' AND a.approved='1' AND (a.expire_date>='" . $now . "' OR a.expire_date='0000-00-00 00:00:00') AND r.id=a.rule" . $displayactivity . " ORDER BY a.insert_date DESC";
$db->setQuery($query, 0, $count);
$rows = $db->loadObjectList();
return $rows;
}
示例3: remove
function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
// @task: Check for acl rules.
$this->checkAccess('comment');
$comments = JRequest::getVar('cid', '', 'POST');
$message = '';
$type = 'message';
if (empty($comments)) {
$message = JText::_('Invalid comment id');
$type = 'error';
} else {
$table = EasyBlogHelper::getTable('Comment', 'Table');
foreach ($comments as $comment) {
$table->load($comment);
// AlphaUserPoints
// since 1.2
if (!empty($table->created_by) && EasyBlogHelper::isAUPEnabled()) {
$aupid = AlphaUserPointsHelper::getAnyUserReferreID($table->created_by);
AlphaUserPointsHelper::newpoints('plgaup_easyblog_delete_comment', $aupid, '', JText::_('COM_EASYBLOG_AUP_COMMENT_DELETED'));
}
if (!$table->delete()) {
$message = JText::_('COM_EASYBLOG_COMMENTS_COMMENT_REMOVE_ERROR');
$type = 'error';
$this->setRedirect('index.php?option=com_easyblog&view=comments', $message, $type);
return;
}
$message = JText::_('COM_EASYBLOG_COMMENTS_COMMENT_REMOVED');
}
}
$this->setRedirect('index.php?option=com_easyblog&view=comments', $message, $type);
}
示例4: getPoint
function getPoint($user_id)
{
require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
$profile = AlphaUserPointsHelper::getUserInfo('', $user_id);
$point = $profile->points;
return $point;
}
示例5: save
function save()
{
$model = $this->getModel('muzeededi');
$db = $model->connectMuzeeli();
$dedicace = JRequest::getVar('dedicace', '', '', 'string');
$params =& JComponentHelper::getParams('com_muzeededi');
$moderer_site = $params->get('moderer_site');
$moderer = $moderer_site == "yes" ? "0" : "1";
$q_dedicace = $db->Quote($dedicace);
$query = "INSERT INTO #__muzeededi (id,dedicace,moderer) VALUES ('',{$q_dedicace},'{$moderer}')";
$test = $db->SetQuery($query);
$test2 = $db->query();
$msg = "";
if ($test2 === true) {
//point alphauserpoints
$api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
if (file_exists($api_AUP)) {
require_once $api_AUP;
AlphaUserPointsHelper::newpoints('plgaup_muzeededi', '', '', 'Dédicace');
}
//fin alphauserpoints
if ($moderer == "0") {
$msg = JTEXT::_("COM_MUZEEDEDI_DEDICACE_ENREGISTREE");
} else {
$texte = $model->getDedicaces($db);
$creer_txt = $model->creerFichier($texte);
$msg = JTEXT::_("COM_MUZEEDEDI_DEDICACE_PUBLIE");
}
$mail = $this->alerteMail($dedicace, $moderer);
} else {
$msg = JTEXT::_("COM_MUZEEDEDI_DEDICACE_ERREUR");
}
$link = 'index.php?option=com_muzeededi';
$this->setRedirect($link, $msg);
}
示例6: sendNotificationOnUpdateRank
private function sendNotificationOnUpdateRank($userinfo, $result)
{
$app = JFactory::getApplication();
$lang = JFactory::getLanguage();
$lang->load('com_alphauserpoints', JPATH_SITE);
jimport('joomla.mail.helper');
require_once JPATH_ROOT . '/components/com_alphauserpoints/helper.php';
// get params definitions
$params = JComponentHelper::getParams('com_alphauserpoints');
$jsNotification = $params->get('jsNotification', 0);
$jsNotificationAdmin = $params->get('fromIdUddeim', 0);
$SiteName = $app->getCfg('sitename');
$MailFrom = $app->getCfg('mailfrom');
$FromName = $app->getCfg('fromname');
$sef = $app->getCfg('sef');
$email = $userinfo->email;
$subject = $result->emailsubject;
$body = $result->emailbody;
$formatMail = $result->emailformat;
$bcc2admin = $result->bcc2admin;
$subject = str_replace('{username}', $userinfo->username, $subject);
$subject = str_replace('{points}', AlphaUserPointsHelper::getFPoints($userinfo->points), $subject);
$body = str_replace('{username}', $userinfo->username, $body);
$body = str_replace('{points}', AlphaUserPointsHelper::getFPoints($userinfo->points), $body);
$subject = JMailHelper::cleanSubject($subject);
if (!$jsNotification) {
$mailer = JFactory::getMailer();
$mailer->setSender(array($MailFrom, $FromName));
$mailer->setSubject($subject);
$mailer->isHTML((bool) $formatMail);
$mailer->CharSet = "utf-8";
$mailer->setBody($body);
$mailer->addRecipient($email);
if ($bcc2admin) {
// get all users allowed to receive e-mail system
$query = "SELECT email" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
$db->setQuery($query);
$rowsAdmins = $db->loadObjectList();
foreach ($rowsAdmins as $rowsAdmin) {
$mailer->addBCC($rowsAdmin->email);
}
}
$send = $mailer->Send();
} else {
require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
$params = new CParameter('');
CNotificationLibrary::add('system_messaging', $jsNotificationAdmin, $userinfo->id, $subject, $body, '', $params);
if ($bcc2admin) {
// get all users allowed to receive e-mail system
$query = "SELECT id" . " FROM #__users" . " WHERE sendEmail='1' AND block='0'";
$db->setQuery($query);
$rowsAdmins = $db->loadObjectList();
foreach ($rowsAdmins as $rowsAdmin) {
$mailer->addBCC($rowsAdmin->id);
CNotificationLibrary::add('system_messaging', $userinfo->id, $rowsAdmin->id, $subject, $body, '', $params);
}
}
}
}
示例7: getDisplayTab
function getDisplayTab($tab,$user,$ui)
{
$params=$this->params;
global $_CB_framework,$_CB_database;
$livesite = JURI::base();
JPlugin::loadLanguage( 'com_alphauserpoints', JPATH_SITE );
$tableclass = $params->get('tableclass', 1);
$count_activity = $params->get('count_activity', 20);
$return ="";
$api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
if ( file_exists($api_AUP)) {
require_once ($api_AUP);
$listActivity = AlphaUserPointsHelper::getListActivity('all', $user->id, $count_activity);
}
if(count($listActivity) >0) {
$return .='<table width="95%" cellspacing="0" border="0">';
$return .= '<tr class=\'sectiontableheader\'><th>';
$return .='</th><th width="20%">';
$return .= JText::_( 'AUP_DATE' );
$return .='</th><th width="20%">';
$return .= JText::_( 'AUP_ACTION' );
$return .='</th><th width="6%">';
$return .= JText::_( 'AUP_POINTS_UPPER' );
$return .='</th><th>';
$return .= JText::_( 'AUP_DETAIL' );
$return .='</th></tr>';
$i=0;
foreach ( $listActivity as $activity ) {
$i++;
if($i>2) $i=1;
$return .='<tr';
if($tableclass) $return .=' class="sectiontableentry'.$i.'"';
$return .=' ><td>';
$icon = ( $activity->category!='' ) ? '<img src="'.JURI::base(true).DS.'components'.DS.'com_alphauserpoints'.DS.'assets'.DS.'images'.DS.'categories'.DS.$activity->category.'.gif" alt="" />' : '';
$return .= $icon;
$return .='</td><td>';
$return .= '<span style="color:#333;">'.JHTML::_('date', $activity->insert_date, JText::_('d.m.Y')).'</span> <span style="color:#777;font-style:oblique;">'.JHTML::_('date', $activity->insert_date, JText::_('H:i:s')).'</span>';
$color = $activity->points>0 ? "#009900" : ($activity->points<0 ? "#ff0000" : ($activity->points==0.00 ? "#777" : "#777"));
$return .='</td><td style="color:'. $color .';">';
$return .= JText::_( $activity->rule_name );
$return .='</td><td style="text-align: right; color:'. $color .';">';
$return .= $activity->points;
$return .=' </td><td style="color:#777;">';
$return .= $activity->datareference;
$return .='</td></tr>';
}
$return .='</table>';
$return .= '<br />' . JHTML::_('date', 'now', JText::_('l d.m.Y H:i'));
} else $return .='<div align="center"><p>'.JText::_( 'AUP_THIS_INFORMATION_HAS_NOT_BEEN_PROVIDED' ).'</p></div>';
return $return;
}
示例8: checkcoupon
public static function checkcoupon($params, $coupon)
{
$app = JFactory::getApplication();
// check if user is logged in
$user = JFactory::getUser();
if (!$user->id) {
echo "<script> alert('" . JText::_('MODAUP_CP_YOU_MUST_BE_LOGGED') . "'); </script>";
return;
}
// insert API AlphaUserPoint
$api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
if (file_exists($api_AUP)) {
require_once $api_AUP;
$db = JFactory::getDBO();
$nullDate = $db->getNullDate();
$date = JFactory::getDate();
$now = $date->toSql();
$query = "SELECT * FROM #__alpha_userpoints_coupons WHERE `couponcode`='{$coupon}' AND (`expires`>='{$now}' OR `expires`='0000-00-00 00:00:00')";
$db->setQuery($query);
$result = $db->loadObjectList();
if ($result) {
$resultCouponExist = 0;
// active user
$referrerid = @$_SESSION['referrerid'];
// check if public or private coupon
if (!$result[0]->public) {
// private -> usable once per one user
$query = "SELECT count(*) FROM #__alpha_userpoints_details WHERE `keyreference`='{$coupon}'";
$db->setQuery($query);
$resultCouponExist = $db->loadResult();
if (!$resultCouponExist) {
// insert points
AlphaUserPointsHelper::newpoints('sysplgaup_couponpointscodes', $referrerid, $result[0]->couponcode, $result[0]->description, $result[0]->points);
} else {
$app->enqueueMessage(JText::_('MODAUP_CP_THIS_COUPON_WAS_ALREADY_USED'));
}
} elseif ($result[0]->public) {
// public -> usable once per all users
$keyreference = $coupon . "##" . $user->id;
$query = "SELECT count(*) FROM #__alpha_userpoints_details WHERE `keyreference`='{$keyreference}'";
$db->setQuery($query);
$resultCouponExist = $db->loadResult();
if (!$resultCouponExist) {
// insert points
AlphaUserPointsHelper::newpoints('sysplgaup_couponpointscodes', $referrerid, $keyreference, $result[0]->description, $result[0]->points);
} else {
$app->enqueueMessage(JText::_('MODAUP_CP_THIS_COUPON_WAS_ALREADY_USED'));
}
}
} else {
$app->enqueueMessage(JText::_('MODAUP_CP_PLEASE_CHECK_YOUR_COUPON'));
return;
}
}
}
示例9: awardPoints
function awardPoints($userid, $function, $referrence, $info)
{
$app =& JFactory::getApplication();
$cwConfig =& CrosswordsHelper::get_configuration();
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;
}
}
}
}
}
}
示例10: getProfileURL
public function getProfileURL($user, $task = '', $xhtml = true) {
if ($user == 0)
return false;
$user = KunenaFactory::getUser ( $user );
$my = JFactory::getUser ();
if ($user === false)
return false;
$userid = $my->id != $user->userid ? '&userid=' . AlphaUserPointsHelper::getAnyUserReferreID ( $user->userid ) : '';
$AUP_itemid = AlphaUserPointsHelper::getItemidAupProfil ();
return JRoute::_ ( 'index.php?option=com_alphauserpoints&view=account' . $userid . '&Itemid=' . $AUP_itemid, $xhtml );
}
示例11: onAfterVote
function onAfterVote($poll, $option_id)
{
$user =& JFactory::getUser();
$aup = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
if ($this->params->get('points', '0') == '1' && file_exists($aup)) {
require_once $aup;
$aup_id = AlphaUserPointsHelper::getAnyUserReferreID($user->id);
if ($aup_id) {
AlphaUserPointsHelper::newpoints('sysplgaup_votepoll', $aup_id, '', JText::_('COM_MIJOPOLLS_CAST_VOTE_AUP') . ' ' . $poll->id, $this->params->get('points_value', '0'), true);
}
}
}
示例12: awardPoints
public function awardPoints($userId, $name, $args)
{
require_once $this->_componentFile;
$key = $args->get('key', '');
$name = str_replace(".", "_", $name);
$name = 'plgaup_jfbconnect_' . $name;
$keyreference = AlphaUserPointsHelper::buildKeyreference($name, $key);
// get the current user's Referrerid always, for now.
$profile = AlphaUserPointsHelper::getUserInfo('', $userId);
$referrerId = $profile->referreid;
$return = AlphaUserPointsHelper::newpoints($name, $referrerId, $keyreference);
}
示例13: onAfterProcess
/**
* Run right at the end of the form processing
* form needs to be set to record in database for this to hook to be called
*
* @throws Exception
*
* @return bool
*/
public function onAfterProcess()
{
$params = $this->getParams();
$api_AUP = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
if (JFile::exists($api_AUP)) {
$w = new FabrikWorker();
$this->data = $this->getProcessData();
require_once $api_AUP;
$aup = new AlphaUserPointsHelper();
// Define which user will receive the points.
$userId = $params->get('user_id', '');
$userId = (int) $w->parseMessageForPlaceholder($userId, $this->data, false);
$aupId = $aup->getAnyUserReferreID($userId);
// Replace these if you want to show a specific reference for the attributed points - doesn't seem to effect anything
$keyReference = '';
// Shown in the user details page - description of what the point is for
$dataReference = $params->get('data_reference', '');
$dataReference = $w->parseMessageForPlaceholder($dataReference, $this->data, false);
// Override the plugin default points
$randomPoints = $params->get('random_points', 0);
if ($params->get('random_points_eval', '0') == '1') {
if (!empty($randomPoints)) {
$randomPoints = $w->parseMessageForPlaceholder($randomPoints, $this->data, false);
$randomPoints = @eval($randomPoints);
FabrikWorker::logEval($randomPoints, 'Caught exception on eval in aup plugin : %s');
}
$randomPoints = (double) $randomPoints;
} else {
$randomPoints = (double) $w->parseMessageForPlaceholder($randomPoints, $this->data, false);
}
// If set to be greater than $randompoints then this is the # of points assigned (not sure when this would be used - commenting out for now)
$referralUserPoints = 0;
$aupPlugin = $params->get('aup_plugin', 'plgaup_fabrik');
$aupPlugin = $w->parseMessageForPlaceholder($aupPlugin, $this->data, false);
if (!$aup->checkRuleEnabled($aupPlugin, 0, $aupId)) {
throw new Exception('Alpha User Points plugin not published');
}
$aup->userpoints($aupPlugin, $aupId, $referralUserPoints, $keyReference, $dataReference, $randomPoints);
}
}
示例14: getLink
public function getLink($user, $class = '', $sizex = 90, $sizey = 90)
{
$user = KunenaFactory::getUser($user);
$size = $this->getSize($sizex, $sizey);
if ($size->y > 100) {
$avatar = AlphaUserPointsHelper::getAupAvatar($user->userid, 0, 100 * (double) $size->x / (double) $size->y, '100');
} else {
$avatar = AlphaUserPointsHelper::getAupAvatar($user->userid, 0, $size->x, $size->y);
}
if (!$avatar) {
$avatar = '<img border="0" width="100" height="100" alt="" src="' . JUri::root() . 'components/com_alphauserpoints/assets/images/avatars/generic_gravatar_grey.png">';
}
return $avatar;
}
示例15: getLink
public function getLink($user, $class='', $sizex=90, $sizey=90)
{
$user = KunenaFactory::getUser($user);
$size = $this->getSize($sizex, $sizey);
if ($size->y > 100) {
$avatar = AlphaUserPointsHelper::getAupAvatar ( $user->userid, 0, 100*(float)$size->x/(float)$size->y, '100' );
} else {
$avatar = AlphaUserPointsHelper::getAupAvatar ( $user->userid, 0, $size->x, $size->y );
}
if (!$avatar) {
// FIXME: need a better way to do this
$avatar = '<img border="0" width="100" height="100" alt="" src="http://kunena16cb/components/com_alphauserpoints/assets/images/avatars/generic_gravatar_grey.gif">';
}
return $avatar;
}