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; }
public function outputMetadataForm($wintype = "") { global $wysiwyg_desc; global $IconPath; global $guide_types; global $guide_headers; global $use_disciplines; //print "<pre>";print_r($this->_staffers); print "</pre>"; $action = htmlentities($_SERVER['PHP_SELF']) . "?subject_id=" . $this->_subject_id; if ($wintype != "") { $action .= "&wintype=pop"; } if ($wintype == "pop") { $copy_guide = ""; } else { $copy_guide = "<a href='guide_copy.php'>" . _("Copy an Existing Guide") . "</a>"; } if ($this->_subject_id) { $guide_title_line = _("Edit Existing Guide Metadata"); } else { $guide_title_line = _("Create New Guide"); } echo "\n <form action=\"" . $action . "\" method=\"post\" id=\"new_record\" class=\"pure-form pure-form-stacked\" accept-charset=\"UTF-8\">\n <input type=\"hidden\" name=\"subject_id\" value=\"" . $this->_subject_id . "\" />\n <div class=\"pure-g\">\n <div class=\"pure-u-1-2\">\n <div class=\"pluslet\">\n <div class=\"titlebar\">\n <div class=\"titlebar_text\">{$guide_title_line}</div>\n <div class=\"titlebar_options\"></div>\n </div>\n <div class=\"pluslet_body\">\n\t\t\t\t{$copy_guide}\n\t\t\t<label for=\"record_title\">" . _("Guide Title") . "</label>\n <input type=\"text\" name=\"subject\" id=\"record_title\" class=\"pure-input-1-2 required_field\" value=\"" . $this->_subject . "\">\n\n <label for=\"record_shortform\">" . _("Short Form") . "</label>\n <input type=\"text\" name=\"shortform\" id=\"record_shortform\" size=\"20\" class=\"pure-input-1-4 required_field\" value=\"" . $this->_shortform . "\">\n\n <span class=\"smaller\">* " . _("Short label that shows up in URL--don't use spaces, ampersands, etc.") . "</span>\n\n <label for=\"type\">" . _("Type of Guide") . "</label>\n "; ///////////////////// // Guide types dropdown ///////////////////// $guideMe = new Dropdown("type", $guide_types, $this->_type, "50"); $guide_string = $guideMe->display(); echo $guide_string; echo "<label for=\"header\">" . _("Header Type") . "</label>"; ///////////////////// // Header switcher dropdown ///////////////////// $headerMe = new Dropdown("header", $guide_headers, $this->_header, "50"); $header_string = $headerMe->display(); echo $header_string; echo "<span class=\"smaller\">* " . _("If you're not sure, stick with default") . "</span>"; ///////////////////// // Is Live //////////////////// $is_live = "<label for=\"active\">" . _("Visibility") . "</label>\n <input name=\"active\" type=\"radio\" value=\"1\""; if ($this->_active == 1) { $is_live .= " checked=\"checked\""; } $is_live .= " /> " . _("Public: Everyone can see") . " <br />\n <input name=\"active\" type=\"radio\" value=\"0\""; if ($this->_active == 0) { $is_live .= " checked=\"checked\""; } $is_live .= " /> " . _("Hidden: Not listed, but visible if you have the URL") . " <br />\n <input name=\"active\" type=\"radio\" value=\"2\""; if ($this->_active == 2) { $is_live .= " checked=\"checked\""; } $is_live .= " /> " . _("Suppressed: Must be logged in to SP to view"); print $is_live; //////////////////////////// // Parenthood /////////////////////////// $parents_list = ""; if ($this->_parents == FALSE) { // No results $parents_list = ""; } else { // loop through results foreach ($this->_parents as $value) { $parents_list .= self::outputParents($value); } } //////// // Parent dropdown //////// $querier = new Querier(); $subject_query = "SELECT subject_id, subject FROM subject WHERE subject_id != '{$this->_subject_id}'"; $subjectArray = $querier->query($subject_query); $parentMe = new Dropdown("parent_id[]", $subjectArray, "", "50", "--Select--"); $parent_string = $parentMe->display(); $parenthood = "{$parent_string} <div id=\"parent_list\">{$parents_list}</div> <!-- parent guides inserted here -->"; // this is for legacy reasons, methinks if (isset($main_col_size)) { } else { $main_col_size = null; } $screen_layout = "<input type=\"hidden\" id=\"extra\" name=\"extra[maincol]\" value=\"{$main_col_size}\" />"; echo "\n <label for=\"parent\">" . _("Parent Guides") . "</label>\n {$parenthood}\n <br style=\"clear: both;\" />\n <span class=\"smaller\">* " . _("Parent guides allow you to create a hierarchy") . "</span>\n {$screen_layout}\n </div>\n </div>\n </div>\n <!-- right hand column -->\n <div class=\"pure-u-1-2\">"; $content = "<input type=\"submit\" name=\"submit_record\" class=\"pure-button pure-button-primary save-guide\" value=\"" . _("Save Now") . "\" />"; // if a) it's not a new record, and b) we're an admin or c) we are listed as a librarian for this guide, show delete button // make sure they're allowed to delete if ($this->_subject_id != "") { if (in_array($_SESSION["staff_id"], $this->_ok_staff) || $_SESSION["admin"] == 1) { $content .= " <input type=\"submit\" name=\"delete_record\" class=\"pure-button delete_button pure-button-warning delete-guide\" value=\"" . _("Delete Forever!") . "\" />"; } } // get edit history $last_mod = _("Last modified: ") . lastModded("guide", $this->_subject_id); $title = "<div id=\"last_edited\">{$last_mod}</div>"; makePluslet($title, $content, "no_overflow"); ///////////////// // Staffers ///////////////// $staffer_list = ""; if ($this->_staffers == FALSE) { // No results $staffer_list = ""; } else { // loop through results foreach ($this->_staffers as $value) { $staffer_list .= self::outputStaff($value); } } $qStaff = "select staff_id, CONCAT(fname, ' ', lname) as fullname FROM staff WHERE ptags LIKE '%records%' AND active = '1' ORDER BY lname, fname"; $querierStaff = new Querier(); $staffArray = $querierStaff->query($qStaff); $staffMe = new Dropdown("staff_id[]", $staffArray, "", "50", "--Select--"); $staff_string = $staffMe->display(); ///////////////// // Disciplines ///////////////// if ($use_disciplines == TRUE) { $discipliner_list = ""; if ($this->_discipliners == FALSE) { // No results $discipliner_list = ""; } else { // loop through results foreach ($this->_discipliners as $value) { $discipliner_list .= self::outputDisciplines($value); } } $qDiscipline = "select discipline_id, discipline FROM discipline ORDER BY discipline"; $querierDiscipline = new Querier(); $disciplineArray = $querierStaff->query($qDiscipline); $disciplineMe = new Dropdown("discipline_id[]", $disciplineArray, "", "50", "--Select--"); $discipline_string = $disciplineMe->display(); } $staff_box = "{$staff_string} <div id=\"item_list\">{$staffer_list}</div> <!-- staff inserted here -->"; makePluslet(_("Staff"), $staff_box, "no_overflow"); ////////////// // Metadata ////////////// $metadata_box = "\n <label for=\"description\">" . _("Description") . "</label>\n <textarea name=\"description\" id=\"record_description\" class=\"\" cols=\"35\" rows=\"2\">" . $this->_description . "</textarea>\n\n <label for=\"keywords\">" . _("Keywords (separate with commas)") . "</label>\n <input type=\"text\" name=\"keywords\" id=\"record_keywords\" size=\"40\" class=\"\" value=\"" . $this->_keywords . "\">\n <label for=\"record_label\">" . _("Redirect Url (for non-SubjectsPlus content)") . "</label>\n <input type=\"text\" name=\"redirect_url\" id=\"record_redirect_url\" size=\"40\" class=\"\" value=\"" . $this->_redirect_url . "\">\n "; if ($use_disciplines == TRUE) { $metadata_box .= "<label for=\"discipline_list\">" . _("Parent Disciplines") . "</span><br />\n {$discipline_string}\n <div id=\"discipline_list\">{$discipliner_list}</div> <!-- disciplines inserted here -->\n </div>"; } makePluslet(_("Metadata (optional)"), $metadata_box, "no_overflow"); //////////////// // Thumbnail Option //////////////// $thumbnail_box = _("If you want to associate a thumbnail image with this guide, put a file called [shortform].jpg in assets/images/guide_thumbs/ on the server."); $thumbnail_box .= "<p>" . _("E.g., musichistory.jpg, if your shortform is \"musichistory\"."); $thumbnail_box .= "<p>" . _("Note that this is NOT required, and might NOT be implemented in your version of SubjectsPlus."); makePluslet(_("Thumbnail (VERY optional)"), $thumbnail_box, "no_overflow"); echo "</div>\n</form>"; }
public function outputMetadataForm($wintype = "") { global $wysiwyg_desc; global $IconPath; global $guide_types; global $arcviveYes; global $archiveNo; global $archiveSelected; global $guide_headers; global $use_disciplines; $archiveMe = ""; //print "<pre>";print_r($this->_staffers); print "</pre>"; $action = htmlentities($_SERVER['PHP_SELF']) . "?subject_id=" . $this->_subject_id; if ($wintype != "") { $action .= "&wintype=pop"; } if ($this->_subject_id) { $guide_title_line = _("Edit Existing Guide Metadata"); } else { $guide_title_line = _("Create New Guide"); } echo "\n <form action=\"" . $action . "\" method=\"post\" id=\"new_record\" class=\"pure-form pure-form-stacked\" accept-charset=\"UTF-8\">\n <input type=\"hidden\" name=\"subject_id\" value=\"" . $this->_subject_id . "\" />\n <div class=\"pure-g\">\n <div class=\"pure-u-1-2\">\n <div class=\"pluslet\">\n <div class=\"titlebar\">\n <div class=\"titlebar_text\">{$guide_title_line}</div>\n <div class=\"titlebar_options\"></div>\n </div>\n <div class=\"pluslet_body\">\n\n\n\n\n <label for=\"record_title\">" . _("Guide") . "</label>\n <input type=\"text\" name=\"subject\" id=\"record_title\" class=\"pure-input-1-2 required_field\" value=\"" . $this->_subject . "\">\n\n <label for=\"record_shortform\">" . _("Short Form") . "</label>\n <input type=\"text\" name=\"shortform\" id=\"record_shortform\" size=\"20\" class=\"pure-input-1-4 required_field\" value=\"" . $this->_shortform . "\">\n\n <span class=\"smaller\">* " . _("Short label that shows up in URL--don't use spaces, ampersands, etc.") . "</span>\n\n\n\n "; ///////////////////// // Archive checkboxes ///////////////////// $archiveMe = "<label for=\"archive\">" . _("Archive") . "</label>\n <input type=\"radio\" name=\"archive\" id=\"archive\" class=\"pure-input-1-4\" value=1\""; if ($this->_archive == 1) { $archiveMe .= ' checked="checked"'; } $archiveMe .= " /> " . _("Yes") . " <br />\n <input type=\"radio\" name=\"archive\" id=\"archive\" class=\"pure-input-1-4\" value=0\""; if ($this->_archive == 0) { $archiveMe .= ' checked="checked"'; } $archiveMe .= " /> " . _("No"); print $archiveMe; ///////////////////// // Guide types dropdown ///////////////////// echo "<label for=\"type\">" . _("Type of Guide") . "</label>"; $guideMe = new Dropdown("type", $guide_types, $this->_type, "50"); $guide_string = $guideMe->display(); echo $guide_string; echo "<label for=\"header\">" . _("Header Type") . "</label>"; ///////////////////// // Header switcher dropdown ///////////////////// $headerMe = new Dropdown("header", $guide_headers, $this->_header, "50"); $header_string = $headerMe->display(); echo $header_string; echo "<span class=\"smaller\">* " . _("If you're not sure, stick with default") . "</span>"; ///////////////////// // Is Live //////////////////// $is_live = "<label for=\"active\">" . _("Visibility") . "</label>\n <input name=\"active\" type=\"radio\" value=\"1\""; if ($this->_active == 1) { $is_live .= " checked=\"checked\""; } $is_live .= " /> " . _("Public: Everyone can see") . " <br />\n <input name=\"active\" type=\"radio\" value=\"0\""; if ($this->_active == 0) { $is_live .= " checked=\"checked\""; } $is_live .= " /> " . _("Hidden: Not listed, but visible if you have the URL") . " <br />\n <input name=\"active\" type=\"radio\" value=\"2\""; if ($this->_active == 2) { $is_live .= " checked=\"checked\""; } $is_live .= " /> " . _("Suppressed: Must be logged in to SP to view"); print $is_live; ///////// // Department dropdown //////// $querier = new Querier(); $dept_query = "SELECT department_id, name FROM department;"; $deptArray = $querier->query($dept_query); $current_dept = new Querier(); $current_dept_query = "SELECT DISTINCT subject.subject, subject.subject_id, department.name, department.department_id, subject_department.date\n FROM subject_department\n JOIN subject ON subject.subject_id = subject_department.id_subject\n JOIN department ON department.department_id = subject_department.id_department\n WHERE subject.subject_id = '{$this->_subject_id}'\n ORDER BY date DESC\n LIMIT 1"; $current_dept_array = $current_dept->query($current_dept_query); print "\n </div>\n </div>\n <div class=\"pluslet\">\n \n <div class=\"titlebar\">\n <div class=\"titlebar_text\">" . _("Associations/Listings (optional)") . "</div>\n <div class=\"titlebar_options\"></div>\n </div>\n <div class=\"pluslet_body\">\n <span class=\"smaller\"> " . _("<strong>Department</strong> lets you group guides to provide a separate listing for a group of guides, say, Special Collections. \n <br /><strong>Parent Guide</strong> allows you to build a hierarchy for display.") . "</span>"; ?> <label for="department"> Department </label> <select name="department"> <?php if ($current_dept_array) { foreach ($current_dept_array as $dept) { echo "<option value='" . $dept["department_id"] . "'>" . $dept["name"] . "</option>"; } } else { print "<option value='0'>--none--</option>"; foreach ($deptArray as $dept) { echo "<option value='" . $dept["department_id"] . "'>" . $dept["name"] . "</option>"; } } ?> </select> <?php //////////////////////////// // Parenthood /////////////////////////// $parents_list = ""; if ($this->_parents == FALSE) { // No results $parents_list = ""; } else { // loop through results foreach ($this->_parents as $value) { $parents_list .= self::outputParents($value); } } //////// // Parent dropdown //////// $querier = new Querier(); $subject_query = "SELECT subject_id, subject FROM subject WHERE subject_id != '{$this->_subject_id}'"; $subjectArray = $querier->query($subject_query); $parentMe = new Dropdown("parent_id[]", $subjectArray, "", "50", "--Select--"); $parent_string = $parentMe->display(); $parenthood = "{$parent_string} <div id=\"parent_list\">{$parents_list}</div> <!-- parent guides inserted here -->"; // this is for legacy reasons, methinks if (isset($main_col_size)) { } else { $main_col_size = null; } $screen_layout = "<input type=\"hidden\" id=\"extra\" name=\"extra[maincol]\" value=\"{$main_col_size}\" />"; echo "\n <label for=\"parent\">" . _("Parent Guides") . "</label>\n {$parenthood}\n\n {$screen_layout}\n </div>\n </div>\n </div>\n <!-- right hand column -->\n <div class=\"pure-u-1-2\">"; $content = "<input type=\"submit\" name=\"submit_record\" class=\"pure-button pure-button-primary save-guide\" value=\"" . _("Save Now") . "\" />"; // if a) it's not a new record, and b) we're an admin or c) we are listed as a librarian for this guide, show delete button // make sure they're allowed to delete if ($this->_subject_id != "") { if (in_array($_SESSION["staff_id"], $this->_ok_staff) || $_SESSION["admin"] == 1) { $content .= " <input type=\"submit\" name=\"delete_record\" class=\"pure-button delete_button pure-button-warning delete-guide\" value=\"" . _("Delete Forever!") . "\" />"; } } // get edit history $last_mod = _("Last modified: ") . lastModded("record", $this->_subject_id); $title = "<div id=\"last_edited\">{$last_mod}</div>"; makePluslet($title, $content, "no_overflow"); ///////////////// // Staffers ///////////////// $staffer_list = ""; if ($this->_staffers == FALSE) { // No results $staffer_list = ""; } else { // loop through results foreach ($this->_staffers as $value) { $staffer_list .= self::outputStaff($value); } } $qStaff = "select staff_id, CONCAT(fname, ' ', lname) as fullname FROM staff WHERE ptags LIKE '%records%' ORDER BY lname, fname"; $querierStaff = new Querier(); $staffArray = $querierStaff->query($qStaff); $staffMe = new Dropdown("staff_id[]", $staffArray, "", "50", "--Select--"); $staff_string = $staffMe->display(); ///////////////// // Disciplines ///////////////// if ($use_disciplines == TRUE) { $discipliner_list = ""; if ($this->_discipliners == FALSE) { // No results $discipliner_list = ""; } else { // loop through results foreach ($this->_discipliners as $value) { $discipliner_list .= self::outputDisciplines($value); } } $qDiscipline = "select discipline_id, discipline FROM discipline ORDER BY discipline"; $querierDiscipline = new Querier(); $disciplineArray = $querierStaff->query($qDiscipline); $disciplineMe = new Dropdown("discipline_id[]", $disciplineArray, "", "50", "--Select--"); $discipline_string = $disciplineMe->display(); } $staff_box = "{$staff_string} <div id=\"item_list\">{$staffer_list}</div> <!-- staff inserted here -->"; makePluslet(_("Staff"), $staff_box, "no_overflow"); ////////////// // Metadata ////////////// $metadata_box = "\n <label for=\"description\">" . _("Description") . "</label>\n <textarea name=\"description\" id=\"record_description\" class=\"\" cols=\"35\" rows=\"2\">" . $this->_description . "</textarea>\n\n <label for=\"keywords\">" . _("Keywords (separate with commas)") . "</label>\n <input type=\"text\" name=\"keywords\" id=\"record_keywords\" size=\"40\" class=\"\" value=\"" . $this->_keywords . "\">\n <label for=\"record_label\">" . _("Redirect Url (for non-SubjectsPlus content)") . "</label>\n <input type=\"text\" name=\"redirect_url\" id=\"record_redirect_url\" size=\"40\" class=\"\" value=\"" . $this->_redirect_url . "\">\n "; if ($use_disciplines == TRUE) { $metadata_box .= "<label for=\"discipline_list\">" . _("Parent Disciplines") . "</span><br />\n {$discipline_string}\n <div id=\"discipline_list\">{$discipliner_list}</div> <!-- disciplines inserted here -->\n </div>"; } makePluslet(_("Metadata (optional)"), $metadata_box, "no_overflow"); echo "</div>\n</form>"; }
public function buildLocation() { $this->_boxcount = 1; /////////////// // Location > Format /////////////// $querierLoc = new Querier(); $qLoc = "select format_id, format from format order by format_id"; $formatArray = $querierLoc->query($qLoc); //////////////// // Location Restrictions //////////////// $querierRes = new Querier(); $qRes = "select restrictions_id, restrictions from restrictions order by restrictions_id"; $restrictionsArray = $querierRes->query($qRes); // Test if these exist, otherwise go to plan B if ($this->_locations == FALSE) { // no location // create format box for later $formatMe = new Dropdown("format[]", $formatArray); $this->_formats = $formatMe->display(); // create restrictions box for later $restrictMe = new Dropdown("access_restrictions[]", $restrictionsArray); $this->_restrictions = $restrictMe->display(); $new_loc = self::outputLocation(); } else { foreach ($this->_locations as $value) { //print "<pre>";print_r($value);print "</pre>"; // SELECT l.location_id, format, call_number, location, access_restrictions, eres_display, display_note, ctags // FROM location_title lt, location l // WHERE lt.location_id = l.location_id AND lt.title_id = " . $this->_record_id; ///////////////// // Hidden location id /////////////////// $this->_location_id = $value[0]; ///////////////// // Location > Url (or call number) ///////////////// $this->_location = $value["location"]; // create format box $formatMe = new Dropdown("format[]", $formatArray, $value["format"]); $this->_formats = $formatMe->display(); $this->_format = $value["format"]; // create restrictions box $restrictMe = new Dropdown("access_restrictions[]", $restrictionsArray, $value["access_restrictions"]); $this->_restrictions = $restrictMe->display(); /////////////// // Display Note /////////////// $this->_note = $value["display_note"]; $this->_display_note = $value["display_note"]; /////////////// // A-Z List /////////////// $this->_az_display = $value["eres_display"]; /////////////// // Secret? call number /////////////// $this->_call_number = $value["call_number"]; ////////////// // Ctags ////////////// $this->_ctags = $value["ctags"]; ////////////// // Help Guide ////////////// $this->_helpguide = $value["helpguide"]; $new_loc = self::outputLocation(); $this->_boxcount++; } // End location inner loop } // End location test outer loop }
} else { $postvar_faq_id = ""; } if (isset($_POST['searchterm'])) { $search_clause = scrubData($_POST['searchterm']); } else { $search_clause = ''; } //////////////// // Get list of subjects for sidebar /////////////// $db = new Querier(); $q2 = "select distinct s.subject_id, s.subject\n from faq f, faq_subject fs, subject s \n WHERE f.faq_id = fs.faq_id \n AND fs.subject_id = s.subject_id\n AND active = '1'\n ORDER BY subject"; $oursubs = $db->query($q2); if ($oursubs) { $guideMe = new Dropdown("subject_id", $oursubs, $postvar_subject_id, "40"); $guide_string = $guideMe->display(); } /* Set local variables */ $suggestion_text = ''; if (isset($_REQUEST['searchterm']) && $_REQUEST['searchterm'] && $_REQUEST['searchterm'] != $suggestion_text) { $displaytype = "search"; $page_title = "Library FAQs: Search Results"; } elseif (isset($_GET['page']) && $_GET['page'] == "all") { $displaytype = "all"; $page_title = "Show All FAQs"; } elseif ($postvar_subject_id != "") { $displaytype = "bysubject"; $page_title = "FAQs by Subject"; } elseif ($postvar_coll_id != "") { $displaytype = "collection";