if (DeletePrompt(_('Poll'))) { DBQuery("DELETE FROM PORTAL_POLLS WHERE ID='{$_REQUEST['id']}'"); DBQuery("DELETE FROM PORTAL_POLL_QUESTIONS WHERE PORTAL_POLL_ID='{$_REQUEST['id']}'"); unset($_REQUEST['modfunc']); } } if ($_REQUEST['modfunc'] != 'remove') { $sql_questions = "SELECT ppq.ID,ppq.PORTAL_POLL_ID,ppq.OPTIONS,ppq.VOTES,ppq.QUESTION,ppq.TYPE FROM PORTAL_POLL_QUESTIONS ppq, PORTAL_POLLS pp WHERE pp.SCHOOL_ID='" . UserSchool() . "' AND pp.SYEAR='" . UserSyear() . "' AND pp.ID=ppq.PORTAL_POLL_ID ORDER BY ppq.ID"; $QI_questions = DBQuery($sql_questions); $questions_RET = DBGet($QI_questions, array('OPTIONS' => '_makeOptionsInput')); $sql = "SELECT pp.ID,pp.SORT_ORDER,pp.TITLE,'See_PORTAL_POLL_QUESTIONS' AS OPTIONS, pp.VOTES_NUMBER,pp.START_DATE,pp.END_DATE,pp.PUBLISHED_PROFILES,pp.STUDENTS_TEACHER_ID,CASE WHEN pp.END_DATE IS NOT NULL AND pp.END_DATE<CURRENT_DATE THEN 'Y' ELSE NULL END AS EXPIRED FROM PORTAL_POLLS pp WHERE pp.SCHOOL_ID='" . UserSchool() . "' AND pp.SYEAR='" . UserSyear() . "' ORDER BY EXPIRED DESC,pp.SORT_ORDER,pp.PUBLISHED_DATE DESC"; $QI = DBQuery($sql); $polls_RET = DBGet($QI, array('TITLE' => '_makeTextInput', 'OPTIONS' => '_makeOptionsInputs', 'VOTES_NUMBER' => '_makePollVotes', 'SORT_ORDER' => '_makeTextInput', 'START_DATE' => '_makePublishing')); $columns = array('TITLE' => _('Title'), 'OPTIONS' => _('Poll'), 'VOTES_NUMBER' => _('Results'), 'SORT_ORDER' => _('Sort Order'), 'START_DATE' => _('Publishing Options')); //,'START_TIME'=>'Start Time','END_TIME'=>'End Time' $link['add']['html'] = array('TITLE' => _makeTextInput('', 'TITLE'), 'OPTIONS' => _makeOptionsInputs('', 'OPTIONS'), 'VOTES_NUMBER' => _makePollVotes('', 'VOTES_NUMBER'), 'SHORT_NAME' => _makeTextInput('', 'SHORT_NAME'), 'SORT_ORDER' => _makeTextInput('', 'SORT_ORDER'), 'START_DATE' => _makePublishing('', 'START_DATE')); $link['remove']['link'] = 'Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=remove'; $link['remove']['variables'] = array('id' => 'ID'); echo '<FORM action="Modules.php?modname=' . $_REQUEST[modname] . '&modfunc=update" method="POST">'; DrawHeader('', SubmitButton(_('Save'))); //modif Francois: fix SQL bug invalid sort order if (isset($error)) { echo $error; } ListOutput($polls_RET, $columns, 'Poll', 'Polls', $link); echo '<span class="center">' . SubmitButton(_('Save')) . '</span>'; echo '</FORM>'; } function _makeTextInput($value, $name) { global $THIS_RET;
} DrawBC("School Setup > " . ProgramTitle()); if (clean_param($_REQUEST['modfunc'], PARAM_ALPHAMOD) == 'remove' && AllowEdit()) { if (DeletePrompt_Portal('message')) { // echo paramlib_validation($column=SORT_ORDER,$_REQUEST[id]); exit; DBQuery('DELETE FROM portal_notes WHERE ID=\'' . paramlib_validation($column = SORT_ORDER, $_REQUEST[id]) . '\''); unset($_REQUEST['modfunc']); } } if ($_REQUEST['modfunc'] != 'remove') { $sql = 'SELECT ID,SORT_ORDER,TITLE,CONTENT,START_DATE,END_DATE,PUBLISHED_PROFILES,CASE WHEN END_DATE IS NOT NULL AND END_DATE<CURRENT_DATE THEN \'Y\' ELSE NULL END AS EXPIRED FROM portal_notes WHERE (SCHOOL_ID=\'' . UserSchool() . '\' OR SCHOOL_ID IS NULL) AND SYEAR=\'' . UserSyear() . '\' ORDER BY EXPIRED DESC,SORT_ORDER,PUBLISHED_DATE DESC'; $QI = DBQuery($sql); $notes_RET = DBGet($QI, array('TITLE' => '_makeTextInput', 'CONTENT' => '_makeContentInput', 'SORT_ORDER' => '_makeTextInput', 'START_DATE' => '_makePublishing')); $columns = array('TITLE' => 'Title', 'CONTENT' => 'Note', 'SORT_ORDER' => 'Sort Order', 'START_DATE' => 'Publishing Options'); //,'START_TIME'=>'Start Time','END_TIME'=>'End Time' $link['add']['html'] = array('TITLE' => _makeTextInput('', 'TITLE'), 'CONTENT' => _makeContentInput('', 'CONTENT'), 'SHORT_NAME' => _makeTextInput('', 'SHORT_NAME'), 'SORT_ORDER' => _makeTextInput('', 'SORT_ORDER'), 'START_DATE' => _makePublishing('', 'START_DATE')); $link['remove']['link'] = "Modules.php?modname={$_REQUEST['modname']}&modfunc=remove"; $link['remove']['variables'] = array('id' => 'ID'); echo "<FORM name=F2 id=F2 action=Modules.php?modname={$_REQUEST['modname']}&modfunc=update method=POST>"; #DrawHeader('',SubmitButton('Save')); ListOutput($notes_RET, $columns, 'Note', 'Notes', $link); echo '<br><CENTER>' . SubmitButton('Save', '', 'class=btn_medium onclick="formcheck_school_setup_portalnotes();"') . '</CENTER>'; echo '</FORM>'; } function _makeTextInput($value, $name) { global $THIS_RET; if ($THIS_RET['ID']) { $id = $THIS_RET['ID']; } else { $id = 'new';
DBQuery("DELETE FROM PORTAL_NOTES WHERE ID='{$_REQUEST['id']}'"); //modif Francois: Moodle integrator if (MOODLE_INTEGRATOR) { $moodleError = Moodle($_REQUEST['modname'], 'core_notes_delete_notes'); } unset($_REQUEST['modfunc']); } } if ($_REQUEST['modfunc'] != 'remove') { //modif Francois: file attached to portal notes $sql = "SELECT ID,SORT_ORDER,TITLE,CONTENT,START_DATE,END_DATE,PUBLISHED_PROFILES,FILE_ATTACHED,CASE WHEN END_DATE IS NOT NULL AND END_DATE<CURRENT_DATE THEN 'Y' ELSE NULL END AS EXPIRED FROM PORTAL_NOTES WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "' ORDER BY EXPIRED DESC,SORT_ORDER,PUBLISHED_DATE DESC"; $QI = DBQuery($sql); $notes_RET = DBGet($QI, array('TITLE' => '_makeTextInput', 'CONTENT' => '_makeContentInput', 'SORT_ORDER' => '_makeTextInput', 'FILE_ATTACHED' => '_makeFileAttached', 'START_DATE' => '_makePublishing')); $columns = array('TITLE' => _('Title'), 'CONTENT' => _('Note'), 'SORT_ORDER' => _('Sort Order'), 'FILE_ATTACHED' => _('File Attached'), 'START_DATE' => _('Publishing Options')); //,'START_TIME'=>'Start Time','END_TIME'=>'End Time' $link['add']['html'] = array('TITLE' => _makeTextInput('', 'TITLE'), 'CONTENT' => _makeContentInput('', 'CONTENT'), 'SHORT_NAME' => _makeTextInput('', 'SHORT_NAME'), 'SORT_ORDER' => _makeTextInput('', 'SORT_ORDER'), 'FILE_ATTACHED' => _makeFileAttached('', 'FILE_ATTACHED'), 'START_DATE' => _makePublishing('', 'START_DATE')); $link['remove']['link'] = "Modules.php?modname={$_REQUEST['modname']}&modfunc=remove"; $link['remove']['variables'] = array('id' => 'ID'); echo '<FORM action="Modules.php?modname=' . $_REQUEST[modname] . '&modfunc=update" method="POST" enctype="multipart/form-data">'; DrawHeader('', SubmitButton(_('Save'))); //modif Francois: fix SQL bug invalid sort order if (isset($error)) { echo $error; } //modif Francois: Moodle integrator echo $moodleError; if (!empty($PortalNotesFilesError)) { echo ErrorMessage(array($PortalNotesFilesError)); } ListOutput($notes_RET, $columns, 'Note', 'Notes', $link); echo '<BR /><span class="center">' . SubmitButton(_('Save')) . '</span>';