Changeset - e6133536166f
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 15 years ago 2011-02-04 21:54:01
ohnobinki@ohnopublishing.net
Change school_instructions_html() to fallback to loading the ``default'' school's profile if the current school doesn't define a <school_id>_instructions_html() function.
1 file changed with 21 insertions and 2 deletions:
0 comments (0 inline, 0 general)
inc/school.inc
Show inline comments
 
@@ -242,11 +242,30 @@ function school_list_html($highlight = N
 
 */
 
function school_instructions_html($school)
 
{
 
  if (!$school || !$school['id']
 
      || !function_exists($school['id'] . '_instructions_html'))
 
  global $school_default_school;
 

	
 
  if (empty($school) || empty($school['id']))
 
    /*
 
     * Invalid param deserves a NULL :-p. Really, this invalid param
 
     * handling shouldn't be needed...
 
     */
 
    return NULL;
 

	
 
  $school_instructions_html = $school['id'] . '_instructions_html';
 

	
 
  if (!function_exists($school_instructions_html))
 
    {
 
      /* load the default school's _instructions_html() function */
 
      if ($school_default_school === NULL)
 
	$school_default_school = school_load('default');
 
      /* ``hacky'', but preferable to recursion: */
 
      $school_instructions_html = 'default' . '_instructions_html';
 

	
 
      /* be 503-safe */
 
      if (!function_exists($school_instructions_html))
 
	return NULL;
 
    }
 

	
 
  return $school_instructions_html();
 
}
 

	
0 comments (0 inline, 0 general)