Файл: plugins/google_map_location/components/user_list.php
Строк: 35
<?php
class GOOGLELOCATION_CMP_UserList extends BASE_CMP_Users
{
public function getFields( $userIdList )
{
$fields = array();
$qs = array();
$qBdate = BOL_QuestionService::getInstance()->findQuestionByName('birthdate');
if ( $qBdate->onView )
{
$qs[] = 'birthdate';
}
$qSex = BOL_QuestionService::getInstance()->findQuestionByName('sex');
if ( $qSex->onView )
{
$qs[] = 'sex';
}
$questionList = BOL_QuestionService::getInstance()->getQuestionData($userIdList, $qs);
foreach ( $questionList as $uid => $question )
{
$fields[$uid] = array();
$age = '';
if ( !empty($question['birthdate']) )
{
$date = UTIL_DateTime::parseDate($question['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
$age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
}
$sexValue = '';
if ( !empty($question['sex']) )
{
$sex = $question['sex'];
for ( $i = 0; $i < 31; $i++ )
{
$val = pow(2, $i);
if ( (int) $sex & $val )
{
$sexValue .= BOL_QuestionService::getInstance()->getQuestionValueLang('sex', $val) . ', ';
}
}
if ( !empty($sexValue) )
{
$sexValue = substr($sexValue, 0, -2);
}
}
if ( !empty($sexValue) && !empty($age) )
{
$fields[$uid][] = array(
'label' => '',
'value' => $sexValue . ' ' . $age
);
}
}
return $fields;
}
}