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


PHP CourseManager::get_coach_list_from_course_code方法代码示例

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


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

示例1: importCalendarStatic

 /**
  * @param string $file
  * @param bool   $moveFile
  *
  * @return int
  */
 private function importCalendarStatic($file, $moveFile = true)
 {
     $data = Import::csv_to_array($file);
     if (!empty($data)) {
         $this->logger->addInfo(count($data) . " records found.");
         $eventsToCreate = array();
         $errorFound = false;
         foreach ($data as $row) {
             $sessionId = null;
             $externalSessionId = null;
             if (isset($row['external_sessionID'])) {
                 $externalSessionId = $row['external_sessionID'];
                 $sessionId = SessionManager::get_session_id_from_original_id($externalSessionId, $this->extraFieldIdNameList['session']);
             }
             $courseCode = null;
             if (isset($row['coursecode'])) {
                 $courseCode = $row['coursecode'];
             }
             $courseInfo = api_get_course_info($courseCode);
             if (empty($courseInfo)) {
                 $this->logger->addInfo("Course '{$courseCode}' does not exists");
             }
             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['code']);
                 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'];
             $comment = $row['comment'];
             $color = isset($row['color']) ? $row['color'] : '';
             $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) || !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 {
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:import_csv.php

示例2: get_lang

 //If I'm a teacher in this course show just my name
 if (isset($teachers[$user_id])) {
     if (!empty($teachers)) {
         $teacher_info = $teachers[$user_id];
         $description .= '<tr><td>' . get_lang('Teacher') . ': </td><td class="highlight">' . api_get_person_name($teacher_info['firstname'], $teacher_info['lastname']) . '</td>';
     }
 } else {
     //If not show all teachers
     $teachers = CourseManager::get_teacher_list_from_course_code_to_string($course_info['real_id']);
     if (!empty($teachers)) {
         $description .= '<tr><td>' . get_lang('Teachers') . ': </td><td class="highlight">' . $teachers . '</td>';
     }
 }
 if (!empty($session_id)) {
     //If I'm a coach
     $coaches = CourseManager::get_coach_list_from_course_code($course_info['real_id'], $session_id);
     if (isset($coaches) && isset($coaches[$user_id])) {
         $user_info = api_get_user_info($user_id);
         $description .= '<tr><td>' . get_lang('Coach') . ': </td><td class="highlight">' . $user_info['complete_name'] . '</td>';
     } else {
         //If not show everything
         $teachers = CourseManager::get_coach_list_from_course_code_to_string($course_info['real_id'], $session_id);
         if (!empty($teachers)) {
             $description .= '<tr><td>' . get_lang('Coachs') . ': </td><td class="highlight">' . $coaches . '</td>';
         }
     }
 }
 $description .= '<tr><td>' . get_lang('Date') . ': </td><td class="highlight">' . api_convert_and_format_date(time(), DATE_TIME_FORMAT_LONG) . '</td>';
 $description .= '</table>';
 $header_attributes = array(array('style' => 'width:10px'), array('style' => 'width:30px'), array('style' => 'width:50px'), array('style' => 'width:500px'));
 $params = array('add_signatures' => false, 'filename' => get_lang('UserList'), 'pdf_title' => get_lang('StudentList'), 'pdf_description' => $description, 'header_attributes' => $header_attributes);
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:user.php

示例3: send_notification_for_oral_questions

 function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id)
 {
     if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
         return null;
     }
     // Email configuration settings
     $courseCode = api_get_course_id();
     $course_info = api_get_course_info($courseCode);
     $url_email = api_get_path(WEB_CODE_PATH) . 'exercice/exercise_show.php?' . api_get_cidreq() . '&id_session=' . api_get_session_id() . '&id=' . $exe_id . '&action=qualify';
     $user_info = api_get_user_info(api_get_user_id());
     $oral_question_list = null;
     foreach ($question_list_answers as $item) {
         $question = $item['question'];
         $answer = $item['answer'];
         $answer_type = $item['answer_type'];
         if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) {
             $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">' . '<tr>' . '<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;' . get_lang('Question') . '</td>' . '<td width="473" valign="top" bgcolor="#F3F3F3">' . $question . '</td>' . '</tr>' . '<tr>' . '<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;' . get_lang('Answer') . '</td>' . '<td valign="top" bgcolor="#F3F3F3">' . $answer . '</td>' . '</tr></table>';
         }
     }
     if (!empty($oral_question_list)) {
         $msg = get_lang('OralQuestionsAttempted') . '<br /><br />
                 ' . get_lang('AttemptDetails') . ' : <br /><br />' . '<table>' . '<tr>' . '<td><em>' . get_lang('CourseName') . '</em></td>' . '<td>&nbsp;<b>#course#</b></td>' . '</tr>' . '<tr>' . '<td>' . get_lang('TestAttempted') . '</td>' . '<td>&nbsp;#exercise#</td>' . '</tr>' . '<tr>' . '<td>' . get_lang('StudentName') . '</td>' . '<td>&nbsp;#firstName# #lastName#</td>' . '</tr>' . '<tr>' . '<td>' . get_lang('StudentEmail') . '</td>' . '<td>&nbsp;#mail#</td>' . '</tr>' . '</table>';
         $msg .= '<br />' . sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list) . '<br />';
         $msg1 = str_replace("#exercise#", $this->exercise, $msg);
         $msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
         $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg);
         $msg = str_replace("#mail#", $user_info['email'], $msg1);
         $msg = str_replace("#course#", $course_info['name'], $msg1);
         if ($origin != 'learnpath') {
             $msg .= '<br /><a href="#url#">' . get_lang('ClickToCommentAndGiveFeedback') . '</a>';
         }
         $msg1 = str_replace("#url#", $url_email, $msg);
         $mail_content = $msg1;
         $subject = get_lang('OralQuestionsAttempted');
         if (api_get_session_id()) {
             $teachers = CourseManager::get_coach_list_from_course_code($courseCode, api_get_session_id());
         } else {
             $teachers = CourseManager::getTeacherListFromCourse($course_info['real_id']);
         }
         if (!empty($teachers)) {
             foreach ($teachers as $user_id => $teacher_data) {
                 MessageManager::send_message_simple($user_id, $subject, $mail_content);
             }
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:46,代码来源:exercise.class.php

示例4: display_add_form

/**
* this function displays the form to upload a new item to the dropbox.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategory, $view)
{
    $course_info = api_get_course_info();
    $_user = api_get_user_info();
    $is_courseAdmin = api_is_course_admin();
    $is_courseTutor = api_is_course_tutor();
    $origin = isset($_GET['origin']) ? $_GET['origin'] : null;
    $token = Security::get_token();
    $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
    $form = new FormValidator('sent_form', 'post', api_get_self() . '?view_received_category=' . $viewReceivedCategory . '&view_sent_category=' . $viewSentCategory . '&view=' . $view . '&' . api_get_cidreq(), null, array('enctype' => 'multipart/form-data', 'onsubmit' => 'javascript: return checkForm(this);'));
    $form->addElement('header', get_lang('UploadNewFile'));
    $form->addElement('hidden', 'MAX_FILE_SIZE', dropbox_cnf('maxFilesize'));
    $form->addElement('hidden', 'dropbox_unid', $dropbox_unid);
    $form->addElement('hidden', 'sec_token', $token);
    $form->addElement('hidden', 'origin', $origin);
    $form->addElement('file', 'file', get_lang('UploadFile'), array('onChange' => 'javascript: checkfile(this.value);'));
    if (dropbox_cnf('allowOverwrite')) {
        $form->addElement('checkbox', 'cb_overwrite', null, get_lang('OverwriteFile'), array('id' => 'cb_overwrite'));
    }
    // List of all users in this course and all virtual courses combined with it
    if (api_get_session_id()) {
        $complete_user_list_for_dropbox = array();
        if (api_get_setting('dropbox_allow_student_to_student') == 'true' || $_user['status'] != STUDENT) {
            $complete_user_list_for_dropbox = CourseManager::get_user_list_from_course_code($course_info['code'], api_get_session_id());
        }
        $complete_user_list2 = CourseManager::get_coach_list_from_course_code($course_info['code'], api_get_session_id());
        $complete_user_list_for_dropbox = array_merge($complete_user_list_for_dropbox, $complete_user_list2);
    } else {
        if (api_get_setting('dropbox_allow_student_to_student') == 'true' || $_user['status'] != STUDENT) {
            $complete_user_list_for_dropbox = CourseManager::get_user_list_from_course_code($course_info['code'], api_get_session_id());
        } else {
            $complete_user_list_for_dropbox = CourseManager::get_teacher_list_from_course_code($course_info['code'], false);
        }
    }
    if (!empty($complete_user_list_for_dropbox)) {
        foreach ($complete_user_list_for_dropbox as $k => $e) {
            $complete_user_list_for_dropbox[$k] = $e + array('lastcommafirst' => api_get_person_name($e['firstname'], $e['lastname']));
        }
        $complete_user_list_for_dropbox = TableSort::sort_table($complete_user_list_for_dropbox, 'lastcommafirst');
    }
    /*
        Create the options inside the select box:
        List all selected users their user id as value and a name string as display
    */
    $current_user_id = '';
    $options = array();
    foreach ($complete_user_list_for_dropbox as $current_user) {
        if (($dropbox_person->isCourseTutor || $dropbox_person->isCourseAdmin || dropbox_cnf('allowStudentToStudent') || $current_user['status'] != 5 || $current_user['tutor_id'] == 1) && $current_user['user_id'] != $_user['user_id']) {
            // Don't include yourself.
            if ($current_user['user_id'] == $current_user_id) {
                continue;
            }
            $full_name = $current_user['lastcommafirst'];
            $current_user_id = $current_user['user_id'];
            $options['user_' . $current_user_id] = $full_name;
            //echo '<option value="user_' . $current_user_id . '">' . $full_name . '</option>';
        }
    }
    /*
     * Show groups
     */
    if (($dropbox_person->isCourseTutor || $dropbox_person->isCourseAdmin) && dropbox_cnf('allowGroup') || dropbox_cnf('allowStudentToStudent')) {
        $complete_group_list_for_dropbox = GroupManager::get_group_list(null, dropbox_cnf('courseId'));
        if (count($complete_group_list_for_dropbox) > 0) {
            foreach ($complete_group_list_for_dropbox as $current_group) {
                if ($current_group['number_of_members'] > 0) {
                    //echo '<option value="group_'.$current_group['id'].'">G: '.$current_group['name'].' - '.$current_group['number_of_members'].' '.get_lang('Users').'</option>';
                    $options['group_' . $current_group['id']] = 'G: ' . $current_group['name'] . ' - ' . $current_group['number_of_members'] . ' ' . get_lang('Users');
                }
            }
        }
    }
    if (dropbox_cnf('allowJustUpload')) {
        //echo '<option value="upload">'.get_lang('JustUploadInSelect').'</option>';
        //echo '<option value="user_'.$_user['user_id'].'">'.get_lang('JustUploadInSelect').'</option>';
        $options['user_' . $_user['user_id']] = get_lang('JustUploadInSelect');
    }
    $form->addElement('select', 'recipients', get_lang('SendTo'), $options, array('multiple' => 'multiple', 'size' => '10', 'class' => 'span4'));
    $form->addElement('button', 'submitWork', get_lang('Upload'));
    $form->display();
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:87,代码来源:dropbox_functions.inc.php

示例5: display_add_form

/**
* this function displays the form to upload a new item to the dropbox.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version march 2006
*/
function display_add_form($dropbox_unid, $viewReceivedCategory, $viewSentCategory, $view)
{
    $course_info = api_get_course_info();
    $_user = api_get_user_info();
    $is_courseAdmin = api_is_course_admin();
    $is_courseTutor = api_is_course_tutor();
    $origin = isset($_GET['origin']) ? $_GET['origin'] : null;
    $token = Security::get_token();
    $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor);
    $form = new FormValidator('sent_form', 'post', api_get_self() . '?view_received_category=' . $viewReceivedCategory . '&view_sent_category=' . $viewSentCategory . '&view=' . $view . '&' . api_get_cidreq(), null, array('enctype' => 'multipart/form-data', 'onsubmit' => 'javascript: return checkForm(this);'));
    $form->addElement('header', get_lang('UploadNewFile'));
    $form->addElement('hidden', 'MAX_FILE_SIZE', dropbox_cnf('maxFilesize'));
    $form->addElement('hidden', 'dropbox_unid', $dropbox_unid);
    $form->addElement('hidden', 'sec_token', $token);
    $form->addElement('hidden', 'origin', $origin);
    $form->addElement('file', 'file', get_lang('UploadFile'), array('onChange' => 'javascript: checkfile(this.value);'));
    if (dropbox_cnf('allowOverwrite')) {
        $form->addElement('checkbox', 'cb_overwrite', null, get_lang('OverwriteFile'), array('id' => 'cb_overwrite'));
    }
    // List of all users in this course and all virtual courses combined with it
    if (api_get_session_id()) {
        $complete_user_list_for_dropbox = array();
        if (api_get_setting('dropbox.dropbox_allow_student_to_student') == 'true' || $_user['status'] != STUDENT) {
            $complete_user_list_for_dropbox = CourseManager::get_user_list_from_course_code($course_info['code'], api_get_session_id(), null, null, 0);
        }
        $complete_user_list2 = CourseManager::get_coach_list_from_course_code($course_info['code'], api_get_session_id());
        $generalCoachList = array();
        $courseCoachList = array();
        foreach ($complete_user_list2 as $coach) {
            if ($coach['type'] == 'general_coach') {
                $generalCoachList[] = $coach;
            } else {
                $courseCoachList[] = $coach;
            }
        }
        $hideCourseCoach = api_get_setting('dropbox_hide_course_coach');
        if ($hideCourseCoach == 'false') {
            $complete_user_list_for_dropbox = array_merge($complete_user_list_for_dropbox, $courseCoachList);
        }
        $hideGeneralCoach = api_get_setting('dropbox_hide_general_coach');
        if ($hideGeneralCoach == 'false') {
            $complete_user_list_for_dropbox = array_merge($complete_user_list_for_dropbox, $generalCoachList);
        }
    } else {
        if (api_get_setting('dropbox.dropbox_allow_student_to_student') == 'true' || $_user['status'] != STUDENT) {
            $complete_user_list_for_dropbox = CourseManager::get_user_list_from_course_code($course_info['code'], api_get_session_id());
        } else {
            $complete_user_list_for_dropbox = CourseManager::getTeacherListFromCourse($course_info['real_id'], false);
        }
    }
    if (!empty($complete_user_list_for_dropbox)) {
        foreach ($complete_user_list_for_dropbox as $k => $e) {
            $complete_user_list_for_dropbox[$k] = $e + array('lastcommafirst' => api_get_person_name($e['firstname'], $e['lastname']));
        }
        $complete_user_list_for_dropbox = TableSort::sort_table($complete_user_list_for_dropbox, 'lastcommafirst');
    }
    /*
        Create the options inside the select box:
        List all selected users their user id as value and a name string as display
    */
    $current_user_id = '';
    $options = array();
    $userGroup = new UserGroup();
    foreach ($complete_user_list_for_dropbox as $current_user) {
        if (($dropbox_person->isCourseTutor || $dropbox_person->isCourseAdmin || dropbox_cnf('allowStudentToStudent') || $current_user['status'] != 5 || $current_user['is_tutor'] == 1) && $current_user['user_id'] != $_user['user_id']) {
            // Don't include yourself.
            if ($current_user['user_id'] == $current_user_id) {
                continue;
            }
            $userId = $current_user['user_id'];
            $userInfo = api_get_user_info($userId);
            if ($userInfo['status'] != INVITEE) {
                $groupNameListToString = '';
                if (!empty($groups)) {
                    $groupNameList = array_column($groups, 'name');
                    $groupNameListToString = ' - [' . implode(', ', $groupNameList) . ']';
                }
                $groups = $userGroup->getUserGroupListByUser($userId);
                $full_name = $userInfo['complete_name'] . $groupNameListToString;
                $current_user_id = $current_user['user_id'];
                $options['user_' . $current_user_id] = $full_name;
            }
        }
    }
    /*
     * Show groups
     */
    if (($dropbox_person->isCourseTutor || $dropbox_person->isCourseAdmin) && dropbox_cnf('allowGroup') || dropbox_cnf('allowStudentToStudent')) {
        $complete_group_list_for_dropbox = GroupManager::get_group_list(null, dropbox_cnf('courseId'));
        if (count($complete_group_list_for_dropbox) > 0) {
            foreach ($complete_group_list_for_dropbox as $current_group) {
                if ($current_group['number_of_members'] > 0) {
                    $options['group_' . $current_group['id']] = 'G: ' . $current_group['name'] . ' - ' . $current_group['number_of_members'] . ' ' . get_lang('Users');
                }
//.........这里部分代码省略.........
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:101,代码来源:dropbox_functions.inc.php

示例6: importCalendarStatic

 /**
  * @param string $file
  * @param bool   $moveFile
  *
  * @return int
  */
 private function importCalendarStatic($file, $moveFile = true)
 {
     $data = Import::csvToArray($file);
     if ($this->getDumpValues()) {
         // Remove all calendar items
         $truncateTables = array(Database::get_course_table(TABLE_AGENDA), Database::get_course_table(TABLE_AGENDA_ATTACHMENT), Database::get_course_table(TABLE_AGENDA_REPEAT), Database::get_course_table(TABLE_AGENDA_REPEAT_NOT), Database::get_main_table(TABLE_PERSONAL_AGENDA), Database::get_main_table(TABLE_PERSONAL_AGENDA_REPEAT_NOT), Database::get_main_table(TABLE_PERSONAL_AGENDA_REPEAT));
         foreach ($truncateTables as $table) {
             $sql = "TRUNCATE {$table}";
             Database::query($sql);
         }
         $table = Database::get_course_table(TABLE_ITEM_PROPERTY);
         $sql = "DELETE FROM {$table} WHERE tool = 'calendar_event'";
         Database::query($sql);
     }
     if (!empty($data)) {
         $this->logger->addInfo(count($data) . " records found.");
         $eventsToCreate = array();
         $errorFound = false;
         foreach ($data as $row) {
             $sessionId = null;
             $externalSessionId = null;
             if (isset($row['external_sessionID'])) {
                 $externalSessionId = $row['external_sessionID'];
                 $sessionId = SessionManager::getSessionIdFromOriginalId($externalSessionId, $this->extraFieldIdNameList['session']);
             }
             $courseCode = null;
             if (isset($row['coursecode'])) {
                 $courseCode = $row['coursecode'];
             }
             $courseInfo = api_get_course_info($courseCode);
             if (empty($courseInfo)) {
                 $this->logger->addInfo("Course '{$courseCode}' does not exists");
             }
             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) {
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:import_csv.php


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