| Current Path : /var/www/html/mmishra/erp/controllers/ |
| Current File : /var/www/html/mmishra/erp/controllers/test_controller.php |
<?php
//if (!class_exists($erpController)) {
require_once __DIR__."/erp_controller.php";
//}
class testController extends erpController {
var $model;
public function __construct($model) {
// call parent constructor
// parent::__construct();
// initialize variables
$this->model = $model;
$this->model->tupleID = $this->tuple;
$this->userIP = $this->getIP(); // requires in log entry
$this->appURL = $_SERVER["REQUEST_URI"]; // this is Request URI for log entry
$this->referer = $_SERVER["HTTP_REFERER"]; // requires for log entry, not mandatory
// maintain erp activity log for inner contents
if ($_SESSION["loginID"] && strpos($this->appURL, 'inner')) {
$this->model->erpLog($this->userIP, $this->appURL, $this->referer);
} else if ($this->model->getMenuProtection($this->menu)) {
print("<h1>Session expired. Please sign-in again.</h1>");
exit;
}
}
public function __destruct() {
//'Destroying: ', $this->moduleID, PHP_EOL;
// log sql operation on corresponding table
// call $erpModel->erpSql($sql);
// print("Thanks.");
}
public function manageHello($action, $rowID) {
$this->model->tableID = 'test_hellos';
$this->model->tupleID = $rowID;
$hostelID = $this->params[0];
$allotmentID = $this->params[1];
switch ($action) {
case 'new':
case 'edit':
$this->editLock = '';
break;
case 'refresh':
case 'open':
case 'help':
case 'trash':
break;
case 'save':
// save record
$myname = $_POST["myname"];
$this->model->saveHello($myname);
$this->model->sqlLog();
$this->errorText = 'Hello record saved successfully.';
break;
case 'delete':
// delete record
$this->model->deleteHello();
$this->model->sqlLog();
$this->errorText = 'Hello record deleted successfully.';
break;
}
return $this->model->tupleID;
}
}
?>