Skip to content

Instantly share code, notes, and snippets.

@xmorave2
Last active May 26, 2017 09:03
Show Gist options
  • Select an option

  • Save xmorave2/55240ac35326bc07e12f1ea5c0aa2528 to your computer and use it in GitHub Desktop.

Select an option

Save xmorave2/55240ac35326bc07e12f1ea5c0aa2528 to your computer and use it in GitHub Desktop.
Série - 787 vufind:
<? $serie = $this->driver->getSerie();?>
<? if (!empty($serie)): ?>
<tr>
<th><?=$this->transEsc('Serie')?>: </th>
<td>
<? foreach($serie as $s): ?>
<a href="<?=$this->record($this->driver)->getLink('series787', $s["title"])?>"><?=$s["title"]?></a><? echo ", " . $this->translate("part") . " " . $s["part"] ?><br/>
<? endforeach; ?>
</td>
</tr>
<? endif; ?>
part = "část"
Serie = "Série"
series787 = 787t
<? $serie = $this->driver->getSerie();?>
<? if (!empty($serie)): ?>
<? foreach($serie as $s): ?>
<br/><?=$this->transEsc('Serie')?>: <a href="<?=$this->record($this->driver)->getLink('series787', $s["title"])?>"><?=$s["title"]?></a><? echo ", " . $this->translate("part") . " " . $s["part"] ?><br/>
<? endforeach; ?>
<? endif; ?>
<!-- Série - dílovky -->
<field name="series787" type="text" indexed="true" stored="true" multiValued="true"/>
Series787:
DismaxFields:
- series787
QueryFields:
series787:
- [onephrase, 50]
- [and, 50]
- [or, ~]
public function getSerie()
{
$ret = [];
$fields = $this->getMarcRecord()->getFields('787');
foreach ($fields as $field) {
if (strpos($field->getSubfield('i')->getData(), 'Z cyklu') !== false) {
$subfield_g = $field->getSubfield('g');
$subfield_t = $field->getSubfield('t');
$ret[] = [
"title" => $subfield_t ? $subfield_t->getData() : false,
"part" => $subfield_g ? $subfield_g->getData() : false,
];
}
}
return $ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment