本文整理汇总了PHP中GWF_User::setVar方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_User::setVar方法的具体用法?PHP GWF_User::setVar怎么用?PHP GWF_User::setVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_User
的用法示例。
在下文中一共展示了GWF_User::setVar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectUsers
/**
* Select Users For Global Ranking.
* @param int $count
* @param int $from
* @return array
*/
private function selectUsers($count, $from)
{
$db = gdo_db();
$count = (int) $count;
$from = (int) $from;
$regat = GDO::table('WC_RegAt')->getTableName();
$users = GDO::table('GWF_User')->getTableName();
$query = "SELECT user_id,user_name,user_level,SUM(regat_score) AS lts, COUNT(regat_score) AS nlinks, regat_langid,user_countryid FROM {$regat} AS B JOIN (SELECT user_id,user_name,user_level,user_countryid FROM {$users} WHERE user_options&0x10000000=0 ORDER BY user_level DESC, user_id ASC LIMIT {$from}, {$count}) AS C ON user_id=regat_uid GROUP by user_id,regat_langid ORDER BY user_level DESC, user_id ASC";
$back = array();
if (false === ($result = $db->queryRead($query))) {
return $back;
}
$current = false;
while (false !== ($row = $db->fetchAssoc($result))) {
if ($current === false) {
$current = new GWF_User($row);
$current->setVar('nlinks', 0);
$back[] = $current;
} elseif ($current->getVar('user_id') !== $row['user_id']) {
if (count($back) === $count) {
break;
}
$current = new GWF_User($row);
$current->setVar('nlinks', 0);
$back[] = $current;
}
$current->setVar('grank_' . $row['regat_langid'], $row['lts']);
$current->setVar('nlinks', $current->getVar('nlinks') + $row['nlinks']);
// var_dump($current->getGDOData());
}
$db->free($result);
// var_dump($back);
return $back;
}
示例2: getUserStuff
private function getUserStuff(array $row, GDO_Database $db, $bits)
{
$back = new GWF_User($row);
$regat = GWF_TABLE_PREFIX . 'wc_regat';
$uid = $row['user_id'];
$query = "SELECT regat_sid, regat_solved FROM {$regat} WHERE regat_uid={$uid} AND regat_tagbits&{$bits} AND regat_options&4=0";
if (false === ($result = $db->queryRead($query))) {
return $back;
}
while (false !== ($row = $db->fetchRow($result))) {
$back->setVar('site_' . $row[0], $row[1]);
}
$db->free($result);
return $back;
}