PHP Classes
elePHPant
Icontem

File: example/controller.php

Recommend this page to a friend!
  Classes of Daniel Alan Guerrero Matamoros  >  JSON Schedule creator  >  example/controller.php  >  Download  
File: example/controller.php
Role: Example script
Content type: text/plain
Description: Controller for send and receive data
Class: JSON Schedule creator
Manage event time schedules stored in JSON files
Author: By
Last change: Role
Date: 3 years ago
Size: 1,044 bytes
 

Contents

Class file image Download
<?php

require_once("Schedule.php");

if(isset(
$_POST["action"])){
   
   
$Y = $_POST["Y"];
   
$n = $_POST["n"];
   
$j = $_POST["j"];
   
   
$inicio = $_POST["Start"];
   
$desc = $_POST["Desc"];
   
$fin = $_POST["Fin"];
   
    switch(
$_POST["action"]){
       
        case
"Create":
           
$c = new Schedule($Y, $n, $j);
           
$c->create($Y, $n, $j);
            echo
"New schedule created";
        break;
       
        case
"Add":
           
$c = new Schedule($Y, $n, $j);
            if(
$c->getData($Y, $n, $j)){
               
$c->add($inicio, $desc, $fin);
                echo
"New entry added";
            }
        break;
       
        case
"See":
           
$c = new Schedule($Y, $n, $j);
            if(
$c->getData($Y, $n, $j)){
               
$c->see();
            } else {
                echo
"Date does not exist";
            }
        break;
       
        default:
            echo
"Command error";
       
    }
   
}

?>