Changeset - 6583b0529782
[Not reviewed]
default
0 4 0
Nathan Brink (binki) - 15 years ago 2011-03-26 11:57:37
ohnobinki@ohnopublishing.net
Fix the school_crawl_days_format() school crawler support function to log errors through school_crawl_logf() instead of error_log().
4 files changed with 13 insertions and 9 deletions:
0 comments (0 inline, 0 general)
inc/school.crawl.inc
Show inline comments
 
@@ -149,8 +149,10 @@ function school_crawl_mktime(array $tm)
 
 * This function is intended to make it easy for one to take the
 
 * output of an explode() call. For example, to decode $days_str =
 
 * 'Monday, Tuesday, Friday', one would do
 
 * school_crawl_days_format(explode(', ', $days_str));
 
 * school_crawl_days_format($school_crawl_log, explode(', ', $days_str));
 
 *
 
 * \param $school_crawl_log
 
 *   A school_crawl_log handle to report errors to.
 
 * \param $days
 
 *   An array of day names. These may be common abbreviations or
 
 *   truncations (any truncations must be two chars long for
 
@@ -161,7 +163,7 @@ function school_crawl_mktime(array $tm)
 
 * \return
 
 *   slate_permutate's strange internal days representation.
 
 */
 
function school_crawl_days_format($days)
 
function school_crawl_days_format(array $school_crawl_log, $days)
 
{
 
  static $daymap_1 = array('m' => 'm', 't' => 't', 'w' => 'w', 'h' => 'h', 'r' => 'h', 'f' => 'f', 's' => 's');
 
  static $daymap_2 = array('th' => 'h');
 
@@ -186,8 +188,8 @@ function school_crawl_days_format($days)
 
      if (isset($daymap_1[$day]))
 
	$my_days[$daymap_1[$day]] = TRUE;
 
      else
 
	error_log('school_crawl_days_format() got invalid day specifier:'
 
		  . ' `' . $day_orig . '\' => `' . $day . '\'');
 
	school_crawl_logf($school_crawl_log, 5, "school_crawl_days_format() got invalid day specifier: `%s' => `%s'.",
 
			  $day_orig, $day);
 
    }
 

	
 
  $day_str = '';
 
@@ -201,18 +203,20 @@ function school_crawl_days_format($days)
 
 * \brief
 
 *   Take a string of day initials and format it.
 
 *
 
 * \param $school_crawl_log
 
 *   The school_crawl_log handle to write errors out to.
 
 * \param $days_str
 
 *   Example input: 'mwf', 'TR'.
 
 * \return
 
 *   Same as school_crawl_days_format()
 
 */
 
function school_crawl_days_str_format($days_str)
 
function school_crawl_days_str_format(array $school_crawl_log, $days_str)
 
{
 
  $day_initials = array();
 
  for ($i = 0; $i < strlen($days_str); $i ++)
 
    $day_initials[] = $days_str[$i];
 

	
 
  return school_crawl_days_format($day_initials);
 
  return school_crawl_days_format($school_crawl_log, $day_initials);
 
}
 

	
 
/**
school.d/calvin.crawl.inc
Show inline comments
 
@@ -343,7 +343,7 @@ function calvin_crawl(array &$semesters,
 
	  /* e.g., 'Lecture', 'Practicum' */
 
	  $meeting_type = strtolower(trim($meeting_info_matches[3]));
 

	
 
	  $days = school_crawl_days_format(explode(', ', $meeting_info_matches[5]));
 
	  $days = school_crawl_days_format($school_crawl_log, explode(', ', $meeting_info_matches[5]));
 
	  $time_start = school_crawl_time_format(strptime($meeting_info_matches[6], '%I:%M%p'));
 
	  $time_end = school_crawl_time_format(strptime($meeting_info_matches[7], '%I:%M%p'));
 
	  $meeting_place = $meeting_info_matches[8];
school.d/ccbcmd.crawl.inc
Show inline comments
 
@@ -228,7 +228,7 @@ function ccbcmd_crawl(array &$semesters,
 
	    return 1;
 
	  }
 

	
 
	$days = school_crawl_days_str_format($children->item($section_offsets['days'])->textContent);
 
	$days = school_crawl_days_str_format($school_crawl_log, $children->item($section_offsets['days'])->textContent);
 

	
 
	$section_meetings[] = new SectionMeeting($days, school_crawl_time_format($time_start), school_crawl_time_format($time_end),
 
						 $children->item($section_offsets['location'])->textContent,
school.d/cedarville.crawl.inc
Show inline comments
 
@@ -229,7 +229,7 @@ function cedarville_crawl(array &$semest
 
	      /* prepare for parsing the next meeting time */
 
	      $meetings_str = substr($meetings_str, strlen($meeting_matches[0]));
 

	
 
	      $days = school_crawl_days_str_format($meeting_matches[3]);
 
	      $days = school_crawl_days_str_format($school_crawl_log, $meeting_matches[3]);
 
	      $time_start = school_crawl_time_format(strptime($meeting_matches[4] . 'M', '%I:%M%p'));
 
	      $time_end = school_crawl_time_format(strptime($meeting_matches[5] . 'M', '%I:%M%p'));
 
	      $room = $meeting_matches[2];
0 comments (0 inline, 0 general)