List of NEICON members

{source}

<?php

if (!function_exists("xodbc_fetch_array"))
{
function xodbc_fetch_array($result, $rownumber=-1) {
if (PHP_VERSION > "4.1") {
if ($rownumber < 0) {
odbc_fetch_into($result, $rs);
}
else {
odbc_fetch_into($result, $rs, $rownumber);
}
} else {
odbc_fetch_into($result, $rownumber, $rs);
}
foreach ($rs as $key => $value) {
$rs_assoc[odbc_field_name($result, $key+1)] = $value;
}
return $rs_assoc;
}
}

if (!function_exists("xodbc_num_rows"))
{
function xodbc_num_rows($sql_id, $CurrRow = 0)
{
$NumRecords = 0;
odbc_fetch_row($sql_id, 0);
while (odbc_fetch_row($sql_id))
{
$NumRecords++;
}
odbc_fetch_row($sql_id, $CurrRow);
return $NumRecords;
}
function _dt($x)
{
return preg_replace("/(\\d{4})-(\\d{2})-(\\d{2}).*/","\\3.\\2.\\1",$x);
}
}

function my_strtoupper($str){ // for Windows-1251
return strtr($str,"ёйцукенгшщзхъфывапролджэячсмитьбю","БЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ");}

$hostname = "login.neicon.pro";

$username = "fin";

$dbName = "fin";

$password = "2026631";
$xxx = pg_connect("user=$username dbname=$dbName password=$password host=$hostname port=15432");

$sql="select oname,cname,uid,url,extract(year from case when xdate is null then ctime else xdate end) as xdate from (select oname, cname, oc.uid, oc.url, ctime, min(cc.xdate) as xdate from (select o.name_e as oname, c.nameeng as cname, c.uid, o.url,o.uid as orguid,x.creation_time as ctime from organizations o , cities c,x_objects x where o.city_id=c.uid and x.uid=o.uid ) oc left join contracts cc on oc.orguid=cc.organization_id group by oname,cname,oc.uid,oc.url,ctime ) as q order by cname, oname
";
$r = pg_query($xxx,$sql);

for ($i=1;$i<=pg_num_rows($r);$i++) {
$a=array();
$a = pg_fetch_array($r);
$cities[$a[1]]=$a[2];
$cs[$a[2]]=$a[1];
$orgs[$a[2]][]=$a[0];
$urls[$a[0]] = $a[3];
$from[$a[0]] = $a[4];
}

$letter_array=array();
$first=True;
echo '<div class="participants-alphabit">';
foreach ($cities as $x=>$y) {
$curlet=iconv('windows-1251','utf-8',substr(iconv('utf-8','windows-1251',my_strtoupper(iconv('windows-1251','utf-8',$x))),0,1));//NO MORE PHP, PLEASE!!!

if (!array_key_exists($curlet,$letter_array)){
if (!$first) echo '</ul></div>';
$first=False;
echo '<div class="participant-index">';
echo '<p style="margin-bottom:5px;"><strong><span style="font-size: 16px; font-family: Fira;"><span style="color: #df7344;">'.$curlet.'</span></span></strong></p>';
echo '<ul class="city-list">';
$letter_array[$curlet]=1;
}
echo '<li>';

echo '<a href="/#'.$y.'">'.iconv('windows-1251','utf-8', $x).'</a>';

echo '</li>';
}
echo '</ul>';
echo '</div>';
echo '</div>';
echo '<a class="presentation-button" href="/https://login.neicon.ru/register">Become consortium member</a>';
echo '<div class="participants-content">';

foreach ($orgs as $city=>$o) {
echo '<div class="participant-info">';
echo '<a class="city" name="'.$city.'">'.iconv('windows-1251','utf-8',$cs[$city]).'<br></a>';

foreach ($o as $x) {
echo "<span>";
$org = sprintf($urls[$x]?'<a target="_blank" href="/%2$s">%s</a>':'%s',$x,strstr($urls[$x],'http')?$urls[$x]:"http://$urls[$x]");
echo iconv('windows-1251','utf-8',$org);
# echo <<<q $from[$x]a.<br>q;
echo ", NEICON member since ".$from[$x].".<br>";
echo "</span>";
}
echo '<br>';
echo '</div>';
}

?>
{/source}