$activity_type = $modifyActivity->activity_type; $visible = $modifyActivity->visible; } else { $activity_type = ''; } $gradebookActivityToModify = $id; } else { //new activity $gradebookActivityToModify = ""; $activity_type = ""; $date = date("Y-n-j", time()); } if (!isset($contentToModify)) { $contentToModify = ""; } @($tool_content .= "\n <div class='form-group'>\n <label for='activity_type' class='col-sm-2 control-label'>{$langGradebookType}:</label>\n <div class='col-sm-10'>\n <select name='activity_type' class='form-control'>\n <option value='' " . typeSelected($activity_type, '') . " >-</option>\n <option value='4' " . typeSelected($activity_type, 4) . " >" . $gradebook_exams . "</option>\n <option value='2' " . typeSelected($activity_type, 2) . " >" . $gradebook_labs . "</option>\n <option value='1' " . typeSelected($activity_type, 1) . " >" . $gradebook_oral . "</option>\n <option value='3' " . typeSelected($activity_type, 3) . " >" . $gradebook_progress . "</option>\n <option value='5' " . typeSelected($activity_type, 5) . " >" . $gradebook_other_type . "</option>\n </select>\n </div>\n </div>\n <div class='form-group'>\n <label for='actTitle' class='col-sm-2 control-label'>{$langTitle}:</label>\n <div class='col-sm-10'>\n <input type='text' class='form-control' name='actTitle' value='{$titleToModify}'/>\n </div>\n </div>\n <div class='form-group'>\n <label for='date' class='col-sm-2 control-label'>{$langGradebookActivityDate2}:</label>\n <div class='col-sm-10'>\n <input type='text' class='form-control' name='date' value='" . datetime_remove_seconds($date) . "'/>\n </div>\n </div>\n <div class='form-group'>\n <label for='weight' class='col-sm-2 control-label'>{$langGradebookActivityWeight}:</label>\n <div class='col-sm-10'>\n <input type='text' class='form-control' name='weight' value='{$weight}' size='5' /> (" . weightleft($gradebook_id, '') . " % {$langGradebookActivityWeightLeft})\n </div>\n </div>\n <div class='form-group'>\n <label for='visible' class='col-sm-2 control-label'>{$langGradeVisible}</label>\n <div class='col-sm-10'>\n <input type='checkbox' class='form-control' id='visible' name='visible' value='1'"); if ($visible) { $tool_content .= " checked"; } $tool_content .= " /></div>\n </div>\n <div class='form-group'>\n <label for='actDesc' class='col-sm-2 control-label'>{$langGradebookActivityWeight}:</label>\n <div class='col-sm-10'>\n " . rich_text_editor('actDesc', 4, 20, $contentToModify) . "\n </div>\n </div>"; if (isset($module_auto_id)) { //accept the auto booking mechanism $tool_content .= "<div class='form-group'>\n <label for='weight' class='col-sm-2 control-label'>{$langGradebookInsAut}:</label> \n <div class='col-sm-10'><input type='checkbox' class='form-control' value='1' name='auto' "; if ($auto) { $tool_content .= " checked"; } $tool_content .= "\n /></div>"; } $tool_content .= "<div class='col-sm-offset-2 col-sm-10'>\n <input class='btn btn-primary' type='submit' name='submitGradebookActivity' value='{$langAdd}' />\n </div>"; if (isset($_GET['modify'])) { $tool_content .= "<input type='hidden' name='id' value='" . $gradebookActivityToModify . "' />";
/** * @brief dislay form for adding other activity in gradebook * @global type $tool_content * @global type $course_code * @global type $visible * @global type $langTitle * @global type $langGradebookActivityDate2 * @global type $langGradebookActivityWeight * @global type $langGradeVisible * @global type $langComments * @global type $langGradebookInsAut * @global type $langAdd * @global type $langAdd * @global type $langType * @global type $langGradebookExams * @global type $langGradebookLabs * @global type $langGradebookOral * @global type $langGradebookProgress * @global type $langGradebookOtherType * @param type $gradebook_id */ function add_gradebook_other_activity($gradebook_id) { global $tool_content, $course_code, $visible, $langTitle, $langGradebookActivityDate2, $langGradebookActivityWeight, $langGradeVisible, $langComments, $langGradebookInsAut, $langAdd, $langAdd, $langType, $langGradebookExams, $langGradebookLabs, $langGradebookOral, $langGradebookProgress, $langGradebookOtherType, $langGradebookRemainingGrade, $langSave, $head_content, $language; load_js('bootstrap-datetimepicker'); $head_content .= " <script type='text/javascript'> $(function() { $('#date').datetimepicker({ format: 'dd-mm-yyyy hh:ii', pickerPosition: 'bottom-left', language: '".$language."', autoclose: true }); }); </script>"; $weight_error = Session::getError('weight'); $date_error = Session::getError('date'); $tool_content .= " <div class='row'> <div class='col-sm-12'> <div class='form-wrapper'> <form class='form-horizontal' role='form' method='post' action='$_SERVER[SCRIPT_NAME]?course=$course_code&gradebook_id=" . getIndirectReference($gradebook_id) . "'> <fieldset>"; if (isset($_GET['modify'])) { // modify an existing gradebook activity $id = filter_var(getDirectReference($_GET['modify']), FILTER_VALIDATE_INT); //All activity data (check if it's in this gradebook) $modifyActivity = Database::get()->querySingle("SELECT * FROM gradebook_activities WHERE id = ?d AND gradebook_id = ?d", $id, $gradebook_id); if ($modifyActivity) { $titleToModify = $modifyActivity->title; $contentToModify = $modifyActivity->description; $date = Session::has('date') ? Session::get('date') : $modifyActivity->date; $module_auto_id = $modifyActivity->module_auto_id; $auto = $modifyActivity->auto; $weight = Session::has('weight') ? Session::get('title') : $modifyActivity->weight; $activity_type = $modifyActivity->activity_type; $visible = $modifyActivity->visible; } else { $activity_type = ''; } $gradebookActivityToModify = $id; } else { //new activity $gradebookActivityToModify = ""; $activity_type = ""; $date = date("Y-n-j", time()); $visible = 1; } if (!isset($contentToModify)) $contentToModify = ""; @$tool_content .= " <div class='form-group'> <label for='activity_type' class='col-sm-2 control-label'>$langType:</label> <div class='col-sm-10'> <select name='activity_type' class='form-control'> <option value='' " . typeSelected($activity_type, '') . " >-</option> <option value='4' " . typeSelected($activity_type, 4) . " >" . $langGradebookExams . "</option> <option value='2' " . typeSelected($activity_type, 2) . " >" . $langGradebookLabs . "</option> <option value='1' " . typeSelected($activity_type, 1) . " >" . $langGradebookOral . "</option> <option value='3' " . typeSelected($activity_type, 3) . " >" . $langGradebookProgress . "</option> <option value='5' " . typeSelected($activity_type, 5) . " >" . $langGradebookOtherType . "</option> </select> </div> </div> <div class='form-group'> <label for='actTitle' class='col-sm-2 control-label'>$langTitle:</label> <div class='col-sm-10'> <input type='text' class='form-control' name='actTitle' value='".q($titleToModify)."'/> </div> </div> <div class='form-group".($date_error ? " has-error" : "")."'> <label for='date' class='col-sm-2 control-label'>$langGradebookActivityDate2:</label> <div class='col-sm-10'> <input type='text' class='form-control' name='date' id='date' value='" . datetime_remove_seconds($date) . "'/> <span class='help-block'>$date_error</span> </div> </div> <div class='form-group".($weight_error ? " has-error" : "")."'> <label for='weight' class='col-sm-2 control-label'>$langGradebookActivityWeight:</label> <div class='col-sm-10'> <input type='text' class='form-control' name='weight' value='$weight' size='5'> <span class='help-block'>". ($weight_error ? $weight_error : "($langGradebookRemainingGrade: " . weightleft($gradebook_id, '') . "%)")."</span> </div> </div> <div class='form-group'> <label for='visible' class='col-sm-2 control-label'>$langGradeVisible:</label> <div class='col-sm-10'> <input type='checkbox' id='visible' name='visible' value='1'"; if ($visible == 1) { $tool_content .= " checked"; } $tool_content .= " /></div> </div> <div class='form-group'> <label for='actDesc' class='col-sm-2 control-label'>$langComments:</label> <div class='col-sm-10'> " . rich_text_editor('actDesc', 4, 20, $contentToModify) . " </div> </div>"; if (isset($module_auto_id) && $module_auto_id != 0) { //accept the auto booking mechanism $tool_content .= "<div class='form-group'> <label for='weight' class='col-sm-2 control-label'>$langGradebookInsAut:</label> <div class='col-sm-10'><input type='checkbox' value='1' name='auto' "; if ($auto) { $tool_content .= " checked"; } $tool_content .= "/></div></div>"; } $tool_content .= "<div class='form-group'> <div class='col-sm-10 col-sm-offset-2'>".form_buttons(array( array( 'text' => $langSave, 'name' => 'submitGradebookActivity', 'value'=> $langAdd ), array( 'href' => "$_SERVER[SCRIPT_NAME]?course=$course_code" ) ))."</div></div>"; if (isset($_GET['modify'])) { $tool_content .= "<input type='hidden' name='id' value='" . getIndirectReference($gradebookActivityToModify) . "'>"; } else { $tool_content .= " <input type='hidden' name='id' value='' >"; } $tool_content .= "</fieldset> ". generate_csrf_token_form_field() ." </form> </div> </div> </div>"; }