if ($_GET['err'] == 1) {
print "Please choose no more than 3 research projects.
";
}
else if($_GET['err'] == 2){
print "Please choose at least 1 research project.
";
}
else {
}
?>
Please choose no more than three research projects from the list below that you wish to be displayed in the Science News Corner.
/************************************
* format order
***********************************/
$args = $_GET['config'];
$intSelected = 0;
/* for ($i=0; $i<4; $i++) {
if (substr($args, $i, 1)== "1") {
$intSelected += 1;
}
}
for ($i=0, $j=0, $k=0; $i<4; $i++) {
if (substr($args, $i, 1)== "1") {
$strIndex[$j] = $i + 1;
$j += 1;
} else {
$strIndex[$k + $intSelected] = $i + 1;
$k += 1;
}
} */
$now = date("Y") . zero_filler(date("m")) . zero_filler(date("d"));
$strIndex = array();
foreach($chosen_config as $subjid => $selected){
if($selected) $strIndex[] = $subjid;
}
for ($i=0; $i<4; $i++) {
if(!in_array($i+1, $strIndex))
$strIndex[] = $i+1;
}
/************************************
* Query and display all projects
***********************************/
$n = 0;
$project_array = array();
if($_GET['project_page']=='')
$project_page = 1;
else
$project_page = $_GET['project_page'];
$project_shown_index = 0;
$max_shown = 2000000;
$first_item = ($max_shown * ($project_page-1) )+ 1;
$last_item = $max_shown * $project_page;
$num_count = 0;
for ($index=0; $index<4; $index++) {
// if($chosen_config[$index+1]!=1) continue;
//$strSQL = "SELECT * FROM tblprojectinfo WHERE datefrom<=$now AND dateto>=$now AND Del<>'1' AND (status LIKE '0%' OR status LIKE '3%' OR status LIKE '4%') AND subject_id=$strIndex[$index] and awarded = 0 order by name_eng asc ";
$strSQL = "SELECT * FROM tblprojectinfo WHERE datefrom<=$now AND dateto>=$now AND Del<>'1' AND (status LIKE '0%' OR status LIKE '3%' OR status LIKE '4%') AND subject_id=$strIndex[$index] and awarded = 0 order by rand()";
$result = MYSQL_QUERY($strSQL, $link);
$row_num = MYSQL_NUM_ROWS($result);
if ($row_num > 0) {
for ($i=0; $i<$row_num; $i++) {
if (strLen(mysql_result($result, $i, "descript_chi")) > 0) {
$project_shown_index++;
if($project_shown_index < $first_item || $project_shown_index > $last_item) continue;
$num_count++;
$temp_array = array();
$temp_array['name'] = mysql_result($result, $i, "name_eng");
$temp_array['project_id'] = mysql_result($result, $i, "project_id");
$project_array[mysql_result($result, $i, "subject_id")][] = $temp_array;
}
}
}
}
if($project_page == 1) $is_first_page = true;
//echo $last_item. " ".$num_count." ".$project_shown_index;
if($last_item >= $project_shown_index) $is_last_page = true;
?>
$vertical_shown = count($project_array) <= 2;
$vertical_shown = true;
$n=0;
if(count($project_array)>0){
//pro_list.php?config= $args;
foreach($project_array as $subjid=>$projects_details){
$n++;
?>
|
if($n%2==0 || $vertical_shown)
echo'
';
}
}
mysql_close($link);
?>
">