diff --git a/system/controllers/dashboard.php b/system/controllers/dashboard.php index 18f9fb0c..164df183 100644 --- a/system/controllers/dashboard.php +++ b/system/controllers/dashboard.php @@ -20,6 +20,11 @@ if (isset($_GET['refresh'])) { r2(getUrl('dashboard'), 's', 'Data Refreshed'); } +$tipeUser = _req("user"); +if (empty($tipeUser)) { + $tipeUser = 'Admin'; +} +$ui->assign('tipeUser', $tipeUser); $reset_day = $config['reset_day']; if (empty($reset_day)) { diff --git a/system/controllers/widgets.php b/system/controllers/widgets.php index 0223e01f..ef0a6286 100644 --- a/system/controllers/widgets.php +++ b/system/controllers/widgets.php @@ -18,8 +18,12 @@ $tipeUser = _req("user"); if (empty($tipeUser)) { $tipeUser = 'Admin'; } +if($tipeUser == 'Customer') { + $WIDGET_PATH .= DIRECTORY_SEPARATOR. 'customer'; +} + $ui->assign('tipeUser', $tipeUser); -$max = ORM::for_table('tbl_widgets')->max('position'); +$max = ORM::for_table('tbl_widgets')->where("user", $tipeUser)->max('position'); $max2 = substr_count($config['dashboard_' . $tipeUser], '.') + substr_count($config['dashboard_' . $tipeUser], ',') + 1; if ($max2 > $max) { $max = $max2; @@ -36,6 +40,7 @@ if ($action == 'add') { $title = _post('title'); $widget = _post('widget'); $content = _post('content'); + print_r($_POST); $d = ORM::for_table('tbl_widgets')->create(); $d->orders = $orders; $d->position = $position; @@ -58,6 +63,7 @@ if ($action == 'add') { } } $widget['position'] = $pos; + $widget['user'] = $tipeUser; $ui->assign('users', ORM::for_table('tbl_widgets')->getEnum("user")); $ui->assign('do', 'add'); $ui->assign('widgets', $widgets); diff --git a/ui/ui/admin/dashboard.tpl b/ui/ui/admin/dashboard.tpl index f1ec2ef3..150b6dd2 100644 --- a/ui/ui/admin/dashboard.tpl +++ b/ui/ui/admin/dashboard.tpl @@ -8,8 +8,9 @@ {/foreach} {/function} +{assign dtipe value="dashboard_`$tipeUser`"} -{assign rows explode(".", $_c['dashboard_cr'])} +{assign rows explode(".", $_c[$dtipe])} {assign pos 1} {foreach $rows as $cols} {if $cols == 12} diff --git a/ui/ui/admin/settings/widgets.tpl b/ui/ui/admin/settings/widgets.tpl index 477c39c3..e44b367b 100644 --- a/ui/ui/admin/settings/widgets.tpl +++ b/ui/ui/admin/settings/widgets.tpl @@ -32,11 +32,11 @@
@@ -66,10 +64,12 @@
{Lang::T("Not all widgets require content. HTML widgets require content, either text or PHP code. Please be careful when writing this content.")}
+ ++ {Lang::T("Not all widgets require content. HTML widgets require content, either text or PHP code. Please be careful when writing this content.")} +