user_login=='vansindata'; }*/ $CRM_STATUS_INDEX = 0; $CRM_NAME_INDEX = 2; $CRM_EMAIL_INDEX = 3; $choose_class = isset($_GET['class'])&&in_array($_GET['class'],array_keys($ary)) ? $_GET['class'] : ''; if($_POST){ $class=isset($_POST['class']) ? $_POST['class'] : ''; if(!isset($ary[$class])){die('invalid class, go back');} $name=isset($_POST['name']) ? trim($_POST['name']) : ''; $email=isset($_POST['email']) ? normalize_aia_email($_POST['email'],false) : ''; if(!strlen($class) or (!$name && !$email)){ die('請輸入欄位。上一頁'); } $cur_class_setting = $ary[$class]; $row = array(); $is_local_data = isset($cur_class_setting['local_file']) && $cur_class_setting['local_file']; $is_CRM_data = isset($cur_class_setting['crm_group']) && $cur_class_setting['crm_group']; $ary_all_rows = array(); if($is_CRM_data){ // CRM data foreach($cur_class_setting['crm_group'] as $crm_group_id=>$status){ $cmd = '/usr/bin/python2.7 '.__DIR__.'/CRM_proxy.py "https://aiacademy.neticrm.tw/civicrm/group/search?force=1&context=smog&gid='.$crm_group_id.'&crmRowCount=9999"'; $s = shell_exec($cmd); if($IS_DEBUG and false){echo'
';echo$cmd;echo"\n";echo $s;echo'
';} $a = preg_split("/(\r\n|\n|\r)/",$s); foreach($a as $v){ if(!trim($v)){ continue; } $ary_all_rows[] = array_merge(array($status), explode('`',$v)); } } if($IS_DEBUG and false){ echo'
';
    print_r($cur_class_setting);
    print_r($cur_class_setting['crm_group']);
    print_r($ary_all_rows);#exit();
  }
  if($IS_DEBUG){
    $has_same_name = false;
    foreach($ary_all_rows as$k=>$v){
      foreach($ary_all_rows as $k2=>$v2){
        if($k!=$k2 and $v[$CRM_NAME_INDEX]==$v2[$CRM_NAME_INDEX]){
          $has_same_name = true;
          echo 'NOTICE: '.$v[$CRM_NAME_INDEX].'('.$v[$CRM_EMAIL_INDEX].')'.$v[$CRM_STATUS_INDEX]
              .'='.$v2[$CRM_NAME_INDEX].'('.$v2[$CRM_EMAIL_INDEX].')'.$v2[$CRM_STATUS_INDEX].'
'; } } } echo $has_same_name ? '---HAS SAME NAME---' : '---Nothing, NO SAME NAME---'; } foreach($ary_all_rows as$v){ $b = false; if($name && $email){ $b = $v[$CRM_NAME_INDEX]==$name && $v[$CRM_EMAIL_INDEX]==$email; }elseif($name && !$email){ $b = $v[$CRM_NAME_INDEX]==$name; }elseif(!$name && $email){ $b = $v[$CRM_EMAIL_INDEX]==$email; } if($b){ if(!$row || ($row and $row[0][$CRM_STATUS_INDEX]!=$v[$CRM_STATUS_INDEX])){ $row[] = $v; } } } }else{ // Database data $name_hashed = !$name ? '' : AmIStudent::get_username_encodehash($name); $email_hashed = !$email ? '' : AmIStudent::get_email_encodehash(trim(strtolower($email))); #MUST lowercase email $ary_where = array(); if($name_hashed){ $ary_where[] = '`name_hashed`="'.$name_hashed.'"'; } if($email_hashed){ $ary_where[] = '`email_hashed`="'.$email_hashed.'"'; } $row = $wpdb->get_results('SELECT * FROM '.TBL_AM_I_STUDENT.' WHERE ('.implode(' OR ', $ary_where).') AND xlass="'.$class.'"'); } if(!$row){ die('找不到紀錄或稍後再查。若您確定有報名「'.$ary[$class]['txt'].'」,請稍後再查或者來信 '.$ary[$class]['_contact'].' 確認您的報名Email與報名姓名。'); } $count_row = count($row); if($count_row>=2){ # for 同名同姓同字 die('因本班有與您同名同姓同字的報名者,需請至 前頁 並同時輸入【報名時】的姓名與Email,以利系統顯示您個人的結果。'); }elseif($count_row==1){ $row # <--- real single row data. = $row[0]; } if($is_CRM_data){ $status = $row[$CRM_STATUS_INDEX]; $name_public = $row[$CRM_NAME_INDEX]; }else{ if($is_local_data){ $google_doc_url = $ary[$class]['local_file']; }else{ $doc = $ary[$class]['doc']; $gid = $ary[$class]['gid']; $google_doc_url = 'https://docs.google.com/spreadsheets/d/'.$doc.'/export?format=tsv&gid='.$gid; } $spreadsheet_content = file_get_contents($google_doc_url); $ary_spreadsheet_content = preg_split("/(\r\n|\n|\r)/",$spreadsheet_content); #var_dump($row->row_position); foreach($ary_spreadsheet_content as$k=>$v){ $n = $k+1; if($n==$row->row_position){ $_ = explode("\t", $v); $name_public = $row->name_public; $status = $_[0]; break; } } // end of foreach } // end of if-else $is_CRM_data } // end if($_POST) #var_dump($status); ?> 學生查詢錄取/備取/不錄取 $v){ if($k==$class){ $class_txt = $v['txt']; $class_place = $v['_place']; $class_num = $v['_num']; $class_type = $v['_type']; $class_contact = $v['_contact']; break; } } echo''; echo'

Hi '.$name_public.', 您報名「'.$class_txt.'」的錄取/備取/未錄取狀態:

'; $CAT_ID = 0; if($status=='P2'){ echo '非常抱歉,我們無法在本期錄取您,但您已確定錄取下一期的期數。
'; $CAT_ID = PASSNEXTSAME_STUDENT_CAT_ID; }elseif(strpos($status,'P')!==false and strpos($status,'B')===false){ echo '恭喜已錄取。
'; $CAT_ID = PASS_STUDENT_CAT_ID; }elseif(strpos($status,'F')!==false){ echo '非常抱歉,我們無法在本期錄取您。
'; $CAT_ID = FAIL_STUDENT_CAT_ID; }elseif(strpos($status,'S')!==false){ echo '非常抱歉,我們無法在本期錄取您
'; $CAT_ID = SUGGEST_STUDENT_CAT_ID; }elseif(strpos($status,'Sgotonexttech')!==false){ echo '非常抱歉,我們無法在本期錄取您。建議您報名下一期的技術班。
'; $CAT_ID = SUGGEST_GO2NEXTTECH_STUDENT_CAT_ID; }elseif(strpos($status,'B')!==false){ preg_match('/B([0-9]+)/', $status, $m); if(!$m or !$m[1]){ if ($is_CRM_data and $status==='B') { # <--- added from 2019.11.13 for CRM data $CAT_ID = BACKUP_STUDENT_CAT_ID; # <--- added from 2019.11.13 for CRM data }else{ echo'unknow, please contact hi@aiacademy.tw'; } }else{ $num_of_passed_B = 0; foreach($ary_spreadsheet_content as$v){ $_ = explode("\t", $v); $_0 = $_[0]; if(strpos($_0, 'B')!==false and strpos($_0, 'P')!==false){ $num_of_passed_B++; } } echo '目前備取進度: '.$num_of_passed_B.'
'; echo '您的備取號碼: '.$m[1].'
'; $CAT_ID = BACKUP_STUDENT_CAT_ID; if($num_of_passed_B>=$m[1]){ echo'--目前備取已備到,等同錄取-- (您已被通知遞補,若未收到通知信件,請即與我們聯繫 '.$class_contact.'。)
'; $CAT_ID = PASS_FROM_BACKUP_STUDENT_CAT_ID; } } } # $posts = get_posts(array('category'=>$CAT_ID, 'fields'=>'ids','post_status'=>'private')); $post_content = null; if($IS_DEBUG){ echo implode('
',array($CAT_ID,$class_place, $class_num,$class_type)).'
'; } foreach($posts as$post_id){ if($IS_DEBUG){ echo implode('
',array(get_post($post_id)->post_title,get_post_meta($post_id, 'class_place',true), get_post_meta($post_id,'class_num',true), get_post_meta($post_id,'class_type',true))); echo'
'; } if($class_place==get_post_meta($post_id, 'class_place',true) and $class_num==get_post_meta($post_id,'class_num',true) and $class_type==get_post_meta($post_id,'class_type',true) ){ $post = get_post($post_id); if($post){$post_content = $post->post_content;} break; } } if($post_content){ echo$post_content; }else{ echo'No more content.'; } #echo'#'.$status.''; #debug code exit; } ?> Logo

查詢報名審核結果:

(必選) 請選擇報名的班別:


請輸入【報名時】的姓名:

請輸入【報名時】的Email:


PS: 忘記【報名時】的輸入的姓名或Email請來信:
台北聯繫 hi@aiacademy.tw
台中聯繫 tc@aiacademy.tw
南部聯繫 st@aiacademy.tw