Exemple #1
0
 if (!$loggedin) {
     dieJSON(array('error' => true, 'errorDesc' => 'Not logged in', 'html' => 'Sorry, you need to log in again.'));
 }
 $saved_roads = CourseRoadDB::getSavedRoads($athena);
 $html = '<table>';
 $html .= '<tr>';
 $html .= '<th style="min-width:50px" title="Select if you\'d like one of ' . 'your saved roads to be available more easily at ' . 'courseroad.mit.edu/index.php#' . $athena . '">Public</th>';
 $html .= '<th style="min-width:118px">Hash</th>';
 $html .= '<th style="min-width:118px">Added</th>';
 $html .= '<th style="min-width:95px">Major(s)</th>';
 $html .= '<th>Classes</th>';
 $html .= '<th style="min-width:30px;max-width:120px;">Comment</th>';
 $html .= '<th>Delete?</th>';
 $html .= '</tr>';
 $html .= '<tr>';
 $html .= '<td><input type="radio" name="setPublicRoad" ' . 'class="setPublicRoad" value="null" ' . (CourseRoadDB::hasPublicRoad($athena) ? '' : 'checked="true" ') . '/></td>';
 $html .= '<td colspan="6">Select this row to prevent any of your ' . 'saved roads from being your publicly-facing road.</td>';
 $html .= '</tr>';
 foreach ($saved_roads as &$row) {
     $row['classes'] = CourseRoadDB::decrypt($row['classes']);
     $row['majors'] = CourseRoadDB::decrypt($row['majors']);
     $hash = stripslashes($row['hash']);
     $roadURL = "?hash={$hash}";
     $html .= "<tr data-hash=\"{$hash}\">";
     $html .= '<td><input type="radio" name="setPublicRoad" ' . 'class="setPublicRoad" value="' . $hash . '" ' . ($row['public'] === 1 ? 'checked="true" ' : '') . '/></td>';
     $html .= '<td><span class="saved-roads-hash">' . substr(strstr($hash, '/'), 1) . '</span><span class="saved-roads-edit-hash ui-icon ui-icon-pencil">' . '</span></td>';
     $html .= "<td><a class=\"hashlink\" href=\"{$roadURL}\">" . stripslashes($row['added']) . '</a></td>';
     $majors = stripslashes($row['majors']);
     if ($majors[0] !== '[') {
         $majors = "[\"{$majors}\"]";
     }