Exemple #1
0
$collections = new Collections();
if (isset($_POST['submit'])) {
    switch ($_GET['c']) {
        case 'add':
            if ($_POST['name'] != "") {
                $name = str_ireplace('/', '-', $_POST['name']);
                $db->insert("collections", "name,user_id", "{$name}||" . $_SESSION['userid']);
                $html->redirection("collections.php?c={$db->affected_id}");
            } else {
                $alerts->display("danger", "error", "Please enter new collections name.");
                echo "<div id='page-title' class='row'>";
                echo "<div class='col-xs-12 col-sm-6'>";
                $html->title("collections", null, "left");
                echo "</div>";
                echo "<div class='col-xs-12 col-sm-6'>";
                $collections->create();
                echo "</div>";
                echo "</div>";
                $collections->listing();
            }
            break;
        default:
            $collections->set_data();
            $collections->submit_data();
            $html->redirection("collections.php");
            break;
    }
} else {
    if (isset($_GET['c'])) {
        $form = new Forms();
        $collections->get_data($_GET['c']);