Identify(); $suffix = $identity['identity'][0]['suffix'][0][0]; $koolielu_local_fields = array('competition'=>'competition', 'independent'=>'independent', 'quality'=>'quality', 'tiigrisupport'=>'tiigrisupport', 'creator'=>'creator'); $fields = array_merge(getCombinedFieldList(), $koolielu_local_fields); $fields['vauthor'] = 'vauthor'; $used_parms = array(); $competition = get_input('competition'); if ($competition) $used_parms['competition'] = $competition; $_SESSION['competition'] = $competition; $independent = get_input('independent'); if ($independent) $used_parms['independent'] = $independent; $_SESSION['independent'] = $independent; $quality = get_input('quality'); if ($quality) $used_parms['quality'] = $quality; $_SESSION['quality'] = $quality; $schemas = get_input('schemas'); $_SESSION['schemas'] = $schemas; $tiigrisupport = get_input('tiigrisupport'); if ($tiigrisupport) $used_parms['tiigrisupport'] = $tiigrisupport; $_SESSION['tiigrisupport'] = $tiigrisupport; $creator = trim(get_input('creator')); $_SESSION['creator'] = $creator; // if one of koolielu filters failed then waramu search is pointless $agerange_min = get_input('min'); if ($agerange_min || $agerange_min == 0) $used_parms['min'] = $agerange_min; $_SESSION['min'] = $agerange_min; $agerange_max = get_input('max'); if ($agerange_max || $agerange_max == 0) $used_parms['max'] = $agerange_max; $_SESSION['max'] = $agerange_max; if ( $agerange_max >=20 ) $agerange_max = 0; $not_older = get_input('not_older_than'); $_SESSION['not_older_than'] = $not_older; if ($not_older) $used_parms['not_older_than'] = $not_older; $not_new_er = get_input('not_newer_than'); $_SESSION['not_newer_than'] = $not_new_er; if ($not_new_er) $used_parms['not_newer_than'] = $not_new_er; // fti $fti = trim(get_input('fti_search_input')); $_SESSION['searchTerm'] = $fti; $_SESSION['sortTerm'] = 'created'; if (get_input('sortValue')) $_SESSION['sortTerm'] = get_input('sortValue'); $sort = ""; if ( $_SESSION['sortTerm'] == "created" || $_SESSION['sortTerm'] == "title" ) { $sort = "<_sort>".$_SESSION['sortTerm'].""; } $result = array(); $query = ""; if (strlen($fti) > 0) { $query .= "<_fulltext>".$fti.""; } foreach ( $fields as $name => $field ) { $fval = urldecode(get_input($name)); $_SESSION[$name] = $fval; if ( !$fval || in_array($name, $koolielu_local_fields) || in_array($name, array("min", "max")) ) continue; $_SESSION[$name] = $fval; $used_parms[$name] = $fval; if($name=="language" && $fval=="all") { $fval=""; } if ($name=="keywords") { $kws = split(",", $fval); foreach ($kws as $kw) { $query .= "<".$name.">".trim($kw).""; } } else if ($name=="curriculumSubject") { $cso = getCurriculumSubject($fval); if ($cso) { $query .= "".($cso[0]->start).""; $query .= "".($cso[0]->end).""; } } else if ($name=='vauthor') { $query .= "<".$name.">FN:".$fval.""; } else { $query .= "<".$name.">".$fval.""; } } if ($agerange_min) { // || $agerange_min==0) { $query .=''.($agerange_min-1).''; } if ($agerange_max) { $query .=''.($agerange_max+1).''; } if ($not_older) { //$query .=''.date( 'Y-m-d H:i:s', strtotime($not_older." -1 day")).''; $query .=''.date( 'Y-m-d H:i:s', strtotime($not_older)).''; } if ($not_new_er) { //print date( 'Y-m-d H:i:s', strtotime($not_new_er." +1 day")); $query .=''.date( 'Y-m-d H:i:s', strtotime($not_new_er." +1 day")).''; } if ($creator) { $query .= "<_owner>".$creator."@".$suffix.""; } if ($competition) { $query .= "1"; } if ($independent) { $query .= "1"; } if ($tiigrisupport) { $query .= "1"; } if ($quality) { $query .= "1"; } if ($schemas) { $query .= "<_schema>".$schemas[0].''; } $query .= "*"; $query .= $sort.""; //$_SESSION['wquery'] = $query; $ids = array(); $idefs= $w->listIdentifiers("", $query); $waramuids = $idefs['identifiers'][0]['id']; foreach($waramuids as $wid) { $ids[] = $wid[0]; } $rn = count($ids); $result[$fti] = array('count'=>$rn, 'results'=>$ids); $_SESSION['results'] = $result; $_SESSION['result_params'] = $used_parms; forward('pg/waramu/results'); ?>