/** * @brief display links of category * @global type $is_editor * @global type $course_id * @global type $urlview * @global type $tool_content * @global type $urlServer * @global type $course_code * @global type $langLinkDelconfirm * @global type $langDelete * @global type $langUp * @global type $langDown * @global type $langModify * @global type $is_in_tinymce * @param type $catid */ function showlinksofcategory($catid) { global $is_editor, $course_id, $urlview, $tool_content, $urlServer, $course_code, $langLinkDelconfirm, $langDelete, $langUp, $langDown, $langModify, $is_in_tinymce; $tool_content .= "<tr>"; $result = Database::get()->queryArray("SELECT * FROM `link`\n WHERE course_id = ?d AND category = ?d\n ORDER BY `order`", $course_id, $catid); $numberoflinks = count($result); $i = 1; foreach ($result as $myrow) { $title = empty($myrow->title) ? $myrow->url : $myrow->title; $num_merge_cols = 1; $aclass = $is_in_tinymce ? " class='fileURL' " : ''; $tool_content .= "<td colspan='{$num_merge_cols}'><a href='" . $urlServer . "modules/link/go.php?course={$course_code}&id={$myrow->id}&url=" . urlencode($myrow->url) . "' {$aclass} target='_blank'>" . q($title) . "</a>"; if (!empty($myrow->description)) { $tool_content .= "<br />" . standard_text_escape($myrow->description); } $tool_content .= "</td>"; $tool_content .= "<td class='option-btn-cell'>"; if ($is_editor && !$is_in_tinymce) { $editlink = "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=editlink&id={$myrow->id}&urlview={$urlview}"; if (isset($category)) { $editlink .= "&category={$category}"; } $tool_content .= action_button(array(array('title' => $langDelete, 'icon' => 'fa-times', 'class' => 'delete', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=deletelink&id={$myrow->id}&urlview={$urlview}", 'confirm' => $langLinkDelconfirm), array('title' => $langModify, 'icon' => 'fa-edit', 'url' => $editlink), array('title' => $langUp, 'icon' => 'fa-arrow-up', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&urlview={$urlview}&up={$myrow->id}", 'show' => $i != 1), array('title' => $langDown, 'icon' => 'fa-arrow-down', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&urlview={$urlview}&down={$myrow->id}", 'show' => $i < $numberoflinks))); } else { $tool_content .= " "; } $tool_content .= "</td>"; $tool_content .= "</tr>"; $i++; } }
function add_question($node) { $objQuestion = new Question(); $objQuestion->updateTitle(standard_text_escape($node->content)); /** *Exercice type 1 refers to single response multiple choice question. *Exercice type 2 refers to multiple response multiple choice question. *QTILite allows only single response multiple choice questions. **/ if($node->num_of_correct_answers > 1 ) { $objQuestion->updateType(2); } else { $objQuestion->updateType(1); } $objQuestion->save(); $questionId = $objQuestion->selectId(); $objAnswer = new Answer($questionId); $tmp_answer = array(); if($node->answers) { foreach ($node->answers as $answer) { $objAnswer->createAnswer($answer['answer'], $answer['correct'], $answer['feedback'], $answer['weight'], 1); } $objAnswer->save(); } }
function list_videos() { global $id, $tool_content, $themeimg, $course_id, $langTitle, $langDescr, $langDate, $langChoice, $langCatVideoDirectory, $langAddModulesButton, $langNoVideo, $course_code; $count = 0; $video_found = FALSE; $cnt1 = Database::get()->querySingle("SELECT COUNT(*) AS cnt FROM video WHERE course_id = ?d", $course_id)->cnt; $cnt2 = Database::get()->querySingle("SELECT COUNT(*) AS cnt FROM videolink WHERE course_id = ?d", $course_id)->cnt; $count = $cnt1 + $cnt2; if ($count > 0) { $video_found = TRUE; $tool_content .= "<form action='insert.php?course={$course_code}' method='post'><input type='hidden' name='id' value='{$id}' />"; $tool_content .= "<table class='table-default'>"; $tool_content .= "<tr>" . "<th width='200' class='text-left'> {$langTitle}</th>" . "<th class='text-left'>{$langDescr}</th>" . "<th width='100'>{$langDate}</th>" . "<th width='80'>{$langChoice}</th>" . "</tr>"; foreach (array('video', 'videolink') as $table) { $result = Database::get()->queryArray("SELECT * FROM {$table} WHERE (category IS NULL OR category = 0) AND course_id = ?d", $course_id); foreach ($result as $row) { $row->course_id = $course_id; if ($table == 'video') { $vObj = MediaResourceFactory::initFromVideo($row); $videolink = MultimediaHelper::chooseMediaAhref($vObj); } else { $vObj = MediaResourceFactory::initFromVideoLink($row); $videolink = MultimediaHelper::chooseMedialinkAhref($vObj); } $tool_content .= "<td> " . icon('fa-film') . " " . $videolink . "</td>" . "<td>" . q($row->description) . "</td>" . "<td class='text-center'>" . nice_format($row->date, true, true) . "</td>" . "<td class='text-center'><input type='checkbox' name='video[]' value='{$table}:{$row->id}' /></td>" . "</tr>"; } } $sql = Database::get()->queryArray("SELECT * FROM video_category WHERE course_id = ?d ORDER BY name", $course_id); if ($sql) { $tool_content .= "<tr><td colspan='3' class='bold'> {$langCatVideoDirectory}</td></tr>"; foreach ($sql as $videocat) { $tool_content .= "<tr>"; $tool_content .= "<td>" . icon('fa-folder-o') . " " . q($videocat->name) . "</td>"; $tool_content .= "<td colspan='2'>" . standard_text_escape($videocat->description) . "</td>"; $tool_content .= "<td align='center'><input type='checkbox' name='videocatlink[]' value='{$videocat->id}' /></td>"; $tool_content .= "</tr>"; foreach (array('video', 'videolink') as $table) { $sql2 = Database::get()->queryArray("SELECT * FROM {$table} WHERE category = ?d", $videocat->id); foreach ($sql2 as $linkvideocat) { $tool_content .= "<tr>"; $tool_content .= "<td> <img src='{$themeimg}/links_on.png' /> <a href='" . q($linkvideocat->url) . "' target='_blank'>" . q($linkvideocat->title == '' ? $linkvideocat->url : $linkvideocat->title) . "</a></td>"; $tool_content .= "<td>" . standard_text_escape($linkvideocat->description) . "</td>"; $tool_content .= "<td class='text-center'>" . nice_format($linkvideocat->date, true, true) . "</td>"; $tool_content .= "<td class='text-center'><input type='checkbox' name='video[]' value='{$table}:{$linkvideocat->id}' /></td>"; $tool_content .= "</tr>"; } } } } $tool_content .= "<tr><th colspan='4'><div align='right'><input class='btn btn-primary' type='submit' name='submit_video' value='" . q($langAddModulesButton) . "' /> </div></th></tr></table></form>"; } if (!$video_found) { $tool_content .= "<div class='alert alert-warning'>{$langNoVideo}</div>"; } }
function table_row($title, $content, $html = false) { global $tool_content; if ($html) { $content = standard_text_escape($content); } else { $content = htmlspecialchars($content); } if (strlen(trim($content))) { $tool_content .= "<tr><th class='left'>{$title}:</th><td>{$content}</td></tr>"; } }
function table_row($title, $content, $html = false) { global $tool_content; if ($html) { $content = standard_text_escape($content); } else { $content = htmlspecialchars($content); } if (strlen(trim($content))) { $tool_content .= " <div class='row margin-bottom-fat'> <div class='col-sm-3'> <strong>$title:</strong> </div> <div class='col-sm-9'>$content </div> </div>"; } }
/** * display available links (if any) * @global type $id * @global type $course_id * @global type $course_code * @global type $tool_content * @global type $langNoCategory * @global type $langCategorisedLinks * @global type $langComments * @global type $langAddModulesButton * @global type $langChoice * @global type $langNoLinksExist * @global type $langLinks * @global type $course_code */ function list_links() { global $id, $course_id, $course_code, $tool_content, $langNoCategory, $langCategorisedLinks, $langComments, $langAddModulesButton, $langChoice, $langNoLinksExist, $langLinks, $course_code; $result = Database::get()->queryArray("SELECT * FROM link WHERE course_id = ?d", $course_id); if (count($result) == 0) { $tool_content .= "<div class='alert alert-warning'>{$langNoLinksExist}</div>"; } else { $tool_content .= "<form action='insert.php?course={$course_code}' method='post'>\n\t\t\t\t<input type='hidden' name='id' value='{$id}' />" . "<table class='table-default'>" . "<tr>" . "<th class='text-left'> {$langLinks}</th>" . "<th class='text-left'>{$langComments}</th>" . "<th width='80'>{$langChoice}</th>" . "</tr>"; $sql = Database::get()->queryArray("SELECT * FROM link_category WHERE course_id = ?d", $course_id); if (count($sql) > 0) { $tool_content .= "<tr>" . "<td colspan='3' class='bold'> {$langCategorisedLinks}</td>" . "</tr>"; foreach ($sql as $catrow) { $tool_content .= "<tr>"; $tool_content .= "<td>" . icon('fa-folder-o') . " " . q($catrow->name) . "</td>"; $tool_content .= "<td>" . standard_text_escape($catrow->description) . "</td>"; $tool_content .= "<td class='text-center'><input type='checkbox' name='catlink[]' value='{$catrow->id}' /></td>"; $tool_content .= "</tr>"; $sql2 = Database::get()->queryArray("SELECT * FROM link WHERE course_id = ?d AND category = ?d", $course_id, $catrow->id); foreach ($sql2 as $linkcatrow) { $tool_content .= "<tr>"; $tool_content .= "<td> " . icon('fa-link') . " <a href='" . q($linkcatrow->url) . "' target='_blank'>" . q($linkcatrow->title == '' ? $linkcatrow->url : $linkcatrow->title) . "</a></td>"; $tool_content .= "<td>" . standard_text_escape($linkcatrow->description) . "</td>"; $tool_content .= "<td class='text-center'><input type='checkbox' name='link[]' value='{$linkcatrow->id}' /></td>"; $tool_content .= "</tr>"; } } } $result = Database::get()->queryArray("SELECT * FROM link WHERE course_id = ?d AND category = 0", $course_id); $linkinfo = array(); foreach ($result as $row) { $linkinfo[] = array('id' => $row->id, 'url' => $row->url, 'title' => $row->title == '' ? $row->url : $row->title, 'comment' => $row->description, 'category' => $row->category); } if (count($linkinfo) > 0) { $tool_content .= "<tr>" . "<td colspan='3' class='bold'>{$langNoCategory}</td>" . "</tr>"; foreach ($linkinfo as $entry) { $tool_content .= "<tr>" . "<td> " . icon('fa-link') . " <a href='" . q($entry['url']) . "' target=_blank>" . q($entry['title']) . "</a></td>" . "<td>" . standard_text_escape($entry['comment']) . "</td>" . "<td class='text-center'><input type='checkbox' name='link[]' value='{$entry['id']}' /></td>"; "</tr>"; } } $tool_content .= "<tr>" . "<th colspan='3'><div align='right'>" . "<input class='btn btn-primary' type='submit' name='submit_link' value='{$langAddModulesButton}' /></div></th>" . "</tr></table></form>"; } }
/** * @brief display event list * @global type $course_code * @global type $is_editor * @global type $langEvents * @global type $langCalendar * @global type $langDateNow * @global type $dateFormatLong * @global type $langHour * @global type $langHours * @global type $langDuration * @global type $langAgendaNoTitle * @global type $langDelete * @global type $langConfirmDeleteEvent * @global type $langConfirmDeleteRecursive * @global type $langConfirmDeleteRecursiveEvents * @global type $langModify * @global type $langVisible * @param type $events * @param type $sens * @return string */ function event_list($events, $sens, $type = '') { global $course_code, $is_editor, $langDateNow, $dateFormatLong, $langHour, $langHours, $langDuration, $langAgendaNoTitle, $langDelete, $langConfirmDeleteEvent, $langConfirmDeleteRecursive, $langConfirmDeleteRecursiveEvents, $langEditChange, $langViewHide, $langViewShow, $id, $is_admin; $dateNow = date("j-n-Y / H:i", time()); $barMonth = ''; $nowBarShowed = false; $eventlist = "<div class='table-responsive'><table class='table-default'>"; foreach ($events as $myrow) { $content = standard_text_escape($myrow->content); $d = strtotime($myrow->start); if (!$nowBarShowed) { // Following order if ((($d > time()) and ($sens == " ASC")) or ( ($d < time()) and ( $sens == " DESC "))) { if ($barMonth != date("m", time())) { $barMonth = date("m", time()); $eventlist .= "<tr>"; // current month $eventlist .= "<td colspan='2' class='monthLabel list-header'><b>" . ucfirst(claro_format_locale_date("%B %Y", time())) . "</b></td>"; $eventlist .= "</tr>"; } $nowBarShowed = TRUE; $eventlist .= "<tr>"; $eventlist .= "<td colspan='2' class='today'>$langDateNow $dateNow</td>"; $eventlist .= "</tr>"; } } if ($barMonth != date("m", $d)) { $barMonth = date("m", $d); // month LABEL $eventlist .= "<tr>"; $eventlist .= "<td colspan='2' class='monthLabel list-header'>"; $eventlist .= "<div align='center'><b>" . ucfirst(claro_format_locale_date("%B %Y", $d)) . "</b></div></td>"; $eventlist .= "</tr>"; } $classvis = ''; if ($is_editor) { if ($myrow->visible == 0) { $classvis = 'class = "not_visible"'; } } $eventlist .= "<tr $classvis>"; if ($is_editor or $type == 'personal' or ($is_admin and $type == 'admin')) { $eventlist .= "<td style='padding:15px;'>"; } else { $eventlist .= "<td style='padding:15px;' colspan='2'>"; } if (($myrow->duration != '0:00') and ($myrow->duration != '')) { if ($myrow->duration == 1) { $message = $langHour; } else { $message = $langHours; } $msg = "($langDuration: " . q($myrow->duration) . " $message)"; } else { $msg = ''; } if ($myrow->title == '') { $eventlist .= "<a href='$_SERVER[PHP_SELF]?course=$course_code&id=$myrow->id'>$langAgendaNoTitle</a>"; } else { $eventlist .= "<strong><a href='$_SERVER[PHP_SELF]?course=$course_code&id=$myrow->id'>".q($myrow->title)."</a></strong> $msg"; } $eventlist .= "<div><span class='day'>" . ucfirst(claro_format_locale_date($dateFormatLong, $d)) . "</span> ($langHour: " . ucfirst(date('H:i', $d)) . ")</div>"; if (isset($id)) { $eventlist .= "<br>"; $eventlist .= "<div class='text-muted'>$content</div>"; } $eventlist .= "</td>"; if ($type == 'admin' and $is_admin == true) { $eventlist .= "<td class='option-btn-cell'>"; $eventlist .= action_button(array( array('title' => $langEditChange, 'url' => "?admin=1&modify=$myrow->id", 'icon' => 'fa-edit'), array('title' => $langConfirmDeleteRecursive, 'url' => "?delete=$myrow->id&et=admin&rep=yes", 'icon' => 'fa-times-circle-o', 'class' => 'delete', 'confirm' => $langConfirmDeleteRecursiveEvents, 'show' => !(is_null($myrow->recursion_period) || is_null($myrow->recursion_end))), array('title' => $langDelete, 'url' => "?delete=$myrow->id&et=admin", 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langConfirmDeleteEvent) )); $eventlist .= "</td>"; } else { if ($is_editor) { $eventlist .= "<td class='option-btn-cell'>"; $eventlist .= action_button(array( array('title' => $langEditChange, 'url' => "?course=$course_code&id=$myrow->id&edit=true", 'icon' => 'fa-edit'), array('title' => $myrow->visible ? $langViewHide : $langViewShow, 'url' => "?course=$course_code&id=$myrow->id" . ($myrow->visible? "&mkInvisibl=true" : "&mkVisibl=true"), 'icon' => $myrow->visible ? 'fa-eye-slash' : 'fa-eye'), array('title' => $langDelete, 'url' => "?course=$course_code&id=$myrow->id&delete=yes", 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langConfirmDeleteEvent), array('title' => $langConfirmDeleteRecursive, 'url' => "?course=$course_code&id=$myrow->id&delete=yes&rep=yes", 'icon' => 'fa-times-circle-o', 'class' => 'delete', 'confirm' => $langConfirmDeleteRecursiveEvents, 'show' => !(is_null($myrow->recursion_period) || is_null($myrow->recursion_end))) )); $eventlist .= "</td>"; } elseif ($type == 'personal') { // personal or admin event $eventlist .= "<td class='option-btn-cell'>"; $eventlist .= action_button(array( array('title' => $langEditChange, 'url' => "?modify=$myrow->id", 'icon' => 'fa-edit'), array('title' => $langDelete, 'url' => "?delete=$myrow->id&et=$type", 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langConfirmDeleteEvent), array('title' => $langConfirmDeleteRecursive, 'url' => "?delete=$myrow->id&et=$type&rep=yes", 'icon' => 'fa-times-circle-o', 'class' => 'delete', 'confirm' => $langConfirmDeleteRecursiveEvents, 'show' => !(is_null($myrow->recursion_period) || is_null($myrow->recursion_end))), )); $eventlist .= "</td>"; } } $eventlist .= "</tr>"; } $eventlist .= "</table></div>"; return $eventlist; }
AND lang=?s AND (`begin` <= NOW() or `begin` IS null) AND (NOW() <= `end` or `end` IS null) ORDER BY `order` DESC", $language); $ann_content = ''; if ($announceArr && sizeof($announceArr) > 0) { $ann_content .= "<ul class='front-announcements'>"; $numOfAnnouncements = sizeof($announceArr); for ($i = 0; $i < $numOfAnnouncements; $i++) { $aid = $announceArr[$i]->id; $ann_content .= " <li> <div><a class='announcement-title' href='modules/announcements/main_ann.php?aid=$aid'>" . q($announceArr[$i]->title) . "</a></div> <span class='announcement-date'>- " . claro_format_locale_date($dateFormatLong, strtotime($announceArr[$i]->date)) . " -</span> " . standard_text_escape(ellipsize_html("<div class='announcement-main'>".$announceArr[$i]->body."</div>", 500, "<div class='announcements-more'><a href='modules/announcements/main_ann.php?aid=$aid'>$langMore …</a></div>"))."</li>"; } } $tool_content .= "<div class='row'> <div class='col-md-8'>"; $tool_content .= "<div class='panel'> <div class='panel-body'> $langInfoAbout </div> </div>"; // display admin announcements if(!empty($ann_content)) { $tool_content .= "<h3 class='content-title'>$langAnnouncements <a href='${urlServer}rss.php' style='padding-left:5px;'> <i class='fa fa-rss-square'></i>
<link href="../../../template/<?php echo $theme ?>/theme.css" rel="stylesheet" type="text/css" /> <title><?php echo $langCourseProgram ?></title> </head> <body style="margin: 0px; padding-left: 0px; height: 100%!important; height: auto; background-color: #ffffff;"> <div id="content" style="width:800px; margin: 0 auto;"> <?php $q = Database::get()->queryArray("SELECT id, title, comments FROM course_description WHERE course_id = ?d ORDER BY `order`", $course_id); if ($q && count($q) > 0) { foreach ($q as $row) { echo " <table class='table-default'> <tr> <td><strong>" . q($row->title) . "</strong></td>\n </tr> <tr>"; if ($is_editor) { echo "\n<td colspan='6'>" . standard_text_escape($row->comments) . "</td>"; } else { echo "\n<td>" . standard_text_escape($row->comments) . "</td>"; } echo "</tr></table><br />\n"; } } else { echo " <div class='alert alert-warning'>$langThisCourseDescriptionIsEmpty</div>"; } ?></div></body></html>
$tool_content .= "<div class='table-responsive'><table class='table-default'> <tr><th>$langTitle</th> <th>$langAnnouncement</th> <th colspan='2'><div align='center'>" . icon('fa-gears') . "</th>"; foreach ($result as $myrow) { if ($myrow->visible == 1) { $visibility = 0; $classvis = ''; } else { $visibility = 1; $classvis = 'not_visible'; } $myrow->date = claro_format_locale_date($dateFormatLong, strtotime($myrow->date)); $tool_content .= "<tr class='$classvis'> <td width='200'><b>" . q($myrow->title) . "</b><br><span class='smaller'>$myrow->date</span></td> <td>" . standard_text_escape($myrow->body) . "</td> <td width='6'>" . action_button(array( array('title' => $langEditChange, 'url' => "$_SERVER[SCRIPT_NAME]?modify=$myrow->id", 'icon' => 'fa-edit'), array('title' => $visibility == 0 ? $langViewHide : $langViewShow, 'url' => "$_SERVER[SCRIPT_NAME]?id=$myrow->id&vis=$visibility", 'icon' => $visibility == 0 ? 'fa-eye-slash' : 'fa-eye'), array('title' => $langUp, 'url' => "$_SERVER[SCRIPT_NAME]?up=$myrow->id", 'icon' => 'fa-arrow-up'), array('title' => $langDown, 'url' => "$_SERVER[SCRIPT_NAME]?down=$myrow->id", 'icon' => 'fa-arrow-down'), array('title' => $langDelete,
} else { $tool_content .= " <span class='tag-value not_visible'> - $langProfileNotAvailable - </span>"; } $tool_content .= $providers; $tool_content .= "</div> </div> <!-- end of col-xs-6 --> </div> <!-- end of row --> </div> <!-- end of col-xs-12 profile-pers-info --> </div> <!-- end of pers_info row -->"; if (!empty($userdata->description)) { $tool_content .= "<div id='profile-about-me' class='row'> <div class='col-xs-12 col-md-10 col-md-offset-2 profile-pers-info'> <h4>$langProfileAboutMe</h4><div> ".standard_text_escape($userdata->description)."</div></div></div>"; } $tool_content .= " <div id='profile-departments' class='row'> <div class='col-xs-12 col-md-10 col-md-offset-2 profile-pers-info'> <div><span class='tag'>$langHierarchyNode : </span>"; $departments = $user->getDepartmentIds($id); $i = 1; foreach ($departments as $dep) { $br = ($i < count($departments)) ? '<br/>' : ''; $tool_content .= $tree->getFullPath($dep) . $br; $i++; } $tool_content .= "</div> <div> <span class='tag'>$langProfileMemberSince : </span><span class='tag-value'>$userdata->registered_at</span>
function showQuestion(&$objQuestionTmp, $exerciseResult = array()) { global $tool_content, $picturePath, $langNoAnswer, $langQuestion, $langColumnA, $langColumnB, $langMakeCorrespond, $langInfoGrades, $i, $exerciseType, $nbrQuestions, $langInfoGrade; $questionId = $objQuestionTmp->id; $questionWeight = $objQuestionTmp->selectWeighting(); $answerType = $objQuestionTmp->selectType(); $message = $langInfoGrades; if (intval($questionWeight) == $questionWeight) { $questionWeight = intval($questionWeight); } if ($questionWeight == 1) { $message = $langInfoGrade; } $questionName = $objQuestionTmp->selectTitle(); $questionDescription = $objQuestionTmp->selectDescription(); $questionDescription_temp = $questionDescription; $questionTypeWord = $objQuestionTmp->selectTypeWord($answerType); $tool_content .= "\n <div class='panel panel-success'>\n <div class='panel-heading'>\n <h3 class='panel-title'>{$langQuestion} : {$i} ({$questionWeight} {$message})" . ($exerciseType == 2 ? " / " . $nbrQuestions : "") . "</h3>\n </div>\n <div class='panel-body'>\n <h4>{$questionName} <br> \n <small>{$questionTypeWord}</small>\n </h4>\n {$questionDescription_temp}\n <div class='text-center'>\n " . (file_exists($picturePath . '/quiz-' . $questionId) ? "<img src='../../{$picturePath}/quiz-{$questionId}'>" : "") . "\n </div>"; // construction of the Answer object $objAnswerTmp = new Answer($questionId); $nbrAnswers = $objAnswerTmp->selectNbrAnswers(); if ($answerType == FREE_TEXT) { $text = isset($exerciseResult[$questionId]) ? $exerciseResult[$questionId] : ''; $tool_content .= rich_text_editor('choice[' . $questionId . ']', 14, 90, $text); } if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER || $answerType == TRUE_FALSE) { $tool_content .= "<input type='hidden' name='choice[{$questionId}]' value='0' />"; } // only used for the answer type "Matching" if ($answerType == MATCHING && $nbrAnswers > 0) { $cpt1 = 'A'; $cpt2 = 1; $Select = array(); $tool_content .= "\n <table class='table-default'>\n <tr>\n <th>{$langColumnA}</th>\n <th>{$langMakeCorrespond}</th>\n <th>{$langColumnB}</th>\n </tr>"; } if ($answerType == FILL_IN_BLANKS) { $tool_content .= "<div class='form-inline'>"; } for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { $answer = $objAnswerTmp->selectAnswer($answerId); $answer = mathfilter($answer, 12, '../../courses/mathimg/'); $answerCorrect = $objAnswerTmp->isCorrect($answerId); if ($answerType == FILL_IN_BLANKS) { // splits text and weightings that are joined with the character '::' list($answer) = explode('::', $answer); // replaces [blank] by an input field $replace_callback = function () use($questionId, $exerciseResult) { static $id = 0; $id++; $value = isset($exerciseResult[$questionId][$id]) ? 'value = ' . $exerciseResult[$questionId][$id] : ''; return "<input type='text' name='choice[{$questionId}][{$id}]' {$value}>"; }; $answer = preg_replace_callback('/\\[[^]]+\\]/', $replace_callback, standard_text_escape($answer)); } // unique answer if ($answerType == UNIQUE_ANSWER) { $checked = isset($exerciseResult[$questionId]) && $exerciseResult[$questionId] == $answerId ? 'checked="checked"' : ''; $tool_content .= "\n <div class='radio'>\n <label>\n <input type='radio' name='choice[{$questionId}]' value='{$answerId}' {$checked}>\n " . standard_text_escape($answer) . "\n </label>\n </div>"; } elseif ($answerType == MULTIPLE_ANSWER) { $checked = isset($exerciseResult[$questionId][$answerId]) && $exerciseResult[$questionId][$answerId] == 1 ? 'checked="checked"' : ''; $tool_content .= "\n <div class='checkbox'>\n <label>\n <input type='checkbox' name='choice[{$questionId}][{$answerId}]' value='1' {$checked}>\n " . standard_text_escape($answer) . "\n </label>\n </div>"; } elseif ($answerType == FILL_IN_BLANKS) { $tool_content .= $answer; } elseif ($answerType == MATCHING) { if (!$answerCorrect) { // options (A, B, C, ...) that will be put into the list-box $Select[$answerId]['Lettre'] = $cpt1++; // answers that will be shown at the right side $Select[$answerId]['Reponse'] = standard_text_escape($answer); } else { $tool_content .= "\n\t\t\t\t <tr>\n\t\t\t\t <td><b>{$cpt2}.</b> " . standard_text_escape($answer) . "</td>\n\t\t\t\t <td><div align='left'>\n\t\t\t\t <select name='choice[{$questionId}][{$answerId}]'>\n\t\t\t\t\t <option value='0'>--</option>"; // fills the list-box foreach ($Select as $key => $val) { $selected = isset($exerciseResult[$questionId][$answerId]) && $exerciseResult[$questionId][$answerId] == $key ? 'selected="selected"' : ''; $tool_content .= "\n\t\t\t\t\t<option value=\"" . q($key) . "\" {$selected}>{$val['Lettre']}</option>"; } $tool_content .= "</select></div></td><td width='200'>"; if (isset($Select[$cpt2])) { $tool_content .= '<b>' . q($Select[$cpt2]['Lettre']) . '.</b> ' . $Select[$cpt2]['Reponse']; } else { $tool_content .= ' '; } $tool_content .= "</td></tr>"; $cpt2++; // if the left side of the "matching" has been completely shown if ($answerId == $nbrAnswers) { // if it remains answers to shown at the right side while (isset($Select[$cpt2])) { $tool_content .= "\n <tr class='even'>\n <td colspan='2'>\n <table width='100%'>\n <tr>\n <td width='200'> </td>\n <td width='100'> </td>\n <td width='200' valign='top'>" . "<b>" . q($Select[$cpt2]['Lettre']) . ".</b> " . q($Select[$cpt2]['Reponse']) . "\n </td>\n </tr>\n </table>\n </td>\n </tr>"; $cpt2++; } // end while() } // end if() } } elseif ($answerType == TRUE_FALSE) { $checked = isset($exerciseResult[$questionId]) && $exerciseResult[$questionId] == $answerId ? 'checked="checked"' : ''; $tool_content .= "\n <div class='radio'>\n <label>\n <input type='radio' name='choice[{$questionId}]' value='{$answerId}' {$checked}>\n " . standard_text_escape($answer) . "\n </label>\n </div>"; } } // end for() if ($answerType == MATCHING && $nbrAnswers > 0) { $tool_content .= "</table>"; } if ($answerType == FILL_IN_BLANKS) { $tool_content .= "</div>"; } if (!$nbrAnswers && $answerType != FREE_TEXT) { $tool_content .= "<div class='alert alert-danger'>{$langNoAnswer}</div>"; } $tool_content .= " \n </div>\n </div>"; // destruction of the Answer object unset($objAnswerTmp); // destruction of the Question object unset($objQuestionTmp); return $nbrAnswers; }
if ($is_course_admin) { $link = "<a href='{$urlAppend}modules/user/?course=$course_code'>$numUsers $langRegistered</a>"; } else { $link = "<a href='{$urlAppend}modules/user/userslist.php?course=$course_code'>$numUsers $langRegistered</a>"; } $bar_content_2 .= "<br><b>$langUsers:</b> $link"; $citation_text = "$professor. <i>$currentCourseName.</i> $langAccessed" . claro_format_locale_date($dateFormatLong, strtotime('now')) . " $langFrom2 {$urlServer}courses/$course_code/"; $tool_content .= "<div class='modal fade' id='citation' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'> <div class='modal-dialog'> <div class='modal-content'> <div class='modal-header'> <button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>×</span></button> <h4 class='modal-title' id='myModalLabel'>$langCitation</h4> </div> <div class='modal-body'>". standard_text_escape($citation_text) ."</div> </div> </div> </div>"; $bar_content_2 .= "<br><a data-modal='citation' data-toggle='modal' data-target='#citation' href='javascript:void(0);'>$langCitation</a>"; // display course license if ($course_license) { $license_info_box = "<small>" . copyright_info($course_id) . "</small>"; } else { $license_info_box = ''; } // display opencourses level in bar $level = ($levres = Database::get()->querySingle("SELECT level FROM course_review WHERE course_id = ?d", $course_id)) ? CourseXMLElement::getLevel($levres->level) : false;
</tr>"; } else { // student view $tool_content .= " <th>$langExerciseName</th> <th class='text-center'>$langStart / $langEnd</th> <th class='text-center'>$langExerciseConstrain</th> <th class='text-center'>$langExerciseAttemptsAllowed</th> <th class='text-center'>$langResults</th> </tr>"; } // display exercise list $k = 0; foreach ($result as $row) { $tool_content .= "<tr ".($is_editor && !$row->active ? "class='not_visible'" : "").">"; $row->description = standard_text_escape($row->description); $exclamation_icon = ''; $lock_icon = ''; $link_class = ''; if (isset($row->password_lock) || isset($row->ip_lock)) { $lock_description = "<ul>"; if ($row->password_lock) { $lock_description .= "<li>$langPasswordUnlock</li>"; $link_class = " class='password_protected'"; } if ($row->ip_lock) { $lock_description .= "<li>$langIPUnlock</li>"; } $lock_description .= "</ul>"; $exclamation_icon = " <span class='fa fa-exclamation-triangle space-after-icon' data-toggle='tooltip' data-placement='right' data-html='true' data-title='$lock_description'><span>"; }
function show_assignment($id, $display_graph_results = false) { global $tool_content, $m, $langBack, $langNoSubmissions, $langSubmissions, $langEndDeadline, $langWEndDeadline, $langNEndDeadline, $langDays, $langDaysLeft, $langGradeOk, $course_code, $webDir, $urlServer, $langGraphResults, $m, $course_code, $themeimg, $works_url, $course_id, $langDelWarnUserAssignment, $langAutoJudgeShowWorkResultRpt; $row = Database::get()->querySingle("SELECT *, CAST(UNIX_TIMESTAMP(deadline)-UNIX_TIMESTAMP(NOW()) AS SIGNED) AS time\n FROM assignment\n WHERE course_id = ?d AND id = ?d", $course_id, $id); $nav[] = $works_url; assignment_details($id, $row); $rev = @($_REQUEST['rev'] == 1) ? ' DESC' : ''; if (isset($_REQUEST['sort'])) { if ($_REQUEST['sort'] == 'am') { $order = 'am'; } elseif ($_REQUEST['sort'] == 'date') { $order = 'submission_date'; } elseif ($_REQUEST['sort'] == 'grade') { $order = 'grade'; } elseif ($_REQUEST['sort'] == 'filename') { $order = 'file_name'; } else { $order = 'surname'; } } else { $order = 'surname'; } $result = Database::get()->queryArray("SELECT * FROM assignment_submit AS assign, user\n WHERE assign.assignment_id = ?d AND user.id = assign.uid\n ORDER BY ?s ?s", $id, $order, $rev); $num_results = count($result); if ($num_results > 0) { if ($num_results == 1) { $num_of_submissions = $m['one_submission']; } else { $num_of_submissions = sprintf("{$m['more_submissions']}", $num_results); } $gradeOccurances = array(); // Named array to hold grade occurances/stats $gradesExists = 0; foreach ($result as $row) { $theGrade = $row->grade; if ($theGrade) { $gradesExists = 1; if (!isset($gradeOccurances[$theGrade])) { $gradeOccurances[$theGrade] = 1; } else { if ($gradesExists) { ++$gradeOccurances[$theGrade]; } } } } if (!$display_graph_results) { $result = Database::get()->queryArray("SELECT assign.id id, assign.file_name file_name,\n assign.uid uid, assign.group_id group_id,\n assign.submission_date submission_date,\n assign.grade_submission_date grade_submission_date,\n assign.grade grade, assign.comments comments,\n assign.grade_comments grade_comments,\n assignment.deadline deadline\n FROM assignment_submit AS assign, user, assignment\n WHERE assign.assignment_id = ?d AND assign.assignment_id = assignment.id AND user.id = assign.uid\n ORDER BY ?s ?s", $id, $order, $rev); $tool_content .= "\n <form action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}' method='post'>\n <input type='hidden' name='grades_id' value='{$id}' />\n <p><div class='sub_title1'>{$langSubmissions}:</div><p>\n <p>{$num_of_submissions}</p>\n <table width='100%' class='sortable'>\n <tr>\n <th width='3'> </th>"; sort_link($m['username'], 'username'); sort_link($m['am'], 'am'); sort_link($m['filename'], 'filename'); sort_link($m['sub_date'], 'date'); sort_link($m['grade'], 'grade'); $tool_content .= "</tr>"; $i = 1; foreach ($result as $row) { //is it a group assignment? if (!empty($row->group_id)) { $subContentGroup = "{$m['groupsubmit']} " . "<a href='../group/group_space.php?course={$course_code}&group_id={$row->group_id}'>" . "{$m['ofgroup']} " . gid_to_name($row->group_id) . "</a>"; } else { $subContentGroup = ''; } $uid_2_name = display_user($row->uid); $stud_am = Database::get()->querySingle("SELECT am FROM user WHERE id = ?d", $row->uid)->am; if ($i % 2 == 1) { $row_color = "class='even'"; } else { $row_color = "class='odd'"; } $filelink = empty($row->file_name) ? ' ' : "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&get={$row->id}'>" . q($row->file_name) . "</a>"; $late_sub_text = (int) $row->deadline && $row->submission_date > $row->deadline ? '<div style="color:red;">$m[late_submission]</div>' : ''; $tool_content .= "\n <tr {$row_color}>\n <td align='right' width='4' rowspan='2' valign='top'>{$i}.</td>\n <td>{$uid_2_name}</td>\n <td width='85'>" . q($stud_am) . "</td>\n <td width='180'>{$filelink}\n <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&id={$id}&as_id={$row->id}' onClick='return confirmation(\"{$langDelWarnUserAssignment}\");'>\n <img src='{$themeimg}/delete.png' title='{$m['WorkDelete']}' />\n </a>\n </td>\n <td width='100'>" . nice_format($row->submission_date, TRUE) . $late_sub_text . "</td>\n <td width='5'>\n <div align='center'><input type='text' value='{$row->grade}' maxlength='3' size='3' name='grades[{$row->id}]'></div>\n </td>\n </tr>\n <tr {$row_color}>\n <td colspan='5'>\n <div>{$subContentGroup}</div>"; if (trim($row->comments != '')) { $tool_content .= "<div style='margin-top: .5em;'><b>{$m['comments']}:</b> " . q($row->comments) . '</div>'; } //professor comments $gradelink = "grade_edit.php?course={$course_code}&assignment={$id}&submission={$row->id}"; $reportlink = "work_result_rpt.php?course={$course_code}&assignment={$id}&submission={$row->id}"; if (trim($row->grade_comments)) { $label = $m['gradecomments'] . ':'; $icon = 'edit.png'; $comments = "<div class='smaller'>" . standard_text_escape($row->grade_comments) . "</div>"; } else { $label = $m['addgradecomments']; $icon = 'add.png'; $comments = ''; } if ($row->grade_comments || $row->grade != '') { $comments .= "<div class='smaller'><i>({$m['grade_comment_date']}: " . nice_format($row->grade_submission_date) . ")</i></div>"; } $tool_content .= "<div style='padding-top: .5em;'><a href='{$gradelink}'><b>{$label}</b></a>\n\t\t\t\t <a href='{$gradelink}'><img src='{$themeimg}/{$icon}'></a>\n\t\t\t\t {$comments}\n\t\t\t\t <a href='{$reportlink}'><b>{$langAutoJudgeShowWorkResultRpt}</b></a>\n </td>\n </tr>"; $i++; } //END of Foreach $tool_content .= "</table>\n <p class='smaller right'><img src='{$themeimg}/email.png' alt='' >\n {$m['email_users']}: <input type='checkbox' value='1' name='email'></p>\n <p><input class='btn btn-primary' type='submit' name='submit_grades' value='{$langGradeOk}'></p>\n </form>"; } else { // display pie chart with grades results if ($gradesExists) { // Used to display grades distribution chart $graded_submissions_count = Database::get()->querySingle("SELECT COUNT(*) AS count FROM assignment_submit AS assign, user\n WHERE assign.assignment_id = ?d AND user.id = assign.uid AND\n assign.grade <> ''", $id)->count; $chart = new Plotter(); $chart->setTitle("{$langGraphResults}"); foreach ($gradeOccurances as $gradeValue => $gradeOccurance) { $percentage = round(100.0 * $gradeOccurance / $graded_submissions_count, 2); $chart->growWithPoint("{$gradeValue} ({$percentage}%)", $percentage); } $tool_content .= $chart->plot(); } } } else { $tool_content .= "\n <p class='sub_title1'>{$langSubmissions}:</p>\n <div class='alert alert-warning'>{$langNoSubmissions}</div>"; } }
array( 'title' => $langDelete, 'url' => "$_SERVER[SCRIPT_NAME]?$url_params&action=delPost&pId=".$post->getId(), 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langSureToDelBlogPost, 'show' => $allow_to_edit ) ))." </div> <h3 class='panel-title'> <a href='$_SERVER[SCRIPT_NAME]?$url_params&action=showPost&pId=".$post->getId()."'>".q($post->getTitle())."</a> </h3> </div> <div class='panel-body'> <div class='label label-success'>" . nice_format($post->getTime(), true). "</div><small>".$langBlogPostUser.display_user($post->getAuthor(), false, false)."</small><br><br>".standard_text_escape(ellipsize_html($post->getContent(), $num_chars_teaser_break, "<strong> ...<a href='$_SERVER[SCRIPT_NAME]?$url_params&action=showPost&pId=".$post->getId()."'> <span class='smaller'>[$langMore]</span></a></strong>"))." $comment_content </div> <div class='panel-footer'> <div class='row'> <div class='col-sm-6'>$rating_content</div> <div class='col-sm-6 text-right'>$sharing_content</div> </div> </div> </div>"; } //display navigation links $tool_content .= $blog->navLinksHTML($page, $posts_per_page);
draw($tool_content, 2); exit; } if (!$objExercise->selectScore() && !$is_editor) { redirect_to_home_page("modules/exercise/index.php?course={$course_code}"); } } if (isset($_SESSION['objExercise'][$exerciseId])) { $objExercise = $_SESSION['objExercise'][$exerciseId]; } $exerciseTitle = $objExercise->selectTitle(); $exerciseDescription = $objExercise->selectDescription(); $exerciseDescription_temp = nl2br(make_clickable($exerciseDescription)); $tool_content .= "\n<div class='table-responsive'>\n <table class='table-default'>\n <tr>\n <th>" . q($exerciseTitle) . "</th>\n </tr>"; if ($exerciseDescription_temp) { $tool_content .= "\n <tr>\n <td>" . standard_text_escape($exerciseDescription_temp) . "</td>\n </tr>"; } $tool_content .= "</table>\n</div><br>"; $status = isset($_GET['status']) ? intval($_GET['status']) : 0; $tool_content .= "<select class='form-control' style='margin:0 0 12px 0;' id='status_filtering'>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}' " . ($status == 0 ? 'selected' : '') . ">--- {$langCurrentStatus} ---</option>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}&status=" . ATTEMPT_COMPLETED . "' " . ($status == 1 ? 'selected' : '') . ">{$langAttemptCompleted}</option>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}&status=" . ATTEMPT_PENDING . "' " . ($status == 2 ? 'selected' : '') . ">{$langAttemptPending}</option>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}&status=" . ATTEMPT_PAUSED . "' " . ($status == 3 ? 'selected' : '') . ">{$langAttemptPaused}</option>\n <option value='results.php?course={$course_code}&exerciseId={$exerciseId}&status=" . ATTEMPT_CANCELED . "' " . ($status == 4 ? 'selected' : '') . ">{$langAttemptCanceled}</option>\n </select>"; //This part of the code could be improved if ($is_editor) { $result = Database::get()->queryArray("SELECT DISTINCT uid FROM `exercise_user_record` WHERE eid in (SELECT id FROM exercise WHERE course_id = ?d)", $course_id); } else { $result[] = (object) array('uid' => $uid); } $extra_sql = $status != 0 ? 'AND attempt_status = ' . $status : ''; foreach ($result as $row) { $sid = $row->uid; $theStudent = Database::get()->querySingle("SELECT surname, givenname, am FROM user WHERE id = ?d", $sid); $result2 = Database::get()->queryArray("SELECT DATE_FORMAT(a.record_start_date, '%Y-%m-%d / %H:%i') AS record_start_date, a.record_end_date,\n CASE b.time_constraint WHEN 0 THEN TIME_TO_SEC(TIMEDIFF(a.record_end_date, a.record_start_date))\n ELSE b.time_constraint*60-a.secs_remaining END AS time_duration, a.total_score, a.total_weighting, a.eurid, a.attempt_status\n FROM `exercise_user_record` a, exercise b WHERE a.uid = ?d AND a.eid = ?d AND a.eid = b.id {$extra_sql}", $sid, $exerciseId);
foreach ($posts as $post) { $sharing_content = ''; $rating_content = ''; if ($sharing_allowed) { $sharing_content = $sharing_enabled ? print_sharing_links($urlServer . "modules/blog/index.php?course={$course_code}&action=showPost&pId=" . $post->getId(), $post->getTitle()) : ''; } if ($ratings_enabled) { $rating = new Rating('up_down', 'blogpost', $post->getId()); $rating_content = $rating->put($is_editor, $uid, $course_id); } if ($comments_enabled) { $comm = new Commenting('blogpost', $post->getId()); $comment_content = "<a class='btn btn-primary btn-xs pull-right' href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=showPost&pId=" . $post->getId() . "#comments_title'>{$langComments} (" . $comm->getCommentsNum() . ")</a>"; } else { $comment_content = "<div class=\"blog_post_empty_space\"></div>"; } $tool_content .= "<div class='panel panel-action-btn-default'>\r\n <div class='panel-heading'>\r\n <div class='pull-right'>\r\n " . action_button(array(array('title' => $langModify, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=editPost&pId=" . $post->getId(), 'icon' => 'fa-edit', 'show' => $post->permEdit($is_editor, $stud_allow_create, $uid)), array('title' => $langDelete, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=delPost&pId=" . $post->getId(), 'icon' => 'fa-times', 'class' => 'delete', 'confirm' => $langSureToDelBlogPost, 'show' => $post->permEdit($is_editor, $stud_allow_create, $uid)))) . "\r\n </div>\r\n <h3 class='panel-title'>\r\n <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=showPost&pId=" . $post->getId() . "'>" . q($post->getTitle()) . "</a>\r\n </h3> \r\n </div>\r\n <div class='panel-body'>\r\n <div class='label label-success'>" . nice_format($post->getTime(), true) . "</div><small>" . $langBlogPostUser . display_user($post->getAuthor(), false, false) . "</small><br><br>" . standard_text_escape(ellipsize_html($post->getContent(), $num_chars_teaser_break, "<strong> ...<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&action=showPost&pId=" . $post->getId() . "'> <span class='smaller'>[{$langMore}]</span></a></strong>")) . "\r\n {$comment_content}\r\n </div>\r\n <div class='panel-footer'>\r\n <div class='row'>\r\n <div class='col-sm-6'>{$rating_content}</div>\r\n <div class='col-sm-6 text-right'>{$sharing_content}</div>\r\n </div> \r\n </div>\r\n </div>"; } //display navigation links $tool_content .= $blog->navLinksHTML($page, $posts_per_page); $tool_content .= "</div>"; /***end of blog posts area***/ /***sidebar area***/ $tool_content .= "<div class='col-sm-3'>"; $tool_content .= $blog->popularBlogPostsHTML($num_popular); $tool_content .= $blog->chronologicalTreeHTML(date('n', strtotime($posts[0]->getTime())), date('Y', strtotime($posts[0]->getTime()))); $tool_content .= "</div></div>"; /***end of sidebar area***/ } } draw($tool_content, 2, null, $head_content);
} if (!empty($g->url)) { $urllink = "<div><span class='term-url'><small><a href='" . q($g->url) . "' target='_blank'>" . q($g->url) . " <i class='fa fa-external-link' style='color:#444;'></i></a></small></span></div>"; } else { $urllink = ''; } if (!empty($g->category_id)) { $cat_descr = "<span class='text-muted'>$langCategory: <a href='$base_url&cat=" . getIndirectReference($g->category_id) . "'>" . q($categories[$g->category_id]) . "</a></span>"; } else { $cat_descr = ''; } if (!empty($g->notes)) { $urllink .= "<br><u>$langComments:</u><div class='text-muted'>". standard_text_escape($g->notes)."</div>"; } if (!empty($g->definition)) { $definition_data = q($g->definition); } else { $definition_data = '-'; } $tool_content .= "<tr> <td width='150'><strong><a href='$base_url&id=" . getIndirectReference($g->id) . "'>" . q($g->term) . "</a></strong><br><span><small>$cat_descr</small></span></td> <td><em>$definition_data</em>$urllink</td>"; if ($is_editor) { $tool_content .= "<td class='option-btn-cell'>"; $tool_content .= action_button(array(
} else { $tool_content .= "<div class='alert alert-warning'>{$langAttendanceNoActMessage1} <a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&addActivity=1'>{$langHere}</a> {$langAttendanceNoActMessage3}</div>"; } } } else { //============Student View================== $pageName = $langAttendance; $userID = $uid; $result = Database::get()->queryArray("SELECT * FROM attendance_activities WHERE attendance_id = ?d ORDER BY `DATE` DESC", $attendance_id); $announcementNumber = count($result); if ($announcementNumber > 0) { $tool_content .= "<div class='alert alert-info'>" . userAttendTotal($attendance_id, $userID) . " " . $langAttendanceAbsencesFrom . " " . q($attendance_limit) . " " . $langAttendanceAbsencesFrom2 . " </div>"; $tool_content .= "<script type='text/javascript' src='../auth/sorttable.js'></script>\n <div class='row'><div class='col-sm-12'><div class='table-responsive'>\n <table class='table-default sortable' id='t2'>"; $tool_content .= "<tr><th >{$langTitle}</th><th>{$langAttendanceActivityDate2}</th><th>{$langDescription}</th><th>{$langAttendanceAbsencesYes}</th></tr>"; foreach ($result as $announce) { $content = standard_text_escape($announce->description); $d = strtotime($announce->date); $tool_content .= "<tr><td><b>"; if (empty($announce->title)) { $tool_content .= $langAnnouncementNoTille; } else { $tool_content .= q($announce->title); } $tool_content .= "</b>"; $tool_content .= "</td>" . "<td><div class='smaller'><span class='day'>" . ucfirst(claro_format_locale_date($dateFormatLong, $d)) . "</span> ({$langHour}: " . ucfirst(date('H:i', $d)) . ")</div></td>" . "<td>" . $content . "</td>"; $tool_content .= "<td class='center'>"; //check if the user has attend for this activity $userAttend = Database::get()->querySingle("SELECT attend FROM attendance_book\n WHERE attendance_activity_id = ?d AND uid = ?d", $announce->id, $userID); if ($userAttend) { $attend = $userAttend->attend; if ($attend) {
/** * display action details in dropbox * @param type $details * @return string */ private function dropbox_action_details($details) { global $langFileName, $langSubject, $langMessage; $details = unserialize($details); $content = "{$langSubject} «" . q($details['subject']) . "»"; if (!empty($details['filename'])) { $content .= " — {$langFileName} «" . q($details['filename']) . "»"; } if (!empty($details['body'])) { $content .= " — {$langMessage} «" . standard_text_escape($details['body']) . "»"; } return $content; }
return true; } // find the order if ($announcement->id == $thisAnnouncementId) { $thisAnnouncementOrder = $announcement->order; $thisAnnouncementOrderFound = true; } }); } // display admin announcements if ($displayAnnouncementList == true) { $result = Database::get()->queryArray("SELECT * FROM admin_announcement ORDER BY `order` DESC"); $bottomAnnouncement = $announcementNumber = count($result); if ($announcementNumber > 0) { $tool_content .= "<div class='table-responsive'><table class='table-default'>\n <tr><th>{$langTitle}</th>\n <th>{$langAnnouncement}</th>\n <th colspan='2'><div align='center'>" . icon('fa-gears') . "</th>"; foreach ($result as $myrow) { if ($myrow->visible == 1) { $visibility = 0; $classvis = ''; } else { $visibility = 1; $classvis = 'not_visible'; } $myrow->date = claro_format_locale_date($dateFormatLong, strtotime($myrow->date)); $tool_content .= "<tr class='{$classvis}'>\n <td width='200'><b>" . q($myrow->title) . "</b><br><span class='smaller'>{$myrow->date}</span></td>\n <td>" . standard_text_escape($myrow->body) . "</td>\n <td width='6'>" . action_button(array(array('title' => $langModify, 'url' => "{$_SERVER['SCRIPT_NAME']}?modify={$myrow->id}", 'icon' => 'fa-edit'), array('title' => $langDelete, 'class' => 'delete', 'url' => "{$_SERVER['SCRIPT_NAME']}?delete={$myrow->id}", 'confirm' => $langConfirmDelete, 'icon' => 'fa-times'), array('title' => $langVisibility, 'url' => "{$_SERVER['SCRIPT_NAME']}?id={$myrow->id}&vis={$visibility}", 'icon' => $visibility == 0 ? 'fa-eye' : 'fa-eye-slash'), array('title' => $langUp, 'url' => "{$_SERVER['SCRIPT_NAME']}?up={$myrow->id}", 'icon' => 'fa-arrow-up'), array('title' => $langDown, 'url' => "{$_SERVER['SCRIPT_NAME']}?down={$myrow->id}", 'icon' => 'fa-arrow-down'))) . "\n </td></tr>"; } $tool_content .= "</table>"; $tool_content .= "</div>"; } } draw($tool_content, 3, null, $head_content);
/** * @brief display resource link * @global type $id * @global string $tool_content * @global type $mysqlMainDb * @global type $urlServer * @global type $is_editor * @global type $langWasDeleted * @global type $course_id * @global type $course_code * @global type $langInactiveModule * @param type $title * @param type $comments * @param type $resource_id * @param type $link_id * @param type $visibility * @return string */ function show_link($title, $comments, $resource_id, $link_id, $visibility) { global $urlServer, $is_editor, $langWasDeleted, $course_id, $course_code, $themeimg, $langInactiveModule; $module_visible = visible_module(MODULE_ID_LINKS); // checks module visibility if (!$module_visible and !$is_editor) { return ''; } $comment_box = $class_vis = $imagelink = $link = ''; $class_vis = ($visibility == 0 or !$module_visible) ? ' class="not_visible"' : ' '; $title = q($title); $l = Database::get()->querySingle("SELECT * FROM link WHERE course_id = ?d AND id = ?d", $course_id, $link_id); if (!$l) { // check if it was deleted if (!$is_editor) { return ''; } else { $status = 'del'; $imagelink = icon('fa-times'); $exlink = "<span class='not_visible'>" . q($title) . " ({$langWasDeleted})</span>"; } } else { $eurl = urlencode($l->url); $link = "<a href='{$urlServer}modules/link/go.php?course={$course_code}&id={$link_id}&url={$eurl}' target='_blank'>"; if ($title == '') { $title = q($l->url); } $exlink = $link . "{$title}</a>"; if (!$module_visible) { $exlink .= " <i>({$langInactiveModule})</i>"; } $imagelink = $link . "" . icon('fa-link') . "</a>"; } if (!empty($comments)) { $comment_box = '<br />' . standard_text_escape($comments); } else { $comment_box = ''; } return "\n <tr{$class_vis}>\n <td>{$imagelink}</td>\n <td>{$exlink} {$comment_box}</td>" . actions('link', $resource_id, $visibility) . "\n </tr>"; }
/** * Clone an Exercise */ function duplicate() { global $langCopy2, $course_id; $id = $this->id; $exercise = $this->exercise . " ({$langCopy2})"; $description = standard_text_escape($this->description); $type = $this->type; $startDate = $this->startDate; $endDate = $this->endDate; $tempSave = $this->tempSave; $timeConstraint = $this->timeConstraint; $attemptsAllowed = $this->attemptsAllowed; $random = $this->random; $active = $this->active; $public = $this->public; $results = $this->results; $score = $this->score; $clone_id = Database::get()->query("INSERT INTO `exercise` (course_id, title, description, type, start_date, \n end_date, temp_save, time_constraint, attempts_allowed, random, active, results, score) \n VALUES (?d, ?s, ?s, ?d, ?t, ?t, ?d, ?d, ?d, ?d, ?d, ?d, ?d)", $course_id, $exercise, $description, $type, $startDate, $endDate, $tempSave, $timeConstraint, $attemptsAllowed, $random, $active, $results, $score)->lastInsertID; Database::get()->query("INSERT INTO `exercise_with_questions` (question_id, exercise_id)\n SELECT question_id, ?d\n FROM `exercise_with_questions`\n WHERE exercise_id = ?d", $clone_id, $id); }
redirect_to_home_page("modules/exercise/results.php?course=$course_code&exerciseId=$exerciseId"); } $exerciseTitle = $objExercise->selectTitle(); $exerciseDescription = $objExercise->selectDescription(); $exerciseDescription_temp = nl2br(make_clickable($exerciseDescription)); $tool_content .= " <div class='table-responsive'> <table class='table-default'> <tr> <th>" . q_math($exerciseTitle) . "</th> </tr>"; if($exerciseDescription_temp) { $tool_content .= " <tr> <td>" . standard_text_escape($exerciseDescription_temp) . "</td> </tr>"; } $tool_content .= "</table> </div><br>"; $status = (isset($_GET['status'])) ? intval($_GET['status']) : 0; $tool_content .= "<select class='form-control' style='margin:0 0 12px 0;' id='status_filtering'> <option value='results.php?course=$course_code&exerciseId=$exerciseId' ".(($status == 0)? 'selected' : '').">--- $langCurrentStatus ---</option> <option value='results.php?course=$course_code&exerciseId=$exerciseId&status=".ATTEMPT_COMPLETED."' ".(($status == 1)? 'selected' : '').">$langAttemptCompleted</option> <option value='results.php?course=$course_code&exerciseId=$exerciseId&status=".ATTEMPT_PENDING."' ".(($status == 2)? 'selected' : '').">$langAttemptPending</option> <option value='results.php?course=$course_code&exerciseId=$exerciseId&status=".ATTEMPT_PAUSED."' ".(($status == 3)? 'selected' : '').">$langAttemptPaused</option> <option value='results.php?course=$course_code&exerciseId=$exerciseId&status=".ATTEMPT_CANCELED."' ".(($status == 4)? 'selected' : '').">$langAttemptCanceled</option> </select>"; //This part of the code could be improved if ($is_editor) { $result = Database::get()->queryArray("SELECT DISTINCT uid FROM `exercise_user_record` WHERE eid in (SELECT id FROM exercise WHERE course_id = ?d)", $course_id);
/** * This function displays the list of available exercises in this course * With the form to add a selected exercise in the learning path * * @param string $dialogBox Error or confirmation text * * @author Thanos Kyritsis <*****@*****.**> * @author Piraux Sebastien <*****@*****.**> * @author Lederer Guillaume <*****@*****.**> */ function display_my_exercises($dialogBox, $style) { global $langAddModulesButton, $langExercise, $langNoEx, $langSelection, $course_code, $course_id; $output = ""; /* -------------------------------------- DIALOG BOX SECTION -------------------------------------- */ if (!empty($dialogBox)) { $output .= disp_message_box($dialogBox, $style) . '<br />' . "\n"; } $output .= '<form method="POST" name="addmodule" action="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '&cmdglobal=add">' . "\n"; $output .= '<div class="table-responsive"><table class="table-default">' . "\n" . '<tr class="list-header">' . "" . '<th><div align="left">' . $langExercise . '</div></th>' . "\n" . '<th width="10"><div align="center">' . $langSelection . '</div></th>' . "\n" . '</tr>'; // Display available modules $atleastOne = FALSE; $sql = "SELECT `id`, `title`, `description`\n FROM `exercise`\n WHERE course_id = ?d\n AND active = 1\n ORDER BY `title`, `id`"; $exercises = Database::get()->queryArray($sql, $course_id); if (is_array($exercises) && !empty($exercises)) { foreach ($exercises as $exercise) { $output .= '<tr>' . '<td align="left">' . '<label for="check_' . $exercise->id . '" >' . icon('fa-pencil-square-o', $langExercise) . ' ' . q($exercise->title) . '</label>' . '<br />'; // COMMENT if (!empty($exercise->description)) { $output .= '<span class="comments">' . standard_text_escape($exercise->description) . '</span>' . '</td>'; } else { $output .= '</td>'; } $output .= '<td align="center">' . '<input type="checkbox" name="check_' . $exercise->id . '" id="check_' . $exercise->id . '" value="' . $exercise->id . '" />' . '</td>' . '</tr>'; $atleastOne = true; } //end while another module to display } if (!$atleastOne) { $output .= '<tr>' . '<td colspan="2" align="center">' . $langNoEx . '</td>' . '</tr>'; } // Display button to add selected modules if ($atleastOne) { $output .= '<tr>' . '<th colspan="2"><div class="pull-right">' . '<input class="btn btn-primary" type="submit" name="insertExercise" value="' . $langAddModulesButton . '">' . '</div></th>' . '</tr>'; } $output .= '</table></div></form>'; return $output; }
<td>"); if ($studentChoice) { echo standard_text_escape(nl2br(make_clickable($answerComment))); } else { echo (' '); } echo ("</td></tr>"); } elseif ($answerType == FILL_IN_BLANKS || $answerType == FILL_IN_BLANKS_TOLERANT) { echo (" <tr class='even'> <td>" . standard_text_escape(nl2br($answer)) . "</td> </tr>"); } else { echo (" <tr class='even'> <td>" . standard_text_escape($answer) . "</td> <td>${choice[$answerId]} / <font color='green'><b>${matching[$answerCorrect]}</b></font></td> </tr>"); } } } // end of if } // end for() if ($displayScore == 1) { echo (" <tr class='even'> <th colspan='$colspan' class='odd'><div align='right'> $langQuestionScore: <b>$questionScore/$questionWeighting</b></div> </th> </tr>"); } echo ("</table>");
$pageName = $langPHPInfo; $navigation[] = array('url' => 'index.php', 'name' => $langAdmin); // Display link to go back to index.php $tool_content .= action_bar(array( array('title' => $langBack, 'url' => "index.php", 'icon' => 'fa-reply', 'level' => 'primary-label'))); // Display phpinfo $tool_content .= "<div class='alert alert-info'>"; ob_start(); phpinfo(); $tool_content .= standard_text_escape(ob_get_contents()); ob_end_clean(); $tool_content .= '</div>'; $local_head_contents = '<style type="text/css"> pre {margin: 0px; font-family: monospace;} table {border-collapse: collapse;} .center {text-align: center;} .center table { margin-left: auto; margin-right: auto; text-align: left;} .center th { text-align: center !important; } td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;} h1 {font-size: 150%;} h2 {font-size: 125%;} .p {text-align: left;} .e {background-color: #ccccff; font-weight: bold; color: #000000;} .h {background-color: #9999cc; font-weight: bold; color: #000000;}
/** * A function to generate event block in day calendar * @param object $event event to format * @param string $color event color * @return html formatted item */ public static function day_calendar_item($event, $class) { global $urlServer, $is_admin, $langVisible, $dateFormatLong, $langDuration, $langAgendaNoTitle, $langModify, $langDelete, $langHour, $langConfirmDelete, $langReferencedObject; $formatted_calendar_item = ""; $formatted_calendar_item .= "<tr {$class}>"; $formatted_calendar_item .= "<td valign='top'><div class=\"legend_color\" style=\"float:left;margin:3px;height:16px;width:16px;background-color:" . Calendar_Events::$calsettings->{$event->event_group . "_color"} . "\"></div></td>"; $formatted_calendar_item .= "<td valign='top'>"; $eventdate = strtotime($event->start); $formatted_calendar_item .= $langHour . ": " . ucfirst(date('H:i', $eventdate)); if ($event->duration != '') { $msg = "({$langDuration}: " . q($event->duration) . ")"; } else { $msg = ''; } $formatted_calendar_item .= "<br><b><div class='event'>"; $link = str_replace('thisid', $event->id, $urlServer . Calendar_Events::$event_type_url[$event->event_type]); if ($event->event_type != 'personal' && $event->event_type != 'admin') { $link = str_replace('thiscourse', $event->course, $link); } if ($event->title == '') { $formatted_calendar_item .= $langAgendaNoTitle; } else { if (!$is_admin && $event->event_type == 'admin') { $formatted_calendar_item .= q($event->title); } else { $formatted_calendar_item .= "<a href=\"" . $link . "\">" . q($event->title) . "</a>"; } } if ($event->event_type == "personal") { $fullevent = Calendar_Events::get_event($event->id); if ($reflink = References::item_link($fullevent->reference_obj_module, $fullevent->reference_obj_type, $fullevent->reference_obj_id, $fullevent->reference_obj_course)) { $formatted_calendar_item .= "</b> {$msg} " . standard_text_escape($event->content) . "{$langReferencedObject}: " . $reflink . "</div></td>"; } } else { $formatted_calendar_item .= "</b> {$msg} " . standard_text_escape($event->content) . "</div></td>"; } $formatted_calendar_item .= "<td class='right' width='70'>"; if ($event->event_type == "personal" || $event->event_type == "admin" && $is_admin) { $formatted_calendar_item .= icon('fa-edit', $langModify, str_replace('thisid', $event->id, Calendar_Events::$event_type_url[$event->event_type])) . " \r\n " . icon('fa-times', $langDelete, "?delete={$event->id}&et={$event->event_type}", "onClick=\"return confirmation('{$langConfirmDelete}');\"") . " "; } $formatted_calendar_item .= "</td>"; $formatted_calendar_item .= "</tr>"; return $formatted_calendar_item; }
include '../../include/baseTheme.php'; require_once 'include/lib/textLib.inc.php'; $pageName = $langAnnouncements; $isaid = isset($_GET['aid']); $announceArr = Database::get()->queryArray($isaid ? "SELECT `date`, `title` , `body` FROM `admin_announcement` WHERE id = ?d" : "SELECT `date`, `title` , `body` FROM `admin_announcement` WHERE `visible` = 1 AND lang = ?s ORDER BY `date` DESC", $isaid ? intval($_GET['aid']) : $language); $numOfAnnouncements = count($announceArr); $tool_content .= action_bar(array( array('title' => $langBack, 'url' => $urlServer, 'icon' => 'fa-reply', 'level' => 'primary-label', 'button-class' => 'btn-default') ),false); if ($numOfAnnouncements > 0) { $tool_content .= "<div class='row'><div class='col-xs-12'><div class='panel'><div class='panel-body'>"; for ($i = 0; $i < $numOfAnnouncements; $i++) { $tool_content .= "<div class='single_announcement'><div class='announcement-title'>" . q($announceArr[$i]->title) . "</div> <span class='announcement-date'>- " . claro_format_locale_date($dateFormatLong, strtotime($announceArr[$i]->date)) . " -</span> <div class='announcement-main'>" . standard_text_escape($announceArr[$i]->body) . "</div> </div>"; } $tool_content .= "</div></div></div></div>"; } draw($tool_content, 0);