Changeset - 143f48e9e161
[Not reviewed]
default
0 2 0
Nathan Brink (binki) - 12 years ago 2013-10-30 01:22:00
ohnobinki@ohnopublishing.net
Add description blurbs that happen to be picked up by facebook’s link blurb generator, somewhat addresses bug #90.

We have per-tab blurbs expanding the sections and a page-wide blurb listing the courses.
2 files changed with 53 insertions and 0 deletions:
0 comments (0 inline, 0 general)
inc/class.schedule.php
Show inline comments
 
@@ -571,48 +571,65 @@ class Schedule
 
		    {
 
		      $max_time += $max_time + 30;
 
		      while ($max_time % 100 >= 60)
 
			$max_time += 40; /* + 100 - 60 */
 
		      $time[] = $max_time;
 
		    }
 
		  while ((int)ltrim($meeting->getStartTime(), '0') < $min_time)
 
		    {
 
		      $max_time += 30;
 
		      while ($min_time % 100 < 30)
 
			$min_time -= 40; /* + 60 - 100 */
 
		      $min_time -= 30;
 
		      $time[] = $min_time;
 
		      $sort_time = TRUE;
 
		    }
 
		}
 
	  }
 
	/* ensure that early times are actually first ;-) */
 
	if ($sort_time)
 
	  sort($time);
 

	
 
        if ($have_saturday)
 
          $dayloop_max = 6;
 

	
 
        /*
 
         * Something to describe the whole page to a link-blurb
 
         * generator (like Facebook’s link-sharer), so per-course.
 
         */
 
        echo '    <div id="courseList" class="description" title="Chosen Courses."><p>' . PHP_EOL;
 
        foreach ($this->courses as $course_j => $course)
 
          {
 
            if ($course_j)
 
              echo ';' . PHP_EOL;
 
            $title = $course->title_get();
 
            echo '      ' . page::entities(
 
              $course->getName()
 
              . (empty($title) ? '' : ': ' . $title));
 
          }
 
        echo '. There are ' . $this->nPermutations . ' valid permutation' . ($this->nPermutations == 1 ? '' : 's') . ' for these courses.' . PHP_EOL;
 
        echo '    </p></div>' . PHP_EOL;
 

	
 
        echo '    <div id="regDialog" title="Registration Codes">' . PHP_EOL
 
	  . '      <div id="regDialog-content"></div>' . PHP_EOL
 
	  . '      <p class="regDialog-disclaimer graytext">' . PHP_EOL
 
	  . '        <em>' . PHP_EOL
 
	  . '          Note: The registration information above corresponds to the sections' . PHP_EOL
 
	  . '          displayed on the currently selected tab.' . PHP_EOL
 
	  . '        </em>' . PHP_EOL
 
	  . '      </p>' . PHP_EOL
 
	  . '      <p class="regDialog-disclaimer graytext">' . PHP_EOL
 
	  . '        <em>' . PHP_EOL
 
	  . '          Disclaimer: You are responsible for' . PHP_EOL
 
	  . '          double-checking the information you get from and input into slate_permutate' . PHP_EOL
 
	  . '          when registering for classes. There is no guarantee that the harvested' . PHP_EOL
 
	  . '          information is correct or that slate_permutate will handle' . PHP_EOL
 
	  . '          the information you enter correctly.' . PHP_EOL
 
	  . '        </em>' . PHP_EOL
 
	  . '      </p>' . PHP_EOL
 
	  . '    </div>' . PHP_EOL;
 
	echo '<div id="tabs">' . "\n" .
 
               '<div id="show-box" class="show-buttons">
 
                  <form action="#"><p class="nospace">
 
                    <label><strong>Display:</strong></label>
 
                    <input id="show-course-title" name="show-course-title" type="checkbox" /><label for="show-course-title">Course Title</label>
 
                    <input id="show-prof" name="show-prof" type="checkbox" checked="checked" /><label for="show-prof">Professor</label>
 
