/** * display the form to edit answers * * @param $exId exercise id, required to get stay in the exercise context if required after posting the form * @param $askDuplicate display or not the form elements allowing to choose if the question must be duplicated or modified in all exercises * @author Sebastien Piraux <*****@*****.**> * @return string html code for display of answer edition form */ public function getFormHtml($exId = null, $askDuplicate) { $html = '<form method="post" action="./edit_answers.php?exId=' . $exId . '&quId=' . $this->questionId . '">' . "\n" . '<input type="hidden" name="cmd" value="exEdit" />' . "\n" . '<input type="hidden" name="answerCount" value="' . count($this->answerList) . '" />' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . claro_form_relay_context() . "\n"; if ($this->multipleAnswer) { // warn course admin that if the user checks all answer he will have the sum of all wieghting values $html .= '<p><small>' . get_lang('Use negative weighting for incorrect choices to penalize a user that check all answers.') . '</small></p>' . "\n"; } if (!empty($exId) && $askDuplicate) { $html .= '<p>' . html_ask_duplicate() . '</p>' . "\n"; } $html .= '<table class="claroTable" >' . "\n" . '<thead>' . '<tr>' . "\n" . '<th>' . get_lang('Expected choice') . '</th>' . "\n" . '<th>' . get_lang('Answer') . '</th>' . "\n" . '<th>' . get_lang('Comment') . '</th>' . "\n" . '<th>' . get_lang('Weighting') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n"; $i = 1; foreach ($this->answerList as $answer) { $html .= '<tr>' . "\n" . '<td valign="top" align="center">'; if ($this->multipleAnswer) { $html .= '<input name="correct_' . $i . '" id="correct_' . $i . '" ' . ($answer['correct'] ? 'checked="checked"' : '') . ' type="checkbox" value="1" />'; } else { $html .= '<input name="correct" id="correct_' . $i . '" ' . ($answer['correct'] ? 'checked="checked"' : '') . ' type="radio" value="correct_' . $i . '" />'; } $html .= '</td>' . "\n" . '<td valign="top">' . claro_html_textarea_editor('answer_' . $i, $answer['answer'], 10, 25, '', 'simple') . '</td>' . "\n" . '<td>' . claro_html_textarea_editor('comment_' . $i, $answer['comment'], 10, 25, '', 'simple') . '</td>' . "\n" . '<td valign="top">' . '<input name="grade_' . $i . '" size="5" value="' . claro_htmlspecialchars($answer['grade']) . '" type="text" />' . '</td>' . "\n" . '</tr>' . "\n\n"; $i++; } $html .= '<tr>' . "\n" . '<td colspan="4" align="center">' . '<input type="submit" name="cmdOk" value="' . get_lang('Ok') . '" /> ' . '<input type="submit" name="cmdRemAnsw" value="' . get_lang('Rem. answ.') . '" /> ' . '<input type="submit" name="cmdAddAnsw" value="' . get_lang('Add answ.') . '" /> ' . claro_html_button(Url::Contextualize('./edit_question.php?exId=' . $exId . '&quId=' . $this->questionId), get_lang("Cancel")) . '</td>' . "\n" . '</tr>' . "\n\n" . '</table>' . "\n\n" . '</form>' . "\n\n"; return $html; }
// Tool list $toolList = array(); if ($is_allowedToEdit) { $toolList[] = array('img' => 'quiz_new', 'name' => get_lang('New category'), 'url' => claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?cmd=add'))); } $out = ''; $out .= $dialogBox->render(); $out .= claro_html_tool_title($nameTools, null, $toolList); if ($displayForm) { $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" >' . "\n\n" . claro_form_relay_context() . '<input type="hidden" name="cmd" value="exEdit" />' . "\n" . '<input type="hidden" name="catId" value="' . $catId . '" />' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n"; $out .= '<table border="0" cellpadding="5">' . "\n"; //-- // title $out .= '<tr>' . "\n" . '<td valign="top"><label for="title">' . get_lang('Title') . ' <span class="required">*</span> :</label></td>' . "\n" . '<td><input type="text" name="title" id="title" size="60" maxlength="200" value="' . $form['title'] . '" /></td>' . "\n" . '</tr>' . "\n\n"; // description $out .= '<tr>' . "\n" . '<td valign="top"><label for="description">' . get_lang('Description') . ' :</label></td>' . "\n" . '<td>' . claro_html_textarea_editor('description', $form['description']) . '</td>' . "\n" . '</tr>' . "\n\n"; //-- $out .= '<tr>' . "\n" . '<td> </td>' . "\n" . '<td><small>' . get_lang('<span class="required">*</span> denotes required field') . '</small></td>' . "\n" . '</tr>' . "\n\n"; //-- buttons $out .= '<tr>' . "\n" . '<td> </td>' . "\n" . '<td>' . '<input type="submit" name="" id="" value="' . get_lang('Ok') . '" /> ' . claro_html_button(Url::Contextualize($_SERVER['PHP_SELF']), get_lang("Cancel")) . '</td>' . "\n" . '</tr>' . "\n\n"; $out .= '</table>' . "\n\n" . '</form>' . "\n\n"; } //-- pager $out .= $myPager->disp_pager_tool_bar($_SERVER['PHP_SELF']); //-- list $out .= '<table class="claroTable emphaseLine" border="0" align="center" cellpadding="2" cellspacing="2" width="100%">' . "\n\n" . '<thead>' . "\n" . '<tr>' . "\n" . '<th>' . get_lang('Title') . '</th>' . "\n"; $colspan = 1; if ($is_allowedToEdit) { $out .= '<th>' . get_lang('Modify') . '</th>' . "\n" . '<th>' . get_lang('Delete') . '</th>' . "\n"; $colspan = 3; }
/** * Enhance a simple textarea with an inline html editor. * * @param string $name name attribute for <textarea> tag * @param string $content content to prefill the area * @param integer $rows count of rows for the displayed editor area * @param integer $cols count of columns for the displayed editor area * @param string $optAttrib optional - additionnal tag attributes * (wrap, class, ...) * @return string html output for standard textarea or Wysiwyg editor * * @deprecated would be removed after 1.8 * @see claro_html_textarea_editor * */ function claro_disp_html_area($name, $content = '', $rows = 20, $cols = 80, $optAttrib = '') { pushClaroMessage((function_exists('claro_html_debug_backtrace') ? claro_html_debug_backtrace() : 'claro_html_debug_backtrace() not defined') . 'claro_disp_textarea_editor() is deprecated , use claro_html_textarea_editor()', 'error'); // becomes a alias while the function call is not replaced by the new one return claro_html_textarea_editor($name, $content, $rows, $cols, $optAttrib); }
} $nameTools = get_lang('Create/edit document'); $out = ''; $out .= claro_html_tool_title(array('mainTitle' => get_lang('Documents and Links'), 'subTitle' => get_lang('Create/edit document'))); /*======================================================================== CREATE DOCUMENT ========================================================================*/ if ($cmd == 'rqMkHtml') { $out .= '<form action="' . claro_htmlspecialchars(get_module_entry_url('CLDOC')) . '" method="post">' . "\n" . claro_form_relay_context() . "\n" . '<input type="hidden" name="cmd" value="exMkHtml" />' . "\n" . '<input type="hidden" name="cwd" value="' . claro_htmlspecialchars(strip_tags($cwd)) . '" />' . "\n" . '<p>' . "\n" . '<b>' . get_lang('Document name') . ' : </b><br />' . "\n" . '<input type="text" name="fileName" size="80" />' . "\n" . '</p>' . "\n" . '<p>' . "\n" . '<b>' . get_lang('Document content') . ' : </b>' . "\n"; if (!empty($_REQUEST['htmlContent'])) { $content = $_REQUEST['htmlContent']; } else { $content = ""; } $out .= claro_html_textarea_editor('htmlContent', $content); // the second argument _REQUEST['htmlContent'] for the case when we have to // get to the editor because of an error at creation // (eg forgot to give a file name) $out .= '</p>' . "\n" . '<p>' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" /> ' . claro_html_button(claro_htmlspecialchars(Url::Contextualize('./document.php?cmd=exChDir&file=' . strip_tags($cwd))), get_lang('Cancel')) . '</p>' . "\n" . '</form>' . "\n"; } elseif ($cmd == "rqEditHtml" && !empty($file)) { if (is_parent_path($baseWorkDir, $file)) { $fileContent = implode("\n", file($baseWorkDir . $file)); } else { claro_die('WRONG PATH'); } $fileContent = get_html_body_content($fileContent); $out .= '<form action="' . claro_htmlspecialchars(get_module_entry_url('CLDOC')) . '" method="post">' . "\n" . claro_form_relay_context() . "\n" . '<input type="hidden" name="cmd" value="exEditHtml" />' . "\n" . '<input type="hidden" name="file" value="' . claro_htmlspecialchars(base64_encode($file)) . '" />' . "\n" . '<b>' . get_lang('Document name') . ' : </b><br />' . "\n" . $file . "\n" . '</p>' . "\n" . '<p>' . "\n" . '<b>' . get_lang('Document content') . ' : </b>' . "\n" . claro_html_textarea_editor('htmlContent', $fileContent) . "\n" . '</p>' . '<p>' . '<input type="submit" value="' . get_lang('Ok') . '" /> ' . "\n" . claro_html_button(claro_htmlspecialchars(Url::Contextualize('./document.php?cmd=rqEdit&file=' . base64_encode($file))), get_lang('Cancel')) . "\n" . '</p>' . "\n" . '</form>' . "\n"; } $out .= '<br />' . "\n" . '<br />' . "\n"; $claroline->display->body->appendContent($out); echo $claroline->display->render();
value = "<?php if (isset($this->announcement['title'])) { echo claro_htmlspecialchars($this->announcement['title']); } ?> " size="80" /> </dd> <dt><label for="newContent"><?php echo get_lang('Content'); ?> </label></dt> <dd> <?php echo claro_html_textarea_editor('newContent', !empty($this->announcement) ? $this->announcement['content'] : '', 12, 67); ?> </dd> <dt></dt> <dd> <input type="checkbox" value="1" name="emailOption" id="emailOption" /> <label for="emailOption"><?php echo get_lang('Send this announcement to registered students'); ?> </label> </dd> </dl> </fieldset> <fieldset id="advancedInformation" class="collapsible collapsed">
echo $this->tips['presetTitle']; ?> " /> <?php } ?> </dd> <dt> <label for="descContent"><?php echo get_lang('Content'); ?> </label> </dt> <dd> <?php echo claro_html_textarea_editor('descContent', $this->description->getContent(), 20, 80); ?> </dd> </dl> </fieldset> <p> <input type="submit" name="save" value="<?php echo get_lang('Ok'); ?> " /> <?php echo claro_html_button(claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'])), get_lang('Cancel')); ?> </p>
} else { $groupWorkUrl = Url::Contextualize(get_path('clarolineRepositoryWeb') . 'backends/download.php?url=' . rawurlencode($file) . '&gidReq=' . claro_get_current_group_id()); } $out .= '<dd>' . '<input type="hidden" name="submitGroupWorkUrl" value="' . claro_htmlspecialchars($submitGroupWorkUrl) . '" />' . '<a href="' . claro_htmlspecialchars($groupWorkUrl) . '">' . basename($file) . '</a>' . '</dd>' . "\n"; } else { $maxFileSize = min(get_max_upload_size($maxFilledSpace, $assignment->getAssigDirSys()), $fileAllowedSize); $out .= '<dd>' . "\n" . '<input type="file" name="wrkFile" id="wrkFile" size="30" /><br />' . '<p class="notice">' . get_lang('Max file size : %size', array('%size' => format_file_size($maxFileSize))) . '</p></td>' . "\n" . '</dd>' . "\n\n"; } } if ($assignmentContent == "FILE" && !$is_feedback) { // display standard html textarea // used for description of an uploaded file $out .= '<dt>' . '<label for="wrkTxt">' . get_lang('File description') . '<br /></label>' . '</dt>' . '<dd>' . "\n" . '<textarea name="wrkTxt" cols="40" rows="10">' . $form['wrkTxt'] . '</textarea>' . '</dd>' . "\n"; } elseif ($assignmentContent == "TEXT" || $assignmentContent == "TEXTFILE" || $is_feedback) { // display enhanced textarea using claro_html_textarea_editor $out .= '<dt>' . '<label for="wrkTxt">' . get_lang('Answer') . ' <span class="required">*</span></label></dt>' . "\n" . '<dd>' . claro_html_textarea_editor('wrkTxt', $form['wrkTxt']) . '</dd>' . "\n\n"; } if ($is_feedback) { $out .= '<dt>' . '<label for="wrkPrivFbk">' . get_lang('Private feedback') . '<br />' . '<small>' . get_lang('Course administrator only') . '</small>' . '</label></dt>' . '<dd>' . "\n" . '<textarea name="wrkPrivFbk" cols="40" rows="10">' . $san->sanitize($form['wrkPrivFbk']) . '</textarea>' . '</dd>' . "\n\n"; // if this is a correction we have to add an input for the score/grade/results/points $wrkScoreField = '<select name="wrkScore" id="wrkScore">' . "\n" . '<option value="-1"'; // add selected attribute if needed if ($form['wrkScore'] == -1) { $wrkScoreField .= ' selected="selected"'; } $wrkScoreField .= '>' . get_lang('No score') . '</option>' . "\n"; for ($i = 0; $i <= 100; $i++) { $wrkScoreField .= '<option value="' . $i . '"'; if ($i == $form['wrkScore']) { $wrkScoreField .= ' selected="selected"'; }
} if (get_conf('mail_notification', false) && !get_conf('automatic_mail_notification', false)) { $cmdList[] = array('img' => 'settings', 'name' => get_lang('Assignments preferences'), 'url' => claro_htmlspecialchars(Url::Contextualize('work_settings.php'))); } } $out = ''; $out .= claro_html_tool_title($nameTools, $helpUrl, $cmdList); if ($is_allowedToEdit) { $out .= $dialogBox->render(); // Form if (isset($displayAssigForm) && $displayAssigForm) { $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<input type="hidden" name="cmd" value="' . $cmdToSend . '" />' . "\n" . claro_form_relay_context() . "\n" . '<fieldset>'; if (!is_null($assigId)) { $out .= '<input type="hidden" name="assigId" value="' . $assigId . '" />' . "\n"; } $out .= '<dl>' . '<dt><label for="title">' . get_lang('Assignment title') . ' <span class="required">*</span></label></dt>' . '<dd><input type="text" name="title" id="title" size="50" maxlength="200" value="' . claro_htmlspecialchars($assignment->getTitle()) . '" /></dd>' . '<dt><label for="description">' . get_lang('Description') . '<br /></label></dt>' . '<dd>' . claro_html_textarea_editor('description', $assignment->getDescription()) . '</dd>' . '<dt>' . get_lang('Submission type') . '</dt>' . '<dd>' . '<input type="radio" name="authorized_content" id="authorizeFile" value="FILE" ' . ($assignment->getSubmissionType() == "FILE" ? 'checked="checked"' : '') . ' /> <label for="authorizeFile"> ' . get_lang('File (file required, description text optional)') . '</label> <br /> <input type="radio" name="authorized_content" id="authorizeText" value="TEXT" ' . ($assignment->getSubmissionType() == "TEXT" ? 'checked="checked"' : '') . '/> <label for="authorizeText"> ' . get_lang('Text only (text required, no file)') . '</label> <br /> <input type="radio" name="authorized_content" id="authorizeTextFile" value="TEXTFILE" ' . ($assignment->getSubmissionType() == "TEXTFILE" ? 'checked="checked"' : '') . ' /> <label for="authorizeTextFile"> ' . get_lang('Text with attached file (text required, file optional)') . '</label>' . '</dd>' . '<dt>' . get_lang('Assignment type') . '</dt>' . '<dd>' . '<input type="radio" name="assignment_type" id="individual" value="INDIVIDUAL" ' . ($assignment->getAssignmentType() == "INDIVIDUAL" ? 'checked="checked"' : '') . ' /> <label for="individual"> ' . get_lang('Individual') . '</label> <br /> <input type="radio" name="assignment_type" id="group" value="GROUP" ' . ($assignment->getAssignmentType() == "GROUP" ? 'checked="checked"' : '') . ' /> <label for="group"> ' . get_lang('Groups (from groups tool, only group members can post)') . '</label>' . '</dd>' . '<dt>' . get_lang('Start date') . '</dt>' . '<dd>' . claro_html_date_form('startDay', 'startMonth', 'startYear', $assignment_data['start_date'], 'long') . ' ' . claro_html_time_form('startHour', 'startMinute', $assignment_data['start_date']) . '<p class="notice">' . get_lang('(d/m/y hh:mm)') . '</p>' . '</dd>' . '<dt>' . get_lang('End date') . '</dt>' . '<dd>' . claro_html_date_form('endDay', 'endMonth', 'endYear', $assignment_data['end_date'], 'long') . ' ' . claro_html_time_form('endHour', 'endMinute', $assignment_data['end_date']) . '<p class="notice">' . get_lang('(d/m/y hh:mm)') . '</p>' . '</dd>' . '<dt>' . get_lang('Allow late upload') . '</dt>' . '<dd> <input type="radio" name="allow_late_upload" id="allowUpload" value="YES" ' . ($assignment->getAllowLateUpload() == "YES" ? 'checked="checked"' : '') . ' /> <label for="allowUpload"> ' . get_lang('Yes, allow users to submit works after end date') . '</label> <br /> <input type="radio" name="allow_late_upload" id="preventUpload" value="NO" ' . ($assignment->getAllowLateUpload() == "NO" ? 'checked="checked"' : '') . ' />
} $subtitle = get_lang('Preview : %textZone', array('%textZone' => $textZoneList[$fileId]['desc'])); $display = DISP_VIEW_FILE; } } } // DISPLAY $nameTools = get_lang('Edit text zones'); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); $noQUERY_STRING = true; $out = ''; //display titles $titles = array('mainTitle' => $nameTools); if (isset($subtitle)) { $titles['subTitle'] = $subtitle; } $out .= claro_html_tool_title($titles) . claro_html_msg_list($controlMsg, 1); if ($display == DISP_EDIT_FILE) { $out .= '<h4>' . basename($textZoneList[$fileId]['filename']) . '</h4>' . '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="file" value="' . claro_htmlspecialchars($fileId) . '" />' . "\n" . '<input type="hidden" name="cmd" value="exEdit" />' . "\n" . claro_html_textarea_editor('textContent', $textContent) . '<p>' . "\n" . '<input type="submit" class="claroButton" value="' . get_lang('Ok') . '" /> ' . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '</p>' . "\n" . '</form>' . "\n"; } elseif ($display == DISP_VIEW_FILE) { $out .= '<br />' . '<h4>' . basename($textZoneList[$fileId]['filename']) . '</h4>' . $textContent . '<br />'; } if ($display == DISP_FILE_LIST || $display == DISP_EDIT_FILE || $display == DISP_VIEW_FILE) { $out .= '<p>' . get_lang('Here you can modify the content of the text zones displayed on the platform home page.') . '<br />' . get_lang('See below the files you can edit from this tool.') . '</p>' . "\n" . '<table cellspacing="2" cellpadding="2" border="0" class="claroTable emphaseLine">' . "\n" . '<thead>' . '<tr>' . "\n" . '<th>' . get_lang('Description') . '</th>' . "\n" . '<th>' . get_lang('Edit') . '</th>' . "\n" . '<th>' . get_lang('Preview') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n"; foreach ($textZoneList as $idFile => $textZone) { $out .= '<tr>' . "\n" . '<td >' . (array_key_exists('desc', $textZone) ? $textZone['desc'] : '') . '</td>' . "\n" . '<td align="center">' . "\n" . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=rqEdit&file=' . $idFile . '">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Edit') . '" />' . "\n" . '</a>' . "\n" . '</td>' . "\n" . '<td align="center">' . "\n" . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exView&file=' . $idFile . '">' . '<img src="' . get_icon_url('preview') . '" alt="' . get_lang('Preview') . '" />' . "\n" . '</a>' . "\n" . '</td>' . "\n" . '</tr>' . "\n"; } $out .= '</table>' . "\n" . '<br />' . "\n"; } $claroline->display->body->appendContent($out); echo $claroline->display->render();
/** * This function is used to display comments of module or learning path with admin links if needed. * Admin links are 'edit' and 'delete' links. * * @param string $type MODULE_ , LEARNINGPATH_ , LEARNINGPATHMODULE_ * @param string $mode DISPLAY_ , UPDATE_ , DELETE_ * * @author Piraux S�bastien <*****@*****.**> * @author Lederer Guillaume <*****@*****.**> */ function commentBox($type, $mode) { $tbl_cdb_names = claro_sql_get_course_tbl(); $tbl_lp_learnPath = $tbl_cdb_names['lp_learnPath']; $tbl_lp_rel_learnPath_module = $tbl_cdb_names['lp_rel_learnPath_module']; $tbl_lp_module = $tbl_cdb_names['lp_module']; $out = ''; // globals global $is_allowedToEdit; // will be set 'true' if the comment has to be displayed $dsp = false; // those vars will be used to build sql queries according to the comment type switch ($type) { case MODULE_: $defaultTxt = get_lang('blockDefaultModuleComment'); $col_name = 'comment'; $tbl_name = $tbl_lp_module; if (isset($_REQUEST['module_id'])) { $module_id = $_REQUEST['module_id']; } else { $module_id = $_SESSION['module_id']; } $where_cond = "`module_id` = " . (int) $module_id; // use backticks ( ` ) for col names and simple quote ( ' ) for string break; case LEARNINGPATH_: $defaultTxt = get_lang('blockDefaultLearningPathComment'); $col_name = 'comment'; $tbl_name = $tbl_lp_learnPath; $where_cond = '`learnPath_id` = ' . (int) $_SESSION['path_id']; // use backticks ( ` ) for col names and simple quote ( ' ) for string break; case LEARNINGPATHMODULE_: $defaultTxt = get_lang('blockDefaultModuleAddedComment'); $col_name = 'specificComment'; $tbl_name = $tbl_lp_rel_learnPath_module; $where_cond = "`learnPath_id` = " . (int) $_SESSION['path_id'] . "\n AND `module_id` = " . (int) $_SESSION['module_id']; // use backticks ( ` ) for col names and simple quote ( ' ) for string break; } // update mode // allow to chose between // - update and show the comment and the pencil and the delete cross (UPDATE_) // - update and nothing displayed after form sent (UPDATENOTSHOWN_) if (($mode == UPDATE_ || $mode == UPDATENOTSHOWN_) && $is_allowedToEdit) { if (isset($_POST['insertCommentBox'])) { $sql = "UPDATE `" . $tbl_name . "`\n SET `" . $col_name . "` = \"" . claro_sql_escape($_POST['insertCommentBox']) . "\"\n WHERE " . $where_cond; claro_sql_query($sql); if ($mode == UPDATE_) { $dsp = true; } elseif ($mode == UPDATENOTSHOWN_) { $dsp = false; } } else { // get info to fill the form in $sql = "SELECT `" . $col_name . "`\n FROM `" . $tbl_name . "`\n WHERE " . $where_cond; $oldComment = claro_sql_query_get_single_value($sql); $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">' . "\n" . claro_html_textarea_editor('insertCommentBox', $oldComment, 15, 55) . '<br />' . "\n" . '<input type="hidden" name="cmd" value="update' . $col_name . '" />' . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . '<br />' . "\n" . '</form>' . "\n"; } } // delete mode if ($mode == DELETE_ && $is_allowedToEdit) { $sql = "UPDATE `" . $tbl_name . "`\n SET `" . $col_name . "` = ''\n WHERE " . $where_cond; claro_sql_query($sql); $dsp = TRUE; } // display mode only or display was asked by delete mode or update mode if ($mode == DISPLAY_ || $dsp == TRUE) { $sql = "SELECT `" . $col_name . "`\n FROM `" . $tbl_name . "`\n WHERE " . $where_cond; $currentComment = claro_sql_query_get_single_value($sql); // display nothing if this is default comment and not an admin if ($currentComment == $defaultTxt && !$is_allowedToEdit) { return ''; } if (empty($currentComment)) { // if no comment and user is admin : display link to add a comment if ($is_allowedToEdit) { $textLink = ''; if ($type == MODULE_) { $textLink = get_lang('Add a comment to this module'); } elseif ($type == LEARNINGPATHMODULE_) { $textLink = get_lang('Add a specific comment to this module'); } else { $textLink = get_lang('Add a comment'); } $out .= '<p>' . "\n" . claro_html_cmd_link($_SERVER['PHP_SELF'] . '?cmd=update' . $col_name . claro_url_relay_context('&'), $textLink) . '</p>' . "\n"; } } else { // display comment $out .= "<p>" . claro_parse_user_text($currentComment) . "</p>"; // display edit and delete links if user as the right to see it if ($is_allowedToEdit) { $out .= '<p>' . "\n" . '<small>' . "\n" . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=update' . $col_name . '">' . "\n" . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Modify') . '" />' . "\n" . '</a>' . "\n" . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=del' . $col_name . '" ' . ' onclick="javascript:if(!confirm(\'' . clean_str_for_javascript(get_lang('Please confirm your choice')) . '\')) return false;">' . "\n" . '<img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />' . "\n" . '</a>' . "\n" . '</small>' . "\n" . '</p>' . "\n"; } } } return $out; }
/* Determines the correct display */ if ($intro_editAllowed && ($introCmd == 'rqEd' || $introCmd == 'rqAdd')) { $intro_dispDefault = false; $intro_dispForm = true; $intro_dispCommand = false; } else { $intro_dispDefault = true; $intro_dispForm = false; $intro_dispCommand = $intro_editAllowed; } /* Executes the display */ if ($intro_dispForm) { $introContent = isset($introSettingList['content']) ? $introSettingList['content'] : ''; $introId = isset($introSettingList['id']) ? $introSettingList['id'] : false; $introEditorCmdValue = $introId ? 'exEd' : 'exAdd'; $output .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid(time()) . '" />' . '<input type="hidden" name="introCmd" value="' . $introEditorCmdValue . '" />' . ($introId ? '<input type="hidden" name="introId" value="' . $introId . '" />' : '') . claro_form_relay_context() . claro_html_textarea_editor('intro_content', trim($introContent)) . '<br />' . "\n"; if (isset($_REQUEST['introId'])) { ResourceLinker::setCurrentLocator(ResourceLinker::$Navigator->getCurrentLocator(array('id' => (int) $_REQUEST['introId']))); } $output .= ResourceLinker::renderLinkerBlock(); $output .= '<input type="submit" class="claroButton" name="submitEvent" value="' . get_lang('Ok') . '" /> ' . "\n"; $output .= claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '<br />' . "\n" . '</form>' . "\n\n"; } if ($intro_dispDefault) { $sql = "SELECT `id`, `rank`, `content`, `visibility`\n FROM `" . $TBL_INTRODUCTION . "`\n WHERE `tool_id` <= 0\n ORDER BY rank ASC"; $textIntroList = claro_sql_query_fetch_all($sql); $introListCount = count($textIntroList); if ($introListCount == 0 && $intro_editAllowed) { $output .= '<div class="HelpText">' . "\n" . get_block('blockIntroCourse') . "\n" . '</div>' . "\n"; } else { foreach ($textIntroList as $thisIntroKey => $thisTextIntro) {
echo isset($this->event['speakers']) ? claro_htmlspecialchars($this->event['speakers']) : ''; ?> " /><br /> <p class="notice"><?php echo get_lang('If more than one, separated by a coma'); ?> </p> </dd> <dt><label for="content"><?php echo get_lang('Detail'); ?> </label></dt> <dd> <?php echo claro_html_textarea_editor('content', $this->event['content'], 12, 67); ?> </dd> </dl> </fieldset> <fieldset> <legend><?php echo get_lang('Attached resources'); ?> </legend> <?php echo ResourceLinker::renderLinkerBlock(); ?> </fieldset>
$displayFeedbackForm = true; } } /** * DISPLAY */ // bredcrump to return to the list when in a form $interbredcrump[] = array('url' => Url::Contextualize('./work.php'), 'name' => get_lang('Assignments')); $interbredcrump[] = array('url' => Url::Contextualize('./work_list.php?assigId=' . $assignmentId), 'name' => get_lang('Assignment')); $nameTools = get_lang('Feedback'); $out = ''; $out .= claro_html_tool_title($nameTools); $out .= $dialogBox->render(); /** * FEEDBACK FORM */ if (isset($displayFeedbackForm) && $displayFeedbackForm) { $out .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data">' . "\n" . '<input type="hidden" name="cmd" value="exEditFeedback" />' . "\n" . claro_form_relay_context() . "\n"; if (isset($assignmentId)) { $out .= '<input type="hidden" name="assigId" value="' . $assignmentId . '" />' . "\n"; } $out .= '<table cellpadding="5" width="100%">' . "\n\n" . '<tr>' . "\n" . '<td valign="top" colspan="2">' . "\n" . '<p>' . "\n" . get_block('blockFeedbackHelp') . "\n" . '</p>' . "\n" . '</td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . "\n" . '<td valign="top">' . "\n" . '<label for="autoFeedbackText">' . "\n" . get_lang('Feedback text') . "\n" . ' :' . "\n" . '<br />' . "\n" . '</label>' . "\n" . '</td>' . "\n" . '<td>' . "\n" . claro_html_textarea_editor('autoFeedbackText', $form['autoFeedbackText']) . '</td>' . "\n" . '</tr>' . "\n\n"; if (!empty($form['autoFeedbackFilename'])) { $target = get_conf('open_submitted_file_in_new_window') ? 'target="_blank"' : ''; $completeFileUrl = $assignment->getAssigDirWeb() . $form['autoFeedbackFilename']; $out .= '<tr>' . "\n" . '<td valign="top">' . get_lang('Current feedback file') . ' :' . '<input type="hidden" name="currentAutoFeedbackFilename" value="' . $form['autoFeedbackFilename'] . '" />' . '</td>' . "\n" . '<td>' . '<a href="' . $completeFileUrl . '" ' . $target . '>' . $assignment->getAutoFeedbackFilename() . '</a>' . '<br />' . '<input type="checkBox" name="delFeedbackFile" id="delFeedbackFile" />' . '<label for="delFeedbackFile">' . get_lang('Check this box to delete the attached file') . ' ' . get_lang('Upload a new file to replace the file') . '</label> ' . '</td>' . "\n" . '</tr>' . "\n\n"; } $out .= '<tr>' . "\n" . '<td valign="top">' . "\n" . '<label for="autoFeedbackFilename">' . "\n" . get_lang('Feedback file') . ' :<br />' . "\n" . '</label>' . "\n" . '</td>' . "\n" . '<td>' . "\n" . '<input type="file" name="autoFeedbackFilename" id="autoFeedbackFilename" size="30" />' . "\n" . '</td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . "\n" . '<td valign="top">' . "\n" . get_lang('Submit feedback') . ' :</td>' . "\n" . '<td>' . "\n" . '<input type="radio" name="autoFeedbackSubmitMethod" id="prefillSubmitEndDate" value="ENDDATE" ' . $prefillSubmitEndDateCheckStatus . '/>' . "\n" . '<label for="prefillSubmitEndDate">' . "\n" . ' ' . "\n" . get_lang('Automatically, after end date') . ' (' . claro_html_localised_date(get_locale('dateTimeFormatLong'), $form['unix_end_date']) . ')' . "\n" . '</label>' . "\n" . '<br />' . "\n" . '<input type="radio" name="autoFeedbackSubmitMethod" id="prefillSubmitAfterPost" value="AFTERPOST" ' . $prefillSubmitAfterPostCheckStatus . ' />' . "\n" . '<label for="prefillSubmitAfterPost"> ' . "\n" . get_lang('Automatically, after each submission') . "\n" . '</label>' . "\n" . '<br />' . "\n" . '</td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . "\n" . '<td> </td>' . "\n" . '<td>' . "\n" . '<input type="submit" name="submitFeedback" value="' . get_lang('Ok') . '" /> ' . "\n" . claro_html_button(Url::Contextualize('./work_list.php?assigId=' . $assignmentId), get_lang('Cancel')) . "\n" . '</td>' . "\n" . '</tr>' . "\n\n" . '</table>' . "\n" . '</form>' . "\n"; } $claroline->display->body->appendContent($out); echo $claroline->display->render();
/** * display the form to edit answers * * @param $exId exercise id, required to get stay in the exercise context if required after posting the form * @param $askDuplicate display or not the form elements allowing to choose if the question must be duplicated or modified in all exercises * @author Sebastien Piraux <*****@*****.**> * @return string html code for display of answer edition form */ public function getFormHtml($exId = null, $askDuplicate = false) { $html = '<form method="post" action="./edit_answers.php?exId=' . $exId . '&quId=' . $this->questionId . '">' . "\n" . '<input type="hidden" name="cmd" value="exEdit" />' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . claro_form_relay_context() . "\n" . '<table class="claroTable">' . "\n"; if (!empty($exId) && $askDuplicate) { $html .= html_ask_duplicate(); } $html .= '<thead>' . "\n" . '<tr>' . "\n" . '<th>' . get_lang('Expected choice') . '</th>' . "\n" . '<th>' . get_lang('Answer') . '</th>' . "\n" . '<th>' . get_lang('Comment') . '</th>' . "\n" . '<th>' . get_lang('Weighting') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n" . '<tr>' . "\n" . '<td valign="top" align="center">' . '<input name="correctAnswer" id="trueCorrect" ' . ($this->correctAnswer == "TRUE" ? 'checked="checked"' : '') . 'type="radio" value="true" />' . '</td>' . "\n" . '<td valign="top"><label for="trueCorrect">' . get_lang('True') . '</label></td>' . "\n" . '<td>' . claro_html_textarea_editor('trueFeedback', $this->trueFeedback, 10, 25, '', 'simple') . '</td>' . "\n" . '<td valign="top"><input name="trueGrade" size="5" value="' . $this->trueGrade . '" type="text" /></td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . "\n" . '<td valign="top" align="center">' . '<input name="correctAnswer" id="falseCorrect" ' . ($this->correctAnswer == "FALSE" ? 'checked="checked"' : '') . 'type="radio" value="false" />' . '</td>' . "\n" . '<td valign="top"><label for="falseCorrect">' . get_lang('False') . '</label></td>' . "\n" . '<td>' . claro_html_textarea_editor('falseFeedback', $this->falseFeedback, 10, 25, '', 'simple') . '</td>' . "\n" . '<td valign="top"><input name="falseGrade" size="5" value="' . $this->falseGrade . '" type="text" /></td>' . "\n" . '</tr>' . "\n\n" . '<tr>' . "\n" . '<td colspan="4" align="center">' . '<input type="submit" name="cmdOk" value="' . get_lang('Ok') . '" /> ' . claro_html_button(Url::Contextualize('./edit_question.php?exId=' . $exId . '&quId=' . $this->questionId), get_lang("Cancel")) . '</td>' . "\n" . '</tr>' . "\n\n" . '</table>' . "\n\n" . '</form>'; return $html; }
<input type="hidden" name="visibility" value="<?php echo $this->intro->getVisibility(); ?> " /> <?php } ?> <dl> <dt><label for="content"><?php echo get_lang('Content'); ?> </label></dt> <dd> <?php echo claro_html_textarea_editor('content', $this->intro->getContent() ? $this->intro->getContent() : '', 12, 67); ?> </dd> </dl> </fieldset> <fieldset> <legend><?php echo get_lang('Attached resources'); ?> </legend> <?php echo ResourceLinker::renderLinkerBlock(); ?> </fieldset>
Display Section =================================================================*/ ClaroBreadCrumbs::getInstance()->prepend(get_lang('Forums'), 'index.php'); $noPHP_SELF = true; $out = ''; // Forum Title $out .= claro_html_tool_title(get_lang('Forums'), $is_allowedToEdit ? 'help_forum.php' : false); if (!$allowed || !$is_allowedToEdit) { $out .= $dialogBox->render(); } else { if (isset($_REQUEST['submit']) && !$error) { if (!isset($_REQUEST['delete'])) { $out .= disp_confirmation_message(get_lang('Your message has been entered'), $forum_id, $topic_id); } else { $out .= disp_confirmation_message(get_lang('Your message has been deleted'), $forum_id); } } else { $first_post = is_first_post($topic_id, $post_id); if ($error) { $out .= $dialogBox->render(); } $out .= disp_forum_breadcrumb($pagetype, $forum_id, $forum_name, $topic_id, $subject) . claro_html_menu_horizontal(disp_forum_toolbar($pagetype, $forum_id, $topic_id, 0)) . '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post" >' . "\n" . claro_form_relay_context() . '<input type="hidden" name="post_id" value="' . $post_id . '" />' . "\n" . '<table border="0" width="100%" >' . "\n"; if ($first_post) { $out .= '<tr valign="top">' . "\n" . '<td align="right">' . "\n" . '<label for="subject">' . get_lang('Subject') . '</label> : ' . '</td>' . "\n" . '<td>' . "\n" . '<input type="text" name="subject" id="subject" size="50" maxlength="100" value="' . htmlspecialchars($subject) . '" />' . '</td>' . "\n" . '</tr>' . "\n"; } $out .= '<tr valign="top">' . "\n" . '<td align="right">' . "\n" . '<br />' . get_lang('Message body') . ' : ' . "\n" . '</td>' . "\n" . '<td>' . "\n" . claro_html_textarea_editor('message', $message) . '</td>' . "\n" . '</tr>' . "\n" . '<tr valign="top">' . "\n" . '<td align="right">' . "\n" . '<label for="delete" >' . get_lang('Delete') . '</label>' . "\n" . ' : ' . "\n" . '</td>' . "\n" . '<td>' . "\n" . '<input type="checkbox" name="delete" id="delete" />' . "\n" . '</td>' . "\n" . '</tr>' . "\n" . '<tr>' . '<td> </td>' . "\n" . '<td>' . '<input type="submit" name="submit" value="' . get_lang('Ok') . '" /> ' . '<input type="submit" name="cancel" value="' . get_lang('Cancel') . '" />' . '</td>' . "\n" . '</tr>' . "\n" . '</table>' . "\n" . '</form>' . "\n" . '<br />' . "\n" . '<center>' . '<a href="' . htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $topic_id)) . '" target="_blank">' . get_lang('Topic review') . '</a>' . '</center>' . '<br />' . "\n"; } // end // else if ! isset submit } $claroline->display->body->appendContent($out); echo $claroline->display->render();
// End --> </script>'); $content .= get_lang('To send a message, select groups of users (marked with a * in the front) or single users from the list on the left.') . "<br/><br/>\n"; $content .= '<div class="messagesform">' . "\n"; $content .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="datos" ' . 'onsubmit="return valida();">' . "\n" . claro_form_relay_context() . "\n" . '<div class="userList">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<input type="hidden" name="cmd" value="exSendMessage" />' . "\n" . '<table class="multiselect">' . "\n" . '<tr>' . "\n" . '<td>' . "\n" . get_lang('User list') . '<br/>' . "\n" . '<select name="nocorreo[]" size="15" multiple="multiple" id="mslist1">' . "\n"; if ($groupList) { foreach ($groupList as $thisGroup) { $content .= '<option value="GROUP:' . $thisGroup['id'] . '">' . '* ' . $thisGroup['name'] . ' (' . $thisGroup['userNb'] . ' ' . get_lang('Users') . ')' . '</option>' . "\n"; } } if ($classList) { foreach ($classList as $thisClass) { $content .= '<option value="CLASS:' . $thisClass['id'] . '">' . '* ' . $thisClass['name'] . ' (' . get_class_user_number($thisClass['id']) . ' ' . get_lang('Users') . ')' . '</option>' . "\n"; } } $content .= '<option value="">' . '---------------------------------------------------------' . '</option>' . "\n"; // display user list foreach ($userList as $thisUser) { $content .= '<option value="USER:'******'user_id'] . '">' . ucwords(strtolower($thisUser['nom'] . ' ' . $thisUser['prenom'])) . '</option>' . "\n"; } // WATCH OUT ! form elements are called by numbers "form.element[3]"... // because select name contains "[]" causing a javascript // element name problem List of selected users $content .= '</select></td>' . "\n" . '<td class="arrows">' . '<a href="#" class="msadd"><img src="' . get_icon_url('go_right') . '" /></a>' . '<br /><br />' . '<a href="#" class="msremove"><img src="' . get_icon_url('go_left') . '" /></a>' . '</td>' . '<td>' . get_lang('Selected Users') . "<br/>" . "\n" . '<select name="incorreo[]" size="15" multiple="multiple" id="mslist2">' . '</select>' . "\n" . '</td>' . '</tr>' . '</table>' . "\n" . '<div class="composeMessage">' . "\n" . '<br/>' . get_lang('Subject') . '<br />' . "\n" . '<input type="text" name="subject" maxlength="255" size="40" />' . '<br/>' . get_lang('Message') . '<br/>' . "\n" . claro_html_textarea_editor('content', "") . '<br/><input type="submit" name="submitMessage" value="' . get_lang('Submit') . '" />' . claro_html_button(claro_htmlspecialchars(Url::Contextualize($from)), get_lang('Cancel')) . '</div>' . "\n" . '</div>' . "\n\n" . '</form>' . "\n\n" . '</div>'; } $claroline->display->body->appendContent(claro_html_tool_title(get_lang('Messages to selected users'))); $claroline->display->body->appendContent($content); // ------------- Display page ----------------------------- echo $claroline->display->render(); // ------------- End of script ----------------------------
<?php echo $this->data['showAnswers'] == 'NEVER' ? ' checked="checked"' : ' '; ?> /> <label for="showAnswerNever"><?php echo get_lang('No'); ?> </label> </dd> <dt><?php echo get_lang('Quiz end message'); ?> </dt> <dd> <div style="width:700px;"><?php echo claro_html_textarea_editor('quizEndMessage', $this->data['quizEndMessage']); ?> </div> </dd> </dl> </div> </fieldset> <div style="padding-top: 5px;"> <small><?php echo get_lang('<span class="required">*</span> denotes required field'); ?> </small> </div> <div style="text-align: center;"> <input type="submit" name="" id="" value="<?php echo get_lang('Ok');
// determine the default order of this Learning path $result = claro_sql_query("SELECT MAX(`rank`)\n FROM `" . $TABLELEARNPATH . "`"); list($orderMax) = mysql_fetch_row($result); $order = $orderMax + 1; // create new learning path $sql = "INSERT\n INTO `" . $TABLELEARNPATH . "`\n (`name`, `comment`, `rank`)\n VALUES ('" . claro_sql_escape($_POST['newPathName']) . "','" . claro_sql_escape(trim($_POST['newComment'])) . "'," . (int) $order . ")"; //echo $sql; $lp_id = claro_sql_query_insert_id($sql); // notify the creation to eventmanager $eventNotifier->notifyCourseEvent("learningpath_created", claro_get_current_course_id(), claro_get_current_tool_id(), $lp_id, claro_get_current_group_id(), "0"); } else { // display error message $dialogBox->error(get_lang('Error : Name already exists in the learning path or in the module pool')); } } else { $dialogBox->form("\n\n" . '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<fieldset>' . claro_form_relay_context() . '<h4>' . get_lang('Create a new learning path') . '</h4>' . "\n" . '<dl>' . '<dt><label for="newPathName">' . get_lang('Title') . '</label></dt>' . "\n" . '<dd><input type="text" name="newPathName" id="newPathName" maxlength="255" /></dd>' . "\n" . '<dt><label for="newComment">' . get_lang('Comment') . '</label></dt>' . "\n" . '<dd>' . claro_html_textarea_editor('newComment', '', 15, 55) . '</dd>' . '</dl>' . "\n" . '</fieldset>' . "\n" . '<input type="hidden" name="cmd" value="create" />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" /> ' . "\n" . claro_html_button('learningPathList.php', get_lang('Cancel')) . '</form>' . "\n"); } break; } // IF ORDER COMMAND RECEIVED // CHANGE ORDER if (isset($sortDirection) && $sortDirection) { $sql = "SELECT `learnPath_id`, `rank`\n FROM `" . $TABLELEARNPATH . "`\n ORDER BY `rank` {$sortDirection}"; $result = claro_sql_query($sql); // LP = learningPath while (list($LPId, $LPOrder) = mysql_fetch_row($result)) { // STEP 2 : FOUND THE NEXT ANNOUNCEMENT ID AND ORDER. // COMMIT ORDER SWAP ON THE DB if (isset($thisLPOrderFound) && $thisLPOrderFound == true) { $nextLPId = $LPId; $nextLPOrder = $LPOrder;
} else { $dialogBox = new DialogBox(); $dialogBox->error(get_lang('Name cannot be empty')); $out .= $dialogBox->render(); } break; //display the form to modify the comment //display the form to modify the comment case "rqComment": if (isset($_REQUEST['module_id'])) { //get current comment from DB $query = "SELECT `comment`\n FROM `" . $TABLEMODULE . "`\n WHERE `module_id` = '" . (int) $_REQUEST['module_id'] . "'"; $result = claro_sql_query($query); $comment = mysql_fetch_array($result); if (isset($comment['comment'])) { $out .= '<form method="get" action="' . $_SERVER['PHP_SELF'] . '">' . "\n" . claro_form_relay_context() . claro_html_textarea_editor('comment', $comment['comment'], 15, 55) . "\n" . '<br />' . "\n" . '<input type="hidden" name="cmd" value="exComment" />' . "\n" . '<input type="hidden" name="module_id" value="' . $_REQUEST['module_id'] . '" />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />' . "\n" . '<br /><br />' . "\n" . '</form>' . "\n"; } } // else no module_id break; //make update to change the comment in the database for this module //make update to change the comment in the database for this module case "exComment": if (isset($_REQUEST['module_id']) && isset($_REQUEST['comment'])) { $sql = "UPDATE `" . $TABLEMODULE . "`\n SET `comment` = '" . claro_sql_escape($_REQUEST['comment']) . "'\n WHERE `module_id` = " . (int) $_REQUEST['module_id']; claro_sql_query($sql); } break; } $sql = "SELECT M.*,\n count(M.`module_id`) AS timesUsed\n FROM `" . $TABLEMODULE . "` AS M\n LEFT JOIN `" . $TABLELEARNPATHMODULE . "` AS LPM ON LPM.`module_id` = M.`module_id`\n WHERE M.`contentType` != '" . CTSCORM_ . "'\n AND M.`contentType` != '" . CTLABEL_ . "'\n GROUP BY M.`module_id`\n ORDER BY M.`name` ASC, M.`contentType`ASC, M.`accessibility` ASC"; $result = claro_sql_query($sql);
} else { header("Location: " . Url::Contextualize("./learningPathList.php")); } exit; } // select details of learning path to display $sql = "SELECT lp.`learnPath_id`,\n lp.`name`,\n lp.`comment`,\n lp.`lock`,\n lp.`visibility`,\n lp.`rank`\n FROM `" . $TABLELEARNPATH . "` AS lp\n WHERE lp.`learnPath_id` = " . (int) $_SESSION['path_id']; $query = claro_sql_query($sql); $LPDetails = mysql_fetch_array($query); // parse commands $cmd = isset($_REQUEST['cmd']) ? $_REQUEST['cmd'] : ''; switch ($cmd) { // REQUEST EDIT case "rqEdit": if (isset($_SESSION['path_id'])) { $dialogBox->form("\n\n" . '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<fieldset>' . "\n" . claro_form_relay_context() . '<h4>' . get_lang('Edit this learning path') . '</h4>' . "\n" . '<dl>' . "\n" . '<dt><label for="newName">' . get_lang('Title') . '</label></dt>' . "\n" . '<dd>' . "\n" . '<input type="text" name="newName" id="newName" size="50" maxlength="255" value="' . claro_htmlspecialchars(claro_utf8_decode($LPDetails['name'], get_conf('charset'))) . '" />' . "\n" . '</dd>' . "\n" . '<dt><label for="newComment">' . get_lang('Comment') . '</label></dt>' . "\n" . '<dd>' . "\n" . claro_html_textarea_editor('newComment', $LPDetails['comment'], 15, 55) . '</dd>' . "\n" . '</dl>' . "\n" . '</fieldset>' . "\n" . '<input type="hidden" name="cmd" value="exEdit" />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" /> ' . "\n" . claro_html_button(Url::Contextualize($_SERVER['PHP_SELF']), get_lang('Cancel')) . '</form>' . "\n"); } else { $dialogBox->error(get_lang('Wrong operation')); } break; // EXECUTE EDIT // EXECUTE EDIT case "exEdit": // Name must be unique $sql = "SELECT COUNT(`name`)\n FROM `" . $TABLELEARNPATH . "`\n WHERE `name` = '" . claro_sql_escape($_POST['newName']) . "'\n AND !(`learnPath_id` = " . (int) $_SESSION['path_id'] . ")"; $num = claro_sql_query_get_single_value($sql); if ($num == 0) { $sql = "UPDATE `" . $TABLELEARNPATH . "`\n SET `name` = '" . claro_sql_escape($_POST['newName']) . "',\n `comment` = '" . claro_sql_escape($_POST['newComment']) . "'\n WHERE `learnPath_id` = " . (int) $_SESSION['path_id']; if (claro_sql_query($sql)) { $dialogBox->success(get_lang('Learning path updated')); }
Display Section =================================================================*/ ClaroBreadCrumbs::getInstance()->prepend(get_lang('Forums'), 'index.php'); $noPHP_SELF = true; $out = ''; // display tool title $out .= claro_html_tool_title(get_lang('Forums'), $is_allowedToEdit ? 'help_forum.php' : false); if (!$allowed) { $out .= $dialogBox->render(); } else { // Display new topic page if (isset($_REQUEST['submit']) && !$error) { // Display success message $out .= disp_confirmation_message(get_lang('Your message has been entered'), $forum_id, $topic_id); } else { if ($error) { // display error message $out .= $dialogBox->render(); } $out .= disp_forum_breadcrumb($pagetype, $forum_id, $forum_name) . claro_html_menu_horizontal(disp_forum_toolbar($pagetype, $forum_id, 0, 0)) . '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . "\n" . '<input type="hidden" name="forum" value="' . $forum_id . '" />' . "\n" . claro_form_relay_context() . '<table border="0" width="100%">' . "\n" . '<tr valign="top">' . "\n" . '<td align="right"><label for="subject">' . get_lang('Subject') . '</label> : </td>' . '<td><input type="text" name="subject" id="subject" size="50" maxlength="100" value="' . htmlspecialchars($subject) . '" /></td>' . '</tr>' . '<tr valign="top">' . "\n" . '<td align="right"><br />' . get_lang('Message body') . ' :</td>'; if (!empty($message)) { $content = $message; } else { $content = ''; } $out .= '<td>' . claro_html_textarea_editor('message', $content) . '</td>' . '</tr>' . '<tr valign="top"><td> </td>' . '<td><input type="submit" name="submit" value="' . get_lang('Ok') . '" /> ' . ' <input type="submit" name="cancel" value="' . get_lang('Cancel') . '" />' . "\n" . '</td></tr>' . '</table>' . '</form>' . "\n"; } } // end allowed $claroline->display->body->appendContent($out); echo $claroline->display->render();
} ?> <dt><label for="title"><?php echo get_lang('Title'); ?> <span class="required">*</span></label></dt> <dd><input type="text" name="title" id="title" size="60" maxlength="200" value="<?php echo claro_htmlspecialchars($this->data['title']); ?> " /></dd> <dt><label for="description"><?php echo get_lang('Description'); ?> <span class="required">*</span></label></dt> <dd><div style="width:500px;"><?php echo claro_html_textarea_editor('description', $this->data['description']); ?> </div></dd> <dt><label for="category"><?php echo get_lang('Category'); ?> </label></dt> <dd> <?php if (!empty($this->categoryList)) { ?> <select name="categoryId"> <option value="0"> </option> <?php foreach ($this->categoryList as $category) { ?>
/** * display the form to edit answers * * @param $exId exercise id, required to get stay in the exercise context if required after posting the form * @param $askDuplicate display or not the form elements allowing to choose if the question must be duplicated or modified in all exercises * @author Sebastien Piraux <*****@*****.**> * @return string html code for display of answer edition form */ public function getFormHtml($exId = null, $askDuplicate) { $html = '<form method="post" action="./edit_answers.php?exId=' . $exId . '&quId=' . $this->questionId . '">' . "\n" . '<input type="hidden" name="cmd" value="exEdit" />' . "\n" . '<input type="hidden" name="step" value="' . $this->step . '" />' . "\n" . claro_form_relay_context() . "\n"; if ($this->step > 1) { $html .= '<input type="hidden" name="answer" value="' . claro_htmlspecialchars($this->answerText) . '" />' . "\n" . '<input type="hidden" name="type" value="' . claro_htmlspecialchars($this->type) . '" />' . "\n" . '<input type="hidden" name="wrongAnswerList" value="' . claro_htmlspecialchars(implode("\n", $this->wrongAnswerList)) . '" />' . "\n\n"; if (!empty($exId) && $askDuplicate) { if (isset($_REQUEST['duplicate'])) { $html .= '<input type="hidden" name="duplicate" value="' . claro_htmlspecialchars($_REQUEST['duplicate']) . '" />' . "\n"; } } $html .= '<p>' . get_lang('Please give a weighting to each blank') . ' :</p>' . "\n" . '<table border="0" cellpadding="5" width="500">' . "\n"; $i = 0; foreach ($this->answerList as $correctAnswer) { $value = isset($this->gradeList[$i]) ? $this->gradeList[$i] : '0'; $html .= '<tr>' . "\n" . '<td width="50%">' . $correctAnswer . '</td>' . "\n" . '<td width="50%">' . '<input type="text" name="grade[' . $i . ']" size="5" value="' . $value . '" />' . '</td>' . "\n" . '</tr>' . "\n\n"; $i++; } $html .= '</table>' . "\n\n" . '<input type="submit" name="cmdBack" value="< ' . get_lang('Back') . '" /> ' . '<input type="submit" name="cmdOk" value="' . get_lang('Ok') . '" /> ' . claro_html_button('./edit_question.php?exId=' . $exId . '&quId=' . $this->questionId, get_lang("Cancel")); } else { // populate fields of other steps $i = 0; foreach ($this->gradeList as $grade) { $html .= '<input type="hidden" name="grade[' . $i . ']" value="' . $grade . '" />' . "\n"; $i++; } if (!empty($exId) && $askDuplicate) { $html .= '<p>' . html_ask_duplicate() . '</p>' . "\n"; } // answer $text = $this->addslashesEncodedBrackets($this->answerText); $text = $this->answerDecode($text); $html .= '<p>' . get_lang('Please type your text below, use brackets %mask to define one or more blanks', array('%mask' => '[...]')) . ' :</p>' . "\n" . claro_html_textarea_editor('answer', $text) . "\n" . '<p>' . get_lang('Fill type') . ' :</p>' . "\n" . '<p>' . "\n" . '<input type="radio" name="type" id="textFill" value="' . TEXTFIELD_FILL . '"' . ($this->type == TEXTFIELD_FILL ? 'checked="checked"' : '') . ' /><label for="textFill">' . get_lang('Fill text field') . '</label><br />' . "\n" . '<input type="radio" name="type" id="listboxFill" value="' . LISTBOX_FILL . '"' . ($this->type == LISTBOX_FILL ? 'checked="checked"' : '') . ' /><label for="listboxFill">' . get_lang('Select in drop down list') . '</label><br />' . "\n" . '</p>' . "\n" . '<p>' . get_lang('Add wrong answers for drop down lists <small>(Optionnal. One wrong answer by line.)</small>') . '</p>' . '<textarea name="wrongAnswerList" cols="30" rows="5">' . claro_htmlspecialchars($this->answerDecode(implode("\n", $this->wrongAnswerList))) . '</textarea>' . "\n" . '<p>' . "\n" . '<input type="submit" name="cmdNext" value="' . get_lang('Next') . ' >" /> ' . claro_html_button(Url::Contextualize('./edit_question.php?exId=' . $exId . '&quId=' . $this->questionId), get_lang("Cancel")) . '</p>' . "\n"; } $html .= '</form>'; return $html; }
} /*================================================================= Display Section =================================================================*/ ClaroBreadCrumbs::getInstance()->prepend(get_lang('Forums'), 'index.php'); $noPHP_SELF = true; $out = ''; $pagetype = 'reply'; $is_allowedToEdit = claro_is_allowed_to_edit(); $out .= claro_html_tool_title(get_lang('Forums'), $is_allowedToEdit ? 'help_forum.php' : false); if (!$allowed) { // not allowed $out .= $dialogBox->render(); } else { if (isset($_REQUEST['submit']) && !$error) { // DISPLAY SUCCES MESSAGE $out .= disp_confirmation_message(get_lang('Your message has been entered'), $forum_id, $topic_id); } else { if ($error) { $out .= $dialogBox->render(); } $out .= claro_html_menu_horizontal(disp_forum_toolbar($pagetype, $forum_id, 0, $topic_id)); $out .= disp_forum_breadcrumb($pagetype, $forum_id, $forum_name, $topic_id, $topic_title); $out .= '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">' . "\n" . claro_form_relay_context() . '<input type="hidden" name="forum" value="' . $forum_id . '" />' . "\n" . '<input type="hidden" name="topic" value="' . $topic_id . '" />' . "\n"; $out .= '<table border="0" width="100%">' . "\n" . '<tr valign="top">' . "\n" . '<td align="right"><br />' . get_lang('Message body') . ' :</td>' . '<td>' . claro_html_textarea_editor('message', $message) . '</td>' . '</tr>' . '<tr valign="top"><td> </td>' . '<td>' . '<input type="submit" name="submit" value="' . get_lang('Ok') . '" /> ' . '<input type="submit" name="cancel" value="' . get_lang('Cancel') . '" />' . '</td>' . '</tr>' . '</table>' . '</form>'; $out .= '<p style="text-align: center;"><a href="' . htmlspecialchars(Url::Contextualize(get_module_url('CLFRM') . '/viewtopic.php?topic=' . $topic_id . '&forum=' . $forum_id)) . '" target="_blank">' . get_lang('Topic review') . '</a></p>'; } // end else if submit } $claroline->display->body->appendContent($out); echo $claroline->display->render();
$subject = ''; } } elseif ('add' == $editMode || 'reply' == $editMode) { $subject = isset($subject) ? $subject : ''; $message = isset($message) ? $message : ''; } $form = new ModuleTemplate('CLFRM', 'forum_editpost.tpl.php'); $form->assign('nextCommand', 'exSavePost'); $form->assign('editMode', $editMode); $form->assign('forumId', $forumSettingList['forum_id']); $form->assign('topicId', $topicSettingList['topic_id']); $form->assign('postId', $postId); $form->assign('subject', $subject); $form->assign('anonymityStatus', $anonymityStatus); $form->assign('is_allowedToEdit', $is_allowedToEdit); $form->assign('editor', claro_html_textarea_editor('message', $message)); } else { $form = null; $dialogBox->error(get_lang('Your are not allowed to edit a contribution')); $cmd = 'show'; } } } if ($is_viewAllowed || $is_postAllowed) { //notification commands should be handled by ajax calls if ('exNotify' == $cmd) { request_topic_notification($topicId, claro_get_current_user_id()); $cmd = 'show'; } elseif ('exdoNotNotify' == $cmd) { cancel_topic_notification($topicId, claro_get_current_user_id()); $cmd = 'show';
$claroline->display->banner->breadcrumbs->append(get_lang('Administration'), get_path('rootAdminWeb')); } elseif ($_REQUEST['typeRecipient'] == 'group') { $recipient = new GroupRecipient($_POST['groupRecipient'], $_POST['courseRecipient']); $message->setCourse($_POST['courseRecipient']); $message->setGroup($_POST['groupRecipient']); } else { claro_die(get_lang('unknow recipient type')); } $recipient->sendMessage($message); $informationString = get_lang('Message sent') . '<br /><br />' . '<a href="messagebox.php?box=inbox">' . get_lang('Back to inbox') . '</a>'; $dialogbox = new DialogBox(); $dialogbox->info($informationString); if ($failure = claro_failure::get_last_failure()) { $dialogbox->warning($failure); } $content .= $dialogbox->render(); } } } } // ------------ Prepare display -------------------- if ($addForm) { $message = claro_html_sanitize_all($message); $content .= "<br/>"; $content .= '<form method="post" action="sendmessage.php?cmd=exSendMessage' . claro_url_relay_context('&') . '">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . claro_form_relay_context() . "\n" . '<input type="hidden" name="cmd" value="exSendMessage" />' . "\n" . '<input type="hidden" name="typeRecipient" value="' . $typeRecipient . '" />' . "\n" . '<input type="hidden" name="userRecipient" value="' . $userRecipient . '" />' . "\n" . '<input type="hidden" name="courseRecipient" value="' . $courseRecipient . '" />' . "\n" . '<input type="hidden" name="groupRecipient" value="' . $groupRecipient . '" />' . "\n" . '<input type="hidden" name="responseTo" value="' . $responseTo . '" />' . "\n" . '<label for="message_subject">' . get_lang('Subject') . ' : </label><br/><input type="text" id="message_subject" name="subject" value="' . claro_htmlspecialchars($subject) . '" maxlength="255" size="40" /><br/>' . "\n" . '<label for="message">' . get_lang('Message') . ' : </label><br/>' . claro_html_textarea_editor('message', $message) . '<br/><br/>' . "\n" . '<input type="submit" value="' . get_lang('Send') . '" name="send" />' . "\n" . '</form>' . "\n\n"; } $claroline->display->body->appendContent(claro_html_tool_title(get_lang('Compose a message'))); $claroline->display->body->appendContent($content); // ------------- Display page ----------------------------- echo $claroline->display->render(); // ------------- End of script ----------------------------