Skip to content
Snippets Groups Projects
Commit b75b4058 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

rel #16325: add items list in inspector gadget

parent b87433ed
Branches
Tags
3 merge requests!780Master,!755Stable,!752Sandbox#16325 inspector gadget record items
......@@ -73,6 +73,34 @@ class Class_Exemplaire extends Storm_Model_Abstract {
}
public function getSectionLabel() {
return $this->_getCodifLabel('section', 'Class_CodifSection');
}
public function getKindLabel() {
return $this->_getCodifLabel('genre', 'Class_CodifGenre');
}
public function getLocationLabel() {
return $this->_getCodifLabel('emplacement', 'Class_CodifEmplacement');
}
protected function _getCodifLabel($attrib, $codif_class) {
if (!$this->_has($attrib))
return '';
$label = $this->_get($attrib) . ' ';
if ($codif = $codif_class::find($this->_get($attrib)))
$label .= $codif->getLibelle();
return $label;
}
public function getDateRetour() {
if ($this->hasPret())
return $this->getPret()->getDateRetour();
......
......@@ -32,7 +32,27 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement {
$reader->setNotice($notice->getUnimarc(), 0);
$reader->acceptVisitor($this);
return $this->renderHeader($notice) . '<hr>' . $this->renderZones();
Class_ScriptLoader::getInstance()
->addJQueryReady('$(".ig-tabs").tabs({activate: function(event, ui) {
if (ui.newPanel.attr("id") == "ig-tab-items")
ui.newPanel.accordion();
}});');
return $this->renderHeader($notice) . '<hr>'
. $this->_tag('div',
$this->renderTabs()
. $this->renderZones()
. $this->renderItems($notice),
['class' => 'ig-tabs']);
}
protected function renderTabs() {
return $this->_tag('ul',
$this->_tag('li', $this->_tag('a', $this->_('Zones'),
['href' => '#ig-tab-zones']))
. $this->_tag('li', $this->_tag('a', $this->_('Exemplaires'),
['href' => '#ig-tab-items'])));
}
......@@ -41,15 +61,15 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement {
foreach($this->_headers as $k => $v)
$html .= $k . ' : ' . $v . '<br>';
$button = $this->view->tag('button', $this->_('Télécharger'),
['style' => 'float:right;font-size:80%',
'onclick' => 'window.location.href=\''
.$this->view->url(['controller' => 'recherche',
'action' => 'download-record',
'id' => $notice->getId()],
null, true).'\'']);
$button = $this->_tag('button', $this->_('Télécharger'),
['style' => 'float:right;font-size:80%',
'onclick' => 'window.location.href=\''
.$this->view->url(['controller' => 'recherche',
'action' => 'download-record',
'id' => $notice->getId()],
null, true).'\'']);
return $this->view->tag('h2', $this->_('Notice unimarc') . $button) . $html;
return $this->_tag('h2', $this->_('Notice unimarc') . $button) . $html;
}
......@@ -58,7 +78,45 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement {
foreach ($this->_zones as $zone)
$html .= $zone->render();
return $this->view->tag('table', $html);
return $this->_tag('div', $this->_tag('table', $html),
['id' => 'ig-tab-zones']);
}
protected function renderItems($notice) {
$mapping = ['getCote' => $this->_('Cote'),
'getSectionLabel' => $this->_('Section'),
'getKindLabel' => $this->_('Genre'),
'getAnnexe' => $this->_('Annexe'),
'getLocationLabel' => $this->_('Emplacement'),
'getActivite' => $this->_('Activité'),
'getIdOrigine' => $this->_('Id origine'),
'getDateNouveaute' => $this->_('Date nouveaté')];
foreach($notice->getExemplaires() as $item)
$html .= $this->renderItem($item, $mapping);
return $this->_tag('div', $html,
['id' => 'ig-tab-items',
'style' => 'height:100%']);
}
protected function renderItem($item, $mapping) {
$html = '';
foreach($mapping as $getter => $label)
$html .= $this->_tag('strong', $label . ' : ')
. call_user_func([$item, $getter])
. $this->_tag('br');
$html .= $this->renderItem995($item);
return $this->_tag('h3', $item->getBibLibelle() . ' ' . $item->getCodeBarres())
. $this->_tag('div', $html);
}
protected function renderItem995($item) {
return $this->_tag('hr') . $item->zone995toString();
}
......@@ -89,6 +147,11 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement {
public function visitZone($name, $value) {
$this->_zones[] = new ZendAfi_View_Helper_Notice_UnimarcZone($this->view, $name, $value);
}
protected function _tag() {
return call_user_func_array([$this->view, 'tag'], func_get_args());
}
}
......@@ -129,18 +192,23 @@ class ZendAfi_View_Helper_Notice_UnimarcZone {
$style = 'vertical-align:top;';
return $this->view
->tag('tr',
$this->view->tag('td', $first ? $this->_label : '',
['style' => $style . 'font-weight:bolder;'])
. $this->view->tag('td',
$first
? $this->_fields['indicateur1']
. $this->_fields['indicateur2']
: '',
['style' => $style])
. $this->view->tag('td', $name, ['style' => $style . 'color:green;'])
. $this->view->tag('td', $value, ['style' => $style])
$this->_tag('td', $first ? $this->_label : '',
['style' => $style . 'font-weight:bolder;'])
. $this->_tag('td',
$first
? $this->_fields['indicateur1']
. $this->_fields['indicateur2']
: '',
['style' => $style])
. $this->_tag('td', $name, ['style' => $style . 'color:green;'])
. $this->_tag('td', $value, ['style' => $style])
);
}
protected function _tag() {
return call_user_func_array([$this->view, 'tag'], func_get_args());
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment