Ejemplo n.º 1
0
 public function getResults()
 {
     $sql = "SELECT subject_id AS 'id', shortform AS 'shortform',  subject AS 'matching_text', description as 'additional_text', '' as 'tab_index', '' AS 'parent_id', 'Subject Guide' as 'content_type' FROM subject \nWHERE description LIKE" . $this->getSearch() . "\nOR subject LIKE " . $this->getSearch() . "\nOR keywords LIKE " . $this->getSearch() . "\nOR shortform LIKE " . $this->getSearch() . "\nOR type LIKE " . $this->getSearch() . "\nUNION \nSELECT p.pluslet_id AS 'id', su.shortform as 'shortform', p.title AS 'matching_text',p.body AS 'additional_text', t.tab_index AS 'additional_text', su.subject_id AS 'parent_id', 'Pluslet' AS 'content_type' FROM pluslet AS p \n\tINNER JOIN pluslet_section AS ps \n\tON ps.pluslet_id = p.pluslet_id\n\tINNER JOIN section AS s \n\tON ps.section_id = s.section_id\n\tINNER JOIN tab AS t\n\tON s.tab_id = t.tab_id\n\tINNER JOIN subject AS su \n\tON su.subject_id = t.subject_id\nWHERE p.body LIKE " . $this->getSearch() . "\nOR p.title LIKE " . $this->getSearch() . "\nUNION\nSELECT title_id AS 'id', '' as 'shortform', title AS 'matching_text' , description as 'additional_text','' as 'tab_index',  '' AS 'parent_id', 'Record' as 'content_type' FROM title \nWHERE title LIKE " . $this->getSearch() . "\nOR description LIKE " . $this->getSearch() . "\nUNION\nSELECT faq_id AS 'id', '' as 'shortform' ,  question AS 'matching_text', answer as 'additional_text','' as 'tab_index', '' AS 'parent_id', 'FAQ' as 'content_type' FROM faq \nWHERE question LIKE " . $this->getSearch() . "\nOR answer LIKE " . $this->getSearch() . "\nOR keywords LIKE " . $this->getSearch() . "\nUNION\nSELECT talkback_id AS 'id', '' as 'shortform',  question AS 'matching_text' , answer as 'additional_text','' as 'tab_index',  '' AS 'parent_id', 'Talkback' as 'content_type' FROM talkback \nWHERE question LIKE " . $this->getSearch() . "\nOR answer LIKE " . $this->getSearch() . "\nUNION\nSELECT staff_id AS 'id',  '' as 'shortform', email AS 'matching_text' , fname as 'additional_text','' as 'tab_index', '' AS 'parent_id', 'Staff' as 'content_type' FROM staff \nWHERE fname LIKE " . $this->getSearch() . "\nOR lname LIKE " . $this->getSearch() . "\nOR email LIKE " . $this->getSearch() . "\nOR tel LIKE " . $this->getSearch() . "\nUNION\nSELECT department_id AS 'id', '' as 'shortform', name AS 'matching_text' , telephone as 'additional_text','' as 'tab_index',  '' AS 'parent_id', 'Department' as 'content_type' FROM department \nWHERE name LIKE " . $this->getSearch() . "\nOR telephone LIKE " . $this->getSearch() . "\nUNION\nSELECT video_id AS 'id',  '' as 'shortform', title AS 'matching_text' , description as 'additional_text','' as 'tab_index', '' AS 'parent_id', 'Video' as 'content_type' FROM video \nWHERE title LIKE " . $this->getSearch() . "\nOR description LIKE " . $this->getSearch() . "\nOR vtags LIKE " . $this->getSearch();
     $db = new Querier();
     $results = $db->query($sql);
     return $results;
 }
Ejemplo n.º 2
0
 public function getFavoritePluslets($staff_id = null)
 {
     if ($staff_id == null) {
         $staff_id = $this->_staff_id;
     }
     $querier = new Querier();
     $sql = "SELECT p.pluslet_id as 'id', p.title AS 'title', p.type AS 'type', t.tab_index AS 'tab_index' FROM pluslet AS p\n                   INNER JOIN pluslet_section AS ps\n                   ON ps.pluslet_id = p.pluslet_id\n                   INNER JOIN section AS s\n                   ON ps.section_id = s.section_id\n                   INNER JOIN tab AS t\n                   ON s.tab_id = t.tab_id\n                   INNER JOIN subject AS subject\n                   ON t.subject_id = subject.subject_id\n                   INNER JOIN staff_subject AS staff_sub\n                   ON subject.subject_id = staff_sub.subject_id\n                   WHERE p.favorite_box = 1\n                   AND staff_sub.staff_id = {$staff_id}";
     $favorites = $querier->query($sql);
     return $favorites;
 }
Ejemplo n.º 3
0
 /**
  * sp_WebService::setData() - this method sets the data that will be outputted for
  * the web service with a get method
  *
  * @return void
  */
 public function setData()
 {
     $lobjParams = $this->mobjUrlParams;
     $lobjParams = $this->sanitizeParams($lobjParams);
     if ($lobjParams === false) {
         die;
     }
     $lstrQuery = $this->generateQuery($lobjParams) or die;
     $lobjQuerier = new Querier();
     $lobjResults = $lobjQuerier->query($lstrQuery, \PDO::FETCH_ASSOC);
     if (!$lobjResults) {
         $lobjResults = array();
     }
     $this->mobjData[$this->mstrTag] = $lobjResults;
 }
Ejemplo n.º 4
0
 /**
  * StaffWebService::setData() - this method overrides the parent method because
  * the staff webservice requires an append to the tel field
  *
  * @return void
  */
 public function setData()
 {
     $lobjParams = $this->mobjUrlParams;
     $lobjParams = $this->sanitizeParams($lobjParams);
     if ($lobjParams === false) {
         die;
     }
     $lstrQuery = $this->generateQuery($lobjParams) or die;
     $lobjQuerier = new Querier();
     $lobjResults = $lobjQuerier->query($lstrQuery, \PDO::FETCH_ASSOC);
     if (!$lobjResults) {
         $lobjResults = array();
     }
     global $tel_prefix;
     foreach ($lobjResults as &$lobjRow) {
         if (isset($tel_prefix)) {
             $lobjRow['tel'] = $tel_prefix . $lobjRow['tel'];
         }
     }
     $this->mobjData[$this->mstrTag] = $lobjResults;
 }
    $db = new Querier();
    $content = '<strong>Results</strong><br />';
    if (get_magic_quotes_gpc()) {
        $searcher = $_POST["search_terms"];
    } else {
        $searcher = addslashes($_POST["search_terms"]);
    }
    // Connect to database
    try {
    } catch (Exception $e) {
        echo $e;
    }
    //create query to search terms
    $q = "SELECT title_id, title FROM title WHERE title LIKE '%" . $searcher . "%' ORDER BY title";
    //query results
    $r = $db->query($q);
    //total returned rows
    $total_items = count($r);
    //return message if no results
    if ($total_items == 0) {
        $content .= "<br /><div valign=\"top\" style=\"float: left; min-width: 230px;\"><p>" . _("There were no results matching your query.") . "</p></div>";
    } else {
        //while rows exist
        foreach ($r as $myrow) {
            $token = "";
            $token = "{{dab},{" . $myrow[0] . "}, {" . $myrow[1] . "}";
            $content .= "<br /><div style=\"clear: both; padding: 3px 5px; font-size: 12px;\"> <input id=\"chosen_token\" name=\"but\" type=\"radio\" value=\"{$token}\"> {$myrow['1']}</div>\n";
        }
    }
    print $content;
}
Ejemplo n.º 6
0
 function getAssocSubjects($staff_id, $ptags)
 {
     global $mod_rewrite;
     $assoc_subjects = "";
     // See if they're a librarian, and then check for subjects
     $islib = preg_match('/librarian/', $ptags);
     if ($islib == 1) {
         // UM hack in query
         $q2 = "SELECT subject, shortform \n              FROM subject, staff_subject \n              WHERE subject.subject_id = staff_subject.subject_id\n              AND staff_subject.staff_id = {$staff_id}\n              AND subject.active = 1\n              AND shortform != 'NewDatabases'\n              ORDER BY subject";
         //print $q2;
         $db = new Querier();
         $r2 = $db->query($q2);
         foreach ($r2 as $myrow2) {
             if ($mod_rewrite == 1) {
                 $link_to_guide = $myrow2[1];
             } else {
                 $link_to_guide = "guide.php?subject=" . $myrow2[1];
             }
             $assoc_subjects .= "<a href=\"{$link_to_guide}\">{$myrow2['0']}</a>, ";
         }
     }
     if ($assoc_subjects != "") {
         $assoc_subjects = rtrim($assoc_subjects, ", ");
         $assoc_subjects = "<br /><span class=\"smaller\">{$assoc_subjects}</span>";
     } else {
         $assoc_subjects = "";
     }
     return $assoc_subjects;
 }
