Changeset - 1d32948ffcdb
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 15 years ago 2010-10-16 13:44:00
ohnobinki@ohnopublishing.net
Fix department auto-complete.
1 file changed with 4 insertions and 6 deletions:
0 comments (0 inline, 0 general)
auto.php
Show inline comments
 
@@ -71,20 +71,18 @@ if (!$school['crawled'])
 
if (!$getsections && count($term_parts) == 1 && $term_strlen == strlen($dept))
 
  {
 
    $dept_file = $cache_dir . '-depts';
 
    if (!file_exists($dept_file))
 
      clean_empty_exit();
 
    $departments = unserialize(file_get_contents($dept_file));
 
    $json_depts = array();
 
    foreach ($departments as $key => $department)
 
      {
 
	if (!strncmp($department, $dept, $dept_strlen))
 
	  $departments[$key] = $department;
 
	else
 
	  unset($departments[$key]);
 
      }
 
    echo json_encode($departments);
 
	$json_depts[] = $department;
 

	
 
    echo json_encode($json_depts);
 
    exit(0);
 
  }
 

	
 
if ($getsections)
 
  {
 
    $section_file = $cache_dir . $dept . DIRECTORY_SEPARATOR . $term_parts['course'];
0 comments (0 inline, 0 general)