In the controller, we need to implement 3 actions:
To load and process data we will use GridConnector. A common use of GridConnector is:
$connector = new GridConnector($db, $type);
$connector->configure($table,$id, $text, $extra,$relation_id);
$connector->render();
The GridConnector constructor takes 2 parameters:
Remember, in case of working with CakePHP, the parameters will get the values:
$this→Event (refers to the model used in the app) and "PHPCake" (the hardcoded value).
The configure method configures the GridConnector object without rendering data and takes 5 parameters:
"controllers/EventController.php" file
<?php
require_once("../Vendor/connector/grid_connector.php");
require_once("../Vendor/connector/scheduler_connector.php");
require_once("../Vendor/connector/db_phpcake.php");
"controllers/EventController.php" file
<?php
require_once("../Vendor/connector/grid_connector.php");
require_once("../Vendor/connector/scheduler_connector.php");
require_once("../Vendor/connector/db_phpcake.php");
class EventController extends AppController { public function grid(){} public function scheduler(){} public function index(){} }
"controllers/EventController.php" file
<?php
require_once("../Vendor/connector/grid_connector.php");
require_once("../Vendor/connector/scheduler_connector.php");
require_once("../Vendor/connector/db_phpcake.php");
class EventController extends AppController {
public function grid(){}
public function scheduler(){}
public function index(){}
}
public function grid_data(){ $this->autoRender = false; $connector = new GridConnector($this->Event, "PHPCake"); $connector->configure("events","event_id","start_date,end_date,event_name"); $connector->render(); }
"controllers/EventController.php" file
<?php
require_once("../Vendor/connector/grid_connector.php");
require_once("../Vendor/connector/scheduler_connector.php");
require_once("../Vendor/connector/db_phpcake.php");
class EventController extends AppController {
public function grid(){}
public function scheduler(){}
public function index(){}
}
public function grid_data(){
$this->autoRender = false;
$connector = new GridConnector($this->Event, "PHPCake");
$connector->configure("events","event_id","start_date,end_date,event_name");
$connector->render();
}
public function scheduler_data(){ $this->autoRender = false; $connector = new SchedulerConnector($this->Event, "PHPCake"); $connector->configure("events","event_id","start_date,end_date,event_name"); $connector->render(); }