本文整理汇总了PHP中CourseManager::get_course_by_category方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::get_course_by_category方法的具体用法?PHP CourseManager::get_course_by_category怎么用?PHP CourseManager::get_course_by_category使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::get_course_by_category方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_name_link
/**
* Generate name column
* @param unknown_type $item
* @return string
*/
private function build_name_link($item)
{
$view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
//$session_id = api_get_session_id();
switch ($item->get_item_type()) {
// category
case 'C':
$prms_uri = '?selectcat=' . $item->get_id() . '&view=' . Security::remove_XSS($_GET['view']);
if (isset($_GET['isStudentView'])) {
if (isset($is_student) || isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview') {
$prms_uri = $prms_uri . '&isStudentView=' . Security::remove_XSS($_GET['isStudentView']);
}
}
$cat = new Category();
$show_message = $cat->show_message_resource_delete($item->get_course_code());
return ' <a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . $prms_uri . '">' . $item->get_name() . '</a>' . ($item->is_course() ? ' [' . $item->get_course_code() . ']' . $show_message : '');
// evaluation
// evaluation
case 'E':
$cat = new Category();
$course_id = CourseManager::get_course_by_category($_GET['selectcat']);
$show_message = $cat->show_message_resource_delete($course_id);
// course/platform admin can go to the view_results page
if (api_is_allowed_to_edit() && $show_message === false) {
if ($item->get_type() == 'presence') {
return ' ' . '<a href="gradebook_view_result.php?cidReq=' . $course_id . '&selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
} else {
return ' ' . '<a href="gradebook_view_result.php?cidReq=' . $course_id . '&selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a> ' . Display::label(get_lang('Evaluation'));
}
} elseif (ScoreDisplay::instance()->is_custom() && $show_message === false) {
// students can go to the statistics page (if custom display enabled)
return ' ' . '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
} elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay::instance()->is_custom()) {
return ' ' . '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">' . $item->get_name() . '</a>';
} else {
return '[' . get_lang('Evaluation') . '] ' . $item->get_name() . $show_message;
}
// link
// link
case 'L':
$cat = new Category();
$course_id = CourseManager::get_course_by_category($_GET['selectcat']);
$show_message = $cat->show_message_resource_delete($course_id);
$url = $item->get_link();
if (isset($url) && $show_message === false) {
$text = ' <a href="' . $item->get_link() . '">' . $item->get_name() . '</a>';
} else {
$text = $item->get_name();
}
$text .= " " . Display::label($item->get_type_name(), 'info') . $show_message;
$cc = $this->currentcat->get_course_code();
if (empty($cc)) {
$text .= ' [<a href="' . api_get_path(REL_COURSE_PATH) . $item->get_course_code() . '/">' . $item->get_course_code() . '</a>]';
}
return $text;
}
}
示例2: array
$addparams['studentoverview'] = '';
}
//$addparams['cidReq']='';
if (isset($_GET['cidReq']) && $_GET['cidReq'] != '') {
$addparams['cidReq'] = Security::remove_XSS($_GET['cidReq']);
} else {
$addparams['cidReq'] = '';
}
$no_qualification = false;
// Show certificate link.
$certificate = array();
$actionsLeft = '';
if ($category != '0') {
$cat = new Category();
$category_id = intval($_GET['selectcat']);
$course_id = CourseManager::get_course_by_category($category_id);
$show_message = $cat->show_message_resource_delete($course_id);
if ($show_message == '') {
// Student
if (!api_is_allowed_to_edit() && !api_is_excluded_user_type()) {
$certificate = Category::register_user_certificate($category_id, $stud_id);
if (isset($certificate['pdf_url'])) {
$actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadCertificatePdf'), $certificate['pdf_url'], ['class' => 'btn btn-default']);
}
$currentScore = Category::getCurrentScore($stud_id, $category_id, $course_code, $session_id, true);
Category::registerCurrentScore($currentScore, $stud_id, $category_id);
}
}
}
if (!api_is_allowed_to_edit(null, true)) {
$actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadReportPdf'), api_get_self() . "?" . api_get_self() . "&action=export_table", ['class' => 'btn btn-default']);
示例3: header
/**
* Displays the header for the gradebook containing the navigation tree and links
* @param Category $catobj
* @param int $showtree '1' will show the browse tree and naviation buttons
* @param boolean $is_course_admin
* @param boolean $is_platform_admin
* @param boolean Whether to show or not the link to add a new qualification
* (we hide it in case of the course-embedded tool where we have only one
* calification per course or session)
* @param boolean Whether to show or not the link to add a new item inside
* the qualification (we hide it in case of the course-embedded tool
* where we have only one calification per course or session)
* @return void Everything is printed on screen upon closing
*/
static function header($catobj, $showtree, $selectcat, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true, $certificateLinkInfo = null)
{
$userId = api_get_user_id();
$courseCode = api_get_course_id();
$courseId = api_get_course_int_id();
$sessionId = api_get_session_id();
// Student.
$status = CourseManager::get_user_in_course_status($userId, $courseCode);
if (!empty($sessionId)) {
$sessionStatus = SessionManager::get_user_status_in_course_session($userId, $courseId, $sessionId);
}
$objcat = new Category();
$course_id = CourseManager::get_course_by_category($selectcat);
$message_resource = $objcat->show_message_resource_delete($course_id);
$grade_model_id = $catobj->get_grade_model_id();
$header = null;
//@todo move these in a function
$sum_categories_weight_array = array();
if (isset($catobj) && !empty($catobj)) {
$categories = Category::load(null, null, null, $catobj->get_id(), null, $sessionId);
if (!empty($categories)) {
foreach ($categories as $category) {
$sum_categories_weight_array[$category->get_id()] = $category->get_weight();
}
} else {
$sum_categories_weight_array[$catobj->get_id()] = $catobj->get_weight();
}
}
if (!$is_course_admin && ($status != 1 || $sessionStatus == 0) && $selectcat != 0) {
$catcourse = Category::load($catobj->get_id());
/** @var Category $category */
$category = $catcourse[0];
$main_weight = $category->get_weight();
$scoredisplay = ScoreDisplay::instance();
$allevals = $category->get_evaluations($userId, true);
$alllinks = $category->get_links($userId, true);
$allEvalsLinks = array_merge($allevals, $alllinks);
$item_value_total = 0;
$scoreinfo = null;
for ($count = 0; $count < count($allEvalsLinks); $count++) {
$item = $allEvalsLinks[$count];
$score = $item->calc_score($userId);
if (!empty($score)) {
$divide = $score[1] == 0 ? 1 : $score[1];
$item_value = $score[0] / $divide * $item->get_weight();
$item_value_total += $item_value;
}
}
$item_total = $main_weight;
$total_score = array($item_value_total, $item_total);
$scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT);
if (!$catobj->get_id() == '0' && !isset($_GET['studentoverview']) && !isset($_GET['search'])) {
$aditionalButtons = null;
if (!empty($certificateLinkInfo)) {
$aditionalButtons .= '<div class="btn-group pull-right">';
$aditionalButtons .= isset($certificateLinkInfo['certificate_link']) ? $certificateLinkInfo['certificate_link'] : '';
$aditionalButtons .= isset($certificateLinkInfo['badge_link']) ? $certificateLinkInfo['badge_link'] : '';
$aditionalButtons .= '</div>';
}
$scoreinfo .= '<strong>' . sprintf(get_lang('TotalX'), $scorecourse_display . $aditionalButtons) . '</strong>';
}
Display::display_normal_message($scoreinfo, false);
}
// show navigation tree and buttons?
if ($showtree == '1' || isset($_GET['studentoverview'])) {
$header = '<div class="actions"><table>';
$header .= '<tr>';
if (!$selectcat == '0') {
$header .= '<td><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
}
$header .= '<td>' . get_lang('CurrentCategory') . '</td>' . '<td><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
$cats = Category::load();
$tree = $cats[0]->get_tree();
unset($cats);
$line = null;
foreach ($tree as $cat) {
for ($i = 0; $i < $cat[2]; $i++) {
$line .= '—';
}
$line = isset($line) ? $line : '';
if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
$header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
} else {
$header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
}
$line = '';
//.........这里部分代码省略.........
示例4: display_header_gradebook
/**
* Displays the header for the gradebook containing the navigation tree and links
* @param Category $currentcat
* @param int $showtree '1' will show the browse tree and naviation buttons
* @param boolean $is_course_admin
* @param boolean $is_platform_admin
* @param boolean Whether to show or not the link to add a new qualification
* (we hide it in case of the course-embedded tool where we have only one
* calification per course or session)
* @param boolean Whether to show or not the link to add a new item inside
* the qualification (we hide it in case of the course-embedded tool
* where we have only one calification per course or session)
* @return void Everything is printed on screen upon closing
*/
static function display_header_gradebook($catobj, $showtree, $selectcat, $is_course_admin, $is_platform_admin, $simple_search_form, $show_add_qualification = true, $show_add_link = true)
{
//student
$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
$objcat = new Category();
$course_id = CourseManager::get_course_by_category($selectcat);
$message_resource = $objcat->show_message_resource_delete($course_id);
$grade_model_id = $catobj->get_grade_model_id();
$header = null;
//@todo move these in a function
$sum_categories_weight_array = array();
if (isset($catobj) && !empty($catobj)) {
$categories = Category::load(null, null, null, $catobj->get_id());
if (!empty($categories)) {
foreach ($categories as $category) {
$sum_categories_weight_array[$category->get_id()] = $category->get_weight();
}
} else {
$sum_categories_weight_array[$catobj->get_id()] = $catobj->get_weight();
}
}
if (!$is_course_admin && $status != 1 && $selectcat != 0) {
$user_id = api_get_user_id();
$catcourse = Category::load($catobj->get_id());
$main_weight = $catcourse[0]->get_weight();
$scoredisplay = ScoreDisplay::instance();
// generating the total score for a course
/*if (count($categories) > 0) {
foreach ($categories as $category) {
$allevals = $category->get_evaluations($user_id, true);
$alllinks = $category->get_links($user_id, true);
$catEvalsLinks = array_merge($allevals, $alllinks);
}
}*/
$allevals = $catcourse[0]->get_evaluations($user_id, true);
$alllinks = $catcourse[0]->get_links($user_id, true);
$allEvalsLinks = array_merge($allevals, $alllinks);
$item_value_total = 0;
$scoreinfo = null;
for ($count = 0; $count < count($allEvalsLinks); $count++) {
$item = $allEvalsLinks[$count];
$score = $item->calc_score($user_id);
$divide = $score[1] == 0 ? 1 : $score[1];
//$item_value = $score[0]/$divide;
$item_value = $score[0] / $divide * $item->get_weight();
$item_value_total += $item_value;
}
$item_total = $main_weight;
$total_score = array($item_value_total, $item_total);
$scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT);
if (!$catobj->get_id() == '0' && !isset($_GET['studentoverview']) && !isset($_GET['search'])) {
$scoreinfo .= '<h2>' . get_lang('Total') . ' : ' . $scorecourse_display . '</h2>';
}
Display::display_normal_message($scoreinfo, false);
}
// show navigation tree and buttons?
if ($showtree == '1' || isset($_GET['studentoverview'])) {
$header = '<div class="actions"><table>';
$header .= '<tr>';
if (!$selectcat == '0') {
$header .= '<td><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
}
$header .= '<td>' . get_lang('CurrentCategory') . '</td>' . '<td><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
$cats = Category::load();
$tree = $cats[0]->get_tree();
unset($cats);
$line = null;
foreach ($tree as $cat) {
for ($i = 0; $i < $cat[2]; $i++) {
$line .= '—';
}
$line = isset($line) ? $line : '';
if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
$header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
} else {
$header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
}
$line = '';
}
$header .= '</select></form></td>';
if (!empty($simple_search_form) && $message_resource === false) {
$header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
} else {
$header .= '<td></td>';
}
if ($is_course_admin && $message_resource === false && $_GET['selectcat'] != 0) {
//.........这里部分代码省略.........