本文整理汇总了PHP中CourseManager::get_real_course_list方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::get_real_course_list方法的具体用法?PHP CourseManager::get_real_course_list怎么用?PHP CourseManager::get_real_course_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::get_real_course_list方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AnnotationReader
<?php
/* For licensing terms, see /license.txt */
$config = new \Doctrine\ORM\Configuration();
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Component\Yaml\Parser;
AnnotationRegistry::registerFile(api_get_path(SYS_PATH) . "vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
$reader = new AnnotationReader();
$driverImpl = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, array(api_get_path(SYS_PATH) . "tests/doctrine_console/mapping"));
$config->setMetadataDriverImpl($driverImpl);
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$courseList = CourseManager::get_real_course_list();
//$courseList = array();
$configurationPath = api_get_path(SYS_PATH) . 'main/inc/conf/';
$newConfigurationFile = $configurationPath . 'configuration.yml';
if (is_file($newConfigurationFile) && file_exists($newConfigurationFile)) {
$yaml = new Parser();
$_configuration = $yaml->parse(file_get_contents($newConfigurationFile));
}
$connectionOptions = array();
if (!empty($courseList)) {
$dbPrefix = isset($_configuration['db_prefix']) && !empty($_configuration['db_prefix']) ? $_configuration['db_prefix'] . Database::get_database_glue() : null;
foreach ($courseList as $course) {
$connectionOptions['_chamilo_course_' . $course['db_name']] = array('driver' => 'pdo_mysql', 'dbname' => $dbPrefix . $course['db_name'], 'user' => $_configuration['db_user'], 'password' => $_configuration['db_password'], 'host' => $_configuration['db_host']);
}
}
if (isset($_configuration['main_database'])) {
$connectionOptions['main_database'] = array('driver' => 'pdo_mysql', 'dbname' => $_configuration['main_database'], 'user' => $_configuration['db_user'], 'password' => $_configuration['db_password'], 'host' => $_configuration['db_host']);
示例2: reports_template_CourseArticulate_getSQL
function reports_template_CourseArticulate_getSQL()
{
// settings
// Nom, prenom
$query = 'select u.lastname as "Last name", u.firstname as "First name" ';
$query .= 'from ' . Database::get_main_table(TABLE_MAIN_USER) . ' u ';
$query .= ' where u.user_id in (' . reports_getVisibilitySQL() . ') ';
$query .= ' order by u.user_id ';
$queries[0] = $query;
// Custom Field
foreach (array("tags" => "tags") as $k => $v) {
// FIXME
$query = 'select ufv.field_value as "' . $v . '" ';
$query .= 'from ' . Database::get_main_table(TABLE_MAIN_USER) . ' u ';
$query .= 'left join' . Database::get_main_table(TABLE_MAIN_USER_FIELD) . ' uf ';
$query .= ' on uf.field_variable="' . $k . '" ';
$query .= 'left outer join ' . Database::get_main_table(TABLE_MAIN_USER_FIELD_VALUES) . ' ufv ';
$query .= ' on ufv.user_id = u.user_id and ufv.field_id = uf.id ';
$query .= 'where u.user_id in (' . reports_getVisibilitySQL() . ') ';
$query .= ' order by u.user_id ';
$queries[] = $query;
}
// Stored Value
$sv = array();
foreach ($sv as $k => $v) {
if (!isset($v['sql'])) {
$v['sql'] = 'FIELD';
}
$sqlField = str_replace('FIELD', 'sv.sv_value', $v['sql']);
$query = 'select ' . $sqlField . ' as "' . $v['title'] . '" ';
// $query = 'select sec_to_time(sv.sv_value) as "'.$v.'" ';
$query .= 'from ' . Database::get_main_table(TABLE_MAIN_USER) . ' u ';
$query .= ' left outer join ' . Database::get_main_table(TABLE_TRACK_STORED_VALUES) . ' sv ';
$query .= 'on sv.user_id = u.user_id and sv_key = "' . $k . '" ';
$query .= ' where u.user_id in (' . reports_getVisibilitySQL() . ') ';
$query .= ' group by u.user_id ';
$query .= ' order by u.user_id ';
$queries[] = $query;
}
// first and last connection
$query = 'select min(tel.login_date) as "First connection", max(tel.logout_date) as "Latest connection" ';
$query .= 'from ' . Database::get_main_table(TABLE_MAIN_USER) . ' u ';
$query .= 'left outer join ' . Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN) . ' tel ';
$query .= ' on tel.login_user_id = u.user_id ';
$query .= ' where u.user_id in (' . reports_getVisibilitySQL() . ') ';
$query .= ' group by u.user_id ';
$query .= ' order by u.user_id ';
$queries[] = $query;
// SCORM Data
$scormData = array();
$course_list = CourseManager::get_real_course_list();
foreach ($course_list as $code => $details) {
$list = Database::query('SELECT l.id as lid, l.name as lname, li.id as liid, li.title as lititle ' . ' FROM ' . Database::get_course_table(TABLE_LP_MAIN) . ' l, ' . Database::get_course_table(TABLE_LP_ITEM) . ' li ' . ' WHERE l.c_id = ' . $details['real_id'] . ' AND li.c_id = ' . $details['real_id'] . ' AND l.id = li.lp_id');
while ($lpItem = Database::fetch_assoc($list)) {
$scormData[] = array('coursedb' => $details['db_name'], 'lid' => $lpItem['lid'], 'liid' => $lpItem['liid'], 'target_view_count' => 1, 'target_indicator' => 'score', 'title' => $details['title'] . '/' . $lpItem['lname'] . '/' . $lpItem['lititle'] . '/1/score', 'sql' => 'FIELD');
$scormData[] = array('coursedb' => $details['db_name'], 'lid' => $lpItem['lid'], 'liid' => $lpItem['liid'], 'target_view_count' => 2, 'target_indicator' => 'score', 'title' => $details['title'] . '/' . $lpItem['lname'] . '/' . $lpItem['lititle'] . '/2/score', 'sql' => 'FIELD');
$scormData[] = array('coursedb' => $details['db_name'], 'lid' => $lpItem['lid'], 'liid' => $lpItem['liid'], 'target_view_count' => null, 'target_indicator' => 'score', 'title' => $details['title'] . '/' . $lpItem['lname'] . '/' . $lpItem['lititle'] . '/all/score', 'sql' => 'avg(FIELD)');
}
}
foreach ($scormData as $v) {
if (!isset($v['sql'])) {
$v['sql'] = 'FIELD';
}
$sqlField = str_replace('FIELD', $v['target_indicator'], $v['sql']);
$query = 'select ' . $sqlField . ' as "' . $v['title'] . '" ';
$query .= 'from ' . Database::get_main_table(TABLE_MAIN_USER) . ' u ';
$query .= 'left outer join ' . Database::get_course_table(TABLE_LP_VIEW, $details['db_name']) . ' lv ';
$query .= ' on u.user_id = lv.user_id and lv.lp_id = ' . $v['lid'];
$query .= ' left outer join ' . Database::get_course_table(TABLE_LP_ITEM_VIEW, $details['db_name']) . ' liv ';
$query .= ' on lv.id = liv.lp_view_id ';
if ($v['target_view_count']) {
$query .= ' and liv.view_count = ' . $v['target_view_count'];
}
$query .= ' and liv.lp_item_id = ' . $v['liid'] . ' ';
$query .= ' where u.user_id in (' . reports_getVisibilitySQL() . ') ';
$query .= ' group by u.user_id ';
$query .= ' order by u.user_id ';
$queries[] = $query;
}
return $queries;
}
示例3: display_real_course_code_select
/**
* This code creates a select form element to let the user
* choose a real course to link to.
*
* We display the course code, but internally store the course id.
*/
function display_real_course_code_select($element_name)
{
$real_course_list = CourseManager::get_real_course_list();
echo "<select name=\"{$element_name}\" size=\"" . SELECT_BOX_SIZE . "\" >\n";
foreach ($real_course_list as $real_course) {
$course_code = $real_course["code"];
echo "<option value=\"" . $course_code . "\">";
echo $course_code;
echo "</option>\n";
}
echo "</select>\n";
}
示例4: foreach
foreach ($courses_by_teacher as $course) {
$students_by_course = array_keys(CourseManager::get_student_list_from_course_code($course['real_id']));
if (count($students_by_course) > 0) {
foreach ($students_by_course as $student_by_course) {
$students[] = $student_by_course;
}
}
}
}
if (!empty($students)) {
$students = array_unique($students);
}
} else {
$students = array_keys(UserManager::get_users_followed_by_drh(api_get_user_id(), STUDENT));
}
$courses_of_the_platform = CourseManager::get_real_course_list();
foreach ($courses_of_the_platform as $course) {
$courses[$course['code']] = $course['code'];
}
}
} else {
if (empty($session_id)) {
//Getting courses
$courses = CourseManager::get_course_list_as_coach($coach_id, false);
if (isset($courses[0])) {
$courses = $courses[0];
}
//Getting students
$students = CourseManager::get_user_list_from_courses_as_coach($coach_id);
} else {
$students = Tracking::get_student_followed_by_coach_in_a_session($session_id, $coach_id);