'Search', 'mode' => 'results'); } /** * @Secured('roles' = {'authenticated'}, 'valid' = {}) * */ public function actionMetaDataSearch() { global $kdb; $mds = array(); foreach (array('targetgroup','language','resourcetype','lre','difficulty') as $md) { if (isset($_POST[$md]) && is_array($_POST[$md])) { $mds [$md] = $_POST[$md]; } } if (count($mds)>0) { $_SESSION['search_results'] = $mds; return array('pid' => 'Search', 'mode' => 'metadata', 'searchAction' => 'multisearch'); } return array('pid' => 'Search', 'mode' => 'metadata'); } function getSearchWord() { if ( !isset($_SESSION['searchword']) ) { return ""; } return $_SESSION['searchword']; } function getResults() { $sword = $this->getSearchWord(); if ( strlen($sword) > 0 ) { return $this->kdb->getResourcesByFTI($sword); } return array(); } public function getDifMD($mdk) { global $kdb; $tgs = array(); $ret = $this->kdb->query("SELECT ".$mdk.", count(".$mdk.") FROM ".$mdk." left JOIN resources on ".$mdk.".resourceID=resources.resourceID left JOIN types on types.typeIdent=resources.type WHERE deleted=0 AND security='public' AND state='final' GROUP BY ".$mdk); while ( $row = mysql_fetch_array($ret) ) { $tgs []= $row; } return $tgs; } public function getByMetadata(){ global $kdb; $mds = array(); if ( isset($_GET['searchAction']) && isset($_SESSION['search_results']) ) { $mds = $_SESSION['search_results']; } else { foreach (array('targetgroup','language','resourcetype','lre','difficulty') as $md) { if (isset($_GET[$md])) { $mds [$md] = array($_GET[$md]); } } } if (count($mds)>0) { $tgs = $this->kdb->getResourcesByMD($mds); return $tgs; } return false; } } ?>