Skip to content
Snippets Groups Projects
Commit b08ed9e7 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #64573 fix records widget sources

parent fd9d8fc0
Branches
Tags
3 merge requests!3297WIP: Master,!3037Master,!2988Dev#64573 templates pour l interface publique libraire bootstrap
Pipeline #5582 passed with stage
in 43 minutes and 29 seconds
......@@ -506,4 +506,9 @@ class Class_PanierNotice extends Storm_Model_Abstract {
$this->setUser($user);
$this->getLoader()->save($this); //skip beforeSave to keep date_maj
}
public function asWhere() {
return sprintf('clef_alpha in("%s")', implode('","', $this->getClesNotices()));
}
}
\ No newline at end of file
......@@ -123,23 +123,7 @@ class Intonation_Library_Widget_Carousel_Record_View extends Zendafi_View_Helper
protected function _getHTML() {
$order = $this->_settings->getOrder();
$selection_id = $this->_settings->getIdPanier();
if ('selection' == $order && !$selection_id)
$order = Class_CriteresRecherche::SORT_RANDOM;
$params = ['limit' => 100,
'order' => new Zend_Db_Expr('url_image="no", url_image="", ' . $order)];
if ($domain = Class_Catalogue::find($this->_settings->getIdCatalogue()))
$params ['where'] = $domain->asWhere();
if ($selection = Class_PanierNotice::find($selection_id))
$params ['where'] = sprintf('clef_alpha in(%s)',
implode(',', $records_key));
if (!$records = Class_Notice::findAllBy($params))
if (!$records = $this->_findRecordsFrom($this->_settings))
return $this->_tag('p', $this->_('Aucun document'));
$records = array_slice($records, 0, $this->_settings->getNbNotices());
......@@ -160,4 +144,31 @@ class Intonation_Library_Widget_Carousel_Record_View extends Zendafi_View_Helper
return $this->view->renderMultipleCarousel($records);
}
protected function _findRecordsFrom($settings) {
$order = $settings->getOrder();
$selection_id = $settings->getIdPanier();
if ('selection' == $order && !$selection_id)
$order = Class_CriteresRecherche::SORT_RANDOM;
$params = ['limit' => 100,
'order' => new Zend_Db_Expr('url_image="no", url_image="", ' . $order)];
if ($domain = Class_Catalogue::find($settings->getIdCatalogue())) {
$params ['where'] = $domain->asWhere();
return Class_Notice::findAllBy($params);
}
if (!$selection = Class_PanierNotice::find($selection_id))
return Class_Notice::findAllBy($params);
if ('selection' == $order)
return $selection->getNoticesAsArray();
$params ['where'] = $selection->asWhere();
return Class_Notice::findAllBy($params);
}
}
\ 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