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


PHP Agenda::setType方法代码示例

本文整理汇总了PHP中Agenda::setType方法的典型用法代码示例。如果您正苦于以下问题:PHP Agenda::setType方法的具体用法?PHP Agenda::setType怎么用?PHP Agenda::setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Agenda的用法示例。


在下文中一共展示了Agenda::setType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add_announcement

 /**
  * Adds an announcement to the database
  * @param string Title of the announcement
  * @param string Content of the announcement
  * @param string Start date (YYYY-MM-DD HH:II: SS)
  * @param string End date (YYYY-MM-DD HH:II: SS)
  * @param int    Whether the announcement should be visible to teachers (1) or not (0)
  * @param int    Whether the announcement should be visible to students (1) or not (0)
  * @param int    Whether the announcement should be visible to anonymous users (1) or not (0)
  * @param string The language for which the announvement should be shown. Leave null for all langages
  * @param int    Whether to send an e-mail to all users (1) or not (0)
  * @return mixed  insert_id on success, false on failure
  */
 public static function add_announcement($title, $content, $date_start, $date_end, $visible_teacher = 0, $visible_student = 0, $visible_guest = 0, $lang = null, $send_mail = 0, $add_to_calendar = false, $sendEmailTest = false)
 {
     $original_content = $content;
     $a_dateS = explode(' ', $date_start);
     $a_arraySD = explode('-', $a_dateS[0]);
     $a_arraySH = explode(':', $a_dateS[1]);
     $date_start_to_compare = array_merge($a_arraySD, $a_arraySH);
     $a_dateE = explode(' ', $date_end);
     $a_arrayED = explode('-', $a_dateE[0]);
     $a_arrayEH = explode(':', $a_dateE[1]);
     $date_end_to_compare = array_merge($a_arrayED, $a_arrayEH);
     $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
     if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
         Display::display_normal_message(get_lang('InvalidStartDate'));
         return false;
     }
     if (($date_end_to_compare[1] || $date_end_to_compare[2] || $date_end_to_compare[0]) && !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])) {
         Display::display_normal_message(get_lang('InvalidEndDate'));
         return false;
     }
     if (strlen(trim($title)) == 0) {
         Display::display_normal_message(get_lang('InvalidTitle'));
         return false;
     }
     $start = api_get_utc_datetime($date_start);
     $end = api_get_utc_datetime($date_end);
     //Fixing urls that are sent by email
     $content = str_replace('src=\\"/home/', 'src=\\"' . api_get_path(WEB_PATH) . 'home/', $content);
     $content = str_replace('file=/home/', 'file=' . api_get_path(WEB_PATH) . 'home/', $content);
     $lang = is_null($lang) ? 'NULL' : $lang;
     $current_access_url_id = 1;
     if (api_is_multiple_url_enabled()) {
         $current_access_url_id = api_get_current_access_url_id();
     }
     $params = ['title' => $title, 'content' => $content, 'date_start' => $start, 'date_end' => $end, 'visible_teacher' => $visible_teacher, 'visible_student' => $visible_student, 'visible_guest' => $visible_guest, 'lang' => $lang, 'access_url_id' => $current_access_url_id];
     $resultId = Database::insert($db_table, $params);
     if ($resultId) {
         if ($sendEmailTest) {
             SystemAnnouncementManager::send_system_announcement_by_email($title, $content, $visible_teacher, $visible_student, $lang, true);
         } else {
             if ($send_mail == 1) {
                 SystemAnnouncementManager::send_system_announcement_by_email($title, $content, $visible_teacher, $visible_student, $lang);
             }
         }
         if ($add_to_calendar) {
             $agenda = new Agenda();
             $agenda->setType('admin');
             $agenda->addEvent($date_start, $date_end, false, $title, $original_content);
         }
         return $resultId;
     }
     return false;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:66,代码来源:system_announcements.lib.php

示例2: importCalendarStatic


