25namespace Noalyss\Widget;
38 public function __construct(
protected int $user_widget_id=0,
protected string $widget_code=
"",
protected $db=
null)
41 $this->
db=\Dossier::connect();
65 return $this->user_widget_id;
70 $this->user_widget_id = $user_widget_id;
76 return $this->widget_code;
81 $this->widget_code = $widget_code;
111 [$this->widget_code]);
113 if ( $flnumber) $strNumber=
"[ $nb ]";
114 echo
"<li id=\"elt_{$this->user_widget_id}\"> $strNumber <span class='widget-name'>{$row['wd_name']}</span>{$row['wd_description']}";
116 if ( $this->user_widget_id > 0) {
117 if (
$row[
'wd_parameter'] == 1) {
120 echo
'<span style="float:right;color:red">'.\Icon_Action::trash(uniqid(),sprintf(
"widget.delete('%s')",$this->user_widget_id));
123 if (
$row[
'wd_parameter'] == 1) {
126 echo
'<span style="float:right;">'.\Icon_Action::icon_add(uniqid(),sprintf(
"widget.add('%s')",$this->widget_code));
140 return $cn->get_array(
"
143 uw.dashboard_widget_id ,
147join widget_dashboard wd on (uw.dashboard_widget_id=wd.wd_id)
148where use_login=$1 order by uw.uw_order
162 if (file_exists(NOALYSS_INCLUDE.
"/widget/$widget_code/$widget_code.php")) {
163 require_once NOALYSS_INCLUDE.
"/widget/$widget_code/$widget_code.php";
164 $class=sprintf(
"\\Noalyss\\Widget\\%s",$widget_code);
166 $obj->set_widget_code($widget_code);
167 $obj->set_user_widget_id($user_widget_id);
180 printf(
'<div id="%s" class="box widget-box">',$this->
get_div_domid());
188 return sprintf(
"%s_%s",$this->widget_code,$this->user_widget_id);
202 echo
h2(
_(
"Un instant, on charge :-)"),
' class="title" ');
205 print '<div style="display:flex;justify-content: center">';
206 print '<div style="margin-top: 50px;margin-left: 20px;">';
207 print '<div class="loading_msg"></div>';
208 print '<div class="loading_msg"></div>';
209 print '<div class="loading_msg"></div>';
210 print '<div class="loading_msg"></div>';
211 print '<div class="loading_msg"></div>';
218 $widgetjs=uniqid(
'widget');
221var {$widgetjs}=
new Widget(
'{$dossier_id}')
240 echo
'<ul class="list-unstyled" id="contain_widget">';
246 echo \HtmlInput::hidden(
"order_widget_hidden",
"");
259 $cn->exec_sql(
"delete from user_widget where use_login = $1",[
$g_user->getLogin()]);
265 $cn->exec_sql(
"create temporary table tmp_widget(user_widget_id integer,tw_order integer )");
266 foreach (
$array as $item) {
267 $cn->exec_sql(
'insert into tmp_widget(user_widget_id,tw_order ) values ($1,$2)',
271 $cn->exec_sql(
"delete from user_widget where use_login = $1 and uw_id not in (select user_widget_id from tmp_widget)",
274 $cn->exec_sql(
"update user_widget set uw_order =tw_order from tmp_widget where user_widget_id=uw_id");
278 }
catch (\Exception
$e) {
293 $aWidget=
$cn->get_array(
"select wd_code,wd_name, wd_description,wd_parameter from widget_dashboard order by wd_name");
294 echo
'<ul id="widget_add" class="list-unstyled">';
297 $widget?->input(
false);
311 printf (
'<form id="%s_param" style="display:inline">',$this->widget_code);
323 throw new \Exception(__FUNCTION__.
" not implemented");
334 throw new \Exception(__FUNCTION__.
" not implemented");
344 $handle=opendir(NOALYSS_INCLUDE.
"/widget");
345 while (($dir = readdir($handle)) !=
false ) {
346 $directory=NOALYSS_INCLUDE.
"/widget".DIRECTORY_SEPARATOR.$dir;
347 if (is_dir(
$directory) && $dir !=
"." && $dir !=
"..") {
349 $cnt=
$cn->get_value(
"select count(*) from widget_dashboard where wd_code = $1",[$dir]);
354 if (file_exists(
$directory . DIRECTORY_SEPARATOR .
"install.php")){
355 include
$directory . DIRECTORY_SEPARATOR .
"install.php";
369 $param = $this->
db->get_value(
"select uw_parameter from user_widget where uw_id=$1",[$this->user_widget_id]);
370 if (empty ($param))
return [];
371 parse_str($param,$aParam);
397 $r=
'<div class="bxbutton">';
399 $r.=
'<span id="span_'.uniqid().
'" style="float:right;margin-right:5px">'.$this->
button_zoom().
"</span>";
401 $r.=sprintf(
'<h2 class="title">%s</h2>',
$title);
413 $box= sprintf(
'%s_%s',$widget_code,$widget_id);
414 $refresh=sprintf(
"%s.display('%s','%s','%s','%s')",
h2($p_string, $p_class="", $raw="")
global $g_user
if no group available , then stop
for($i=0; $i< $nb_vatex_code; $i++)($i % 2==0) ? " odd " $cnt
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
_("actif, passif,charge,...")
$class
Display the Plugin and for each profile were it is installed or not.
static refresh($p_id, $javascript)
static zoom($p_div, $p_javascript)
Display a icon for zooming.
create_script($p_string)
create the HTML for adding the script tags around of the script