Dashboard - Settings: Fix Enabled state on edit.
This commit is contained in:
@@ -89,100 +89,100 @@
|
|||||||
|
|
||||||
|
|
||||||
//action add or update
|
//action add or update
|
||||||
if (isset($_REQUEST["export"])) {
|
// if (isset($_REQUEST["export"])) {
|
||||||
$export = $_REQUEST["export"];
|
// $export = $_REQUEST["export"];
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//expore provider settings
|
//expore settings
|
||||||
if (isset($export) && $export == 'true') {
|
// if (isset($export) && $export == 'true') {
|
||||||
|
//
|
||||||
//get the dashboard
|
// //get the dashboard
|
||||||
$sql = "select ";
|
// $sql = "select ";
|
||||||
$sql .= "dashboard_uuid, ";
|
// $sql .= "dashboard_uuid, ";
|
||||||
$sql .= "dashboard_name, ";
|
// $sql .= "dashboard_name, ";
|
||||||
$sql .= "dashboard_path, ";
|
// $sql .= "dashboard_path, ";
|
||||||
$sql .= "dashboard_order, ";
|
// $sql .= "dashboard_order, ";
|
||||||
$sql .= "cast(dashboard_enabled as text), ";
|
// $sql .= "cast(dashboard_enabled as text), ";
|
||||||
$sql .= "dashboard_description ";
|
// $sql .= "dashboard_description ";
|
||||||
$sql .= "from v_dashboard ";
|
// $sql .= "from v_dashboard ";
|
||||||
$database = new database;
|
// $database = new database;
|
||||||
$dashboard_widgets = $database->select($sql, $parameters, 'all');
|
// $dashboard_widgets = $database->select($sql, $parameters, 'all');
|
||||||
unset($sql, $parameters);
|
// unset($sql, $parameters);
|
||||||
|
//
|
||||||
//prepare the array
|
// //prepare the array
|
||||||
if (is_array($dashboard_widgets)) {
|
// if (is_array($dashboard_widgets)) {
|
||||||
$x = 0;
|
// $x = 0;
|
||||||
$y = 0;
|
// $y = 0;
|
||||||
foreach ($dashboard_widgets as $row) {
|
// foreach ($dashboard_widgets as $row) {
|
||||||
//add to the array
|
// //add to the array
|
||||||
$array['dashboard'][$x]['dashboard_uuid'] = $row["dashboard_uuid"];
|
// $array['dashboard'][$x]['dashboard_uuid'] = $row["dashboard_uuid"];
|
||||||
$array['dashboard'][$x]['dashboard_name'] = $row["dashboard_name"];
|
// $array['dashboard'][$x]['dashboard_name'] = $row["dashboard_name"];
|
||||||
$array['dashboard'][$x]['dashboard_path'] = $row["dashboard_path"];
|
// $array['dashboard'][$x]['dashboard_path'] = $row["dashboard_path"];
|
||||||
$array['dashboard'][$x]['dashboard_order'] = $row["dashboard_order"];
|
// $array['dashboard'][$x]['dashboard_order'] = $row["dashboard_order"];
|
||||||
$array['dashboard'][$x]['dashboard_enabled'] = $row["dashboard_enabled"];
|
// $array['dashboard'][$x]['dashboard_enabled'] = $row["dashboard_enabled"] ?: 'false';
|
||||||
$array['dashboard'][$x]['dashboard_description'] = $row["dashboard_description"];
|
// $array['dashboard'][$x]['dashboard_description'] = $row["dashboard_description"];
|
||||||
|
//
|
||||||
//get the dashboard groups
|
// //get the dashboard groups
|
||||||
$sql = "select ";
|
// $sql = "select ";
|
||||||
$sql .= "dashboard_group_uuid, ";
|
// $sql .= "dashboard_group_uuid, ";
|
||||||
$sql .= "dashboard_uuid, ";
|
// $sql .= "dashboard_uuid, ";
|
||||||
$sql .= "group_uuid, ";
|
// $sql .= "group_uuid, ";
|
||||||
$sql .= "(select group_name from v_groups where v_dashboard_groups.group_uuid = group_uuid) as group_name ";
|
// $sql .= "(select group_name from v_groups where v_dashboard_groups.group_uuid = group_uuid) as group_name ";
|
||||||
$sql .= "from v_dashboard_groups ";
|
// $sql .= "from v_dashboard_groups ";
|
||||||
$sql .= "where dashboard_uuid = :dashboard_uuid ";
|
// $sql .= "where dashboard_uuid = :dashboard_uuid ";
|
||||||
$parameters['dashboard_uuid'] = $row["dashboard_uuid"];
|
// $parameters['dashboard_uuid'] = $row["dashboard_uuid"];
|
||||||
$database = new database;
|
// $database = new database;
|
||||||
$dashboard_groups = $database->select($sql, $parameters, 'all');
|
// $dashboard_groups = $database->select($sql, $parameters, 'all');
|
||||||
unset($sql, $parameters);
|
// unset($sql, $parameters);
|
||||||
if (is_array($dashboard_groups)) {
|
// if (is_array($dashboard_groups)) {
|
||||||
$y = 0;
|
// $y = 0;
|
||||||
foreach ($dashboard_groups as $row) {
|
// foreach ($dashboard_groups as $row) {
|
||||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = $row["dashboard_group_uuid"];
|
// $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_group_uuid'] = $row["dashboard_group_uuid"];
|
||||||
$array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = $row["dashboard_uuid"];
|
// $array['dashboard'][$x]['dashboard_groups'][$y]['dashboard_uuid'] = $row["dashboard_uuid"];
|
||||||
//$array['dashboard'][$x]['dashboard_groups'][$y]['group_uuid'] = $row["group_uuid"];
|
// //$array['dashboard'][$x]['dashboard_groups'][$y]['group_uuid'] = $row["group_uuid"];
|
||||||
$array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = $row["group_name"];
|
// $array['dashboard'][$x]['dashboard_groups'][$y]['group_name'] = $row["group_name"];
|
||||||
$y++;
|
// $y++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
$x++;
|
// $x++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//write the code
|
// //write the code
|
||||||
echo "<textarea style=\"width: 100%; max-width: 100%; height: 100%; max-height: 100%;\">\n";
|
// echo "<textarea style=\"width: 100%; max-width: 100%; height: 100%; max-height: 100%;\">\n";
|
||||||
if (is_array($array['dashboard'])) {
|
// if (is_array($array['dashboard'])) {
|
||||||
echo "\n\n\n";
|
// echo "\n\n\n";
|
||||||
//echo "\$x = 0;\n";
|
// //echo "\$x = 0;\n";
|
||||||
foreach ($array['dashboard'] as $row) {
|
// foreach ($array['dashboard'] as $row) {
|
||||||
foreach ($row as $key => $value) {
|
// foreach ($row as $key => $value) {
|
||||||
if (is_array($value)) {
|
// if (is_array($value)) {
|
||||||
echo "\$y = 0;\n";
|
// echo "\$y = 0;\n";
|
||||||
$count = count($value);
|
// $count = count($value);
|
||||||
$i = 1;
|
// $i = 1;
|
||||||
foreach ($value as $row) {
|
// foreach ($value as $row) {
|
||||||
foreach ($row as $key => $value) {
|
// foreach ($row as $key => $value) {
|
||||||
echo "\$array['dashboard'][\$x]['dashboard_groups'][\$y]['{$key}'] = '{$value}';\n";
|
// echo "\$array['dashboard'][\$x]['dashboard_groups'][\$y]['{$key}'] = '{$value}';\n";
|
||||||
}
|
// }
|
||||||
if ($i < $count) {
|
// if ($i < $count) {
|
||||||
echo "\$y++;\n";
|
// echo "\$y++;\n";
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
echo "\n\n---------------------------\n\n\n";
|
// echo "\n\n---------------------------\n\n\n";
|
||||||
}
|
// }
|
||||||
$i++;
|
// $i++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
echo "\$array['dashboard'][\$x]['{$key}'] = '{$value}';\n";
|
// echo "\$array['dashboard'][\$x]['{$key}'] = '{$value}';\n";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
echo "</textarea>\n";
|
// echo "</textarea>\n";
|
||||||
exit;
|
// exit;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//get the count
|
//get the count
|
||||||
$sql = "select count(dashboard_uuid) ";
|
$sql = "select count(dashboard_uuid) ";
|
||||||
@@ -324,11 +324,11 @@
|
|||||||
if (permission_exists('dashboard_edit')) {
|
if (permission_exists('dashboard_edit')) {
|
||||||
echo " <td class='no-link center'>\n";
|
echo " <td class='no-link center'>\n";
|
||||||
echo " <input type='hidden' name='number_translations[$x][dashboard_enabled]' value='".escape($row['dashboard_enabled'])."' />\n";
|
echo " <input type='hidden' name='number_translations[$x][dashboard_enabled]' value='".escape($row['dashboard_enabled'])."' />\n";
|
||||||
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.$row['dashboard_enabled']],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
echo button::create(['type'=>'submit','class'=>'link','label'=>$text['label-'.($row['dashboard_enabled']?:'false')],'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo " <td class='center'>\n";
|
echo " <td class='center'>\n";
|
||||||
echo $text['label-'.$row['dashboard_enabled']];
|
echo $text['label-'.($row['dashboard_enabled']?:'false')];
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td class='description overflow hide-sm-dn'>".escape($row['dashboard_description'])."</td>\n";
|
echo " <td class='description overflow hide-sm-dn'>".escape($row['dashboard_description'])."</td>\n";
|
||||||
|
|||||||
@@ -218,15 +218,12 @@
|
|||||||
$dashboard_column_span = $row["dashboard_column_span"];
|
$dashboard_column_span = $row["dashboard_column_span"];
|
||||||
$dashboard_details_state = $row["dashboard_details_state"];
|
$dashboard_details_state = $row["dashboard_details_state"];
|
||||||
$dashboard_order = $row["dashboard_order"];
|
$dashboard_order = $row["dashboard_order"];
|
||||||
$dashboard_enabled = $row["dashboard_enabled"];
|
$dashboard_enabled = $row["dashboard_enabled"] ?: 'false';
|
||||||
$dashboard_description = $row["dashboard_description"];
|
$dashboard_description = $row["dashboard_description"];
|
||||||
}
|
}
|
||||||
unset($sql, $parameters, $row);
|
unset($sql, $parameters, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the defaults
|
|
||||||
if (strlen($dashboard_enabled) == 0) { $dashboard_enabled = true; }
|
|
||||||
|
|
||||||
//get the child data
|
//get the child data
|
||||||
if (is_uuid($dashboard_uuid)) {
|
if (is_uuid($dashboard_uuid)) {
|
||||||
$sql = "select ";
|
$sql = "select ";
|
||||||
@@ -474,14 +471,14 @@
|
|||||||
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
echo "<td class='vtable' style='position: relative;' align='left'>\n";
|
||||||
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
|
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
|
||||||
echo " <label class='switch'>\n";
|
echo " <label class='switch'>\n";
|
||||||
echo " <input type='checkbox' id='dashboard_enabled' name='dashboard_enabled' value='true' ".($dashboard_enabled == true ? "checked='checked'" : null).">\n";
|
echo " <input type='checkbox' id='dashboard_enabled' name='dashboard_enabled' value='true' ".($dashboard_enabled == 'true' ? "checked='checked'" : null).">\n";
|
||||||
echo " <span class='slider'></span>\n";
|
echo " <span class='slider'></span>\n";
|
||||||
echo " </label>\n";
|
echo " </label>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo " <select class='formfld' id='dashboard_enabled' name='dashboard_enabled'>\n";
|
echo " <select class='formfld' id='dashboard_enabled' name='dashboard_enabled'>\n";
|
||||||
echo " <option value='true' ".($dashboard_enabled == true ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
|
echo " <option value='false'>".$text['option-false']."</option>\n";
|
||||||
echo " <option value='false' ".($dashboard_enabled == false ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
|
echo " <option value='true' ".($dashboard_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
|
||||||
echo " </select>\n";
|
echo " </select>\n";
|
||||||
}
|
}
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user