예제 #1
0
<?php

// Ejecutamos la lógica de arranque de la app, o lógica de bootstrap
include_once 'autoloader.php';
use Javiers\Agenda\csvmanager;
// If we recieve post action = edited we are updating member.
if ($_POST['action'] != "edit") {
    // UPDATE data
    csvmanager::getInstance(__DIR__ . "/../address/example.csv")->update($_POST)->write();
    // Redirect back to home
    header('Location: /trycatch/csvmanager/list.php');
    exit;
}
// Not POST lets crUd.
?>
<!DOCTYPE html>
<html lang="en">
<?php 
include '../views/head.php';
?>
<body>
    <div class="container-narrow">
        <div class="masthead">
            <h3 class="muted">CSV Manager</h3>
        </div>
        <div class="jumbotron">
            <a class="btn btn-large btn-success" href="list.php">&lt;&lt; Back</a>
        </div>
        <hr />
        <h3>Update Contact</h3>
        <form role="form" method="post" enctype='application/json' accept-charset="UTF-8">
예제 #2
0
파일: list.php 프로젝트: sultanos/trycatch
<?php

// lets list
include_once 'autoloader.php';
use Javiers\Agenda\csvmanager;
// Gather contact's data from CSV
$contacts = csvmanager::getInstance(__DIR__ . "/../address/example.csv")->getCsv()->contact;
// gather the obtained  data into this array
?>
<!DOCTYPE html>
<html lang="en">

<?php 
include '../views/head.php';
?>
<body>
    <div class="container-narrow">
        <div class="masthead">
            <h3 class="muted">CSV Manager</h3>
        </div>
        <div class="jumbotron">
            <a class="btn btn-large btn-success" href="add.php">Add Contact</a>
            <?php 
// no data message
if (empty($contacts)) {
    ?>
            <h4>No data avalaible</h4>
            <?php 
} else {
    include '../views/list.php';
}
예제 #3
0
<?php

// Ejecutamos la lógica de arranque de la app, o lógica de bootstrap
include_once 'autoloader.php';
use Javiers\Agenda\csvmanager;
// Lets cruD deleting contact
csvmanager::getInstance(__DIR__ . "/../address/example.csv")->delete($_POST['id'])->write();
// Redirect back to home
header('Location: /trycatch/csvmanager/list.php');
exit;