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


PHP CourseManager::get_course_category方法代码示例

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


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

示例1: WSListCourses

function WSListCourses($params)
{
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    $course_field_name = isset($params['original_course_id_name']) ? $params['original_course_id_name'] : '';
    $courses_result = array();
    $category_names = array();
    $courses = CourseManager::get_courses_list();
    foreach ($courses as $course) {
        $course_tmp = array();
        $course_tmp['id'] = $course['id'];
        $course_tmp['code'] = $course['code'];
        $course_tmp['title'] = $course['title'];
        $course_tmp['language'] = $course['course_language'];
        $course_tmp['visibility'] = $course['visibility'];
        // Determining category name
        if (!empty($course['category_code']) && $category_names[$course['category_code']]) {
            $course_tmp['category_name'] = $category_names[$course['category_code']];
        } else {
            $category = CourseManager::get_course_category($course['category_code']);
            $category_names[$course['category_code']] = $category['name'];
            $course_tmp['category_name'] = $category['name'];
        }
        // Determining number of students registered in course
        $course_tmp['number_students'] = CourseManager::get_users_count_in_course($course['code']);
        // Determining external course id
        $externalCourseId = '';
        if ($course_field_name) {
            $externalCourseId = CourseManager::get_course_extra_field_value($course_field_name, $course['code']);
        }
        $course_tmp['external_course_id'] = $externalCourseId;
        $courses_result[] = $course_tmp;
    }
    return $courses_result;
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:36,代码来源:registration.soap.php

示例2: ListCourses

	/**
	 * List courses
	 *
	 * @param string API secret key
	 * @param string A list of visibility filter we want to apply
	 * @return array An array with elements of the form ('id' => 'Course internal id', 'code' => 'Course code', 'title' => 'Course title', 'language' => 'Course language', 'visibility' => 'Course visibility',
	 * 'category_name' => 'Name of the category of the course', 'number_students' => 'Number of students in the course', 'external_course_id' => 'External course id')
	 */
	public function ListCourses($secret_key, $visibility = 'public,public-registered,private,closed') {
		$verifKey = $this->verifyKey($secret_key);
		if($verifKey instanceof WSError) {
			$this->handleError($verifKey);
		} else {
            $visibilities = split(',',$visibility);
            $vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0');
            foreach ($visibilities as $p => $visibility) {
                $visibilities[$p] = $vis[$visibility];
            }
			$courses_result = array();
			$category_names = array();

			$courses = CourseManager::get_courses_list();
			foreach($courses as $course) {
                //skip elements that do not match required visibility
                if (!in_array($course['visibility'],$visibilities)) { continue; }
				$course_tmp = array();
				$course_tmp['id'] = $course['id'];
				$course_tmp['code'] = $course['code'];
				$course_tmp['title'] = $course['title'];
				$course_tmp['language'] = $course['course_language'];
				$course_tmp['visibility'] = $course['visibility'];

				// Determining category name
				if($category_names[$course['category_code']]) {
					$course_tmp['category_name'] = $category_names[$course['category_code']];
				} else {
					$category = CourseManager::get_course_category($course['category_code']);
					$category_names[$course['category_code']] = $category['name'];
					$course_tmp['category_name'] = $category['name'];
				}

				// Determining number of students registered in course
				$user_list = CourseManager::get_user_list_from_course_code($course['code'], 0);
				$course_tmp['number_students'] = count($user_list);

				// Determining external course id - this code misses the external course id field name
				// $course_tmp['external_course_id'] = CourseManager::get_course_extra_field_value($course_field_name, $course['code']);


				$courses_result[] = $course_tmp;
			}

			return $courses_result;
		}
	}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:55,代码来源:webservice_course.php

示例3: attendance_sheet_export_to_pdf

 /**
  * It's used to print attendance sheet
  * @param string action
  * @param int    attendance id
  */
 public function attendance_sheet_export_to_pdf($action, $attendance_id, $student_id = 0, $course_id = '')
 {
     $attendance = new Attendance();
     $courseInfo = CourseManager::get_course_information($course_id);
     $attendance->set_course_id($courseInfo['code']);
     $data_array = array();
     $data_array['attendance_id'] = $attendance_id;
     $data_array['users_in_course'] = $attendance->get_users_rel_course($attendance_id);
     $filter_type = 'today';
     if (!empty($_REQUEST['filter'])) {
         $filter_type = $_REQUEST['filter'];
     }
     $my_calendar_id = null;
     if (is_numeric($filter_type)) {
         $my_calendar_id = $filter_type;
         $filter_type = 'calendar_id';
     }
     $data_array['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id, $filter_type, $my_calendar_id);
     if (api_is_allowed_to_edit(null, true) || api_is_drh()) {
         $data_array['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id);
     } else {
         if (!empty($student_id)) {
             $user_id = intval($student_id);
         } else {
             $user_id = api_get_user_id();
         }
         $data_array['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, $user_id);
         $data_array['faults'] = $attendance->get_faults_of_user($user_id, $attendance_id);
         $data_array['user_id'] = $user_id;
     }
     $data_array['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
     //Set headers pdf
     $courseCategory = CourseManager::get_course_category($courseInfo['category_code']);
     $teacherInfo = CourseManager::get_teacher_list_from_course_code($courseInfo['real_id']);
     $teacherName = null;
     foreach ($teacherInfo as $dados) {
         if ($teacherName != null) {
             $teacherName = $teacherName . " / ";
         }
         $teacherName .= $dados['firstname'] . " " . $dados['lastname'];
     }
     // Get data table - Marco - ordenacao fixa - just fullname
     $data_table = array();
     $head_table = array('#', get_lang('Name'));
     foreach ($data_array['attendant_calendar'] as $class_day) {
         //$head_table[] = api_format_date($class_day['date_time'], DATE_FORMAT_SHORT).' <br />'.api_format_date($class_day['date_time'], TIME_NO_SEC_FORMAT);
         $head_table[] = api_format_date($class_day['date_time'], DATE_FORMAT_NUMBER_NO_YEAR);
     }
     $data_table[] = $head_table;
     $dataClass = array();
     $max_dates_per_page = 10;
     $data_attendant_calendar = $data_array['attendant_calendar'];
     $data_users_presence = $data_array['users_presence'];
     $count = 1;
     if (!empty($data_array['users_in_course'])) {
         foreach ($data_array['users_in_course'] as $user) {
             $cols = 1;
             $result = array();
             $result['count'] = $count;
             $result['full_name'] = api_get_person_name($user['firstname'], $user['lastname']);
             foreach ($data_array['attendant_calendar'] as $class_day) {
                 if ($class_day['done_attendance'] == 1) {
                     if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) {
                         $result[$class_day['id']] = get_lang('UserAttendedSymbol');
                     } else {
                         $result[$class_day['id']] = get_lang('UserNotAttendedSymbol');
                     }
                 } else {
                     $result[$class_day['id']] = " ";
                 }
                 $cols++;
             }
             $count++;
             $data_table[] = $result;
         }
     }
     $max_cols_per_page = 12;
     //10 dates + 2 name and number
     $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2;
     //10
     $rows = count($data_table);
     if ($cols > $max_cols_per_page) {
         $number_tables = round(($cols - 2) / $max_dates_per_page);
         $headers = $data_table[0];
         $all = array();
         $tables = array();
         $changed = 1;
         for ($i = 0; $i <= $rows; $i++) {
             $row = $data_table[$i];
             $key = 1;
             $max_dates_per_page = 10;
             $item = $data_table[$i];
             $count_j = 0;
             if (!empty($item)) {
                 foreach ($item as $value) {
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:attendance_controller.php

示例4: ListCourses

	/**
	 * List courses
	 *
	 * @param string API secret key
	 * @param string Course id field name. Use "chamilo_course_id" to use internal id
	 * @return array An array with elements of the form ('id' => 'Course internal id', 'code' => 'Course code', 'title' => 'Course title', 'language' => 'Course language', 'visibility' => 'Course visibility',
	 * 'category_name' => 'Name of the category of the course', 'number_students' => 'Number of students in the course', 'external_course_id' => 'External course id')
	 */
	public function ListCourses($secret_key, $course_id_field_name) {
		$verifKey = $this->verifyKey($secret_key);
		if($verifKey instanceof WSError) {
			$this->handleError($verifKey);
		} else {
			$courses_result = array();
			$category_names = array();

			$courses = CourseManager::get_courses_list();
			foreach($courses as $course) {
				$course_tmp = array();
				$course_tmp['id'] = $course['id'];
				$course_tmp['code'] = $course['code'];
				$course_tmp['title'] = $course['title'];
				$course_tmp['language'] = $course['course_language'];
				$course_tmp['visibility'] = $course['visibility'];

				// Determining category name
				if($category_names[$course['category_code']]) {
					$course_tmp['category_name'] = $category_names[$course['category_code']];
				} else {
					$category = CourseManager::get_course_category($course['category_code']);
					$category_names[$course['category_code']] = $category['name'];
					$course_tmp['category_name'] = $category['name'];
				}

				// Determining number of students registered in course
				$user_list = CourseManager::get_user_list_from_course_code($course['code']);
				$course_tmp['number_students'] = count($user_list);

				// Determining external course id
				$course_tmp['external_course_id'] = CourseManager::get_course_extra_field_value($course_id_field_name, $course['code']);


				$courses_result[] = $course_tmp;
			}

			return $courses_result;
		}
	}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:48,代码来源:cm_webservice_course.php


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