Changeset - 5e7fdb927b36
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 14 years ago 2011-10-27 00:35:10
ohnobinki@ohnopublishing.net
Use a different way to fix the reported time for saved_schedules created in the future.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
@@ -106,50 +106,49 @@ class page
 
   * \param $ntitle
 
   *   Must be a valid HTML string (i.e., escaped with htmlentities()).
 
   * \param $nscripts
 
   *   An array of strings identifying the scripts to include for this page.
 
   * \param $options
 
   *   An array containing any of the following keys:
 
   *     - 'school': The school to use instead of the autodetected one.
 
   *     - 'semester': The semester to use instead of the autodetected one.
 
   */
 
  protected function __construct($ntitle, $nscripts = array(), $immediate = TRUE, array $options = array())
 
  {
 
    /* Begin tracking generation time */
 
    $this->pageGenTime = round(microtime(),4);
 

	
 
    global $ga_trackers;
 

	
 
    require_once('school.inc');
 

	
 
    /* Scripts and styles available for inclusion */
 

	
 
    $this->headCode['jQuery'] = '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>';
 
    $this->headCode['jQueryUI'] = '<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script><link rel="stylesheet" href="styles/jqueryui.css" type="text/css" media="screen" charset="utf-8" />';
 
    $this->headCode['jValidate'] = '<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>';
 
    $this->headCode['jAddress'] = '<script type="text/javascript" src="http://js.ohnopub.net/js/jquery.address-1.3.2.min.js"></script>';
 
    $this->headCode['jQuery.cuteTime'] = '<script type="text/javascript" src="http://ohnopub.net/~ohnobinki/CuteTime/js/jquery.cuteTime.js"></script>'
 
      . $this->script_wrap('$.fn.cuteTime.settings.time_ranges[0].cuteness = \'in the future\';');
 
    $this->headCode['jQuery.cuteTime'] = '<script type="text/javascript" src="http://ohnopub.net/~ohnobinki/CuteTime/js/jquery.cuteTime.js"></script>';
 
    $this->headCode['qTip'] = '<script type="text/javascript" src="http://js.ohnopub.net/js/jquery.qtip-1.0.min.js"></script>';
 
    $this->headCode['qTip2'] = '<script type="text/javascript" src="http://js.ohnopub.net/js/2011.03.21/jquery.qtip.min.js"></script><link rel="stylesheet" href="http://js.ohnopub.net/js/2011.03.21/jquery.qtip.min.css" type="text/css" media="screen" />';
 
    $this->headCode['schedInput'] = '<script type="text/javascript" src="scripts/scheduleInput.js"></script>';
 
    $this->headCode['outputPrintStyle'] = '<link rel="stylesheet" href="styles/print.css" type="text/css" media="screen" charset="utf-8" />';
 
    $this->headCode['outputStyle'] = '<link rel="stylesheet" href="styles/output.css" type="text/css" media="screen" charset="utf-8" />'; 
 
    $this->headCode['gliderHeadcode'] = '<link rel="stylesheet" href="styles/glider.css" type="text/css" media="screen" charset="utf-8" />'; 
 
    $this->headCode['uiTabsKeyboard'] = '<script type="text/javascript" src="scripts/uiTabsKeyboard.js"></script>';
 
    $this->headCode['displayTables'] = '<script type="text/javascript" src="scripts/displayTables.js"></script>';
 

	
 
    $this->pagetitle = $ntitle;
 
    $this->scripts = $nscripts;
 

	
 
   /* Compliant browsers which care, such as gecko, explicitly request xhtml: */
 
   if(empty($_SERVER['HTTP_ACCEPT'])  /* then the browser doesn't care :-) */
 
      || strpos($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') !== FALSE)
 
       $this->xhtml = TRUE;
 

	
 
   if (count($ga_trackers))
 
     {
 
       $ga_www = 'http://www.';
 
       if ($_SERVER['SERVER_PORT'] != 80)
 
	 $ga_www = 'https://ssl.';
 

	
 
       $this->trackingcode = '<script type="text/javascript" src="' . $ga_www . 'google-analytics.com/ga.js" />' . "\n"
 
@@ -252,49 +251,50 @@ class page
 

	
 
    echo '<!DOCTYPE ' . $this->doctype . '>'. PHP_EOL .
 
	  '<html ' . $this->htmlargs . '>'. PHP_EOL .
 
	  '  <head>'. PHP_EOL .
 
	  '    <title>' . $this->pagetitle . ' - ' . $this->base_title . '</title>'. PHP_EOL .
 
          '    <link rel="stylesheet" href="styles/general.css" type="text/css" media="screen" charset="utf-8" />'.  PHP_EOL .
 
	  '    <link rel="stylesheet" type="text/css" media="print" href="styles/print.css" />'. PHP_EOL .
 
          '    <!--[if IE]>'. PHP_EOL .
 
          '      <link rel="stylesheet" type="text/css" media="screen" charset="utf-8" href="styles/ie.css" />'. PHP_EOL .
 
          '    <![endif]-->'. PHP_EOL .
 
          '    <link rel="shortcut icon" href="images/favicon.png" />'. PHP_EOL
 
      . '    <style type="text/css">' . PHP_EOL
 
      . $this->cdata_wrap(school_page_css($this->school))
 
      . '    </style>' . PHP_EOL;
 
    // Write out all passed scripts
 
    foreach ($this->scripts as $i)
 
      echo '    ' . $this->headCode["$i"] . "\n";
 

	
 
    /*
 
     * Perhaps we should have a separate array for javascript library
 
     * initialization snippets.
 
     */
 
    $javascript_init = '';
 
    if (in_array('jQuery.cuteTime', $this->scripts))
 
      $javascript_init .= 'jQuery.extend(jQuery.fn.cuteTime.settings, {refresh: 10000, use_html_attribute: false});' . PHP_EOL;
 
      $javascript_init .= 'jQuery.extend(jQuery.fn.cuteTime.settings, {refresh: 10000, use_html_attribute: false});' . PHP_EOL
 
	. 'jQuery.fn.cuteTime.settings.time_ranges[0].cuteness = \'in the future\';' . PHP_EOL;
 

	
 
    echo $this->script_wrap(''
 
			    . 'var slate_permutate_school = ' . json_encode($this->school['id']) . ';' . PHP_EOL
 
			    . 'var slate_permutate_semester = ' . json_encode($this->semester['id']) . ';' . PHP_EOL
 
			    . $javascript_init);
 

	
 
    $selectschool_query = '&amp;school=' . $this->school['id'];
 
    /* kludge */
 
    if (!empty($_REQUEST['s']))
 
      $selectschool_query .= '&amp;s=' . (int)$_REQUEST['s'];
 

	
 
    echo '  </head>' . PHP_EOL .
 
	 '  <body>'. PHP_EOL .
 
         '    <div id="page">'. PHP_EOL .
 
         '      <div id="header">'. PHP_EOL .
 
	 '        <div id="title">'. PHP_EOL .
 
         '          <h1><a href="index.php"><img src="images/slatepermutate-alpha.png" alt="SlatePermutate" class="noborder" /></a><br /></h1>'. PHP_EOL .
 
         '          <p>'. PHP_EOL .
 
         '            <span id="subtitle">'.$this->pagetitle.'</span>'. PHP_EOL .
 
  	 '            <span id="menu">' . PHP_EOL
 
      . '              Profile: <em>' . $this->school['name'] . '</em>' . ($this->school_semester_constant ? '' : ' <a href="input.php?selectschool=1' . $selectschool_query . '">(change)</a>') . PHP_EOL;
 
    if (!empty($this->semester))
 
      echo  '             Semester: <em>' . $this->semester['name'] . '</em>' . ($this->school_semester_constant ? '' : ' <a href="input.php?selectsemester=1' . $selectschool_query . '">(change)</a>') . PHP_EOL;
 
    echo '            </span>'. PHP_EOL .
0 comments (0 inline, 0 general)