Exemplo n.º 1
0
 function getCondition($collegefield, $datefield)
 {
     // รับค่า parameter //
     $collegeId = $_GET['collegeId'];
     $college = App_Env::getCollege($collegeId);
     $collegeName = iconv('TIS-620', 'UTF-8', $college->collegeName);
     $getparams[] = "collegeId={$collegeId}";
     $WHERES[] = "{$collegefield}=?";
     $dataWhere[] = $collegeId;
     $dateto = trim($_GET['date-to']);
     $dateform = trim($_GET['date-from']);
     $getparams[] = "date-to={$dateto}";
     $getparams[] = "date-from={$dateform}";
     $titledate = '';
     if ($dateto != '' and $dateform != '') {
         $titledate .= 'จาก ' . App_Formatter::thaidate($dateform) . ' ถึง ' . App_Formatter::thaidate($dateto);
         //$WHERES[]    = "$collegefield=?";
         //$dataWhere[] = "";
     } elseif ($dateto != '' and $dateform == '') {
         $titledate .= ' ณ  ' . App_Formatter::thaidate($dateto);
     } elseif ($dateto == '' and $dateform != '') {
         $titledate .= ' ตั้งแต่ ' . App_Formatter::thaidate($dateform);
     }
     // จบช่วงรับค่่า parameter
     return array('where' => $WHERES, 'param' => $dataWhere, 'collegeName' => $collegeName, 'collegeID' => $collegeId, 'collegeId' => $collegeId, 'titleDate' => $titledate, 'getparam' => join("&", $getparams));
 }