entityCondition('entity_type', 'node')
->entityCondition('bundle', 'department')
->propertyCondition('status', NODE_PUBLISHED);
$result = $query->execute();
if (isset($result['node'])) {
$depts_nids = array_keys($result['node']);
$depts = entity_load('node', $depts_nids);
}
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'clovek')
->propertyCondition('status', NODE_PUBLISHED)
->fieldCondition('field_aktivn', 'value', 'Ano', '=')
->fieldCondition('field_seznam', 'value', 'Ano', '=')
->fieldOrderBy('title_field', 'value', 'ASC')
->fieldOrderBy('field_jmno', 'value', 'ASC');
$result = $query->execute();
if (isset($result['node'])) {
$people_nids = array_keys($result['node']);
$people = entity_load('node', $people_nids);
print '
' . "\n";
$fchar = '';
foreach ($people as $p){
$sname1 = mb_substr( $p->title, 0, 1,'UTF8');
$fname = field_get_items('node', $p, 'field_jmno');
$fname1 = mb_substr( $fname[0]['value'], 0, 1,'UTF8');
$phone = field_get_items('node', $p, 'field_telefon');
$room = field_get_items('node', $p, 'field_mstnost');
$deptId = field_get_items('node', $p, 'field_department');
if($deptId)
$dept = field_get_items('node', $depts[$deptId[0]['target_id']], 'field_abbreviation');
else
$dept = '';
if ($phone && $phone[0]['value']){
if ($fchar != $sname1) { $cclass = ' pb_cap'; $fchar = $sname1; }else{ $cclass = '';}
print '
'."\n";
}
?>
';
print ''.$p->title . ' ' . $fname1 . '.';
print '';
$phoneList = array();
foreach ($phone as $phn){
$phoneList[] = preg_replace('/^'.$utia_prefix.'/', '', $phn['value']);
}
print implode(', ', $phoneList);
print ''."\n";
print ''. $dept[0]['value'] . '';
print ''. $room[0]['value'] . '';
print '
'."\n";
}
}
print '