Example #1
0
 function writeTable($qualifier, $subject_id = '')
 {
     global $IconPath;
     global $proxyURL;
     // sanitize submission
     $selected = scrubData($qualifier);
     $subject_id = scrubData($subject_id);
     // determine submission type
     $selected = getTableOptions($selected, $subject_id);
     if (isset($subject_id) && $subject_id != "") {
         $q = "select distinct left(title,1) as initial, title, description, location, access_restrictions, title.title_id as this_record,\neres_display, display_note, pre, citation_guide, ctags\n        FROM title, restrictions, location, location_title, source, rank\n        {$selected}\n        AND title.title_id = location_title.title_id\n        AND location.location_id = location_title.location_id\n        AND restrictions_id = access_restrictions\n       \n        AND rank.title_id = title.title_id AND source.source_id = rank.source_id\n        ORDER BY title ";
     } else {
         $q = "select distinct left(title,1) as initial, title, description, location, access_restrictions, title.title_id as this_record,\neres_display, display_note, pre, citation_guide, ctags\n\t\tFROM title, restrictions, location, location_title, source\n\t\t{$selected}\n\t\tAND title.title_id = location_title.title_id\n\t\tAND location.location_id = location_title.location_id\n\t\tAND restrictions_id = access_restrictions\n\n\t\tORDER BY title";
     }
     //print $q;
     $db = new Querier();
     $r = $db->query($q);
     // check row count for 0 returns
     $num_rows = count($r);
     if ($num_rows == 0) {
         return "<div class=\"no_results\">" . _("Sorry, there are no results at this time.") . "</div>";
     }
     // prepare 	header
     $items = "<table width=\"98%\" class=\"item_listing\">";
     $row_count = 0;
     $colour1 = "oddrow";
     $colour2 = "evenrow";
     foreach ($r as $myrow) {
         $row_colour = $row_count % 2 ? $colour1 : $colour2;
         $patterns = "/'|\"/";
         $replacements = "";
         $item_title = $myrow["title"];
         $safe_title = trim(preg_replace($patterns, $replacements, $item_title));
         $blurb = $myrow["description"];
         $bib_id = $myrow["5"];
         /// CHECK RESTRICTIONS ///
         if ($myrow['4'] == 2 or $myrow['4'] == 3) {
             $url = $proxyURL . $myrow[3];
             $rest_icons = "restricted";
         } else {
             $url = $myrow[3];
             $rest_icons = "";
             // if you want the unlocked icon to show, enter "unrestricted" here
         }
         $current_ctags = explode("|", $myrow["ctags"]);
         // add our $rest_icons info to this array at the beginning
         array_unshift($current_ctags, $rest_icons);
         $icons = showIcons($current_ctags);
         //Check if there is a display note
         if ($myrow["display_note"] == NULL) {
             $display_note_text = "";
         } else {
             $display_note_text = "<strong>" . _("Note:") . " </strong>{$myrow['display_note']}";
         }
         $bonus = "{$blurb}";
         if ($blurb != "") {
             $information = "<img src=\"{$IconPath}/information.png\" border=\"0\" alt=\"" . _("more information") . "\" title=\"" . _("more information") . "\"  id=\"bib-{$bib_id}\" />";
         } else {
             $information = "";
         }
         $items .= "\n\t<tr class=\"zebra {$row_colour}\" valign=\"top\">\n\t\t\n\t\t<td><a href=\"{$url}\" target=\"_blank\"><strong>{$item_title}</strong></a> {$icons}<br/>{$bonus}   {$display_note_text}\n                   \n\t</tr>";
         $row_count++;
     }
     $items .= "</table>";
     return $items;
 }
        padding:10px; 
        width: 200px;
    }
    #d_clip_button.hover { background-color:#eee; }
    #d_clip_button.active { background-color:#aaa; }
    
</style>
<script type="text/javascript" src="http://ben.soundenterprises.net/constructor/zeroclipboard/ZeroClipboard.js"></script>

<h1>Class Constructor</h1>
<form id="tableselector" action="constructor.jay.php">
    Class to create:
    <select name="table" onchange="document.getElementById('tableselector').submit()">
        <option value="">Select a Table</option>
        <?php 
getTableOptions();
?>
    </select>
</form>
<?php 
writeTable();
if (isset($_REQUEST['pageaction'])) {
    switch ($_REQUEST['pageaction']) {
        case 'c':
            writeClass();
            break;
        case 'alist':
            writeAdminList();
            break;
        case 'elist':
            writeAdminEdit();