Example #1
0
 /**
  * Action finish
  *
  * Finish the CRUD operation.
  * Select the stencil and download zip.
  *
  */
 public function action_finish($table_name, $load = false)
 {
     // set table name in data array
     Table::update_data(array('TBL_NAME' => $table_name), true);
     // create data if none exists
     // this means the user clicked the 'express' generation option in action_tables
     if ($load) {
         Table::get_all_data($load);
     }
     // set padding for each column
     Table::set_column_pad();
     // use first item not ommited from the listing for sort order
     Table::set_sort_by_column();
     // get post input
     if ($input = \Input::post(null)) {
         // write files to output directory
         if (\Input::post('submit') == 'Download Zip') {
             if (!File::download_zip()) {
                 $msg = array('modal_id' => 'modal_error', 'text' => Error::get_all());
                 \Session::set_flash('modal_msg', $msg);
             }
         }
         // redirect
         \Response::redirect(self::_breadcrumbs(\Request::active()->action, 'prev'));
     }
     // set global stencil template vars
     $this->template->set_global('stencil', array('data' => Stencil::get(Table::get('crud.STENCIL_NAME'))));
     // set common template vars
     self::_set_template_vars($this->template);
 }