Beispiel #1
0
     $mentor_session_2 = filter_input(INPUT_POST, 'mentor_session_2');
     $mentor_session_3 = filter_input(INPUT_POST, 'mentor_session_3');
     $mentor_session_4 = filter_input(INPUT_POST, 'mentor_session_4');
     $mentor_sessions = [$mentor_session_1, $mentor_session_2, $mentor_session_3, $mentor_session_4];
     // The user either pressed Add or Cancel.
     // If Add, then add the mentor.
     // Otherwise, just skip down to the list redraw.
     if ($choice == 'Add') {
         add_mentor($mentor_last_name, $mentor_first_name, $mentor_suffix, $mentor_field, $mentor_position, $mentor_company, $mentor_profile, $mentor_keywords, $pres_room, $pres_host_teacher, $pres_max_capacity, $mentor_sessions);
     }
     $mentorList = get_mentor_list();
     echo 'Mentor Added. Close inner page and refresh to see changes.';
     break;
 case 'show_modify_mentor':
     $mentor_id = filter_input(INPUT_GET, 'mentor_id');
     $mentor = get_mentor($mentor_id);
     $mentor_first_name = $mentor['mentor_first_name'];
     $mentor_last_name = $mentor['mentor_last_name'];
     $mentor_suffix = $mentor['mentor_suffix'];
     $mentor_field = $mentor['mentor_field'];
     $mentor_position = $mentor['mentor_position'];
     $mentor_company = $mentor['mentor_company'];
     $mentor_profile = $mentor['mentor_profile'];
     $mentor_keywords = $mentor['mentor_keywords'];
     $pres_room = $mentor['pres_room'];
     $pres_host_teacher = $mentor['pres_host_teacher'];
     $pres_max_capacity = $mentor['pres_max_capacity'];
     $mentor_sessions_check = [false, false, false, false];
     for ($i = 1; $i <= 4; $i++) {
         if (!empty(get_presentation_by_mentor_session($mentor_id, $i))) {
             $mentor_sessions_check[$i - 1] = true;
                save($mapFile, $saveContent, "a+");
                //echo "save $saveContent\n";
                /*抓取论文摘要内容*/
                $content = $httpClient->quickGet($contentUrl);
                $contentSize = strlen($content);
                if ($contentSize > 300) {
                    save($cachedHtml, $content);
                } else {
                    fakeSleep();
                }
            } while ($contentSize < 300);
        } else {
            $sleep = false;
            echo "Hit\n";
            $content = file_get_contents($localedCachedHtml);
            if (strlen($content) < 300) {
                delFile($cachedHtml);
                echo "Empty abstract file \n";
            }
            continue;
        }
        $keyWords = get_key_words($content);
        $keyWords .= "#" . get_mentor($content) . "#" . get_major($content);
        $abs = get_paper_abs($content);
        save("{$absPath}", $keyWords . "\n" . $abs);
        if ($sleep && false) {
            fastSleep();
        }
    }
    fclose($fp);
}