public function login()
 {
     Hooks::addHook('js', 'Controllers\\auth@js');
     Hooks::addHook('css', 'Controllers\\auth@css');
     $error = 'hi';
     $success = 'hi';
     if (Session::get('loggedin')) {
         Url::redirect();
     }
     if (isset($_POST['submit'])) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         //validation
         if (Password::verify($password, $this->_model->getHash($username)) == false) {
             $error[] = 'Wrong username or password';
         }
         //if validation has passed carry on
         if (!$error) {
             Session::set('loggedin', true);
             Session::set('username', $username);
             Session::set('memberID', $this->_model->getID($username));
             $data = array('lastLogin' => date('Y-m-d G:i:s'));
             $where = array('memberID' => $this->_model->getID($username));
             $this->_model->update($data, $where);
             $error = 'hi';
             Url::redirect();
         }
     }
     $data['title'] = 'Login';
     View::rendertemplate('header', $data);
     View::render('auth/login', $data, $error, $success);
     View::rendertemplate('footer', $data);
 }
 public function index()
 {
     if (!Session::get('loggedin')) {
         Url::redirect('login');
     }
     if (isset($_POST['submit']) && $_FILES['fileToUpload']['size'] > 0) {
         $name = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
         $price = !isset($_POST['productPrice']) || trim($_POST['productPrice']) == '' ? 0 : floatval($_POST['productPrice']);
         $description = !isset($_POST['productDescription']) || trim($_POST['productDescription']) == '' ? '' : $_POST['productDescription'];
         $target_dir = "uploads/";
         $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
         $uploadOk = 1;
         $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
         // Check if image file is a actual image or fake image
         if (isset($_POST["submit"])) {
             $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
             if ($check !== false) {
                 //echo "File is an image - " . $check["mime"] . ".";
                 $uploadOk = 1;
             } else {
                 //echo "File is not an image.";
                 $uploadOk = 0;
             }
         }
         // Check if file already exists
         if (file_exists($target_file)) {
             $error = "Sorry, file already exists." . $error;
             $uploadOk = 0;
         }
         // Check file size
         if ($_FILES["fileToUpload"]["size"] > 500000) {
             $error = "Sorry, your file is too large." . $error;
             $uploadOk = 0;
         }
         // Allow certain file formats
         if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
             $error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
             $uploadOk = 0;
         }
         // Check if $uploadOk is set to 0 by an error
         if ($uploadOk == 0) {
             $error = "Sorry, your file was not uploaded." . $error;
             // if everything is ok, try to upload file
         } else {
             //if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], str_replace(' ','-',strtolower($target_file)))) {
             //echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
             $product['product'] = array('name' => $name, 'price' => $price, 'description' => $description, 'lastUpdate' => date('Y-m-d G:i:s'));
             $product['image'] = array('image' => file_get_contents($_FILES['fileToUpload']['tmp_name']), 'size' => $_FILES["fileToUpload"]["size"], 'type' => $imageFileType);
             $this->_model->insertProduct($product);
             //unlink(str_replace(' ','-',strtolower($target_file)));
         }
     }
     Hooks::addHook('js', 'Controllers\\menu@indexJS');
     Hooks::addHook('css', 'Controllers\\menu@indexCss');
     $data['title'] = 'index';
     $data['username'] = Session::get('username');
     View::rendertemplate('header', $data);
     View::render('menu/index', $data, $error);
     View::rendertemplate('footer', $data);
 }
示例#3
0
文件: View.php 项目: sisnox/framework
 /**
  * place hook calls into the relevant data array call
  * @param  array $data
  * @return array $data
  */
 public static function dataLoadandConvert($data)
 {
     $hooks = Hooks::get();
     $data['afterBody'] = $hooks->run('afterBody', $data['afterBody']);
     $data['css'] = $hooks->run('css', $data['css']);
     $data['js'] = $hooks->run('js', $data['js']);
     return $data;
 }
