Fixing refreshing issue.

1.9.x
Julio Montoya 11 years ago
parent cd3dcf4ed9
commit ce6c5bb18f
  1. 4
      main/admin/session_list.php
  2. 14
      main/inc/ajax/course.ajax.php
  3. 16
      main/inc/lib/course_category.lib.php

@ -50,8 +50,10 @@ $url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course';
$courseList = array();
$courseId = isset($_GET['course_id']) ? $_GET['course_id'] : null;
if (!empty($courseId)) {
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
$courseInfo = api_get_course_info_by_id($courseId);
$courseList[] = array('id' => $courseInfo['id'], 'text' => $courseInfo['title']);
$parents = getParentsToString($courseInfo['categoryCode']);
$courseList[] = array('id' => $courseInfo['id'], 'text' => $parents.$courseInfo['title']);
}
$sessionFilter->addElement('select_ajax', 'course_name', get_lang('SearchCourse'), null, array('url' => $url, 'defaults' => $courseList));
$url = api_get_self();

@ -65,23 +65,13 @@ switch ($action) {
$results = array();
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php';
$categories = browseCourseCategories();
foreach ($courseList as $courseInfo) {
$title = $courseInfo['title'];
if (!empty($courseInfo['category_code'])) {
$parents = getParents($courseInfo['category_code']);
if (!empty($parents)) {
$parents = array_reverse($parents);
$categories = array();
foreach ($parents as $category) {
$categories[] = $category['code'];
}
$categoriesInString = implode(' > ', $categories).' > ';
$title = $categoriesInString.$courseInfo['title'];
}
$parents = getParentsToString($courseInfo['category_code']);
$title = $parents.$courseInfo['title'];
}
$results[] = array(

@ -291,6 +291,22 @@ function getParents($categoryCode)
}
return $children;
}
function getParentsToString($categoryCode)
{
$parents = getParents($categoryCode);
if (!empty($parents)) {
$parents = array_reverse($parents);
$categories = array();
foreach ($parents as $category) {
$categories[] = $category['code'];
}
$categoriesInString = implode(' > ', $categories).' > ';
return $categoriesInString;
}
return null;
}
/**
* @param string $categorySource
* @return string

Loading…
Cancel
Save