From a4879c8632c27476984b9d3b1f67d42da7715b02 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Thu, 6 Jul 2017 10:21:05 -0400 Subject: [PATCH] Make NoILS driver play nicely with course reserves. - Resolves VUFIND-1232. --- module/VuFind/src/VuFind/ILS/Driver/NoILS.php | 64 ++++++++++++++ .../templates/search/reserves.phtml | 85 ++++++++++--------- 2 files changed, 110 insertions(+), 39 deletions(-) diff --git a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php index 523ff210a03..b53bdd0a666 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/NoILS.php +++ b/module/VuFind/src/VuFind/ILS/Driver/NoILS.php @@ -379,4 +379,68 @@ class NoILS extends AbstractBase implements TranslatorAwareInterface // Block authentication: return null; } + + /** + * Get Departments + * + * Obtain a list of departments for use in limiting the reserves list. + * + * @throws ILSException + * @return array An associative array with key = dept. ID, value = dept. name. + */ + public function getDepartments() + { + // Does not work while ILS offline: + return []; + } + + /** + * Get Instructors + * + * Obtain a list of instructors for use in limiting the reserves list. + * + * @throws ILSException + * @return array An associative array with key = ID, value = name. + */ + public function getInstructors() + { + // Does not work while ILS offline: + return []; + } + + /** + * Get Courses + * + * Obtain a list of courses for use in limiting the reserves list. + * + * @throws ILSException + * @return array An associative array with key = ID, value = name. + */ + public function getCourses() + { + // Does not work while ILS offline: + return []; + } + + /** + * Find Reserves + * + * Obtain information on course reserves. + * + * This version of findReserves was contributed by Matthew Hooper and includes + * support for electronic reserves (though eReserve support is still a work in + * progress). + * + * @param string $course ID from getCourses (empty string to match all) + * @param string $inst ID from getInstructors (empty string to match all) + * @param string $dept ID from getDepartments (empty string to match all) + * + * @throws ILSException + * @return array An array of associative arrays representing reserve items. + */ + public function findReserves($course, $inst, $dept) + { + // Does not work while ILS offline: + return []; + } } diff --git a/themes/bootstrap3/templates/search/reserves.phtml b/themes/bootstrap3/templates/search/reserves.phtml index 2760ff0deee..1ed5be825d1 100644 --- a/themes/bootstrap3/templates/search/reserves.phtml +++ b/themes/bootstrap3/templates/search/reserves.phtml @@ -4,45 +4,52 @@ // Set up breadcrumbs: $this->layout()->breadcrumbs = '<li class="active">' . $this->transEsc('Reserves') . '</li>'; + + // Convenience variable: + $offlineMode = $this->ils()->getOfflineMode(); ?> -<h2><?=$this->transEsc('Search For Items on Reserve')?></h2> -<form method="get" name="searchForm" class="form-search-reserves"> - <? if (is_array($this->courseList)): ?> - <div class="form-group"> - <label for="reserves_by_course" class="control-label"><?=$this->transEsc('By Course')?>:</label> - <select name="course" id="reserves_by_course" class="form-control"> - <option></option> - <? foreach ($this->courseList as $courseId => $courseName): ?> - <option value="<?=$this->escapeHtmlAttr($courseId)?>"><?=$this->escapeHtml($courseName)?></option> - <? endforeach; ?> - </select> - <input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Find')?>"/> - </div> - <? endif; ?> +<? if ($offlineMode == "ils-offline"): ?> + <?=$this->render('Helpers/ils-offline.phtml', ['offlineModeMsg' => 'ils_offline_holdings_message'])?> +<? else: ?> + <h2><?=$this->transEsc('Search For Items on Reserve')?></h2> + <form method="get" name="searchForm" class="form-search-reserves"> + <? if (is_array($this->courseList)): ?> + <div class="form-group"> + <label for="reserves_by_course" class="control-label"><?=$this->transEsc('By Course')?>:</label> + <select name="course" id="reserves_by_course" class="form-control"> + <option></option> + <? foreach ($this->courseList as $courseId => $courseName): ?> + <option value="<?=$this->escapeHtmlAttr($courseId)?>"><?=$this->escapeHtml($courseName)?></option> + <? endforeach; ?> + </select> + <input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Find')?>"/> + </div> + <? endif; ?> - <? if (is_array($this->instList)): ?> - <div class="form-group"> - <label for="reserves_by_inst" class="control-label"><?=$this->transEsc('By Instructor')?>:</label> - <select name="inst" id="reserves_by_inst" class="form-control"> - <option></option> - <? foreach ($this->instList as $instId => $instName): ?> - <option value="<?=$this->escapeHtmlAttr($instId)?>"><?=$this->escapeHtml($instName)?></option> - <? endforeach; ?> - </select> - <input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Find')?>"/> - </div> - <? endif; ?> + <? if (is_array($this->instList)): ?> + <div class="form-group"> + <label for="reserves_by_inst" class="control-label"><?=$this->transEsc('By Instructor')?>:</label> + <select name="inst" id="reserves_by_inst" class="form-control"> + <option></option> + <? foreach ($this->instList as $instId => $instName): ?> + <option value="<?=$this->escapeHtmlAttr($instId)?>"><?=$this->escapeHtml($instName)?></option> + <? endforeach; ?> + </select> + <input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Find')?>"/> + </div> + <? endif; ?> - <? if (is_array($this->deptList)): ?> - <div class="form-group"> - <label for="reserves_by_dept" class="control-label"><?=$this->transEsc('By Department')?>:</label> - <select name="dept" id="reserves_by_dept" class="form-control"> - <option></option> - <? foreach ($this->deptList as $deptId => $deptName): ?> - <option value="<?=$this->escapeHtmlAttr($deptId)?>"><?=$this->escapeHtml($deptName)?></option> - <? endforeach; ?> - </select> - <input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Find')?>"/> - </div> - <? endif; ?> -</form> + <? if (is_array($this->deptList)): ?> + <div class="form-group"> + <label for="reserves_by_dept" class="control-label"><?=$this->transEsc('By Department')?>:</label> + <select name="dept" id="reserves_by_dept" class="form-control"> + <option></option> + <? foreach ($this->deptList as $deptId => $deptName): ?> + <option value="<?=$this->escapeHtmlAttr($deptId)?>"><?=$this->escapeHtml($deptName)?></option> + <? endforeach; ?> + </select> + <input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Find')?>"/> + </div> + <? endif; ?> + </form> +<? endif; ?> -- GitLab