示例#4
0
 /**
  * Method automatically invoked before the current Action, stopping the flight
  * when it return false. This Method is supposed to be overriden for using it.
  */
 protected function before()
 {
     // Run the Hooks associated to Views.
     $hooks = Hooks::get();
     foreach (array('afterBody', 'css', 'js') as $hook) {
         $result = $hooks->run($hook);
         // Share the result into Views.
         View::share($hook, $result);
     }
     // Return true to continue the processing.
     return true;
 }
 public function GetUser($id_contato, $messages = [])
 {
     $data['name'] = $this->contatos->getOneName($id_contato);
     $data['mail'] = $this->contatos->getOneMail($id_contato);
     $data['mail_type'] = $this->contatos->getMailType();
     $data['phone'] = $this->contatos->getOnePhone($id_contato);
     $data['phone_type'] = $this->contatos->getPhoneType();
     $data['messages'] = $messages;
     Hooks::addHook('js', '\\Controllers\\PainelContatoUsuario@scripts');
     // var_dump($data['mail_type']);
     // var_dump('aaa');
     // die();
     View::renderTemplate('header', $data);
     View::render('painel_contato_usuario/edit_contato_usuario', $data);
     View::renderTemplate('footer', $data);
 }
 public function login()
 {
     Hooks::addHook('js', 'Controllers\\auth@js');
     Hooks::addHook('css', 'Controllers\\auth@css');
     // if(Session::get('loggedin')){
     //           Url::redirect();
     //       }
     $currentUser = ParseUser::getCurrentUser();
     if ($currentUser) {
         // do stuff with the user
         Url::redirect();
     } else {
         // show the signup or login page
     }
     //==============Sign Up Manually==========================
     // $user = new ParseUser();
     // $user->set("username", "yoak");
     // $user->set("password", "yoakyoak");
     // $user->set("email", "*****@*****.**");
     // // other fields can be set just like with ParseObject
     // $user->set("phone", "0909814465");
     // try {
     //   $user->signUp();
     //   // Hooray! Let them use the app now.
     //   $error = 'Hooray! Let them use the app now.';
     // } catch (ParseException $ex) {
     //   // Show the error message somewhere and let the user try again.
     //   echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
     // }
     //==============Sign Up Manually==========================
     if (isset($_POST['submit'])) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         try {
             $user = ParseUser::logIn($username, $password);
             Url::redirect();
             // Do stuff after successful login.
         } catch (ParseException $ex) {
             // The login failed. Check error to see why.
             $error = "ParseException: " . $ex->getCode() . " " . $ex->getMessage();
         }
     }
     $data['title'] = 'Login';
     View::rendertemplate('header', $data);
     View::render('auth/login', $data, $error);
     View::rendertemplate('footer', $data);
 }
示例#7
0
<?php

use Helpers\Hooks;
Hooks::addHook('routes', 'Modules\\Blog\\Controllers\\Blog@routes');
示例#8
0
<?php

use Helpers\Hooks;
Hooks::addHook('sidebar', 'Modules\\Members\\Controllers\\Members@index');
Hooks::addHook('routes', 'Modules\\Members\\Controllers\\Members@routes');
示例#9
0
<?php

use Helpers\Hooks;
Hooks::addHook('sidebar', 'Modules\\Members\\Controllers\\Members@index');
Hooks::addHook('routes', 'Modules\\Members\\Controllers\\Members@routes');
Hooks::addHook('navbar', 'Modules\\Members\\Controllers\\Members@navbar');
<?php

use Helpers\Hooks;
Hooks::addhook('routes', 'Modules\\Forum\\Controllers\\Forum@routes');
示例#11
0
<?php

use Helpers\Hooks;
//use Modules\Search\Controllers\Config as config;
Hooks::addHook('routes', 'Modules\\Search\\Controllers\\Main@routes');
<?php

