function checkrequired(thisform) { if ($('#event_title').val()=='' || $('#startdate').val()=='') { bootbox.alert('$langTitleDateNotEmpty'); return false; } if($('#id').val()>0 && $('#rep').val() != ''){ bootbox.dialog(dialogUpdateOptions); } else { thisform.submit(); } } </script>"; } if ($is_editor) { $agdx = new AgendaIndexer(); // modify visibility if (isset($_GET['mkInvisibl']) and $_GET['mkInvisibl'] == true) { Database::get()->query("UPDATE agenda SET visible = 0 WHERE course_id = ?d AND id = ?d", $course_id, $id); $agdx->store($id); redirect_to_home_page("modules/agenda/index.php?course=$course_code&v=1"); } elseif (isset($_GET['mkVisibl']) and ( $_GET['mkVisibl'] == true)) { Database::get()->query("UPDATE agenda SET visible = 1 WHERE course_id = ?d AND id = ?d", $course_id, $id); $agdx->store($id); redirect_to_home_page("modules/agenda/index.php?course=$course_code&v=1"); } if (isset($_POST['event_title'])) { register_posted_variables(array('startdate' => true, 'event_title' => true, 'content' => true, 'duration' => true)); $content = purify($content); if (isset($_POST['id']) and !empty($_POST['id'])) { // update event $id = $_POST['id'];
/** * @brief search in course * @global Indexer $idx * @param type $searchTerms * @param type $courseId * @param type $anonymous * @return boolean */ function search_in_course($searchTerms, $courseId, $anonymous) { global $idx; $data = array(); $data['search_terms'] = $searchTerms; $data['course_id'] = $courseId; require_once 'announcementindexer.class.php'; $anhits = $idx->searchRaw(AnnouncementIndexer::buildQuery($data, $anonymous)); if (count($anhits) > 0) { return true; } require_once 'agendaindexer.class.php'; $aghits = $idx->searchRaw(AgendaIndexer::buildQuery($data, $anonymous)); if (count($aghits) > 0) { return true; } require_once 'documentindexer.class.php'; $dhits = $idx->searchRaw(DocumentIndexer::buildQuery($data, $anonymous)); if (count($dhits) > 0) { return true; } require_once 'exerciseindexer.class.php'; $exhits = $idx->searchRaw(ExerciseIndexer::buildQuery($data, $anonymous)); if (count($exhits) > 0) { return true; } require_once 'forumindexer.class.php'; $fhits = $idx->searchRaw(ForumIndexer::buildQuery($data, $anonymous)); if (count($fhits) > 0) { return true; } require_once 'forumtopicindexer.class.php'; $fthits = $idx->searchRaw(ForumTopicIndexer::buildQuery($data, $anonymous)); if (count($fthits) > 0) { return true; } require_once 'linkindexer.class.php'; $lhits = $idx->searchRaw(LinkIndexer::buildQuery($data, $anonymous)); if (count($lhits) > 0) { return true; } require_once 'videoindexer.class.php'; $vhits = $idx->searchRaw(VideoIndexer::buildQuery($data, $anonymous)); if (count($vhits) > 0) { return true; } require_once 'videolinkindexer.class.php'; $vlhits = $idx->searchRaw(VideolinkIndexer::buildQuery($data, $anonymous)); if (count($vlhits) > 0) { return true; } require_once 'unitindexer.class.php'; $uhits = $idx->searchRaw(UnitIndexer::buildQuery($data, $anonymous)); if (count($uhits) > 0) { return true; } require_once 'unitresourceindexer.class.php'; $urhits = $idx->searchRaw(UnitResourceIndexer::buildQuery($data, $anonymous)); if (count($urhits) > 0) { return true; } return false; }
/** * Batch remove all index contents related to a Course. * * @param int $courseId */ public function removeAllByCourse($courseId) { if (!get_config('enable_indexing')) { return; } $cidx = new CourseIndexer($this); $cidx->remove($courseId); $aidx = new AnnouncementIndexer($this); $aidx->removeByCourse($courseId); $agdx = new AgendaIndexer($this); $agdx->removeByCourse($courseId); $lidx = new LinkIndexer($this); $lidx->removeByCourse($courseId); $vdx = new VideoIndexer($this); $vdx->removeByCourse($courseId); $vldx = new VideolinkIndexer($this); $vldx->removeByCourse($courseId); $eidx = new ExerciseIndexer($this); $eidx->removeByCourse($courseId); $fidx = new ForumIndexer($this); $fidx->removeByCourse($courseId); $ftdx = new ForumTopicIndexer($this); $ftdx->removeByCourse($courseId); $fpdx = new ForumPostIndexer($this); $fpdx->removeByCourse($courseId); $didx = new DocumentIndexer($this); $didx->removeByCourse($courseId); $uidx = new UnitIndexer($this); $uidx->removeByCourse($courseId); $urdx = new UnitResourceIndexer($this); $urdx->removeByCourse($courseId); $ndx = new NoteIndexer($this); $ndx->removeByCourse($courseId); }
if (count($announceHits) > 0) { $tool_content .= "<script type='text/javascript' src='../auth/sorttable.js'></script>\n <table width='99%' class='sortable' id='t1' align='left'>\n <tr>\n <th colspan='2'>{$langAnnouncements}:</th>\n </tr>"; $numLine = 0; foreach ($announceHits as $annHit) { $announce = Database::get()->querySingle("SELECT title, content, date FROM announcement WHERE id = ?d", $annHit->pkid); $class = $numLine % 2 ? 'odd' : 'even'; $tool_content .= "<tr class='{$class}'>\n <td width='1' valign='top'><img style='padding-top:3px;' src='{$themeimg}/arrow.png' title='bullet' /></td>\n <td><b><a href='" . $annHit->url . "'>" . q($announce->title) . "</a></b> \n <small>(" . nice_format(claro_format_locale_date($dateFormatLong, strtotime($announce->date))) . ")\n </small><br />" . $announce->content . "</td></tr>"; $numLine++; } $tool_content .= "</table>"; $found = true; } } // search in agenda if ($agenda) { $agendaHits = $idx->searchRaw(AgendaIndexer::buildQuery($_POST)); if (count($agendaHits) > 0) { $tool_content .= "<script type='text/javascript' src='../auth/sorttable.js'></script>\n <table width='99%' class='sortable' id='t2' align='left'>\n <tr>\n <th colspan='2' class='left'>{$langAgenda}:</th>\n </tr>"; $numLine = 0; foreach ($agendaHits as $agHit) { $agenda = Database::get()->querySingle("SELECT title, content, start, duration FROM agenda WHERE id = ?d", $agHit->pkid); $class = $numLine % 2 ? 'odd' : 'even'; $tool_content .= "\n <tr class='{$class}'>\n <td width='1' valign='top'><img style='padding-top:3px;' src='{$themeimg}/arrow.png' title='bullet' /></td>\n <td>"; $message = $langUnknown; if ($agenda->duration != "") { if ($agenda->duration == 1) { $message = $langHour; } else { $message = $langHours; } }