<th>Страна</th> <th>Категория<br/>тура</th> <th>Действие</th> </tr> <?php foreach ($list as $item) { $worldCount = 0; $uzCount = 0; $itemCount = 0; // Определеяем количество статей if ($item->info_category_id->id > 0) { $itemCount = CatalogInfo::count(DBQueryParamsClass::CreateParams()->setConditions("category_id =:cid")->setParams([":cid" => $item->info_category_id->id])); } elseif ($item->country_id->id > 0) { $itemCount = CatalogInfo::count(DBQueryParamsClass::CreateParams()->setConditions("country_id = :cid")->setParams([":cid" => $item->country_id->id])); } elseif ($item->category_id->id > 0) { $itemCountArr = CatalogInfo::sql("SELECT count(id) as count_ FROM catalog_info WHERE id in ( SELECT leftId FROM cat_relations WHERE leftClass='CatalogInfo' AND rightId='" . $item->category_id->id . "' AND rightClass='CatalogToursCategory' )"); if (sizeof($itemCountArr) > 0) { $itemCount = $itemCountArr[0]["count_"]; } } if ($item->country_id->id > 0) { $countryWhere = "country_id = "; } $sql = "SELECT count(id) as count_ FROM catalog_tours WHERE active=1"; if ($item->category_id->id > 0) { $sql .= " AND category_id='" . $item->category_id->id . "'"; } $worldCountArr = CatalogTours::sql($sql . " AND country_id='1' "); if (sizeof($worldCountArr) > 0) { $worldCount = $worldCountArr[0]["count_"]; }