//.........这里部分代码省略.........
             $startDateDay = substr($date, 6, 8);
             $startDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $startTime . ":00";
             $endDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $endTime . ":00";
             if (!api_is_valid_date($startDate) || !api_is_valid_date($endDate)) {
                 $this->logger->addInfo("Verify your dates:  '{$startDate}' : '{$endDate}' ");
                 $errorFound = true;
             }
             // If old events do nothing.
             /*if (api_strtotime($startDate) < time()) {
                   continue;
               }*/
             if ($errorFound == false) {
                 $eventsToCreate[] = array('start' => $startDate, 'end' => $endDate, 'title' => $title, 'sender_id' => $teacherId, 'course_id' => $courseInfo['real_id'], 'session_id' => $sessionId, 'comment' => $comment, 'color' => $color, $this->extraFieldIdNameList['calendar_event'] => $row['external_calendar_itemID']);
             }
         }
         if (empty($eventsToCreate)) {
             $this->logger->addInfo("No events to add");
             return 0;
         }
         $this->logger->addInfo("Ready to insert events");
         $agenda = new Agenda();
         $extraFieldValue = new ExtraFieldValue('calendar_event');
         $extraFieldName = $this->extraFieldIdNameList['calendar_event'];
         $externalEventId = null;
         $extraField = new ExtraField('calendar_event');
         $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($extraFieldName);
         if (empty($extraFieldInfo)) {
             $this->logger->addInfo("No calendar event extra field created: {$extraFieldName}");
             return 0;
         }
         foreach ($eventsToCreate as $event) {
             $update = false;
             $item = null;
             if (!isset($event[$extraFieldName])) {
                 $this->logger->addInfo("No external_calendar_itemID found. Skipping ...");
                 continue;
             } else {
                 $externalEventId = $event[$extraFieldName];
                 if (empty($externalEventId)) {
                     $this->logger->addInfo("external_calendar_itemID was set but empty. Skipping ...");
                     continue;
                 }
                 $items = $extraFieldValue->get_item_id_from_field_variable_and_field_value($extraFieldName, $externalEventId, false, false, true);
                 $item = null;
                 foreach ($items as $tempItem) {
                     if ($tempItem['c_id'] == $event['course_id']) {
                         $item = $tempItem;
                     }
                 }
                 if (!empty($item)) {
                     $this->logger->addInfo("Event #{$externalEventId} was already added. Updating ...");
                     $update = true;
                     //continue;
                 }
             }
             $courseInfo = api_get_course_info_by_id($event['course_id']);
             $agenda->set_course($courseInfo);
             $agenda->setType('course');
             $agenda->setSessionId($event['session_id']);
             $agenda->setSenderId($event['sender_id']);
             $agenda->setIsAllowedToEdit(true);
             $eventComment = $event['comment'];
             $color = $event['color'];
             // To use the event comment you need
             // ALTER TABLE c_calendar_event ADD COLUMN comment TEXT;
             // add in configuration.php allow_agenda_event_comment = true
             if (empty($courseInfo)) {
                 $this->logger->addInfo("No course found for added: #" . $event['course_id'] . " Skipping ...");
                 continue;
             }
             if (empty($event['sender_id'])) {
                 $this->logger->addInfo("No sender found: #" . $event['sender_id'] . " Skipping ...");
                 continue;
             }
             $content = '';
             if ($update && isset($item['calendar_event_id'])) {
                 //the event already exists, just update
                 $eventId = $agenda->edit_event($item['calendar_event_id'], $event['start'], $event['end'], false, $event['title'], $content, array('everyone'), array(), null, $eventComment, $color);
                 if ($eventId !== false) {
                     $this->logger->addInfo("Event updated: #{$eventId}");
                 } else {
                     $this->logger->addInfo("Error while updating event.");
                 }
             } else {
                 // New event. Create it.
                 $eventId = $agenda->add_event($event['start'], $event['end'], false, $event['title'], $content, array('everyone'), false, null, array(), null, $eventComment, $color);
                 if (!empty($eventId)) {
                     $extraFieldValue->is_course_model = true;
                     $extraFieldValue->save(array('field_value' => $externalEventId, 'field_id' => $extraFieldInfo['id'], 'calendar_event_id' => $eventId, 'c_id' => $event['course_id']));
                     $this->logger->addInfo("Event added: #{$eventId}");
                 } else {
                     $this->logger->addInfo("Error while creating event.");
                 }
             }
         }
     }
     if ($moveFile) {
         $this->moveFile($file);
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:import_csv.php

示例3: add_announcement

 /**
  * Adds an announcement to the database
  * @param string Title of the announcement
  * @param string Content of the announcement
  * @param string Start date (YYYY-MM-DD HH:II: SS)
  * @param string End date (YYYY-MM-DD HH:II: SS)
  * @param int    Whether the announcement should be visible to teachers (1) or not (0)
  * @param int    Whether the announcement should be visible to students (1) or not (0)
  * @param int    Whether the announcement should be visible to anonymous users (1) or not (0)
  * @param string The language for which the announvement should be shown. Leave null for all langages
  * @param int    Whether to send an e-mail to all users (1) or not (0)
  * @return mixed  insert_id on success, false on failure
  */
 public static function add_announcement($title, $content, $date_start, $date_end, $visible_teacher = 0, $visible_student = 0, $visible_guest = 0, $lang = null, $send_mail = 0, $add_to_calendar = false)
 {
     $original_content = $content;
     $a_dateS = explode(' ', $date_start);
     $a_arraySD = explode('-', $a_dateS[0]);
     $a_arraySH = explode(':', $a_dateS[1]);
     $date_start_to_compare = array_merge($a_arraySD, $a_arraySH);
     $a_dateE = explode(' ', $date_end);
     $a_arrayED = explode('-', $a_dateE[0]);
     $a_arrayEH = explode(':', $a_dateE[1]);
     $date_end_to_compare = array_merge($a_arrayED, $a_arrayEH);
     $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
     if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
         Display::display_normal_message(get_lang('InvalidStartDate'));
         return false;
     }
     if (($date_end_to_compare[1] || $date_end_to_compare[2] || $date_end_to_compare[0]) && !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])) {
         Display::display_normal_message(get_lang('InvalidEndDate'));
         return false;
     }
     if (strlen(trim($title)) == 0) {
         Display::display_normal_message(get_lang('InvalidTitle'));
         return false;
     }
     $start = api_get_utc_datetime($date_start);
     $end = api_get_utc_datetime($date_end);
     $title = Database::escape_string($title);
     $content = Database::escape_string($content);
     //Fixing urls that are sent by email
     $content = str_replace('src=\\"/home/', 'src=\\"' . api_get_path(WEB_PATH) . 'home/', $content);
     $content = str_replace('file=/home/', 'file=' . api_get_path(WEB_PATH) . 'home/', $content);
     $langsql = is_null($lang) ? 'NULL' : "'" . Database::escape_string($lang) . "'";
     global $_configuration;
     $current_access_url_id = 1;
     if ($_configuration['multiple_access_urls']) {
         $current_access_url_id = api_get_current_access_url_id();
     }
     $sql = "INSERT INTO " . $db_table . " (title,content,date_start,date_end,visible_teacher,visible_student,visible_guest, lang, access_url_id)\n\t\t\t\tVALUES ('" . $title . "','" . $content . "','" . $start . "','" . $end . "','" . $visible_teacher . "','" . $visible_student . "','" . $visible_guest . "'," . $langsql . ", " . $current_access_url_id . ")";
     if ($send_mail == 1) {
         SystemAnnouncementManager::send_system_announcement_by_email($title, $content, $visible_teacher, $visible_student, $lang);
     }
     $res = Database::query($sql);
     if ($res === false) {
         Debug::log_s(mysql_error());
         return false;
     }
     if ($add_to_calendar) {
         $agenda = new Agenda();
         $agenda->setType('admin');
         $agenda->add_event($date_start, $date_end, false, null, $title, $original_content);
     }
     return Database::insert_id();
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:66,代码来源:system_announcements.lib.php

