* Easyshop is a web shop system */ include_once './core/orderhelper.class.php'; include_once './core/order.class.php'; include_once './core/item.class.php'; include_once './core/customer.class.php'; include_once './core/cs_ticket.class.php'; include_once './core/cs_ticket_message.class.php'; include_once './modules/widgets/backordered_items.php'; include_once './modules/widgets/new_customers.php'; include_once './modules/widgets/new_orders.php'; include_once './modules/widgets/warehouse_inventory.php'; include_once './modules/widgets/paypal_money_back.php'; include_once './modules/widgets/new_messages.php'; include_once './modules/widgets/inventory_manager.php'; // TODO: need a new function in customer class // is_set_config_item return true if key is set and false if not // and get_config_item returns value if value for key is set and false if value is null class admin_dashboard { private $base_object; private $layout_object; public function __construct($base_object, $layout_object) { $this->base_object = $base_object; $this->layout_object = $layout_object; } function run() { if (isset($_GET['action'])) { $action = $_GET['action']; } else { $action = false; } if ($action == 'set_data') { $this->set_data(); } else { return $this->return_layout(); } } function set_data() { if(isset($_POST['widget_container'])) { $widget_container = $_POST['widget_container']; $widget_list = $_POST['widget_list']; $this->base_object->customer->set_config_item($widget_container, $widget_list); } else { echo "ERROR"; } } private function get_url() { if( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) { $protocol = "https://"; } else { $protocol = "http://"; } return $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; } function return_layout() { //$big_widgets_list = array('backordered_items', '', 'new_messages'); //$big_widgets_list = array('inventory_manager', 'backordered_items'); $big_widgets_list = array('backordered_items'); foreach ($big_widgets_list as $widget) { $widget_object = new $widget(); $big_widget[] = $widget_object->run(); } $this->layout_object->assign('big_widgets', $big_widget); $little_widgets_list = array('new_orders', 'new_customers', 'warehouse_inventory'); foreach ($little_widgets_list as $widget) { $widget_object = new $widget(); $little_widgets[] = $widget_object->run(); } $this->layout_object->assign('little_widgets', $little_widgets); return $this->layout_object->fetch('admin_dashboard.tpl'); } } ?>