Example #1
0
 public function templateAction(\clarus\request\Request $request)
 {
     //var_dump('template', $this->basePath, );
     $tplFile = sprintf('%stemplate/%s', $request->getRouter()->getModuleBasePath(), $_GET['name']);
     if (file_exists($tplFile)) {
         header('Content-type: text/html');
         echo file_get_contents($tplFile);
         exit;
     } else {
         return new NotAcceptable();
     }
 }
Example #2
0
    public function editAction(\clarus\request\Request $request)
    {
        $response = new HtmlOk($request->getRouter()->getModuleBasePath() . 'template/product/edit.php');
        $stm = $this->db->prepare('SELECT * FROM t_product p WHERE id_product = :id');
        $stm->execute([':id' => $_GET['id_product']]);
        $response['product'] = $stm->fetch();
        $stm = $this->db->prepare('SELECT w_name, SUM(pvw_stock)::numeric(30,3) FROM t_product_variant pv
									LEFT JOIN j_product_variant_warehouse USING (id_product_variant)
									LEFT JOIN t_warehouse USING (id_warehouse)
									WHERE pv.id_product = :id
									GROUP BY w_name');
        $stm->execute([':id' => $_GET['id_product']]);
        $response['stock'] = $stm->fetchAll();
        return $response;
    }
Example #3
0
 public function indexAction(\clarus\request\Request $request)
 {
     $response = new HtmlOk($request->getRouter()->getModuleBasePath() . 'template/controller/index.php');
     $response['modules'] = [['caption' => 'Produkty', 'load' => '/admin/core/product/'], ['caption' => 'Sklady', 'load' => '/admin/warehouse//'], ['caption' => 'Objednavky', 'load' => '/admin/core/orders/']];
     return $response;
 }