$reparam = '';
if($_GET["w"]){ $reparam .= '?w='.$_GET["w"]; }
if($_GET["cnt"]){ $reparam .= ($reparam)?'&':'?'.'cnt='.urlencode($_GET["cnt"]);}
if($_GET["mon"]){ $reparam .= ($reparam)?'&':'?'.'mon='.urlencode($_GET["mon"]);}
if($_GET["t"]){ $reparam .= ($reparam)?'&':'?'.'t='.urlencode($_GET["t"]); }
if($_GET["p"]){ $reparam .= ($reparam)?'&':'?'.'p='.urlencode($_GET["p"]); }
if($_GET["key"]){ $reparam .= ($reparam)?'&':'?'.'key='.urlencode($_GET["key"]);}
require_once("../common/_inc/def.php");
uacheck($contURL.'/academy/sp/sch.php'.$reparam);
function convertDate($datestr){
if(strpos($datestr,'年') !== false){
$dateAry = split('年',$datestr);
$str_y = $dateAry[0];
$dateAry = split('月',$dateAry[1]);
$str_m = $dateAry[0];
$str_d = str_replace("日", "", $dateAry[1]);
} else {
$dateAry = split('/',$datestr);
$str_y = $dateAry[0];
$str_m = str_pad($dateAry[1], 2, 0, STR_PAD_LEFT);
$str_d = str_pad($dateAry[2], 2, 0, STR_PAD_LEFT);
}
return $str_y.$str_m.$str_d;
}
$season = getSeasonData();
$season = $season["data"];
$category = getCategoryData();
$category = $category["data"];
$sc_w = intval( $_GET["w"] );
$sc_cnt = intval( $_GET["cnt"] );
$sc_mon = intval( $_GET["mon"] );
$sc_t = intval( $_GET["t"] );
$sc_p = intval( $_GET["p"] );
$sc_key = $_GET["key"];
$cond = [];
$cond[] = array("name" => "cou_pub_flg", "value" => 1);//公開フラグ
if($sc_w){//1~7
switch ($sc_w) {
case 1:
$cond[] = array("name" => "cou_sc_w1", "value" => 1);
break;
case 2:
$cond[] = array("name" => "cou_sc_w2", "value" => 1);
break;
case 3:
$cond[] = array("name" => "cou_sc_w3", "value" => 1);
break;
case 4:
$cond[] = array("name" => "cou_sc_w4", "value" => 1);
break;
case 5:
$cond[] = array("name" => "cou_sc_w5", "value" => 1);
break;
case 6:
$cond[] = array("name" => "cou_sc_w6", "value" => 1);
break;
case 7:
$cond[] = array("name" => "cou_sc_w7", "value" => 1);
break;
}
}
/*
*/
if($sc_cnt){//回数
switch ($sc_cnt) {
case 1:
$cond[] = array("name" => "cou_sc_cnt", "value" => 1);
break;
case 2:
$cond[] = array("name" => "cou_sc_cnt", "value" => 2,"operator" => ">=");
$cond[] = array("name" => "cou_sc_cnt", "value" => 9,"operator" => "<=");
break;
case 3:
$cond[] = array("name" => "cou_sc_cnt", "value" => 10,"operator" => ">");
break;
}
}
if($sc_mon){//開講月
$cond[] = array("name" => "cou_sc_mon", "value" => $sc_mon);
}
if($sc_t){//開講時間
switch ($sc_cnt) {
case 1:
$cond[] = array("name" => "cou_sc_t1", "value" => 1);
break;
case 2:
$cond[] = array("name" => "cou_sc_t2", "value" => 1);
break;
case 3:
$cond[] = array("name" => "cou_sc_t3", "value" => 1);
break;
}
}
if($sc_p){//受講料
switch ($sc_p) {
case 1:
$cond[] = array("name" => "cou_sc_p1", "value" => 1);
break;
case 2:
$cond[] = array("name" => "cou_sc_p2", "value" => 1);
break;
case 3:
$cond[] = array("name" => "cou_sc_p3", "value" => 1);
break;
case 4:
$cond[] = array("name" => "cou_sc_t4", "value" => 1);
break;
}
}
if($sc_key){//キーワード
/*
$cond[] = array("name" => "cou_name", "value" => "%".html_entity_decode($sc_key)."%","operator" => "LIKE");
$cond[] = array("logical_connection" => "or", "name" => "cou_sc_key", "value" => "%".html_entity_decode($sc_key)."%","operator" => "LIKE");
*/
$cond[] = array("name" => "cou_sc_key", "value" => "%".html_entity_decode($sc_key)."%","operator" => "LIKE");
}
if( count($cond) > 0 ){
// -----------------------------------------------------------------------------
// SELECT
// -----------------------------------------------------------------------------
// API用のHTTPヘッダ
$api_headers = array(
"X-SPIRAL-API: database/select/request",
"Content-Type: application/json; charset=UTF-8",
);
// 送信するJSONデータを作成
$parameters = array();
$parameters["spiral_api_token"] = $api_token; //トークン
$parameters["db_title"] = "adm_coursedata"; //DBのタイトル
$parameters["passkey"] = time(); //エポック秒
$parameters["lines_per_page"] = 1000; //件数
// 表示カラム名
$parameters["select_columns"] = array(
"id",//0
"cou_year",//1
"cou_sea_m_id",//2
"cou_sea_m_name",//3
"cou_cou_m_id",//4
"cou_cou_m_name",//5
"cou_cou_id",//6
"cou_name",//7
"cou_e_flag",//8受付状態
"cou_sort",//9並び用数値
"cou_e_start",//10受付開始日
"cou_e_end",//11受付終了日
);
// 検索条件
$parameters["search_condition"] = $cond;
// ソート
$parameters["sort"] = array(
array("name" => "cou_cou_id", "order" => "asc"),
);
// 署名を付けます
$key = $parameters["spiral_api_token"] . "&" . $parameters["passkey"];
$parameters["signature"] = hash_hmac('sha1', $key, $api_secret, false);
// 送信用のJSONデータを作成します。
$json = json_encode($parameters);
// curlライブラリを使って送信します。
$curl = curl_init($api_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST , true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt($curl, CURLOPT_HTTPHEADER, $api_headers);
curl_exec($curl);
if (curl_errno($curl)) echo curl_error($curl);
$response = curl_multi_getcontent($curl);
curl_close($curl);
// 画面に表示
// 配列にしたい時は json_decode($response, true); とします。
//echo "$response\n\n";
//print_r(json_decode($response, true));
$res = json_decode($response, true);
$res = $res["data"];
}
$num = count($res);
?>
講座を選ぶ | 共立女子大学・短期大学 共立アカデミー
- 共立女子大学・短期大学 共立アカデミーTOP
- 講座を選ぶ
- 検索結果一覧
検索結果一覧
include( "schbox.php" );?>
検索結果
if($num==0){?>
該当する講座は見つかりませんでした。
別の条件か、キーワードを設定して、再検索してください。
} ?>
$toDay = date('Ymd');
$endAry = array();
for ( $iCnt = 0 ; $iCnt < count( $res ) ; $iCnt++ ) {
$startDay = convertDate($res[$iCnt][10]);
$endDay = convertDate($res[$iCnt][11]);
$endFlg = $course[$cCnt][8];
if ( $endFlg != 1 && $startDay <= $toDay && $endDay + 1 > $toDay ) {
$status = 1;//受付中
} else if ( $endFlg == 1 ) {
$status = 3;//強制受付終了
} else if ( $startDay > $toDay ) {
$status = 0;//受付前
} else {
$status = 2;//受付終了(期限切れ)
}
$wkorder = "";
if ( $status >= 2 ) {
$wkorder = <<
EOF;
}
if($status < 2) {
?>
-
} else {
$endAry[] = $res[$iCnt];
}
}
?>
if(count($endAry)>0){
?>
受付終了
for ( $eCnt = 0 ; $eCnt < count( $endAry ) ; $eCnt++ ) {
$wkorder = <<
EOF;
?>
-
}
}
?>