/** * Deletes an existing event and logs the action * @param int $eventid id in table personal_calendar * @param string $eventtype type of the event: personal|admin|course|deadline * @param boolean $recursivelly specifies if the update should be applied to all events of the group of recursive events or to the specific one */ public static function delete_event($eventid, $eventtype, $recursivelly = false) { global $uid, $is_admin, $langNotAllowed; if ($eventtype != 'personal' && $eventtype != 'admin') { return array('success' => false, 'message' => $langNotAllowed); } if ($eventtype == 'personal' && !($event = Calendar_Events::get_event($eventid))) { return array('success' => false, 'message' => $langNotAllowed); } if ($eventtype == 'admin' && (!is_admin || !($event = Calendar_Events::get_admin_event($eventid)))) { return array('success' => false, 'message' => $langNotAllowed); } $t = $eventtype == 'personal' ? 'personal_calendar' : 'admin_calendar'; $content = ellipsize_html(canonicalize_whitespace(strip_tags($event->content)), 50, '+'); $where_clause = $recursivelly ? "WHERE source_event_id = ?d" : "WHERE id = ?d"; $resp = Database::get()->query("DELETE FROM {$t} " . $where_clause, $eventid); $m = $eventtype == 'personal' ? MODULE_ID_PERSONALCALENDAR : MODULE_ID_ADMINCALENDAR; Log::record(0, $m, LOG_DELETE, array('user_id' => $uid, 'id' => $eventid, 'title' => $event->title, 'content' => $content)); return array('success' => true, 'message' => '', 'event' => $eventid); }
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>
/** * Deletes an existing event and logs the action * @param int $noteid id in table note */ function delete_event($eventid, $recursivelly = false){ global $course_id, $is_admin, $is_editor, $langNotAllowed, $uid; $rec_event = Database::get()->querySingle('SELECT * FROM agenda WHERE id=?d AND course_id=?d',$eventid,$course_id); if($rec_event && ($is_admin || $is_editor)){ $content = ellipsize_html(canonicalize_whitespace(strip_tags($rec_event->content)), 50, '+'); $where_clause = ($recursivelly)? " WHERE source_event_id = ?d":" WHERE id = ?d"; $d = Database::get()->query("DELETE FROM agenda ".$where_clause, $eventid); if($d){ Log::record($course_id, MODULE_ID_AGENDA, LOG_DELETE, array('user_id' => $uid, 'id' => $eventid, 'title' => $rec_event->title, 'content' => $content, 'recursive'=>$recursivelly)); } return array('success'=>true,'message'=>'', 'event'=>$eventid); } else { return array('success'=>true,'message'=>$langNotAllowed); } }
$tool_content .= ">\n <input type='hidden' value='" . $actID . "' name='actID'>\n </td>"; $tool_content .= "\n </tr>"; } $tool_content .= "</tbody></table> <input type='submit' class='btn btn-default' name='bookUsersToAct' value='{$langAttendanceBooking}' /></form>"; } $showAttendanceActivities = 0; } //DISPLAY: list of attendance activities if ($showAttendanceActivities == 1) { //get all the available activities $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='row'><div class='col-sm-12'><div class='table-responsive'>\n <table class='table-default'>\n <tr><th class='text-center' colspan='5'>{$langAttendanceActList}</th></tr>\n <tr> \n <th>{$langTitle}</th>\n <th>{$langAttendanceActivityDate}</th>\n <th>{$langType}</th>\n <th>{$langAttendanceAbsences}</th>\n <th class='text-center'><i class='fa fa-cogs'></i></th>\n </tr>"; foreach ($result as $announce) { $content = ellipsize_html($announce->description, 50); $d = strtotime($announce->date); $tool_content .= "<tr><td>"; if (empty($announce->title)) { $tool_content .= $langAnnouncementNoTille; } else { $tool_content .= q($announce->title); } $tool_content .= "</td>\n <td>" . ucfirst(claro_format_locale_date($dateFormatLong, $d)) . " ({$langHour}: " . ucfirst(date('H:i', $d)) . ")</td>"; $tool_content .= "<td class='smaller'>"; if ($announce->module_auto_id) { if ($announce->module_auto_id == 1) { $tool_content .= $langExercise; } elseif ($announce->module_auto_id == 2) { $tool_content .= $langAssignment; }
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);
} if (!empty($_POST['id'])) { $id = intval($_POST['id']); Database::get()->query("UPDATE announcement SET content = ?s, title = ?s, `date` = " . DBHelper::timeAfter() . ", start_display = ?t, stop_display = ?t WHERE id = ?d", $newContent, $antitle, $start_display, $stop_display, $id); $log_type = LOG_MODIFY; $message = "<div class='alert alert-success'>{$langAnnModify}</div>"; } else { // add new announcement $orderMax = Database::get()->querySingle("SELECT MAX(`order`) AS maxorder FROM announcement\n WHERE course_id = ?d", $course_id)->maxorder; $order = $orderMax + 1; // insert $id = Database::get()->query("INSERT INTO announcement\n SET content = ?s,\n title = ?s, `date` = " . DBHelper::timeAfter() . ",\n course_id = ?d, `order` = ?d,\n visible = 1,\n start_display = ?t,\n stop_display = ?t", $newContent, $antitle, $course_id, $order, $start_display, $stop_display)->lastInsertID; $log_type = LOG_INSERT; } Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_ANNOUNCEMENT, $id); $txt_content = ellipsize_html(canonicalize_whitespace(strip_tags($_POST['newContent'])), 50, '+'); Log::record($course_id, MODULE_ID_ANNOUNCE, $log_type, array('id' => $id, 'email' => $send_mail, 'title' => $_POST['antitle'], 'content' => $txt_content)); // send email if ($send_mail) { $recipients_emaillist = ""; foreach ($_POST['recipients'] as $re) { $recipients_emaillist .= empty($recipients_emaillist) ? "'{$re}'" : ",'{$re}'"; } $emailContent = "{$professorMessage}: " . q($_SESSION['givenname']) . " " . q($_SESSION['surname']) . "<br>\n<br>\n" . q($_POST['antitle']) . "<br>\n<br>\n" . $_POST['newContent']; $emailSubject = "{$professorMessage} ({$public_code} - " . q($title) . " - {$langAnnouncement})"; // select students email list $countEmail = 0; $invalid = 0; $recipients = array(); $emailBody = html2text($emailContent); $linkhere = " <a href='{$urlServer}main/profile/emailunsubscribe.php?cid={$course_id}'>{$langHere}</a>.";
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);
/** * @brief Enter the modified info submitted from the link form into the database * @global type $course_id * @global type $langLinkMod * @global type $langLinkAdded * @global type $urllink * @global type $title * @global type $description * @global type $selectcategory * @global type $langLinkNotPermitted * @global string $state * @return type */ function submit_link() { global $course_id, $langLinkMod, $langLinkAdded, $course_code, $uid, $langSocialCategory, $urllink, $title, $description, $selectcategory, $langLinkNotPermitted, $state; register_posted_variables(array('urllink' => true, 'title' => true, 'description' => true), 'all', 'trim'); $urllink = canonicalize_url($urllink); if (!is_url_accepted($urllink,"(https?|ftp)")){ $message = $langLinkNotPermitted; if (isset($_POST['id'])) { $id = getDirectReference($_POST['id']); redirect_to_home_page("modules/link/index.php?course=$course_code&action=editlink&id=" . getIndirectReference($id) . "&urlview="); } else { redirect_to_home_page("modules/link/index.php?course=$course_code&action=addlink&urlview="); } } $set_sql = "SET url = ?s, title = ?s, description = ?s, category = ?d"; $terms = array($urllink, $title, purify($description), intval(getDirectReference($_POST['selectcategory']))); if (isset($_POST['id'])) { $id = intval(getDirectReference($_POST['id'])); Database::get()->query("UPDATE `link` $set_sql WHERE course_id = ?d AND id = ?d", $terms, $course_id, $id); $log_type = LOG_MODIFY; } else { $order = Database::get()->querySingle("SELECT MAX(`order`) as maxorder FROM `link` WHERE course_id = ?d AND category = ?d", $course_id, getDirectReference($_POST['selectcategory']))->maxorder; $order++; $id = Database::get()->query("INSERT INTO `link` $set_sql, course_id = ?d, `order` = ?d, user_id = ?d", $terms, $course_id, $order, $uid)->lastInsertID; $log_type = LOG_INSERT; } Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_LINK, $id); // find category name if ($selectcategory == -2) { $category = $langSocialCategory; } else { $category_object = Database::get()->querySingle("SELECT link_category.name as name FROM link, link_category WHERE link.category = link_category.id AND link.course_id = ?s AND link.id = ?d", $course_id, $id); $category = $category_object ? $category_object->name : 0; } $txt_description = ellipsize_html(canonicalize_whitespace(strip_tags($description)), 50, '+'); Log::record($course_id, MODULE_ID_LINKS, $log_type, @array('id' => $id, 'url' => $urllink, 'title' => $title, 'description' => $txt_description, 'category' => $category)); }
/** * @brief display available assignments for adding them to gradebook * @global type $course_id * @global type $course_code * @global type $tool_content * @global type $dateFormatLong * @global type $langWorks * @global type $m * @global type $langDescription * @global type $langAttendanceNoActMessageAss4 * @global type $langAdd * @global type $langTitle * @global type $langHour * @param type $gradebook_id */ function display_available_assignments($gradebook_id) { global $course_id, $course_code, $tool_content, $dateFormatLong, $langWorks, $m, $langDescription, $langAttendanceNoActMessageAss4, $langAdd, $langTitle, $langHour; $checkForAss = Database::get()->queryArray("SELECT * FROM assignment WHERE assignment.course_id = ?d AND assignment.active = 1 AND assignment.id NOT IN (SELECT module_auto_id FROM gradebook_activities WHERE module_auto_type = 1 AND gradebook_id = ?d)", $course_id, $gradebook_id); $checkForAssNumber = count($checkForAss); if ($checkForAssNumber > 0) { $tool_content .= " <div class='row'><div class='col-sm-12'><div class='table-responsive'> <table class='table-default'"; $tool_content .= "<tr class='list-header'><th>$langTitle</th><th>".q($m['deadline'])."</th><th>$langDescription</th>"; $tool_content .= "<th class='text-center'><i class='fa fa-cogs'></i></th>"; $tool_content .= "</tr>"; foreach ($checkForAss as $newAssToGradebook) { $content = ellipsize_html($newAssToGradebook->description, 50); if($newAssToGradebook->assign_to_specific){ $content .= "$m[WorkAssignTo]:<br>"; $checkForAssSpec = Database::get()->queryArray("SELECT user_id, user.surname , user.givenname FROM `assignment_to_specific`, user WHERE user_id = user.id AND assignment_id = ?d", $newAssToGradebook->id); foreach ($checkForAssSpec as $checkForAssSpecR) { $content .= q($checkForAssSpecR->surname). " " . q($checkForAssSpecR->givenname) . "<br>"; } } if ((int) $newAssToGradebook->deadline){ $d = strtotime($newAssToGradebook->deadline); $date_str = ucfirst(claro_format_locale_date($dateFormatLong, $d)); $hour_str = "($langHour: " . ucfirst(date('H:i', $d)).")"; } else { $date_str = $m['no_deadline']; $hour_str = ""; } $tool_content .= "<tr><td><b>"; if (!empty($newAssToGradebook->title)) { $tool_content .= q($newAssToGradebook->title); } $tool_content .= "</b>"; $tool_content .= "</td>" . "<td><div class='smaller'><span class='day'>".q($date_str)."</span> ".q($hour_str)." </div></td>" . "<td>" . $content . "</td>"; $tool_content .= "<td width='70' class='text-center'>".icon('fa-plus', $langAdd, "$_SERVER[SCRIPT_NAME]?course=$course_code&gradebook_id=" . getIndirectReference($gradebook_id) . "&addCourseActivity=" . getIndirectReference($newAssToGradebook->id) . "&type=1"); } // end of while $tool_content .= "</tr></table></div></div></div>"; } else { $tool_content .= "<div class='alert alert-warning'>$langAttendanceNoActMessageAss4</div>"; } }
$tool_content .= "</div>"; } $tool_content .= " </div>"; if (!empty($warning)) { $tool_content .= "<br><span>{$warning}</span>"; } $tool_content .= "</div>\n </div>\n </div>\n </div>\n </div>"; $rss_link = "<link rel='alternate' type='application/rss+xml' title='RSS-Feed' href='" . $urlServer . "rss.php'>"; $announceArr = Database::get()->queryArray("SELECT `id`, `date`, `title`, `body`, `order` FROM `admin_announcement`\n WHERE `visible` = 1\n AND lang=?s\n AND (`begin` <= NOW() or `begin` IS null)\n AND (NOW() <= `end` or `end` IS null)\n ORDER BY `order` DESC", $language); $ann_content = ''; if ($announceArr && sizeof($announceArr) > 0) { $ann_content .= "<h4>{$langAnnouncements} <a href='{$urlServer}rss.php' style='padding-left:5px;'>\n <i class='fa fa-rss-square'></i>\n </a></h4><ul class='front-announcements'>"; $numOfAnnouncements = sizeof($announceArr); for ($i = 0; $i < $numOfAnnouncements; $i++) { $aid = $announceArr[$i]->id; $ann_content .= "\n <li>\n <div><a class='announcement-title' href='modules/announcements/main_ann.php?aid={$aid}'>" . q($announceArr[$i]->title) . "</a></div>\n <span class='announcement-date'>- " . claro_format_locale_date($dateFormatLong, strtotime($announceArr[$i]->date)) . " -</span>\n " . standard_text_escape(ellipsize_html($announceArr[$i]->body, 500, "<div class='announcements-more'><a href='modules/announcements/main_ann.php?aid={$aid}'>{$langMore} …</a></div>")) . "</li>"; } } $tool_content .= "\n\n <div class='row'>\n\n <div class='col-md-8'>\n <div class='panel'>\n <div class='panel-body'>\n {$langInfoAbout}\n </div>\n </div>\n <div class='panel'>\n <div class='panel-body'>"; if (!empty($ann_content)) { $tool_content .= $ann_content; } else { $tool_content .= "<li>{$langNoRecentAnnounce}</li>"; } $tool_content .= "</ul></div>\n </div>\n </div>\n \n <div class='col-md-4'>\n\n "; $online_users = getOnlineUsers(); $tool_content .= "\n\n <div class='panel'>\n <div class='panel-body'>\n <i class='fa fa-group space-after-icon'></i>{$langOnlineUsers}: {$online_users}\n </div>\n </div>"; if (get_config('opencourses_enable')) { $tool_content .= "<div class='panel'>\n <div class='panel-body'>\n <a href='http://opencourses.gr'>\n <img class='img-responsive' src='{$themeimg}/open_courses_bnr.png'>\n </a>\n </div>\n </div>"; } if (get_config('enable_mobileapi')) {
/** * Deletes an existing note and logs the action * @param int $noteid id in table note */ public static function delete_note($noteid){ global $uid; $note = Database::get()->querySingle("SELECT title, content FROM note WHERE id = ?d ", $noteid); $content = ellipsize_html(canonicalize_whitespace(strip_tags($note->content)), 50, '+'); Database::get()->query("DELETE FROM note WHERE id = ?d", $noteid); Indexer::queueAsync(Indexer::REQUEST_REMOVE, Indexer::RESOURCE_NOTE, $noteid); Log::record(0, MODULE_ID_NOTES, LOG_DELETE, array('user_id' => $uid, 'id' => $noteid, 'title' => $note->title, 'content' => $content)); }
foreach ($notelist as $note) { $content = standard_text_escape($note->content); $note->date_time = claro_format_locale_date($dateFormatLong, strtotime($note->date_time)); $tool_content .= "<tr><td><b>"; if (empty($note->title)) { $tool_content .= $langNoteNoTitle; } else { $tool_content .= "<a href='$_SERVER[SCRIPT_NAME]?nid=" . getIndirectReference($note->id)."'>" . q($note->title) . "</a>"; } $tool_content .= "</b><br><small>" . nice_format($note->date_time) . "</small>"; if (!is_null($note->reference_obj_type)) { $tool_content .= "<br><small>$langReferencedObject: " . References::item_link($note->reference_obj_module, $note->reference_obj_type, $note->reference_obj_id, $note->reference_obj_course) . "</small>"; } $tool_content .= standard_text_escape(ellipsize_html($content, 500, "<strong> ...<a href='$_SERVER[SCRIPT_NAME]?nid=" . getIndirectReference($note->id)."'> <span class='smaller'>[$langMore]</span></a></strong>")); $tool_content .= "</td>"; $tool_content .= "<td class='option-btn-cell'>" . action_button(array( array('title' => $langEditChange, 'url' => "$_SERVER[SCRIPT_NAME]?modify=" . getIndirectReference($note->id), 'icon' => 'fa-edit'), array('title' => $langDelete, 'url' => "$_SERVER[SCRIPT_NAME]?delete=" . getIndirectReference($note->id), 'confirm' => $langSureToDelNote, 'class' => 'delete', 'icon' => 'fa-times'), array('title' => $langMove . " " . $langUp, 'url' => "$_SERVER[SCRIPT_NAME]?up=" . getIndirectReference($note->id), 'level' => 'primary',
$tool_content .= "</tr>"; } foreach ($notelist as $note) { $content = standard_text_escape($note->content); $note->date_time = claro_format_locale_date($dateFormatLong, strtotime($note->date_time)); $tool_content .= "<tr><td><b>"; if (empty($note->title)) { $tool_content .= $langNoteNoTitle; } else { $tool_content .= "<a href='{$_SERVER['SCRIPT_NAME']}?nid={$note->id}'>" . q($note->title) . "</a>"; } $tool_content .= "</b><br><small>" . nice_format($note->date_time) . "</small>"; if (!is_null($note->reference_obj_type)) { $tool_content .= "<br><small>{$langReferencedObject}: " . References::item_link($note->reference_obj_module, $note->reference_obj_type, $note->reference_obj_id, $note->reference_obj_course) . "</small>"; } $tool_content .= standard_text_escape(ellipsize_html($content, 500, "<strong> ...<a href='{$_SERVER['SCRIPT_NAME']}?nid={$note->id}'> <span class='smaller'>[{$langMore}]</span></a></strong>")); $tool_content .= "</td>"; $tool_content .= "<td class='option-btn-cell'>" . action_button(array(array('title' => $langModify, 'url' => "{$_SERVER['SCRIPT_NAME']}?modify={$note->id}", 'icon' => 'fa-edit'), array('title' => $langDelete, 'url' => "{$_SERVER['SCRIPT_NAME']}?delete={$note->id}", 'confirm' => $langSureToDelNote, 'class' => 'delete', 'icon' => 'fa-times'), array('title' => $langMove . " " . $langUp, 'url' => "{$_SERVER['SCRIPT_NAME']}?up={$note->id}", 'show' => $iterator != 1, 'icon' => 'fa-arrow-up'), array('title' => $langMove . " " . $langDown, 'url' => "{$_SERVER['SCRIPT_NAME']}?down=" . $note->id, 'show' => $iterator < $bottomNote, 'icon' => 'fa-arrow-down'))) . "</td>"; $tool_content .= "</tr>"; $iterator++; } // end of while $tool_content .= "</table></div>"; if ($noteNumber < 1) { $no_content = true; if (isset($_GET['addNote'])) { $no_content = false; } if (isset($_GET['modify'])) { $no_content = false; }
/** * @brief display forum posts from users courses * @global type $langNoPosts * @global type $langMore * @global type $urlServer * @param type $param * @param type $type * @return string */ function getUserForumPosts($lesson_id) { global $langNoPosts, $langMore, $urlServer; $last_month = strftime('%Y %m %d', strtotime('now -1 month')); $found = false; $forum_content = '<table width="100%">'; foreach ($lesson_id as $lid) { $q = Database::get()->queryArray("SELECT forum.id AS forumid,\n forum.name,\n forum_topic.id AS topicid,\n forum_topic.title, \n forum_post.post_time,\n forum_post.poster_id,\n forum_post.post_text\n FROM forum, forum_topic, forum_post, course_module\n WHERE CONCAT(forum_topic.title, forum_post.post_text) != ''\n AND forum.id = forum_topic.forum_id\n AND forum_post.topic_id = forum_topic.id\n AND forum.course_id = ?d\n AND DATE_FORMAT(forum_post.post_time, '%Y %m %d') >= ?t\n AND course_module.visible = 1\n AND course_module.module_id = " . MODULE_ID_FORUM . "\n AND course_module.course_id = ?d\n ORDER BY forum_post.post_time LIMIT 10", $lid, $last_month, $lid); if ($q) { $found = true; $forum_content .= "<tr><td class='sub_title1'>" . q(ellipsize(course_id_to_title($lid), 70)) . "</td></tr>"; foreach ($q as $data) { $url = $urlServer . "modules/forum/viewtopic.php?course=" . course_id_to_code($lid) . "&topic=" . $data->topicid . "&forum=" . $data->forumid; $forum_content .= "<tr><td><ul class='custom_list'><li><a href='{$url}'>\n\t\t\t\t<b>" . q($data->title) . " (" . nice_format(date("Y-m-d", strtotime($data->post_time))) . ")</b>\n </a><div class='smaller grey'><b>" . q(uid_to_name($data->poster_id)) . "</b></div><div class='smaller'>" . standard_text_escape(ellipsize_html($data->post_text, 150, "<b> ...<a href='{$url}'>[{$langMore}]</a></b>")) . "</div></li></ul></td></tr>"; } } } $forum_content .= "</table>"; if ($found) { return $forum_content; } else { return "<div class='alert alert-warning'>{$langNoPosts}</div>"; } }