Skip to content
Snippets Groups Projects
Commit c93d62d1 authored by gloas's avatar gloas
Browse files

fix test failures on avis edit link

parent 8287f64f
Branches
Tags
5 merge requests!366Master,!365Master,!364Master,!363Master,!361Hotline 6.50
......@@ -16,28 +16,21 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_Notice_Avis extends Zend_View_Helper_HtmlElement {
use Trait_Translator;
public function Notice_Avis($notice,$avis,$params) {
$id_notice = $notice->getId();
$cls_rating = $this->view->getHelper('NoteImg');
// Identité user connecté
$user = Zend_Auth::getInstance()->getIdentity();
$user = Class_Users::getIdentity();
// Debut html
$html='<table cellspacing="0" width="100%">';
$url_avis = '';
if ((Class_AdminVar::get('AVIS_BIB_SEULEMENT') != 1) or ($user->ROLE_LEVEL > 2))
$url_avis=sprintf('<a data-popup="true" class=notice href="%s">&raquo;&nbsp;%s</a>',
$this->view->url(['controller' => 'noticeajax',
'action' => 'add-avis',
'id_notice' => $id_notice]),
$this->_('Donnez ou modifiez votre avis'));
$url_avis = $this->getAvisLink($user);
$html.='<tr><td style="text-align:left" colspan="3">'.$url_avis.'</td></tr>';
$html.='<tr><td colspan="3"><ul class="notice_info" style="margin-top:2px">';
......@@ -52,7 +45,7 @@ class ZendAfi_View_Helper_Notice_Avis extends Zend_View_Helper_HtmlElement {
if (isset($params['onglet']) && (substr($params["onglet"],0,4)) == "bloc") $fct="infos_bloc"; else $fct="infos_onglet";
$url_site="javascript:".$fct."('".$params["onglet"]."','".$id_notice."','avis','".$source."',1,1)";
if($nb > 0)
if($nb > 0)
$html.='<li>'.$cls_rating->NoteImg($ligne["note"]).'&nbsp;&nbsp;<a class="notice" href="'.$url_site.'">'. $avis[$source]["titre"]. ' </a><small>('.$ev.")</small></li>";
}
$html.='</ul></td></tr>';
......@@ -69,7 +62,7 @@ class ZendAfi_View_Helper_Notice_Avis extends Zend_View_Helper_HtmlElement {
if($source) {
$avis_helper = $this->view->getHelper('Avis');
if (($user = Class_Users::getIdentity())
if (($user = Class_Users::getIdentity())
&& $user->isBibliothecaire())
$avis_helper->setAdminActions(['edit', 'del']);
......@@ -98,6 +91,21 @@ class ZendAfi_View_Helper_Notice_Avis extends Zend_View_Helper_HtmlElement {
$html.='</table>';
return $html;
}
protected function getAvisLink($user) {
if(!$user)
return '';
return ((Class_AdminVar::get('AVIS_BIB_SEULEMENT') != 1) or ($user->getRoleLevel() > ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB))
? $this->view->tagAnchor($this->view->url(['controller' => 'noticeajax',
'action' => 'add-avis',
'id_notice' => $id_notice]),
$this->_('Donnez ou modifiez votre avis'),
['class' => 'notice',
'data-popup' => true])
: '';
}
}
?>
\ 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