<?php $cid = isset($_POST['cid']) ? $_POST['cid'] : 0; print select_course('cid', $cid); print '<div id="admin_post_section">'; print list_posts($cid, 10, 1); print '</div>'; ?> <script type="text/javascript"> $("select#cid").change(function(){ $("#admin_post_section").load("triggers/admin_post.php",{cid:$(this).val(),count:10,page:1}); }); </script>
<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); }); </script> <form id="form" method="post" action=""> <table> <tr id="course"> <td><label for="title">Course:</label></td> <td><?php print isset($_POST['post_cid']) ? $post_course['Course_Name'] . '<input type="hidden" name="cid" value="' . $post_cid . '" />' : select_course('cid'); ?> </td> </tr> <tr id="week"> <td><label for="title">Week:</label></td> <td><?php print select_week('week'); ?> </td> </tr> <tr> <td><label for="title">Title:</label></td> <td><input type="text" name="title" size="60" maxlength="128" class="required" /></td> </tr> <tr>
<script language="javascript"> $(document).ready(function() { //$('#body').markItUp(myHtmlSettings); //$('#answer').markItUp(myHtmlSettings); }); </script> <form id="form" method="post" action=""> <input type="hidden" name="pid" value="<?php print $pid; ?> "/> <table> <tr id="course"> <td><label for="type">Course:</label></td> <td><?php print select_course('cid', $old_cid); ?> </td> </tr> <tr id="week"> <td><label for="type">Week:</label></td> <td><?php print select_week('week', $old_week); ?> </td> </tr> <tr style="display:none"> <td><label for="title">Title:</label></td> <td><input type="text" name="title" value="<?php print $old_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; }