Example #1
0
 function __construct()
 {
     $header = array('#', 'ID', 'ADDRESS');
     $dba = new DB();
     $data = $dba->getAll('SELECT * FROM customer');
     parent::__construct("Customer Report", $header, $data);
 }
Example #2
0
 public static function processForm($form)
 {
     $data = DataBase::extractDataForm($form);
     $tables = NULL;
     if (!isset($data)) {
         return;
     }
     //First we create instance to the tables
     foreach ($data as $table => $value) {
         $ob_table = parent::dispense($table);
         foreach ($value as $col => $value) {
             $ob_table[$col] = $value;
         }
         $tables[] = $ob_table;
     }
     return $tables;
 }
Example #3
0
 function customeraddAction(Request $request)
 {
     // This our DataBase Object!
     //Creating Report Table for customer
     $customertable = new RT();
     /*
      * Creating customer Form
      * Check forms/CustomerForm.php
      */
     $customerform = new CF();
     //persistence($request) method keep the data through requests
     $customerform->persistence($request);
     //$errors variable is going to be an array to save all the errors
     $errors = '';
     $success = '';
     //now we check is the form has been summitted
     if ($request->isMethod('POST')) {
         //Validating the form
         $customerform->validate();
         /*
          * storeForm($form) save the data from a form to the DB
          * return an execption if it found a error
          */
         $e = DB::storeForm($customerform);
         if (isset($e)) {
             $errors = $e->getMessage();
         } else {
             $success = 'Data Saved!';
         }
     }
     /*
       return the view/example/customerform.html template
       also we send the customerform as parameter
       and the errors variable
     */
     return $this->render('example/customerform', array('url' => $this->generateURL('customerform'), 'newurl' => $this->generateURL('customerform'), 'form' => $customerform, 'error' => $errors, 'success' => $success, 'table' => $customertable->createReport()));
 }