New : icon_action:slider icon_action:comment

and fix single quote issue in icon_action:tips
This commit is contained in:
Dany De Bontridder 2019-08-27 19:28:38 +02:00
parent 7de5af784c
commit 5e291fc48f
2 changed files with 42 additions and 1 deletions

View file

@ -96,13 +96,31 @@ class Icon_Action
*/
static function tips($p_comment)
{
$p_comment=htmlentities($p_comment);
$p_comment=str_replace("'",' ',$p_comment);
$r='<span tabindex="-1" class="icon" style="cursor:pointer;display:inline;text-decoration:none;" onmouseover="displayBulle(\''.$p_comment.'\')" onclick="displayBulle(\''.$p_comment.'\')" onmouseout="hideBulle(0)">';
$r.="&#xf086;";
$r.='</span>';
return $r;
}
/**
* Display a info in a bubble, text is given as parameter
* @param string $p_comment
*
* @return html string
*/
static function comment($p_comment)
{
$p_comment=str_replace("'",' ',$p_comment);
$js=sprintf("displayBulle('%s')",$p_comment);
$r=sprintf('<span tabindex="-1" class="icon" style="cursor:pointer;display:inline;text-decoration:none;" onmouseover="%s" onclick="%s" onmouseout="hideBulle(0)">',
$js,$js);
$r.="&#xf0e5;";
$r.='</span>';
return $r;
}
/**
* Display a icon ON
* @param string $p_div id of element
@ -307,4 +325,21 @@ class Icon_Action
$lock_cur);
return $r;
}
/**
* Display the icon of a slider
* @param string $p_id DOMid
* @param string $p_javascript
* @return htmlString
*/
static function slider($p_id,$p_javascript)
{
$lock_cur="&#xf1de;";
$r=sprintf( '<span id="%s" onclick="%s" class="icon smallicon">%s</span>',
$p_id,
$p_javascript,
$lock_cur);
return $r;
}
}

View file

@ -77,4 +77,10 @@ include_once NOALYSS_INCLUDE."/lib/icon_action.class.php";
</p>
<p>
Tips <?php echo Icon_Action::tips("Allo ?")?>
</p>
<p>
Slider <?php echo Icon_Action::slider(uniqid(), "alert('test')")?>
</p>
<p>
Comment<?php echo Icon_Action::comment("Allo ? l'heure d'été ?")?>
</p>