use Helpers\Hooks;
Hooks::addhook('routes', 'Modules\\Profile\\Controllers\\Profile@routes');
 public function order()
 {
     $currentUser = ParseUser::getCurrentUser();
     if ($currentUser) {
         // do stuff with the user
     } else {
         // show the signup or login page
         Url::redirect('login');
     }
     if (isset($_POST['table'])) {
         View::render('inventory/order-table', $data, $error);
     } elseif (isset($_POST['del']) && isset($_POST['objectId'])) {
         $objectId = $_POST['objectId'];
         $query = new ParseQuery('Order');
         try {
             $data = 1;
         } catch (ParseException $ex) {
             $data = $ex;
         }
         $query->equalTo('objectId', $objectId);
         $order = $query->first();
         $order->destroy();
         header('Content-type: application/json; charset=utf-8');
         echo json_encode(array('result' => $data));
     } elseif (isset($_POST['update'])) {
         $objectId = !isset($_POST['objectId']) || trim($_POST['objectId']) == '' ? '' : $_POST['objectId'];
         $productId = !isset($_POST['productId']) || trim($_POST['productId']) == '' ? '' : $_POST['productId'];
         $productName = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
         $customerId = !isset($_POST['customerId']) || trim($_POST['customerId']) == '' ? '' : $_POST['customerId'];
         $customerName = !isset($_POST['customerName']) || trim($_POST['customerName']) == '' ? '' : $_POST['customerName'];
         $lineId = !isset($_POST['lineId']) || trim($_POST['lineId']) == '' ? '' : $_POST['lineId'];
         $facebook = !isset($_POST['facebook']) || trim($_POST['facebook']) == '' ? '' : $_POST['facebook'];
         $telephone = !isset($_POST['telephone']) || trim($_POST['telephone']) == '' ? '' : $_POST['telephone'];
         $transportDate = !isset($_POST['transportDate']) || trim($_POST['transportDate']) == '' ? null : DateTime::createFromFormat('d/m/Y', $_POST['transportDate']);
         $address = !isset($_POST['address']) || trim($_POST['address']) == '' ? '' : $_POST['address'];
         $transportStatus = !isset($_POST['transportStatus']) || trim($_POST['transportStatus']) == '' ? '' : $_POST['transportStatus'];
         $transferStatus = !isset($_POST['transferStatus']) || trim($_POST['transferStatus']) == '' ? '' : $_POST['transferStatus'];
         $trackingNumber = !isset($_POST['trackingNumber']) || trim($_POST['trackingNumber']) == '' ? '' : $_POST['trackingNumber'];
         $contact = ['telephone' => $telephone, 'lineId' => $lineId, 'facebook' => $facebook];
         if ($_FILES['fileToUpload']['size'] > 0) {
             $target_file = basename($_FILES["fileToUpload"]["name"]);
             $uploadOk = 1;
             $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
             $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
             if ($check !== false) {
                 //echo "File is an image - " . $check["mime"] . ".";
                 $uploadOk = 1;
             } else {
                 //echo "File is not an image.";
                 $uploadOk = 0;
             }
             // Check file size
             if ($_FILES["fileToUpload"]["size"] > 500000) {
                 $error = "Sorry, your file is too large." . $error;
                 $uploadOk = 0;
             }
             // Allow certain file formats
             if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                 $error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
                 $uploadOk = 0;
             }
             // Check if $uploadOk is set to 0 by an error
             if ($uploadOk == 0) {
                 $error = "Sorry, your file was not uploaded." . $error;
                 // if everything is ok, try to upload file
             } else {
                 $imageFile = ParseFile::createFromData(file_get_contents($_FILES['fileToUpload']['tmp_name']), $target_file);
                 $query = new ParseQuery('Order');
                 $query->equalTo('objectId', $objectId);
                 $order = $query->first();
                 $order->set('productId', $productId);
                 $order->set('productName', $productName);
                 $order->set('customerName', $customerName);
                 $order->set('customerId', $customerId);
                 $order->setAssociativeArray('contact', $contact);
                 $order->set('slipPayin', $imageFile);
                 $order->set('transportDate', $transportDate);
                 $order->set('address', $address);
                 $order->set('transportStatus', $transportStatus);
                 $order->set('transferStatus', $transferStatus);
                 $order->set('trackingNumber', $trackingNumber);
                 $order->save();
             }
         } else {
             $query = new ParseQuery('Order');
             $query->equalTo('objectId', $objectId);
             $order = $query->first();
             $order->set('productId', $productId);
             $order->set('productName', $productName);
             $order->set('customerName', $customerName);
             $order->set('customerId', $customerId);
             $order->setAssociativeArray('contact', $contact);
             $order->set('transportDate', $transportDate);
             $order->set('address', $address);
             $order->set('transportStatus', $transportStatus);
             $order->set('transferStatus', $transferStatus);
             $order->set('trackingNumber', $trackingNumber);
             $order->save();
         }
     } else {
         if (isset($_POST['submit'])) {
             $productId = !isset($_POST['productId']) || trim($_POST['productId']) == '' ? '' : $_POST['productId'];
             $productName = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
             $customerId = !isset($_POST['customerId']) || trim($_POST['customerId']) == '' ? '' : $_POST['customerId'];
             $customerName = !isset($_POST['customerName']) || trim($_POST['customerName']) == '' ? '' : $_POST['customerName'];
             $lineId = !isset($_POST['lineId']) || trim($_POST['lineId']) == '' ? '' : $_POST['lineId'];
             $facebook = !isset($_POST['facebook']) || trim($_POST['facebook']) == '' ? '' : $_POST['facebook'];
             $telephone = !isset($_POST['telephone']) || trim($_POST['telephone']) == '' ? '' : $_POST['telephone'];
             $transportDate = !isset($_POST['transportDate']) || trim($_POST['transportDate']) == '' ? null : DateTime::createFromFormat('d/m/Y', $_POST['transportDate']);
             $transportStatus = !isset($_POST['transportStatus']) || trim($_POST['transportStatus']) == '' ? '' : $_POST['transportStatus'];
             $transferStatus = !isset($_POST['transferStatus']) || trim($_POST['transferStatus']) == '' ? '' : $_POST['transferStatus'];
             $trackingNumber = !isset($_POST['trackingNumber']) || trim($_POST['trackingNumber']) == '' ? '' : $_POST['trackingNumber'];
             $contact = ['telephone' => $telephone, 'lineId' => $lineId, 'facebook' => $facebook];
             if ($_FILES['fileToUpload']['size'] > 0) {
                 $target_file = basename($_FILES["fileToUpload"]["name"]);
                 $uploadOk = 1;
                 $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
                 $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
                 if ($check !== false) {
                     //echo "File is an image - " . $check["mime"] . ".";
                     $uploadOk = 1;
                 } else {
                     //echo "File is not an image.";
                     $uploadOk = 0;
                 }
                 // Check file size
                 if ($_FILES["fileToUpload"]["size"] > 500000) {
                     $error = "Sorry, your file is too large." . $error;
                     $uploadOk = 0;
                 }
                 // Allow certain file formats
                 if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                     $error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
                     $uploadOk = 0;
                 }
                 // Check if $uploadOk is set to 0 by an error
                 if ($uploadOk == 0) {
                     $error = "Sorry, your file was not uploaded." . $error;
                     // if everything is ok, try to upload file
                 } else {
                     $imageFile = ParseFile::createFromData(file_get_contents($_FILES['fileToUpload']['tmp_name']), $target_file);
                     $order = new ParseObject('Order');
                     $order->set('productId', $productId);
                     $order->set('productName', $productName);
                     $order->set('customerName', $customerName);
                     $order->set('customerId', $customerId);
                     $order->setAssociativeArray('contact', $contact);
                     $order->set('slipPayin', $imageFile);
                     $order->set('transportDate', $transportDate);
                     $order->set('address', $address);
                     $order->set('transportStatus', $transportStatus);
                     $order->set('transferStatus', $transferStatus);
                     $order->set('trackingNumber', $trackingNumber);
                     $order->save();
                 }
             } else {
                 $order = new ParseObject('Order');
                 $order->set('productId', $productId);
                 $order->set('productName', $productName);
                 $order->set('customerName', $customerName);
                 $order->set('customerId', $customerId);
                 $order->setAssociativeArray('contact', $contact);
                 $order->set('transportDate', $transportDate);
                 $order->set('address', $address);
                 $order->set('transportStatus', $transportStatus);
                 $order->set('transferStatus', $transferStatus);
                 $order->set('trackingNumber', $trackingNumber);
                 $order->save();
             }
             Url::redirect('order');
         }
         $sidemenu = new ParseQuery('SideMenu');
         $result = $sidemenu->find();
         Hooks::addHook('js', 'Controllers\\inventory\\Order@JS');
         Hooks::addHook('css', 'Controllers\\inventory\\Order@CSS');
         $data['title'] = 'รายการสั่งซื้อสินค้า';
         $data['username'] = $currentUser->get('username');
         $data['sidemenu'] = $result;
         View::rendertemplate('header', $data);
         View::render('inventory/order', $data, $error);
         View::rendertemplate('footer', $data);
     }
 }
