public static function editForm($uporabnik = [])
 {
     if (empty($uporabnik)) {
         $rules = ["id" => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 1]]];
         $data = filter_input_array(INPUT_GET, $rules);
         $uporabnik = UporabnikDB::get($data);
     }
     echo ViewHelper::render("view/admin/uporabnik-edit.php", ["uporabnik" => $uporabnik]);
 }
Exemplo n.º 2
0
 public static function productsDetail()
 {
     $data = filter_input_array(INPUT_GET, self::getIdRules());
     if (self::checkValues($data)) {
         $product = ProductsDB::get($data);
         $images = ImagesDB::getProdutAll(["izdelek_id" => $product["id"]]);
         echo ViewHelper::render("view/anonymous-products-detail.php", ["product" => $product, "images" => $images]);
     } else {
         ViewHelper::redirect(BASE_URL);
     }
 }
Exemplo n.º 3
0
 public static function edit()
 {
     $rules = self::getRules();
     $rules["id"] = ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 1]];
     $data = filter_input_array(INPUT_POST, $rules);
     if (self::checkValues($data)) {
         IgralecDB::update($data);
         echo ViewHelper::render("view/editor/main-editor.php");
     } else {
         self::editForm($data);
     }
 }
Exemplo n.º 4
0
	<link rel="stylesheet" href="/<?php 
echo BASE_PATH;
?>
stylesheets/layout.css">
	<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">

	<!-- Favicons
	================================================== -->
	<link rel="shortcut icon" href="/<?php 
echo BASE_PATH;
?>
images/favicon.png">

	<?php 
if (isset($presskit)) {
    ViewHelper::render('analytics', array('code' => $presskit->developer->analytics));
}
?>
</head>
<body>

	<!-- Primary Page Layout
	================================================== -->
	<div class="container">
		<?php 
if (sizeof(ErrorHelper::$errors)) {
    echo '<ul class="errors sixteen columns">';
    foreach (ErrorHelper::$errors as $error) {
        echo '<li>', $error, '</li>';
    }
    echo '</ul>';
Exemplo n.º 5
0
 public static function orderCancelledDetail()
 {
     $rules = ["id" => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 1]]];
     $data = filter_input_array(INPUT_POST, $rules);
     if ($data == null) {
         $data["id"] = $_SESSION["pid"];
     }
     if (self::checkValues($data)) {
         $order = OrdersDB::get($data);
         echo ViewHelper::render("view/customer-order-detail-cancelled.php", ["order" => $order, "products" => OrdersDB::getOrderProducts(["narocilo_id" => $data["id"]]), "user" => UsersDB::get(["id" => $order["uporabnik_id"]])]);
     } else {
         ViewHelper::redirect(BASE_URL);
     }
 }
Exemplo n.º 6
0
 public function credits()
 {
     ViewHelper::$title = ViewHelper::$header = 'alt. presskit credits';
     ViewHelper::render('credits');
 }
Exemplo n.º 7
0
 public static function addUserForm($values = ["ime" => "", "priimek" => "", "mail" => "", "uporabnisko_ime" => "", "geslo" => "", "aktiven" => "", "telefon" => "", "ulica" => "", "stevilka" => "", "posta" => "", "kraj" => ""])
 {
     $values["geslo"] = "";
     $values["geslo2"] = "";
     $values["stranka"] = true;
     $form = new OsebaForm('registracija', $values, "dodajanje");
     echo ViewHelper::render("view/salesman-user-add.php", ["form" => $form]);
 }
Exemplo n.º 8
0
 public static function index()
 {
     echo ViewHelper::render("view/login.php");
 }
Exemplo n.º 9
0
 public static function addUserForm($values = ["ime" => "", "priimek" => "", "mail" => "", "uporabnisko_ime" => "", "geslo" => "", "aktiven" => ""])
 {
     $values["geslo"] = "";
     $values["geslo2"] = "";
     $form = new OsebaForm('registracija', $values, "dodajanje");
     echo ViewHelper::render("view/admin-user-add.php", ["form" => $form]);
 }
Exemplo n.º 10
0
            CustomerController::setActiveUser();
            echo ViewHelper::render("view/customer-message.php", ["message" => "Registracija uspešna! Lahko se sedaj prijavite."]);
        } else {
            echo ViewHelper::render("view/customer-message.php", ["message" => "Registracija neuspešna! Vpišite pravi registracijski naslov."]);
            //                AnonymousController::registrationUnsuccessful();
        }
    } else {
        AnonymousController::registration();
    }
}, "customer/rating" => function () {
    CustomerController::addRating();
    //        echo json_encode($_POST["ocena"]);
}, "customer/registration/mailsent" => function () {
    echo ViewHelper::render("view/customer-message.php", ["message" => "Hvala za registracijo! Potrditveni mail je bil poslan na mail."]);
}, "customer/registration/mailfailed" => function () {
    echo ViewHelper::render("view/customer-message.php", ["message" => "Zgodila se je napaka! Potrditveni mail ni bil poslan."]);
}, "customer/login" => function () {
    if (isset($_SESSION["active"]) && $_SESSION["role"] == "customer") {
        ViewHelper::redirect(BASE_URL . "customer");
    } elseif ($_SERVER["REQUEST_METHOD"] == "POST") {
        CustomerController::check();
    } else {
        CustomerController::login();
    }
}, "customer/logout" => function () {
    session_unset();
    ViewHelper::redirect(BASE_URL);
}, "product/detail" => function () {
    if (isset($_SESSION["active"]) && $_SESSION["role"] == "customer") {
        ViewHelper::redirect(BASE_URL . "customer");
    } else {
Exemplo n.º 11
0
}, "edit/novica" => function () {
    NovicaController::index();
}, "edit/novica/add" => function () {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        NovicaController::add();
    } else {
        NovicaController::addForm();
    }
}, "edit/novica/edit" => function () {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        NovicaController::edit();
    } else {
        NovicaController::editForm();
    }
}, "edit/novica/delete" => function () {
    NovicaController::delete();
}, "" => function () {
    //ViewHelper::redirect(BASE_URL . "uporabnik");
    echo ViewHelper::render("view/home.php");
}];
try {
    if (isset($urls[$path])) {
        $urls[$path]();
    } else {
        echo "No controller for '{$path}'";
    }
} catch (InvalidArgumentException $e) {
    ViewHelper::error404();
} catch (Exception $e) {
    echo "An error occurred: <pre>{$e}</pre>";
}