public function update() { $orderEntity = false; if ($this->isPost()) { $tableName = zbase_entity('custom_orders')->getTable(); $name = zbase_request_input('name', false); $orderId = zbase_request_input('order_id', false); $amount = zbase_request_input('amount', false); $validators = ['name' => 'required', 'amount' => 'required', 'order_id' => 'required|exists:' . $tableName . ',order_id,name,' . $name . ',total,' . number_format($amount, 2) . ',status,1', 'date' => 'required|date_format:Y-m-d|before:' . zbase_date_now()->addDay(), 'payment_center' => 'required', 'file' => 'required|image']; $messages = ['order_id.exists' => 'Order ID, Name and Amount don\'t match.', 'amount.required' => 'Enter the amount that you deposited or paid.', 'file.required' => 'Kindly upload your deposit or payment slip.', 'file.image' => 'The file you uploaded is not an image.']; $this->validate(zbase_request(), $validators, $messages); $folder = zbase_storage_path() . '/zivsluck/order/receipts/'; $newFilename = zbase_file_name_from_file($_FILES['file']['name'], $orderId, true); $newFilename = zbase_file_upload_image('file', $folder, $newFilename, 'png', [280, null]); if (file_exists($newFilename)) { $orderEntity = zbase_entity('custom_orders')->repository()->byId($orderId); $orderEntity->status = 2; $orderEntity->payment_merchant = zbase_request_input('payment_center', null); $orderEntity->paid_date_at = zbase_request_input('date', null); $orderEntity->payment_tracking_number = zbase_request_input('payment_tracking', null); $orderEntity->save(); $orderEntity->sendPaymentReceiptToShane(); } } zbase_view_pagetitle_set('Update Order'); return $this->view(zbase_view_file('order.update'), compact('orderEntity')); }
public function upload() { $image = false; $success = false; if ($this->isPost()) { if (!empty($_FILES['file'])) { $folder = zbase_storage_path() . '/zivsluck/site/images/'; $filename = md5($_FILES['file']['name'] . date('Y-m-d-H')); $newFilename = zbase_file_name_from_file($_FILES['file']['name'], $filename, true); if (!file_exists($folder . $filename . '.png')) { $newFilename = zbase_file_upload_image('file', $folder, $newFilename, 'png', []); if (file_exists($newFilename)) { $data = ['filename' => $filename]; $image = zbase_entity('images')->create($data); } } $image = zbase_entity('images')->repository()->by('filename', $filename)->first(); } else { $imagex = zbase_request_input('image', false); $delete = zbase_request_input('delete', false); if (!empty($imagex)) { $image = zbase_entity('images')->repository()->by('filename', $imagex)->first(); if (!empty($image)) { if (!empty($delete)) { unlink($folder = zbase_storage_path() . '/zivsluck/site/images/' . $image->name() . '.png'); $image->delete(); return 1; } $image->font = zbase_request_input('font', null); $image->material = zbase_request_input('material', null); $image->tags = zbase_request_input('tags', null); $image->save(); return 1; } return 0; } } } zbase_view_pagetitle_set('Images'); return $this->view(zbase_view_file('site.upload'), compact('image')); }
/** * Set Page Property * @param string $action The Controller Action * @param array $param some assoc array that can be replace to the string * @return void */ public function pageProperties($action) { $section = zbase_section(); if (zbase_request_is_post()) { $action = str_replace('post-', null, $action); } $title = $this->_v('controller.' . $section . '.action.' . $action . '.page.title', null); $headTitle = $this->_v('controller.' . $section . '.action.' . $action . '.page.headTitle', $title); $subTitle = $this->_v('controller.' . $section . '.action.' . $action . '.page.subTitle', null); $breadcrumbs = $this->_v('controller.' . $section . '.action.' . $action . '.page.breadcrumbs', $this->_v('controller.' . $section . '.action.index.page.breadcrumbs', [])); zbase_view_pagetitle_set($headTitle, $title, $subTitle); if (!empty($breadcrumbs)) { zbase_view_breadcrumb($breadcrumbs); } return $this; }
/** * Extract Page Details from the given $config/array * Will check for index: navIndex => nav.front.main.navIndex.meta * Will check for index: pageIndex => nav.front.main.navIndex.meta * @param array $config */ function zbase_view_page_details($config) { if (!empty($config['navIndex'])) { $navIndex = $config['navIndex']; $meta = zbase_config_get('nav.front.main.' . $navIndex . '.meta', zbase_config_get('nav.main.' . $navIndex . '.meta', false)); } if (!empty($config['pageIndex'])) { $pageIndex = $config['pageIndex']; $meta = zbase_config_get('page.front.' . $pageIndex . '.meta', zbase_config_get('page.' . $pageIndex . '.meta', false)); } if (!empty($config['page'])) { $title = null; $headTitle = null; $subTitle = null; if (!empty($config['page']['title'])) { $title = $config['page']['title']; } if (!empty($config['page']['headTitle'])) { $headTitle = $config['page']['headTitle']; } if (!empty($config['page']['subTitle'])) { $subTitle = $config['page']['subTitle']; } zbase_view_pagetitle_set($headTitle, $title, $subTitle); if (!empty($config['page']['breadcrumbs'])) { zbase_view_breadcrumb($config['page']['breadcrumbs']); } $shortUrl = ''; if (!empty($config['page']['shortUrl'])) { $shortUrl = $config['page']['shortUrl']; } if (!empty($config['page']['canonical'])) { zbase_view_canonicalUrl($config['page']['canonical'], $shortUrl); } } if (!empty($meta)) { zbase_view_extract_meta($meta); } }
<?php zbase_view_pagetitle_set('Dashboard', 'Dashboard'); ?> @extends(zbase_view_template_layout()) @section('content') <?php echo zbase_view_placeholder_render('admin-dashboard'); ?> @stop
/** * Set Page Property * @param string $action The Controller Action * @param array $param some assoc array that can be replace to the string * @return void */ public function pageProperties($action) { $enable = $this->_v('page.' . $action . '.enable', false); if (!empty($enable)) { $title = $this->_v('page.' . $action . '.title', null); $headTitle = $this->_v('page.' . $action . '.headTitle', $title); $subTitle = $this->_v('page.' . $action . '.subTitle', null); $breadcrumbs = $this->_v('page.' . $action . '.breadcrumbs', []); if (!empty($title)) { zbase_view_pagetitle_set($headTitle, $title, $subTitle); } if (!empty($breadcrumbs)) { zbase_view_breadcrumb($breadcrumbs); } } return $this; }