load_js('references.js'); $head_content .= '<script type="text/javascript">var langEmptyGroupName = "' . $langEmptyNoteTitle . '";</script>'; $noteNumber = Notes::count_user_notes(); $displayForm = true; /* up and down commands */ if (isset($_GET['down'])) { $thisNoteId = intval(getDirectReference($_GET['down'])); Notes::movedown_note($thisNoteId); redirect_to_home_page('main/notes/index.php'); } if (isset($_GET['up'])) { $thisNoteId = intval(getDirectReference($_GET['up'])); Notes::moveup_note($thisNoteId); redirect_to_home_page('main/notes/index.php'); } /* submit form: new or updated note */ if (isset($_POST['submitNote'])) { $v = new Valitron\Validator($_POST); $v->rule('required', array('newTitle')); $v->labels(array( 'newTitle' => "$langTheField $langTitle" )); if($v->validate()) { $newTitle = $_POST['newTitle']; $newContent = $_POST['newContent']; $refobjid = ($_POST['refobjid'] == "0") ? $_POST['refcourse'] : $_POST['refobjid']; if (!empty($_POST['id'])) { //existing note