<% if ($lang=="eng") echo "All projects"; else echo "Visi projekti"; %> <% if ($lang=="eng") echo "Last 20 projects"; else echo "Pēdējie 20 projekti"; %>   LAT  ENG
<% if (($Bt>" ")or($sub_cmd>" ")) { if ($op<" ") $op="or"; $fields=' projekts_id, nosaukums, nosaukums_eng, numurs, nozare_nosaukums, nozare_nosaukums_eng, parent_nosaukums, struktura_nosaukums, parent_nosaukums_eng, struktura_nosaukums_eng, esfin_iesniegts, esfin_sanemts, mekle_partneri, nicks, vards, uzvards, entered_by, need_to_check_by, atb_persona, pieejamiba, need_to_check '; $joins = ""; $sstr=""; $source = &$_GET; /* #Sep 2007 - get column names from view "projekti" */ $avail_columns = array(); $q = "SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'projekti'"; $res = $GLOBALS["db"]->execSQL($q); while ($row = $GLOBALS["db"]->fetchRow($res)) { $avail_columns[] = $row[0]; } while (list($key, $value) = each($HTTP_GET_VARS)): switch($key) { case "cmd": case "Bt": case "lapa": case "oid": case "op": case "lang": case "embed": { $allow_var = false; break; } default: $allow_var = true; } if (($value>" ")&&(strlen($key)>3)&&$allow_var) { if($key == "iesniedzejs") { // $sstr .= "$op ($key = $value OR struktura_parent_id = $value) "; $value = intval($value); if($value > 0) $sstr = str_append($op, $sstr, "($key = $value OR $key IN (SELECT struktura_id FROM GetDepartmentChildren($value))) "); } elseif($key == "atslegvardi") { $skeywords = ""; foreach(explode(" ", trim($atslegvardi)) as $word) { if($skeywords > " ") $skeywords .= " OR "; $skeywords .= "atslegvardi LIKE N'%".$word."%'"; } if($skeywords > " ") $sstr = str_append($op, $sstr, " ($skeywords) "); } elseif($key == "bloks_id") { } elseif($key == "stadija") { if($value === "all1") $sstr = str_append($op, $sstr, " stadija <> 2 "); else $sstr = str_append($op, $sstr, " $key = ".$db->escape($value)); } elseif($key == "rigafin_paredzets") { $cfy = intval($source["cfy"]); $joins .= " LEFT JOIN project_params p ON p.project_id = projekti.projekts_id "; $sstr = str_append(" $op ", $sstr, " p.param_field = 'rigafin_paredzets' AND p.param_year = '$cfy' AND p.param_value = 1 "); $fields = str_append(", ", $fields, "p.param_value AS rigafin_paredzets_$cfy"); } elseif($key == "rigafin_sanemts") { $cfy = intval($source["cfy"]); $joins .= " LEFT JOIN project_params p1 ON p1.project_id = projekti.projekts_id "; $sstr = str_append(" $op ", $sstr, " p1.param_field = 'rigafin_sanemts' AND p1.param_year = '$cfy' AND p1.param_value = 1 "); $fields = str_append(", ", $fields, "p1.param_value AS rigafin_sanemts_$cfy"); } elseif($key == "prioritate_id") { if(intval($prioritate_id) > 0) $sstr = str_append($op, $sstr, " prioritate_id = $prioritate_id "); } elseif(is_numeric($value) && in_array($key,$avail_columns)) { $sstr = str_append($op, $sstr, " $key = $value "); } elseif(in_array($key,$avail_columns)) $sstr = str_append($op, $sstr, " $key like N'%". prepare($value) . "%' "); } endwhile; /* Teksta meklēšana jebkurā lauka */ if(strlen($fs)) { $fs = prepare($fs); // cut out all dangerous strings $fs2 = "N'%".strtolower($fs)."%'"; $sstr = str_append(" $op ", $sstr, " ( LOWER(nosaukums) LIKE $fs2 OR LOWER(nosaukums_eng) LIKE $fs2 OR ". "LOWER(CAST(puses AS varchar)) LIKE $fs2 OR LOWER(CAST(puses_eng AS varchar)) LIKE $fs2 OR ". "LOWER(CAST(situacija AS varchar)) LIKE $fs2 OR LOWER(CAST(situacija_eng AS varchar)) LIKE $fs2 OR ". "LOWER(CAST(merki AS varchar)) LIKE $fs2 OR LOWER(CAST(merki_eng AS varchar)) LIKE $fs2 OR ". "LOWER(CAST(stadija_apraksts AS varchar)) LIKE $fs2 OR LOWER(CAST(stadija_apraksts_eng AS varchar)) LIKE $fs2 OR ". "LOWER(istenosanas_laiks) LIKE $fs2 OR LOWER(istenosanas_laiks_eng) LIKE $fs2 OR ". "LOWER(finansejums) LIKE $fs2 OR LOWER(finansejums_eng) LIKE $fs2 OR ". "LOWER(nozare_nosaukums) LIKE $fs2 OR LOWER(nozare_nosaukums_eng) LIKE $fs2 OR ". "LOWER(tips_nosaukums) LIKE $fs2 OR LOWER(tips_nosaukums_eng) LIKE $fs2 OR ". "LOWER(struktura_nosaukums) LIKE $fs2 OR LOWER(struktura_nosaukums_eng) LIKE $fs2 ) "); } $ie = str_replace(array('.',','),'',$ie); // replace all dots and comma with empty symbol //if (intval($ie)>1) $sstr .= "izmaksas_eur $io ".intval($ie); if (intval($ie)>1) $sstr = str_append($op, $sstr, " izmaksas_eur $io ".intval($ie)); if (strlen($sstr)) $sstr = "(".$sstr.")"; if ($sub_cmd=="all") $sstr=" pieejamiba=0 "; $where_sql = 'WHERE (pieejamiba=0)'; $where_sql = str_append(' AND ', $where_sql, $sstr); if(!empty($fs)) { $joins = str_append(" ", $joins, "LEFT JOIN tipi ON tipi.tips_id = projekti.tips"); } $msq=" select distinct $fields from projekti left join nozares on projekti.nozare=nozares.nozare_id left join strukturas_ar_parentiem on projekti.iesniedzejs=strukturas_ar_parentiem.struktura_id left join lietotaji_few on projekti.atb_persona=lietotaji_few.nicks LEFT OUTER JOIN prioritates_projekti ON projekts_id = proj_id ".$joins." ".$where_sql." order by projekts_id"; if ($sub_cmd=="20_last") $msq=" select top 20 nosaukums, nosaukums_eng, projekts_id, need_to_check, pieejamiba, numurs, strukturas_ar_parentiem.*, lietotaji_few.*, nozares.* from projekti left join nozares on projekti.nozare=nozares.nozare_id left join strukturas_ar_parentiem on projekti.iesniedzejs=strukturas_ar_parentiem.struktura_id left join lietotaji_few on projekti.atb_persona=lietotaji_few.nicks ".$joins." where (pieejamiba=0) order by lastmod desc"; // echo $msq; //echo "\r\n\r\n"; $projekti = $db->execSQL($msq); //$projekti= odbc_exec($con, $msq); $cnt=0; %>
Meklēšanas rezultāti
<%while (odbc_fetch_row($projekti)): $cnt++;%> <%endwhile;%> <% if ($lang=="eng") $txt="$cnt records found"; else $txt="Kopā:  $cnt   ieraksti/-s"; %>
ID Projekta nosaukums Nozare Par projektu atbildīgā iestāde Atbildīgā persona
<%=odbc_result($projekti, "projekts_id"); // if (odbc_result($projekti, "numurs")) echo ' ('.odbc_result($projekti, "numurs").')'; if(odbc_result($projekti,"need_to_check") == 0&&odbc_result($projekti,"pieejamiba") == 0) $proj_info_url = "href=\"http://".$_SERVER["SERVER_NAME"]."/projekts.php?lang=".$lang."&projid=".odbc_result($projekti, "projekts_id")."\" target=\"_blank\""; else $proj_info_url = "href=\"javascript:cont_na('".odbc_result($projekti, "nicks")."')\""; %> <% if ($lang=="eng") echo odbc_result($projekti, "nosaukums_eng"); else echo odbc_result($projekti, "nosaukums");%> <% if ($lang=="eng") echo odbc_result($projekti, "nozare_nosaukums_eng"); else echo odbc_result($projekti, "nozare_nosaukums");%> <% if ($lang=="eng") { if (odbc_result($projekti, "parent_nosaukums_eng")) echo odbc_result($projekti, "parent_nosaukums_eng"); else echo odbc_result($projekti, "struktura_nosaukums_eng"); } else { if (odbc_result($projekti, "parent_nosaukums")) echo odbc_result($projekti, "parent_nosaukums"); else echo odbc_result($projekti, "struktura_nosaukums"); } %> ')"><%=odbc_result($projekti, "uzvards")%> <%=odbc_result($projekti, "vards")%>
<%=$txt%>
<% } %>
<% require ('inc_proj_search_form.php'); %>
<%require ('inc_bottom.php');%>