当前位置: 首页>>代码示例>>PHP>>正文


PHP calendar::getLessonCalendarEvents方法代码示例

本文整理汇总了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) {
//.........这里部分代码省略.........
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:101,代码来源:lesson.class.php

示例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'] . '&amp;ctg=news&amp;view=' . $value['id'];
                 } else {
                     $link = G_SERVERNAME . 'userpage.php?ctg=news&amp;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']] . '&nbsp;&rarr;&nbsp;' . $value['name'];
                 $data[] = array('title' => $pathString, 'link' => G_SERVERNAME . 'index.php?ctg=lesson_info&amp;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']] . '&nbsp;&rarr;&nbsp;' . $value['name'];
                 $data[] = array('title' => $pathString, 'link' => G_SERVERNAME . 'index.php?ctg=lesson_info&amp;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&amp;view_calendar=' . $value['timestamp'] . '&amp;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) {
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_rss.class.php


注:本文中的calendar::getLessonCalendarEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。