Inheritance: extends AppController
示例#1
0
/**
 * The ShoppingCart - an administrative tool for shopping cart inventory.
 *
 * @package Plugins
 * @subpackage shopping-cart
 *
 * @author Stefan Miller <*****@*****.**>
 * Copyright (C) 2014 Stefan Miller <*****@*****.**>
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 *
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
$sh = new ShoppingCartController();
?>



<?php 
$category_options = $sh->select_cat("SELECT * FROM CART_categories order by parent_id, id asc", "onchange=\"submit()\"");
?>

<h1><a href="<?php 
echo get_url('plugin/shopping_cart');
?>
">Category</a>: <?php 
echo $sh->category_breadcrumb('CART_categories', $_SESSION['product_category']);
?>
</h1>
示例#2
0
//Einbinden von Controllers
include_once 'controller/UserController.php';
include_once 'controller/ShoppingCartController.php';
include_once 'controller/ProductController.php';
include_once 'controller/CustomerController.php';
include_once 'controller/OrderController.php';
//Session wird gestartet
session_start();
//op = operation, Server übergibt den wert von 'op', von allen Server Variablen($_POST,$_GET,usw.)
@($op = $_REQUEST['op']);
//pr = productnummer die vom Shop ausgewählt wird, -1 weil Index bei 0 anfängt
@($pr = $_REQUEST['pr'] - 1);
//Controllers werden instanziert, damit wir ihre Funktionen im index brauchen können
$user_controller = new UserController();
$cart_controller = new ShoppingCartController();
$prod_controller = new ProductController();
$cust_controller = new CustomerController();
$order_controller = new orderController();
/*******************************
Anhand des Wertes von op, also der gesuchten Funktion im Index,
werden auf verschiedene Seiten gezeigt und /oder verschiedene Funktionen eines 
Controllers durchgeführt. z.B versucht der User einzuloggen wird im Forumular
über $_POST login button (mit name "op"!)die login Funktion des Indexes
aufgerufen. Ist die Authentifizierung erfolgreich wird der User auf den Shop
(ShopView.php) verlinkt. 
Alle Verlinkungen verlaufen durch den Index.
******************************/
switch ($op) {
    //verweist einen leeren op an die Loginseite (erste Ladung des Shops)
    case "":
/**
 * The ShoppingCart - an administrative tool for shopping cart inventory.
 *
 * @package Plugins
 * @subpackage shopping-cart
 *
 * @author Stefan Miller <*****@*****.**>
 * Copyright (C) 2014 Stefan Miller <*****@*****.**>
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 *
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
$sh = new ShoppingCartController();
?>



<h1>Manage Orders</h1>
<br/>

<form action="<?php 
echo get_url('plugin/shopping_cart');
?>
" method="post">
<?php 
echo $category_options['element'];
?>
</form>
/**
 * The ShoppingCart - an administrative tool for shopping cart inventory.
 *
 * @package Plugins
 * @subpackage shopping-cart
 *
 * @author Stefan Miller <*****@*****.**>
 * Copyright (C) 2014 Stefan Miller <*****@*****.**>
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 *
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
$sh = new ShoppingCartController();
?>



<?php 
$category_options = $sh->select_cat("SELECT * FROM CART_categories order by parent_id, id asc", "onchange=\"submit()\"");
$ord['customer_id'] = 1;
?>

<h1>Manage Customers</h1>
<br/>



 private function _upload_file($origin, $dest, $tmp_name, $overwrite = false)
 {
     ShoppingCartController::_checkPermission();
     AuthUser::load();
     if (!AuthUser::hasPermission('shopping_cart_upload')) {
         //return false;
     }
     $origin = basename($origin);
     $full_dest = $dest . $origin;
     $file_name = $origin;
     for ($i = 1; file_exists($full_dest); $i++) {
         if ($overwrite) {
             unlink($full_dest);
             continue;
         }
         $file_ext = strpos($origin, '.') === false ? '' : '.' . substr(strrchr($origin, '.'), 1);
         $file_name = substr($origin, 0, strlen($origin) - strlen($file_ext)) . '_' . $i . $file_ext;
         $full_dest = $dest . $file_name;
     }
     if (move_uploaded_file($tmp_name, $full_dest)) {
         // change mode of the uploaded file
         $mode = Plugin::getSetting('filemode', 'file_manager');
         chmod($full_dest, octdec($mode));
         return $file_name;
     }
     return false;
 }