本文整理汇总了PHP中calendar::getLessonCalendarEvents方法的典型用法代码示例。如果您正苦于以下问题:PHP calendar::getLessonCalendarEvents方法的具体用法?PHP calendar::getLessonCalendarEvents怎么用?PHP calendar::getLessonCalendarEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calendar
的用法示例。
在下文中一共展示了calendar::getLessonCalendarEvents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export
/**
* Export lesson
*
* This function is used to export the current lesson's data to
* a file, which can then be imported to other systems. Apart from
* the lesson content, the user may optinally specify additional
* information to export, using the $exportEntities array. If
* $exportEntities is 'all', everything that can be exported, is
* exported
*
* <br/>Example:
* <code>
* $exportedFile = $lesson -> export('all');
* </code>
*
* @param array $exportEntities The additional data to export
* @param boolean $rename Whether to rename the exported file with the same name as the lesson
* @param boolean $exportFiles Whether to export files as well
* @return EfrontFile The object of the exported data file
* @since 3.5.0
* @access public
*/
public function export($exportEntities, $rename = true, $exportFiles = true)
{
if (!$exportEntities) {
$exportEntities = array('export_surveys' => 1, 'export_announcements' => 1, 'export_glossary' => 1, 'export_calendar' => 1, 'export_comments' => 1, 'export_rules' => 1);
}
$data['lessons'] = $this->lesson;
unset($data['lessons']['share_folder']);
unset($data['lessons']['instance_source']);
unset($data['lessons']['originating_course']);
$content = eF_getTableData("content", "*", "lessons_ID=" . $this->lesson['id']);
if (sizeof($content) > 0) {
$contentIds = array();
for ($i = 0; $i < sizeof($content); $i++) {
$content[$i]['data'] = str_replace(G_SERVERNAME, "##SERVERNAME##", $content[$i]['data']);
$content[$i]['data'] = str_replace("content/lessons/" . ($this->lesson['share_folder'] ? $this->lesson['share_folder'] : $this->lesson['id']), "##LESSONSLINK##", $content[$i]['data']);
$contentIds[] = $content[$i]['id'];
}
$content_list = implode(",", array_values($contentIds));
$data['content'] = $content;
$questions = eF_getTableData("questions", "*", "lessons_ID=" . $this->lesson['id']);
if (sizeof($questions) > 0) {
for ($i = 0; $i < sizeof($questions); $i++) {
$questions[$i]['text'] = str_replace(G_SERVERNAME, "##SERVERNAME##", $questions[$i]['text']);
$questions[$i]['text'] = str_replace("content/lessons/" . ($this->lesson['share_folder'] ? $this->lesson['share_folder'] : $this->lesson['id']), "##LESSONSLINK##", $questions[$i]['text']);
}
$data['questions'] = $questions;
}
$tests = eF_getTableData("tests", "*", "lessons_ID=" . $this->lesson['id']);
if (sizeof($tests)) {
$testsIds = array();
foreach ($tests as $key => $value) {
$testsIds[] = $value['id'];
}
$tests_list = implode(",", array_values($testsIds));
$tests_to_questions = eF_getTableData("tests_to_questions", "*", "tests_ID IN ({$tests_list})");
for ($i = 0; $i < sizeof($tests); $i++) {
$tests[$i]['description'] = str_replace(G_SERVERNAME, "##SERVERNAME##", $tests[$i]['description']);
$tests[$i]['description'] = str_replace("content/lessons/" . ($this->lesson['share_folder'] ? $this->lesson['share_folder'] : $this->lesson['id']), "##LESSONSLINK##", $tests[$i]['description']);
}
$data['tests'] = $tests;
$data['tests_to_questions'] = $tests_to_questions;
}
if (isset($exportEntities['export_rules'])) {
$rules = eF_getTableData("rules", "*", "lessons_ID=" . $this->lesson['id']);
if (sizeof($rules) > 0) {
$data['rules'] = $rules;
}
}
if (isset($exportEntities['export_comments'])) {
$comments = eF_getTableData("comments", "*", "content_ID IN ({$content_list})");
if (sizeof($comments) > 0) {
$data['comments'] = $comments;
}
}
}
if (isset($exportEntities['export_calendar'])) {
$calendar = calendar::getLessonCalendarEvents($this);
$calendar = array_values($calendar);
if (sizeof($calendar) > 0) {
$data['calendar'] = $calendar;
}
}
if (isset($exportEntities['export_glossary'])) {
$glossary = eF_getTableData("glossary", "*", "lessons_ID = " . $this->lesson['id']);
if (sizeof($glossary) > 0) {
$data['glossary'] = $glossary;
}
}
if (isset($exportEntities['export_announcements'])) {
$news = eF_getTableData("news", "*", "lessons_ID=" . $this->lesson['id']);
if (sizeof($news) > 0) {
$data['news'] = $news;
}
}
if (isset($exportEntities['export_surveys'])) {
$surveys = eF_getTableData("surveys", "*", "lessons_ID=" . $this->lesson['id']);
//prepei na ginei to lesson_ID -> lessons_ID sti basi (ayto isos to parampsoyme eykola)
if (sizeof($surveys) > 0) {
//.........这里部分代码省略.........
示例2: getRssSource
private function getRssSource($source, $mode, $lesson)
{
$feeds = $this->getProvidedFeeds();
foreach ($feeds as $value) {
if ($value['active'] && $value['mode'] == 'system') {
$systemFeeds[$value['type']] = $value;
} else {
if ($value['active'] && $value['mode'] == 'lesson') {
$lessonFeeds[$value['type']] = $value;
}
}
}
if ($mode == 'system' && !in_array($source, array_keys($systemFeeds))) {
return array();
} elseif ($mode == 'lesson' && !in_array($source, array_keys($lessonFeeds))) {
return array();
}
$data = array();
switch ($source) {
case 'announcements':
if ($mode == 'system') {
$news = news::getNews(0, true);
} elseif ($mode == 'lesson') {
if ($lesson) {
$news = news::getNews($lesson, true);
} else {
$lessons = eF_getTableDataFlat("lessons", "id, name");
$lessonNames = array_combine($lessons['id'], $lessons['name']);
$news = news::getNews($lessons['id'], true);
}
}
$count = 1;
foreach ($news as $value) {
if ($mode == 'lesson' && !$lesson) {
$value['title'] = $lessonNames[$value['lessons_ID']] . ': ' . $value['title'];
$link = G_SERVERNAME . 'userpage.php?lessons_ID=' . $value['lessons_ID'] . '&ctg=news&view=' . $value['id'];
} else {
$link = G_SERVERNAME . 'userpage.php?ctg=news&view=' . $value['id'];
}
$data[] = array('title' => $value['title'], 'link' => $link, 'description' => $value['data']);
/*
if ($count++ == $this -> feedLimit) {
break;
}
*/
}
break;
case 'catalog':
$constraints = array("return_objects" => false, 'archive' => false, 'active' => true);
$result = EfrontCourse::getAllCourses($constraints);
$directionsTree = new EfrontDirectionsTree();
$directionPaths = $directionsTree->toPathString();
foreach ($result as $value) {
$pathString = $directionPaths[$value['directions_ID']] . ' → ' . $value['name'];
$data[] = array('title' => $pathString, 'link' => G_SERVERNAME . 'index.php?ctg=lesson_info&courses_ID=' . $value['id'], 'description' => implode("<br>", unserialize($value['info'])));
}
$result = eF_getTableData("lessons", "id,name,directions_ID, info", "archive=0 and instance_source = 0 and active=1 and course_only=0", "name");
foreach ($result as $value) {
$pathString = $directionPaths[$value['directions_ID']] . ' → ' . $value['name'];
$data[] = array('title' => $pathString, 'link' => G_SERVERNAME . 'index.php?ctg=lesson_info&lessons_ID=' . $value['id'], 'description' => implode("<br>", unserialize($value['info'])));
}
$data = array_values(eF_multisort($data, 'title', 'asc'));
//Sort results based on path string
break;
case 'calendar':
if ($mode == 'system') {
$events = calendar::getGlobalCalendarEvents();
} elseif ($mode == 'lesson') {
if ($lesson) {
$events = calendar::getLessonCalendarEvents($lesson);
} else {
$events = calendar::getCalendarEventsForAllLessons();
}
}
foreach ($events as $value) {
$value['name'] ? $title = formatTimestamp($value['timestamp']) . ' (' . $value['name'] . ')' : ($title = formatTimestamp($value['timestamp']));
$data[] = array('title' => $title, 'link' => G_SERVERNAME . 'userpage.php?ctg=calendar&view_calendar=' . $value['timestamp'] . '&type=0', 'description' => $value['data']);
}
break;
/*
case 'history':
$currentUser = $this -> getCurrentUser();
$eventObjects = array();
$result = eF_getTableData("events", "*", "", "timestamp DESC limit 100");
foreach ($result as $value) {
$eventObject = new EfrontEvent($value);
$eventObject -> createMessage();
pr($eventObject);
}
break;
*/
/*
case 'history':
$currentUser = $this -> getCurrentUser();
$eventObjects = array();
$result = eF_getTableData("events", "*", "", "timestamp DESC limit 100");
foreach ($result as $value) {
//.........这里部分代码省略.........