/**
* @file
* @brief Utility , library of icon with javascript
*/
/**
* @brief Utility , library of icon with javascript
*/
class Icon_Action
{
/**
* Display a icon with a magnify glass
* @param string $id id of element
* @param string $p_javascript
* @param string $p_style optionnal HTML code
* @return type
*/
static function icon_magnifier($id, $p_javascript, $p_style="")
{
$r="";
$r.=sprintf('%s',
$id, $p_style, $p_javascript,ICON_SEARCH);
return $r;
}
/**
* Display a icon with a magnify glass
* @param string $id id of element
* @param string $p_javascript
* @param string $p_style optionnal HTML code
* @return type
*/
static function button_magnifier($id, $p_javascript, $p_style="")
{
$r="";
$r.=sprintf('',
$id, $p_style, $p_javascript,ICON_SEARCH);
return $r;
}
/**
*
* @param type $id
* @param type $p_javascript
* @param type $p_style
* @return type
*/
static function icon_add($id, $p_javascript, $p_style="")
{
$r=sprintf('',
$p_javascript, $id, $p_style);
return $r;
}
/**
*
* @param string $id
* @param string $p_javascript
* @param string opt $p_style
* @return html string
*/
static function clean_zone($id, $p_javascript, $p_style="")
{
$r=sprintf('',
$p_javascript, $id, ICON_CLEAN,$p_style
);
return $r;
}
/**
* Display a info in a bubble, text is in message_javascript
* @param integer $p_comment
* @see message_javascript.php
* @return html string
*/
static function infobulle($p_comment)
{
$r='';
$r.="";
$r.='';
return $r;
}
/**
* Display a info in a bubble, text is given as parameter
* @param string $p_comment
*
* @return html string
*/
static function tips($p_comment)
{
$p_comment=noalyss_str_replace("'",' ',$p_comment);
$r='';
$r.="";
$r.='';
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=noalyss_str_replace("'",' ',$p_comment);
$js=sprintf("displayBulle('%s')",$p_comment);
$r=sprintf('',
$js,$js);
$r.="";
$r.='';
return $r;
}
/**
* Display a icon ON
* @param string $p_div id of element
* @param string $p_javascript
* @param string $p_style optionnal HTML code
* @return html string
*/
static function iconon($p_id, $p_javascript, $p_style="")
{
$r=sprintf('',
$p_id, $p_style, $p_javascript);
return $r;
}
/**
* Display a icon OFF
* @param string $p_div id of element
* @param string $p_javascript
* @param string $p_style optionnal HTML code
* @return html string
*/
static function iconoff($p_id, $p_javascript, $p_style="")
{
$r=sprintf('',
$p_id, $p_style, $p_javascript);
return $r;
}
/**
* Return a html string with an anchor which close the inside popup. (top-right corner)
* @param name of the DIV to close
*/
static function close($p_div)
{
$r='';
$r.=sprintf('',
$p_div);
return $r;
}
/**
* Display a icon for fix or move a div
* @param string $p_div id of the div to fix/move
* @param string $p_javascript
* @return html string
*/
static function draggable($p_div)
{
$drag=sprintf(''.UNPINDG.'',
$p_div, $p_div);
return $drag;
}
/**
* Display a icon for zooming
* @param string $p_div id of the div to zoom
* @param string $p_javascript
* @return html string
*/
static function zoom($p_div, $p_javascript)
{
$r=sprintf('
', $p_div, $p_javascript);
return $r;
}
/**
* Display a warning in a bubble, text is in message_javascript
* @param integer $p_comment
* @see message_javascript.php
* @return html string
*/
static function warnbulle($p_comment)
{
$r=sprintf('',
$p_comment, $p_comment);
return $r;
}
/**
* Return a html string with an anchor to hide a div, put it in the right corner
* @param $action action action to perform (message)
* @param $javascript javascript
* @note not protected against html
* @see Acc_Ledger::display_search_form
*/
static function hide($action, $javascript)
{
$r='';
$r.=''.$action.'';
return $r;
}
/**
* Return a html string with an anchor to hide a div, put it in the right corner
* @param $action action action to perform (message)
* @param $javascript javascript
* @note not protected against html
* @see Acc_Ledger::display_search_form
*/
static function hide_icon( $p_id,$javascript)
{
$r='';
$r.=''."".'';
return $r;
}
/**
* Return a html string with an eye
* @param type $javascript
* @return string
*/
static function show_icon($p_id,$javascript) {
$r='';
$r.='';
return $r;
}
/**
* Display the icon of a trashbin
* @param string $p_id DOMid
* @param string $p_javascript
* @return htmlString
*/
static function trash($p_id,$p_javascript)
{
$r='';
return $r;
}
/**
* Display the icon to modify a idem
* @param type $p_id
* @param type $p_javascript
* @return string
*/
static function modify($p_id,$p_javascript)
{
$r='';
return $r;
}
/**
* Display the icon to modify a idem
* @param type $p_id
* @param type $p_javascript
* @return string
*/
static function validate($p_id,$p_javascript)
{
$r='';
return $r;
}
/**
* Display the icon to modify a idem
* @param type $p_id
* @param type $p_javascript
* @return string
*/
static function cancel($p_id,$p_javascript)
{
$r='';
return $r;
}
static function detail($p_id,$p_javascript)
{
$r=sprintf('',
$p_id,
$p_javascript);
return $r;
}
static function detail_anchor($p_id,$url)
{
$r=sprintf('
',
$url
,$p_id);
return $r;
}
static function more($p_id,$p_javascript)
{
$r=sprintf('',
$p_id,
$p_javascript);
return $r;
}
static function less($p_id,$p_javascript)
{
$r=sprintf('',
$p_id,
$p_javascript);
return $r;
}
/**
* When a mouse is over this or if you click on it , it will trigger the javascript
* @param domid $p_id
* @param string $p_javascript
* @return html string
*/
static function menu_click($p_id,$p_javascript)
{
$r=sprintf('',
$p_id,
$p_javascript);
return $r;
}
/**
* Display the icon of a padlock to lock or unlock element
* @param string $p_id DOMid
* @param string $p_javascript
* @return htmlString
*/
static function lock($p_id,$p_javascript)
{
$lock_cur="";
$lock_next="";
$r=sprintf( '%s',
$p_id,
$p_id,
$p_javascript,
$lock_cur);
return $r;
}
/**
* Display the icon of a trashbin
* @param string $p_id DOMid
* @param string $p_javascript
* @return htmlString
*/
static function unlock($p_id,$p_javascript)
{
$lock_cur="";
$r=sprintf( '%s',
$p_id,
$p_id,
$p_javascript,
$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="";
$r=sprintf( '%s',
$p_id,
$p_javascript,
$lock_cur);
return $r;
}
/**
* Display a icon ON is $p_value == 1 otherwise OFF
* @param string $p_div id of element
* @param string $p_javascript
* @param string $p_style optionnal HTML code
* @param integer 0 or 1 , 0 means OFF and 1 means ON
* @return html string
*/
static function icon_onoff($p_id,$p_javascript,$p_style,$p_value)
{
if ( $p_value == 1 ) { return \Icon_Action::iconon($p_id, $p_javascript,$p_style);}
if ( $p_value == 0 ) { return \Icon_Action::iconoff($p_id, $p_javascript,$p_style);}
}
static function checked ($p_id,$p_javascript="",$p_classrange="") {
$lock_cur="";
$r=sprintf( '%s',
$p_id,
$p_javascript,
$p_classrange,
$lock_cur);
return $r;
}
static function unchecked ($p_id,$p_javascript="",$p_classrange="") {
$lock_cur="";
$r=sprintf( '%s',
$p_id,
$p_javascript,
$p_classrange,
$lock_cur);
return $r;
}
static function checkbox ($p_id,$p_javascript="",$p_value=0,$p_classrange="") {
if ( $p_value == 0 ) { return \Icon_Action::checked($p_id, $p_javascript,$p_classrange); }
if ( $p_value == 1 ) { return \Icon_Action::unchecked($p_id, $p_javascript,$p_classrange);}
}
static function full_size($p_div) {
$js=sprintf("full_size('%s')",$p_div);
$icon="";
$r=sprintf('%s',
$p_div,$js,$icon);
return $r;
}
static function duplicate($p_js) {
$r=sprintf('%s',
uniqid(),$p_js,"");
return $r;
}
static function card($p_js) {
$r=sprintf('%s',
uniqid(),$p_js,"");
return $r;
}
static function option($p_js) {
$r=sprintf('%s',
uniqid(),$p_js,"");
return $r;
}
/**
* @brief Increase size of input_text (p_domid) with p_domid
* @param $p_domid domid of the input "text" element
* @param $p_size size of the element
* @return string HTML string
*/
static function longer($p_domid,$p_size) {
$r=sprintf('%s',
$p_domid,$p_domid,$p_size,"");
return $r;
}
/**
* @brief Increase size of input_text (p_domid) with p_domid
* @param $p_domid domid of the input "text" element
* @param $p_size size of the element
* @return string HTML string
*/
static function show_note($p_domid) {
$r='';
return $r;
}
/**
* @brief hide or display an element, to be used for an accordon
* @param $p_id ip of the icon
* @param $p_id_to_hide element to hide or show
* @return HTML string
*/
static function toggle_hide($p_id,$p_id_to_hide)
{
$javascript=sprintf("toggleHideShow('%s','%s',true)",$p_id_to_hide,$p_id);
$r=sprintf('',
$p_id,$javascript
);
return $r;
}
}