- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
/**
* Получить список NEW5
*
* @return array список событий
*/
public function getLastForBlockNew($cat_tc_id = NULL)
{
$max_name_len = 41;
$sql = "SELECT
a.d_id,
CONCAT(a.d_sname, ' ', a.d_name, ' ', a.d_fname) as d_name,
SUBSTR(a.d_description, 0, 30) as d_description,
a.d_rating,
c.c_name_url,
b.rg_name_url,
'".Application_Url_Maker::makeUrl(array(), 'sub-domain1')."' as domain
FROM customers a
LEFT JOIN cities c ON c.c_id=a.d_c_id
LEFT JOIN regions b ON b.rg_id=c.c_rg_id
WHERE a.d_rating is not NULL
ORDER BY RAND()
LIMIT 5
";
$query[-1] = $this->querycached($sql);
$sql = "SELECT
a.h_id,
a.h_name_ru,
SUBSTR(a.h_description, 0, 30) as h_description,
a.h_rating,
c.c_name_url,
b.rg_name_url,
'".Application_Url_Maker::makeUrl(array(), 'sub-domain2')."' as domain,
h_lat,
h_lon,
h_address,
h_phones,
d.hs_name_url
FROM hospitals a
LEFT JOIN cities c ON c.c_id=a.h_c_id
LEFT JOIN regions b ON b.rg_id=c.c_rg_id
LEFT JOIN item_specializations d ON d.hs_id=a.h_hs_id
WHERE a.h_rating is not NULL
ORDER BY RAND()
LIMIT 5
";
$query[1] = $this->querycached($sql);
$tc_ids = $this->db->fetchAll("select tc_id, tc_name_subdomain from type_catalogs where tc_id<>1");
foreach($tc_ids as $v){
$sql = "SELECT
a.cat_id,
a.cat_name_ru,
SUBSTR(a.cat_description, 0, 30) as cat_description,
a.cat_rating,
c.c_name_url,
b.rg_name_url,
'".Application_Url_Maker::makeUrl(array(), $v['tc_name_subdomain'])."' as domain,
cat_lat,
cat_lon,
cat_address,
cat_phones
FROM catalogs a
LEFT JOIN cities c ON c.c_id=a.cat_c_id
LEFT JOIN regions b ON b.rg_id=c.c_rg_id
WHERE a.cat_tc_id=? and a.cat_rating is not NULL
ORDER BY RAND()
LIMIT 5
";
$query[$v['tc_id']] = $this->querycached($sql, array($v['tc_id']));
}
foreach($query as $k=>$v){
foreach($v as $k1=>$v1){
if(isset($v1['cat_name_ru']) && mb_strlen($v1['cat_name_ru']) > $max_name_len){
$query[$k][$k1]['cat_name_ru'] = mb_substr($v1['cat_name_ru'], 0, $max_name_len).'...';
}
elseif(isset($v1['h_name_ru']) && mb_strlen($v1['h_name_ru']) > $max_name_len){
$query[$k][$k1]['h_name_ru'] = mb_substr($v1['h_name_ru'], 0, $max_name_len).'...';
}
}
}
return $query;
}