<?php // -*- tab-width: 3; indent-tabs-mode: 1; -*-
/*
* $Id: topicSearch.php,v 1.9 2004/04/29 12:46:01 micsik Exp $
* Created for the StreamOnTheFly project (IST-2001-32226)
* Authors: András Micsik, Máté Pataki, Tamás Déri
* at MTA SZTAKI DSD, http://dsd.sztaki.hu
*/
require("init.inc.php");
$treeId = sotf_Utils::getParameter('tree');
$ID = sotf_Utils::getParameter('ID');
//$NAME = sotf_Utils::getParameter('NAME');
if(!$ID) {
$ID = $vocabularies->getTopicTreeRoot($treeId);
}
if($ID) {
$info = $vocabularies->getTopicInfo($ID, $lang);
$smarty->assign("TOPIC", $info);
$treeId = $info['tree_id'];
$NAME = $info['name'];
}
// collect subtopics
$subtopics = $vocabularies->getSubTopics($ID, $lang);
$smarty->assign('SUBTOPICS', $subtopics);
// collect supertopics
$super = $vocabularies->getSuperTopic($ID, $lang);
while($super) {
$supertopics[] = $super;
$super = $vocabularies->getSuperTopic($super['id'], $lang);
}
if($supertopics) {
$smarty->assign('SUPERTOPICS', array_reverse($supertopics));
}
if(!$supertopics) {
// collect info on topic tree
$smarty->assign('TREE', $vocabularies->getTopicTreeInfo($treeId, $lang));
// list all topic trees
$smarty->assign('TREES', $vocabularies->listTopicTrees($lang));
}
$max = $vocabularies->countProgsForTopic($ID);
if($max > 0) {
$limit = $page->splitList($max, "?ID=$ID");
$result = $vocabularies->getProgsForTopic($ID, $limit["from"], $limit["maxresults"]);
// cache icons for results
for($i=0; $i<count($result); $i++) {
$result[$i]['icon'] = sotf_Blob::cacheIcon2($result[$i]);
}
}
$smarty->assign("ID", $ID); //topic id
$smarty->assign("NAME", $NAME); //topic name
$smarty->assign("query", $query); //query
$smarty->assign("result", $result); //result array
$page->send("main_frame_left.htm");
?>