Changeset - 807664acef3a
[Not reviewed]
default
0 3 0
Ethan Zonca - 15 years ago 2010-12-08 23:32:44
ez@ethanzonca.com
Added registration code interface. The implemention is functional, but a bit rough for filling the syns[] array in php
3 files changed with 34 insertions and 0 deletions:
0 comments (0 inline, 0 general)
class.schedule.php
Show inline comments
 
@@ -280,31 +280,34 @@ class Schedule
 
            </script>';
 

	
 
      echo '<div id="sharedialog" title="Share Schedule"><p>You can share your schedule with the URL below:</p><p>'.$outputPage->gen_share_url($this->id_get()).'</p></div>';
 
      echo '<p><span id="printItems"><a href="#">Print</a></span> :: <span id="share"><a href="#">Share</a></span> :: <a href="input.php">Home</a></p>';
 
      echo '<p class="centeredtext">Having problems? <a href="feedback.php">Let us know</a>.</p>';
 
      echo '<p class="centeredtext graytext"><em>Keyboard Shortcut: Left and right arrow keys switch between schedules</em></p>';
 
    }		
 

	
 
    echo "\n";
 

	
 
    if($this->nPermutations > 0)
 
      {
 

	
 
        echo '<div id="regDialog" title="Registration Codes"><p>Enter these codes into your school\'s online course registration system to register for classes:</p><div id="regDialogList"></div></div>';
 
	echo '<div id="tabs">' . "\n" .
 
               '<div id="show-box" class="show-buttons">
 
                  <form>
 
                    <label><strong>Display:</strong></label>
 
                    <input id="show-prof" name="show-prof" type="checkbox" checked="checked" /><label for="show-prof">Professor</label>
 
                    <input id="show-location" name="show-location" type="checkbox" /><label for="show-location">Room</label>
 
                    <input id="show-synonym" name="show-synonym" type="checkbox" /><label for="show-synonym">Synonym</label>
 
                    <div id="regCodes"><label><a href="#">Registration Codes</a></label></div>
 
                  </form>
 
                </div> <!-- id="show-box" -->'
 
	     . '<div id="the-tabs"><ul>' . "\n";
 
			
 
	for($nn = $first_permutation + 1; $nn <= $last_permutation; $nn++)
 
	  {
 
	    echo  "<li><a href=\"#tabs-" . $nn . "\">&nbsp;" . $nn . "&nbsp;</a></li>\n";
 
	  }
 
			
 
	echo "    </ul></div>\n  \n";
 

	
 
	echo "    <div id=\"pagers\">\n";
 
@@ -314,24 +317,25 @@ class Schedule
 

	
 
	/* Next button */
 
	if ($page + 1 < $npages)
 
	  echo '      <div id="pager-next" class="pager right"><a href="' . $this->url($this->id, $page + 1) . '">Next &raquo;</a></div>' . "\n";
 
	echo "    </div> <!-- id=\"pagers\" -->\n";
 

	
 

	
 
	echo "  <div class=\"scroller\">\n"
 
	  . "    <div class=\"scontent\">\n";
 
		
 
	for($i = $first_permutation; $i < $last_permutation; $i++)
 
	  {
 
             $syns = array();
 
	     echo  '      <div class="section" id="tabs-' . ($i+1) . "\">\n";
 
  
 
	    // 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"
 
	      . "            <td class=\"day\">Monday</td>\n"
 
	      . "            <td class=\"day\">Tuesday</td>\n"
 
	      . "            <td class=\"day\">Wednesday</td>\n"
 
	      . "            <td class=\"day\">Thursday</td>\n"
 
@@ -384,47 +388,50 @@ class Schedule
 

	
 
				      echo '            <td rowspan="' . $rowspan[$dayLoop]
 
					. '" class="' . $single_multi . ' class' . $j
 
					. '" title="prof: ' . htmlentities($section->getProf(), ENT_QUOTES)
 
					. ', room: ' . htmlentities($current_meeting->getLocation(), ENT_QUOTES)
 
					. ', type: ' . htmlentities($current_meeting->type_get(), ENT_QUOTES) . '">'
 
					. htmlentities($class->getName(), ENT_QUOTES) . '-'
 
					. htmlentities($section->getLetter(), ENT_QUOTES) . "\n"
 
					. '<span class="prof block">' . htmlentities($section->getProf(), ENT_QUOTES) . "</span>\n"
 
					. '<span class="location block">' . htmlentities($current_meeting->getLocation(), ENT_QUOTES) . "</span>\n"
 
					. '<span class="synonym block">' . htmlentities($section->getSynonym(), ENT_QUOTES) . "</span>\n"
 
					. "</td>\n";
 
				      $syns[$section->getSynonym()] = $section->getSynonym();
 
				      $filled = TRUE;
 
				    }
 
			}
 
		    }
 

	
 
		  if ($rowspan[$dayLoop] > 0)
 
		    {
 
		      $filled = TRUE;
 
		      $rowspan[$dayLoop] --;
 
		    }
 

	
 
		  /* If the cell was not filled, fill it with an empty cell. */
 
			if(!$filled)
 
			{
 
				echo "            <td class=\"none\">&nbsp;</td>\n";
 
			}
 
			$filled = FALSE;
 
		}
 
		
 
		// End of row
 
		echo "          </tr>\n";
 
	      }
 

	
 
            echo '<div class="syns'.$i.'">'.  json_encode($syns) . '</div>';
 

	
 
	    // End of table
 
	    echo "        </table>\n"
 
	      . '      </div> <!-- id="section' . ($i + 1) . "\" -->\n";
 
	  }
 

	
 
	echo $table
 
	  . "    </div> <!-- class=\"scontent\" -->\n"
 
	  . "  </div> <!-- class=\"scroller\" -->\n"
 
	  . "</div> <!-- id=\"my-glider\" -->\n"
 
	  . $footcloser; // Closes off the content div
 
      } else {
 
      echo '<html><body><p>There are no possible schedules. Please try again.</p></body></html>';
scripts/displayTables.js
Show inline comments
 
@@ -36,14 +36,32 @@ function show_box_change()
 
		{
 
		    jQuery('.' + css_class).hide();
 
		}
 
	}
 

	
 
    return false;
 
}
 

	
 
jQuery(document).ready( function()
 
  {
 
      jQuery('#show-box input').change(show_box_change);
 
      jQuery('#show-box input').change();
 

	
 
      jQuery("#regDialog").dialog({ modal: true, width: 550, resizable: false, draggable: false, autoOpen: false });   
 
      jQuery('#regCodes').click( function() {
 
        jQuery('#regDialogList').empty();
 
        var currSec = '.syns' + jQuery('#tabs').tabs('option','selected');
 

	
 
        var jHtml = jQuery(currSec).html();
 
        var secs = eval('(' + jHtml + ')');
 
        var output = '<p class=\'synList\'>';
 
        for( var i in secs ) {
 
          output = output + secs[i] + '<br />';
 
        }
 
        output = output + '</p>';
 
        jQuery('#regDialogList').append(output);
 

	
 
        jQuery("#regDialog").dialog("open");
 
      });
 
  }
 
);
 

	
styles/general.css
Show inline comments
 
@@ -213,12 +213,21 @@ td.center {
 

	
 
/** Used for hidden saved schedules */
 
.hidden {
 
  display: none;
 
}
 
#showLess {
 
  display:none;
 
}
 
#savedBox p {
 
  padding:0;
 
  margin:0;
 
}
 
.syns {
 
  display:none;
 
}
 
#regCodes {
 
  float: right;
 
}
 
.synList {
 
  margin-left: 1em;
 
}
0 comments (0 inline, 0 general)