$v) { $$k = $v; // echo "k = ".$k."---- v = ".$v."
"; } ?>
"; if($language == 1) { $qLang = "Arm"; $tGrancum = "գրանցում"; $tPage = "Էջ"; } if($language == 2) { $qLang = "Eng"; $tGrancum = "result"; $tPage = "Page"; } function getId($parentId) { global $strAll; $query = "SELECT GROUP_CONCAT( AAT_TreeID SEPARATOR ',' ) AS ParStr FROM `aat_tree` WHERE ParentID IN ( ".$parentId." ) GROUP BY ParentID "; $result = mysql_query($query); if ($result) { $strIds = ""; while($row = mysql_fetch_row($result)) { $strIds .= $row[0].","; } $strIds = substr($strIds,0,strlen($strIds)-1); $strAll .= $strIds.","; if (!empty($strIds)) getId($strIds); } } function drawLimit($rowCount,$limStart) { global $pageCount,$tPage; if($rowCount < $pageCount && $rowCount != 0) { echo "

"; } if($rowCount > $pageCount) { //echo"
"; //echo"
"; if($limStart == 0) { $limStart=1; } echo "
"; if($limStart > 1) { echo" << "; if($limStart > 10) echo" < "; else echo" < "; } $k = intval($rowCount/$pageCount); for($ii=$limStart-1;$ii<$limStart+10;$ii++) { if($ii <= $k && $ii != -1) { if((!$limStart && $ii == 0) || ($limStart == ($ii+1))) echo "".($ii+1).""; else echo"".($ii+1).""; } } if($limStart == 0) { $next = 2; if($rowCount > $pageCount) echo" >  "; } else if(($limStart+10) < $k) { $next = $limStart + 10; echo" > "; echo" >> "; } //echo"
"; echo ""; } } $IsAAT = true; if(!$selTreeID) echo "";//Click in link in the tree on left."; else { $pageCount = 10; if(!$limStart) $LimitStart = 0; else $LimitStart = ($limStart-1)*$pageCount; echo " $tSearch1 $hdPath"; getId($selTreeID); $strAll = substr($strAll,0,strlen($strAll)-2); $strAll_1 = $selTreeID.((!empty($strAll))?",".$strAll:""); // echo "$selMonument"; $querySearch = "SELECT DISTINCT M.MonumentID,M.Name".$qLang.",D.FromYear,D.ToYear,D.FromFormat,M.Note".$qLang.",M.SubtypeID,S.Name".$qLang." AS SubName,S.IconExt FROM monument M LEFT JOIN monumentsubtypes S ON M.SubtypeID=S.SubtypeID INNER JOIN address A ON A.MonumentID=M.MonumentID INNER JOIN dates D ON A.DateID=D.DateID INNER JOIN aat_monuments AM ON AM.MonumentID=M.MonumentID AND AM.AAT_TreeID IN (".$strAll_1.") LIMIT $LimitStart,$pageCount"; $queryCount = "SELECT COUNT(DISTINCT M.MonumentID) FROM monument M INNER JOIN address A ON A.MonumentID=M.MonumentID INNER JOIN dates D ON A.DateID=D.DateID INNER JOIN aat_monuments AM ON AM.MonumentID=M.MonumentID AND AM.AAT_TreeID IN (".$strAll_1.")"; // echo "queryCount = $queryCount
"; // echo "querySearch = $querySearch
"; $resultCount = mysql_query($queryCount); if ($resultCount) $rowCount = mysql_fetch_row($resultCount); if ($rowCount[0] > 0) { $resultSearch = mysql_query($querySearch); if($resultSearch) { echo ""; echo""; drawLimit($rowCount[0],$limStart); echo "
$tFind $rowCount[0] $tGrancum
"; echo ""; $searchCount = mysql_num_rows($resultSearch); echo ""; echo ""; require "monumentsearch_aat.php"; echo "
"; echo ""; echo ""; echo""; drawLimit($rowCount[0],$limStart); echo "
"; echo ""; } } else echo "$tFind $rowCount[0] $tGrancum"; } ?>