From: Demian K. <dem...@vi...> - 2012-09-19 12:37:50
|
This is getting technical, so I'm moving this to the tech list. All of the code I suggested can go in web/RecordDrivers/MarcRecord.php. (You can add some more complicated steps to isolate the code changes from the core VuFind code -- I alluded to this in the previous email -- but in the interest of brevity I won't repeat all of that; see http://vufind.org/wiki/other_than_marc#record_display for details). I think I gave all the code in my previous email, but let me refactor it a little for clarity: Here is a new support function you can use: protected function hasBlacklistedFormat() { $blacklist = array('format1', 'format2', 'format3'); $myFormats = $this->getFormats(); foreach ($blacklist as $current) { if (in_array($current, $myFormats)) { return true; } } return false; } (Obviously you need to edit $blacklist to meet your needs). Now at the top of the existing getRealTimeHoldings() method, you can add: if ($this->hasBlacklistedFormat()) { return array(); } Elsewhere in the file, you can replace: $interface->assign('summAjaxStatus', true); with: $interface->assign('summAjaxStatus', !$this->hasBlacklistedFormat()); None of that code is tested... but hopefully it gives you the general idea. - Demian > -----Original Message----- > From: Katharina Wolkwitz [mailto:wol...@fh...] > Sent: Wednesday, September 19, 2012 4:01 AM > To: vuf...@li... > Subject: Re: [VuFind-General] Using ILS-query dependent of record-format-type > > Hi Demian, > > thanks for the answer to my mail - using an approach outside the ILS-driver > itself seems better to me as well. :-) > > How would I go about checking the formats of the current record against a > blacklist of bad formats, returning an empty holdings array if you find a > match? > Would I need to call the function "public Set getFormat(Record record){" from > import\index_scripts\format.bsh? > And how exactly would I have to do that? Can you point me to a file where such > a > call is already in place, so I can base my code on that? > > Could you also point my to the file(s) where hasBlacklistedFormat() and > getSearchResult method live? > > Sorry to be such a programming dummy. :-( > > Kate > > Am 18.09.2012 15:30 schrieb Demian Katz: > > Another possible approach would be to modify the > > web/RecordDrivers/MarcRecord.php's getRealTimeHoldings() method to start > with > > something like: > > > > $blacklist = array('format1', 'format2', 'format3'); $myFormats = > > $this->getFormats(); foreach ($blacklist as $current) { if > > (in_array($current, $myFormats)) { return array(); } } > > > > Then you check the formats of the current record against a blacklist of bad > > formats, returning an empty holdings array if you find a match. No need to > > change any driver code, etc. > > > > You could use similar logic (ideally refactored to a support method like > > hasBlacklistedFormat()) to adjust the summAjaxStatus variable set in the > > getSearchResult method. > > > > If you want to make this change without modifying core code, you can create > a > > custom record driver as a subclass of MarcRecord and reindex your records > > with a different recordtype that points to your custom driver... or, > > alternatively, you can modify the code in-place for now and worry about > > better separation after upgrading to 2.0 (when this will be easier and won't > > require reindexing). > > > > - Demian > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > VuFind-General mailing list > VuF...@li... > https://lists.sourceforge.net/lists/listinfo/vufind-general |