Пример #1
0
 public function processSection()
 {
     global $IconPath;
     $lobjGuide = new Guide();
     if (isset($this->_input['action'])) {
         switch ($this->_input['action']) {
             case 'create':
                 // print section and slider div
                 $new_id = rand(1, 100000);
                 print "<div id=\"section_{$new_id}\" class=\"sp_section pure-g\" data-layout='4-4-4'>";
                 print "<div class=\"sp_section_controls\">";
                 print "<i class=\"fa fa-arrows section_sort\" title=\"Move Section\"></i>\n\t\t\t\t\t<i class=\"fa fa-trash-o section_remove\" title=\"Delete Section\"></i>\n\t\t\t\t\t</div>";
                 print $lobjGuide->dropBoxes(0, 'left', "");
                 print $lobjGuide->dropBoxes(1, 'center', "");
                 print $lobjGuide->dropBoxes(2, 'sidebar', "");
                 print '<div id="clearblock" style="clear:both;"></div> <!-- this just seems to allow the space to grow to fit dropbox areas -->';
                 print '</div>';
                 break;
             case 'delete':
                 if (isset($_POST['section_id'])) {
                     $db = new Querier();
                     $q = "DELETE p, s\n\t\t\t\t\t\t\tFROM pluslet p\n\t\t\t\t\t\t\tINNER JOIN pluslet_section ps\n\t\t\t\t\t\t\tON p.pluslet_id = ps.pluslet_id\n\t\t\t\t\t\t\tINNER JOIN section s\n\t\t\t\t\t\t\tON ps.section_id = s.section_id\n\t\t\t\t\t\t\tWHERE p.type != 'Special'\n\t\t\t\t\t\t\tAND s.section_id = " . $_POST['section_id'];
                     if ($db->exec($q) === FALSE) {
                         print "Query Error! Did not delete";
                     } else {
                         print "Thy will be done!";
                     }
                 } else {
                     print "Error: No section ID";
                 }
                 break;
             default:
                 print 'No action.';
                 break;
         }
     } else {
         print 'No action.';
     }
 }
