5000) { show_old_subject($id); exit; } //limited_access: step 2 if(!is_local_testing() && !can_access_member_page(18)) { exit; } if(isset($_REQUEST['comment'])) { add_user_comment($id, 1, $_REQUEST['comment']); } if(!validate_id($id) || !cross_level_check(3, $id)) { show_restricted_access(); exit; } //for guest juggling around: if(is_guest()) { $exam_guide_id = get_exam_guide_id_by_sub_id($id); set_up_exam_guide_id_for_guest($exam_guide_id); } increment_access_score(4); //Now: if(should_redirect_to_payment()) { print_package("study_los.php?id=$id"); exit; } $custom_js = get_study_los_jquery_js($id); $user = $_SESSION['user']; $sub_row = get_subject_info_from_subid($id); if(is_restricted_user() && $sub_row['substatus'] == 1) { show_restricted_access(); exit; } $los_value = ""; $los_notes = ""; $year = $user['exam_year']; $level_label = get_exam_name_for_user(); $los_result = do_mysqli_query("select l.value, l.notes from los_main l, los_subject ls where ls.losid = l.id and ls.subid = " . $id); if($los_row = mysqli_fetch_array($los_result)) { $los_value = $los_row['value']; $los_notes = "CFA® $level_label Curriculum, " . $los_row['notes']; } $tweeter_text = "CFA Study Notes for $level_label - Topic " . $sub_row['ssnumber'] . ". Learning Module " . $sub_row['rnumber'] . ". LOS " . $los_value; //bq: $query = "select count(bqid) as count from basic_question where subid = $id"; if(!grant_access_based_on_region($user['ip'])) { $query = $query . " and source not like 'CFAI%'"; } $num_bq = get_count($query); //user complete subject and bookmark. $complete_status = 0; $bookmark = 0; if (!(is_paid_user_qb() && $sub_row['substatus'] == 1) && is_logged_on()) {//don't even show these 2 options if the content is not shown. $query = "select status, bookmark from sub_user_assgnmt where subid = " . $id . " and userId = " . $user['id']; $result = do_mysqli_query($query); if(mysqli_num_rows($result) != 0) { $rowsua = mysqli_fetch_array($result); $complete_status = $rowsua['status']; $bookmark = $rowsua['bookmark']; } } $private_note = get_private_note($id, 2); //social buttons: if(strlen($tweeter_text) > 108) { $tweeter_text = substr($tweeter_text, 0, 108) . " ...."; } //next and previous: if($sub_row['subnumber'] > 1) { $previousId = get_subject_id($sub_row['rid'], $sub_row['subnumber'], "<"); } $nextId = get_subject_id($sub_row['rid'], $sub_row['subnumber'], ">"); //links: $link_study_all = build_study_all_link(); $link_topic = build_topic_link_title($sub_row['ssid']); $link_module = build_module_link_title($sub_row['rid']); $canonical_link = build_subject_link_title_from_subid($id); $last_item = "Subject " . $sub_row['subnumber'] . ". " . $sub_row['subvalue']; $breadcrumb = array(array($link_study_all, $level_label), array($link_topic, "Topic " . $sub_row['ssnumber'] . ". " . $sub_row['ssvalue']), array($link_module, "Learning Module " . $sub_row['rnumber'] . ". " . $sub_row['rvalue']), array("", $last_item)); print_page_header("CFA Study Preparation", $canonical_link); print_breadcrumb($breadcrumb); print_study_los_page(); function print_los_action_links() { global $num_bq, $id, $previousId, $nextId, $complete_status, $bookmark, $private_note; print_card_start_with_header("Actions"); echo ""; print_los_action_msgs('l'); print_card_end(); } function get_subid_from_html() { $id = -1;//subid. if(isset($_REQUEST['id'])) { $id = $_REQUEST['id']; } else if (isset($_REQUEST['lostitle'])) { $id = get_subid_from_link($_REQUEST['lostitle']); } else if (isset($_REQUEST['subtitle'])) { $id = get_subid_from_link($_REQUEST['subtitle']); } return $id; } function get_subid_from_link($los_title) { $los_title = clean_ip_html_title($los_title); if(empty($los_title)) { return 0; } $id_clause = get_sub_id_clause(); $query = "select subid as id from subject where link = ? $id_clause"; $subid = get_study_id_by_link_dbo($query, $los_title); if($subid == 0 && is_guest()) { $query = "select subid as id from subject where link = ?"; $subid = get_study_id_by_link_dbo($query, $los_title); } if($subid == 0) { $query = "select subid as id from old_subject where link = ?"; $subid = get_study_id_by_link_dbo($query, $los_title); } return $subid; } function get_sub_id_clause() { $exam_guide_id = get_user_exam_guide_id(); $min_subid = $exam_guide_id * 1000 - 1000; return " and subid > $min_subid and subid < " . ($min_subid + 1000); } function get_subject_id($rid, $number, $sign) { $query = "select subid as id from subject where rid = $rid and number $sign $number"; $query = $query . " order by number"; if($sign == "<") { $query = $query . " desc"; } else { $query = $query . " asc"; } $id = 0; $result = do_mysqli_query($query); if(mysqli_num_rows($result) > 0) { $id = do_mysqli_result($result, "id"); } return $id; } function show_old_subject($id) { global $canonical_link; $query = "select * from old_subject where subid = $id"; $result = do_mysqli_query($query); if(mysqli_num_rows($result) != 1) { show_user_error(); return; } $subject = mysqli_fetch_array($result); do_mysqli_query("update old_subject set visit = visit + 1 where subid = $id"); $query = "select * from old_reading where rid = " . $subject['rid']; $result = do_mysqli_query($query); $reading = mysqli_fetch_array($result); $breadcrumb = array(array("cfa-learning-module-" . $reading['link'] . ".html", $reading['title']), array("", $subject['title'])); print_page_header("Learning Outcome Statements", $canonical_link); print_breadcrumb($breadcrumb); print_container_start(); //main: print_main_section_start_with_card_header("Subject " . $subject['title'], "edit"); print_card_block(cleanup_notes_html($subject['answer'])); $query = "select * from old_question where subid = $id"; $result = do_mysqli_query($query); $counter = 0; while($row = mysqli_fetch_array($result)) { $counter++; $question_value = "

Practice Question $counter

"; $question_value = "

" . $question_value . $row['value'] . "

"; $question_value = "

" . $question_value . $row['answer'] . "

"; print_card_block($question_value); } print_card_section_end(); //side_column print_side_section_start(); print_rotating_image(); print_side_study_title_only("Study notes from a previous year's CFA exam:

" . $subject['title']); print_side_section_end(); print_container_end(); print_footer(); } function get_study_los_jquery_js($id) { if(is_guest()) { return ""; } //the add note function did not work in safari and firefox. Indian helped. return ""; } ?>