if ($_GET['err'] == 1) {
print "請 選 出 不 多 於 三 個 項 目 。
";
}
else if($_GET['err'] == 2){
print "請 選 出 至 少 一 個 項 目 。
";
}
else {
}
?>
請 你 在 以 下 列 舉 的 科 研 計 劃 中 , 選 出 最 多 三 個 你 最 希 望 在 科 訊 廊 內 展 出 的 項 目 。
/************************************
* 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;
//and shown = 1
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) {
// $project_shown_index++;
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_chi");
$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;
if($last_item >= $project_shown_index) $is_last_page = true;
if($is_last_page){ ?>