Ejemplo n.º 7
0
//print_r($_POST);
switch ($_POST["type"]) {
    case "location":
        $record = new Record();
        $record->buildLocation();
        break;
    case "add_subject":
        $subject_name = Truncate($_POST["our_sub_text"], 25, '');
        $source_name = Truncate($_POST["our_source_text"], 15, '');
        echo "<div class=\"selected_item_wrapper\"><div class=\"selected_item\" id=\"root-" . $_POST["our_source_id"] . "\"><input type=\"hidden\" name=\"rank[]\" value=\"0\" /><input type=\"hidden\" name=\"subject[]\" value=\"" . $_POST["our_sub_id"] . "\" /><input type=\"hidden\" id=\"hidden_source-" . $_POST["our_sub_id"] . "-" . $_POST["our_source_id"] . "\" name=\"source[]\" value=\"" . $_POST["our_source_id"] . "\" />" . $subject_name . "<span class=\"small_extra\"> " . $source_name . " </span><br />\n        <textarea class=\"desc_override desc-area\" name=\"description_override[]\" rows=\"4\" cols=\"35\"></textarea></div>\n        <div class=\"selected_item_options\"><i class=\"fa fa-lg fa-trash delete_sub clickable\" alt=\"" . _("remove subject") . "\" title=\"" . _("remove subject") . "\"></i>\n        <i class=\"fa fa-book fa-lg\"></i>\n        <i class=\"fa fa-lg fa-file-text-o source_override clickable\" id=\"source_override-" . $_POST["our_sub_id"] . "-" . $_POST["our_source_id"] . "\"></i> </div></div>";
        break;
    case "source_override":
        // load list of sources
        $querierSource = new Querier();
        $qSource = "select source_id, source from source order by source";
        $defsourceArray = $querierSource->query($qSource);
        $sourceMe = new Dropdown("source_override[]", $defsourceArray, $_POST["our_source_id"]);
        $source_string = $sourceMe->display();
        echo "<span class=\"record-source-override\">" . _("Source Override") . "<br />{$source_string} <img src=\"{$IconPath}/list-add.png\" class=\"add_source\" id=\"add_source_id-" . $_POST["our_subject_id"] . "-" . $_POST["our_source_id"] . "\" alt=\"" . _("add source override") . "\" title=\"" . _("add source override") . "\" border=\"0\">\n        <i class=\"fa fa-times clickable cancel_add_source\" id=\"cancel_add_source_id-" . $_POST["our_subject_id"] . "-" . $_POST["our_source_id"] . "\" alt=\"" . _("never mind") . "\" title=\"" . _("never mind") . "\" border=\"0\"></i></span>";
        break;
    case "new_record_label":
        switch ($_POST["format_type_id"]) {
            case 1:
                $label_text = _("Location (Enter URL)");
                break;
            case 2:
                $label_text = _("Location (Enter Call Number)");
                break;
            case 3:
                $label_text = _("Location (Enter Persistent Catalog URL--include http://)");
                break;
Ejemplo n.º 8
0
 public function getRelatedTitles()
 {
     $db = new Querier();
     //get title ids in pluslets' resource token connected to guide
     $q = "SELECT p.body\n            FROM subject AS s\n            INNER JOIN tab AS tb ON s.subject_id = tb.subject_id\n            LEFT JOIN section AS sc ON tb.tab_id = sc.tab_id\n            LEFT JOIN pluslet_section AS ps ON sc.section_id = ps.section_id\n            LEFT JOIN pluslet AS p ON ps.pluslet_id = p.pluslet_id\n            WHERE p.body LIKE  '%{{dab}%'\n            AND s.subject_id = {$this->_subject_id}";
     $lobjResults = $db->query($q);
     $lobjMatches = array();
     $lobjTitleIds = array();
     foreach ($lobjResults as $lobjResult) {
         preg_match_all('/\\{\\{dab\\},\\{([^}]*)\\}/', $lobjResult['body'], $lobjMatches);
         $lobjTitleIds = array_merge($lobjTitleIds, $lobjMatches[1]);
     }
     return $lobjTitleIds;
 }
Ejemplo n.º 9
0
try {
} catch (Exception $e) {
    echo $e;
}
if (isset($_GET["limit"])) {
    if ($_GET["limit"] == "all") {
        $limit = "";
    } else {
        $limit = "LIMIT 0," . scrubData($_GET["limit"], "int");
    }
} else {
    $limit = "LIMIT 0,10";
}
$querierFAQ = new Querier();
$qFAQ = "SELECT faq_id, question, answer, keywords\n\tFROM faq\n\tORDER BY faq_id DESC\n\t{$limit}";
$faqArray = $querierFAQ->query($qFAQ);
$row_count1 = 0;
$row_count2 = 0;
$colour1 = "evenrow";
$colour2 = "oddrow";
$faq_list = "";
if ($faqArray) {
    foreach ($faqArray as $value) {
        $row_colour1 = $row_count1 % 2 ? $colour1 : $colour2;
        $short_question = Truncate($value["question"], 200);
        $short_answer = stripslashes(htmlspecialchars_decode(TruncByWord($value["answer"], 15)));
        $last_revised_line = lastModded("faq", $value[0]);
        // Answered FAQs
        $faq_list .= "\n            <div class=\"striper faq_wrapper {$row_colour1}\">\n                <div class=\"faq_tools\">\n                <a href=\"faq.php?faq_id={$value['0']}&amp;wintype=pop\" class=\"showmedium-reloader\"><img src=\"{$IconPath}/pencil.png\" alt=\"edit\" width=\"16\" height=\"16\" /></a>\n                &nbsp; &nbsp;<a href=\"" . $FAQPath . "?faq_id={$value['0']}\" target=\"_blank\"><img src=\"{$IconPath}/eye.png\" alt=\"edit\" width=\"16\" height=\"16\" /></a>\n                </div>\n                <div class=\"faq_question\">\n                 {$short_question} <span class=\"faq-short-question\">({$last_revised_line})</span>\n                </div>\n            </div>";
        $row_count1++;
    }
Ejemplo n.º 10
0
    include "../includes/footer.php";
    exit;
}
$querier = new Querier();
$q1 = 'SELECT staff_id, CONCAT( fname, " ", lname ) AS fullname, email, CONCAT( emergency_contact_name, " (", emergency_contact_relation, ")", ": ", emergency_contact_phone ) AS contact, CONCAT( street_address, "<br />", city, " ", state, " ", zip ) AS full_address, home_phone, cell_phone, lat_long
FROM staff
WHERE lat_long != ""
AND active = 1';
if (isset($_GET["fac_only"]) && $_GET["fac_only"] == 1) {
    $q1 = 'SELECT staff_id, CONCAT( fname, " ", lname ) AS fullname, email, CONCAT( emergency_contact_name, " (", emergency_contact_relation, ")", ": ", emergency_contact_phone ) AS contact, CONCAT( street_address, "<br />", city, " ", state, " ", zip ) AS full_address, home_phone, cell_phone, lat_long
FROM staff
WHERE lat_long != ""
AND ptags LIKE "%librarian%"';
}
$db = new Querier();
$staffArray = $db->query($q1);
?>
<div id="map" style="width: 100%; height: 800px; border: 1px solid #333;"></div>

<?php 
include "../includes/footer.php";
?>

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
  
  google.maps.event.addDomListener(window, 'load', function() {
    var requested = "";
    
    /////////////////////
    // This map has Coral Gables as its center
Ejemplo n.º 11
0
    } else {
        $feedback = "There is no record by that ID.";
    }
}
if (isset($_POST["submit_record"])) {
    // 1.  Make sure we have minimum non-dupe data
    // 1a. Make sure there is a title, location, and subject
    if ($_POST["title"] == "" || $_POST["location"][0] == "" || $_POST["subject"][0] == "") {
        echo "<div class=\"feedback\">" . _("You must have a title, location, and subject.  Please go back and fix these omissions.  And turn on JavaScript, for goodness sakes!") . "</div><br /><br />";
        exit;
    }
    // 1b. IF THIS IS AN INSERT make sure the title isn't an exact dupe
    if ($_POST["title_id"] == "") {
        $db = new Querier();
        $qDupe = "SELECT title_id, title FROM title WHERE title LIKE " . $db->quote($_POST["title"]);
        $dupetitleArray = $db->query($qDupe);
        if ($dupetitleArray) {
            echo _("There is already a record with this title: ") . "<a href=\"record.php?record_id=" . $dupetitleArray[0] . "\">" . $dupetitleArray[1] . "</a>.  " . _("Maybe do a search and make sure it doesn't already exist?");
            return FALSE;
        }
    }
    // Submit form
    $record = new Record($_POST["title_id"], "post");
    //////////////////////////////////
    // Is this an Insert or an update?
    //////////////////////////////////
    if ($_POST["title_id"] == "") {
        $record->insertRecord();
        $ok_record_id = $record->getRecordId();
    } else {
        $record->updateRecord();
Ejemplo n.º 12
0
    }
    return $row_count;
}
// Connect to database
try {
} catch (Exception $e) {
    echo $e;
}
//querier initialize
$db = new Querier();
//if browsing by subject
if (isset($_GET["browse"]) && $_GET["browse"] == "subject") {
    print "<br /><h2>" . _("<strong>Tick</strong> the boxes of any FAQs you want to include in your pluslet and hit <strong>OK</strong>.") . "</h2>";
    //sql for all subjects
    $q = "SELECT * FROM faq f, faq_subject fs, subject s WHERE f.faq_id = fs.faq_id AND s.subject_id = fs.subject_id GROUP BY subject";
    $r = $db->query($q);
    //go through all subjects and get the related faqs
    foreach ($r as $myrow) {
        $sub_id = $myrow["subject_id"];
        $subject = $myrow["subject"];
        print "<br /><p><strong style=\"font-size: large;\">{$subject}</strong></p><br />";
        //sql for faqs
        $q2 = "SELECT f.faq_id, f.question FROM faq_subject fs, faq f WHERE  f.faq_id = fs.faq_id AND fs.subject_id = '{$sub_id}' ORDER BY f.question";
        $r2 = $db->query($q2);
        //go through all results to print out checkboxes
        $rc = innerLoop($sub_id, $r2, 1);
        if ($rc == 0) {
            print "<p>" . _("There are no results.  You'll need to try something different.") . "</p>";
        }
    }
} elseif (isset($_GET["browse"]) && $_GET["browse"] == "collection") {
Ejemplo n.º 13
0
$subsubcat = "";
$subcat = "videos";
$page_title = "Video Bits include";
$header = "noshow";
use SubjectsPlus\Control\Querier;
include "../includes/header.php";
// Connect to database
//print_r($_POST);
switch ($_REQUEST["type"]) {
    case "ingest":
        $db = new Querier();
        // check if we already have a record like this
        $our_id = scrubData($_REQUEST["foreign_id"]);
        $qcheck = "SELECT video_id FROM video WHERE foreign_id = '" . $our_id . "'";
        //print $qcheck;
        $rcheck = $db->query($qcheck);
        if (count($rcheck) == 0) {
            $qinsert = "INSERT INTO video (title, description, source, foreign_id, duration, date, display)\n        values(\"" . $_POST["title"] . "\", \"" . $_POST["description"] . "\", \"" . $_POST["source"] . "\", \"" . $_POST["foreign_id"] . "\", \"" . $_POST["duration"] . "\", \"" . $_POST["upload_date"] . "\",\n          1                \n        )";
            //   print_r ($qinsert);
            $rinsert = $db->exec($qinsert);
            $video_id = $db->last_id();
        } else {
            // Do an update
            $db = new Querier();
            $qupdate = "UPDATE video \n          SET title = " . $db->quote(scrubData($_POST['title'])) . ",\n          description = " . $db->quote(scrubData($_POST['description'], 'richtext')) . ",\n          source = " . $db->quote(scrubData($_POST['source'])) . " ,\n          foreign_id = " . $db->quote(scrubData($_POST['foreign_id'])) . ",\n          duration = " . $db->quote(scrubData($_POST['duration'])) . " ,\n          date = " . $db->quote(scrubData($_POST['upload_date'])) . " ,\n          WHERE foreign_id = " . $our_id;
            //print_r ($qupdate);
            $rupdate = $db->exec($qupdate);
            $video_id = $rupdate[0];
        }
        // insert/update image
        // get small thumbnail
Ejemplo n.º 14
0
 function writeTable($qualifier, $subject_id = '', $description_search = 0)
 {
     global $IconPath;
     global $proxyURL;
     $db = new Querier();
     // sanitize submission
     $subject_id = scrubData($subject_id);
     // Prepare conditions
     $condition1 = "";
     $condition2 = "";
     $condition3 = "";
     switch ($qualifier) {
         case "Num":
             $condition1 = "WHERE left(title, 1)  REGEXP '[[:digit:]]+'";
             $condition2 = "WHERE left(alternate_title, 1)  REGEXP '[[:digit:]]+'";
             break;
         case "All":
             $condition1 = "WHERE title != ''";
             $condition2 = "WHERE alternate_title != ''";
             break;
         case "bysub":
             if (isset($subject_id)) {
                 //get title ids in pluslets' resource token connected to subject
                 $lobjGuide = new Guide($subject_id);
                 $lobjTitleIds = $lobjGuide->getRelatedTitles();
                 $condition1 = "WHERE (subject_id = {$subject_id}";
                 $condition1 .= count($lobjTitleIds) > 0 ? "\nOR t.title_id IN (" . implode(',', $lobjTitleIds) . ")" : "";
                 $condition1 .= ")";
                 $condition2 = "WHERE subject_id = {$subject_id}";
             } else {
                 $condition1 = "WHERE title LIKE " . $db->quote("%" . $qualifier . "%");
                 $condition2 = "WHERE alternate_title LIKE " . $db->quote("%" . $qualifier . "%");
             }
             break;
         case "bytype":
             if (isset($_GET["type"])) {
                 $condition1 = "WHERE ctags LIKE " . $db->quote(scrubData($_GET["type"]));
                 $condition2 = "WHERE ctags LIKE " . $db->quote(scrubData($_GET["type"]));
                 $condition3 = "and alternate_title NOT NULL";
             }
             break;
         case "search":
             $condition1 = "WHERE title LIKE " . $db->quote("%" . $qualifier . "%");
             // If you uncomment the next line, it will search description field
             $condition1 = "WHERE (title LIKE " . $db->quote("%" . $qualifier . "%") . " OR description LIKE " . $db->quote("%" . $qualifier . "%");
             $condition2 = "WHERE alternate_title LIKE " . $db->quote("%" + $qualifier + "%");
             break;
         default:
             // This is the simple output by letter and also the search
             if (strlen($qualifier) == 1) {
                 // Is like the first letter
                 $condition1 = "WHERE title LIKE " . $db->quote($qualifier . "%");
             } else {
                 $condition1 = "WHERE title LIKE " . $db->quote("%" . $qualifier . "%");
             }
             if ($description_search == 1) {
                 // If you uncomment the next line, it will search description field
                 $condition1 = "WHERE (title LIKE " . $db->quote("%" . $qualifier . "%") . " OR description LIKE " . $db->quote("%" . $qualifier . "%") . ")";
             }
             $condition2 = "WHERE alternate_title LIKE " . $db->quote("%" + $qualifier + "%");
     }
     $q1 = "SELECT distinct left(t.title,1) as initial, t.title as newtitle, t.description, location, access_restrictions, t.title_id as this_record,eres_display, display_note, pre, citation_guide, ctags, helpguide\n            FROM title as t\n            INNER JOIN location_title as lt\n            ON t.title_id = lt.title_id\n            INNER JOIN location as l\n            ON lt.location_id = l.location_id\n            INNER JOIN restrictions as r\n            ON l.access_restrictions = r.restrictions_id\n            INNER JOIN rank as rk\n            ON rk.title_id = t.title_id\n            INNER JOIN source as s\n            ON rk.source_id = s.source_id\n            {$condition1}\n            AND eres_display = 'Y'\n            ORDER BY newtitle";
     $q2 = "SELECT distinct left(t.alternate_title,1) as initial, t.alternate_title as newtitle, t.description, location, access_restrictions, t.title_id as this_record,eres_display, display_note, pre, citation_guide, ctags, helpguide\n            FROM title as t\n            INNER JOIN location_title as lt\n            ON t.title_id = lt.title_id\n            INNER JOIN location as l\n            ON lt.location_id = l.location_id\n            INNER JOIN restrictions as r\n            ON l.access_restrictions = r.restrictions_id\n            INNER JOIN rank as rk\n            ON rk.title_id = t.title_id\n            INNER JOIN source as s\n            ON rk.source_id = s.source_id\n            {$condition2}\n\t\t        AND eres_display = 'Y'\n            {$condition3}\n\n\t\t        ORDER BY newtitle";
     $r = $db->query($q1);
     $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[1];
         if ($myrow["pre"] != "") {
             $item_title = $myrow["pre"] . " " . $item_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";
         } elseif ($myrow['4'] == 4) {
             $url = $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 for Help Guide ///
         if ($myrow["helpguide"] != "") {
             $helpguide = " <a href=\"" . $myrow["helpguide"] . "\"><img src=\"{$IconPath}/help.gif\" border=\"0\" alt=\"" . _("Help Guide") . "\" title=\"" . _("Help Guide") . "\" /></a>";
         } else {
             $helpguide = "";
         }
         //Check if there is a display note
         if ($myrow["display_note"] == NULL) {
             $display_note_text = "";
         } else {
             $display_note_text = "<br /><strong>" . _("Note:") . " </strong>" . $myrow['display_note'];
         }
         $bonus = "{$blurb}<br />";
         if ($blurb != "") {
             $information1 = "<span id=\"bib-{$bib_id}\" class=\"toggleLink curse_me\"><img src=\"{$IconPath}/information.png\" border=\"0\" alt=\"" . _("more information") . "\" title=\"" . _("more information") . "\" /></span>";
             // This is new details link; you can use the one above if you prefer
             $information = "<span id=\"bib-{$bib_id}\" class=\"toggleLink curse_me\">" . _("about") . "</span>";
         } else {
             $information = "";
         }
         $target = targetBlanker();
         $items .= self::generateLayout($row_colour, $url, $target, $item_title, $information, $information1, $icons, $helpguide, $display_note_text, $bonus);
         $row_count++;
     }
     $items .= "</table>";
     return $items;
 }
Ejemplo n.º 15
0
<?php

use SubjectsPlus\Control\Querier;
//include subjectsplus config and functions files
include_once '../../../../control/includes/config.php';
include_once '../../../../control/includes/functions.php';
include_once '../../../../control/includes/autoloader.php';
global $AssetPath;
try {
} catch (Exception $e) {
    echo $e;
}
$querier = new Querier();
if (isset($_COOKIE["our_guide"]) && isset($_COOKIE["our_guide_id"])) {
    $qs = "SELECT lname, fname, email, tel, title, s.staff_id from staff s, staff_subject ss WHERE s.staff_id = ss.staff_id and ss.subject_id = " . $_COOKIE["our_guide_id"] . " ORDER BY lname, fname";
    $sugStaffArray = $querier->query($qs);
}
$lobjStaffIds = array();
foreach ($sugStaffArray as $lobjStaff) {
    $lobjStaffIds[] = $lobjStaff[5];
}
$qs = "SELECT lname, fname, email, tel, title from staff s WHERE s.staff_id NOT IN ('" . implode('\',\'', $lobjStaffIds) . "')  ORDER BY lname, fname";
$staffArray = $querier->query($qs);
if (count($sugStaffArray) > 0) {
    $lstrHTML = "<table>";
    $lstrHTML .= "<strong>" . _("Specialists") . "</strong>";
}
foreach ($sugStaffArray as $value) {
    // get username from email
    $truncated_email = explode("@", $value[2]);
    $staff_picture = $AssetPath . "users/_" . $truncated_email[0] . "/headshot.jpg";
Ejemplo n.º 16
0
        $qUpDept = "UPDATE department SET\n        name = " . $db->quote(scrubData($value[0])) . ",\n        telephone = " . $db->quote(scrubData($value[1])) . ",\n        department_sort = " . $row_count . ",\n        email = " . $db->quote(scrubData($value[2])) . ",\n        url = " . $db->quote(scrubData($value[3])) . "\n        WHERE department_id = " . scrubData($key, "integer");
        $rUpDept = $db->exec($qUpDept);
        $row_count++;
    }
    $feedback = _("Thy Will Be Done.  Department list order updated.");
    // Show feedback
    //$feedback = $record->getMessage();
    // See all the queries?
    //$record->deBug();
}
///////////////
// Departments
///////////////
$querierDept = new Querier();
$qDept = "select department_id, name, telephone, department_sort, email, url from department order by department_sort";
$deptArray = $querierDept->query($qDept);
$ourlist = "";
foreach ($deptArray as $value) {
    $ourlist .= "<li id=\"item-{$value['0']}\" class=\"sortable_item department-sortable\"><a id=\"delete-{$value['0']}\"><img src=\"{$IconPath}/delete.png\" class=\"pointer\" /></a>\n  &nbsp; <input type=\"text\" size=\"40\" name=\"dept[]\" value=\"{$value['1']}\" /> \n  &nbsp; <input type=\"text\" size=\"10\" name=\"tel[]\" value=\"{$value['2']}\" /> \n  &nbsp; <input type=\"text\" size=\"20\" name=\"email[]\" value=\"{$value['4']}\" />\n  &nbsp; <input type=\"text\" size=\"20\" name=\"url[]\" value=\"{$value['5']}\" />\n  <input type=\"hidden\" name=\"dept_id[]\" value=\"{$value['0']}\" /></li>";
}
$dept_box = "\n<p>" . _("Enter department name, telephone number, email, website url.  Drag departments to change display order.") . "</p>\n<button id=\"save_guide\" class=\"button pure-button pure-button-primary\" style=\"display: block;\" name=\"update_departments\" >" . _("SAVE CHANGES") . "</button>\n<form id=\"departments\" action=\"\" method=\"post\">\n\n<ul id=\"sortable-\" class=\"sortable_list\">\n{$ourlist}\n</ul>\n</form>";
$add_dept_box = "<form id=\"new_department\" action=\"\" class=\"pure-form pure-form-stacked\" method=\"post\">\n<label for=\"department\">" . _("Department Name") . "</label>\n<input type=\"text\" name=\"department\" id=\"\" size=\"40\" value=\"\">\n\n<label for=\"telephone\">" . _("Telephone") . "</label>\n<input type=\"text\" name=\"telephone\" id=\"\" size=\"10\" value=\"\">\n\n<label for=\"email\">" . _("Email") . "</label>\n<input type=\"text\" name=\"email\" id=\"\" size=\"20\" value=\"\">\n\n<label for=\"url\">" . _("Website") . "</label>\n<input type=\"text\" name=\"url\" id=\"\" size=\"40\" value=\"\">\n<p></p>\n<button class=\"button pure-button pure-button-primary\" id=\"add_dept\" name=\"add_department\" >" . _("Add New Department") . "</button>\n</form>";
$view_depts_box = "<ul>\n<li><a href=\"{$PublicPath}" . "/staff.php?letter=By Department\" target=\"_blank\">" . _("Staff by Department") . "</a></li>\n</ul>";
print feedBack($feedback);
print "<div class=\"sort_feedback\"></div>";
print "\n\n<form id=\"departments\" action=\"\" method=\"post\">\n\n<div class=\"pure-g\">\n  <div class=\"pure-u-2-3\">\n";
makePluslet(_("Departments"), $dept_box, "no_overflow");
print "</div>\n<div class=\"pure-u-1-3\">";
makePluslet(_("Add Department"), $add_dept_box, "no_overflow");
makePluslet(_("View Live!"), $view_depts_box, "no_overflow");
print "</div>";
Ejemplo n.º 17
0
 
             //print $findGuidesQuery;
             $findGuidesResult = $querier->query($findGuidesQuery);
             $guides = array(); // for the list of guides in which the file appears
 
             if ($findGuidesResult) {
                 foreach ($findGuidesResult as $row) {
                     $guideName = $row['subject'];
                     $guideId = $row['subject_id'];
                     $guides["$guideId"] = $guideName;
                 }
             }
 */
 $db = new Querier();
 $findGuidesQuery = "\n\t\t\t\tSELECT st.fname, st.lname, s.subject, s.subject_id\n\t\t\t\tFROM pluslet p INNER JOIN pluslet_section ps\n\t\t\t\tON p.pluslet_id = ps.pluslet_id\n\t\t\t\tINNER JOIN section sec\n\t\t\t\tON ps.section_id = sec.section_id\n\t\t\t\tINNER JOIN tab t\n\t\t\t\tON sec.tab_id = t.tab_id\n\t\t\t\tINNER JOIN subject s\n\t\t\t\tON t.subject_id = s.subject_id\n\t\t\t\tINNER JOIN staff_subject ss\n\t\t\t\tON s.subject_id = ss.subject_id\n\t\t\t\tINNER JOIN staff st\n\t\t\t\tON ss.staff_id = st.staff_id\n\t\t\t\tWHERE p.body LIKE " . $db->quote('%' . $location_hint . "/" . $shortName . '%') . "\n                OR p.body LIKE " . $db->quote('%' . $location_hint . trim(" \\ ") . $shortName . '%') . "\n                OR p.body LIKE " . $db->quote('%' . $location_hint . trim(" \\ ") . "image" . trim(" \\ ") . $shortName . '%') . "\n                OR p.body LIKE " . $db->quote('%' . $location_hint . "/image/" . $shortName . '%');
 $findGuidesResult = $querier->query($findGuidesQuery);
 $guides = array();
 // for the list of guides in which the file appears
 if ($findGuidesResult) {
     foreach ($findGuidesResult as $row) {
         $owner = $row['fname'] . " " . $row['lname'];
         $guideName = $row['subject'];
         $guideId = $row['subject_id'];
         $guides["{$guideId}"] = $guideName;
     }
 } else {
     $owner = '';
 }
 if (empty($guides)) {
     // the file is an orphan--flag it!
     $tr = "<tr class=\"zebra oddrow\" id=\"item-{$rowcount}\">";
Ejemplo n.º 18
0
    default:
        //depending on permissions user has, set credential as true or false
        $check_credentials = isset($_SESSION["view_map"]) && $_SESSION["view_map"] == 1 ? TRUE : FALSE;
        $and = "AND user_type_id = '1' ";
}
// Boot them out if they shouldn't be viewing this file
if ($check_credentials == FALSE) {
    echo "<p style=\"background-color: red; color: white;\">You probably should not be here.  Please use the back button.  If you think you should be able to access this part of the site, please contact an administrator";
    include "../includes/footer.php";
    exit;
}
$header = "";
$data = "";
$select = "SELECT lname AS 'Last Name', fname AS 'First Name', tel AS 'Work Phone #', cell_phone AS 'Cell Phone #', home_phone as 'Home Phone',  staff.email AS 'Email',\nemergency_contact_name AS 'Contact Name', emergency_contact_phone AS 'Contact Phone #', emergency_contact_relation AS 'Relationship', name AS 'Department',\n  street_address AS 'Street Address', city as 'City', state AS 'State', zip as 'Zip Code', supervisor_id AS Super_ID, (SELECT lname from staff where staff.staff_id = Super_ID) AS 'Supervisor LName', (SELECT \n  fname from staff where staff.staff_id = Super_ID) AS 'Supervisor FName'\n  FROM staff, department\n  WHERE active = '1'\n  AND staff.department_id = department.department_id\n  {$and}\n  ORDER BY lname";
$db = new Querier();
$export = $db->query($select);
$fields = count($export);
// yes, i cheated.  couldn't figure out how to get this with pdo from $select query
$header_fields = array("Last Name", "First Name", "Work Phone #", "Cell Phone #", "Home Phone", "Contact Name", "Contact Phone #", "Relationship", "Department", "Street Address", "City", "State", "Zip", "Super_ID", "Supervisor Lname", "Supervisor Fname");
foreach ($header_fields as $key => $value) {
    $header .= $value . "\t";
}
foreach ($export as $row) {
    $line = '';
    foreach ($row as $value) {
        if (!isset($value) || $value == "") {
            $value = "\t";
        } else {
            $value = str_replace('"', '""', $value);
            $value = '"' . $value . '"' . "\t";
        }
Ejemplo n.º 19
0
function checkReports($staff_id, $super_chain = "", $recursion = 0)
{
    global $all_supers;
    $indent = "";
    $data = "";
    $q = "SELECT staff_id, CONCAT( fname, ' ', lname ) AS fullname, email, CONCAT( street_address, ' ', city, ' ', state, ' ', zip) as full_address\n  , home_phone, cell_phone,\n  emergency_contact_name, emergency_contact_relation,emergency_contact_phone, supervisor_id, lname, fname\n  FROM staff\n  WHERE supervisor_id = '" . $staff_id . "'\n  AND active = 1\n  ORDER BY lname, fname";
    //print $q . "<br /><br />";
    $db = new Querier();
    $r = $db->query($q);
    if (!$r) {
        return $data;
    }
    $row_count = count($r);
    foreach ($r as $myrow) {
        if ($recursion == 1) {
            $q2 = "select lname, staff_id from staff where staff_id = " . $myrow[9] . " ORDER BY lname, fname";
            $supername = $db->query($q2);
            $superbits = explode("-", $super_chain);
            if (!in_array($supername[1], $superbits)) {
                $super_chain = $super_chain . "-" . $supername[1];
                array_push($all_supers, $supername[1]);
            }
            $superbits = explode("-", $super_chain);
            //  need to reset this after the alteration
            $num_supervisors = count($superbits);
            //$row_colour = ($row_count % 2) ? $colour1 : $colour2;
            if ($num_supervisors > 2) {
                $indent = "margin-left:" . 1 * ($num_supervisors * 1) . "em";
            } else {
                $indent = "font-weight: bold;";
            }
        }
        //$data .= makeExcelData($myrow);
        //$data = str_replace( "\r" , "" , $data );
        $data .= makeTR($myrow, $indent);
        if ($recursion == 1) {
            $data .= checkReports($myrow[0], $super_chain, 1);
        }
    }
    //print "<pre>";
    // print_r($typeArray);
    //return $typeArray;
    return $data;
}
Ejemplo n.º 20
0
use SubjectsPlus\Control\LinkChecker;
use SubjectsPlus\Control\Querier;
$subcat = "records";
$subsubcat = "index.php";
$page_title = "Browse Items";
// init some vars
$atoz = "";
$letter = "";
$ctag = "";
$full_query = "";
include "../includes/header.php";
$db = new Querier();
// Where to start?
// Choose initial letter to display
$alpha_query = "SELECT  distinct left(title,1) as 'initial' FROM  title, restrictions, location, location_title, source where title.title_id = location_title.title_id and location.location_id = location_title.location_id and restrictions_id = access_restrictions ORDER BY initial";
$alpha_result = $db->query($alpha_query);
$count = 0;
$firstletter = "A";
foreach ($alpha_result as $myletter) {
    if ($count == 0) {
        $firstletter = $myletter[0][0];
    }
    $atoz .= "<a href=\"" . "index.php?letter=" . $myletter[0][0] . "\">" . $myletter[0][0] . "</a> &nbsp;";
    $count++;
}
$atoz .= "<a href=\"index.php?letter=all\">[all]</a>";
// end A-Z header for now
$results = "<p>" . _("Please select a letter or tag to browse.") . "</p>";
if (isset($_GET["ctag"])) {
    $alpha_id = $_GET["ctag"];
    $full_query = "select distinct title, description, location, restrictions_id, title.title_id as 'this_record', eres_display, ctags  from title, restrictions, location, location_title, source where title.title_id = location_title.title_id and location.location_id = location_title.location_id and restrictions_id = access_restrictions  and ctags like '%{$alpha_id}%' order by title.title";
Ejemplo n.º 21
0
try {
} catch (Exception $e) {
    echo $e;
}
if (isset($_GET["limit"])) {
    if ($_GET["limit"] == "all") {
        $limit = "";
    } else {
        $limit = "LIMIT 0," . scrubData($_GET["limit"], "int");
    }
} else {
    $limit = "";
}
$querierVid = new Querier();
$qVid = "SELECT video_id, title, description, source, foreign_id, duration, date, display, vtags\n\tFROM video\n\tORDER BY video_id DESC\n\t{$limit}";
$vidArray = $querierVid->query($qVid);
$row_count1 = 0;
$row_count2 = 0;
$colour1 = "evenrow";
$colour2 = "oddrow";
$vid_list = "";
if ($vidArray) {
    foreach ($vidArray as $value) {
        $row_colour1 = $row_count1 % 2 ? $colour1 : $colour2;
        $short_title = Truncate($value["title"], 200);
        $short_desc = stripslashes(htmlspecialchars_decode(TruncByWord($value["description"], 15)));
        $last_revised_line = lastModded("video", $value[0]);
        if ($value[7] != "1") {
            $activity = " <span style=\"color: #666;\">* " . _("unpublished") . "</span>";
        } else {
            $activity = "";
Ejemplo n.º 22
0
        $output = json_decode($address);
        //print $output->results[0]->geometry->location->lat;
        $lat = $output->results[0]->geometry->location->lat;
        $long = $output->results[0]->geometry->location->lng;
        $coords = $lat . "," . $long;
        print $coords;
        //print $address;
        return;
        // return early so we don't show the stuff that follows
        break;
}
// End Action loop
// Now generate results, $extra_q set in action loop above
$q = "SELECT s.subject_id, subject, fname, lname, st.staff_id, type, shortform, s.active\nFROM subject s\nLEFT JOIN staff_subject ss ON s.subject_id = ss.subject_id\nLEFT JOIN staff st ON ss.staff_id = st.staff_id\n{$extra_q}\nORDER BY subject";
$querier = new Querier();
$subsArray = $querier->query($q);
if (!empty($subsArray)) {
    // set up striping
    $row_count = 0;
    $colour1 = "oddrow";
    $colour2 = "evenrow";
    $staff_list = "";
    foreach ($subsArray as $value) {
        if ($value[7] != "1") {
            $active = " <span style=\"font-size:smaller; color: #666;\">" . _("inactive") . "</span>";
        } else {
            $active = "";
        }
        $row_colour = $row_count % 2 ? $colour1 : $colour2;
        $staff_list .= "<div class=\"{$row_colour} striper\" style=\"clear: both; float: left; min-width: 500px;\"><input type=\"checkbox\" name=\"guide-{$value['0']}\" value=\"{$value['0']}\"><a class=\"showmedium-reloader\" href=\"../guides/metadata.php?subject_id={$value['0']}&wintype=pop\"><img src=\"{$IconPath}/emblem-system.png\" alt=\"" . _("delete") . "\" border=\"0\"></a> &nbsp;&nbsp;\n        <a target=\"_blank\" href=\"../../subjects/guide.php?subject={$value['0']}\"><img src=\"{$IconPath}/eye.png\" alt=\"" . _("see live") . "\" border=\"0\"></a> &nbsp;&nbsp;\n        <a href=\"../guides/guide.php?subject_id={$value['0']}\">{$value['1']}</a> {$active}</div> <div class=\"{$row_colour} striper\" style=\"float: left; min-width: 100px; font-size: smaller;\">{$value['2']} {$value['3']}</div>  <div class=\"{$row_colour} striper\" style=\"float: left; min-width: 75px;font-size: smaller;\">{$value['5']}</div>";
        $row_count++;
Ejemplo n.º 23
0
if (!isset($_GET["subject_id"])) {
    $_GET["subject_id"] = "";
    $clean_id = "";
} else {
    $clean_id = scrubData($_GET["subject_id"], "integer");
}
if ($_GET["letter"] == "bysub") {
    $page_title = _("Database List By Subject");
    if ($clean_id == "") {
        $_GET["subject_id"] = "";
        $show_subjects = TRUE;
    } else {
        $show_subjects = FALSE;
        // add subject name to title
        $qt = "SELECT subject FROM subject WHERE subject_id=" . $clean_id . " LIMIT 0,1";
        $myrow = $db->query($qt);
        $page_title .= ": " . $myrow[0][0];
    }
} else {
    $_GET["subject_id"] = "";
    $show_subjects = FALSE;
}
// Deal with databases by type display
if ($_GET["letter"] == "bytype") {
    $page_title = _("Database List By Format");
    if (!isset($_GET["type"])) {
        $_GET["type"] = "";
        $show_types = TRUE;
    } else {
        $clean_type = ucfirst(scrubData($_GET["type"]));
        $pretty_type = ucwords(preg_replace('/_/', ' ', $clean_type));
Ejemplo n.º 24
0
    $result = array_combine($a, $b);
    // Loop through array, update departments table
    $row_count = 1;
    foreach ($result as $key => $value) {
        $qUpDept = "UPDATE discipline SET\n\t\tdiscipline = " . $db->quote(scrubData($value)) . ", \n\t\tsort = " . $row_count . " \n\t\tWHERE discipline_id = " . scrubData($key, "integer");
        $rUpDept = $db->exec($qUpDept);
        $row_count++;
    }
    $feedback = _("Thy Will Be Done.  discipline list updated.");
}
///////////////
// disciplines
///////////////
$querierDept = new Querier();
$qdiscipline = "select discipline_id, discipline, sort from discipline order by sort, discipline";
$disciplineArray = $querierDept->query($qdiscipline);
foreach ($disciplineArray as $value) {
    $ourlist .= "<li id=\"item-{$value['0']}\" class=\"sortable_item disc-sortable\"><a id=\"delete-{$value['0']}\"><img src=\"{$IconPath}/delete.png\" class=\"pointer\" /></a> &nbsp; <input type=\"text\" size=\"40\" name=\"discipline[]\" value=\"{$value['1']}\" /> <input type=\"hidden\" name=\"discipline_id[]\" value=\"{$value['0']}\" /></li>";
}
$discipline_box = "\n<form id=\"disciplines\" action=\"\" method=\"post\">\n<button class=\"button\" id=\"save_guide\"  class=\"button pure-button pure-button-primary\" style=\"display: block;\" name=\"update_disciplines\" >" . _("SAVE CHANGES") . "</button>\n\n<p>" . _("NOTE:  Disciplines were added to facilitate Serials Solution ingest of data.  This original set was provided by SerSol in Nov 2012. \n    If you are a SerSol customer, you might not want to change these.  Sort may or may not be implemented in your version of SP.") . "</p>\n<p>" . _("Enter discipline type label.") . "</p>\n<br />\n\n<ul id=\"sortable-\" class=\"sortable_list\">\n{$ourlist}\n</ul>\n</form>\n";
$add_discipline_box = "\n<form id=\"new_discipline\" action=\"\" method=\"post\">\n<span class=\"record_label\">" . _("Source Name") . "</span><br />\n<input type=\"text\" name=\"source\" id=\"\" size=\"40\" class=\"\" value=\"\">\n<br /><br />\n<button class=\"button\" id=\"add_discipline\" name=\"add_discipline\">" . _("Add New Discipline") . "</button>\n</form>";
print feedBack($feedback);
print "\n\n<form id=\"disciplines\" action=\"\" method=\"post\">\n\n<div class=\"pure-g\">\n  <div class=\"pure-u-2-3\">\n";
makePluslet(_("Disciplines"), $discipline_box, "no_overflow");
print "</div>\n<div class=\"pure-u-1-3\">";
makePluslet(_("Add Discipline"), $add_discipline_box, "no_overflow");
print "</div>";
// close pure-u-
print "</div>";
// close pure
include "../includes/footer.php";
Ejemplo n.º 25
0
 public function search()
 {
     $db = new Querier();
     $search_param = $db->quote("%" . $this->param . "%");
     $subject_id = $db->quote($this->subject_id);
     switch ($this->collection) {
         case "home":
             $q = "SELECT subject_id AS 'id', subject AS 'matching_text',subject AS 'label', description as 'additional_text', shortform AS 'short_form', 'Subject Guide' as 'content_type', '' as 'additional_id', '' as 'parent' FROM subject\n                    WHERE description LIKE " . $search_param . "\n                    OR subject LIKE " . $search_param . "\n                    OR keywords LIKE " . $search_param . "\n                    UNION\n                    SELECT p.pluslet_id, p.title,p.title AS 'label', su.subject_id AS 'parent_id', su.shortform, 'Pluslet' AS 'content_type', t.tab_index as 'additional_id',su.subject as 'parent' FROM pluslet AS p\n                    INNER JOIN pluslet_section AS ps\n                    ON ps.pluslet_id = p.pluslet_id\n                    INNER JOIN section AS s\n                    ON ps.section_id = s.section_id\n                    INNER JOIN tab AS t\n                    ON s.tab_id = t.tab_id\n                    INNER JOIN subject AS su\n                    ON su.subject_id = t.subject_id\n                    WHERE p.body LIKE " . $search_param . "\n                    OR p.title LIKE " . $search_param . "\n\n                    UNION\n                    SELECT faq_id AS 'id', question AS 'matching_text',question AS 'label',  answer as 'additional_text','' AS 'short_form','FAQ' as 'content_type', '' as 'additional_id', '' as 'parent' FROM faq\n                    WHERE question LIKE " . $search_param . "\n                    OR answer LIKE " . $search_param . "\n                    OR keywords LIKE " . $search_param . "\n                    UNION\n                    SELECT talkback_id AS 'id', question AS 'matching_text' ,question AS 'label', answer as 'additional_text','' AS 'short_form', 'Talkback' as 'content_type', '' as 'additional_id', '' as 'parent' FROM talkback\n                    WHERE question LIKE " . $search_param . "\n                    OR answer LIKE " . $search_param . "\n                    UNION\n                    SELECT staff_id AS 'id', email AS 'matching_text' ,email AS 'label', fname as 'additional_text','' AS 'short_form', 'Staff' as 'content_type', '' as 'additional_id', '' as 'parent' FROM staff\n                    WHERE fname LIKE " . $search_param . "\n                    OR lname LIKE " . $search_param . "\n                    OR email LIKE " . $search_param . "\n                    OR tel LIKE " . $search_param . "\n                    UNION\n                    SELECT department_id AS 'id', name AS 'matching_text' , name AS 'label', telephone as 'additional_text','' AS 'short_form', 'Department' as 'content_type', '' as 'additional_id','' as 'parent' FROM department\n                    WHERE name LIKE " . $search_param . "\n                    OR telephone LIKE  " . $search_param . "\n                    UNION\n                    SELECT video_id AS 'id', title AS 'matching_text' ,title AS 'label', description as 'additional_text','' AS 'short_form', 'Video' as 'content_type', '' as 'additional_id', '' as 'parent' FROM video\n                    WHERE title LIKE " . $search_param . "\n                    OR description LIKE " . $search_param . "\n                    OR vtags LIKE " . $search_param;
             break;
         case "guides":
             $q = "SELECT subject_id as 'id', subject,'Subject Guide' as 'content_type', subject AS 'label',shortform AS 'short_form' FROM subject WHERE subject LIKE " . $search_param . "OR shortform LIKE " . $search_param . "OR description LIKE " . $search_param . "OR keywords LIKE " . $search_param . "OR type LIKE " . $search_param;
             break;
         case "guide":
             $q = "SELECT p.pluslet_id as 'id',su.shortform as 'short_form','Pluslet' as 'content_type', p.title, p.title AS 'label', ps.section_id, t.tab_index AS 'additional_id', t.subject_id, su.subject FROM pluslet AS p\n                    INNER JOIN pluslet_section AS ps\n                    ON ps.pluslet_id = p.pluslet_id\n                    INNER JOIN section AS s\n                    ON ps.section_id = s.section_id\n                    INNER JOIN tab AS t\n                    ON s.tab_id = t.tab_id\n                    INNER JOIN subject AS su\n                    ON su.subject_id = t.subject_id\n                    WHERE p.body LIKE " . $search_param . " AND t.subject_id = " . $subject_id;
             break;
         case "records":
             $q = "SELECT title_id AS 'id', 'Record' as 'content_type',title AS 'label', title FROM title WHERE title LIKE " . $search_param;
             break;
         case "faq":
             $q = "SELECT faq_id AS 'id',question AS 'label', LEFT(question, 55), 'FAQ' as 'content_type'  FROM faq WHERE question LIKE " . $search_param;
             break;
         case "talkback":
             $q = "SELECT talkback_id AS 'id',question AS 'label','Talkback' as content_type, LEFT(question, 55) FROM talkback WHERE question LIKE " . $search_param;
             break;
         case "admin":
             $q = "SELECT staff_id AS 'id',email AS 'label','Staff' as 'content_type', CONCAT(fname, ' ', lname, ' (', email, ')') as fullname FROM staff WHERE (fname LIKE " . $search_param . ") OR (lname LIKE " . $search_param . ")";
             break;
     }
     //print_r ($q);
     $result = $db->query($q);
     $arr = array();
     $i = 0;
     // This takes the results and creates an array that will be turned into JSON
     foreach ($result as $myrow) {
         //add no title label if empty
         $myrow['label'] = empty($myrow['label']) ? '[no title]' : $myrow['label'];
         $arr[$i]['label'] = $myrow['label'];
         if (isset($myrow['content_type'])) {
             $arr[$i]['id'] = $myrow['id'];
             if (isset($myrow['short_form'])) {
                 $arr[$i]['shortform'] = $myrow['short_form'];
             }
             if (isset($myrow['matching_text'])) {
                 $arr[$i]['value'] = $myrow['matching_text'];
             }
             if (isset($myrow['content_type'])) {
                 $arr[$i]['content_type'] = $myrow['content_type'];
             }
             if (isset($myrow['parent'])) {
                 $arr[$i]['parent'] = $myrow['parent'];
             }
             if (isset($myrow['additional_id'])) {
                 $arr[$i]['parent_id'] = $myrow['additional_id'];
             }
             switch ($myrow['content_type']) {
                 case "Record":
                     $arr[$i]['label'] = $myrow['label'];
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = 'record.php?record_id=' . $myrow['id'];
                     } else {
                         $db = new Querier();
                         $record_url_sql = "SELECT location, title\n\t\t\t\tFROM location l, title t, location_title lt \n\t\t\t\tWHERE  t.title_id = lt.title_id\n\t\t\t\tAND l.location_id = lt.location_id AND t.title_id = " . $db->quote($myrow['id']) . " ";
                         $record_url_result = $db->query($record_url_sql);
                         if (isset($record_url_result[0]['location'])) {
                             $arr[$i]['url'] = $record_url_result[0]['location'];
                         } else {
                             $arr[$i]['url'] = '';
                         }
                     }
                     break;
                 case "Subject Guide":
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = getControlURL() . 'guides/guide.php?subject_id=' . $myrow['id'];
                     } else {
                         $arr[$i]['url'] = 'guide.php?subject=' . $myrow['short_form'];
                     }
                     break;
                 case "FAQ":
                     $arr[$i]['label'] = $myrow['label'];
                     $arr[$i]['url'] = 'faq.php?faq_id=' . $myrow['id'];
                     break;
                 case "Pluslet":
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = getControlURL() . 'guides/guide.php?subject_id=' . $myrow['short_form'] . '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['hash'] = '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['label'] = $myrow['label'];
                     } else {
                         $arr[$i]['url'] = 'guide.php?subject=' . $myrow['short_form'] . '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['hash'] = '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['tab_index'] = $myrow['additional_id'];
                     }
                     break;
                 case "Talkback":
                     $arr[$i]['label'] = $myrow['label'];
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = 'talkback.php?talkback_id=' . $myrow['id'];
                     } else {
                         $arr[$i]['url'] = 'talkback.php';
                     }
                     break;
                 case "Staff":
                     $arr[$i]['label'] = $myrow['fullname'];
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = 'user.php?staff_id=' . $myrow['id'];
                     } else {
                         $name = explode('@', $myrow['label']);
                         $arr[$i]['url'] = 'staff_details.php?name=' . $name[0];
                     }
                     break;
             }
         } else {
             $arr[$i]['value'] = $myrow[0];
         }
         $i++;
     }
     $response = json_encode($arr);
     return $response;
 }
Ejemplo n.º 26
0
$tickboxes = "<ul>";
foreach ($guide_types as $key) {
    // $tickboxes .= "<li><input type=\"checkbox\" id=\"show-" . ucfirst($key) . "\" name=\"show$key\"";  Fixed the checkboxes issue 03/21/16
    // if ($view_type == "all" || $view_type == $key) {
    //    $tickboxes .= " checked=\"checked\"";
    // }
    //$tickboxes .= "/>" . ucfirst($key) . " Guides</li></li>\n";
}
$tickboxes .= "</ul>";
// Get the subjects for jquery autocomplete
$suggestibles = "";
// init
$q = "select subject, shortform from subject where active = '1' order by subject";
//initialize $suggestibles
$suggestibles = '';
foreach ($db->query($q) as $myrow) {
    $item_title = trim($myrow[0][0]);
    if (!isset($link)) {
        $link = '';
    }
    $suggestibles .= "{text:\"" . htmlspecialchars($item_title) . "\", url:\"{$link}{$myrow['1']}[0]\"}, ";
}
$suggestibles = trim($suggestibles, ', ');
// Get our newest guides
$q2 = "select subject, subject_id, shortform from subject where active = '1' order by subject_id DESC limit 0,5";
//$r2 = $db->query($q2);
$newest_guides = "<ul>\n";
foreach ($db->query($q2) as $myrow2) {
    $guide_location = $guide_path . $myrow2[2];
    $newest_guides .= "<li><a href=\"{$guide_location}\">" . trim($myrow2[0]) . "</a></li>\n";
}
Ejemplo n.º 27
0
///////////////////
// Browse View
///////////////////
if (isset($_GET["browse"])) {
    $q = "SELECT user_type_id, user_type FROM user_type ORDER BY user_type_id";
    $querier = new Querier();
    $typeArray = $querier->query($q);
    print "<div class=\"pure-g\">\n  <div class=\"pure-u-2-3\">";
    // Loop through user types
    foreach ($typeArray as $value) {
        $staff_list = "";
        $staffArray = "";
        $our_title = $value[1];
        $q2 = "SELECT staff_id, fname, lname, email, ptags FROM staff WHERE user_type_id = " . $value[0] . " ORDER BY lname, fname";
        $querier2 = new Querier();
        $staffArray = $querier2->query($q2);
        $staff_list .= "";
        // if there are no results
        if (!$staffArray) {
            $staff_list .= "<p>" . _("None registered.  Just as well.  They're going to rise up against us someday.") . "</p>";
        } else {
            $staff_list .= "<p>" . _("Click on a name to update details and privileges") . "</p>";
            // set up striping
            $row_count = 0;
            $colour1 = "oddrow";
            $colour2 = "evenrow";
            foreach ($staffArray as $staff) {
                // unpack the ptags
                $these_tags = "";
                $current_ptags = explode("|", $staff[4]);
                foreach ($all_ptags as $value2) {
Ejemplo n.º 28
0
 public function search()
 {
     $db = new Querier();
     $connection = $db->getConnection();
     $search_param = "%" . $this->param . "%";
     $subject_id = $this->subject_id;
     switch ($this->collection) {
         case "home":
             $statement = $connection->prepare("SELECT subject_id AS 'id', subject AS 'matching_text',subject AS 'label', description as 'additional_text', shortform AS 'short_form', 'Subject Guide' as 'content_type', '' as 'additional_id', '' as 'parent' FROM subject\n                    WHERE description LIKE :search_term\n                    OR subject LIKE :search_term\n                    OR keywords LIKE :search_term\n                    UNION\n                    SELECT p.pluslet_id, p.title,p.title AS 'label', su.subject_id AS 'parent_id', su.shortform, 'Pluslet' AS 'content_type', t.tab_index as 'additional_id',su.subject as 'parent' FROM pluslet AS p\n                    INNER JOIN pluslet_section AS ps\n                    ON ps.pluslet_id = p.pluslet_id\n                    INNER JOIN section AS s\n                    ON ps.section_id = s.section_id\n                    INNER JOIN tab AS t\n                    ON s.tab_id = t.tab_id\n                    INNER JOIN subject AS su\n                    ON su.subject_id = t.subject_id\n                    WHERE p.body LIKE :search_term\n                    OR p.title LIKE :search_term\n                    UNION\n                    SELECT faq_id AS 'id', question AS 'matching_text',question AS 'label',  answer as 'additional_text','' AS 'short_form','FAQ' as 'content_type', '' as 'additional_id', '' as 'parent' FROM faq\n                    WHERE question LIKE :search_term\n                    OR answer LIKE :search_term\n                    OR keywords LIKE :search_term\n                    UNION\n                    SELECT talkback_id AS 'id', question AS 'matching_text' ,question AS 'label', answer as 'additional_text','' AS 'short_form', 'Talkback' as 'content_type', '' as 'additional_id', '' as 'parent' FROM talkback\n                    WHERE question LIKE :search_term\n                    OR answer LIKE :search_term\n                    UNION\n                    SELECT staff_id AS 'id', email AS 'matching_text' ,email AS 'label', fname as 'additional_text','' AS 'short_form', 'Staff' as 'content_type', '' as 'additional_id', '' as 'parent' FROM staff\n                    WHERE fname LIKE :search_term\n                    OR lname LIKE :search_term\n                    OR email LIKE :search_term\n                    OR tel LIKE :search_term\n                    UNION\n                    SELECT department_id AS 'id', name AS 'matching_text' , name AS 'label', telephone as 'additional_text','' AS 'short_form', 'Department' as 'content_type', '' as 'additional_id','' as 'parent' FROM department\n                    WHERE name LIKE :search_term\n                    OR telephone LIKE  :search_term\n                    UNION\n                    SELECT video_id AS 'id', title AS 'matching_text' ,title AS 'label', description as 'additional_text','' AS 'short_form', 'Video' as 'content_type', '' as 'additional_id', '' as 'parent' FROM video\n                    WHERE title LIKE :search_term\n                    OR description LIKE :search_term\n                    OR vtags LIKE :search_term");
             break;
         case "guides":
             $statement = $connection->prepare("SELECT subject_id as 'id', subject,'Subject Guide' as 'content_type', subject AS 'label',shortform AS 'short_form' \n       FROM subject \n       WHERE active = '1'\n       AND (subject LIKE :search_term\n           OR shortform LIKE :search_term\n           OR description LIKE :search_term\n           OR keywords LIKE :search_term\n           OR type LIKE :search_term)\n           ");
             break;
         case "all_guides":
             $statement = $connection->prepare("SELECT subject_id as 'id', subject,'Subject Guide' as 'content_type', subject AS 'label',shortform AS 'short_form'\n       FROM subject\n       WHERE (subject LIKE :search_term\n           OR shortform LIKE :search_term\n           OR description LIKE :search_term\n           OR keywords LIKE :search_term\n           OR type LIKE :search_term)\n           ORDER BY subject\n           ");
             break;
         case "guide":
             $statement = $connection->prepare("SELECT p.pluslet_id as 'id',su.shortform as 'short_form','Pluslet' as 'content_type',p.type as 'type', p.title, p.title AS 'label', ps.section_id, t.tab_index AS 'additional_id', t.subject_id, su.subject FROM pluslet AS p\n                    INNER JOIN pluslet_section AS ps\n                    ON ps.pluslet_id = p.pluslet_id\n                    INNER JOIN section AS s\n                    ON ps.section_id = s.section_id\n                    INNER JOIN tab AS t\n                    ON s.tab_id = t.tab_id\n                    INNER JOIN subject AS su\n                    ON su.subject_id = t.subject_id\n                    WHERE p.body LIKE :search_term\n      \t\t\t    AND t.subject_id = :subject_id");
             $statement->bindParam(":subject_id", $subject_id);
             break;
         case "current_guide":
             $statement = $connection->prepare("SELECT p.pluslet_id as 'id',su.shortform as 'short_form','Pluslet' as 'content_type',p.type as 'type', p.title, p.title AS 'label', ps.section_id, t.tab_index AS 'additional_id', t.subject_id, su.subject FROM pluslet AS p\n                    INNER JOIN pluslet_section AS ps\n                    ON ps.pluslet_id = p.pluslet_id\n                    INNER JOIN section AS s\n                    ON ps.section_id = s.section_id\n                    INNER JOIN tab AS t\n                    ON s.tab_id = t.tab_id\n                    INNER JOIN subject AS su\n                    ON su.subject_id = t.subject_id\n                    WHERE p.title LIKE :search_term\n      \t\t\t    AND t.subject_id = :subject_id");
             $statement->bindParam(":subject_id", $subject_id);
             break;
         case "records":
             $statement = $connection->prepare("SELECT DISTINCT title.title_id as 'id','Record' as 'content_type', title.title as 'label', location.location as 'location_url'\nFROM title\nINNER JOIN location_title\nON title.title_id = location_title.title_id\nINNER JOIN location\nON location.location_id = location_title.location_id\nAND title.title LIKE :search_term");
             break;
         case "azrecords":
             $statement = $connection->prepare("SELECT DISTINCT title.title_id as 'id','Record' as 'content_type', title.title as 'label', location.location as 'location_url'\nFROM title\nINNER JOIN location_title \nON title.title_id = location_title.title_id\nINNER JOIN location\nON location.location_id = location_title.location_id\nAND eres_display = 'Y'\nAND title.title LIKE :search_term");
             break;
         case "faq":
             $statement = $connection->prepare("SELECT faq_id AS 'id',question AS 'label', LEFT(question, 55), \n        \t\t'FAQ' as 'content_type'  FROM faq WHERE question LIKE :search_term");
             break;
         case "talkback":
             $statement = $connection->prepare("SELECT talkback_id AS 'id',question AS 'label','Talkback' \n        \t\tas content_type, LEFT(question, 55) FROM talkback WHERE question LIKE :search_term");
             break;
         case "admin":
             $statement = $connection->prepare("SELECT staff_id AS 'id',email AS 'label','Staff' \n        \t\tas 'content_type', CONCAT(fname, ' ', lname, ' (', email, ')') as fullname \n        \t\tFROM staff WHERE (fname LIKE :search_term) OR (lname LIKE :search_term)");
             break;
         case "pluslet":
             $statement = $connection->prepare("SELECT p.pluslet_id AS 'pluslet_id', p.title,p.title AS 'label',p.type as 'type', p.pluslet_id AS 'id', su.shortform as 'short_form', 'Pluslet' AS 'content_type', t.tab_index as 'additional_id',su.subject as 'parent' FROM pluslet AS p\n                    INNER JOIN pluslet_section AS ps\n                    ON ps.pluslet_id = p.pluslet_id\n                    INNER JOIN section AS s\n                    ON ps.section_id = s.section_id\n                    INNER JOIN tab AS t\n                    ON s.tab_id = t.tab_id\n                    INNER JOIN subject AS su\n                    ON su.subject_id = t.subject_id\n                    WHERE p.title LIKE :search_term\n      \t\t\t\n      \t\t\t\t");
             break;
         case "my_pluslets":
             $statement = $connection->prepare("SELECT p.pluslet_id AS 'pluslet_id', p.title,p.title AS 'label',p.type as 'type', p.pluslet_id AS 'id', su.shortform as 'short_form', 'Pluslet' AS 'content_type', t.tab_index as 'additional_id',su.subject as 'parent' FROM pluslet AS p\n                    INNER JOIN pluslet_section AS ps\n                    ON ps.pluslet_id = p.pluslet_id\n                    INNER JOIN section AS s\n                    ON ps.section_id = s.section_id\n                    INNER JOIN tab AS t\n                    ON s.tab_id = t.tab_id\n                    INNER JOIN subject AS su\n                    ON su.subject_id = t.subject_id\n                    INNER JOIN staff_subject AS st_sub\n                    ON st_sub.subject_id = su.subject_id\n                    WHERE p.title LIKE :search_term\n                    AND st_sub.staff_id = :staff_id\n      \t\t\t\n      \t\t\t\t");
             $statement->bindParam(":staff_id", $this->staff_id);
             break;
     }
     $search_param = '%' . $search_param . '%';
     $statement->bindParam(":search_term", $search_param);
     $statement->execute();
     $result = $statement->fetchAll();
     $arr = array();
     $i = 0;
     // This takes the results and creates an array that will be turned into JSON
     foreach ($result as $myrow) {
         //add no title label if empty
         $myrow['label'] = empty($myrow['label']) ? '[no title]' : $myrow['label'];
         $arr[$i]['label'] = html_entity_decode($myrow['label']);
         if (isset($myrow['content_type'])) {
             if (isset($myrow['id'])) {
                 $arr[$i]['id'] = $myrow['id'];
             }
             $arr[$i]['content_type'] = $myrow['content_type'];
             if (isset($myrow['location_url'])) {
                 $arr[$i]['location_url'] = $myrow['location_url'];
             }
             if (isset($myrow['short_form'])) {
                 $arr[$i]['shortform'] = $myrow['short_form'];
             }
             if (isset($myrow['matching_text'])) {
                 $arr[$i]['value'] = $myrow['matching_text'];
             }
             if (isset($myrow['parent'])) {
                 $arr[$i]['parent'] = $myrow['parent'];
             }
             if (isset($myrow['additional_id'])) {
                 $arr[$i]['parent_id'] = $myrow['additional_id'];
             }
             switch ($myrow['content_type']) {
                 case "Record":
                     $arr[$i]['label'] = html_entity_decode($myrow['label']);
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = 'record.php?record_id=' . $myrow['id'];
                     } else {
                         $db = new Querier();
                         $record_url_sql = "SELECT location, title\n        FROM location l, title t, location_title lt \n        WHERE  t.title_id = lt.title_id\n        AND l.location_id = lt.location_id AND t.title_id = " . $db->quote($myrow['id']) . " ";
                         $record_url_result = $db->query($record_url_sql);
                         if (isset($record_url_result[0]['location'])) {
                             $arr[$i]['url'] = $record_url_result[0]['location'];
                         } else {
                             $arr[$i]['url'] = '';
                         }
                     }
                     break;
                 case "Subject Guide":
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = getControlURL() . 'guides/guide.php?subject_id=' . $myrow['id'];
                     } else {
                         $arr[$i]['url'] = 'guide.php?subject=' . $myrow['short_form'];
                     }
                     break;
                 case "FAQ":
                     $arr[$i]['label'] = html_entity_decode($myrow['label']);
                     $arr[$i]['url'] = 'faq.php?faq_id=' . $myrow['id'];
                     break;
                 case "Pluslet":
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = getControlURL() . 'guides/guide.php?subject_id=' . $myrow['short_form'] . '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['hash'] = '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['label'] = html_entity_decode($myrow['label']);
                         if (isset($myrow['type'])) {
                             $arr[$i]['type'] = $myrow['type'];
                         }
                         if (isset($arr[$i]['pluslet_id'])) {
                             $arr[$i]['pluslet_id'] = $myrow['id'];
                         }
                     } else {
                         $arr[$i]['url'] = 'guide.php?subject=' . $myrow['short_form'] . '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['hash'] = '#box-' . $myrow['additional_id'] . '-' . $myrow['id'];
                         $arr[$i]['tab_index'] = $myrow['additional_id'];
                         $arr[$i]['pluslet_id'] = $myrow['id'];
                     }
                     break;
                 case "Talkback":
                     $arr[$i]['label'] = html_entity_decode($myrow['label']);
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = 'talkback.php?talkback_id=' . $myrow['id'];
                     } else {
                         $arr[$i]['url'] = 'talkback.php';
                     }
                     break;
                 case "Staff":
                     if ($myrow['fullname'] != null) {
                         $arr[$i]['label'] = $myrow['fullname'];
                     } else {
                         $arr[$i]['label'] = "";
                     }
                     if ($this->getSearchPage() == "control") {
                         $arr[$i]['url'] = 'user.php?staff_id=' . $myrow['id'];
                     } else {
                         $name = explode('@', $myrow['label']);
                         $arr[$i]['url'] = 'staff_details.php?name=' . $name[0];
                     }
                     break;
             }
         } else {
             $arr[$i]['value'] = $myrow[0];
         }
         $i++;
     }
     $response = json_encode($arr);
     return $response;
 }
Ejemplo n.º 29
0
    } else {
        $feedback = "There is no record by that ID.";
    }
}
if (isset($_POST["submit_record"])) {
    // 1.  Make sure we have minimum non-dupe data
    // 1a. Make sure there is a title, location, and subject
    if ($_POST["title"] == "" || $_POST["location"][0] == "" || $_POST["subject"][0] == "") {
        echo "<div class=\"feedback\">" . _("You must have a title, location, and subject.  Please go back and fix these omissions.  And turn on JavaScript, for goodness sakes!") . "</div><br /><br />";
        exit;
    }
    // 1b. IF THIS IS AN INSERT make sure the title isn't an exact dupe
    if ($_POST["title_id"] == "") {
        $querierDupe = new Querier();
        $qDupe = "SELECT title_id, title FROM title WHERE title LIKE " . $db->quote($_POST["title"]);
        $dupetitleArray = $querierDupe->query($qDupe);
        if ($dupetitleArray) {
            echo _("There is already a record with this title: ") . "<a href=\"record.php?record_id=" . $dupetitleArray[0] . "\">" . $dupetitleArray[1] . "</a>.  " . _("Maybe do a search and make sure it doesn't already exist?");
            return FALSE;
        }
    }
    // Submit form
    $record = new Record($_POST["title_id"], "post");
    //////////////////////////////////
    // Is this an Insert or an update?
    //////////////////////////////////
    if ($_POST["title_id"] == "") {
        $record->insertRecord();
        $ok_record_id = $record->getRecordId();
    } else {
        $record->updateRecord();
Ejemplo n.º 30
0
 public function save()
 {
     $db = new Querier();
     $lobjTabs = json_decode($this->_input['tabs'], true);
     // Remove all existing entries for that guide from intervening table
     $subject_id = $this->_input["this_subject_id"];
     $qs = "SELECT tab_id FROM tab WHERE subject_id = '{$subject_id}'";
     $drs = $db->query($qs);
     // list all pluslets associated with guide before save that aren't special
     $qp = "SELECT p.pluslet_id\nFROM pluslet p\nINNER JOIN pluslet_section ps\nON p.pluslet_id = ps.pluslet_id\nINNER JOIN section sec\nON ps.section_id = sec.section_id\nINNER JOIN tab t\nON sec.tab_id = t.tab_id\nINNER JOIN subject s\nON t.subject_id = s.subject_id\nWHERE s.subject_id = {$subject_id}\nAND p.type != 'Special'";
     $lobjBeforePluslets = $db->query($qp);
     $lobjAfterPluslets = array();
     // initiate list currently saving pluslets
     foreach ($drs as $row) {
         $qd = "DELETE ps, sec FROM pluslet_section ps\n\tINNER JOIN section sec\n\tON ps.section_id = sec.section_id\n\tWHERE sec.tab_id = '{$row[0]}'";
         $db->exec($qd);
         $qd = "DELETE FROM tab WHERE tab_id = '{$row[0]}'";
         $db->exec($qd);
     }
     $lintTabIndex = 0;
     foreach ($lobjTabs as $lobjTab) {
         if (isset($lobjTab['external'])) {
         } else {
             $lobjTab['external'] = NULL;
         }
         $qi = "INSERT INTO tab (subject_id, label, tab_index, external_url, visibility) VALUES ('{$subject_id}', '{$lobjTab['name']}', {$lintTabIndex}, '{$lobjTab['external']}', {$lobjTab['visibility']})";
         // print $qi . "<br />";
         $db->exec($qi);
         $lintTabId = $db->last_id();
         $lintSectionIndex = 0;
         // insert sections
         foreach ($lobjTab['sections'] as $lobjSection) {
             // insert section, as of now only one per tab
             $qi = "INSERT INTO section (section_index, layout, tab_id) VALUES ('{$lintSectionIndex}', '{$lobjSection['layout']}', '{$lintTabId}')";
             // print $qi . "<br />";
             $db->exec($qi);
             $lintSecId = $db->last_id();
             $left_col = $lobjSection["left_data"];
             $center_col = $lobjSection["center_data"];
             $sidebar = $lobjSection["sidebar_data"];
             // added by dgonzalez in order to separate by '&pluslet[]=' even if dropspot-left doesn't exist
             $left_col = "&" . $left_col;
             $center_col = "&" . $center_col;
             $sidebar = "&" . $sidebar;
             // remove the "drop here" non-content & get all our "real" contents into array
             $left_col = str_replace("dropspot-left[]=1", "", $left_col);
             $leftconts = explode("&pluslet[]=", $left_col);
             $center_col = str_replace("dropspot-center[]=1", "", $center_col);
             $centerconts = explode("&pluslet[]=", $center_col);
             $sidebar = str_replace("dropspot-sidebar[]=1", "", $sidebar);
             $sidebarconts = explode("&pluslet[]=", $sidebar);
             // CHECK IF THERE IS CONTENT
             // Now insert the appropriate entries
             foreach ($leftconts as $key => $value) {
                 if ($key != 0) {
                     $qi = "INSERT INTO pluslet_section (pluslet_id, section_id, pcolumn, prow) VALUES ('{$value}', '{$lintSecId}', 0, '{$key}')";
                     // print $qi . "<br />";
                     $db->exec($qi);
                     array_push($lobjAfterPluslets, $value);
                 }
             }
             foreach ($centerconts as $key => $value) {
                 if ($key != 0) {
                     $qi = "INSERT INTO pluslet_section (pluslet_id, section_id, pcolumn, prow) VALUES ('{$value}', '{$lintSecId}', 1, '{$key}')";
                     // print $qi . "<br />";
                     $db->exec($qi);
                     array_push($lobjAfterPluslets, $value);
                 }
             }
             foreach ($sidebarconts as $key => $value) {
                 if ($key != 0) {
                     $qi = "INSERT INTO pluslet_section (pluslet_id, section_id, pcolumn, prow) VALUES ('{$value}', '{$lintSecId}', 2, '{$key}')";
                     // print $qi . "<br />";
                     $db->exec($qi);
                     array_push($lobjAfterPluslets, $value);
                 }
             }
             $lintSectionIndex++;
         }
         $lintTabIndex++;
     }
     // delete all pluslets that are not being used anymore to avoid orphans
     foreach ($lobjBeforePluslets as $lobjPluslet) {
         if (!in_array($lobjPluslet['pluslet_id'], $lobjAfterPluslets)) {
             $q = "DELETE FROM pluslet WHERE pluslet_id = {$lobjPluslet['pluslet_id']}";
             if ($db->exec($q) === FALSE) {
                 print "Error could not remove pluslet orphans!";
                 exit;
             }
         }
     }
     // ///////////////////
     // Alter chchchanges table
     // table, flag, item_id, title, staff_id
     // //////////////////
     // $updateChangeTable = changeMe("guide", "update", $_COOKIE["our_guide_id"], $_COOKIE["our_guide"], $_SESSION['staff_id']);
     print _("Thy Will Be Done:  Guide Updated.");
 }