@@ -665,48 +682,77 @@ class Schedule
 
	    /*
 
	     * Skip suppressed permutations, such as when displaying a
 
	     * page for printing a particular permutation.
 
	     */
 
	    if (!empty($suppressed_permutations[$i]))
 
	      continue;
 

	
 
	    /*
 
	     * Store a JSON list of courses, each with only the one
 
	     * section rendered in this permutation. This is used for
 
	     * the ``Registration Numbers'' dialog which noramlly
 
	     * shows users course synonyms.
 
	     */
 
	    $permutation_courses = array();
 

	
 
            /*
 
             * Count the number of credit hours in this particular
 
             * schedule.
 
             */
 
            $credit_hours = array();
 
            $have_credit_hours = FALSE;
 

	
 
	     echo  '      <div class="section" id="tabs-' . ($i+1) . "\">\n";
 
  
 
             /*
 
              * A description readable by link blurb-generators (like
 
              * facebook’s link sharer) per permutation (so
 
              * section-specific). This gets picked up by the
 
              * blurb-generators because they respect fragments in
 
              * URIs.
 
              */
 
             echo '    <div class="sectionList"><p>' . PHP_EOL;
 
             foreach ($this->courses as $course_j => $course)
 
               {
 
                 foreach ($course as $course_slot)
 
                   {
 
                     $section = $course_slot->section_get_i($this->storage[$i][$course_j]);
 
                     if ($course_j)
 
                       echo ';' . PHP_EOL;
 
                     $instructors = array();
 
                     foreach ($section as $section_meeting)
 
                       if ($instructor = $section_meeting->instructor_get())
 
                         $instructors[$instructor] = TRUE;
 
                     $title = $course->title_get();
 
                     echo '      ' . page::entities(
 
                       $course->getName() . '-' . $section->getLetter()
 
                       . (empty($title) ? '' : ': ' . $title)
 
                       . (empty($instructors) ? '' : ' with ' . implode(', ', array_keys($instructors))));
 
                   }
 
               }
 
             echo '.' . PHP_EOL;
 
             echo '    </p></div>' . PHP_EOL;
 

	
 
	    // Beginning of table
 
	    echo "        <table style=\"empty-cells:show;\" border=\"1\" cellspacing=\"0\">\n";
 
				
 
	    // Header row
 
	    echo "          <tr>\n"
 
              . '            <td class="none permuteNum">' . ($i + 1) . "</td>\n";
 
            if ($have_sunday)
 
              echo '            <td class="day">Sunday</td>' . PHP_EOL;
 
            echo "            <td class=\"day\">Monday</td>\n"
 
	      . "            <td class=\"day\">Tuesday</td>\n"
 
	      . "            <td class=\"day\">Wednesday</td>\n"
 
	      . "            <td class=\"day\">Thursday</td>\n"
 
	      . "            <td class=\"day\">Friday</td>\n";
 
	    if ($have_saturday)
 
	      echo "            <td class=\"day\">Saturday</td>\n";
 
	    echo "          </tr>\n";
 

	
 
	    $last_meeting = array();
 
	    $rowspan = array(0, 0, 0, 0, 0, 0, 0);
 
	    for($r = 0; $r < (count($time)-1); $r++)
 
	      {
 

	
 
		echo "          <tr>\n"
 
		  . "            <td class=\"time\">" . $this->prettyTime($time[$r]) . "</td>\n";
styles/output.css
Show inline comments
 
@@ -178,40 +178,47 @@ td{
 
}
 
.show-buttons label {
 
  padding-right: .5em;
 
}
 

	
 
.pager
 
{
 
  display: inline-block;
 

	
 
  clear: none;
 
}
 
.pager a
 
{
 
  text-decoration: none;
 
}
 

	
 
#pager-previous
 
{
 
  float: left;
 
}
 
#pager-next
 
{
 
  float: right;
 
}
 
/*
 
 * For link-blurb generators to read, not humans to directly see.
 
 */
 
.sectionList, #courseList
 
{
 
  display: none;
 
}
 

	
 
table {
 
  border-radius: 5px;
 
}
 
.none {
 
  border-bottom: 1px dotted #ccc;
 
}
 

	
 
.section
 
{
 
    page-break-before: always;
 
}
 
.section:first-child
 
{
 
    page-break-before: auto;
 
}
0 comments (0 inline, 0 general)