Skip to content
Snippets Groups Projects
Commit 900957bd authored by lbrun's avatar lbrun
Browse files

hotline #30015 : refacto

parent 53bb579f
Branches
Tags
1 merge request!1157Hotline#30015 pas de lien de retour depuis l explorateur de fichiers
......@@ -333,30 +333,31 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdmin extends ZendAfi_View_Helper_Base
return($html);
}
function addMenu($img,$titre,$lien, $access_allowed, $options=[]) {
if (!$access_allowed) return '';
function addMenu($img, $titre, $lien, $access_allowed, $options=[]) {
if (!$access_allowed)
return '';
if(!preg_match('^http://^',$lien))
$lien = BASE_URL.$lien;
$target = isset($options['target'])
? ' target="' . $options['target'] . '"'
: '';
$ico = '<img src="'.URL_ADMIN_IMG.'picto/'.$img.'" alt="'.$titre.'" />';
$url= ['START'=>'<a href="'.$lien.'"'.$target.'>',
'END'=>'</a>'];
$lien = BASE_URL . $lien;
$extra_infos = isset($options['extra_infos'])
? '<span class="menu_info">' . $options['extra_infos'] . '</span>'
: '';
$class_selected = '';
if (array_key_exists('REQUEST_URI', $_SERVER)
and false !== strpos($_SERVER['REQUEST_URI'], $lien)) {
$class_selected = 'class="selected"';
}
$attributes = (array_key_exists('REQUEST_URI', $_SERVER)
&& false !== strpos($_SERVER['REQUEST_URI'], $lien))
? ['class' => 'selected']
: [];
$anchor_params = ['href' => $lien];
if (isset($options['target']))
$anchor_params['target'] = $options['target'];
$ico = $this->_tag('img', null,
['src' => URL_ADMIN_IMG . 'picto/' . $img,
'alt' => $titre]);
$html = '<li '.$class_selected.'>'.$ico.$url["START"].$titre.$url["END"].$extra_infos.'</li>';
return ($html);
return $this->_tag('li',
$ico . $this->_tag('a', $titre, $anchor_params) . $extra_infos,
$attributes);
}
}
......@@ -30,6 +30,7 @@ abstract class ZendAfi_View_Helper_Admin_MenuGaucheAdminVariableBibnumDisabledTe
Class_AdminVar::newInstanceWithId('BIBNUM', ['valeur' => 0]);
$this->helper = new ZendAfi_View_Helper_Admin_MenuGaucheAdmin();
$this->helper->setView($this->view);
}
}
......
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