Пример #2
0
        $main_width = 0;
    }
    if (isset($col_widths[2]) && $col_widths[2] > 0) {
        $side_width = $col_widths[2] * 8 - 3;
        // we make this a squidgen narrower so it doesn't wrap nastily
    } else {
        $side_width = 0;
    }
    // Is there a selected tab?
    if (isset($_GET["t"]) && $_GET["t"] != "") {
        $selected_tab = scrubData($_GET["t"]);
    } else {
        $selected_tab = 0;
    }
    //create new guide object and set admin view to false
    $lobjGuide = new Guide($this_id);
    $lobjGuide->_isAdmin = FALSE;
    //processVisibility
    if (!$lobjGuide->checkVisibility()) {
        exit;
    }
    $all_tabs = $lobjGuide->getTabs('public');
} else {
    header("location:index.php");
}
$page_title = $subject_name;
// Do we have an alternate header?
if (isset($header_type) && $header_type != 'default') {
    if (file_exists("includes/header_{$header_type}.php")) {
        include "includes/header_{$header_type}.php";
    } else {
Пример #3
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;
 }
Пример #4
0
        $main_width = 0;
    }
    if (isset($col_widths[2]) && $col_widths[2] > 0) {
        $side_width = $col_widths[2] * 8 - 3;
        // we make this a squidgen narrower so it doesn't wrap nastily
    } else {
        $side_width = 0;
    }
    // Is there a selected tab?
    if (isset($_GET["t"]) && $_GET["t"] != "") {
        $selected_tab = scrubData($_GET["t"]);
    } else {
        $selected_tab = 0;
    }
    //create new guide object and set admin view to true
    $lobjGuide = new Guide($this_id);
    $lobjGuide->_isAdmin = TRUE;
    $all_tabs = $lobjGuide->getTabs();
} else {
    print "no guide";
}
////////////////////////////
// Now, get our pluslets //
///////////////////////////
global $pluslets_activated;
$all_boxes = "\n<ul id=\"box_options\">\n<li class=\"box_note box-item\">" . _("Drag selection, then drop to right") . "</li>";
foreach ($pluslets_activated as $lstrPluslet) {
    if (file_exists(dirname(dirname(__DIR__)) . "/lib/SubjectsPlus/Control/Pluslet/{$lstrPluslet}.php")) {
        $lstrObj = "SubjectsPlus\\Control\\Pluslet_" . $lstrPluslet;
        if (method_exists($lstrObj, 'getMenuName')) {
            $all_boxes .= "<li class=\"box-item draggable\" id=\"pluslet-id-{$lstrPluslet}\" ckclass='" . call_user_func(array($lstrObj, 'getCkPluginName')) . "'>" . call_user_func(array($lstrObj, 'getMenuName')) . "</li>";
Пример #5
0
/**
 *   @file section_data.php
 *   @brief Create new section HTML
 *   @description
 *
 *   @author agdarby, dgonzalez
 *   @date updated April 2014
 */
use SubjectsPlus\Control\Guide;
use SubjectsPlus\Control\Querier;
$subsubcat = "";
$subcat = "guides";
$page_title = "Section Functions";
$header = "noshow";
include "../../includes/header.php";
$lobjGuide = new Guide();
if (isset($_POST['action'])) {
    switch ($_POST['action']) {
        case 'create':
            //print section and slider div
            $new_id = rand(1, 100000);
            print "<div id=\"section_new_{$new_id}\" class=\"sp_section\" data-layout=\"4-4-4\">";
            print "<div class=\"sp_section_controls\">\n\t\t\t<img src=\"{$IconPath}/hand_cursor-26.png\" class=\"section_sort\"/>\n\t\t\t<img src=\"{$IconPath}/delete.png\" class=\"section_remove\" />\n\t\t\t<div id=\"slider_section_new_{$new_id}\" class=\"sp_section_slider\"></div>\n\t\t\t\t   </div>";
            print $lobjGuide->dropBoxes(0, 'left', "");
            print $lobjGuide->dropBoxes(1, 'center', "");
            print $lobjGuide->dropBoxes(2, 'sidebar', "");
            print '<div id="clearblock" style="clear:both;"></div> <!-- this just seems to allow the space to grow to fit dropbox areas -->';
            print '</div>';
            ?>
			<script type="text/javascript">
				makeSectionSlider('div[id="<?php 
Пример #6
0
    // Is this an Insert or an update?
    //////////////////////////////////
    if ($_POST["subject_id"] == "") {
        $record->insertRecord();
        $ok_record_id = $record->getRecordId();
    } else {
        $record->updateRecord();
    }
    // Show feedback
    $feedback = $record->getMessage();
    // See all the queries?
    //$record->deBug();
    print "<div class=\"feedback\" style=\"display:block;\">" . $feedback . "</div>";
}
if (!isset($no_form)) {
    $record = new Guide($ok_record_id);
}
// show feedback if it isn't already set
if (!isset($feedback)) {
    $feedback = $record->getMessage();
}
/////////////////////////
// SHOW FORM
// If the form isn't suppressed, output it.  It will be blank if there's no id
/////////////////////////
if (!isset($_REQUEST["wintype"])) {
    $_GET["wintype"] = "";
}
if (!isset($no_form)) {
    print "<div id=\"maincontent\">";
    $record->outputMetadataForm($_GET["wintype"]);
Пример #7
0
    $db = new Querier();
    $r = $db->query($q);
    // If this guide doesn't exist, send them away
    if (count($r) == 0) {
        header("location:index.php");
    }
    $subject_name = $r[0][0];
    $shortform = $r[0][1];
    // Is there a selected tab?
    if (isset($_GET["t"]) && $_GET["t"] != "") {
        $selected_tab = scrubData($_GET["t"]);
    } else {
        $selected_tab = 0;
    }
    // create new guide object and set admin view to true
    $lobjGuide = new Guide($this_id);
    $lobjGuide->_isAdmin = TRUE;
    $all_tabs = $lobjGuide->getTabs();
} else {
    print "no guide";
}
// //////////////////////////
// Now, get our pluslets //
// /////////////////////////
global $pluslets_activated;
// get related guides
$related_guides = $lobjGuide->getRelatedGuides();
$related_guides = array_filter($related_guides);
// if none exist then do not display related guide pluslet icon
if (empty($related_guides)) {
    if (($key = array_search('Related', $pluslets_activated)) !== false) {