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


PHP PhpFox::getUserBy方法代码示例

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


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

示例1: runAchievement

 /**
  * Run a given achievement
  *
  * @param int $iId
  */
 public function runAchievement($iId)
 {
     $aQuery = $this->database()->select('a._table, a.type, a.has_prefix, a.col_user, a.col_operator, a.col_value, a.built_query, a.activity_points, a.title, a.change_user_group, a.moderation_col_name, a.moderation_col_operator, a.moderation_col_value, u.item_id, g.change_id as upgrade_user_group')->from($this->_sTable, 'a')->leftjoin(Phpfox::getT('ko_achievements_user'), 'u', 'u.user_id = ' . Phpfox::getUserId() . ' AND u.achievement_id = a.achieve_id')->leftjoin(Phpfox::getT('ko_achievements_group_change'), 'g', 'g.achieve_id = a.achieve_id AND g.group_id = ' . PhpFox::getUserBy('user_group_id'))->where('a.achieve_id = ' . (int) $iId)->execute('getRow');
     if (count($aQuery) == 0 || isset($aQuery['item_id'])) {
         return false;
     }
     if ($aQuery['type'] == 1) {
         $iCheck = $this->database()->select('COUNT(*)')->from($aQuery['has_prefix'] == 1 ? Phpfox::getT($aQuery['_table']) : $aQuery['_table'])->where($aQuery['col_user'] . ' = ' . Phpfox::getUserId() . ' AND ' . $aQuery['built_query'])->execute('getField');
     } else {
         $this->setUpWhere(Phpfox::getUserId(), $aQuery['col_user'], $aQuery['moderation_col_name'], $aQuery['moderation_col_operator'], $aQuery['moderation_col_value']);
         $iCheck = $this->database()->select('COUNT(*)')->from($aQuery['has_prefix'] == 1 ? Phpfox::getT($aQuery['_table']) : $aQuery['_table'])->execute('getField');
         if ($iCheck > 0) {
             eval('$sIf = $iCheck' . $this->operator($aQuery['col_operator']) . $aQuery['col_value'] . ';');
             if ($sIf === true) {
                 $iCheck = true;
             } else {
                 $iCheck = false;
             }
         }
     }
     if ($iCheck) {
         $iInsert = $this->database()->insert(Phpfox::getT('ko_achievements_user'), array('user_id' => Phpfox::getUserId(), 'achievement_id' => (int) $iId, 'time' => PHPFOX_TIME), true);
         if ($aQuery['change_user_group'] > 0 && isset($aQuery['upgrade_user_group'])) {
             Phpfox::getService('user.process')->updateUserGroup(Phpfox::getUserId(), $aQuery['change_user_group']);
         }
         if ($aQuery['activity_points'] > 0) {
             $this->database()->update(Phpfox::getT('user_activity'), array('activity_achievements' => array('= activity_achievements +', 1), 'activity_total' => array('= activity_total +', 1), 'activity_points' => array('= activity_points +', $aQuery['activity_points'])), 'user_id = ' . Phpfox::getUserId());
         }
         /**
         			 * Depreciated
         			  if( Phpfox::isModule('notification') && Phpfox::getParam('achievements.send_notification') )
         			  {
         			  Phpfox::getService('notification.process')->add('achievements_new', (int) $iId, Phpfox::getUserId());
         			  } */
         if (Phpfox::isModule('feed') && Phpfox::getParam('achievements.on_feed')) {
             Phpfox::getService('feed.process')->add('achievements', $iInsert);
         }
         if (Phpfox::getParam('achievements.send_email')) {
             $oUrl = Phpfox::getLib('url');
             $aFind = array('{urlLogin}', '{urlAchievement}', '{userName}', '{achievementName}');
             $aReplace = array($oUrl->makeUrl('user.login'), $oUrl->makeUrl('achievements'), Phpfox::getUserBy('full_name'), $aQuery['title']);
             $sSubject = str_replace($aFind, $aReplace, Phpfox::getParam('achievements.email_subject'));
             $sMessage = str_replace($aFind, $aReplace, Phpfox::getParam('achievements.email_content'));
             Phpfox::getLib('mail')->to(Phpfox::getUserId())->subject($sSubject)->message($sMessage)->notification('achievements.achievements')->send();
         }
     }
 }
开发者ID:Lovinity,项目名称:EQM,代码行数:52,代码来源:achievements.class.php


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