示例4: fill_db_course


//.........这里部分代码省略.........
                                 //Copying file
                                 copy($default_course_path . $value['file'], $course_documents_folder . $value['file']);
                                 chmod($course_documents_folder . $value['file'], $perm_file);
                                 //echo $default_course_path.$value['file']; echo ' - '; echo $course_documents_folder.$value['file']; echo '<br />';
                                 $temp = explode('/', $value['file']);
                                 $file_size = filesize($course_documents_folder . $value['file']);
                                 //hack until feature #5242 is implemented
                                 if ($media_type == 'images/gallery') {
                                     $value["file"] = 'gallery/' . $value["file"];
                                 }
                                 //Inserting file in the DB
                                 Database::query("INSERT INTO {$TABLETOOLDOCUMENT} (c_id, path,title,filetype,size)\n                                        VALUES ({$course_id},'{$path_documents}" . $value["file"] . "','" . $temp[count($temp) - 1] . "','file','{$file_size}')");
                                 $image_id = Database::insert_id();
                                 if ($image_id) {
                                     $sql = "UPDATE {$TABLETOOLDOCUMENT} SET id = iid WHERE iid = {$image_id}";
                                     Database::query($sql);
                                     if ($path_documents . $value['file'] == '/certificates/default.html') {
                                         $example_cert_id = $image_id;
                                     }
                                     Database::query("INSERT INTO {$TABLEITEMPROPERTY} (c_id, tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility)\n                                            VALUES ({$course_id},'document',1,'{$now}','{$now}',{$image_id},'DocumentAdded',1,NULL,NULL,1)");
                                     $docId = Database::insert_id();
                                     if ($docId) {
                                         $sql = "UPDATE {$TABLEITEMPROPERTY} SET id = iid WHERE iid = {$docId}";
                                         Database::query($sql);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $agenda = new Agenda();
         $agenda->setType('course');
         $agenda->set_course($courseInfo);
         $agenda->addEvent($now, $now, 0, get_lang('AgendaCreationTitle'), get_lang('AgendaCreationContenu'));
         /*  Links tool */
         $link = new Link();
         $link->setCourse($courseInfo);
         $links = [['c_id' => $course_id, 'url' => 'http://www.google.com', 'title' => 'Google', 'description' => get_lang('Google'), 'category_id' => 0, 'on_homepage' => 0, 'target' => '_self', 'session_id' => 0], ['c_id' => $course_id, 'url' => 'http://www.wikipedia.org', 'title' => 'Wikipedia', 'description' => get_lang('Wikipedia'), 'category_id' => 0, 'on_homepage' => 0, 'target' => '_self', 'session_id' => 0]];
         foreach ($links as $params) {
             $link->save($params);
         }
         /* Announcement tool */
         AnnouncementManager::add_announcement(get_lang('AnnouncementExampleTitle'), get_lang('AnnouncementEx'), ['everyone' => 'everyone'], null, null, $now);
         $manager = Database::getManager();
         /* Introduction text */
         $intro_text = '<p style="text-align: center;">
                         <img src="' . api_get_path(REL_CODE_PATH) . 'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" />
                         <h2>' . self::lang2db(get_lang('IntroductionText')) . '</h2>
                      </p>';
         $toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
         $toolIntro->setCId($course_id)->setId(TOOL_COURSE_HOMEPAGE)->setSessionId(0)->setIntroText($intro_text);
         $manager->persist($toolIntro);
         $toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
         $toolIntro->setCId($course_id)->setId(TOOL_STUDENTPUBLICATION)->setSessionId(0)->setIntroText(get_lang('IntroductionTwo'));
         $manager->persist($toolIntro);
         $toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
         $toolIntro->setCId($course_id)->setId(TOOL_WIKI)->setSessionId(0)->setIntroText(get_lang('IntroductionWiki'));
         $manager->persist($toolIntro);
         $manager->flush();
         /*  Exercise tool */
         $exercise = new Exercise($course_id);
         $exercise->exercise = get_lang('ExerciceEx');
         $html = '<table width="100%" border="0" cellpadding="0" cellspacing="0">
                     <tr>
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:67,代码来源:add_course.lib.inc.php

示例5: array

<?php

/* For licensing terms, see /license.txt */
/**
 * @package chamilo.calendar
 */
// name of the language file that needs to be included
$language_file = array('agenda', 'group', 'announcements');
require_once '../inc/global.inc.php';
require_once 'agenda.lib.php';
require_once 'agenda.inc.php';
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . "calendar/agenda_js.php", 'name' => get_lang('Agenda'));
$agenda = new Agenda();
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
$agenda->setType($type);
$events = $agenda->get_events(null, null, api_get_course_int_id(), api_get_group_id(), null, 'array');
$this_section = SECTION_MYAGENDA;
if (!empty($GLOBALS['_cid']) && $GLOBALS['_cid'] != -1) {
    // Agenda is inside a course tool
    // Little hack to sort the events by start date in personal agenda (Agenda events List view - See #8014)
    usort($events, function ($a, $b) {
        $t1 = strtotime($a['start']);
        $t2 = strtotime($b['start']);
        return $t1 - $t2;
    });
    $url = false;
    foreach ($events as &$event) {
        $event['url'] = api_get_self() . '?cid=' . $event['course_id'] . '&type=' . $event['type'];
    }
    $url = api_get_self() . '?' . api_get_cidreq();
    $this_section = SECTION_COURSES;
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:agenda_list.php

示例6: switch

}
if (!api_is_allowed_to_edit(null, true) && $event_type == 'course') {
    api_not_allowed();
}
$course_info = api_get_course_info();
if (api_is_allowed_to_edit(false, true) or api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous() && api_is_allowed_to_session_edit(false, true) or GroupManager::user_has_access(api_get_user_id(), $group_id, GroupManager::GROUP_TOOL_CALENDAR) && GroupManager::is_tutor_of_group(api_get_user_id(), $group_id)) {
    switch ($action) {
        case 'add':
            if (isset($_POST['submit_event']) && $_POST['submit_event']) {
                $startDate = Text::return_datetime_from_array($_POST['start_date']);
                $endDate = Text::return_datetime_from_array($_POST['end_date']);
                $repeatEndDay = Text::return_datetime_from_array($_POST['repeat_end_day']);
                $fileComment = isset($_POST['file_comment']) ? $_POST['file_comment'] : null;
                $fileAttachment = isset($_FILES['user_upload']) ? $_FILES['user_upload'] : null;
                $agenda = new Agenda();
                $agenda->setType('course');
                $repeatSettings = array();
                if (!empty($_POST['repeat'])) {
                    $repeatSettings = array('repeat_type' => $_POST['repeat_type'], 'repeat_end' => $repeatEndDay);
                    /*
                                        $res = agenda_add_repeat_item(
                                            $course_info,
                                            $id,
                                            $_POST['repeat_type'],
                                            $repeatEndDay,
                                            $_POST['users'],
                                            $safe_file_comment
                                        );*/
                }
                $id = $agenda->add_event($startDate, $endDate, null, null, $_POST['title'], $_POST['content'], $_POST['users'], false, null, array('comment' => $fileComment, 'file' => $fileAttachment), $repeatSettings);
                Display::display_confirmation_message(get_lang('AddSuccess'));
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:agenda.php

示例7: importCalendarStatic


//.........这里部分代码省略.........
             if (empty($sessionId)) {
                 $this->logger->addInfo("external_sessionID: " . $externalSessionId . " does not exists.");
             }
             $teacherId = null;
             if (!empty($sessionId) && !empty($courseInfo)) {
                 $courseIncluded = SessionManager::relation_session_course_exist($sessionId, $courseInfo['real_id']);
                 if ($courseIncluded == false) {
                     $this->logger->addInfo("Course '{$courseCode}' is not included in session: {$sessionId}");
                     $errorFound = true;
                 } else {
                     $teachers = CourseManager::get_coach_list_from_course_code($courseInfo['code'], $sessionId);
                     // Getting first teacher.
                     if (!empty($teachers)) {
                         $teacher = current($teachers);
                         $teacherId = $teacher['user_id'];
                     } else {
                         $sessionInfo = api_get_session_info($sessionId);
                         $teacherId = $sessionInfo['id_coach'];
                     }
                 }
             } else {
                 $errorFound = true;
             }
             if (empty($teacherId)) {
                 $errorFound = true;
                 $this->logger->addInfo("No teacher found in course code : '{$courseCode}' and session: '{$sessionId}'");
             }
             $date = $row['date'];
             $startTime = $row['time_start'];
             $endTime = $row['time_end'];
             $title = $row['title'];
             $startDateYear = substr($date, 0, 4);
             $startDateMonth = substr($date, 4, 2);
             $startDateDay = substr($date, 6, 8);
             $startDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $startTime . ":00";
             $endDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $endTime . ":00";
             if (!api_is_valid_date($startDate) or !api_is_valid_date($endDate)) {
                 $this->logger->addInfo("Verify your dates:  '{$startDate}' : '{$endDate}' ");
                 $errorFound = true;
             }
             if ($errorFound == false) {
                 $eventsToCreate[] = array('start' => $startDate, 'end' => $endDate, 'title' => $title, 'sender_id' => $teacherId, 'course_id' => $courseInfo['real_id'], 'session_id' => $sessionId, $this->extraFieldIdNameList['calendar_event'] => $row['external_calendar_itemID']);
             }
         }
         if (empty($eventsToCreate)) {
             $this->logger->addInfo("No events to add");
             return 0;
         }
         $this->logger->addInfo("Ready to insert events");
         $content = null;
         $agenda = new Agenda();
         $extraFieldValue = new ExtraFieldValue('calendar_event');
         $extraFieldName = $this->extraFieldIdNameList['calendar_event'];
         $externalEventId = null;
         $extraField = new ExtraField('calendar_event');
         $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($extraFieldName);
         if (empty($extraFieldInfo)) {
             $this->logger->addInfo("No calendar event extra field created: {$extraFieldName}");
             return 0;
         }
         foreach ($eventsToCreate as $event) {
             if (!isset($event[$extraFieldName])) {
                 $this->logger->addInfo("No external_calendar_itemID found. Skipping ...");
                 continue;
             } else {
                 $externalEventId = $event[$extraFieldName];
                 $item = $extraFieldValue->get_item_id_from_field_variable_and_field_value($extraFieldName, $externalEventId);
                 if (!empty($item) || empty($externalEventId)) {
                     $this->logger->addInfo("Event #{$externalEventId} was already added . Skipping ...");
                     continue;
                 }
             }
             $courseInfo = api_get_course_info_by_id($event['course_id']);
             $agenda->set_course($courseInfo);
             $agenda->setType('course');
             $agenda->setSessionId($event['session_id']);
             $agenda->setSenderId($event['sender_id']);
             $agenda->setIsAllowedToEdit(true);
             $eventComment = $event['comment'];
             if (empty($courseInfo)) {
                 $this->logger->addInfo("No course found for added: #" . $event['course_id'] . " Skipping ...");
                 continue;
             }
             if (empty($event['sender_id'])) {
                 $this->logger->addInfo("No sender found: #" . $event['sender_id'] . " Skipping ...");
                 continue;
             }
             $eventId = $agenda->addEvent($event['start'], $event['end'], false, $event['title'], $content, array('everyone'), false, null, array(), null, $eventComment);
             if (!empty($eventId)) {
                 $extraFieldValue->save(array('value' => $externalEventId, 'field_id' => $extraFieldInfo['id'], 'item_id' => $eventId));
                 $this->logger->addInfo("Event added: #{$eventId}");
             } else {
                 $this->logger->addInfo("Error while creating event.");
             }
         }
     }
     if ($moveFile) {
         $this->moveFile($file);
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:import_csv.php


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