<?php $uid = $_SESSION['uid']; $post_cid = isset($_POST['post_cid']) ? $_POST['post_cid'] : ''; $post_course = course_load($post_cid); $cid = isset($_POST['cid']) ? $_POST['cid'] : ''; $week = isset($_POST['week']) ? $_POST['week'] : ''; $title = isset($_POST['title']) ? $_POST['title'] : ''; $url = isset($_POST['url']) ? $_POST['url'] : ''; $body = isset($_POST['body']) ? $_POST['body'] : ''; $answer = isset($_POST['answer']) ? $_POST['answer'] : ''; if (isset($_POST['submit'])) { create_post($uid, $cid, $week, $title, $url, $body, $answer); if (mysql_affected_rows($link) == 1) { sleep(1); header('location: ' . currentURL() . '?p=post'); print 'Post created. Click <a href="?p=post">here</a> to view created posts'; } else { print 'Post not created'; } } ?> <link rel="stylesheet" type="text/css" href="markitup/skins/markitup/style.css" /> <link rel="stylesheet" type="text/css" href="markitup/sets/html/style.css" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="markitup/jquery.markitup.js"></script> <script type="text/javascript" src="markitup/sets/html/set.js"></script> <script language="javascript"> $(document).ready(function() { $('#body').markItUp(myHtmlSettings); $('#answer').markItUp(myHtmlSettings);
$body_class = 'course'; } elseif (in_array($p, $course_week_paths)) { $cid = $course_week['cid']; $course = course_load($cid); $title = $course['Course_Code'] . ': ' . $course['Course_Name'] . (isset($_SESSION['uid']) && $course['User_ID'] == $_SESSION['uid'] ? ' - You are coordinator' : '') . ' - Week ' . $course_week['week']; $body_class = 'course week'; } elseif ($p == 'sitemap') { $title = 'Sitemap'; $body_class = 'sitemap'; } elseif ($p == 'terms-and-conditions') { $title = 'Terms and Conditions'; $body_class = 'terms'; } else { $title = '404 page not found'; $body_class = 'not-found'; } if (in_array($p, $course_paths)) { $course = course_load($cid); $body_class .= ' cid-' . $course['Course_ID']; } if (in_array($p, $course_week_paths)) { $cid = $course_week['cid']; $course = course_load($cid); $body_class .= ' cid-' . $cid . ' week-' . $course_week['week']; } if (isset($_SESSION['rid'])) { $site_name = '[Logged in] Online KMS'; } else { $site_name = 'Online KMS'; } $meta_description = 'Online Knowledge Management System' . (isset($post) ? ' - ' . $post['Post_Title'] . ': ' . $post['Post_Question'] : (isset($course) ? ' - ' . $course['Course_Code'] . ': ' . $course['Course_Name'] : ' - ' . $title));
function chart_questions_per_week($cid = 0) { $output = ''; $course = course_load($cid); $weeks = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'); $output .= '<div id="chart_course_week">'; $output .= select_course('cid', $cid); $output .= '<h2>Number of questions per week of ' . ($cid == 0 ? 'all courses' : '"' . $course['Course_Name'] . '"') . '</h2>'; $output .= '<div id="mychart" style="width: 1024px; min-height: 320px;"></div>'; $output .= '</div>'; $output .= '<script> (function() { YUI().use("charts-legend", function (Y) { var myDataValues = [ '; for ($i = 0; $i < count($weeks); $i++) { $output .= ' {week: "Week ' . $weeks[$i] . '", "Questions": ' . ($cid != 0 ? count_posts_by_course_week($cid, $weeks[$i]) : count_posts_by_week($weeks[$i])) . ', "Likes": ' . ($cid != 0 ? count_post_likes_by_course_week($cid, $weeks[$i]) : count_post_likes_by_week($weeks[$i])) . ', "Dislikes": ' . ($cid != 0 ? count_post_dislikes_by_course_week($cid, $weeks[$i]) : count_post_dislikes_by_week($weeks[$i])) . ', "Follows": ' . ($cid != 0 ? count_post_follows_by_course_week($cid, $weeks[$i]) : count_post_follows_by_week($weeks[$i])) . ', "Comments": ' . ($cid != 0 ? count_comments_by_course_week($cid, $weeks[$i]) : count_comments_by_week($weeks[$i])) . ($i != count($weeks) - 1 ? '},' : '}'); } $output .= ' ]; var myAxes = { values:{ position:"left", type:"numeric", maximum: "NumericAxis", minimum: 0, roundingMethod: "niceNumber", alwaysShowZero:true } }; var mychart = new Y.Chart({ legend: { position: "right", width: 350, height: 350, styles: { hAlign: "center", hSpacing: 4 } }, dataProvider:myDataValues, render:"#mychart", type: "column", axes:myAxes, interactionType:"marker", horizontalGridlines: { styles: { line: { color: "#dad8c9" } } }, verticalGridlines: { styles: { line: { color: "#dad8c9" } } }, //styles: styleDef, categoryKey:"week", tooltip: { styles: { backgroundColor: "#414042", color: "#fff", borderColor: "#fff", textAlign: "center" } } }); }); })(); </script>'; $output .= '<script> $("select#cid").change(function(){ $("#chart_course_week").load("triggers/chart_course_week.php",{cid:$(this).val(),report_type:"Number of questions per week"}); }); </script>'; return $output; }