<?php

use Helpers\Hooks;
Hooks::addhook('routes', 'Modules\\Messages\\Controllers\\Messages@routes');
示例#15
0
文件: footer.php 项目: APKO/Billing
<?php

\Helpers\Hooks::get()->run('footer');
?>
</body>
</html>
示例#16
0
<?php

/**
 * Sample layout
 */
use Helpers\Assets;
use Helpers\Url;
use Helpers\Hooks;
//initialise hooks
$hooks = Hooks::get();
?>
<!DOCTYPE html>
<html lang="<?php 
echo LANGUAGE_CODE;
?>
">
    <head>

        <!-- Site meta -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

        <?php 
//hook for plugging in meta tags
$hooks->run('meta');
?>
        <title><?php 
echo $data['title'] . ' - ' . SITETITLE;
//SITETITLE defined in app/Core/Config.php
?>
</title>
 public function product()
 {
     // if(!Session::get('loggedin')){
     //     Url::redirect('login');
     // }
     $currentUser = ParseUser::getCurrentUser();
     if ($currentUser) {
         // do stuff with the user
     } else {
         // show the signup or login page
         Url::redirect('login');
     }
     if (isset($_POST['table'])) {
         View::render('inventory/product-table', $data, $error);
     } elseif (isset($_POST['del']) && isset($_POST['objectId'])) {
         $objectId = $_POST['objectId'];
         $query = new ParseQuery('Product');
         try {
             $data = 1;
         } catch (ParseException $ex) {
             $data = $ex;
         }
         $query->equalTo('objectId', $objectId);
         $product = $query->first();
         $product->destroy();
         header('Content-type: application/json; charset=utf-8');
         echo json_encode(array('result' => $data));
     } elseif (isset($_POST['update'])) {
         $objectId = !isset($_POST['objectId']) || trim($_POST['objectId']) == '' ? '' : $_POST['objectId'];
         $name = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
         $price = !isset($_POST['productPrice']) || trim($_POST['productPrice']) == '' ? 0 : floatval($_POST['productPrice']);
         $description = !isset($_POST['productDescription']) || trim($_POST['productDescription']) == '' ? '' : $_POST['productDescription'];
         if ($_FILES['fileToUpload']['size'] > 0) {
             $target_file = basename($_FILES["fileToUpload"]["name"]);
             $uploadOk = 1;
             $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
             $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
             if ($check !== false) {
                 //echo "File is an image - " . $check["mime"] . ".";
                 $uploadOk = 1;
             } else {
                 //echo "File is not an image.";
                 $uploadOk = 0;
             }
             // Check file size
             if ($_FILES["fileToUpload"]["size"] > 500000) {
                 $error = "Sorry, your file is too large." . $error;
                 $uploadOk = 0;
             }
             // Allow certain file formats
             if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                 $error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
                 $uploadOk = 0;
             }
             // Check if $uploadOk is set to 0 by an error
             if ($uploadOk == 0) {
                 $error = "Sorry, your file was not uploaded." . $error;
                 // if everything is ok, try to upload file
             } else {
                 $imageFile = ParseFile::createFromData(file_get_contents($_FILES['fileToUpload']['tmp_name']), $target_file);
                 $query = new ParseQuery('Product');
                 $query->equalTo('objectId', $objectId);
                 $product = $query->first();
                 $product->set('name', $_POST['productName']);
                 $product->set('price', $price);
                 $product->set('description', $description);
                 $product->set('picture', $imageFile);
                 $product->save();
             }
         } else {
             $query = new ParseQuery('Product');
             $query->equalTo('objectId', $objectId);
             $product = $query->first();
             $product->set('name', $name);
             $product->set('price', $price);
             $product->set('description', $description);
             $product->save();
         }
     } else {
         if (isset($_POST['submit'])) {
             $name = !isset($_POST['productName']) || trim($_POST['productName']) == '' ? '' : $_POST['productName'];
             $price = !isset($_POST['productPrice']) || trim($_POST['productPrice']) == '' ? 0 : floatval($_POST['productPrice']);
             $description = !isset($_POST['productDescription']) || trim($_POST['productDescription']) == '' ? '' : $_POST['productDescription'];
             if ($_FILES['fileToUpload']['size'] > 0) {
                 $target_file = basename($_FILES["fileToUpload"]["name"]);
                 $uploadOk = 1;
                 $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
                 $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
                 if ($check !== false) {
                     //echo "File is an image - " . $check["mime"] . ".";
                     $uploadOk = 1;
                 } else {
                     //echo "File is not an image.";
                     $uploadOk = 0;
                 }
                 // Check file size
                 if ($_FILES["fileToUpload"]["size"] > 500000) {
                     $error = "Sorry, your file is too large." . $error;
                     $uploadOk = 0;
                 }
                 // Allow certain file formats
                 if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
                     $error = "Sorry, only JPG, JPEG, PNG & GIF files are allowed." . $error;
                     $uploadOk = 0;
                 }
                 // Check if $uploadOk is set to 0 by an error
                 if ($uploadOk == 0) {
                     $error = "Sorry, your file was not uploaded." . $error;
                     // if everything is ok, try to upload file
                 } else {
                     $imageFile = ParseFile::createFromData(file_get_contents($_FILES['fileToUpload']['tmp_name']), $target_file);
                     $product = new ParseObject('Product');
                     $product->set('name', $name);
                     $product->set('price', $price);
                     $product->set('description', $description);
                     $product->set('picture', $imageFile);
                     $product->save();
                 }
             } else {
                 $product = new ParseObject('Product');
                 $product->set('name', $name);
                 $product->set('price', $price);
                 $product->set('description', $description);
                 $product->save();
             }
             Url::redirect('product');
         }
         $sidemenu = new ParseQuery('SideMenu');
         $result = $sidemenu->find();
         Hooks::addHook('js', 'Controllers\\inventory\\Product@JS');
         Hooks::addHook('css', 'Controllers\\inventory\\Product@CSS');
         $data['title'] = 'สินค้า';
         $data['username'] = $currentUser->get('username');
         $data['sidemenu'] = $result;
         View::rendertemplate('header', $data);
         View::render('inventory/product', $data, $error);
         View::rendertemplate('footer', $data);
     }
 }