Merge branch 'dev/mod_tarifas_rangos' into 'main'

Dev/mod tarifas rangos

See merge request jjimenez/safekat!24
This commit is contained in:
2023-06-14 10:44:18 +00:00
241 changed files with 83899 additions and 385 deletions

2
.vscode/sftp.json vendored
View File

@ -4,7 +4,7 @@
"protocol": "ftp",
"port": 21,
"username": "sk-jjo",
"password": "yuh1C^290",
"password": "Snwi1660%",
"remotePath": "/",
"uploadOnSave": true,
"useTempFile": false,

View File

@ -65,17 +65,18 @@ $routes->group('paises', ['namespace' => 'App\Controllers\Configuracion'], funct
});
$routes->group('tarifaacabado', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
$routes->get('', 'Tarifaacabado::index', ['as' => 'tarifaacabadoList']);
$routes->get('index', 'Tarifaacabado::index', ['as' => 'tarifaacabadoIndex']);
$routes->get('list', 'Tarifaacabado::index', ['as' => 'tarifaacabadoList2']);
$routes->get('add', 'Tarifaacabado::add', ['as' => 'newTarifaacabado']);
$routes->post('add', 'Tarifaacabado::add', ['as' => 'createTarifaacabado']);
$routes->get('edit/(:num)', 'Tarifaacabado::edit/$1', ['as' => 'editTarifaacabado']);
$routes->post('edit/(:num)', 'Tarifaacabado::edit/$1', ['as' => 'updateTarifaacabado']);
$routes->get('delete/(:num)', 'Tarifaacabado::delete/$1', ['as' => 'deleteTarifaacabado']);
$routes->post('allmenuitems', 'Tarifaacabado::allItemsSelect', ['as' => 'select2ItemsOfTarifasacabado']);
$routes->post('menuitems', 'Tarifaacabado::menuItems', ['as' => 'menuItemsOfTarifasacabado']);
$routes->get('', 'Tarifaacabado::index', ['as' => 'tarifaAcabadoList']);
$routes->get('add', 'Tarifaacabado::add', ['as' => 'newTarifaAcabado']);
$routes->post('add', 'Tarifaacabado::add', ['as' => 'createTarifaAcabado']);
$routes->post('create', 'Tarifaacabado::create', ['as' => 'ajaxCreateTarifaAcabado']);
$routes->put('(:num)/update', 'Tarifaacabado::update/$1', ['as' => 'ajaxUpdateTarifaAcabado']);
$routes->post('edit/(:num)', 'Tarifaacabado::edit/$1', ['as' => 'updateTarifaAcabado']);
$routes->post('datatable', 'Tarifaacabado::datatable', ['as' => 'dataTableOfTarifasAcabado']);
$routes->post('allmenuitems', 'Tarifaacabado::allItemsSelect', ['as' => 'select2ItemsOfTarifasAcabado']);
$routes->post('menuitems', 'Tarifaacabado::menuItems', ['as' => 'menuItemsOfTarifasAcabado']);
});
$routes->resource('tarifaacabado', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifaacabado', 'except' => 'show,new,create,update']);
$routes->group('users', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
$routes->get('', 'Users::index', ['as' => 'userList']);
@ -191,6 +192,20 @@ $routes->group('papelimpresiontipologias', ['namespace' => 'App\Controllers\Conf
$routes->get('delete/(:num)', 'Papelimpresiontipologias::delete/$1', ['as' => 'deletePapelImpresionTipologia']);
});
$routes->group('tarifaacabadolineas', ['namespace' => 'App\Controllers\Tarifas'], function ($routes) {
$routes->get('', 'Tarifaacabadolineas::index', ['as' => 'tarifaAcabadoLineaList']);
$routes->get('add', 'Tarifaacabadolineas::add', ['as' => 'newTarifaAcabadoLinea']);
$routes->post('add', 'Tarifaacabadolineas::add', ['as' => 'createTarifaAcabadoLinea']);
$routes->post('create', 'Tarifaacabadolineas::create', ['as' => 'ajaxCreateTarifaAcabadoLinea']);
$routes->put('(:num)/update', 'Tarifaacabadolineas::update/$1', ['as' => 'ajaxUpdateTarifaAcabadoLinea']);
$routes->post('(:num)/edit', 'Tarifaacabadolineas::edit/$1', ['as' => 'updateTarifaAcabadoLinea']);
$routes->post('datatable', 'Tarifaacabadolineas::datatable', ['as' => 'dataTableOfTarifaAcabadoLineas']);
$routes->post('datatable_editor', 'Tarifaacabadolineas::datatable_editor', ['as' => 'editorOfTarifaAcabadoLineas']);
$routes->post('allmenuitems', 'Tarifaacabadolineas::allItemsSelect', ['as' => 'select2ItemsOfTarifaAcabadoLineas']);
$routes->post('menuitems', 'Tarifaacabadolineas::menuItems', ['as' => 'menuItemsOfTarifaAcabadoLineas']);
$routes->get('delete/(:num)', 'Tarifaacabadolineas::delete/$1', ['as' => 'deleteTarifaAcabadoLinea']);
});
$routes->resource('tarifaacabadolineas', ['namespace' => 'App\Controllers\Tarifas', 'controller' => 'Tarifaacabadolineas', 'except' => 'show,new,create,update']);
$routes->group('profile', ['namespace' => 'App\Controllers'], function ($routes) {

View File

@ -286,12 +286,12 @@ class Papelimpresiontipologias extends \App\Controllers\GoBaseResourceController
array_unshift($menu , $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName = csrf_token();
$output = array(
'success' => 'yes',
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
);
return json_encode($output);
} else {
return $this->failUnauthorized('Invalid request', 403);
}

View File

@ -1,45 +1,65 @@
<?php namespace App\Controllers\Tarifas;
<?php namespace App\Controllers\tarifas;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Tarifas\TarifaacabadoEntity;
class Tarifaacabado extends \App\Controllers\GoBaseController {
use App\Models\Tarifas\TarifaacabadoModel;
use \CodeIgniter\API\ResponseTrait;
class Tarifaacabado extends \App\Controllers\GoBaseResourceController {
protected static $primaryModelName = 'App\Models\Tarifas\TarifaacabadoModel';
protected $modelName = TarifaacabadoModel::class;
protected $format = 'json';
protected static $singularObjectNameCc = 'tarifaacabado';
protected static $singularObjectName = 'Tarifaacabado';
protected static $pluralObjectName = 'Tarifasacabado';
protected static $controllerSlug = 'tarifaacabado';
protected static $singularObjectName = 'Tarifa Acabado';
protected static $singularObjectNameCc = 'tarifaAcabado';
protected static $pluralObjectName = 'Tarifas Acabado';
protected static $pluralObjectNameCc = 'tarifasAcabado';
protected static $controllerSlug = 'tarifasacabado';
protected static $viewPath = 'themes/backend/vuexy/form/tarifas/acabado/';
protected $indexRoute = 'tarifaacabadoList';
protected $indexRoute = 'tarifaAcabadoList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->viewData['pageTitle'] = lang('Tarifaacabado.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
// Se indica que este controlador trabaja con soft_delete
$this->soft_delete = true;
// Se indica el flag para los ficheros borrados
$this->delete_flag = 1;
$this->viewData = ['usingServerSideDataTable' => true];
parent::initController($request, $response, $logger);
}
public function index() {
$this->viewData['usingClientSideDataTable'] = true;
$this->viewData['pageSubTitle'] = lang('Basic.global.ManageAllRecords', [lang('Tarifaacabado.tarifaacabado')]);
parent::index();
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('Tarifaacabado.tarifaacabado')]),
'tarifaacabadoEntity' => new TarifaacabadoEntity(),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath.'viewTarifaAcabadoList', $viewData);
}
public function add() {
// JJO
$session = session();
$requestMethod = $this->request->getMethod();
@ -49,13 +69,17 @@ class Tarifaacabado extends \App\Controllers\GoBaseController {
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$sanitizedData['user_created_id'] = $session->id_user;
$sanitizedData['user_update_id'] = $session->id_user;
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
// JJO
if(isset($this->model->user_update_id)){
$sanitizedData['user_created_id'] = $session->id_user;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
@ -76,28 +100,28 @@ class Tarifaacabado extends \App\Controllers\GoBaseController {
$id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('Tarifaacabado.tarifaacabado'))]).'.';
$message .= anchor(route_to('editTarifaacabado', $id), lang('Basic.global.continueEditing').'?');
$message .= anchor( "tarifasacabado/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
else:
return $this->redirect2listView('successMessage', $message);
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->viewData['successMessage'] = $message;
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['tarifaacabado_'] = isset($sanitizedData) ? new TarifaacabadoEntity($sanitizedData) : new TarifaacabadoEntity();
$this->viewData['tarifaacabadoEntity'] = isset($sanitizedData) ? new TarifaacabadoEntity($sanitizedData) : new TarifaacabadoEntity();
$this->viewData['formAction'] = route_to('createTarifaacabado');
$this->viewData['formAction'] = route_to('createTarifaAcabado');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Tarifaacabado.tarifaacabado').' '.lang('Basic.global.addNewSuffix');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('Tarifaacabado.moduleTitle').' '.lang('Basic.global.addNewSuffix');
return $this->displayForm(__METHOD__);
@ -112,11 +136,11 @@ class Tarifaacabado extends \App\Controllers\GoBaseController {
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$tarifaacabado_ = $this->model->find($id);
$tarifaacabadoEntity = $this->model->find($id);
if ($tarifaacabado_ == false) :
if ($tarifaacabadoEntity == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('Tarifaacabado.tarifaacabado')), $id]);
return $this->redirect2listView('errorMessage', $message);
return $this->redirect2listView('sweet-error', $message);
endif;
$requestMethod = $this->request->getMethod();
@ -126,19 +150,19 @@ class Tarifaacabado extends \App\Controllers\GoBaseController {
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
// JJO
if(isset($this->model->user_update_id)){
$sanitizedData['user_update_id'] = $session->id_user;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
@ -152,49 +176,77 @@ class Tarifaacabado extends \App\Controllers\GoBaseController {
endif;
$tarifaacabado_->fill($sanitizedData);
$tarifaacabadoEntity->fill($sanitizedData);
$thenRedirect = true;
endif;
if ($noException && $successfulResult) :
$id = $tarifaacabado_->id ?? $id;
$id = $tarifaacabadoEntity->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('Tarifaacabado.tarifaacabado'))]).'.';
$message .= anchor(route_to('editTarifaacabado', $id), lang('Basic.global.continueEditing').'?');
$message .= anchor( "tarifasacabado/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('successMessage', $message);
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
else:
return $this->redirect2listView('successMessage', $message);
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->viewData['successMessage'] = $message;
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['tarifaacabado_'] = $tarifaacabado_;
$this->viewData['tarifaacabadoEntity'] = $tarifaacabadoEntity;
$this->viewData['formAction'] = route_to('updateTarifaacabado', $id);
$this->viewData['formAction'] = route_to('updateTarifaAcabado', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Tarifaacabado.tarifaacabado').' '.lang('Basic.global.edit3');
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('Tarifaacabado.moduleTitle').' '.lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
public function datatable() {
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 1;
$order = TarifaacabadoModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 1];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$resourceData = $this->model->getResource($search)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($search)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function allItemsSelect() {
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal.', Select a field...', 'Select a field...', $onlyActiveOnes, false);
$menu = $this->model->getAllForMenu($reqVal.', nombre', 'nombre', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->Selectafield = '- '.lang('Basic.global.None').' -';
$nonItem->nombre = '- '.lang('Basic.global.None').' -';
array_unshift($menu , $nonItem);
$newTokenHash = csrf_hash();
@ -208,14 +260,14 @@ class Tarifaacabado extends \App\Controllers\GoBaseController {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function menuItems() {
if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0];
$reqText = goSanitize($this->request->getPost('text'))[0];
$onlyActiveOnes = false;
$columns2select = [$reqId ?? 'id', $reqText ?? 'Select a field...'];
$columns2select = [$reqId ?? 'id', $reqText ?? 'nombre'];
$onlyActiveOnes = false;
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
$nonItem = new \stdClass;
@ -233,5 +285,6 @@ class Tarifaacabado extends \App\Controllers\GoBaseController {
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
}
}

View File

@ -0,0 +1,412 @@
<?php namespace App\Controllers\Tarifas;
use App\Controllers\GoBaseResourceController;
use App\Models\Collection;
use App\Entities\Tarifas\TarifaAcabadoLinea;
use App\Models\tarifas\TarifaacabadoModel;
use App\Models\Tarifas\TarifaAcabadoLineaModel;
use
DataTables\Editor,
DataTables\Database,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Options,
DataTables\Editor\Upload,
DataTables\Editor\Validate,
DataTables\Editor\ValidateOptions;
class Tarifaacabadolineas extends \App\Controllers\GoBaseResourceController {
protected $modelName = TarifaAcabadoLineaModel::class;
protected $format = 'json';
protected static $singularObjectName = 'Tarifa Acabado Linea';
protected static $singularObjectNameCc = 'tarifaAcabadoLinea';
protected static $pluralObjectName = 'Tarifa Acabado Lineas';
protected static $pluralObjectNameCc = 'tarifaAcabadoLineas';
protected static $controllerSlug = 'tarifa-acabado-lineas';
protected static $viewPath = 'themes/backend/vuexy/form/tarifas/acabado/';
protected $indexRoute = 'tarifaAcabadoLineaList';
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) {
$this->viewData['pageTitle'] = lang('TarifaAcabadoLineas.moduleTitle');
$this->viewData['usingSweetAlert'] = true;
parent::initController($request, $response, $logger);
}
public function index() {
$viewData = [
'currentModule' => static::$controllerSlug,
'pageSubTitle' => lang('Basic.global.ManageAllRecords', [lang('TarifaAcabadoLineas.tarifaAcabadoLinea')]),
'tarifaAcabadoLinea' => new TarifaAcabadoLinea(),
'usingServerSideDataTable' => true,
];
$viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class
return view(static::$viewPath.'viewTarifaAcabadoLineaList', $viewData);
}
public function add() {
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->save($sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else:
$this->viewData['errorMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TarifaAcabadoLineas.tarifaAcabadoLinea'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$thenRedirect = true; // Change this to false if you want your user to stay on the form after submission
endif;
if ($noException && $successfulResult) :
$id = $this->model->db->insertID();
$message = lang('Basic.global.saveSuccess', [mb_strtolower(lang('TarifaAcabadoLineas.tarifaAcabadoLinea'))]).'.';
$message .= anchor( "tarifa-acabado-lineas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['tarifaAcabadoLinea'] = isset($sanitizedData) ? new TarifaAcabadoLinea($sanitizedData) : new TarifaAcabadoLinea();
$this->viewData['tarifaAcabadoList'] = $this->getTarifaAcabadoListItems($tarifaAcabadoLinea->tarifa_acabado_id ?? null);
$this->viewData['formAction'] = route_to('createTarifaAcabadoLinea');
$this->viewData['boxTitle'] = lang('Basic.global.addNew').' '.lang('TarifaAcabadoLineas.moduleTitle').' '.lang('Basic.global.addNewSuffix');
return $this->displayForm(__METHOD__);
} // end function add()
public function edit($requestedId = null) {
if ($requestedId == null) :
return $this->redirect2listView();
endif;
$id = filter_var($requestedId, FILTER_SANITIZE_URL);
$tarifaAcabadoLinea = $this->model->find($id);
if ($tarifaAcabadoLinea == false) :
$message = lang('Basic.global.notFoundWithIdErr', [mb_strtolower(lang('TarifaAcabadoLineas.tarifaAcabadoLinea')), $id]);
return $this->redirect2listView('sweet-error', $message);
endif;
$requestMethod = $this->request->getMethod();
if ($requestMethod === 'post') :
$nullIfEmpty = true; // !(phpversion() >= '8.1');
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :
if ($this->canValidate()) :
try {
$successfulResult = $this->model->skipValidation(true)->update($id, $sanitizedData);
} catch (\Exception $e) {
$noException = false;
$this->dealWithException($e);
}
else:
$this->viewData['warningMessage'] = lang('Basic.global.formErr1', [mb_strtolower(lang('TarifaAcabadoLineas.tarifaAcabadoLinea'))]);
$this->session->setFlashdata('formErrors', $this->model->errors());
endif;
$tarifaAcabadoLinea->fill($sanitizedData);
$thenRedirect = true;
endif;
if ($noException && $successfulResult) :
$id = $tarifaAcabadoLinea->id ?? $id;
$message = lang('Basic.global.updateSuccess', [mb_strtolower(lang('TarifaAcabadoLineas.tarifaAcabadoLinea'))]).'.';
$message .= anchor( "tarifa-acabado-lineas/{$id}/edit" , lang('Basic.global.continueEditing').'?');
$message = ucfirst(str_replace("'", "\'", $message));
if ($thenRedirect) :
if (!empty($this->indexRoute)) :
return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
else:
return $this->redirect2listView('sweet-success', $message);
endif;
else:
$this->session->setFlashData('sweet-success', $message);
endif;
endif; // $noException && $successfulResult
endif; // ($requestMethod === 'post')
$this->viewData['tarifaAcabadoLinea'] = $tarifaAcabadoLinea;
$this->viewData['tarifaAcabadoList'] = $this->getTarifaAcabadoListItems($tarifaAcabadoLinea->tarifa_acabado_id ?? null);
$this->viewData['formAction'] = route_to('updateTarifaAcabadoLinea', $id);
$this->viewData['boxTitle'] = lang('Basic.global.edit2').' '.lang('TarifaAcabadoLineas.moduleTitle').' '.lang('Basic.global.edit3');
return $this->displayForm(__METHOD__, $id);
} // end function edit(...)
public function datatable() {
if ($this->request->isAJAX()) {
$reqData = $this->request->getPost();
if (!isset($reqData['draw']) || !isset($reqData['columns']) ) {
$errstr = 'No data available in response to this specific request.';
$response = $this->respond(Collection::datatable( [], 0, 0, $errstr ), 400, $errstr);
return $response;
}
$start = $reqData['start'] ?? 0;
$length = $reqData['length'] ?? 5;
$search = $reqData['search']['value'];
$requestedOrder = $reqData['order']['0']['column'] ?? 0;
$order = TarifaAcabadoLineaModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
$dir = $reqData['order']['0']['dir'] ?? 'asc';
$id_TA = $reqData['id_tarifaacabado'] ?? -1;
$resourceData = $this->model->getResource("", $id_TA)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
return $this->respond(Collection::datatable(
$resourceData,
$this->model->getResource()->countAllResults(),
$this->model->getResource($search, $id_TA)->countAllResults()
));
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function datatable_editor() {
if ($this->request->isAJAX()) {
include(APPPATH . "ThirdParty/DatatablesEditor/DataTables.php");
// Build our Editor instance and process the data coming from _POST
$response = Editor::inst( $db, 'tarifa_acabado_lineas' )
->fields(
Field::inst( 'tirada_min' )
->validator( 'Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.tirada_min.decimal') )
)
->validator( 'Validate::notEmpty',array(
'message' => lang('TarifaAcabadoLineas.validation.tirada_min.required') )
),
Field::inst( 'tirada_max' )
->validator( 'Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.tirada_max.decimal') )
)
->validator( 'Validate::notEmpty',array(
'message' => lang('TarifaAcabadoLineas.validation.tirada_max.required') )
),
Field::inst( 'precio_min' )
->validator( 'Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.precio_min.decimal') )
)
->validator( 'Validate::notEmpty',array(
'message' => lang('TarifaAcabadoLineas.validation.precio_min.required') )
),
Field::inst( 'precio_max' )
->validator( 'Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.precio_max.decimal') )
)
->validator( 'Validate::notEmpty',array(
'message' => lang('TarifaAcabadoLineas.validation.precio_max.required') )
),
Field::inst( 'precio_unidad' )
->validator( 'Validate::numeric', array(
'message' => lang('TarifaAcabadoLineas.validation.precio_unidad.decimal') )
)
->validator( 'Validate::notEmpty',array(
'message' => lang('TarifaAcabadoLineas.validation.precio_unidad.required') )
),
Field::inst( 'tarifa_acabado_id' ),
Field::inst( 'user_created_id' ),
Field::inst( 'created_at' ),
Field::inst( 'user_updated_id' ),
Field::inst( 'updated_at' ),
Field::inst( 'is_deleted' ),
Field::inst( 'deleted_at' ),
)
->validator( function($editor, $action, $data){
if ($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT){
foreach ($data['data'] as $pkey => $values ){
$count = $this->model->select('*')
->where(array('tirada_min'=> $values['tirada_min'], 'tirada_max'=> $values['tirada_max'], 'is_deleted'=> 0))
->countAllResults();
if ($count >= 1){
return lang('TarifaAcabadoLineas.validation.duplicated_tirada');
}
}
}
})
->on( 'preCreate', function ( $editor, &$values ) {
$session = session();
$datetime = (new \CodeIgniter\I18n\Time("now"));
$editor
->field( 'user_created_id' )
->setValue( $session->id_user );
$editor
->field( 'created_at' )
->setValue( $datetime->format('Y-m-d H:i:s') );
} )
->on( 'preEdit', function ( $editor, &$values ) {
$session = session();
$datetime = (new \CodeIgniter\I18n\Time("now"));
$editor
->field( 'user_updated_id' )
->setValue( $session->id_user );
$editor
->field( 'updated_at' )
->setValue( $datetime->format('Y-m-d H:i:s') );
} )
->debug(true)
->process( $_POST )
->data();
// if unique key is set in DB
if(isset($response['error'])){
if(str_contains($response['error'], "tirada_min_tirada_max") &&
str_contains($response['error'], "Duplicate entry ")){
$response['error'] = lang('TarifaAcabadoLineas.validation.duplicated_tirada');
}
}
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$response[$csrfTokenName] = $newTokenHash;
echo json_encode($response);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function allItemsSelect() {
if ($this->request->isAJAX()) {
$onlyActiveOnes = true;
$reqVal = $this->request->getPost('val') ?? 'id';
$menu = $this->model->getAllForMenu($reqVal.', tarifa_acabado_id', 'tarifa_acabado_id', $onlyActiveOnes, false);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->tarifa_acabado_id = '- '.lang('Basic.global.None').' -';
array_unshift($menu , $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
public function menuItems() {
if ($this->request->isAJAX()) {
$searchStr = goSanitize($this->request->getPost('searchTerm'))[0];
$reqId = goSanitize($this->request->getPost('id'))[0];
$reqText = goSanitize($this->request->getPost('text'))[0];
$onlyActiveOnes = false;
$columns2select = [$reqId ?? 'id', $reqText ?? 'tarifa_acabado_id'];
$onlyActiveOnes = false;
$menu = $this->model->getSelect2MenuItems($columns2select, $columns2select[1], $onlyActiveOnes, $searchStr);
$nonItem = new \stdClass;
$nonItem->id = '';
$nonItem->text = '- '.lang('Basic.global.None').' -';
array_unshift($menu , $nonItem);
$newTokenHash = csrf_hash();
$csrfTokenName = csrf_token();
$data = [
'menu' => $menu,
$csrfTokenName => $newTokenHash
];
return $this->respond($data);
} else {
return $this->failUnauthorized('Invalid request', 403);
}
}
protected function getTarifaAcabadoListItems($selId = null) {
$data = [''=>lang('Basic.global.pleaseSelectA', [mb_strtolower(lang('Tarifaacabado.tarifaAcabado'))])];
if (!empty($selId)) :
$tarifaacabadoModel = model('App\Models\tarifas\TarifaacabadoModel');
$selOption = $tarifaacabadoModel->where('id', $selId)->findColumn('id');
if (!empty($selOption)) :
$data[$selId] = $selOption[0];
endif;
endif;
return $data;
}
}

View File

@ -41,7 +41,8 @@ class Tarifamanipulado extends \App\Controllers\GoBaseController {
public function add() {
// JJO
$session = session();
$requestMethod = $this->request->getMethod();
@ -52,6 +53,10 @@ class Tarifamanipulado extends \App\Controllers\GoBaseController {
$postData = $this->request->getPost();
$sanitizedData = $this->sanitized($postData, $nullIfEmpty);
// JJO
if(isset($this->model->user_update_id)){
$sanitizedData['user_created_id'] = $session->id_user;
}
$noException = true;
if ($successfulResult = $this->canValidate()) : // if ($successfulResult = $this->validate($this->formValidationRules) ) :

View File

@ -0,0 +1,33 @@
<?php
namespace App\Entities\Tarifas;
use CodeIgniter\Entity;
class TarifaAcabadoLinea extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"tarifa_acabado_id" => 0,
"tirada_min" => 0,
"tirada_max" => 0,
"precio_min" => 0,
"precio_max" => 0,
"precio_unidad" => 0,
"user_created_id" => 0,
"user_updated_id" => 0,
"is_deleted" => 0,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"tarifa_acabado_id" => "int",
"tirada_min" => "int",
"tirada_max" => "int",
"precio_min" => "float",
"precio_max" => "float",
"precio_unidad" => "float",
"user_created_id" => "int",
"user_updated_id" => "int",
"is_deleted" => "int",
];
}

View File

@ -1,33 +1,22 @@
<?php
namespace App\Entities\Tarifas;
namespace App\Entities\tarifas;
use CodeIgniter\Entity\Entity;
class TarifaacabadoEntity extends Entity
use CodeIgniter\Entity;
class TarifaacabadoEntity extends \CodeIgniter\Entity\Entity
{
protected $attributes = [
"id" => null,
"nombre" => null,
"tirada_min" => 0,
"precio_min" => 0,
"tirada_max" => 0,
"precio_max" => null,
"ajuste" => 0,
"formula_price" => null,
"user_created_id" => 1,
"user_update_id" => 1,
"deleted_at" => null,
"user_created_id" => 0,
"user_update_id" => 0,
"is_deleted" => 0,
"created_at" => null,
"updated_at" => null,
];
protected $casts = [
"tirada_min" => "int",
"precio_min" => "float",
"tirada_max" => "int",
"precio_max" => "float",
"ajuste" => "float",
"user_created_id" => "int",
"user_update_id" => "int",
"is_deleted" => "int",
];
}

View File

@ -79,7 +79,8 @@ return [
'sureToDeleteTitle' => 'Are you sure you want to delete this {0}?',
'text' => 'This action cannot be undone.',
'title' => 'Are you sure?',
'maxRowsReached' => 'No more lines can be added.'
'maxRowsReached' => 'No more lines can be added.',
'line' => 'the line'
],
'ok' => 'Ok',
'wait' => 'Wait',

View File

@ -0,0 +1,51 @@
<?php
return [
'id' => 'ID',
'moduleTitle' => 'Finish rates Lines',
'deleteLine' => 'the selected register',
'precioMax' => 'Max Price',
'precioMin' => 'Min Price',
'precioUnidad' => 'Price Unit',
'tiradaMax' => 'Print Max',
'tiradaMin' => 'Print Min',
'validation' => [
'duplicated_tirada' => "Duplicated line (the couple 'Print Min' and 'Print Max' must be unique)",
'precio_max' => [
'decimal' => 'The field must contain a decimal number.',
'required' => 'The field is required.',
],
'precio_min' => [
'decimal' => 'The field must contain a decimal number.',
'required' => 'The field is required.',
],
'precio_unidad' => [
'decimal' => 'The field must contain a decimal number.',
'required' => 'The field is required.',
],
'tirada_max' => [
'integer' => 'The field must contain an integer.',
'required' => 'The field is required.',
],
'tirada_min' => [
'integer' => 'The field must contain an integer.',
'required' => 'The field is required.',
],
],
];

View File

@ -79,7 +79,8 @@ return [
'sureToDeleteTitle' => 'Está seguro de borrar {0}?',
'text' => 'Esta acción no se puede deshacer.',
'title' => 'Está seguro?',
'maxRowsReached' => 'No se pueden añadir más líneas.'
'maxRowsReached' => 'No se pueden añadir más líneas.',
'line' => 'la línea'
],
'ok' => 'Ok',

View File

@ -0,0 +1,50 @@
<?php
return [
'id' => 'ID',
'moduleTitle' => 'Tarifa Acabado Lineas',
'deleteLine' => 'el registro seleccionado',
'precioMax' => 'Precio Max',
'precioMin' => 'Precio Min',
'precioUnidad' => 'Precio Unidad',
'tiradaMax' => 'Tirada Max',
'tiradaMin' => 'Tirada Min',
'validation' => [
'duplicated_tirada' => "Línea duplicada (la pareja 'Tirada Min' y 'Tirada Max' debe de ser única)",
'precio_max' => [
'decimal' => 'El campo debe contener un número decimal.',
'required' => 'El campo es obligatorio.',
],
'precio_min' => [
'decimal' => 'El campo debe contener un número decimal.',
'required' => 'El campo es obligatorio.',
],
'precio_unidad' => [
'decimal' => 'El campo debe contener un número decimal.',
'required' => 'El campo es obligatorio.',
],
'tirada_max' => [
'integer' => 'El campo debe contener un número entero.',
'required' => 'El campo es obligatorio.',
],
'tirada_min' => [
'integer' => 'El campo debe contener un número entero.',
'required' => 'El campo es obligatorio.',
],
],
];

View File

@ -0,0 +1,191 @@
<?php
namespace App\Models\Tarifas;
class TarifaAcabadoLineaModel extends \App\Models\GoBaseModel
{
protected $table = "tarifa_acabado_lineas";
/**
* Whether primary key uses auto increment.
*
* @var bool
*/
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t1.tirada_min",
1 => "t1.tirada_max",
2 => "t1.precio_min",
3 => "t1.precio_max",
4 => "t1.precio_unidad",
];
protected $allowedFields = [
"tirada_min",
"tirada_max",
"precio_min",
"precio_max",
"precio_unidad",
"user_created_id",
"is_deleted",
];
protected $returnType = "App\Entities\Tarifas\TarifaAcabadoLinea";
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "tarifa_acabado_id";
protected $validationRules = [
"is_deleted" => [
"label" => "TarifaAcabadoLineas.isDeleted",
"rules" => "required|integer",
],
"precio_max" => [
"label" => "TarifaAcabadoLineas.precioMax",
"rules" => "required|decimal",
],
"precio_min" => [
"label" => "TarifaAcabadoLineas.precioMin",
"rules" => "required|decimal",
],
"precio_unidad" => [
"label" => "TarifaAcabadoLineas.precioUnidad",
"rules" => "required|decimal",
],
"tirada_max" => [
"label" => "TarifaAcabadoLineas.tiradaMax",
"rules" => "required|integer",
],
"tirada_min" => [
"label" => "TarifaAcabadoLineas.tiradaMin",
"rules" => "required|integer",
],
"user_created_id" => [
"label" => "TarifaAcabadoLineas.userCreatedId",
"rules" => "required|integer",
],
];
protected $validationMessages = [
"is_deleted" => [
"integer" => "TarifaAcabadoLineas.validation.is_deleted.integer",
"required" => "TarifaAcabadoLineas.validation.is_deleted.required",
],
"precio_max" => [
"decimal" => "TarifaAcabadoLineas.validation.precio_max.decimal",
"required" => "TarifaAcabadoLineas.validation.precio_max.required",
],
"precio_min" => [
"decimal" => "TarifaAcabadoLineas.validation.precio_min.decimal",
"required" => "TarifaAcabadoLineas.validation.precio_min.required",
],
"precio_unidad" => [
"decimal" => "TarifaAcabadoLineas.validation.precio_unidad.decimal",
"required" => "TarifaAcabadoLineas.validation.precio_unidad.required",
],
"tirada_max" => [
"integer" => "TarifaAcabadoLineas.validation.tirada_max.integer",
"required" => "TarifaAcabadoLineas.validation.tirada_max.required",
],
"tirada_min" => [
"integer" => "TarifaAcabadoLineas.validation.tirada_min.integer",
"required" => "TarifaAcabadoLineas.validation.tirada_min.required",
],
"user_created_id" => [
"integer" => "TarifaAcabadoLineas.validation.user_created_id.integer",
"required" => "TarifaAcabadoLineas.validation.user_created_id.required",
],
];
public function findAllWithTarifaAcabado(string $selcols = "*", int $limit = null, int $offset = 0)
{
$sql =
"SELECT t1." .
$selcols .
", t2.id AS tarifa_acabado FROM " .
$this->table .
" t1 LEFT JOIN lg_tarifa_acabado t2 ON t1.tarifa_acabado_id = t2.id";
if (!is_null($limit) && intval($limit) > 0) {
$sql .= " LIMIT " . $limit;
}
if (!is_null($offset) && intval($offset) > 0) {
$sql .= " OFFSET " . $offset;
}
$query = $this->db->query($sql);
$result = $query->getResultObject();
return $result;
}
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "", $tarifa_acabado_id = -1)
{
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id AS id, t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max, t1.precio_min AS precio_min, t1.precio_max AS precio_max, t1.precio_unidad AS precio_unidad, t1.user_created_id AS user_created_id, t1.user_updated_id AS user_updated_id, t1.is_deleted AS is_deleted, t1.created_at AS created_at, t1.updated_at AS updated_at, t2.id AS tarifa_acabado"
);
if($tarifa_acabado_id>=0)
{
$builder->where('tarifa_acabado_id', $tarifa_acabado_id);
}
$builder->join("lg_tarifa_acabado t2", "t1.tarifa_acabado_id = t2.id", "left");
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.tirada_min", $search)
->orLike("t1.tirada_max", $search)
->orLike("t1.precio_min", $search)
->orLike("t1.precio_max", $search)
->orLike("t1.precio_unidad", $search)
->orLike("t1.user_created_id", $search)
->orLike("t1.user_updated_id", $search)
->orLike("t1.is_deleted", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->orLike("t2.id", $search)
->orLike("t1.tirada_min", $search)
->orLike("t1.tirada_max", $search)
->orLike("t1.precio_min", $search)
->orLike("t1.precio_max", $search)
->orLike("t1.precio_unidad", $search)
->orLike("t1.user_created_id", $search)
->orLike("t1.user_updated_id", $search)
->orLike("t1.is_deleted", $search)
->orLike("t1.created_at", $search)
->orLike("t1.updated_at", $search)
->orLike("t2.id", $search)
->groupEnd();
}
public function findLineasForTarifaAcabado(int $tarifaacabado_id){
$builder = $this->db
->table($this->table )
->select("*")
->where("tarifa_acabado_id", $tarifaacabado_id);
return $builder;
}
}

View File

@ -1,5 +1,5 @@
<?php
namespace App\Models\Tarifas;
namespace App\Models\tarifas;
class TarifaacabadoModel extends \App\Models\GoBaseModel
{
@ -11,88 +11,63 @@ class TarifaacabadoModel extends \App\Models\GoBaseModel
* @var bool
*/
protected $useAutoIncrement = true;
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
const SORTABLE = [
0 => "t1.nombre",
];
protected $allowedFields = [
"nombre",
"tirada_min",
"precio_min",
"tirada_max",
"precio_max",
"ajuste",
"formula_price",
"deleted_at",
"is_deleted",
"user_created_id",
"user_update_id",
];
protected $returnType = "App\Entities\Tarifas\TarifaacabadoEntity";
protected $returnType = 'App\Entities\Tarifas\TarifaacabadoEntity';
protected $useTimestamps = true;
protected $useSoftDeletes = false;
protected $createdField = "created_at";
protected $updatedField = "updated_at";
public static $labelField = "nombre";
protected $validationRules = [
"ajuste" => [
"label" => "Acabadoes.ajuste",
"rules" => "required|decimal",
],
"formula_price" => [
"label" => "Acabadoes.formulaPrice",
"rules" => "trim|required|max_length[1073241]",
],
"nombre" => [
"label" => "Acabadoes.nombre",
"rules" => "trim|required|max_length[255]",
],
"precio_max" => [
"label" => "Acabadoes.precioMax",
"rules" => "required|decimal",
],
"precio_min" => [
"label" => "Acabadoes.precioMin",
"rules" => "required|decimal",
],
"tirada_max" => [
"label" => "Acabadoes.tiradaMax",
"rules" => "required|integer",
],
"tirada_min" => [
"label" => "Acabadoes.tiradaMin",
"rules" => "required|integer",
]
];
protected $validationMessages = [
"ajuste" => [
"decimal" => "Acabadoes.validation.ajuste.decimal",
"required" => "Acabadoes.validation.ajuste.required",
],
"formula_price" => [
"max_length" => "Acabadoes.validation.formula_price.max_length",
"required" => "Acabadoes.validation.formula_price.required",
],
"nombre" => [
"max_length" => "Acabadoes.validation.nombre.max_length",
"required" => "Acabadoes.validation.nombre.required",
],
"precio_max" => [
"decimal" => "Acabadoes.validation.precio_max.decimal",
"required" => "Acabadoes.validation.precio_max.required",
],
"precio_min" => [
"decimal" => "Acabadoes.validation.precio_min.decimal",
"required" => "Acabadoes.validation.precio_min.required",
],
"tirada_max" => [
"integer" => "Acabadoes.validation.tirada_max.integer",
"required" => "Acabadoes.validation.tirada_max.required",
],
"tirada_min" => [
"integer" => "Acabadoes.validation.tirada_min.integer",
"required" => "Acabadoes.validation.tirada_min.required",
]
];
/**
* Get resource data.
*
* @param string $search
*
* @return \CodeIgniter\Database\BaseBuilder
*/
public function getResource(string $search = "")
{
$builder = $this->db->table($this->table . " t1")->select("t1.id AS id, t1.nombre AS nombre");
//JJO
$builder->where("t1.is_deleted", 0);
return empty($search)
? $builder
: $builder
->groupStart()
->like("t1.nombre", $search)
->orLike("t1.nombre", $search)
->groupEnd();
}
}

View File

@ -0,0 +1,54 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables;
if (!defined('DATATABLES')) exit();
//
// Configuration
// Load the database connection configuration options
//
if (!isset($sql_details)) {
include(APPPATH . 'ThirdParty/DatatablesEditor/config.php');
}
//
// Auto-loader
// Automatically loads DataTables classes - they are psr-4 compliant
//
spl_autoload_register(function ($class) {
$a = explode("\\", $class);
// Are we working in the DataTables namespace
if ($a[0] !== "DataTables") {
return;
}
array_shift($a);
$className = array_pop($a);
$path = count($a) ?
implode('/', $a) . '/' :
'';
include(APPPATH . 'ThirdParty/DatatablesEditor/' . $path . $className . '.php');
});
//
// Database connection
// Database connection is globally available
//
$db = new Database($sql_details);

View File

@ -0,0 +1,36 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
define("DATATABLES", true);
//
// Error checking - check that we are PHP 5.3 or newer
//
if (version_compare(PHP_VERSION, "5.3.0", '<')) {
echo json_encode(array(
"sError" => "Editor PHP libraries required PHP 5.3 or newer. You are " .
"currently using " . PHP_VERSION . ". PHP 5.3 and newer have a lot of " .
"great new features that the Editor libraries take advantage of to " .
"present an easy to use and flexible API."
));
exit(0);
}
//
// Load the DataTables bootstrap core file and let it register the required
// handlers.
//
include(APPPATH . 'ThirdParty/DatatablesEditor/Bootstrap.php');

View File

@ -0,0 +1,473 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables;
if (!defined('DATATABLES')) exit();
use
DataTables\Database\Query,
DataTables\Database\Result;
/**
* DataTables Database connection object.
*
* Create a database connection which may then have queries performed upon it.
*
* This is a database abstraction class that can be used on multiple different
* databases. As a result of this, it might not be suitable to perform complex
* queries through this interface or vendor specific queries, but everything
* required for basic database interaction is provided through the abstracted
* methods.
*/
class Database {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
/**
* Database instance constructor.
* @param string[] $opts Array of connection parameters for the database:
* ```php
* array(
* "user" => "", // User name
* "pass" => "", // Password
* "host" => "", // Host name
* "port" => "", // Port
* "db" => "", // Database name
* "type" => "" // Datable type: "Mysql", "Postgres" or "Sqlite"
* )
* ```
*/
function __construct( $opts )
{
$types = array( 'Mysql', 'Oracle', 'Postgres', 'Sqlite', 'Sqlserver', 'Db2', 'Firebird' );
if ( ! in_array( $opts['type'], $types ) ) {
throw new \Exception(
"Unknown database driver type. Must be one of ".implode(', ', $types),
1
);
}
$this->_type = $opts['type'];
$this->query_driver = "DataTables\\Database\\Driver\\".$opts['type'].'Query';
$this->_dbResource = isset( $opts['pdo'] ) ?
$opts['pdo'] :
call_user_func($this->query_driver.'::connect', $opts );
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
/** @var resource */
private $_dbResource = null;
/** @var callable */
private $_type = null;
private $_debugCallback = null;
private $query_driver = null;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
/**
* Determine if there is any data in the table that matches the query
* condition
*
* @param string|string[] $table Table name(s) to act upon.
* @param array $where Where condition for what to select - see {@see
* Query->where()}.
* @return boolean Boolean flag - true if there were rows
*/
public function any( $table, $where=null )
{
$res = $this->query( 'select' )
->table( $table )
->get( '*' )
->where( $where )
->limit(1)
->exec();
return $res->count() > 0;
}
/**
* Commit a database transaction.
*
* Use with {@see Database->transaction()} and {@see Database->rollback()}.
* @return self
*/
public function commit ()
{
call_user_func($this->query_driver.'::commit', $this->_dbResource );
return $this;
}
/**
* Get a count from a table.
* @param string|string[] $table Table name(s) to act upon.
* @param string $field Primary key field name
* @param array $where Where condition for what to select - see {@see
* Query->where()}.
* @return Number
*/
public function count ( $table, $field="id", $where=null )
{
$res = $this->query( 'count' )
->table( $table )
->get( $field )
->where( $where )
->exec();
$cnt = $res->fetch();
return $cnt['cnt'];
}
/**
* Get / set debug mode.
*
* @param boolean $_ Debug mode state. If not given, then used as a getter.
* @return boolean|self Debug mode state if no parameter is given, or
* self if used as a setter.
*/
public function debug ( $set=null )
{
if ( $set === null ) {
return $this->_debugCallback ? true : false;
}
else if ( $set === false ) {
$this->_debugCallback = null;
}
else {
$this->_debugCallback = $set;
}
return $this;
}
/**
* Perform a delete query on a table.
*
* This is a short cut method that creates an update query and then uses
* the query('delete'), table, where and exec methods of the query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $where Where condition for what to delete - see {@see
* Query->where()}.
* @return Result
*/
public function delete ( $table, $where=null )
{
return $this->query( 'delete' )
->table( $table )
->where( $where )
->exec();
}
/**
* Insert data into a table.
*
* This is a short cut method that creates an update query and then uses
* the query('insert'), table, set and exec methods of the query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $set Field names and values to set - see {@see
* Query->set()}.
* @param array $pkey Primary key column names (this is an array for
* forwards compt, although only the first item in the array is actually
* used). This doesn't need to be set, but it must be if you want to use
* the `Result->insertId()` method.
* @return Result
*/
public function insert ( $table, $set, $pkey='' )
{
return $this->query( 'insert' )
->pkey( $pkey )
->table( $table )
->set( $set )
->exec();
}
/**
* Update or Insert data. When doing an insert, the where condition is
* added as a set field
* @param string|string[] $table Table name(s) to act upon.
* @param array $set Field names and values to set - see {@see
* Query->set()}.
* @param array $where Where condition for what to update - see {@see
* Query->where()}.
* @param array $pkey Primary key column names (this is an array for
* forwards compt, although only the first item in the array is actually
* used). This doesn't need to be set, but it must be if you want to use
* the `Result->insertId()` method. Only used if an insert is performed.
* @return Result
*/
public function push ( $table, $set, $where=null, $pkey='' )
{
$selectColumn = '*';
if ( $pkey ) {
$selectColumn = is_array($pkey) ?
$pkey[0] :
$pkey;
}
// Update or insert
if ( $this->select( $table, $selectColumn, $where )->count() > 0 ) {
return $this->update( $table, $set, $where );
}
// Add the where condition to the values to set
foreach ($where as $key => $value) {
if ( ! isset( $set[ $key ] ) ) {
$set[ $key ] = $value;
}
}
return $this->insert( $table, $set, $pkey );
}
/**
* Create a query object to build a database query.
* @param string $type Query type - select, insert, update or delete.
* @param string|string[] $table Table name(s) to act upon.
* @return Query
*/
public function query ( $type, $table=null )
{
return new $this->query_driver( $this, $type, $table );
}
/**
* Quote a string for a quote. Note you should generally use a bind!
* @param string $val Value to quote
* @param string $type Value type
* @return string
*/
public function quote ( $val, $type=\PDO::PARAM_STR )
{
return $this->_dbResource->quote( $val, $type );
}
/**
* Create a `Query` object that will execute a custom SQL query. This is
* similar to the `sql` method, but in this case you must call the `exec()`
* method of the returned `Query` object manually. This can be useful if you
* wish to bind parameters using the query `bind` method to ensure data is
* properly escaped.
*
* @return Result
*
* @example
* Safely escape user input
* ```php
* $db
* ->raw()
* ->bind( ':date', $_POST['date'] )
* ->exec( 'SELECT * FROM staff where date < :date' );
* ```
*/
public function raw ()
{
return $this->query( 'raw' );
}
/**
* Get the database resource connector. This is typically a PDO object.
* @return resource PDO connection resource (driver dependent)
*/
public function resource ()
{
return $this->_dbResource;
}
/**
* Rollback the database state to the start of the transaction.
*
* Use with {@see Database->transaction()} and {@see Database->commit()}.
* @return self
*/
public function rollback ()
{
call_user_func($this->query_driver.'::rollback', $this->_dbResource );
return $this;
}
/**
* Select data from a table.
*
* This is a short cut method that creates an update query and then uses
* the query('select'), table, get, where and exec methods of the query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $field Fields to get from the table(s) - see {@see
* Query->get()}.
* @param array $where Where condition for what to select - see {@see
* Query->where()}.
* @param array $orderBy Order condition - see {@see
* Query->order()}.
* @return Result
*/
public function select ( $table, $field="*", $where=null, $orderBy=null )
{
return $this->query( 'select' )
->table( $table )
->get( $field )
->where( $where )
->order( $orderBy )
->exec();
}
/**
* Select distinct data from a table.
*
* This is a short cut method that creates an update query and then uses the
* query('select'), distinct ,table, get, where and exec methods of the
* query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $field Fields to get from the table(s) - see {@see
* Query->get()}.
* @param array $where Where condition for what to select - see {@see
* Query->where()}.
* @param array $orderBy Order condition - see {@see
* Query->order()}.
* @return Result
*/
public function selectDistinct ( $table, $field="*", $where=null, $orderBy=null )
{
return $this->query( 'select' )
->table( $table )
->distinct( true )
->get( $field )
->where( $where )
->order( $orderBy )
->exec();
}
/**
* Execute an raw SQL query - i.e. give the method your own SQL, rather
* than having the Database classes building it for you.
*
* This method will execute the given SQL immediately. Use the `raw()`
* method if you need the ability to add bound parameters.
* @param string $sql SQL string to execute (only if _type is 'raw').
* @return Result
*
* @example
* Basic select
* ```php
* $result = $db->sql( 'SELECT * FROM myTable;' );
* ```
*
* @example
* Set the character set of the connection
* ```php
* $db->sql("SET character_set_client=utf8");
* $db->sql("SET character_set_connection=utf8");
* $db->sql("SET character_set_results=utf8");
* ```
*/
public function sql ( $sql )
{
return $this->query( 'raw' )
->exec( $sql );
}
/**
* Start a new database transaction.
*
* Use with {@see Database->commit()} and {@see Database->rollback()}.
* @return self
*/
public function transaction ()
{
call_user_func($this->query_driver.'::transaction', $this->_dbResource );
return $this;
}
/**
* Get the database type (e.g. Postgres, Mysql, etc)
*/
public function type ()
{
return $this->_type;
}
/**
* Update data.
*
* This is a short cut method that creates an update query and then uses
* the query('update'), table, set, where and exec methods of the query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $set Field names and values to set - see {@see
* Query->set()}.
* @param array $where Where condition for what to update - see {@see
* Query->where()}.
* @return Result
*/
public function update ( $table, $set=null, $where=null )
{
return $this->query( 'update' )
->table( $table )
->set( $set )
->where( $where )
->exec();
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Internal functions
*/
/**
* Get debug query information.
*
* @return array Information about the queries used. When this method is
* called it will reset the query cache.
* @internal
*/
public function debugInfo ( $query=null, $bindings=null )
{
$callback = $this->_debugCallback;
if ( $callback ) {
$callback( array(
"query" => $query,
"bindings" => $bindings
) );
}
return $this;
}
};

View File

@ -0,0 +1,161 @@
<?php
/**
* DB2 database driver for DataTables libraries.
* BETA! Feedback welcome
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use DataTables\Database\Query;
use DataTables\Database\Driver\Db2Result;
/**
* DB2 driver for DataTables Database Query class
* @internal
*/
class Db2Query extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_editor_pkey_value;
private $_sql;
protected $_identifier_limiter = null;
protected $_field_quote = '"';
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
}
// $connStr = 'DATABASE='.$db.';HOSTNAME='.$host;
// if ( $port ) {
// $connStr .= ';PORT='.$port;
// }
// $connStr .= ';UID='.$user.';PWD='.$pass.';AUTHENTICATION=server';
$connStr = $db;
$conn = db2_connect($connStr, $user, $pass);
if ( ! $conn ) {
// If we can't establish a DB connection then we returna DataTables
// error.
$e = 'Connection failed: '.db2_conn_error().' : '.db2_conn_errormsg();
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e
) );
exit(0);
}
return $conn;
}
public static function transaction ( $conn )
{
// no op
}
public static function commit ( $conn )
{
// no op
}
public static function rollback ( $conn )
{
// no op
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare($sql)
{
$this->_sql = $sql;
}
protected function _exec()
{
$resource = $this->database()->resource();
$bindings = $this->_bindings;
$paramSql = preg_replace('/(:[a-zA-Z\-_0-9]*)/', '?', $this->_sql);
//echo $paramSql."\n";
$this->_stmt = db2_prepare($resource, $paramSql);
$stmt = $this->_stmt;
//echo $this->_sql."\n";
preg_match_all('/(:[a-zA-Z\-_0-9]*)/', $this->_sql, $matches);
//print_r( $matches );
//print_r( $bindings);
//$allanTest = 65;
//db2_bind_param( $stmt, 1, 'allanTest', DB2_PARAM_IN );
for ( $i=0, $ien=count($matches[0]) ; $i<$ien ; $i++ ) {
for ( $j=0, $jen=count($bindings) ; $j<$jen ; $j++ ) {
if ( $bindings[$j]['name'] === $matches[0][$i] ) {
$name = str_replace(':', '', $matches[0][$i]);
$$name = $bindings[$j]['value'];
//$_GLOBALS[ $name ] = $bindings[$j]['value'];
//echo "bind $name as ".$$name."\n";
db2_bind_param( $stmt, $i+1, $name, DB2_PARAM_IN );
}
}
}
//print_r( get_defined_vars() );
$res = db2_execute($stmt);
if (! $res) {
throw new \Exception('DB2 SQL error = '.db2_stmt_error($this->_stmt));
return false;
}
$resource = $this->database()->resource();
return new Db2Result($resource, $this->_stmt, $this->_editor_pkey_value);
}
protected function _build_table()
{
$out = array();
for ($i = 0, $ien = count($this->_table); $i < $ien; $i ++) {
$t = $this->_table[$i];
if (strpos($t, ' as ')) {
$a = explode(' as ', $t);
$out[] = $a[0] . ' ' . $a[1];
} else {
$out[] = $t;
}
}
return ' ' . implode(', ', $out) . ' ';
}
}

View File

@ -0,0 +1,82 @@
<?php
/**
* SQL Server driver for DataTables PHP libraries
* BETA! Feedback welcome
*
* @author SpryMedia
* @copyright 2013 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* SQL Server driver for DataTables Database Result class
* @internal
*/
class Db2Result extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
private $_allRows = null;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
$all = $this->_fetchAll();
return count($all);
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return db2_fetch_assoc( $this->_stmt );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
$all = $this->_fetchAll();
return $all;
}
public function insertId ()
{
return db2_last_insert_id( $this->_dbh );
}
private function _fetchAll () {
$a = array();
while ( $row = db2_fetch_assoc( $this->_stmt ) ) {
$a[] = $row;
}
return $a;
}
}

View File

@ -0,0 +1,137 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\FirebirdResult;
/**
* Firebird driver for DataTables Database Query class
* @internal
*/
class FirebirdQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
protected $_identifier_limiter = ['"', '"'];
protected $_field_quote = '"';
protected $_supportsAsAlias = false;
public $_pkeyInsertedTo;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
if ( $host !== "" ) {
$host = "{$host}";
if ( $port !== "" ) {
$host .= "/{$port}";
}
$host .= ';';
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
$pdo = @new PDO(
"firebird:{$host}dbname={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
$pkey = $this->pkey();
// If insert, add the pkey column
if ( $this->_type === 'insert' && $pkey ) {
$this->_pkeyInsertedTo = (is_array($pkey) ? $pkey[0] : $pkey);
$sql .= ' RETURNING "'.$this->_pkeyInsertedTo.'"';
}
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
try {
$this->_stmt->execute();
}
catch (\PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
$resource = $this->database()->resource();
return new FirebirdResult( $resource, $this->_stmt, $this->_pkeyInsertedTo );
}
}

View File

@ -0,0 +1,77 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* Firebird driver for DataTables Database Result class
* @internal
*/
class FirebirdResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt, $pkey )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
$this->_pkey = $pkey;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
private $_pkey;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetch( $fetchType );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetchAll( $fetchType );
}
public function insertId ()
{
// Only useful after an insert of course...
$rows = $this->_stmt->fetchAll();
return $rows[0][$this->_pkey];
}
}

View File

@ -0,0 +1,121 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\MysqlResult;
/**
* MySQL driver for DataTables Database Query class
* @internal
*/
class MysqlQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$host = $opts['host'];
$db = $opts['db'];
$port = isset( $opts['port'] ) ? $opts['port'] : '';
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
if ( $port !== "" ) {
$port = "port={$port};";
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
$pdo = @new PDO(
"mysql:host={$host};{$port}dbname={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
// $start = hrtime(true);
try {
$this->_stmt->execute();
}
catch (\PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
// $this->database()->debugInfo( 'Execution complete - duration: '. (hrtime(true) - $start) . ' Time: '. microtime(true), [] );
$resource = $this->database()->resource();
return new MysqlResult( $resource, $this->_stmt );
}
}

View File

@ -0,0 +1,73 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* MySQL driver for DataTables Database Result class
* @internal
*/
class MysqlResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetch( $fetchType );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetchAll( $fetchType );
}
public function insertId ()
{
return $this->_dbh->lastInsertId();
}
}

View File

@ -0,0 +1,203 @@
<?php
/**
* Oracle database driver for DataTables libraries.
*
* Note that this software uses the oci_* methods in PHP and NOT the Oracle PDO
* driver, which is poorly supported.
*
* @author SpryMedia
* @copyright 2014 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\OracleResult;
/**
* Oracle driver for DataTables Database Query class
* @internal
*/
class OracleQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_editor_pkey_value;
protected $_identifier_limiter = array( '"', '"' );
protected $_field_quote = '"';
protected $_supportsAsAlias = false;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
}
if ( $port !== "" ) {
$port = ":{$port}";
}
if ( ! is_callable( 'oci_connect' ) ) {
echo json_encode( array(
"error" => "oci methods are not available in this PHP install to connect to Oracle"
) );
exit(0);
}
$conn = @oci_connect($user, $pass, $host.$port.'/'.$db, 'utf8');
if ( ! $conn ) {
// If we can't establish a DB connection then we return a DataTables
// error.
$e = oci_error();
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e['message']
) );
exit(0);
}
// Use ISO date and time styles
$stmt = oci_parse($conn, "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'" );
$res = oci_execute( $stmt );
$stmt = oci_parse($conn, "ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" );
$res = oci_execute( $stmt );
return $conn;
}
public static function transaction ( $conn )
{
// no op
}
public static function commit ( $conn )
{
oci_commit( $conn );
}
public static function rollback ( $conn )
{
oci_rollback( $conn );
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$resource = $this->database()->resource();
$pkey = $this->pkey();
// If insert, add the pkey column
if ( $this->_type === 'insert' && $pkey ) {
$sql .= ' RETURNING '.$this->_protect_identifiers(is_array($pkey) ? $pkey[0] : $pkey).' INTO :editor_pkey_value';
}
else if ( $this->_type === 'select' && $this->_oracle_offset !== null ) {
$sql = '
select * from (select rownum rnum, a.*
from ('.$sql.') a where rownum <= '.($this->_oracle_offset+$this->_oracle_limit).')
where rnum > '.$this->_oracle_offset;
}
$this->database()->debugInfo( $sql, $this->_bindings );
$this->_stmt = oci_parse( $resource, $sql );
// If insert, add a binding for the returned id
if ( $this->_type === 'insert' && $pkey ) {
oci_bind_by_name(
$this->_stmt,
':editor_pkey_value',
$this->_editor_pkey_value,
36
);
}
// Bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
oci_bind_by_name(
$this->_stmt,
$binding['name'],
$binding['value']
);
}
}
protected function _exec()
{
$res = @oci_execute( $this->_stmt, OCI_NO_AUTO_COMMIT );
if ( ! $res ) {
$e = oci_error( $this->_stmt );
throw new \Exception( "Oracle SQL error: ".$e['message'] );
return false;
}
$resource = $this->database()->resource();
return new OracleResult( $resource, $this->_stmt, $this->_editor_pkey_value );
}
protected function _build_table()
{
$out = array();
for ( $i=0, $ien=count($this->_table) ; $i<$ien ; $i++ ) {
$t = $this->_table[$i];
if ( strpos($t, ' as ') ) {
$a = explode( ' as ', $t );
$out[] = $this->_protect_identifiers($a[0]).' '.$this->_protect_identifiers($a[1]);
}
else {
$out[] = $t;
}
}
return ' '.implode(', ', $out).' ';
}
private $_oracle_offset = null;
private $_oracle_limit = null;
protected function _build_limit()
{
$this->_oracle_offset = $this->_offset;
$this->_oracle_limit = $this->_limit;
return ' ';
}
}

View File

@ -0,0 +1,82 @@
<?php
/**
* Oracle database driver for Editor
*
* @author SpryMedia
* @copyright 2014 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* MySQL driver for DataTables Database Result class
* @internal
*/
class OracleResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt, $pkey_val )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
$this->_pkey_val = $pkey_val;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt; // Result from oci_parse
private $_dbh; // Result from oci_connect
private $_rows = null;
private $_pkey_val;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ )
{
return oci_fetch_assoc( $this->_stmt );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ )
{
if ( ! $this->_rows ) {
$out = array();
oci_fetch_all( $this->_stmt, $out, 0, -1, OCI_FETCHSTATEMENT_BY_ROW + OCI_ASSOC );
$this->_rows = $out;
}
return $this->_rows;
}
public function insertId ()
{
return $this->_pkey_val;
}
}

View File

@ -0,0 +1,146 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\PostgresResult;
/**
* Postgres driver for DataTables Database Query class
* @internal
*/
class PostgresQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
protected $_identifier_limiter = array('"', '"');
protected $_field_quote = '"';
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
if ( $port !== "" ) {
$port = "port={$port};";
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
$pdo = @new PDO(
"pgsql:host={$host};{$port}dbname={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
// Add a RETURNING command to postgres insert queries so we can get the
// pkey value from the query reliably
if ( $this->_type === 'insert' ) {
$table = explode( ' as ', $this->_table[0] );
// Get the pkey field name
$pkRes = $resource->prepare(
"SELECT
pg_attribute.attname,
format_type(pg_attribute.atttypid, pg_attribute.atttypmod)
FROM pg_index, pg_class, pg_attribute
WHERE
pg_class.oid = '{$table[0]}'::regclass AND
indrelid = pg_class.oid AND
pg_attribute.attrelid = pg_class.oid AND
pg_attribute.attnum = any(pg_index.indkey)
AND indisprimary"
);
$pkRes->execute();
$row = $pkRes->fetch();
if ( $row && isset($row['attname'] ) ) {
$sql .= ' RETURNING '.$row['attname'].' as dt_pkey';
}
}
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
try {
$this->_stmt->execute();
}
catch (\PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
$resource = $this->database()->resource();
return new PostgresResult( $resource, $this->_stmt );
}
}

View File

@ -0,0 +1,75 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* Postgres driver for DataTables Database Result class
* @internal
*/
class PostgresResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetch( $fetchType );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetchAll( $fetchType );
}
public function insertId ()
{
// Only useful after an insert of course...
$rows = $this->_stmt->fetchAll();
return $rows[0]['dt_pkey'];
}
}

View File

@ -0,0 +1,112 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\SqliteResult;
/**
* SQLite3 driver for DataTables Database Query class
* @internal
*/
class SqliteQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
protected $_identifier_limiter = null;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
$pdo = @new PDO(
"sqlite:{$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
try {
$this->_stmt->execute();
}
catch (PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
$resource = $this->database()->resource();
return new SqliteResult( $resource, $this->_stmt );
}
}

View File

@ -0,0 +1,73 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* Sqlite driver for DataTables Database Result class
* @internal
*/
class SqliteResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetch( $fetchType );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetchAll( $fetchType );
}
public function insertId ()
{
return $this->_dbh->lastInsertId();
}
}

View File

@ -0,0 +1,153 @@
<?php
/**
* SQL Server driver for DataTables PHP libraries
*
* @author SpryMedia
* @copyright 2013 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\PostgresResult;
/**
* SQL Server driver for DataTables Database Query class
* @internal
*/
class SqlserverQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
protected $_identifier_limiter = array( '[', ']' );
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
if ( in_array( 'sqlsrv', PDO::getAvailableDrivers() ) ) {
// Windows
if ( $port !== "" ) {
$port = ",{$port}";
}
$pdo = new PDO(
"sqlsrv:Server={$host}{$port};Database={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
}
else {
// Linux
if ( $port !== "" ) {
$port = ":{$port}";
}
$pdo = new PDO(
"dblib:host={$host}{$port};dbname={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
}
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
try {
$this->_stmt->execute();
}
catch (PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
$resource = $this->database()->resource();
return new SqlserverResult( $resource, $this->_stmt );
}
// SQL Server 2012+ only
protected function _build_limit()
{
$out = '';
if ( $this->_offset ) {
$out .= ' OFFSET '.$this->_offset.' ROWS';
}
if ( $this->_limit ) {
if ( ! $this->_offset ) {
$out .= ' OFFSET 0 ROWS';
}
$out .= ' FETCH NEXT '.$this->_limit. ' ROWS ONLY';
}
return $out;
}
}

View File

@ -0,0 +1,71 @@
<?php
/**
* SQL Server driver for DataTables PHP libraries
*
* @author SpryMedia
* @copyright 2013 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* SQL Server driver for DataTables Database Result class
* @internal
*/
class SqlserverResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetch( $fetchType );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetchAll( $fetchType );
}
public function insertId ()
{
return $this->_dbh->lastInsertId();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database;
if (!defined('DATATABLES')) exit();
//
// This is a stub class that a driver must extend and complete
//
/**
* Result object given by a {@see Query} performed on a database.
*
* The typical pattern for using this class is to receive an instance of it as a
* result of using the {@see Database} and {@see Query} class methods that
* return a result. This class should not be initialised independently.
*
* Note that this is a stub class that a driver will extend and complete as
* required for individual database types. Individual drivers could add
* additional methods, but this is discouraged to ensure that the API is the
* same for all database types.
*/
abstract class Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
/**
* Count the number of rows in the result set.
* @return int
*/
abstract public function count ();
/**
* Get the next row in a result set
* @param int PDO row fetch style - PDO::FETCH_ASSOC is the default
* @return array
*/
abstract public function fetch ( $fetchType=\PDO::FETCH_ASSOC );
/**
* Get all rows in the result set
* @param int PDO row fetch style - PDO::FETCH_ASSOC is the default
* @return array
*/
abstract public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC );
/**
* After an INSERT query, get the ID that was inserted.
* @return int
*/
abstract public function insertId ();
};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,961 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Editor;
if (!defined('DATATABLES')) exit();
use
DataTables,
DataTables\Editor,
DataTables\Editor\Options,
DataTables\Editor\Join;
use DataTables\HtmLawed\Htmlaw;
/**
* Field definitions for the DataTables Editor.
*
* Each Database column that is used with Editor can be described with this
* Field method (both for Editor and Join instances). It basically tells
* Editor what table column to use, how to format the data and if you want
* to read and/or write this column.
*
* Field instances are used with the {@see Editor->field()} and
* {@see Join->field()} methods to describe what fields should be interacted
* with by the editable table.
*
* @example
* Simply get a column with the name "city". No validation is performed.
* ```php
* Field::inst( 'city' )
* ```
*
* @example
* Get a column with the name "first_name" - when edited a value must
* be given due to the "required" validation from the {@see Validate} class.
* ```php
* Field::inst( 'first_name' )->validator( 'Validate::required' )
* ```
*
* @example
* Working with a date field, which is validated, and also has *get* and
* *set* formatters.
* ```php
* Field::inst( 'registered_date' )
* ->validator( 'Validate::dateFormat', 'D, d M y' )
* ->getFormatter( 'Format::date_sql_to_format', 'D, d M y' )
* ->setFormatter( 'Format::date_format_to_sql', 'D, d M y' )
* ```
*
* @example
* Using an alias in the first parameter
* ```php
* Field::inst( 'name.first as first_name' )
* ```
*/
class Field extends DataTables\Ext {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Statics
*/
/** Set option flag (`set()`) - do not set data */
const SET_NONE = 'none';
/** Set option flag (`set()`) - write to database on both create and edit */
const SET_BOTH = 'both';
/** Set option flag (`set()`) - write to database only on create */
const SET_CREATE = 'create';
/** Set option flag (`set()`) - write to database only on edit */
const SET_EDIT = 'edit';
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
/**
* Field instance constructor.
* @param string $dbField Name of the database column
* @param string $name Name to use in the JSON output from Editor and the
* HTTP submit from the client-side when editing. If not given then the
* $dbField name is used.
*/
function __construct( $dbField=null, $name=null )
{
if ( $dbField !== null && $name === null ) {
// Allow just a single parameter to be passed - each can be
// overridden if needed later using the API.
$this->name( $dbField );
$this->dbField( $dbField );
}
else {
$this->name( $name );
$this->dbField( $dbField );
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private parameters
*/
/** @var string */
private $_dbField = null;
/** @var boolean */
private $_get = true;
/** @var mixed */
private $_getFormatter = null;
/** @var mixed */
private $_getFormatterOpts = null;
/** @var mixed */
private $_getValue = null;
/** @var Options */
private $_opts = null;
/** @var SearchPaneOptions */
private $_spopts = null;
/** @var SearchBuilderOptions */
private $_sbopts = null;
/** @var callable */
private $_optsFn = null;
/** @var callable */
private $_spoptsFn = null;
/** @var callable */
private $_sboptsFn = null;
/** @var string */
private $_name = null;
/** @var string */
private $_set = Field::SET_BOTH;
/** @var mixed */
private $_setFormatter = null;
/** @var mixed */
private $_setFormatterOpts = null;
/** @var mixed */
private $_setValue = null;
/** @var mixed */
private $_validator = array();
/** @var Upload */
private $_upload = null;
/** @var callable */
private $_xss = null;
/** @var boolean */
private $_xssFormat = true;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
/**
* Get / set the DB field name.
*
* Note that when used as a setter, an alias can be given for the field
* using the SQL `as` keyword - for example: `firstName as name`. In this
* situation the dbField is set to the field name before the `as`, and the
* field's name (`name()`) is set to the name after the ` as `.
*
* As a result of this, the following constructs have identical
* functionality:
*
* Field::inst( 'firstName as name' );
* Field::inst( 'firstName', 'name' );
*
* @param string $_ Value to set if using as a setter.
* @return string|self The name of the db field if no parameter is given,
* or self if used as a setter.
*/
public function dbField ( $_=null )
{
if ( $_ === null ) {
return $this->_dbField;
}
// Don't split on an `as` inside paraenthesis
$a = preg_split( '/ as (?![^\(]*\))/i', $_ );
if ( count($a) > 1 ) {
$this->_dbField = trim( $a[0] );
$this->_name = trim( $a[1] );
}
else {
$this->_dbField = $_;
}
return $this;
}
/**
* Get / set the 'get' property of the field.
*
* A field can be marked as write only when setting the get property to false
* here.
* @param boolean $_ Value to set if using as a setter.
* @return boolean|self The get property if no parameter is given, or self
* if used as a setter.
*/
public function get ( $_=null )
{
return $this->_getSet( $this->_get, $_ );
}
/**
* Get formatter for the field's data.
*
* When the data has been retrieved from the server, it can be passed through
* a formatter here, which will manipulate (format) the data as required. This
* can be useful when, for example, working with dates and a particular format
* is required on the client-side.
*
* Editor has a number of formatters available with the {@see Format} class
* which can be used directly with this method.
* @param callable|string $_ Value to set if using as a setter. Can be given as
* a closure function or a string with a reference to a function that will
* be called with call_user_func().
* @param mixed $opts Variable that is passed through to the get formatting
* function - can be useful for passing through extra information such as
* date formatting string, or a required flag. The actual options available
* depend upon the formatter used.
* @return callable|string|self The get formatter if no parameter is given, or
* self if used as a setter.
*/
public function getFormatter ( $_=null, $opts=null )
{
if ( $opts !== null ) {
$this->_getFormatterOpts = $opts;
}
return $this->_getSet( $this->_getFormatter, $_ );
}
/**
* Get / set a get value. If given, then this value is used to send to the
* client-side, regardless of what value is held by the database.
*
* @param callable|string|number $_ Value to set, or no value to use as a
* getter
* @return callable|string|self Value if used as a getter, or self if used
* as a setter.
*/
public function getValue ( $_=null )
{
return $this->_getSet( $this->_getValue, $_ );
}
/**
* Get / set the 'name' property of the field.
*
* The name is typically the same as the dbField name, since it makes things
* less confusing(!), but it is possible to set a different name for the data
* which is used in the JSON returned to DataTables in a 'get' operation and
* the field name used in a 'set' operation.
* @param string $_ Value to set if using as a setter.
* @return string|self The name property if no parameter is given, or self
* if used as a setter.
*/
public function name ( $_=null )
{
return $this->_getSet( $this->_name, $_ );
}
/**
* Get a list of values that can be used for the options list in radio,
* select and checkbox inputs from the database for this field.
*
* Note that this is for simple 'label / value' pairs only. For more complex
* data, including pairs that require joins and where conditions, use a
* closure to provide a query
*
* @param string|callable $table Database table name to use to get the
* paired data from, or a closure function if providing a method
* @param string $value Table column name that contains the pair's
* value. Not used if the first parameter is given as a closure
* @param string $label Table column name that contains the pair's
* label. Not used if the first parameter is given as a closure
* @param callable $condition Function that will add `where`
* conditions to the query
* @param callable $format Function will render each label
* @param string $order SQL ordering
* @return Field Self for chaining
*/
public function options ( $table=null, $value=null, $label=null, $condition=null, $format=null, $order=null )
{
if ( $table === null ) {
return $this->_opts;
}
// Overloads for backwards compatibility
if ( is_a( $table, '\DataTables\Editor\Options' ) ) {
// Options class
$this->_optsFn = null;
$this->_opts = $table;
}
else if ( is_callable($table) && is_object($table) ) {
// Function
$this->_opts = null;
$this->_optsFn = $table;
}
else {
$this->_optsFn = null;
$this->_opts = Options::inst()
->table( $table )
->value( $value )
->label( $label );
if ( $condition ) {
$this->_opts->where( $condition );
}
if ( $format ) {
$this->_opts->render( $format );
}
if ( $order ) {
$this->_opts->order( $order );
}
}
return $this;
}
/**
* Get a list of values that can be used for the options list in SearchPanes
*
* @param SearchPaneOptions|callable $spInput SearchPaneOptions instance or a closure function if providing a method
* @return self
*/
public function searchPaneOptions ( $spInput=null )
{
if ( $spInput === null ) {
return $this->_spopts;
}
// Overloads for backwards compatibility
if ( is_a( $spInput, '\DataTables\Editor\SearchPaneOptions' ) ) {
// Options class
$this->_spoptsFn = null;
$this->_spopts = $spInput;
}
else if ( is_callable($spInput) && is_object($spInput) ) {
// Function
$this->_spopts = null;
$this->_spoptsFn = $spInput;
}
return $this;
}
/**
* Get a list of values that can be used for the options list in SearchBuilder
*
* @param SearchBuilderOptions|callable $sbInput SearchBuilderOptions instance or a closure function if providing a method
* @return self
*/
public function searchBuilderOptions ( $sbInput=null )
{
if ( $sbInput === null ) {
return $this->_sbopts;
}
// Overloads for backwards compatibility
if ( is_a( $sbInput, '\DataTables\Editor\SearchBuilderOptions' ) ) {
// Options class
$this->_sboptsFn = null;
$this->_sbopts = $sbInput;
}
else if ( is_callable($sbInput) && is_object($sbInput) ) {
// Function
$this->_sbopts = null;
$this->_sboptsFn = $sbInput;
}
return $this;
}
/**
* Get / set the 'set' property of the field.
*
* A field can be marked as read only using this option, to be set only
* during an create or edit action or to be set during both actions. This
* provides the ability to have fields that are only set when a new row is
* created (for example a "created" time stamp).
* @param string|boolean $_ Value to set when the method is being used as a
* setter (leave as undefined to use as a getter). This can take the
* value of:
*
* * `true` - Same as `Field::SET_BOTH`
* * `false` - Same as `Field::SET_NONE`
* * `Field::SET_BOTH` - Set the database value on both create and edit commands
* * `Field::SET_NONE` - Never set the database value
* * `Field::SET_CREATE` - Set the database value only on create
* * `Field::SET_EDIT` - Set the database value only on edit
* @return string|self The set property if no parameter is given, or self
* if used as a setter.
*/
public function set ( $_=null )
{
if ( $_ === true ) {
$_ = Field::SET_BOTH;
}
else if ( $_ === false ) {
$_ = Field::SET_NONE;
}
return $this->_getSet( $this->_set, $_ );
}
/**
* Set formatter for the field's data.
*
* When the data has been retrieved from the server, it can be passed through
* a formatter here, which will manipulate (format) the data as required. This
* can be useful when, for example, working with dates and a particular format
* is required on the client-side.
*
* Editor has a number of formatters available with the {@see Format} class
* which can be used directly with this method.
* @param callable|string $_ Value to set if using as a setter. Can be given as
* a closure function or a string with a reference to a function that will
* be called with call_user_func().
* @param mixed $opts Variable that is passed through to the get formatting
* function - can be useful for passing through extra information such as
* date formatting string, or a required flag. The actual options available
* depend upon the formatter used.
* @return callable|string|self The set formatter if no parameter is given, or
* self if used as a setter.
*/
public function setFormatter ( $_=null, $opts=null )
{
if ( $opts !== null ) {
$this->_setFormatterOpts = $opts;
}
return $this->_getSet( $this->_setFormatter, $_ );
}
/**
* Get / set a set value. If given, then this value is used to write to the
* database regardless of what data is sent from the client-side.
*
* @param callable|string|number $_ Value to set, or no value to use as a
* getter
* @return callable|string|self Value if used as a getter, or self if used
* as a setter.
*/
public function setValue ( $_=null )
{
return $this->_getSet( $this->_setValue, $_ );
}
/**
* Get / set the upload class for this field.
* @param Upload $_ Upload class if used as a setter
* @return Upload|self Value if used as a getter, or self if used
* as a setter.
*/
public function upload ( $_=null )
{
return $this->_getSet( $this->_upload, $_ );
}
/**
* Get / set the 'validator' of the field.
*
* The validator can be used to check if any abstract piece of data is valid
* or not according to the given rules of the validation function used.
*
* Multiple validation options can be applied to a field instance by calling
* this method multiple times. For example, it would be possible to have a
* 'required' validation and a 'maxLength' validation with multiple calls.
*
* Editor has a number of validation available with the {@see Validate} class
* which can be used directly with this method.
* @param callable|string $_ Value to set if using as the validation method.
* Can be given as a closure function or a string with a reference to a
* function that will be called with call_user_func().
* @param mixed $opts Variable that is passed through to the validation
* function - can be useful for passing through extra information such as
* date formatting string, or a required flag. The actual options available
* depend upon the validation function used.
* @return callable|string|self The validation method if no parameter is given,
* or self if used as a setter.
*/
public function validator ( $_=null, $opts=null )
{
if ( $_ === null ) {
return $this->_validator;
}
else {
$this->_validator[] = array(
"func" => $_,
"opts" => $opts
);
}
return $this;
}
/**
* Set a formatting method that will be used for XSS checking / removal.
* This should be a function that takes a single argument (the value to be
* cleaned) and returns the cleaned value.
*
* Editor will use HtmLawed by default for this operation, which is built
* into the software and no additional configuration is required, but a
* custom function can be used if you wish to use a different formatter such
* as HTMLPurifier.
*
* If you wish to disable this option (which you would only do if you are
* absolutely confident that your validation will pick up on any XSS inputs)
* simply provide a closure function that returns the value given to the
* function. This is _not_ recommended.
*
* @param callable|false $xssFormatter XSS cleaner function, use `false` or
* `null` to disable XSS cleaning.
* @return Field Self for chaining.
*/
public function xss ( $xssFormatter )
{
if ( $xssFormatter === true || $xssFormatter === false || $xssFormatter === null ) {
$this->_xssFormat = $xssFormatter;
}
else {
$this->_xss = $xssFormatter;
}
return $this;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Internal methods
* Used by the Editor class and not generally for public use
*/
/**
* Check to see if a field should be used for a particular action (get or set).
*
* Called by the Editor / Join class instances - not expected for general
* consumption - internal.
* @param string $action Direction that the data is travelling - 'get' is
* reading DB data, `create` and `edit` for writing to the DB
* @param array $data Data submitted from the client-side when setting.
* @return boolean true if the field should be used in the get / set.
* @internal
*/
public function apply ( $action, $data=null )
{
if ( $action === 'get' ) {
// Get action - can we get this field
return $this->_get;
}
else {
// Note that validation must be done on input data before we get here
// Create or edit action, are we configured to use this field
if ( $action === 'create' &&
($this->_set === Field::SET_NONE || $this->_set === Field::SET_EDIT)
) {
return false;
}
else if ( $action === 'edit' &&
($this->_set === Field::SET_NONE || $this->_set === Field::SET_CREATE)
) {
return false;
}
// Check it was in the submitted data. If not, then not required
// (validation would have failed if it was) and therefore we don't
// set it. Check for a value as well, as it can format data from
// some other source
if ( $this->_setValue === null && ! $this->_inData( $this->name(), $data ) ) {
return false;
}
// In the data set, so use it
return true;
}
}
/**
* Execute the ipOpts to get the list of options to return to the client-
* side
*
* @param \DataTables\Database $db Database instance
* @return Array Array of value / label options for the list
* @internal
*/
public function optionsExec ( $db )
{
if ( $this->_optsFn ) {
$fn = $this->_optsFn;
return $fn($db);
}
else if ( $this->_opts ) {
return $this->_opts->exec( $db );
}
return false;
}
/**
* Execute the spopts to get the list of options for SearchPanes to return
* to the client-side
*
* @param DataTables\Field $field The field to retrieve the data from
* @param DataTables\Editor $editor The editor instance
* @param DataTables\DTRequest $http The http request sent to the server
* @param DataTables\Field[] $fields All of the fields
* @param any $leftJoin Info for a leftJoin if required
* @return Promise<IOption[]> | boolean
* @internal
*/
public function searchPaneOptionsExec ( $field, $editor, $http, $fields, $leftJoin)
{
if ( $this->_spoptsFn ) {
$fn = $this->_spoptsFn;
return $fn($editor->db(), $editor);
}
else if ( $this->_spopts ) {
return $this->_spopts->exec( $field, $editor, $http, $fields, $leftJoin );
}
return false;
}
/**
* Execute the spopts to get the list of options for SearchBuilder to return
* to the client-side
*
* @param DataTables\Field $field The field to retrieve the data from
* @param DataTables\Editor $editor The editor instance
* @param DataTables\DTRequest $http The http request sent to the server
* @param DataTables\Field[] $fields All of the fields
* @param any $leftJoin Info for a leftJoin if required
* @return Promise<IOption[]> | boolean
* @internal
*/
public function searchBuilderOptionsExec ( $field, $editor, $http, $fields, $leftJoin)
{
if ( $this->_sboptsFn ) {
$fn = $this->_sboptsFn;
return $fn($editor->db(), $editor);
}
else if ( $this->_sbopts ) {
return $this->_sbopts->exec( $field, $editor, $http, $fields, $leftJoin );
}
return false;
}
/**
* Get the value of the field, taking into account if it is coming from the
* DB or from a POST. If formatting has been specified for this field, it
* will be applied here.
*
* Called by the Editor / Join class instances - not expected for general
* consumption - internal.
* @param string $direction Direction that the data is travelling - 'get' is
* reading data, and 'set' is writing it to the DB.
* @param array $data Data submitted from the client-side when setting or the
* data for the row when getting data from the DB.
* @return string Value for the field
* @internal
*/
public function val ( $direction, $data )
{
if ( $direction === 'get' ) {
if ( $this->_getValue !== null ) {
$val = $this->_getAssignedValue( $this->_getValue );
}
else {
// Getting data, so the db field name
$val = isset( $data[ $this->_dbField ] ) ?
$data[ $this->_dbField ] :
null;
}
return $this->_format(
$val, $data, $this->_getFormatter, $this->_getFormatterOpts
);
}
else {
// Sanity check that we aren't operating on a function
if ( strpos( $this->dbField(), '(' ) !== false ) {
throw new \Exception('Cannot set the value for an SQL function field. These fields are read only: ' . $this->name());
}
// Setting data, so using from the payload (POST usually) and thus
// use the 'name'
$val = $this->_setValue !== null ?
$this->_getAssignedValue( $this->_setValue ) :
$this->_readProp( $this->name(), $data );
// XSS removal / checker
if ( $this->_xssFormat && $val ) {
$val = $this->xssSafety( $val );
}
return $this->_format(
$val, $data, $this->_setFormatter, $this->_setFormatterOpts
);
}
}
/**
* Check the validity of the field based on the data submitted. Note that
* this validation is performed on the wire data - i.e. that which is
* submitted, before any setFormatter is run
*
* Called by the Editor / Join class instances - not expected for general
* consumption - internal.
*
* @param array $data Data submitted from the client-side
* @param Editor $editor Editor instance
* @param mixed $id Row id that is being validated
* @return boolean|string `true` if valid, string with error message if not
* @internal
*/
public function validate ( $data, $editor, $id=null )
{
// Three cases for the validator - closure, string or null
if ( ! count( $this->_validator ) ) {
return true;
}
// Value could be from user data, or setValue might take priority
$val = $this->_setValue !== null ?
$this->_getAssignedValue( $this->_setValue ) :
$this->_readProp( $this->name(), $data );
$processData = $editor->inData();
$instances = array(
'action' => $processData['action'],
'id' => $id,
'field' => $this,
'editor' => $editor,
'db' => $editor->db()
);
for ( $i=0, $ien=count( $this->_validator ) ; $i<$ien ; $i++ ) {
$validator = $this->_validator[$i];
// Backwards compatibility
if ( is_string( $validator['func'] ) ) {
if ( strpos($validator['func'], "Validate::") === 0 ) {
$a = explode("::", $validator['func']);
// Validate class static methods - they have `Legacy` counter parts that
// convert from the old style to the new so the old style options still work.
if ( method_exists( "\\DataTables\\Editor\\".$a[0], $a[1].'Legacy' ) ) {
$func = call_user_func( "\\DataTables\\Editor\\".$validator['func'].'Legacy', $validator['opts'] );
$res = call_user_func( $func, $val, $data, $this, $instances );
}
else {
// User style legacy function. Call it directly
$func = "\\DataTables\\Editor\\".$validator['func'];
$res = call_user_func( $func, $val, $data, $this, $instances );
}
}
else {
// And for cases where a string was used to point to a function,
// which was not in the Validate class
$res = call_user_func( $validator['func'], $val, $data, $validator['opts'], $instances );
}
}
else {
$func = $validator['func'];
$res = $func( $val, $data, $this, $instances );
}
// Check if there was a validation error and if so, return it
if ( $res !== true ) {
return $res;
}
}
// Validation methods all run, must be valid
return true;
}
/**
* Write the value for this field to the output array for a read operation
*
* @param array $out Row output data (to the JSON)
* @param mixed $srcData Row input data (raw, from the database)
* @internal
*/
public function write( &$out, $srcData )
{
$this->_writeProp( $out, $this->name(), $this->val('get', $srcData) );
}
/**
* Perform XSS prevention on an input.
*
* @param mixed $val Value to be escaped
* @return string Safe value
*/
public function xssSafety ( $val ) {
$xss = $this->_xss;
if ( is_array( $val ) ) {
$res = array();
foreach ( $val as $individual ) {
$res[] = $xss ?
$xss( $individual ) :
Htmlaw::filter( $individual );
}
return $res;
}
return $xss ?
$xss( $val ) :
Htmlaw::filter( $val );
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private methods
*/
/**
* Apply a formatter to data. The caller will decide what formatter to apply
* (get or set)
*
* @param mixed $val Value to be formatted
* @param mixed $data Full row data
* @param callable $formatter Formatting function to be called
* @param array $opts Array of options to be passed to the formatter
* @return mixed Formatted value
*/
private function _format( $val, $data, $formatter, $opts )
{
// Three cases for the formatter - closure, string or null
if ( ! $formatter ) {
return $val;
}
if ( ! is_string( $formatter ) ) {
return $formatter( $val, $data, $opts );
}
// Backwards compatibility - strings will not be supported in v2
if ( strpos($formatter, "Format::") === 0 ) {
$a = explode( '::', $formatter );
// Old style Editor formatter - use the legacy functions to
// convert to the new style
if ( method_exists( "\\DataTables\\Editor\\".$a[0], $a[1].'Legacy' ) ) {
$func = call_user_func( "\\DataTables\\Editor\\".$formatter.'Legacy', $opts );
return $func( $val, $data );
}
else {
// User added old style methods
return call_user_func( "\\DataTables\\Editor\\".$formatter, $val, $data, $opts );
}
}
// User function (string identifier)
return call_user_func( $formatter, $val, $data, $opts );
}
/**
* Get the value from `_[gs]etValue` - taking into account if it is callable
* function or not
*
* @param mixed $val Value to be evaluated
* @return mixed Value assigned, or returned from the function
*/
private function _getAssignedValue ( $val )
{
return is_callable($val) && is_object($val) ?
$val() :
$val;
}
/**
* Check is a parameter is in the submitted data set. This is functionally
* the same as the `_readProp()` method, but in this case a binary value
* is required to indicate if the value is present or not.
*
* @param string $name Javascript dotted object name to write to
* @param array $data Data source array to read from
* @return boolean `true` if present, `false` otherwise
* @private
*/
private function _inData ( $name, $data )
{
if ( strpos($name, '.') === false ) {
return isset( $data[ $name ] ) ?
true :
false;
}
$names = explode( '.', $name );
$inner = $data;
for ( $i=0 ; $i<count($names)-1 ; $i++ ) {
if ( ! isset( $inner[ $names[$i] ] ) ) {
return false;
}
$inner = $inner[ $names[$i] ];
}
return isset( $inner [ $names[count($names)-1] ] ) ?
true :
false;
}
}

View File

@ -0,0 +1,346 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Editor;
if (!defined('DATATABLES')) exit();
/**
* Formatter methods for the DataTables Editor
*
* All methods in this class are static with common inputs and returns.
*/
class Format {
/** Date format: 2012-03-09. jQuery UI equivalent format: yy-mm-dd */
const DATE_ISO_8601 = "Y-m-d";
/** Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y */
const DATE_ISO_822 = "D, j M y";
/** Date format: Friday, 09-Mar-12. jQuery UI equivalent format: DD, dd-M-y */
const DATE_ISO_850 = "l, d-M-y";
/** Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y */
const DATE_ISO_1036 = "D, j M y";
/** Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy */
const DATE_ISO_1123 = "D, j M Y";
/** Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy */
const DATE_ISO_2822 = "D, j M Y";
/** Date format: March-. jQuery UI equivalent format: D, d M yy */
const DATE_USA = "m-d-Y";
/** Date format: 1331251200. jQuery UI equivalent format: @ */
const DATE_TIMESTAMP = "U";
/** Date format: 1331251200. jQuery UI equivalent format: @ */
const DATE_EPOCH = "U";
/**
* Convert from SQL date / date time format to a format given by the options
* parameter.
*
* Typical use of this method is to use it with the
* {@see Field::getFormatter()} and {@see Field::setFormatter()} methods of
* {@see Field} where the parameters required for this method will be
* automatically satisfied.
* @param string $val Value to convert from MySQL date format
* @param string[] $data Data for the whole row / submitted data
* @param string $opts Format to convert to using PHP date() options.
* @return string Formatted date or empty string on error.
*/
public static function dateSqlToFormat( $format ) {
return function ( $val, $data ) use ( $format ) {
if ( $val === null || $val === '' ) {
return null;
}
$date = new \DateTime( $val );
// Allow empty strings or invalid dates
if ( $date ) {
return date_format( $date, $format );
}
return null;
};
}
/**
* Convert from a format given by the options parameter to a format that
* SQL servers will recognise as a date.
*
* Typical use of this method is to use it with the
* {@see Field::getFormatter()} and {@see Field::setFormatter()} methods of
* {@see Field} where the parameters required for this method will be
* automatically satisfied.
* @param string $val Value to convert to SQL date format
* @param string[] $data Data for the whole row / submitted data
* @param string $opts Format to convert from using PHP date() options.
* @return string Formatted date or null on error.
*/
public static function dateFormatToSql( $format ) {
return function ( $val, $data ) use ( $format ) {
if ( $val === null || $val === '' ) {
return null;
}
// Note that this assumes the date is in the correct format (should be
// checked by validation before being used here!)
if ( substr($format, 0, 1) !== '!' ) {
$format = '!'.$format;
}
$date = date_create_from_format($format, $val);
// Invalid dates or empty string are replaced with null. Use the
// validation to ensure the date given is valid if you don't want this!
if ( $date ) {
return date_format( $date, 'Y-m-d' );
}
return null;
};
}
/**
* Convert from one date time format to another
*
* Typical use of this method is to use it with the
* {@see Field::getFormatter()} and {@see Field::setFormatter()} methods of
* {@see Field} where the parameters required for this method will be
* automatically satisfied.
* @param string $val Value to convert
* @param string[] $data Data for the whole row / submitted data
* @param string $opts Array with `from` and `to` properties which are the
* formats to convert from and to
* @return string Formatted date or null on error.
*/
public static function datetime( $from, $to ) {
return function ( $val, $data ) use ( $from, $to ) {
if ( $val === null || $val === '' ) {
return null;
}
if ( substr($from, 0, 1) !== '!' ) {
$from = '!'.$from;
}
$date = date_create_from_format( $from, $val );
// Allow empty strings or invalid dates
if ( $date ) {
return date_format( $date, $to );
}
return null;
};
}
/**
* Convert a string of values into an array for use with checkboxes.
* @param string $val Value to convert to from a string to an array
* @param string[] $data Data for the whole row / submitted data
* @param string $opts Field delimiter
* @return string Formatted value or null on error.
*/
public static function explode( $char='|' ) {
return function ( $val, $data ) use ( $char ) {
if ($val === null) {
$val = '';
}
return explode($char, $val);
};
}
/**
* Convert an array of values from a checkbox into a string which can be
* used to store in a text field in a database.
* @param string $val Value to convert to from an array to a string
* @param string[] $data Data for the whole row / submitted data
* @param string $opts Field delimiter
* @return string Formatted value or null on error.
*/
public static function implode( $char='|' ) {
return function ( $val, $data ) use ( $char ) {
return implode($char, $val);
};
}
/**
* Convert an empty string to `null`. Null values are very useful in
* databases, but HTTP variables have no way of representing `null` as a
* value, often leading to an empty string and null overlapping. This method
* will check the value to operate on and return null if it is empty.
* @param string $val Value to convert to from a string to an array
* @param string[] $data Data for the whole row / submitted data
* @param string $opts Field delimiter
* @return string Formatted value or null on error.
*/
public static function nullEmpty () {
// Legacy function - use `ifEmpty` now
return self::ifEmpty( null );
}
/**
* Formatter that can be used to specify what value should be used if an
* empty value is submitted by the client-side (e.g. null, 0, 'Not set',
* etc)
* @param string $val Value to convert to from a string to an array
* @param string[] $data Data for the whole row / submitted data
* @param string $opts Empty value
* @return string Formatted value or null on error.
*/
public static function ifEmpty ( $ret ) {
return function ( $val, $data ) use ( $ret ) {
return $val === '' ?
$ret :
$val;
};
}
/**
* Convert a number from using any character other than a period (dot) to
* one which does use a period. This is useful for allowing numeric user
* input in regions where a comma is used as the decimal character. Use with
* a set formatter.
* @param string $val Value to convert to from a string to an array
* @param string[] $data Data for the whole row / submitted data
* @param string $opts Decimal place character (default ',')
* @return string Formatted value or null on error.
*/
public static function fromDecimalChar ( $char=',' ) {
return function ( $val, $data ) use ( $char ) {
return str_replace( $char, '.', $val );
};
}
/**
* Convert a number with a period (dot) as the decimal character to use
* a different character (typically a comma). Use with a get formatter.
* @param string $val Value to convert to from a string to an array
* @param string[] $data Data for the whole row / submitted data
* @param string $opts Decimal place character (default ',')
* @return string Formatted value or null on error.
*/
public static function toDecimalChar ( $char=',' ) {
return function ( $val, $data ) use ( $char ) {
return str_replace( '.', $char, $val );
};
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Internal functions
* These legacy methods are for backwards compatibility with the old way of
* using the formatter methods. They basically do argument swapping.
*/
/**
* @internal
*/
public static function date_sql_to_format ( $opts ) {
return self::dateSqlToFormat( $opts );
}
/**
* @internal
*/
public static function date_sql_to_formatLegacy ( $opts ) {
return self::dateSqlToFormat( $opts );
}
/**
* @internal
*/
public static function date_format_to_sql ( $opts ) {
return self::dateFormatToSql( $opts );
}
/**
* @internal
*/
public static function date_format_to_sqlLegacy ( $opts ) {
return self::dateFormatToSql( $opts );
}
/**
* @internal
*/
public static function datetimeLegacy ( $opts ) {
return self::datetime( $opts['from'], $opts['to'] );
}
/**
* @internal
*/
public static function explodeLegacy ( $opts ) {
if ( $opts === null ) {
$opts = '|';
}
return self::explode( $opts );
}
/**
* @internal
*/
public static function implodeLegacy ( $opts ) {
if ( $opts === null ) {
$opts = '|';
}
return self::implode( $opts );
}
/**
* @internal
*/
public static function nullEmptyLegacy ( $opts ) {
return self::nullEmpty( null );
}
/**
* @internal
*/
public static function ifEmptyLegacy ( $opts ) {
return self::ifEmpty( $opts );
}
/**
* @internal
*/
public static function fromDecimalCharLegacy ( $opts ) {
if ( $opts === null ) {
$opts = ',';
}
return self::fromDecimalChar( $opts );
}
/**
* @internal
*/
public static function toDecimalCharLegacy ( $opts ) {
if ( $opts === null ) {
$opts = ',';
}
return self::toDecimalChar( $opts );
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Editor;
if (!defined('DATATABLES')) exit();
use DataTables\Editor\Join;
/**
* The `Mjoin` class extends the `Join` class with the join data type set to
* 'array', whereas the `Join` default is `object` which has been rendered
* obsolete by the `Editor->leftJoin()` method. The API API is otherwise
* identical.
*
* This class is recommended over the `Join` class.
*/
class Mjoin extends Join
{
function __construct( $table=null )
{
parent::__construct( $table, 'array' );
}
}

View File

@ -0,0 +1,341 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2016 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Editor;
if (!defined('DATATABLES')) exit();
use DataTables;
/**
* The Options class provides a convenient method of specifying where Editor
* should get the list of options for a `select`, `radio` or `checkbox` field.
* This is normally from a table that is _left joined_ to the main table being
* edited, and a list of the values available from the joined table is shown to
* the end user to let them select from.
*
* `Options` instances are used with the {@see Field->options()} method.
*
* @example
* Get a list of options from the `sites` table
* ```php
* Field::inst( 'users.site' )
* ->options( Options::inst()
* ->table( 'sites' )
* ->value( 'id' )
* ->label( 'name' )
* )
* ```
*
* @example
* Get a list of options with custom ordering
* ```php
* Field::inst( 'users.site' )
* ->options( Options::inst()
* ->table( 'sites' )
* ->value( 'id' )
* ->label( 'name' )
* ->order( 'name DESC' )
* )
* ```
*
* @example
* Get a list of options showing the id and name in the label
* ```php
* Field::inst( 'users.site' )
* ->options( Options::inst()
* ->table( 'sites' )
* ->value( 'id' )
* ->label( [ 'name', 'id' ] )
* ->render( function ( $row ) {
* return $row['name'].' ('.$row['id'].')';
* } )
* )
* ```
*/
class Options extends DataTables\Ext {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private parameters
*/
/** @var string Table to get the information from */
private $_table = null;
/** @var string Column name containing the value */
private $_value = null;
/** @var string[] Column names for the label(s) */
private $_label = array();
/** Information for left join */
private $_leftJoin = array();
/** @var integer Row limit */
private $_limit = null;
/** @var callable Callback function to do rendering of labels */
private $_renderer = null;
/** @var callback Callback function to add where conditions */
private $_where = null;
/** @var string ORDER BY clause */
private $_order = null;
private $_manualAdd = array();
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
/**
* Add extra options to the list, in addition to any obtained from the database
*
* @param string $label The label to use for the option
* @param string|null $value Value for the option. If not given, the label will be used
* @return Options Self for chaining
*/
public function add ( $label, $value=null )
{
if ( $value === null ) {
$value = $label;
}
$this->_manualAdd[] = array(
'label' => $label,
'value' => $value
);
return $this;
}
/**
* Get / set the column(s) to use as the label value of the options
*
* @param null|string|string[] $_ null to get the current value, string or
* array to get.
* @return Options|string[] Self if setting for chaining, array of values if
* getting.
*/
public function label ( $_=null )
{
if ( $_ === null ) {
return $this;
}
else if ( is_string($_) ) {
$this->_label = array( $_ );
}
else {
$this->_label = $_;
}
return $this;
}
/**
* Set up a left join operation for the options
*
* @param string $table to get the information from
* @param string $field1 the first field to get the information from
* @param string $operator the operation to perform on the two fields
* @param string $field2 the second field to get the information from
* @return self
*/
public function leftJoin ( $table, $field1, $operator, $field2 )
{
$this->_leftJoin[] = array(
"table" => $table,
"field1" => $field1,
"field2" => $field2,
"operator" => $operator
);
return $this;
}
/**
* Get / set the LIMIT clause to limit the number of records returned.
*
* @param null|number $_ Number of rows to limit the result to
* @return Options|string[] Self if setting for chaining, limit if getting.
*/
public function limit ( $_=null )
{
return $this->_getSet( $this->_limit, $_ );
}
/**
* Get / set the ORDER BY clause to use in the SQL. If this option is not
* provided the ordering will be based on the rendered output, either
* numerically or alphabetically based on the data returned by the renderer.
*
* @param null|string $_ String to set, null to get current value
* @return Options|string Self if setting for chaining, string if getting.
*/
public function order ( $_=null )
{
return $this->_getSet( $this->_order, $_ );
}
/**
* Get / set the label renderer. The renderer can be used to combine
* multiple database columns into a single string that is shown as the label
* to the end user in the list of options.
*
* @param null|callable $_ Function to set, null to get current value
* @return Options|callable Self if setting for chaining, callable if
* getting.
*/
public function render ( $_=null )
{
return $this->_getSet( $this->_renderer, $_ );
}
/**
* Get / set the database table from which to gather the options for the
* list.
*
* @param null|string $_ String to set, null to get current value
* @return Options|string Self if setting for chaining, string if getting.
*/
public function table ( $_=null )
{
return $this->_getSet( $this->_table, $_ );
}
/**
* Get / set the column name to use for the value in the options list. This
* would normally be the primary key for the table.
*
* @param null|string $_ String to set, null to get current value
* @return Options|string Self if setting for chaining, string if getting.
*/
public function value ( $_=null )
{
return $this->_getSet( $this->_value, $_ );
}
/**
* Get / set the method to use for a WHERE condition if it is to be
* applied to the query to get the options.
*
* @param null|callable $_ Function to set, null to get current value
* @return Options|callable Self if setting for chaining, callable if
* getting.
*/
public function where ( $_=null )
{
return $this->_getSet( $this->_where, $_ );
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Internal methods
*/
/**
* Execute the options (i.e. get them)
*
* @param Database $db Database connection
* @return array List of options
* @internal
*/
public function exec ( $db )
{
$label = $this->_label;
$value = $this->_value;
$formatter = $this->_renderer;
// Create a list of the fields that we need to get from the db
$fields = array();
$fields[] = $value;
$fields = array_merge( $fields, $label );
// We need a default formatter if one isn't provided
if ( ! $formatter ) {
$formatter = function ( $row ) use ( $label ) {
$a = array();
for ( $i=0, $ien=count($label) ; $i<$ien ; $i++ ) {
$a[] = $row[ $label[$i] ];
}
return implode(' ', $a);
};
}
// Get the data
$q = $db
->query('select')
->distinct( true )
->table( $this->_table )
->left_join($this->_leftJoin)
->get( $fields )
->where( $this->_where );
if ( $this->_order ) {
// For cases where we are ordering by a field which isn't included in the list
// of fields to display, we need to add the ordering field, due to the
// select distinct.
$orderFields = explode( ',', $this->_order );
for ( $i=0, $ien=count($orderFields) ; $i<$ien ; $i++ ) {
$field = strtolower( $orderFields[$i] );
$field = str_replace( ' asc', '', $field );
$field = str_replace( ' desc', '', $field );
$field = trim( $field );
if ( ! in_array( $field, $fields ) ) {
$q->get( $field );
}
}
$q->order( $this->_order );
}
if ( $this->_limit !== null ) {
$q->limit( $this->_limit );
}
$rows = $q
->exec()
->fetchAll();
// Create the output array
$out = array();
for ( $i=0, $ien=count($rows) ; $i<$ien ; $i++ ) {
$out[] = array(
"label" => $formatter( $rows[$i] ),
"value" => $rows[$i][$value]
);
}
// Stick on any extra manually added options
if ( count( $this->_manualAdd ) ) {
$out = array_merge( $out, $this->_manualAdd );
}
// Only sort if there was no SQL order field
if ( ! $this->_order ) {
usort( $out, function ( $a, $b ) {
return is_numeric($a['label']) && is_numeric($b['label']) ?
($a['label']*1) - ($b['label']*1) :
strcmp( $a['label'], $b['label'] );
} );
}
return $out;
}
}

View File

@ -0,0 +1,335 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2016 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Editor;
if (!defined('DATATABLES')) exit();
use DataTables;
/**
* The Options class provides a convenient method of specifying where Editor
* should get the list of options for a `select`, `radio` or `checkbox` field.
* This is normally from a table that is _left joined_ to the main table being
* edited, and a list of the values available from the joined table is shown to
* the end user to let them select from.
*
* `Options` instances are used with the {@see Field->options()} method.
*
* @example
* Get a list of options from the `sites` table
* ```php
* Field::inst( 'users.site' )
* ->options( Options::inst()
* ->table( 'sites' )
* ->value( 'id' )
* ->label( 'name' )
* )
* ```
*
* @example
* Get a list of options with custom ordering
* ```php
* Field::inst( 'users.site' )
* ->options( Options::inst()
* ->table( 'sites' )
* ->value( 'id' )
* ->label( 'name' )
* ->order( 'name DESC' )
* )
* ```
*
* @example
* Get a list of options showing the id and name in the label
* ```php
* Field::inst( 'users.site' )
* ->options( Options::inst()
* ->table( 'sites' )
* ->value( 'id' )
* ->label( [ 'name', 'id' ] )
* ->render( function ( $row ) {
* return $row['name'].' ('.$row['id'].')';
* } )
* )
* ```
*/
class SearchBuilderOptions extends DataTables\Ext {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private parameters
*/
/** @var string Table to get the information from */
private $_table = null;
/** @var string Column name containing the value */
private $_value = null;
/** @var string[] Column names for the label(s) */
private $_label = array();
/** @var string[] Column names for left join */
private $_leftJoin = array();
/** @var callable Callback function to do rendering of labels */
private $_renderer = null;
/** @var callback Callback function to add where conditions */
private $_where = null;
/** @var string ORDER BY clause */
private $_order = null;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
/**
* Get / set the column(s) to use as the label value of the options
*
* @param null|string|string[] $_ null to get the current value, string or
* array to get.
* @return Options|string[] Self if setting for chaining, array of values if
* getting.
*/
public function label ( $_=null )
{
if ( $_ === null ) {
return $this;
}
else if ( is_string($_) ) {
$this->_label = array( $_ );
}
else {
$this->_label = $_;
}
return $this;
}
/**
* Get / set the ORDER BY clause to use in the SQL. If this option is not
* provided the ordering will be based on the rendered output, either
* numerically or alphabetically based on the data returned by the renderer.
*
* @param null|string $_ String to set, null to get current value
* @return Options|string Self if setting for chaining, string if getting.
*/
public function order ( $_=null )
{
return $this->_getSet( $this->_order, $_ );
}
/**
* Get / set the label renderer. The renderer can be used to combine
* multiple database columns into a single string that is shown as the label
* to the end user in the list of options.
*
* @param null|callable $_ Function to set, null to get current value
* @return Options|callable Self if setting for chaining, callable if
* getting.
*/
public function render ( $_=null )
{
return $this->_getSet( $this->_renderer, $_ );
}
/**
* Get / set the database table from which to gather the options for the
* list.
*
* @param null|string $_ String to set, null to get current value
* @return Options|string Self if setting for chaining, string if getting.
*/
public function table ( $_=null )
{
return $this->_getSet( $this->_table, $_ );
}
/**
* Get / set the column name to use for the value in the options list. This
* would normally be the primary key for the table.
*
* @param null|string $_ String to set, null to get current value
* @return Options|string Self if setting for chaining, string if getting.
*/
public function value ( $_=null )
{
return $this->_getSet( $this->_value, $_ );
}
/**
* Get / set the method to use for a WHERE condition if it is to be
* applied to the query to get the options.
*
* @param null|callable $_ Function to set, null to get current value
* @return Options|callable Self if setting for chaining, callable if
* getting.
*/
public function where ( $_=null )
{
return $this->_getSet( $this->_where, $_ );
}
/**
* Get / set the array values used for a leftJoin condition if it is to be
* applied to the query to get the options.
*
* @param string $table to get the information from
* @param string $field1 the first field to get the information from
* @param string $operator the operation to perform on the two fields
* @param string $field2 the second field to get the information from
* @return self
*/
public function leftJoin ( $table, $field1, $operator, $field2 )
{
$this->_leftJoin[] = array(
"table" => $table,
"field1" => $field1,
"field2" => $field2,
"operator" => $operator
);
return $this;
}
/**
* Adds all of the where conditions to the desired query
*
* @param string $query the query being built
* @return self
*/
private function _get_where ( $query )
{
for ( $i=0 ; $i<count($this->_where) ; $i++ ) {
if ( is_callable( $this->_where[$i] ) ) {
$this->_where[$i]( $query );
}
else {
$query->where(
$this->_where[$i]['key'],
$this->_where[$i]['value'],
$this->_where[$i]['op']
);
}
}
return $this;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Internal methods
*/
/**
* Execute the options (i.e. get them)
*
* @param Database $db Database connection
* @return array List of options
* @internal
*/
public function exec ( $field, $editor, $http, $fields, $leftJoinIn )
{
// If the value is not yet set then set the variable to be the field name
if ( $this->_value == null) {
$value = $field->dbField();
}
else {
$value = $this->_value;
}
$readTable = $editor->readTable();
// If the table is not yet set then set the table variable to be the same as editor
// This is not taking a value from the SearchBuilderOptions instance as the table should be defined in value/label. This throws up errors if not.
if($this->_table !== null) {
$table = $this->_table;
}
else if(count($readTable) > 0) {
$table = $readTable;
}
else {
$table = $editor->table();
}
// If the label value has not yet been set then just set it to be the same as value
if ( $this->_label == null ) {
$label = $value;
}
else {
$label = $this->_label[0];
}
// Set the database from editor
$db = $editor->db();
$formatter = $this->_renderer;
// We need a default formatter if one isn't provided
if ( ! $formatter ) {
$formatter = function ( $str ) {
return $str;
};
}
// Set up the join variable so that it will fit nicely later
$leftJoin = gettype($this->_leftJoin) === 'array' ?
$this->_leftJoin :
array($this->_leftJoin);
foreach($leftJoinIn as $lj) {
$found = false;
foreach($leftJoin as $lje) {
if($lj['table'] === $lje['table']) {
$found = true;
}
}
if(!$found) {
array_push($leftJoin, $lj);
}
}
// Set the query to get the current counts for viewTotal
$query = $db
->query('select')
->table( $table )
->left_join($leftJoin);
if ( $field->apply('get') && $field->getValue() === null ) {
$query->get($value." as value", $label." as label");
$query->group_by( $value);
}
$res = $query
->exec()
->fetchAll();
// Create the output array
$out = array();
for( $j=0 ; $j<count($res) ; $j ++) {
$out[] = array(
"value" => $res[$j]['value'],
"label" => $res[$j]['label']
);
}
// Only sort if there was no SQL order field
if ( ! $this->_order ) {
usort( $out, function ( $a, $b ) {
return is_numeric($a['label']) && is_numeric($b['label']) ?
($a['label']*1) - ($b['label']*1) :
strcmp( $a['label'], $b['label'] );
} );
}
return $out;
}
}

View File

@ -0,0 +1,467 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2016 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Editor;
if (!defined('DATATABLES')) exit();
use DataTables;
/**
* The Options class provides a convenient method of specifying where Editor
* should get the list of options for a `select`, `radio` or `checkbox` field.
* This is normally from a table that is _left joined_ to the main table being
* edited, and a list of the values available from the joined table is shown to
* the end user to let them select from.
*
* `Options` instances are used with the {@see Field->options()} method.
*
* @example
* Get a list of options from the `sites` table
* ```php
* Field::inst( 'users.site' )
* ->options( Options::inst()
* ->table( 'sites' )
* ->value( 'id' )
* ->label( 'name' )
* )
* ```
*
* @example
* Get a list of options with custom ordering
* ```php
* Field::inst( 'users.site' )
* ->options( Options::inst()
* ->table( 'sites' )
* ->value( 'id' )
* ->label( 'name' )
* ->order( 'name DESC' )
* )
* ```
*
* @example
* Get a list of options showing the id and name in the label
* ```php
* Field::inst( 'users.site' )
* ->options( Options::inst()
* ->table( 'sites' )
* ->value( 'id' )
* ->label( [ 'name', 'id' ] )
* ->render( function ( $row ) {
* return $row['name'].' ('.$row['id'].')';
* } )
* )
* ```
*/
class SearchPaneOptions extends DataTables\Ext {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private parameters
*/
/** @var string Table to get the information from */
private $_table = null;
/** @var string Column name containing the value */
private $_value = null;
/** @var string[] Column names for the label(s) */
private $_label = array();
/** @var string[] Column names for left join */
private $_leftJoin = array();
/** @var callable Callback function to do rendering of labels */
private $_renderer = null;
/** @var callback Callback function to add where conditions */
private $_where = null;
/** @var string ORDER BY clause */
private $_order = null;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
/**
* Get / set the column(s) to use as the label value of the options
*
* @param null|string|string[] $_ null to get the current value, string or
* array to get.
* @return Options|string[] Self if setting for chaining, array of values if
* getting.
*/
public function label ( $_=null )
{
if ( $_ === null ) {
return $this;
}
else if ( is_string($_) ) {
$this->_label = array( $_ );
}
else {
$this->_label = $_;
}
return $this;
}
/**
* Get / set the ORDER BY clause to use in the SQL. If this option is not
* provided the ordering will be based on the rendered output, either
* numerically or alphabetically based on the data returned by the renderer.
*
* @param null|string $_ String to set, null to get current value
* @return Options|string Self if setting for chaining, string if getting.
*/
public function order ( $_=null )
{
return $this->_getSet( $this->_order, $_ );
}
/**
* Get / set the label renderer. The renderer can be used to combine
* multiple database columns into a single string that is shown as the label
* to the end user in the list of options.
*
* @param null|callable $_ Function to set, null to get current value
* @return Options|callable Self if setting for chaining, callable if
* getting.
*/
public function render ( $_=null )
{
return $this->_getSet( $this->_renderer, $_ );
}
/**
* Get / set the database table from which to gather the options for the
* list.
*
* @param null|string $_ String to set, null to get current value
* @return Options|string Self if setting for chaining, string if getting.
*/
public function table ( $_=null )
{
return $this->_getSet( $this->_table, $_ );
}
/**
* Get / set the column name to use for the value in the options list. This
* would normally be the primary key for the table.
*
* @param null|string $_ String to set, null to get current value
* @return Options|string Self if setting for chaining, string if getting.
*/
public function value ( $_=null )
{
return $this->_getSet( $this->_value, $_ );
}
/**
* Get / set the method to use for a WHERE condition if it is to be
* applied to the query to get the options.
*
* @param null|callable $_ Function to set, null to get current value
* @return Options|callable Self if setting for chaining, callable if
* getting.
*/
public function where ( $_=null )
{
return $this->_getSet( $this->_where, $_ );
}
/**
* Get / set the array values used for a leftJoin condition if it is to be
* applied to the query to get the options.
*
* @param string $table to get the information from
* @param string $field1 the first field to get the information from
* @param string $operator the operation to perform on the two fields
* @param string $field2 the second field to get the information from
* @return self
*/
public function leftJoin ( $table, $field1, $operator, $field2 )
{
$this->_leftJoin[] = array(
"table" => $table,
"field1" => $field1,
"field2" => $field2,
"operator" => $operator
);
return $this;
}
/**
* Adds all of the where conditions to the desired query
*
* @param string $query the query being built
* @return self
*/
private function _get_where ( $query )
{
for ( $i=0 ; $i<count($this->_where) ; $i++ ) {
if ( is_callable( $this->_where[$i] ) ) {
$this->_where[$i]( $query );
}
else {
$query->where(
$this->_where[$i]['key'],
$this->_where[$i]['value'],
$this->_where[$i]['op']
);
}
}
return $this;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Internal methods
*/
/**
* Execute the options (i.e. get them)
*
* @param Database $db Database connection
* @return array List of options
* @internal
*/
public function exec ( $field, $editor, $http, $fields, $leftJoinIn )
{
$db = $editor->db();
$readTable = $editor->readTable();
$filteringActive = isset($http['searchPanes']);
$viewCount = isset($http['searchPanes_options'])
? filter_var($http['searchPanes_options']['viewCount'], FILTER_VALIDATE_BOOLEAN)
: true;
$viewTotal = isset($http['searchPanes_options'])
? filter_var($http['searchPanes_options']['viewTotal'], FILTER_VALIDATE_BOOLEAN)
: false;
$cascade = isset($http['searchPanes_options'])
? filter_var($http['searchPanes_options']['cascade'], FILTER_VALIDATE_BOOLEAN)
: false;
$entries = null;
// If the value is not yet set then set the variable to be the field name
$value = $this->_value == null
? $field->dbField()
: $this->_value;
// If the table is not yet set then set the table variable to be the same as editor
// This is not taking a value from the SearchPaneOptions instance as the table should be defined in value/label. This throws up errors if not.
if($this->_table !== null) {
$table = $this->_table;
}
else if(count($readTable) > 0) {
$table = $readTable;
}
else {
$table = $editor->table();
}
// If the label value has not yet been set then just set it to be the same as value
$label = $this->_label == null
? $value
: $this->_label[0];
$formatter = $this->_renderer
? $this->_renderer
: function ( $str ) {
return $str;
};
// Set up the join variable so that it will fit nicely later
$leftJoin = gettype($this->_leftJoin) === 'array' ?
$this->_leftJoin :
array($this->_leftJoin);
foreach($leftJoinIn as $lj) {
$found = false;
foreach($leftJoin as $lje) {
if($lj['table'] === $lje['table']) {
$found = true;
}
}
if(!$found) {
array_push($leftJoin, $lj);
}
}
// Get the data for the pane options
$q = $db
->query('select')
->distinct(true)
->table( $table )
->get( $label." as label", $value." as value" )
->left_join($leftJoin)
->group_by( $value )
->where( $this->_where );
// If not cascading, then the total and count must be the same
if ($viewTotal) {
$q->get("COUNT(*) as total");
}
if ( $this->_order ) {
// For cases where we are ordering by a field which isn't included in the list
// of fields to display, we need to add the ordering field, due to the
// select distinct.
$orderFields = explode( ',', $this->_order );
for ( $i=0, $ien=count($orderFields) ; $i<$ien ; $i++ ) {
$orderField = strtolower( $orderFields[$i] );
$orderField = str_replace( ' asc', '', $orderField );
$orderField = str_replace( ' desc', '', $orderField );
$orderField = trim( $orderField );
if ( ! in_array( $orderField, $fields ) ) {
$q->get( $orderField );
}
}
$q->order( $this->_order );
}
$rows = $q
->exec()
->fetchAll();
// Remove any filtering entries that don't exist in the database (values might have changed)
if (isset($http['searchPanes'][$field->name()])) {
$values = array_column($rows, 'value');
$selected = $http['searchPanes'][$field->name()];
for ($i=0 ; $i<count($selected) ; $i++) {
$idx = array_search($selected[$i], $values);
if ($idx === false) {
array_splice($http['searchPanes'][$field->name()], $i, 1);
}
}
}
// Apply filters to cascade tables
if ($viewCount || $cascade) {
$query = $db
->query('select')
->distinct(true)
->table($table)
->left_join($leftJoin);
if ( $field->apply('get') && $field->getValue() === null ) {
$query->get($value." as value");
$query->group_by($value);
// We viewTotal is enabled, we need to do a count to get the number of records,
// If it isn't we still need to know it exists, but don't care about the cardinality
if ($viewCount) {
$query->get("COUNT(*) as count");
}
else {
$query->get("(1) as count");
}
}
// Construct the where queries based upon the options selected by the user
foreach ($fields as $fieldOpt) {
$add = false;
$fieldName = $fieldOpt->name();
// If there is a last value set then a slightly different set of results is required for cascade
// That panes results are based off of the results when only considering the selections of all of the others
if (isset($http['searchPanesLast']) && $field->name() === $http['searchPanesLast']) {
if (isset($http['searchPanes'][$fieldName]) && $fieldName !== $http['searchPanesLast']) {
$add = true;
}
}
else if (isset($http['searchPanes']) && isset($http['searchPanes'][$fieldName])) {
$add = true;
}
if ($add) {
$query->where( function ($q) use ($fieldOpt, $http, $fieldName) {
for($j=0, $jen=count($http['searchPanes'][$fieldName]); $j < $jen ; $j++) {
$q->or_where(
$fieldOpt->dbField(),
isset($http['searchPanes_null'][$fieldName][$j])
? null
: $http['searchPanes'][$fieldName][$j],
'='
);
}
});
}
}
$entriesRows = $query
->exec()
->fetchAll();
// Key by the value for fast lookup
$entriesKeys = array_column($entriesRows, 'value');
$entries = array_combine($entriesKeys, $entriesRows);
}
$out = array();
for ( $i=0, $ien=count($rows) ; $i<$ien ; $i++ ) {
$row = $rows[$i];
$value = $row['value'];
$total = isset($row['total']) ? $row['total'] : null;
$count = $total;
if ($entries !== null) {
$count = isset($entries[$value]) && isset($entries[$value]['count'])
? $entries[$value]['count']
: 0;
// For when viewCount is enabled and viewTotal is not
// the total needs to be the same as the count!
if ($total === null) {
$total = $count;
}
}
$out[] = array(
"label" => $formatter($row['label']),
"total" => $total,
"value" => $value,
"count" => $count
);
}
// Only sort if there was no SQL order field
if ( ! $this->_order ) {
usort( $out, function ( $a, $b ) {
$aLabel = $a['label'];
$bLabel = $b['label'];
if ($aLabel === null) {
$aLabel = '';
}
if ($bLabel === null) {
$bLabel = '';
}
return is_numeric($aLabel) && is_numeric($bLabel) ?
($aLabel*1) - ($bLabel*1) :
strcmp( $aLabel, $bLabel );
} );
}
return $out;
}
}

View File

@ -0,0 +1,735 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2015 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Editor;
if (!defined('DATATABLES')) exit();
use DataTables;
/**
* Upload class for Editor. This class provides the ability to easily specify
* file upload information, specifically how the file should be recorded on
* the server (database and file system).
*
* An instance of this class is attached to a field using the {@see
* Field->upload()} method. When Editor detects a file upload for that file the
* information provided for this instance is executed.
*
* The configuration is primarily driven through the {@see Upload->db()} and
* {@see Upload->action()} methods:
*
* * {@see Upload->db()} Describes how information about the uploaded file is to be
* stored on the database.
* * {@see Upload->action()} Describes where the file should be stored on the file system
* and provides the option of specifying a custom action when a file is
* uploaded.
*
* Both methods are optional - you can store the file on the server using the
* {@see Upload->db()} method only if you want to store the file in the database, or if
* you don't want to store relational data on the database us only
* {@see Upload->action()}. However, the majority of the time it is best to use
* both - store information about the file on the database for fast retrieval (using a
* {@see Editor->leftJoin()} for example) and the file on the file system for direct
* web access.
*
* @example
* Store information about a file in a table called `files` and the actual
* file in an `uploads` directory.
* ```
* Field::inst( 'imageId' )
* ->upload(
* Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/uploads/__ID__.__EXTN__' )
* ->db( 'files', 'id', array(
* 'webPath' => Upload::DB_WEB_PATH,
* 'fileName' => Upload::DB_FILE_NAME,
* 'fileSize' => Upload::DB_FILE_SIZE,
* 'systemPath' => Upload::DB_SYSTEM_PATH
* ) )
* ->allowedExtensions( array( 'png', 'jpg' ), "Please upload an image file" )
* )
* ```
*
* @example
* As above, but with PHP 5.4 (which allows chaining from new instances of a
* class)
* ```
* newField( 'imageId' )
* ->upload(
* new Upload( $_SERVER['DOCUMENT_ROOT'].'/uploads/__ID__.__EXTN__' )
* ->db( 'files', 'id', array(
* 'webPath' => Upload::DB_WEB_PATH,
* 'fileName' => Upload::DB_FILE_NAME,
* 'fileSize' => Upload::DB_FILE_SIZE,
* 'systemPath' => Upload::DB_SYSTEM_PATH
* ) )
* ->allowedExtensions( array( 'png', 'jpg' ), "Please upload an image file" )
* )
* ```
*/
class Upload extends DataTables\Ext {
/* * * * * * * * * * * * * * * * * * * * * * * * *
* Constants
*/
/** Database value option (`Db()`) - File content. This should be written to
* a blob. Typically this should be avoided and the file saved on the file
* system, but there are cases where it can be useful to store the file in
* the database.
*/
const DB_CONTENT = 'editor-content';
/** Database value option (`Db()`) - Content type */
const DB_CONTENT_TYPE = 'editor-contentType';
/** Database value option (`Db()`) - File extension */
const DB_EXTN = 'editor-extn';
/** Database value option (`Db()`) - File name (with extension) */
const DB_FILE_NAME = 'editor-fileName';
/** Database value option (`Db()`) - File size (bytes) */
const DB_FILE_SIZE = 'editor-fileSize';
/** Database value option (`Db()`) - MIME type */
const DB_MIME_TYPE = 'editor-mimeType';
/** Database value option (`Db()`) - Full system path to the file */
const DB_SYSTEM_PATH = 'editor-systemPath';
/** Database value option (`Db()`) - HTTP path to the file. This is derived
* from the system path by removing `$_SERVER['DOCUMENT_ROOT']`. If your
* images live outside of the document root a custom value would be to be
* used.
*/
const DB_WEB_PATH = 'editor-webPath';
/** Read from the database - don't write to it
*/
const DB_READ_ONLY = 'editor-readOnly';
/* * * * * * * * * * * * * * * * * * * * * * * * *
* Private parameters
*/
private $_action = null;
private $_dbCleanCallback = null;
private $_dbCleanTableField = null;
private $_dbTable = null;
private $_dbPKey = null;
private $_dbFields = null;
private $_dbFormat = null;
private $_extns = null;
private $_extnError = null;
private $_error = null;
private $_mode = 0644;
private $_validators = array();
private $_where = array();
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
/**
* Upload instance constructor
* @param string|callable $action Action to take on upload - this is applied
* directly to {@see Upload->action()}.
*/
function __construct( $action=null )
{
if ( $action ) {
$this->action( $action );
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
/**
* Set the action to take when a file is uploaded. This can be either of:
*
* * A string - the value given is the full system path to where the
* uploaded file is written to. The value given can include three "macros"
* which are replaced by the script dependent on the uploaded file:
* * `__EXTN__` - the file extension
* * `__NAME__` - the uploaded file's name (including the extension)
* * `__ID__` - Database primary key value if the {@see Upload->db()} method is
* used.
* * A closure - if a function is given the responsibility of what to do
* with the uploaded file is transferred to this function. That will
* typically involve writing it to the file system so it can be used
* later.
*
* @param string|callable $action Action to take - see description above.
* @return self Current instance, used for chaining
*/
public function action ( $action )
{
$this->_action = $action;
return $this;
}
/**
* An array of valid file extensions that can be uploaded. This is for
* simple validation that the file is of the expected type - for example you
* might use `[ 'png', 'jpg', 'jpeg', 'gif' ]` for images. The check is
* case-insensitive. If no extensions are given, no validation is performed
* on the file extension.
*
* @param string[] $extn List of file extensions that are allowable for
* the upload
* @param string $error Error message if a file is uploaded that doesn't
* match the valid list of extensions.
* @return self Current instance, used for chaining
* @deprecated Use Validate::fileExtensions
*/
public function allowedExtensions ( $extn, $error="This file type cannot be uploaded" )
{
$this->_extns = $extn;
$this->_extnError = $error;
return $this;
}
/**
* Database configuration method. When used, this method will tell Editor
* what information you want written to a database on file upload, should
* you wish to store relational information about your file on the database
* (this is generally recommended).
*
* @param string $table The name of the table where the file information
* should be stored
* @param string $pkey Primary key column name. The `Upload` class
* requires that the database table have a single primary key so each
* row can be uniquely identified.
* @param array $fields A list of the fields to be written to on upload.
* The property names are the database columns and the values can be
* defined by the constants of this class. The value can also be a
* string or a closure function if you wish to send custom information
* to the database.
* @param callable Formatting function that can change the data obtained
* from the database. Only gets a single parameter passed in - the
* database row for the file that is read.
* @return self Current instance, used for chaining
*/
public function db ( $table, $pkey, $fields, $format=null )
{
$this->_dbTable = $table;
$this->_dbPKey = $pkey;
$this->_dbFields = $fields;
$this->_dbFormat = $format;
return $this;
}
/**
* Set a callback function that is used to remove files which no longer have
* a reference in a source table.
*
* @param callable $callback Function that will be executed on clean. It is
* given an array of information from the database about the orphaned
* rows, and can return true to indicate that the rows should be
* removed from the database. Any other return value (including none)
* will result in the records being retained.
* @return self Current instance, used for chaining
*/
public function dbClean( $tableField, $callback=null )
{
// Argument swapping
if ( $callback === null ) {
$callback = $tableField;
$tableField = null;
}
$this->_dbCleanCallback = $callback;
$this->_dbCleanTableField = $tableField;
return $this;
}
/**
* Set the permissions on the file after it has been uploaded using
* chmod.
*/
public function mode( $m ) {
$this->_mode = $m;
return $this;
}
/**
* Add a validation method to check file uploads. Multiple validators can be
* added by calling this method multiple times - they will be executed in
* sequence when a file has been uploaded.
*
* @param callable $fn Validation function. A PHP `$_FILES` parameter is
* passed in for the uploaded file and the return is either a string
* (validation failed and error message), or `null` (validation passed).
* @return self Current instance, used for chaining
*/
public function validator ( $fn )
{
$this->_validators[] = $fn;
return $this;
}
/**
* Add a condition to the data to be retrieved from the database. This
* must be given as a function to be executed (usually anonymous) and
* will be passed in a single argument, the `Query` object, to which
* conditions can be added. Multiple calls to this method can be made.
*
* @param callable $fn Where function.
* @return self Current instance, used for chaining
*/
public function where ( $fn )
{
$this->_where[] = $fn;
return $this;
}
/* * * * * * * * * * * * * * * * * * * * * * * * *
* Internal methods
*/
/**
* Get database information data from the table
*
* @param \DataTables\Database $db Database
* @param number[] [$ids=null] Limit to a specific set of ids
* @return array Database information
* @internal
*/
public function data ( $db, $ids=null )
{
if ( ! $this->_dbTable ) {
return null;
}
// Select the details requested, for the columns requested
$q = $db
->query( 'select' )
->table( $this->_dbTable )
->get( $this->_dbPKey );
foreach ( $this->_dbFields as $column => $prop ) {
if ( $prop !== self::DB_CONTENT ) {
$q->get( $column );
}
}
if ( $ids !== null ) {
$q->where_in( $this->_dbPKey, $ids );
}
for ( $i=0, $ien=count($this->_where) ; $i<$ien ; $i++ ) {
$q->where( $this->_where[$i] );
}
$result = $q->exec()->fetchAll();
$out = array();
for ( $i=0, $ien=count($result) ; $i<$ien ; $i++ ) {
if ($this->_dbFormat) {
$this->_dbFormat( $result[$i] );
}
$out[ $result[$i][ $this->_dbPKey ] ] = $result[$i];
}
return $out;
}
/**
* Clean the database
* @param \DataTables\Editor $editor Calling Editor instance
* @param Field $field Host field
* @internal
*/
public function dbCleanExec ( $editor, $field )
{
// Database and file system clean up BEFORE adding the new file to
// the db, otherwise it will be removed immediately
$tables = $editor->table();
$this->_dbClean( $editor->db(), $tables[0], $field->dbField() );
}
/**
* Get the set error message
*
* @return string Class error
* @internal
*/
public function error ()
{
return $this->_error;
}
/**
* Execute an upload
*
* @param \DataTables\Editor $editor Calling Editor instance
* @return int Primary key value
* @internal
*/
public function exec ( $editor )
{
$id = null;
$upload = $_FILES['upload'];
// Validation - PHP standard validation
if ( $upload['error'] !== UPLOAD_ERR_OK ) {
if ( $upload['error'] === UPLOAD_ERR_INI_SIZE ) {
$this->_error = "File exceeds maximum file upload size";
}
else {
$this->_error = "There was an error uploading the file (".$upload['error'].")";
}
return false;
}
// Validation - acceptable file extensions
if ( is_array( $this->_extns ) ) {
$extn = pathinfo($upload['name'], PATHINFO_EXTENSION);
if ( in_array( strtolower($extn), array_map( 'strtolower', $this->_extns ) ) === false ) {
$this->_error = $this->_extnError;
return false;
}
}
// Validation - custom callback
for ( $i=0, $ien=count($this->_validators) ; $i<$ien ; $i++ ) {
$res = $this->_validators[$i]( $upload );
if ( is_string( $res ) ) {
$this->_error = $res;
return false;
}
}
// Database
if ( $this->_dbTable ) {
foreach ( $this->_dbFields as $column => $prop ) {
// We can't know what the path is, if it has moved into place
// by an external function - throw an error if this does happen
if ( ! is_string( $this->_action ) &&
($prop === self::DB_SYSTEM_PATH || $prop === self::DB_WEB_PATH )
) {
$this->_error = "Cannot set path information in database ".
"if a custom method is used to save the file.";
return false;
}
}
// Commit to the database
$id = $this->_dbExec( $upload, $editor->db() );
}
// Perform file system actions
return $this->_actionExec( $upload, $id );
}
/**
* Get the primary key column for the table
*
* @return string Primary key column name
* @internal
*/
public function pkey ()
{
return $this->_dbPKey;
}
/**
* Get the db table name
*
* @return string DB table name
* @internal
*/
public function table ()
{
return $this->_dbTable;
}
/* * * * * * * * * * * * * * * * * * * * * * * * *
* Private methods
*/
/**
* Execute the configured action for the upload
*
* @param array $upload $_FILES['upload']
* @param int $id Primary key value
* @return int File identifier - typically the primary key
*/
private function _actionExec ( $upload, $id )
{
if ( ! is_string( $this->_action ) ) {
// Custom function
$action = $this->_action;
return $action( $upload, $id );
}
// Default action - move the file to the location specified by the
// action string
$to = $this->_path( $upload['name'], $id );
$res = rename( $upload['tmp_name'], $to );
if ( $res === false ) {
$this->_error = "An error occurred while moving the uploaded file.";
return false;
}
if ($this->_mode) {
chmod($to, $this->_mode);
}
return $id !== null ?
$id :
$to;
}
/**
* Perform the database clean by first getting the information about the
* orphaned rows and then calling the callback function. The callback can
* then instruct the rows to be removed through the return value.
*
* @param \DataTables\Database $db Database instance
* @param string $editorTable Editor Editor instance table name
* @param string $fieldName Host field's name
*/
private function _dbClean ( $db, $editorTable, $fieldName )
{
$callback = $this->_dbCleanCallback;
if ( ! $this->_dbTable || ! $callback ) {
return;
}
// If there is a table / field that we should use to check if the value
// is in use, then use that. Otherwise we'll try to use the information
// from the Editor / Field instance.
if ( $this->_dbCleanTableField ) {
$fieldName = $this->_dbCleanTableField;
}
$a = explode('.', $fieldName);
if ( count($a) === 1 ) {
$table = $editorTable;
$field = $a[0];
}
else if ( count($a) === 2 ) {
$table = $a[0];
$field = $a[1];
}
else {
$table = $a[1];
$field = $a[2];
}
// Select the details requested, for the columns requested
$q = $db
->query( 'select' )
->table( $this->_dbTable )
->get( $this->_dbPKey );
foreach ( $this->_dbFields as $column => $prop ) {
if ( $prop !== self::DB_CONTENT ) {
$q->get( $column );
}
}
$q->where( $this->_dbPKey, '(SELECT '.$field.' FROM '.$table.' WHERE '.$field.' IS NOT NULL)', 'NOT IN', false );
$data = $q->exec()->fetchAll();
if ( count( $data ) === 0 ) {
return;
}
$result = $callback( $data );
// Delete the selected rows, iff the developer says to do so with the
// returned value (i.e. acknowledge that the files have be removed from
// the file system)
if ( $result === true ) {
$qDelete = $db
->query( 'delete' )
->table( $this->_dbTable );
for ( $i=0, $ien=count( $data ) ; $i<$ien ; $i++ ) {
$qDelete->or_where( $this->_dbPKey, $data[$i][ $this->_dbPKey ] );
}
$qDelete->exec();
}
}
/**
* Add a record to the database for a newly uploaded file
*
* @param array $upload $_FILES['upload']
* @param \DataTables\Database $db Database instance
* @return int Primary key value for the newly uploaded file
*/
private function _dbExec ( $upload, $db )
{
$pathFields = array();
$insertedId = null;
// Insert the details requested, for the columns requested
$q = $db
->query( 'insert' )
->table( $this->_dbTable )
->pkey( $this->_dbPKey );
foreach ( $this->_dbFields as $column => $prop ) {
switch ( $prop ) {
case self::DB_READ_ONLY:
break;
case self::DB_CONTENT:
$q->set( $column, file_get_contents($upload['tmp_name']) );
break;
case self::DB_CONTENT_TYPE:
case self::DB_MIME_TYPE:
$finfo = finfo_open(FILEINFO_MIME);
$mime = finfo_file($finfo, $upload['tmp_name']);
finfo_close($finfo);
$q->set( $column, $mime );
break;
case self::DB_EXTN:
$extn = pathinfo($upload['name'], PATHINFO_EXTENSION);
$q->set( $column, $extn );
break;
case self::DB_FILE_NAME:
$q->set( $column, $upload['name'] );
break;
case self::DB_FILE_SIZE:
$q->set( $column, $upload['size'] );
break;
case self::DB_SYSTEM_PATH:
$pathFields[ $column ] = self::DB_SYSTEM_PATH;
$q->set( $column, '-' ); // Use a temporary value to avoid cases
break; // where the db will reject empty values
case self::DB_WEB_PATH:
$pathFields[ $column ] = self::DB_WEB_PATH;
$q->set( $column, '-' ); // Use a temporary value (as above)
break;
default:
$val = $prop;
// Callable function - execute to get the value
if ( is_callable($prop) && is_object($prop) ) {
$val = $prop( $db, $upload );
}
// If the primary key value was set - use that
if ( $column === $this->_dbPKey ) {
$insertedId = $val;
}
if (is_string($val) && ! empty($val)) {
// Allow for replacement of __ID__, etc when the value is a string
$pathFields[ $column ] = $val;
$q->set( $column, '-' ); // Use a temporary value (as above)
}
else {
$q->set( $column, $val );
}
break;
}
}
$res = $q->exec();
$id = $insertedId !== null
? $insertedId
: $res->insertId();
// Update the newly inserted row with the path information. We have to
// use a second statement here as we don't know in advance what the
// database schema is and don't want to prescribe that certain triggers
// etc be created. It makes it a bit less efficient but much more
// compatible
if ( count( $pathFields ) ) {
// For this to operate the action must be a string, which is
// validated in the `exec` method
$path = $this->_path( $upload['name'], $id );
$webPath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $path);
$q = $db
->query( 'update' )
->table( $this->_dbTable )
->where( $this->_dbPKey, $id );
foreach ( $pathFields as $column => $type ) {
$q->set( $column, $type === self::DB_WEB_PATH ? $webPath : $path );
}
$q->exec();
}
return $id;
}
/**
* Apply macros to a user specified path
*
* @param string $name File path
* @param int $id Primary key value for the file
* @return string Resolved path
*/
private function _path ( $name, $id )
{
$extn = pathinfo( $name, PATHINFO_EXTENSION );
$to = $this->_action;
$to = str_replace( "__NAME__", $name, $to );
$to = str_replace( "__ID__", $id, $to );
$to = str_replace( "__EXTN__", $extn, $to );
return $to;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012-2014 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Editor;
if (!defined('DATATABLES')) exit();
use DataTables;
/**
* Common validation options that can be specified for all validation methods.
*/
class ValidateOptions extends DataTables\Ext {
private $_empty = true;
private $_message = 'Input not valid';
private $_optional = true;
function __construct( $opts=null )
{
if ( $opts ) {
if ( isset( $opts['empty'] ) ) {
$this->allowEmpty( $opts['empty'] );
}
if ( isset( $opts['message'] ) ) {
$this->message( $opts['message'] );
}
if ( isset( $opts['optional'] ) ) {
$this->optional( $opts['optional'] );
}
}
return $this;
}
/**
* Get / set the error message to use if validation fails
* @param string $msg Error message to use. If not given, the currently
* set message will be returned.
* @return ValidateOptions|string Self if setting, message if getting.
*/
public function message ( $msg=null ) {
if ( $msg === null ) {
return $this->_message;
}
$this->_message = $msg;
return $this;
}
/**
* Get / set the field empty option
* @param boolean $empty `false` if the field is not allowed to be
* empty. `true` if it can be.
* @return ValidateOptions|boolean Self if setting, current value if getting.
*/
public function allowEmpty ( $empty=null ) {
if ( $empty === null ) {
return $this->_empty;
}
$this->_empty = $empty;
return $this;
}
/**
* Get / set the field optional option
* @param boolean $optional `false` if the field does not need to be
* submitted. `true` if it must be.
* @return ValidateOptions|boolean Self if setting, current value if getting.
*/
public function optional ( $optional=null ) {
if ( $optional === null ) {
return $this->_optional;
}
$this->_optional = $optional;
return $this;
}
/**
* @internal
*/
static public function select ( $user ) {
if ( $user ) {
return $user;
}
return new ValidateOptions();
}
}

View File

@ -0,0 +1,222 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables;
if (!defined('DATATABLES')) exit();
/**
* Base class for DataTables classes.
*/
class Ext {
/**
* Static method to instantiate a new instance of a class.
*
* A factory method that will create a new instance of the class
* that has extended 'Ext'. This allows classes to be instantiated
* and then chained - which otherwise isn't available until PHP 5.4.
* If using PHP 5.4 or later, simply create a 'new' instance of the
* target class and chain methods as normal.
* @return \DataTables\Editor|\DataTables\Editor\Field|\DataTables\Editor\Join|\DataTables\Editor\Upload Instantiated class
* @static
*/
public static function instantiate ()
{
$rc = new \ReflectionClass( get_called_class() );
$args = func_get_args();
return count( $args ) === 0 ?
$rc->newInstance() :
$rc->newInstanceArgs( $args );
}
/**
* Static method to instantiate a new instance of a class (shorthand of
* 'instantiate').
*
* This method performs exactly the same actions as the 'instantiate'
* static method, but is simply shorter and easier to type!
* @return \DataTables\Editor|\DataTables\Editor\Field|\DataTables\Editor\Join|\DataTables\Editor\Upload class
* @static
*/
public static function inst ()
{
$rc = new \ReflectionClass( get_called_class() );
$args = func_get_args();
return count( $args ) === 0 ?
$rc->newInstance() :
$rc->newInstanceArgs( $args );
}
/**
* Common getter / setter function for DataTables classes.
*
* This getter / setter method makes building getter / setting methods
* easier, by abstracting everything to a single function call.
* @param mixed &$prop The property to set
* @param mixed $val The value to set - if given as null, then we assume
* that the function is being used as a getter.
* @param boolean $array Treat the target property as an array or not
* (default false). If used as an array, then values passed in are added
* to the $prop array.
* @return self|mixed Class instance if setting (allowing chaining), or
* the value requested if getting.
*/
protected function _getSet( &$prop, $val, $array=false )
{
// Get
if ( $val === null ) {
return $prop;
}
// Set
if ( $array ) {
// Property is an array, merge or add to array
is_array( $val ) ?
$prop = array_merge( $prop, $val ) :
$prop[] = $val;
}
else {
// Property is just a value
$prop = $val;
}
return $this;
}
/**
* Determine if a property is available in a data set (allowing `null` to be
* a valid value)
* @param string $name Javascript dotted object name to write to
* @param array $data Data source array to read from
* @return boolean true if present, false otherwise
* @private
*/
protected function _propExists ( $name, $data )
{
if ( strpos($name, '.') === false ) {
return isset( $data[ $name ] );
}
$names = explode( '.', $name );
$inner = $data;
for ( $i=0 ; $i<count($names)-1 ; $i++ ) {
if ( ! isset( $inner[ $names[$i] ] ) ) {
return false;
}
$inner = $inner[ $names[$i] ];
}
if ( isset( $names[count($names)-1] ) ) {
$idx = $names[count($names)-1];
return isset( $inner[ $idx ] );
}
return false;
}
/**
* Read a value from a data structure, using Javascript dotted object
* notation. This is the inverse of the `_writeProp` method and provides
* the same support, matching DataTables' ability to read nested JSON
* data objects.
*
* @param string $name Javascript dotted object name to write to
* @param array $data Data source array to read from
* @return mixed The read value, or null if no value found.
* @private
*/
protected function _readProp ( $name, $data )
{
if ( strpos($name, '.') === false ) {
return isset( $data[ $name ] ) ?
$data[ $name ] :
null;
}
$names = explode( '.', $name );
$inner = $data;
for ( $i=0 ; $i<count($names)-1 ; $i++ ) {
if ( ! isset( $inner[ $names[$i] ] ) ) {
return null;
}
$inner = $inner[ $names[$i] ];
}
if ( isset( $names[count($names)-1] ) ) {
$idx = $names[count($names)-1];
return isset( $inner[ $idx ] ) ?
$inner[ $idx ] :
null;
}
return null;
}
/**
* Write the field's value to an array structure, using Javascript dotted
* object notation to indicate JSON data structure. For example `name.first`
* gives the data structure: `name: { first: ... }`. This matches DataTables
* own ability to do this on the client-side, although this doesn't
* implement implement quite such a complex structure (no array / function
* support).
*
* @param array &$out Array to write the data to
* @param string $name Javascript dotted object name to write to
* @param mixed $value Value to write
* @throws \Exception Information about duplicate properties
* @private
*/
protected function _writeProp( &$out, $name, $value )
{
if ( strpos($name, '.') === false ) {
$out[ $name ] = $value;
return;
}
$names = explode( '.', $name );
$inner = &$out;
for ( $i=0 ; $i<count($names)-1 ; $i++ ) {
$loopName = $names[$i];
if ( ! isset( $inner[ $loopName ] ) ) {
$inner[ $loopName ] = array();
}
else if ( ! is_array( $inner[ $loopName ] ) ) {
throw new \Exception(
'A property with the name `'.$name.'` already exists. This '.
'can occur if you have properties which share a prefix - '.
'for example `name` and `name.first`.'
);
}
$inner = &$inner[ $loopName ];
}
if ( isset( $inner[ $names[count($names)-1] ] ) ) {
throw new \Exception(
'Duplicate field detected - a field with the name `'.$name.'` '.
'already exists.'
);
}
$inner[ $names[count($names)-1] ] = $value;
}
}

View File

@ -0,0 +1,112 @@
<?php
/**
* HtmLawed is used here to provide protection against XSS attacks with Editor
* input - see the `Field->xss()` method. The Vanilla forums wrapper is used
* to provide sensible defaults and a clean interface for HtmLawed.
*
* Changes:
*
* * Add `DataTables/HtmLawed` namespace to this and htmLawed - this is to ensure
* that if htmLawed is included by any other aspect of the site it will not
* result in a conflict.
* * Use the OOP version of htmLawed (required a single updated to call it) to
* make the namespacing relatively easy.
* * Change the name of the Vanilla class so it don't conflict with the
* htmLawed OOP class
* * Update all `htmLawed::` references to `\DataTables\HtmLawed\HtmLawed::` in
* the htmLawed file (to allow callbacks to operate correctly)
* * Updated Vanilla wrapper to operate on PHP 5.3
*
* HtmLawed:
* http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/
* Copyright: Santosh Patnaik
* License: Dual licensed with LGPL 3 and GPL 2+
*
* Vanilla wrapper for HtmLawed:
* https://github.com/vanilla/htmlawed/
* Author: Todd Burry <todd@vanillaforums.com>
* Copyright: 2009-2014 Vanilla Forums Inc.
* License: LGPL-3.0
*/
namespace DataTables\HtmLawed;
/**
* A class wrapper for the htmLawed library.
*/
class Htmlaw {
/// Methods ///
public static $defaultConfig = array(
'anti_link_spam' => array('`.`', ''),
'comment' => 1,
'cdata' => 3,
'css_expression' => 1,
'deny_attribute' => 'on*',
'unique_ids' => 0,
'elements' => '*-applet-form-input-textarea-iframe-script-style-embed-object',
'keep_bad' => 1,
'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', // clsid allowed in class
'valid_xhtml' => 0,
'direct_list_nest' => 1,
'balance' => 1
);
public static $defaultSpec = array(
'object=-classid-type, -codebase',
'embed=type(oneof=application/x-shockwave-flash)'
);
/**
* Filters a string of html with the htmLawed library.
*
* @param string $html The text to filter.
* @param array|null $config Config settings for the array.
* @param string|array|null $spec A specification to further limit the allowed attribute values in the html.
* @return string Returns the filtered html.
* @see http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm
*/
public static function filter($html, array $config = null, $spec = null) {
if ($config === null) {
$config = self::$defaultConfig;
}
if (isset($config['spec']) && !$spec) {
$spec = $config['spec'];
}
if ($spec === null) {
$spec = static::$defaultSpec;
}
return Htmlawed::hl($html, $config, $spec);
}
/**
* Filter a string of html so that it can be put into an rss feed.
*
* @param $html The html text to fitlter.
* @return string Returns the filtered html.
* @see Htmlawed::filter().
*/
public static function filterRSS($html) {
$config = array(
'anti_link_spam' => array('`.`', ''),
'comment' => 1,
'cdata' => 3,
'css_expression' => 1,
'deny_attribute' => 'on*,style,class',
'elements' => '*-applet-form-input-textarea-iframe-script-style-object-embed-comment-link-listing-meta-noscript-plaintext-xmp',
'keep_bad' => 0,
'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', // clsid allowed in class
'valid_xml' => 2,
'balance' => 1
);
$spec = static::$defaultSpec;
$result = static::filter($html, $config, $spec);
return $result;
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
PHP libraries for DataTables Editor
Copyright (c) 2018 SpryMedia Limited and other contributors
http://datatables.net
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,36 @@
{
"name": "datatables.net/editor-php",
"description": "PHP server-side libraries for Editor",
"type": "library",
"require": {
"php": ">=5.3.0"
},
"keywords": ["DataTables","jQuery","Editor"],
"homepage": "https://editor.datatables.net",
"authors": [
{
"name": "SpryMedia Ltd",
"homepage": "https://datatables.net"
}
],
"require-dev": {
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "1.4.5",
"phpstan/phpstan-deprecation-rules": "^1.0"
},
"autoload": {
"psr-4": {
"DataTables\\": ""
},
"files": [
"composer.php"
]
},
"license": "MIT",
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
},
"sort-packages": true
}
}

View File

@ -0,0 +1,12 @@
<?php
/*
* This file is included by composer automatically and is used simply
* to define a parameter that allows the Editor PHP libraries to load
* (they check for this parameter and will exit immediately if not
* defined for security).
*
* This file should NOT be included manually. It is for use by
* composer only.
*/
define("DATATABLES", true);

View File

@ -0,0 +1,30 @@
<?php if (!defined('DATATABLES')) exit(); // Ensure being used in DataTables .env.
// Enable error reporting for debugging (remove for production)
error_reporting(E_ALL);
ini_set('display_errors', '1');
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Database user / pass
*/
$sql_details = array(
"type" => "Mysql", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle"
"user" => "sk_jjo", // Database user name
"pass" => "61tv&G1Zf^XY", // Database password
"host" => "localhost", // Database host
"port" => "", // Database connection port (can be left empty for default)
"db" => "sk_jjo", // Database name
"dsn" => "", // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL
"pdoAttr" => array() // PHP PDO attributes array. See the PHP documentation for all options
);
// This is included for the development and deploy environment used on the DataTables
// server. You can delete this block - it just includes my own user/pass without making
// them public!
if ( is_file($_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php") ) {
include( $_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php" );
}
// /End development include

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,515 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database.html">Database</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database-driver.html">Driver</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
Db2Result
<span class="phpdocumentor-element__extends">
extends <a href="classes/DataTables-Database-Result.html"><abbr title="\DataTables\Database\Result">Result</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/Db2Result.php"><a href="files/database-driver-db2result.html"><abbr title="Database/Driver/Db2Result.php">Db2Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">23</span>
<a href="classes/DataTables-Database-Driver-Db2Result.html#source-view.23" class="phpdocumentor-element-found-in__source" data-line="23" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">SQL Server driver for DataTables Database Result class</p>
<section class="phpdocumentor-description"><p>@internal</p>
</section>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-Db2Result.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-Db2Result.html#method_count">count()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Count the number of rows in the result set.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-Db2Result.html#method_fetch">fetch()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get the next row in a result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-Db2Result.html#method_fetchAll">fetchAll()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get all rows in the result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-Db2Result.html#method_insertId">insertId()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>After an INSERT query, get the ID that was inserted.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Database-Driver-Db2Result.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/DataTables-Database-Driver-Db2Result.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/Db2Result.php"><a href="files/database-driver-db2result.html"><abbr title="Database/Driver/Db2Result.php">Db2Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">28</span>
<a href="classes/DataTables-Database-Driver-Db2Result.html#source-view.28" class="phpdocumentor-element-found-in__source" data-line="28" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$dbh</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$stmt</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"></section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$dbh</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$stmt</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_count">
count()
<a href="classes/DataTables-Database-Driver-Db2Result.html#method_count" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/Db2Result.php"><a href="files/database-driver-db2result.html"><abbr title="Database/Driver/Db2Result.php">Db2Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">50</span>
<a href="classes/DataTables-Database-Driver-Db2Result.html#source-view.50" class="phpdocumentor-element-found-in__source" data-line="50" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Count the number of rows in the result set.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">count</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetch">
fetch()
<a href="classes/DataTables-Database-Driver-Db2Result.html#method_fetch" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/Db2Result.php"><a href="files/database-driver-db2result.html"><abbr title="Database/Driver/Db2Result.php">Db2Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">57</span>
<a href="classes/DataTables-Database-Driver-Db2Result.html#source-view.57" class="phpdocumentor-element-found-in__source" data-line="57" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get the next row in a result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetch</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetchAll">
fetchAll()
<a href="classes/DataTables-Database-Driver-Db2Result.html#method_fetchAll" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/Db2Result.php"><a href="files/database-driver-db2result.html"><abbr title="Database/Driver/Db2Result.php">Db2Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">63</span>
<a href="classes/DataTables-Database-Driver-Db2Result.html#source-view.63" class="phpdocumentor-element-found-in__source" data-line="63" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get all rows in the result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetchAll</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_insertId">
insertId()
<a href="classes/DataTables-Database-Driver-Db2Result.html#method_insertId" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/Db2Result.php"><a href="files/database-driver-db2result.html"><abbr title="Database/Driver/Db2Result.php">Db2Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">69</span>
<a href="classes/DataTables-Database-Driver-Db2Result.html#source-view.69" class="phpdocumentor-element-found-in__source" data-line="69" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">After an INSERT query, get the ID that was inserted.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">insertId</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Database/Driver/Db2Result.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Database-Driver-Db2Result.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,523 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database.html">Database</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database-driver.html">Driver</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
FirebirdResult
<span class="phpdocumentor-element__extends">
extends <a href="classes/DataTables-Database-Result.html"><abbr title="\DataTables\Database\Result">Result</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/FirebirdResult.php"><a href="files/database-driver-firebirdresult.html"><abbr title="Database/Driver/FirebirdResult.php">FirebirdResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">24</span>
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#source-view.24" class="phpdocumentor-element-found-in__source" data-line="24" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Firebird driver for DataTables Database Result class</p>
<section class="phpdocumentor-description"><p>@internal</p>
</section>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method_count">count()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Count the number of rows in the result set.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method_fetch">fetch()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get the next row in a result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method_fetchAll">fetchAll()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get all rows in the result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method_insertId">insertId()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>After an INSERT query, get the ID that was inserted.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/FirebirdResult.php"><a href="files/database-driver-firebirdresult.html"><abbr title="Database/Driver/FirebirdResult.php">FirebirdResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">29</span>
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#source-view.29" class="phpdocumentor-element-found-in__source" data-line="29" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$dbh</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$stmt</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$pkey</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"></section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$dbh</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$stmt</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$pkey</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_count">
count()
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method_count" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/FirebirdResult.php"><a href="files/database-driver-firebirdresult.html"><abbr title="Database/Driver/FirebirdResult.php">FirebirdResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">52</span>
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#source-view.52" class="phpdocumentor-element-found-in__source" data-line="52" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Count the number of rows in the result set.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">count</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetch">
fetch()
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method_fetch" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/FirebirdResult.php"><a href="files/database-driver-firebirdresult.html"><abbr title="Database/Driver/FirebirdResult.php">FirebirdResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">58</span>
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#source-view.58" class="phpdocumentor-element-found-in__source" data-line="58" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get the next row in a result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetch</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetchAll">
fetchAll()
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method_fetchAll" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/FirebirdResult.php"><a href="files/database-driver-firebirdresult.html"><abbr title="Database/Driver/FirebirdResult.php">FirebirdResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">64</span>
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#source-view.64" class="phpdocumentor-element-found-in__source" data-line="64" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get all rows in the result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetchAll</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_insertId">
insertId()
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#method_insertId" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/FirebirdResult.php"><a href="files/database-driver-firebirdresult.html"><abbr title="Database/Driver/FirebirdResult.php">FirebirdResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">70</span>
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#source-view.70" class="phpdocumentor-element-found-in__source" data-line="70" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">After an INSERT query, get the ID that was inserted.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">insertId</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Database/Driver/FirebirdResult.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Database-Driver-FirebirdResult.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,515 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database.html">Database</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database-driver.html">Driver</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
MysqlResult
<span class="phpdocumentor-element__extends">
extends <a href="classes/DataTables-Database-Result.html"><abbr title="\DataTables\Database\Result">Result</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/MysqlResult.php"><a href="files/database-driver-mysqlresult.html"><abbr title="Database/Driver/MysqlResult.php">MysqlResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">24</span>
<a href="classes/DataTables-Database-Driver-MysqlResult.html#source-view.24" class="phpdocumentor-element-found-in__source" data-line="24" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">MySQL driver for DataTables Database Result class</p>
<section class="phpdocumentor-description"><p>@internal</p>
</section>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method_count">count()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Count the number of rows in the result set.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method_fetch">fetch()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get the next row in a result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method_fetchAll">fetchAll()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get all rows in the result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method_insertId">insertId()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>After an INSERT query, get the ID that was inserted.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Database-Driver-MysqlResult.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/MysqlResult.php"><a href="files/database-driver-mysqlresult.html"><abbr title="Database/Driver/MysqlResult.php">MysqlResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">29</span>
<a href="classes/DataTables-Database-Driver-MysqlResult.html#source-view.29" class="phpdocumentor-element-found-in__source" data-line="29" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$dbh</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$stmt</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"></section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$dbh</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$stmt</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_count">
count()
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method_count" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/MysqlResult.php"><a href="files/database-driver-mysqlresult.html"><abbr title="Database/Driver/MysqlResult.php">MysqlResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">50</span>
<a href="classes/DataTables-Database-Driver-MysqlResult.html#source-view.50" class="phpdocumentor-element-found-in__source" data-line="50" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Count the number of rows in the result set.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">count</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetch">
fetch()
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method_fetch" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/MysqlResult.php"><a href="files/database-driver-mysqlresult.html"><abbr title="Database/Driver/MysqlResult.php">MysqlResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">56</span>
<a href="classes/DataTables-Database-Driver-MysqlResult.html#source-view.56" class="phpdocumentor-element-found-in__source" data-line="56" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get the next row in a result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetch</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetchAll">
fetchAll()
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method_fetchAll" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/MysqlResult.php"><a href="files/database-driver-mysqlresult.html"><abbr title="Database/Driver/MysqlResult.php">MysqlResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">62</span>
<a href="classes/DataTables-Database-Driver-MysqlResult.html#source-view.62" class="phpdocumentor-element-found-in__source" data-line="62" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get all rows in the result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetchAll</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_insertId">
insertId()
<a href="classes/DataTables-Database-Driver-MysqlResult.html#method_insertId" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/MysqlResult.php"><a href="files/database-driver-mysqlresult.html"><abbr title="Database/Driver/MysqlResult.php">MysqlResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">68</span>
<a href="classes/DataTables-Database-Driver-MysqlResult.html#source-view.68" class="phpdocumentor-element-found-in__source" data-line="68" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">After an INSERT query, get the ID that was inserted.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">insertId</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Database/Driver/MysqlResult.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Database-Driver-MysqlResult.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,523 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database.html">Database</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database-driver.html">Driver</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
OracleResult
<span class="phpdocumentor-element__extends">
extends <a href="classes/DataTables-Database-Result.html"><abbr title="\DataTables\Database\Result">Result</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/OracleResult.php"><a href="files/database-driver-oracleresult.html"><abbr title="Database/Driver/OracleResult.php">OracleResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">22</span>
<a href="classes/DataTables-Database-Driver-OracleResult.html#source-view.22" class="phpdocumentor-element-found-in__source" data-line="22" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">MySQL driver for DataTables Database Result class</p>
<section class="phpdocumentor-description"><p>@internal</p>
</section>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-OracleResult.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-OracleResult.html#method_count">count()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Count the number of rows in the result set.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-OracleResult.html#method_fetch">fetch()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get the next row in a result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-OracleResult.html#method_fetchAll">fetchAll()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get all rows in the result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-OracleResult.html#method_insertId">insertId()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>After an INSERT query, get the ID that was inserted.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Database-Driver-OracleResult.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/DataTables-Database-Driver-OracleResult.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/OracleResult.php"><a href="files/database-driver-oracleresult.html"><abbr title="Database/Driver/OracleResult.php">OracleResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">27</span>
<a href="classes/DataTables-Database-Driver-OracleResult.html#source-view.27" class="phpdocumentor-element-found-in__source" data-line="27" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$dbh</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$stmt</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$pkey_val</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"></section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$dbh</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$stmt</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$pkey_val</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_count">
count()
<a href="classes/DataTables-Database-Driver-OracleResult.html#method_count" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/OracleResult.php"><a href="files/database-driver-oracleresult.html"><abbr title="Database/Driver/OracleResult.php">OracleResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">51</span>
<a href="classes/DataTables-Database-Driver-OracleResult.html#source-view.51" class="phpdocumentor-element-found-in__source" data-line="51" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Count the number of rows in the result set.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">count</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetch">
fetch()
<a href="classes/DataTables-Database-Driver-OracleResult.html#method_fetch" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/OracleResult.php"><a href="files/database-driver-oracleresult.html"><abbr title="Database/Driver/OracleResult.php">OracleResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">57</span>
<a href="classes/DataTables-Database-Driver-OracleResult.html#source-view.57" class="phpdocumentor-element-found-in__source" data-line="57" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get the next row in a result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetch</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetchAll">
fetchAll()
<a href="classes/DataTables-Database-Driver-OracleResult.html#method_fetchAll" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/OracleResult.php"><a href="files/database-driver-oracleresult.html"><abbr title="Database/Driver/OracleResult.php">OracleResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">63</span>
<a href="classes/DataTables-Database-Driver-OracleResult.html#source-view.63" class="phpdocumentor-element-found-in__source" data-line="63" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get all rows in the result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetchAll</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_insertId">
insertId()
<a href="classes/DataTables-Database-Driver-OracleResult.html#method_insertId" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/OracleResult.php"><a href="files/database-driver-oracleresult.html"><abbr title="Database/Driver/OracleResult.php">OracleResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">77</span>
<a href="classes/DataTables-Database-Driver-OracleResult.html#source-view.77" class="phpdocumentor-element-found-in__source" data-line="77" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">After an INSERT query, get the ID that was inserted.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">insertId</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Database/Driver/OracleResult.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Database-Driver-OracleResult.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,515 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database.html">Database</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database-driver.html">Driver</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
PostgresResult
<span class="phpdocumentor-element__extends">
extends <a href="classes/DataTables-Database-Result.html"><abbr title="\DataTables\Database\Result">Result</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/PostgresResult.php"><a href="files/database-driver-postgresresult.html"><abbr title="Database/Driver/PostgresResult.php">PostgresResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">24</span>
<a href="classes/DataTables-Database-Driver-PostgresResult.html#source-view.24" class="phpdocumentor-element-found-in__source" data-line="24" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Postgres driver for DataTables Database Result class</p>
<section class="phpdocumentor-description"><p>@internal</p>
</section>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method_count">count()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Count the number of rows in the result set.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method_fetch">fetch()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get the next row in a result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method_fetchAll">fetchAll()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get all rows in the result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method_insertId">insertId()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>After an INSERT query, get the ID that was inserted.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Database-Driver-PostgresResult.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/PostgresResult.php"><a href="files/database-driver-postgresresult.html"><abbr title="Database/Driver/PostgresResult.php">PostgresResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">29</span>
<a href="classes/DataTables-Database-Driver-PostgresResult.html#source-view.29" class="phpdocumentor-element-found-in__source" data-line="29" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$dbh</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$stmt</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"></section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$dbh</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$stmt</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_count">
count()
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method_count" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/PostgresResult.php"><a href="files/database-driver-postgresresult.html"><abbr title="Database/Driver/PostgresResult.php">PostgresResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">50</span>
<a href="classes/DataTables-Database-Driver-PostgresResult.html#source-view.50" class="phpdocumentor-element-found-in__source" data-line="50" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Count the number of rows in the result set.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">count</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetch">
fetch()
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method_fetch" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/PostgresResult.php"><a href="files/database-driver-postgresresult.html"><abbr title="Database/Driver/PostgresResult.php">PostgresResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">56</span>
<a href="classes/DataTables-Database-Driver-PostgresResult.html#source-view.56" class="phpdocumentor-element-found-in__source" data-line="56" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get the next row in a result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetch</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetchAll">
fetchAll()
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method_fetchAll" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/PostgresResult.php"><a href="files/database-driver-postgresresult.html"><abbr title="Database/Driver/PostgresResult.php">PostgresResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">62</span>
<a href="classes/DataTables-Database-Driver-PostgresResult.html#source-view.62" class="phpdocumentor-element-found-in__source" data-line="62" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get all rows in the result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetchAll</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_insertId">
insertId()
<a href="classes/DataTables-Database-Driver-PostgresResult.html#method_insertId" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/PostgresResult.php"><a href="files/database-driver-postgresresult.html"><abbr title="Database/Driver/PostgresResult.php">PostgresResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">68</span>
<a href="classes/DataTables-Database-Driver-PostgresResult.html#source-view.68" class="phpdocumentor-element-found-in__source" data-line="68" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">After an INSERT query, get the ID that was inserted.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">insertId</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Database/Driver/PostgresResult.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Database-Driver-PostgresResult.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,515 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database.html">Database</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database-driver.html">Driver</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
SqliteResult
<span class="phpdocumentor-element__extends">
extends <a href="classes/DataTables-Database-Result.html"><abbr title="\DataTables\Database\Result">Result</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqliteResult.php"><a href="files/database-driver-sqliteresult.html"><abbr title="Database/Driver/SqliteResult.php">SqliteResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">24</span>
<a href="classes/DataTables-Database-Driver-SqliteResult.html#source-view.24" class="phpdocumentor-element-found-in__source" data-line="24" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Sqlite driver for DataTables Database Result class</p>
<section class="phpdocumentor-description"><p>@internal</p>
</section>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method_count">count()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Count the number of rows in the result set.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method_fetch">fetch()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get the next row in a result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method_fetchAll">fetchAll()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get all rows in the result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method_insertId">insertId()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>After an INSERT query, get the ID that was inserted.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Database-Driver-SqliteResult.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqliteResult.php"><a href="files/database-driver-sqliteresult.html"><abbr title="Database/Driver/SqliteResult.php">SqliteResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">29</span>
<a href="classes/DataTables-Database-Driver-SqliteResult.html#source-view.29" class="phpdocumentor-element-found-in__source" data-line="29" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$dbh</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$stmt</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"></section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$dbh</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$stmt</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_count">
count()
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method_count" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqliteResult.php"><a href="files/database-driver-sqliteresult.html"><abbr title="Database/Driver/SqliteResult.php">SqliteResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">50</span>
<a href="classes/DataTables-Database-Driver-SqliteResult.html#source-view.50" class="phpdocumentor-element-found-in__source" data-line="50" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Count the number of rows in the result set.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">count</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetch">
fetch()
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method_fetch" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqliteResult.php"><a href="files/database-driver-sqliteresult.html"><abbr title="Database/Driver/SqliteResult.php">SqliteResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">56</span>
<a href="classes/DataTables-Database-Driver-SqliteResult.html#source-view.56" class="phpdocumentor-element-found-in__source" data-line="56" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get the next row in a result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetch</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetchAll">
fetchAll()
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method_fetchAll" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqliteResult.php"><a href="files/database-driver-sqliteresult.html"><abbr title="Database/Driver/SqliteResult.php">SqliteResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">62</span>
<a href="classes/DataTables-Database-Driver-SqliteResult.html#source-view.62" class="phpdocumentor-element-found-in__source" data-line="62" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get all rows in the result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetchAll</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_insertId">
insertId()
<a href="classes/DataTables-Database-Driver-SqliteResult.html#method_insertId" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqliteResult.php"><a href="files/database-driver-sqliteresult.html"><abbr title="Database/Driver/SqliteResult.php">SqliteResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">68</span>
<a href="classes/DataTables-Database-Driver-SqliteResult.html#source-view.68" class="phpdocumentor-element-found-in__source" data-line="68" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">After an INSERT query, get the ID that was inserted.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">insertId</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Database/Driver/SqliteResult.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Database-Driver-SqliteResult.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,515 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database.html">Database</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database-driver.html">Driver</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
SqlserverResult
<span class="phpdocumentor-element__extends">
extends <a href="classes/DataTables-Database-Result.html"><abbr title="\DataTables\Database\Result">Result</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqlserverResult.php"><a href="files/database-driver-sqlserverresult.html"><abbr title="Database/Driver/SqlserverResult.php">SqlserverResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">22</span>
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#source-view.22" class="phpdocumentor-element-found-in__source" data-line="22" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">SQL Server driver for DataTables Database Result class</p>
<section class="phpdocumentor-description"><p>@internal</p>
</section>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method_count">count()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Count the number of rows in the result set.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method_fetch">fetch()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get the next row in a result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method_fetchAll">fetchAll()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get all rows in the result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method_insertId">insertId()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>After an INSERT query, get the ID that was inserted.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqlserverResult.php"><a href="files/database-driver-sqlserverresult.html"><abbr title="Database/Driver/SqlserverResult.php">SqlserverResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">27</span>
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#source-view.27" class="phpdocumentor-element-found-in__source" data-line="27" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$dbh</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$stmt</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"></section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$dbh</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$stmt</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_count">
count()
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method_count" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqlserverResult.php"><a href="files/database-driver-sqlserverresult.html"><abbr title="Database/Driver/SqlserverResult.php">SqlserverResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">48</span>
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#source-view.48" class="phpdocumentor-element-found-in__source" data-line="48" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Count the number of rows in the result set.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">count</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetch">
fetch()
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method_fetch" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqlserverResult.php"><a href="files/database-driver-sqlserverresult.html"><abbr title="Database/Driver/SqlserverResult.php">SqlserverResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">54</span>
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#source-view.54" class="phpdocumentor-element-found-in__source" data-line="54" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get the next row in a result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetch</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_fetchAll">
fetchAll()
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method_fetchAll" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqlserverResult.php"><a href="files/database-driver-sqlserverresult.html"><abbr title="Database/Driver/SqlserverResult.php">SqlserverResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">60</span>
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#source-view.60" class="phpdocumentor-element-found-in__source" data-line="60" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get all rows in the result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">fetchAll</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_insertId">
insertId()
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#method_insertId" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Driver/SqlserverResult.php"><a href="files/database-driver-sqlserverresult.html"><abbr title="Database/Driver/SqlserverResult.php">SqlserverResult.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">66</span>
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#source-view.66" class="phpdocumentor-element-found-in__source" data-line="66" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">After an INSERT query, get the ID that was inserted.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">insertId</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Database/Driver/SqlserverResult.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Database-Driver-SqlserverResult.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,457 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-database.html">Database</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
Result
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Result.php"><a href="files/database-result.html"><abbr title="Database/Result.php">Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">33</span>
<a href="classes/DataTables-Database-Result.html#source-view.33" class="phpdocumentor-element-found-in__source" data-line="33" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Result object given by a {@see Query} performed on a database.</p>
<section class="phpdocumentor-description"><p>The typical pattern for using this class is to receive an instance of it as a
result of using the <abbr title="\DataTables\Database\Database">Database</abbr> and <a href="classes/DataTables-Database-Query.html"><abbr title="\DataTables\Database\Query">Query</abbr></a> class methods that
return a result. This class should not be initialised independently.</p>
<p>Note that this is a stub class that a driver will extend and complete as
required for individual database types. Individual drivers could add
additional methods, but this is discouraged to ensure that the API is the
same for all database types.</p>
</section>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Result.html#method_count">count()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Count the number of rows in the result set.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Result.html#method_fetch">fetch()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get the next row in a result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Result.html#method_fetchAll">fetchAll()</a>
<span>
&nbsp;: array&lt;string|int, mixed&gt; </span>
</dt>
<dd>Get all rows in the result set</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Database-Result.html#method_insertId">insertId()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>After an INSERT query, get the ID that was inserted.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Database-Result.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
-abstract "
>
<h4 class="phpdocumentor-element__name" id="method_count">
count()
<a href="classes/DataTables-Database-Result.html#method_count" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Result.php"><a href="files/database-result.html"><abbr title="Database/Result.php">Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">42</span>
<a href="classes/DataTables-Database-Result.html#source-view.42" class="phpdocumentor-element-found-in__source" data-line="42" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Count the number of rows in the result set.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__abstract">abstract</span> <span class="phpdocumentor-signature__name">count</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
-abstract "
>
<h4 class="phpdocumentor-element__name" id="method_fetch">
fetch()
<a href="classes/DataTables-Database-Result.html#method_fetch" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Result.php"><a href="files/database-result.html"><abbr title="Database/Result.php">Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">50</span>
<a href="classes/DataTables-Database-Result.html#source-view.50" class="phpdocumentor-element-found-in__source" data-line="50" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get the next row in a result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__abstract">abstract</span> <span class="phpdocumentor-signature__name">fetch</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
-abstract "
>
<h4 class="phpdocumentor-element__name" id="method_fetchAll">
fetchAll()
<a href="classes/DataTables-Database-Result.html#method_fetchAll" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Result.php"><a href="files/database-result.html"><abbr title="Database/Result.php">Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">58</span>
<a href="classes/DataTables-Database-Result.html#source-view.58" class="phpdocumentor-element-found-in__source" data-line="58" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get all rows in the result set</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__abstract">abstract</span> <span class="phpdocumentor-signature__name">fetchAll</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$fetchType</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span></code>
<section class="phpdocumentor-description"><p>@param int PDO row fetch style - PDO::FETCH_ASSOC is the default</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$fetchType</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">PDO::FETCH_ASSOC</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">array&lt;string|int, mixed&gt;</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
-abstract "
>
<h4 class="phpdocumentor-element__name" id="method_insertId">
insertId()
<a href="classes/DataTables-Database-Result.html#method_insertId" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Database/Result.php"><a href="files/database-result.html"><abbr title="Database/Result.php">Result.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">65</span>
<a href="classes/DataTables-Database-Result.html#source-view.65" class="phpdocumentor-element-found-in__source" data-line="65" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">After an INSERT query, get the ID that was inserted.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__abstract">abstract</span> <span class="phpdocumentor-signature__name">insertId</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>@return int</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Database/Result.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Database-Result.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,922 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-editor.html">Editor</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
ValidateOptions
<span class="phpdocumentor-element__extends">
extends <a href="classes/DataTables-Ext.html"><abbr title="\DataTables\Ext">Ext</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Editor/ValidateOptions.php"><a href="files/editor-validateoptions.html"><abbr title="Editor/ValidateOptions.php">ValidateOptions.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">21</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.21" class="phpdocumentor-element-found-in__source" data-line="21" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Common validation options that can be specified for all validation methods.</p>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Editor-ValidateOptions.html#method___construct">__construct()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Editor-ValidateOptions.html#method_allowEmpty">allowEmpty()</a>
<span>
&nbsp;: <a href="classes/DataTables-Editor-ValidateOptions.html"><abbr title="\DataTables\Editor\ValidateOptions">ValidateOptions</abbr></a>|bool </span>
</dt>
<dd>Get / set the field empty option</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Ext.html#method_inst">inst()</a>
<span>
&nbsp;: <a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a> </span>
</dt>
<dd>Static method to instantiate a new instance of a class (shorthand of
&#039;instantiate&#039;).</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Ext.html#method_instantiate">instantiate()</a>
<span>
&nbsp;: <a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a> </span>
</dt>
<dd>Static method to instantiate a new instance of a class.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Editor-ValidateOptions.html#method_message">message()</a>
<span>
&nbsp;: <a href="classes/DataTables-Editor-ValidateOptions.html"><abbr title="\DataTables\Editor\ValidateOptions">ValidateOptions</abbr></a>|string </span>
</dt>
<dd>Get / set the error message to use if validation fails</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Editor-ValidateOptions.html#method_optional">optional()</a>
<span>
&nbsp;: <a href="classes/DataTables-Editor-ValidateOptions.html"><abbr title="\DataTables\Editor\ValidateOptions">ValidateOptions</abbr></a>|bool </span>
</dt>
<dd>Get / set the field optional option</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a href="classes/DataTables-Ext.html#method__getSet">_getSet()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Common getter / setter function for DataTables classes.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a href="classes/DataTables-Ext.html#method__propExists">_propExists()</a>
<span>
&nbsp;: bool </span>
</dt>
<dd>Determine if a property is available in a data set (allowing `null` to be
a valid value)</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a href="classes/DataTables-Ext.html#method__readProp">_readProp()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Read a value from a data structure, using Javascript dotted object
notation. This is the inverse of the `_writeProp` method and provides
the same support, matching DataTables&#039; ability to read nested JSON
data objects.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a href="classes/DataTables-Ext.html#method__writeProp">_writeProp()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Write the field&#039;s value to an array structure, using Javascript dotted
object notation to indicate JSON data structure. For example `name.first`
gives the data structure: `name: { first: ... }`. This matches DataTables
own ability to do this on the client-side, although this doesn&#039;t
implement implement quite such a complex structure (no array / function
support).</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Editor-ValidateOptions.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method___construct">
__construct()
<a href="classes/DataTables-Editor-ValidateOptions.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Editor/ValidateOptions.php"><a href="files/editor-validateoptions.html"><abbr title="Editor/ValidateOptions.php">ValidateOptions.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">26</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.26" class="phpdocumentor-element-found-in__source" data-line="26" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">__construct</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$opts</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">null</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"></section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$opts</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">null</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_allowEmpty">
allowEmpty()
<a href="classes/DataTables-Editor-ValidateOptions.html#method_allowEmpty" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Editor/ValidateOptions.php"><a href="files/editor-validateoptions.html"><abbr title="Editor/ValidateOptions.php">ValidateOptions.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">64</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.64" class="phpdocumentor-element-found-in__source" data-line="64" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get / set the field empty option</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">allowEmpty</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">bool&nbsp;</span><span class="phpdocumentor-signature__argument__name">$empty</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">null</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor-ValidateOptions.html"><abbr title="\DataTables\Editor\ValidateOptions">ValidateOptions</abbr></a>|bool</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$empty</span>
: <span class="phpdocumentor-signature__argument__return-type">bool</span>
= <span class="phpdocumentor-signature__argument__default-value">null</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p><code class="prettyprint">false</code> if the field is not allowed to be
empty. <code class="prettyprint">true</code> if it can be.</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor-ValidateOptions.html"><abbr title="\DataTables\Editor\ValidateOptions">ValidateOptions</abbr></a>|bool</span>
&mdash;
<section class="phpdocumentor-description"><p>Self if setting, current value if getting.</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_inst">
inst()
<a href="classes/DataTables-Ext.html#method_inst" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">51</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.51" class="phpdocumentor-element-found-in__source" data-line="51" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Static method to instantiate a new instance of a class (shorthand of
&#039;instantiate&#039;).</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">inst</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a></span></code>
<section class="phpdocumentor-description"><p>This method performs exactly the same actions as the 'instantiate'
static method, but is simply shorter and easier to type!</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a></span>
&mdash;
<section class="phpdocumentor-description"><p>class
@static</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_instantiate">
instantiate()
<a href="classes/DataTables-Ext.html#method_instantiate" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">32</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.32" class="phpdocumentor-element-found-in__source" data-line="32" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Static method to instantiate a new instance of a class.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">instantiate</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a></span></code>
<section class="phpdocumentor-description"><p>A factory method that will create a new instance of the class
that has extended 'Ext'. This allows classes to be instantiated
and then chained - which otherwise isn't available until PHP 5.4.
If using PHP 5.4 or later, simply create a 'new' instance of the
target class and chain methods as normal.</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a></span>
&mdash;
<section class="phpdocumentor-description"><p>Instantiated class
@static</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_message">
message()
<a href="classes/DataTables-Editor-ValidateOptions.html#method_message" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Editor/ValidateOptions.php"><a href="files/editor-validateoptions.html"><abbr title="Editor/ValidateOptions.php">ValidateOptions.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">49</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.49" class="phpdocumentor-element-found-in__source" data-line="49" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get / set the error message to use if validation fails</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">message</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$msg</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">null</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor-ValidateOptions.html"><abbr title="\DataTables\Editor\ValidateOptions">ValidateOptions</abbr></a>|string</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$msg</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
= <span class="phpdocumentor-signature__argument__default-value">null</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Error message to use. If not given, the currently
set message will be returned.</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor-ValidateOptions.html"><abbr title="\DataTables\Editor\ValidateOptions">ValidateOptions</abbr></a>|string</span>
&mdash;
<section class="phpdocumentor-description"><p>Self if setting, message if getting.</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_optional">
optional()
<a href="classes/DataTables-Editor-ValidateOptions.html#method_optional" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Editor/ValidateOptions.php"><a href="files/editor-validateoptions.html"><abbr title="Editor/ValidateOptions.php">ValidateOptions.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">79</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.79" class="phpdocumentor-element-found-in__source" data-line="79" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Get / set the field optional option</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">optional</span><span>(</span><span class="phpdocumentor-signature__argument"><span>[</span><span class="phpdocumentor-signature__argument__return-type">bool&nbsp;</span><span class="phpdocumentor-signature__argument__name">$optional</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">null</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor-ValidateOptions.html"><abbr title="\DataTables\Editor\ValidateOptions">ValidateOptions</abbr></a>|bool</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$optional</span>
: <span class="phpdocumentor-signature__argument__return-type">bool</span>
= <span class="phpdocumentor-signature__argument__default-value">null</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p><code class="prettyprint">false</code> if the field does not need to be
submitted. <code class="prettyprint">true</code> if it must be.</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor-ValidateOptions.html"><abbr title="\DataTables\Editor\ValidateOptions">ValidateOptions</abbr></a>|bool</span>
&mdash;
<section class="phpdocumentor-description"><p>Self if setting, current value if getting.</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method__getSet">
_getSet()
<a href="classes/DataTables-Ext.html#method__getSet" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">75</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.75" class="phpdocumentor-element-found-in__source" data-line="75" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Common getter / setter function for DataTables classes.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">_getSet</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__reference-operator">&amp;</span><span class="phpdocumentor-signature__argument__name">$prop</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$val</span></span><span class="phpdocumentor-signature__argument"><span>[</span><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$array</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">false</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>This getter / setter method makes building getter / setting methods
easier, by abstracting everything to a single function call.</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$prop</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>The property to set
@param mixed $val The value to set - if given as null, then we assume
that the function is being used as a getter.
@param boolean $array Treat the target property as an array or not
(default false). If used as an array, then values passed in are added
to the $prop array.
@return self|mixed Class instance if setting (allowing chaining), or
the value requested if getting.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$val</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$array</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">false</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method__propExists">
_propExists()
<a href="classes/DataTables-Ext.html#method__propExists" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">105</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.105" class="phpdocumentor-element-found-in__source" data-line="105" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Determine if a property is available in a data set (allowing `null` to be
a valid value)</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">_propExists</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$name</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$data</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">bool</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$name</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Javascript dotted object name to write to</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$data</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Data source array to read from</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">private</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">bool</span>
&mdash;
<section class="phpdocumentor-description"><p>true if present, false otherwise</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method__readProp">
_readProp()
<a href="classes/DataTables-Ext.html#method__readProp" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">142</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.142" class="phpdocumentor-element-found-in__source" data-line="142" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Read a value from a data structure, using Javascript dotted object
notation. This is the inverse of the `_writeProp` method and provides
the same support, matching DataTables&#039; ability to read nested JSON
data objects.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">_readProp</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$name</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$data</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$name</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Javascript dotted object name to write to</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$data</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Data source array to read from</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">private</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
<section class="phpdocumentor-description"><p>The read value, or null if no value found.</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method__writeProp">
_writeProp()
<a href="classes/DataTables-Ext.html#method__writeProp" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">186</span>
<a href="classes/DataTables-Editor-ValidateOptions.html#source-view.186" class="phpdocumentor-element-found-in__source" data-line="186" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Write the field&#039;s value to an array structure, using Javascript dotted
object notation to indicate JSON data structure. For example `name.first`
gives the data structure: `name: { first: ... }`. This matches DataTables
own ability to do this on the client-side, although this doesn&#039;t
implement implement quite such a complex structure (no array / function
support).</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">_writeProp</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__reference-operator">&amp;</span><span class="phpdocumentor-signature__argument__name">$out</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$name</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$value</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$out</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Array to write the data to</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$name</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Javascript dotted object name to write to</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$value</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Value to write</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">throws</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link"><abbr title="\Exception">Exception</abbr></span>
<section class="phpdocumentor-description"><p>Information about duplicate properties</p>
</section>
</dd>
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">private</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Editor/ValidateOptions.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Editor-ValidateOptions.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,698 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
Ext
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">20</span>
<a href="classes/DataTables-Ext.html#source-view.20" class="phpdocumentor-element-found-in__source" data-line="20" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Base class for DataTables classes.</p>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Ext.html#method_inst">inst()</a>
<span>
&nbsp;: <a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a> </span>
</dt>
<dd>Static method to instantiate a new instance of a class (shorthand of
&#039;instantiate&#039;).</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-Ext.html#method_instantiate">instantiate()</a>
<span>
&nbsp;: <a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a> </span>
</dt>
<dd>Static method to instantiate a new instance of a class.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a href="classes/DataTables-Ext.html#method__getSet">_getSet()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Common getter / setter function for DataTables classes.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a href="classes/DataTables-Ext.html#method__propExists">_propExists()</a>
<span>
&nbsp;: bool </span>
</dt>
<dd>Determine if a property is available in a data set (allowing `null` to be
a valid value)</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a href="classes/DataTables-Ext.html#method__readProp">_readProp()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Read a value from a data structure, using Javascript dotted object
notation. This is the inverse of the `_writeProp` method and provides
the same support, matching DataTables&#039; ability to read nested JSON
data objects.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -protected">
<a href="classes/DataTables-Ext.html#method__writeProp">_writeProp()</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd>Write the field&#039;s value to an array structure, using Javascript dotted
object notation to indicate JSON data structure. For example `name.first`
gives the data structure: `name: { first: ... }`. This matches DataTables
own ability to do this on the client-side, although this doesn&#039;t
implement implement quite such a complex structure (no array / function
support).</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-Ext.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_inst">
inst()
<a href="classes/DataTables-Ext.html#method_inst" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">51</span>
<a href="classes/DataTables-Ext.html#source-view.51" class="phpdocumentor-element-found-in__source" data-line="51" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Static method to instantiate a new instance of a class (shorthand of
&#039;instantiate&#039;).</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">inst</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a></span></code>
<section class="phpdocumentor-description"><p>This method performs exactly the same actions as the 'instantiate'
static method, but is simply shorter and easier to type!</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a></span>
&mdash;
<section class="phpdocumentor-description"><p>class
@static</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_instantiate">
instantiate()
<a href="classes/DataTables-Ext.html#method_instantiate" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">32</span>
<a href="classes/DataTables-Ext.html#source-view.32" class="phpdocumentor-element-found-in__source" data-line="32" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Static method to instantiate a new instance of a class.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">instantiate</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a></span></code>
<section class="phpdocumentor-description"><p>A factory method that will create a new instance of the class
that has extended 'Ext'. This allows classes to be instantiated
and then chained - which otherwise isn't available until PHP 5.4.
If using PHP 5.4 or later, simply create a 'new' instance of the
target class and chain methods as normal.</p>
</section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type"><a href="classes/DataTables-Editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a>|<a href="classes/DataTables-Editor-Field.html"><abbr title="\DataTables\Editor\Field">Field</abbr></a>|<a href="classes/DataTables-Editor-Join.html"><abbr title="\DataTables\Editor\Join">Join</abbr></a>|<a href="classes/DataTables-Editor-Upload.html"><abbr title="\DataTables\Editor\Upload">Upload</abbr></a></span>
&mdash;
<section class="phpdocumentor-description"><p>Instantiated class
@static</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method__getSet">
_getSet()
<a href="classes/DataTables-Ext.html#method__getSet" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">75</span>
<a href="classes/DataTables-Ext.html#source-view.75" class="phpdocumentor-element-found-in__source" data-line="75" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Common getter / setter function for DataTables classes.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">_getSet</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__reference-operator">&amp;</span><span class="phpdocumentor-signature__argument__name">$prop</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$val</span></span><span class="phpdocumentor-signature__argument"><span>[</span><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$array</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">false</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<section class="phpdocumentor-description"><p>This getter / setter method makes building getter / setting methods
easier, by abstracting everything to a single function call.</p>
</section>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$prop</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>The property to set
@param mixed $val The value to set - if given as null, then we assume
that the function is being used as a getter.
@param boolean $array Treat the target property as an array or not
(default false). If used as an array, then values passed in are added
to the $prop array.
@return self|mixed Class instance if setting (allowing chaining), or
the value requested if getting.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$val</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$array</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
= <span class="phpdocumentor-signature__argument__default-value">false</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"></section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method__propExists">
_propExists()
<a href="classes/DataTables-Ext.html#method__propExists" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">105</span>
<a href="classes/DataTables-Ext.html#source-view.105" class="phpdocumentor-element-found-in__source" data-line="105" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Determine if a property is available in a data set (allowing `null` to be
a valid value)</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">_propExists</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$name</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$data</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">bool</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$name</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Javascript dotted object name to write to</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$data</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Data source array to read from</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">private</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">bool</span>
&mdash;
<section class="phpdocumentor-description"><p>true if present, false otherwise</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method__readProp">
_readProp()
<a href="classes/DataTables-Ext.html#method__readProp" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">142</span>
<a href="classes/DataTables-Ext.html#source-view.142" class="phpdocumentor-element-found-in__source" data-line="142" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Read a value from a data structure, using Javascript dotted object
notation. This is the inverse of the `_writeProp` method and provides
the same support, matching DataTables&#039; ability to read nested JSON
data objects.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">_readProp</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$name</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__name">$data</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$name</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Javascript dotted object name to write to</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$data</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Data source array to read from</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">private</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
<section class="phpdocumentor-description"><p>The read value, or null if no value found.</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-protected
"
>
<h4 class="phpdocumentor-element__name" id="method__writeProp">
_writeProp()
<a href="classes/DataTables-Ext.html#method__writeProp" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="Ext.php"><a href="files/ext.html"><abbr title="Ext.php">Ext.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">186</span>
<a href="classes/DataTables-Ext.html#source-view.186" class="phpdocumentor-element-found-in__source" data-line="186" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Write the field&#039;s value to an array structure, using Javascript dotted
object notation to indicate JSON data structure. For example `name.first`
gives the data structure: `name: { first: ... }`. This matches DataTables
own ability to do this on the client-side, although this doesn&#039;t
implement implement quite such a complex structure (no array / function
support).</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">protected</span>
<span class="phpdocumentor-signature__name">_writeProp</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;&nbsp;</span><span class="phpdocumentor-signature__argument__reference-operator">&amp;</span><span class="phpdocumentor-signature__argument__name">$out</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$name</span></span><span class="phpdocumentor-signature__argument"><span>, </span><span class="phpdocumentor-signature__argument__return-type">mixed&nbsp;</span><span class="phpdocumentor-signature__argument__name">$value</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$out</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Array to write the data to</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$name</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Javascript dotted object name to write to</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$value</span>
: <span class="phpdocumentor-signature__argument__return-type">mixed</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Value to write</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">throws</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link"><abbr title="\Exception">Exception</abbr></span>
<section class="phpdocumentor-description"><p>Information about duplicate properties</p>
</section>
</dd>
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">private</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">mixed</span>
&mdash;
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/Ext.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-Ext.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,516 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Editor PHP 2.1.3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.1.3</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -four phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/datatables.html" class="">DataTables</a>
</h4>
<ul class="phpdocumentor-list">
<li>
<a href="namespaces/datatables-database.html" class="">Database</a>
</li>
<li>
<a href="namespaces/datatables-editor.html" class="">Editor</a>
</li>
<li>
<a href="namespaces/datatables-htmlawed.html" class="">HtmLawed</a>
</li>
</ul>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -eight phpdocumentor-content">
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables.html">DataTables</a></li>
<li class="phpdocumentor-breadcrumb"><a href="namespaces/datatables-htmlawed.html">HtmLawed</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
Htmlaw
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="HtmLawed/Htmlaw.php"><a href="files/htmlawed-htmlaw.html"><abbr title="HtmLawed/Htmlaw.php">Htmlaw.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">37</span>
<a href="classes/DataTables-HtmLawed-Htmlaw.html#source-view.37" class="phpdocumentor-element-found-in__source" data-line="37" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">A class wrapper for the htmLawed library.</p>
<h3 id="toc">
Table of Contents
<a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -property -public">
<a href="classes/DataTables-HtmLawed-Htmlaw.html#property_defaultConfig">$defaultConfig</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -property -public">
<a href="classes/DataTables-HtmLawed-Htmlaw.html#property_defaultSpec">$defaultSpec</a>
<span>
&nbsp;: mixed </span>
</dt>
<dd></dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-HtmLawed-Htmlaw.html#method_filter">filter()</a>
<span>
&nbsp;: string </span>
</dt>
<dd>Filters a string of html with the htmLawed library.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/DataTables-HtmLawed-Htmlaw.html#method_filterRSS">filterRSS()</a>
<span>
&nbsp;: string </span>
</dt>
<dd>Filter a string of html so that it can be put into an rss feed.</dd>
</dl>
<section class="phpdocumentor-properties">
<h3 class="phpdocumentor-elements__header" id="properties">
Properties
<a href="classes/DataTables-HtmLawed-Htmlaw.html#properties" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="
phpdocumentor-element
-property
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="property_defaultConfig">
$defaultConfig
<a href="classes/DataTables-HtmLawed-Htmlaw.html#property_defaultConfig" class="headerlink"><i class="fas fa-link"></i></a>
<span class="phpdocumentor-element__modifiers">
</span>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="HtmLawed/Htmlaw.php"><a href="files/htmlawed-htmlaw.html"><abbr title="HtmLawed/Htmlaw.php">Htmlaw.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">40</span>
<a href="classes/DataTables-HtmLawed-Htmlaw.html#source-view.40" class="phpdocumentor-element-found-in__source" data-line="40" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__type">mixed</span>
<span class="phpdocumentor-signature__name">$defaultConfig</span>
= <span class="phpdocumentor-signature__default-value">array(
&#039;anti_link_spam&#039; =&gt; array(&#039;`.`&#039;, &#039;&#039;),
&#039;comment&#039; =&gt; 1,
&#039;cdata&#039; =&gt; 3,
&#039;css_expression&#039; =&gt; 1,
&#039;deny_attribute&#039; =&gt; &#039;on*&#039;,
&#039;unique_ids&#039; =&gt; 0,
&#039;elements&#039; =&gt; &#039;*-applet-form-input-textarea-iframe-script-style-embed-object&#039;,
&#039;keep_bad&#039; =&gt; 1,
&#039;schemes&#039; =&gt; &#039;classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https&#039;,
// clsid allowed in class
&#039;valid_xhtml&#039; =&gt; 0,
&#039;direct_list_nest&#039; =&gt; 1,
&#039;balance&#039; =&gt; 1,
)</span></code>
<section class="phpdocumentor-description"></section>
<section class="phpdocumentor-description"></section>
</article>
<article
class="
phpdocumentor-element
-property
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="property_defaultSpec">
$defaultSpec
<a href="classes/DataTables-HtmLawed-Htmlaw.html#property_defaultSpec" class="headerlink"><i class="fas fa-link"></i></a>
<span class="phpdocumentor-element__modifiers">
</span>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="HtmLawed/Htmlaw.php"><a href="files/htmlawed-htmlaw.html"><abbr title="HtmLawed/Htmlaw.php">Htmlaw.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">55</span>
<a href="classes/DataTables-HtmLawed-Htmlaw.html#source-view.55" class="phpdocumentor-element-found-in__source" data-line="55" data-modal="source-view"></a>
</aside>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__type">mixed</span>
<span class="phpdocumentor-signature__name">$defaultSpec</span>
= <span class="phpdocumentor-signature__default-value">array(&#039;object=-classid-type, -codebase&#039;, &#039;embed=type(oneof=application/x-shockwave-flash)&#039;)</span></code>
<section class="phpdocumentor-description"></section>
<section class="phpdocumentor-description"></section>
</article>
</section>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/DataTables-HtmLawed-Htmlaw.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_filter">
filter()
<a href="classes/DataTables-HtmLawed-Htmlaw.html#method_filter" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="HtmLawed/Htmlaw.php"><a href="files/htmlawed-htmlaw.html"><abbr title="HtmLawed/Htmlaw.php">Htmlaw.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">69</span>
<a href="classes/DataTables-HtmLawed-Htmlaw.html#source-view.69" class="phpdocumentor-element-found-in__source" data-line="69" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Filters a string of html with the htmLawed library.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">filter</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$html</span></span><span class="phpdocumentor-signature__argument"><span>[</span><span>, </span><span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;|null&nbsp;</span><span class="phpdocumentor-signature__argument__name">$config</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">null</span><span> ]</span></span><span class="phpdocumentor-signature__argument"><span>[</span><span>, </span><span class="phpdocumentor-signature__argument__return-type">string|array&lt;string|int, mixed&gt;|null&nbsp;</span><span class="phpdocumentor-signature__argument__name">$spec</span><span> = </span><span class="phpdocumentor-signature__argument__default-value">null</span><span> ]</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">string</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$html</span>
: <span class="phpdocumentor-signature__argument__return-type">string</span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>The text to filter.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$config</span>
: <span class="phpdocumentor-signature__argument__return-type">array&lt;string|int, mixed&gt;|null</span>
= <span class="phpdocumentor-signature__argument__default-value">null</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>Config settings for the array.</p>
</section>
</dd>
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$spec</span>
: <span class="phpdocumentor-signature__argument__return-type">string|array&lt;string|int, mixed&gt;|null</span>
= <span class="phpdocumentor-signature__argument__default-value">null</span> </dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>A specification to further limit the allowed attribute values in the html.</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">see</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link"><a href="http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm"><abbr title="http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm">http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm</abbr></a></span>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">string</span>
&mdash;
<section class="phpdocumentor-description"><p>Returns the filtered html.</p>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
-static "
>
<h4 class="phpdocumentor-element__name" id="method_filterRSS">
filterRSS()
<a href="classes/DataTables-HtmLawed-Htmlaw.html#method_filterRSS" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="HtmLawed/Htmlaw.php"><a href="files/htmlawed-htmlaw.html"><abbr title="HtmLawed/Htmlaw.php">Htmlaw.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">93</span>
<a href="classes/DataTables-HtmLawed-Htmlaw.html#source-view.93" class="phpdocumentor-element-found-in__source" data-line="93" data-modal="source-view"></a>
</aside>
<p class="phpdocumentor-summary">Filter a string of html so that it can be put into an rss feed.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__static">static</span> <span class="phpdocumentor-signature__name">filterRSS</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><a href=""><abbr title=""></abbr></a>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$html</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">string</span></code>
<h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
<dl class="phpdocumentor-argument-list">
<dt class="phpdocumentor-argument-list__entry">
<span class="phpdocumentor-signature__argument__name">$html</span>
: <span class="phpdocumentor-signature__argument__return-type"><a href=""><abbr title=""></abbr></a></span>
</dt>
<dd class="phpdocumentor-argument-list__definition">
<section class="phpdocumentor-description"><p>The html text to fitlter.</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">see</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<section class="phpdocumentor-description"><p>Htmlawed::filter().</p>
</section>
</dd>
</dl>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">string</span>
&mdash;
<section class="phpdocumentor-description"><p>Returns the filtered html.</p>
</section>
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/HtmLawed/Htmlaw.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">X</button>
</div>
</div>
<script type="text/javascript">
function loadExternalCodeSnippets(line) {
Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
var src = pre.getAttribute('data-src').replace( /\\/g, '/');
var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
var language = 'php';
var code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
}
else if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
}
else {
code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
}
}
};
xhr.send(null);
});
}
var modals = document.querySelectorAll("[data-modal]");
modals.forEach(function (trigger) {
trigger.addEventListener("click", function (event) {
//event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippets(trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
</script>
</article>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
</div>
<a href="classes/DataTables-HtmLawed-Htmlaw.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,427 @@
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox.
* Correct `block` display not defined for `main` in IE 11.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
/**
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
*/
audio,
canvas,
progress,
video {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
*/
[hidden],
template {
display: none;
}
/* Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* Text-level semantics
========================================================================== */
/**
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/**
* Address styling not present in Safari and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9/10.
*/
img {
border: 0;
}
/**
* Correct overflow not hidden in IE 9/10/11.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari.
*/
figure {
margin: 1em 40px;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Contain overflow in all browsers.
*/
pre {
overflow: auto;
}
/**
* Address odd `em`-unit font size rendering in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: var(--font-monospace);
font-size: 1em;
}
/* Forms
========================================================================== */
/**
* Known limitation: by default, Chrome and Safari on OS X allow very limited
* styling of `select`, unless a `border` property is set.
*/
/**
* 1. Correct color not being inherited.
* Known issue: affects color of disabled elements.
* 2. Correct font properties not being inherited.
* 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
*/
button,
input,
optgroup,
select,
textarea {
color: inherit; /* 1 */
font: inherit; /* 2 */
margin: 0; /* 3 */
}
/**
* Address `overflow` set to `hidden` in IE 8/9/10/11.
*/
button {
overflow: visible;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
* Correct `select` style inheritance in Firefox.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
input {
line-height: normal;
}
/**
* It's recommended that you don't attempt to style these elements.
* Firefox's implementation doesn't respect box-sizing, padding, or width.
*
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* Fix the cursor style for Chrome's increment/decrement buttons. For certain
* `font-size` values of the `input`, it causes the cursor style of the
* decrement button to change from `default` to `text`.
*/
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Address `appearance` set to `searchfield` in Safari and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/**
* Remove inner padding and search cancel button in Safari and Chrome on OS X.
* Safari (but not Chrome) clips the cancel button when the search input has
* padding (and `textfield` appearance).
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9/10/11.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* Remove default vertical scrollbar in IE 8/9/10/11.
*/
textarea {
overflow: auto;
}
/**
* Don't inherit the `font-weight` (applied by a rule above).
* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
*/
optgroup {
font-weight: bold;
}
/* Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}

View File

@ -0,0 +1,192 @@
.phpdocumentor-summary {
font-style: italic;
}
.phpdocumentor-description {
margin-bottom: var(--spacing-md);
}
.phpdocumentor-element {
position: relative;
}
.phpdocumentor .phpdocumentor-element__name {
line-height: 1;
}
.phpdocumentor-element__package,
.phpdocumentor-element__extends,
.phpdocumentor-element__implements {
display: block;
font-size: var(--text-xxs);
font-weight: normal;
opacity: .7;
}
.phpdocumentor-element__package .phpdocumentor-breadcrumbs {
display: inline;
}
.phpdocumentor-element:not(:last-child) {
border-bottom: 1px solid var(--primary-color-lighten);
padding-bottom: var(--spacing-lg);
}
.phpdocumentor-element.-deprecated .phpdocumentor-element__name {
text-decoration: line-through;
}
.phpdocumentor-element__modifier {
font-size: var(--text-xxs);
padding: calc(var(--spacing-base-size) / 4) calc(var(--spacing-base-size) / 2);
color: var(--text-color);
background-color: var(--light-gray);
border-radius: 3px;
text-transform: uppercase;
}
.phpdocumentor-signature {
display: inline-block;
font-size: var(--text-sm);
margin-bottom: var(--spacing-md);
}
.phpdocumentor-signature.-deprecated .phpdocumentor-signature__name {
text-decoration: line-through;
}
.phpdocumentor-table-of-contents {
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry {
padding-top: var(--spacing-xs);
margin-left: 2rem;
display: flex;
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > a {
flex: 0 1 auto;
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > span {
flex: 1;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry:after {
content: '';
height: 12px;
width: 12px;
left: 16px;
position: absolute;
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-private:after {
background: url('data:image/svg+xml;utf8,<svg width="8" height="10" viewBox="0 0 8 10" fill="none" xmlns="http://www.w3.org/2000/svg"><rect y="4" width="8" height="6" rx="1.4" fill="%23EE6749"/><path d="M2 4C2 3 2.4 1 4 1C5.6 1 6 3 6 4" stroke="%23EE6749" stroke-width="1.4"/></svg>') no-repeat;
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-protected:after {
left: 13px;
background: url('data:image/svg+xml;utf8,<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="3" y="3" width="8" height="6" rx="1.4" fill="%23EE9949"/><path d="M5 4C5 3 4.6 1 3 1C1.4 1 1 3 1 4" stroke="%23EE9949" stroke-width="1.4"/></svg>') no-repeat;
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry:before {
width: 1.25rem;
height: 1.25rem;
line-height: 1.25rem;
background: transparent url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="10" fill="%238DD35F"/></svg>') no-repeat center center;
content: '';
position: absolute;
left: 0;
border-radius: 50%;
font-weight: 600;
color: white;
text-align: center;
font-size: .75rem;
margin-top: .2rem;
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-method:before {
content: 'M';
background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="10" fill="%238DD35F"/></svg>');
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-function:before {
content: 'M';
background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="10" cy="10" r="10" fill="%238DD35F"/></svg>');
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-property:before {
content: 'P'
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-constant:before {
content: 'C';
background-color: transparent;
background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="-3.05176e-05" y="9.99998" width="14.1422" height="14.1422" transform="rotate(-45 -3.05176e-05 9.99998)" fill="%238DD35F"/></svg>');
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-class:before {
content: 'C'
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-interface:before {
content: 'I'
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-trait:before {
content: 'T'
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-namespace:before {
content: 'N'
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-package:before {
content: 'P'
}
.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-enum:before {
content: 'E'
}
.phpdocumentor-table-of-contents dd {
font-style: italic;
margin-left: 2rem;
}
.phpdocumentor-element-found-in {
position: absolute;
top: 0;
right: 0;
font-size: var(--text-sm);
color: gray;
}
.phpdocumentor-element-found-in .phpdocumentor-element-found-in__source {
flex: 0 1 auto;
display: inline-flex;
}
.phpdocumentor-element-found-in .phpdocumentor-element-found-in__source:after {
width: 1.25rem;
height: 1.25rem;
line-height: 1.25rem;
background: transparent url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="gray"><path d="M5.854 4.854a.5.5 0 1 0-.708-.708l-3.5 3.5a.5.5 0 0 0 0 .708l3.5 3.5a.5.5 0 0 0 .708-.708L2.707 8l3.147-3.146zm4.292 0a.5.5 0 0 1 .708-.708l3.5 3.5a.5.5 0 0 1 0 .708l-3.5 3.5a.5.5 0 0 1-.708-.708L13.293 8l-3.147-3.146z" stroke="gray" stroke-width="1.4"/></svg>') no-repeat center center;
content: '';
left: 0;
border-radius: 50%;
font-weight: 600;
text-align: center;
font-size: .75rem;
margin-top: .2rem;
}
.phpdocumentor-class-graph {
width: 100%; height: 600px; border:1px solid black; overflow: hidden
}
.phpdocumentor-class-graph__graph {
width: 100%;
}
.phpdocumentor-tag-list__definition {
display: flex;
}
.phpdocumentor-tag-link {
margin-right: var(--spacing-sm);
}

View File

@ -0,0 +1,54 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables;
if (!defined('DATATABLES')) exit();
//
// Configuration
// Load the database connection configuration options
//
if ( ! isset( $sql_details ) ) {
include( dirname(__FILE__).'/config.php' );
}
//
// Auto-loader
// Automatically loads DataTables classes - they are psr-4 compliant
//
spl_autoload_register( function ($class) {
$a = explode("\\", $class);
// Are we working in the DataTables namespace
if ( $a[0] !== "DataTables" ) {
return;
}
array_shift( $a );
$className = array_pop( $a );
$path = count( $a ) ?
implode('/', $a).'/' :
'';
require( dirname(__FILE__).'/'.$path.$className.'.php' );
} );
//
// Database connection
// Database connection is globally available
//
$db = new Database( $sql_details );

View File

@ -0,0 +1,34 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
define("DATATABLES", true);
//
// Error checking - check that we are PHP 5.3 or newer
//
if ( version_compare( PHP_VERSION, "5.3.0", '<' ) ) {
echo json_encode( array(
"sError" => "Editor PHP libraries required PHP 5.3 or newer. You are ".
"currently using ".PHP_VERSION.". PHP 5.3 and newer have a lot of ".
"great new features that the Editor libraries take advantage of to ".
"present an easy to use and flexible API."
) );
exit(0);
}
//
// Load the DataTables bootstrap core file and let it register the required
// handlers.
//
require( dirname(__FILE__).'/Bootstrap.php' );

View File

@ -0,0 +1,473 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables;
if (!defined('DATATABLES')) exit();
use
DataTables\Database\Query,
DataTables\Database\Result;
/**
* DataTables Database connection object.
*
* Create a database connection which may then have queries performed upon it.
*
* This is a database abstraction class that can be used on multiple different
* databases. As a result of this, it might not be suitable to perform complex
* queries through this interface or vendor specific queries, but everything
* required for basic database interaction is provided through the abstracted
* methods.
*/
class Database {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
/**
* Database instance constructor.
* @param string[] $opts Array of connection parameters for the database:
* ```php
* array(
* "user" => "", // User name
* "pass" => "", // Password
* "host" => "", // Host name
* "port" => "", // Port
* "db" => "", // Database name
* "type" => "" // Datable type: "Mysql", "Postgres" or "Sqlite"
* )
* ```
*/
function __construct( $opts )
{
$types = array( 'Mysql', 'Oracle', 'Postgres', 'Sqlite', 'Sqlserver', 'Db2', 'Firebird' );
if ( ! in_array( $opts['type'], $types ) ) {
throw new \Exception(
"Unknown database driver type. Must be one of ".implode(', ', $types),
1
);
}
$this->_type = $opts['type'];
$this->query_driver = "DataTables\\Database\\Driver\\".$opts['type'].'Query';
$this->_dbResource = isset( $opts['pdo'] ) ?
$opts['pdo'] :
call_user_func($this->query_driver.'::connect', $opts );
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
/** @var resource */
private $_dbResource = null;
/** @var callable */
private $_type = null;
private $_debugCallback = null;
private $query_driver = null;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
/**
* Determine if there is any data in the table that matches the query
* condition
*
* @param string|string[] $table Table name(s) to act upon.
* @param array $where Where condition for what to select - see {@see
* Query->where()}.
* @return boolean Boolean flag - true if there were rows
*/
public function any( $table, $where=null )
{
$res = $this->query( 'select' )
->table( $table )
->get( '*' )
->where( $where )
->limit(1)
->exec();
return $res->count() > 0;
}
/**
* Commit a database transaction.
*
* Use with {@see Database->transaction()} and {@see Database->rollback()}.
* @return self
*/
public function commit ()
{
call_user_func($this->query_driver.'::commit', $this->_dbResource );
return $this;
}
/**
* Get a count from a table.
* @param string|string[] $table Table name(s) to act upon.
* @param string $field Primary key field name
* @param array $where Where condition for what to select - see {@see
* Query->where()}.
* @return Number
*/
public function count ( $table, $field="id", $where=null )
{
$res = $this->query( 'count' )
->table( $table )
->get( $field )
->where( $where )
->exec();
$cnt = $res->fetch();
return $cnt['cnt'];
}
/**
* Get / set debug mode.
*
* @param boolean $_ Debug mode state. If not given, then used as a getter.
* @return boolean|self Debug mode state if no parameter is given, or
* self if used as a setter.
*/
public function debug ( $set=null )
{
if ( $set === null ) {
return $this->_debugCallback ? true : false;
}
else if ( $set === false ) {
$this->_debugCallback = null;
}
else {
$this->_debugCallback = $set;
}
return $this;
}
/**
* Perform a delete query on a table.
*
* This is a short cut method that creates an update query and then uses
* the query('delete'), table, where and exec methods of the query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $where Where condition for what to delete - see {@see
* Query->where()}.
* @return Result
*/
public function delete ( $table, $where=null )
{
return $this->query( 'delete' )
->table( $table )
->where( $where )
->exec();
}
/**
* Insert data into a table.
*
* This is a short cut method that creates an update query and then uses
* the query('insert'), table, set and exec methods of the query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $set Field names and values to set - see {@see
* Query->set()}.
* @param array $pkey Primary key column names (this is an array for
* forwards compt, although only the first item in the array is actually
* used). This doesn't need to be set, but it must be if you want to use
* the `Result->insertId()` method.
* @return Result
*/
public function insert ( $table, $set, $pkey='' )
{
return $this->query( 'insert' )
->pkey( $pkey )
->table( $table )
->set( $set )
->exec();
}
/**
* Update or Insert data. When doing an insert, the where condition is
* added as a set field
* @param string|string[] $table Table name(s) to act upon.
* @param array $set Field names and values to set - see {@see
* Query->set()}.
* @param array $where Where condition for what to update - see {@see
* Query->where()}.
* @param array $pkey Primary key column names (this is an array for
* forwards compt, although only the first item in the array is actually
* used). This doesn't need to be set, but it must be if you want to use
* the `Result->insertId()` method. Only used if an insert is performed.
* @return Result
*/
public function push ( $table, $set, $where=null, $pkey='' )
{
$selectColumn = '*';
if ( $pkey ) {
$selectColumn = is_array($pkey) ?
$pkey[0] :
$pkey;
}
// Update or insert
if ( $this->select( $table, $selectColumn, $where )->count() > 0 ) {
return $this->update( $table, $set, $where );
}
// Add the where condition to the values to set
foreach ($where as $key => $value) {
if ( ! isset( $set[ $key ] ) ) {
$set[ $key ] = $value;
}
}
return $this->insert( $table, $set, $pkey );
}
/**
* Create a query object to build a database query.
* @param string $type Query type - select, insert, update or delete.
* @param string|string[] $table Table name(s) to act upon.
* @return Query
*/
public function query ( $type, $table=null )
{
return new $this->query_driver( $this, $type, $table );
}
/**
* Quote a string for a quote. Note you should generally use a bind!
* @param string $val Value to quote
* @param string $type Value type
* @return string
*/
public function quote ( $val, $type=\PDO::PARAM_STR )
{
return $this->_dbResource->quote( $val, $type );
}
/**
* Create a `Query` object that will execute a custom SQL query. This is
* similar to the `sql` method, but in this case you must call the `exec()`
* method of the returned `Query` object manually. This can be useful if you
* wish to bind parameters using the query `bind` method to ensure data is
* properly escaped.
*
* @return Result
*
* @example
* Safely escape user input
* ```php
* $db
* ->raw()
* ->bind( ':date', $_POST['date'] )
* ->exec( 'SELECT * FROM staff where date < :date' );
* ```
*/
public function raw ()
{
return $this->query( 'raw' );
}
/**
* Get the database resource connector. This is typically a PDO object.
* @return resource PDO connection resource (driver dependent)
*/
public function resource ()
{
return $this->_dbResource;
}
/**
* Rollback the database state to the start of the transaction.
*
* Use with {@see Database->transaction()} and {@see Database->commit()}.
* @return self
*/
public function rollback ()
{
call_user_func($this->query_driver.'::rollback', $this->_dbResource );
return $this;
}
/**
* Select data from a table.
*
* This is a short cut method that creates an update query and then uses
* the query('select'), table, get, where and exec methods of the query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $field Fields to get from the table(s) - see {@see
* Query->get()}.
* @param array $where Where condition for what to select - see {@see
* Query->where()}.
* @param array $orderBy Order condition - see {@see
* Query->order()}.
* @return Result
*/
public function select ( $table, $field="*", $where=null, $orderBy=null )
{
return $this->query( 'select' )
->table( $table )
->get( $field )
->where( $where )
->order( $orderBy )
->exec();
}
/**
* Select distinct data from a table.
*
* This is a short cut method that creates an update query and then uses the
* query('select'), distinct ,table, get, where and exec methods of the
* query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $field Fields to get from the table(s) - see {@see
* Query->get()}.
* @param array $where Where condition for what to select - see {@see
* Query->where()}.
* @param array $orderBy Order condition - see {@see
* Query->order()}.
* @return Result
*/
public function selectDistinct ( $table, $field="*", $where=null, $orderBy=null )
{
return $this->query( 'select' )
->table( $table )
->distinct( true )
->get( $field )
->where( $where )
->order( $orderBy )
->exec();
}
/**
* Execute an raw SQL query - i.e. give the method your own SQL, rather
* than having the Database classes building it for you.
*
* This method will execute the given SQL immediately. Use the `raw()`
* method if you need the ability to add bound parameters.
* @param string $sql SQL string to execute (only if _type is 'raw').
* @return Result
*
* @example
* Basic select
* ```php
* $result = $db->sql( 'SELECT * FROM myTable;' );
* ```
*
* @example
* Set the character set of the connection
* ```php
* $db->sql("SET character_set_client=utf8");
* $db->sql("SET character_set_connection=utf8");
* $db->sql("SET character_set_results=utf8");
* ```
*/
public function sql ( $sql )
{
return $this->query( 'raw' )
->exec( $sql );
}
/**
* Start a new database transaction.
*
* Use with {@see Database->commit()} and {@see Database->rollback()}.
* @return self
*/
public function transaction ()
{
call_user_func($this->query_driver.'::transaction', $this->_dbResource );
return $this;
}
/**
* Get the database type (e.g. Postgres, Mysql, etc)
*/
public function type ()
{
return $this->_type;
}
/**
* Update data.
*
* This is a short cut method that creates an update query and then uses
* the query('update'), table, set, where and exec methods of the query.
* @param string|string[] $table Table name(s) to act upon.
* @param array $set Field names and values to set - see {@see
* Query->set()}.
* @param array $where Where condition for what to update - see {@see
* Query->where()}.
* @return Result
*/
public function update ( $table, $set=null, $where=null )
{
return $this->query( 'update' )
->table( $table )
->set( $set )
->where( $where )
->exec();
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Internal functions
*/
/**
* Get debug query information.
*
* @return array Information about the queries used. When this method is
* called it will reset the query cache.
* @internal
*/
public function debugInfo ( $query=null, $bindings=null )
{
$callback = $this->_debugCallback;
if ( $callback ) {
$callback( array(
"query" => $query,
"bindings" => $bindings
) );
}
return $this;
}
};

View File

@ -0,0 +1,161 @@
<?php
/**
* DB2 database driver for DataTables libraries.
* BETA! Feedback welcome
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use DataTables\Database\Query;
use DataTables\Database\Driver\Db2Result;
/**
* DB2 driver for DataTables Database Query class
* @internal
*/
class Db2Query extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_editor_pkey_value;
private $_sql;
protected $_identifier_limiter = null;
protected $_field_quote = '"';
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
}
// $connStr = 'DATABASE='.$db.';HOSTNAME='.$host;
// if ( $port ) {
// $connStr .= ';PORT='.$port;
// }
// $connStr .= ';UID='.$user.';PWD='.$pass.';AUTHENTICATION=server';
$connStr = $db;
$conn = db2_connect($connStr, $user, $pass);
if ( ! $conn ) {
// If we can't establish a DB connection then we returna DataTables
// error.
$e = 'Connection failed: '.db2_conn_error().' : '.db2_conn_errormsg();
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e
) );
exit(0);
}
return $conn;
}
public static function transaction ( $conn )
{
// no op
}
public static function commit ( $conn )
{
// no op
}
public static function rollback ( $conn )
{
// no op
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare($sql)
{
$this->_sql = $sql;
}
protected function _exec()
{
$resource = $this->database()->resource();
$bindings = $this->_bindings;
$paramSql = preg_replace('/(:[a-zA-Z\-_0-9]*)/', '?', $this->_sql);
//echo $paramSql."\n";
$this->_stmt = db2_prepare($resource, $paramSql);
$stmt = $this->_stmt;
//echo $this->_sql."\n";
preg_match_all('/(:[a-zA-Z\-_0-9]*)/', $this->_sql, $matches);
//print_r( $matches );
//print_r( $bindings);
//$allanTest = 65;
//db2_bind_param( $stmt, 1, 'allanTest', DB2_PARAM_IN );
for ( $i=0, $ien=count($matches[0]) ; $i<$ien ; $i++ ) {
for ( $j=0, $jen=count($bindings) ; $j<$jen ; $j++ ) {
if ( $bindings[$j]['name'] === $matches[0][$i] ) {
$name = str_replace(':', '', $matches[0][$i]);
$$name = $bindings[$j]['value'];
//$_GLOBALS[ $name ] = $bindings[$j]['value'];
//echo "bind $name as ".$$name."\n";
db2_bind_param( $stmt, $i+1, $name, DB2_PARAM_IN );
}
}
}
//print_r( get_defined_vars() );
$res = db2_execute($stmt);
if (! $res) {
throw new \Exception('DB2 SQL error = '.db2_stmt_error($this->_stmt));
return false;
}
$resource = $this->database()->resource();
return new Db2Result($resource, $this->_stmt, $this->_editor_pkey_value);
}
protected function _build_table()
{
$out = array();
for ($i = 0, $ien = count($this->_table); $i < $ien; $i ++) {
$t = $this->_table[$i];
if (strpos($t, ' as ')) {
$a = explode(' as ', $t);
$out[] = $a[0] . ' ' . $a[1];
} else {
$out[] = $t;
}
}
return ' ' . implode(', ', $out) . ' ';
}
}

View File

@ -0,0 +1,82 @@
<?php
/**
* SQL Server driver for DataTables PHP libraries
* BETA! Feedback welcome
*
* @author SpryMedia
* @copyright 2013 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* SQL Server driver for DataTables Database Result class
* @internal
*/
class Db2Result extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
private $_allRows = null;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
$all = $this->_fetchAll();
return count($all);
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return db2_fetch_assoc( $this->_stmt );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
$all = $this->_fetchAll();
return $all;
}
public function insertId ()
{
return db2_last_insert_id( $this->_dbh );
}
private function _fetchAll () {
$a = array();
while ( $row = db2_fetch_assoc( $this->_stmt ) ) {
$a[] = $row;
}
return $a;
}
}

View File

@ -0,0 +1,137 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\FirebirdResult;
/**
* Firebird driver for DataTables Database Query class
* @internal
*/
class FirebirdQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
protected $_identifier_limiter = ['"', '"'];
protected $_field_quote = '"';
protected $_supportsAsAlias = false;
public $_pkeyInsertedTo;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
if ( $host !== "" ) {
$host = "{$host}";
if ( $port !== "" ) {
$host .= "/{$port}";
}
$host .= ';';
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
$pdo = @new PDO(
"firebird:{$host}dbname={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
$pkey = $this->pkey();
// If insert, add the pkey column
if ( $this->_type === 'insert' && $pkey ) {
$this->_pkeyInsertedTo = (is_array($pkey) ? $pkey[0] : $pkey);
$sql .= ' RETURNING "'.$this->_pkeyInsertedTo.'"';
}
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
try {
$this->_stmt->execute();
}
catch (\PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
$resource = $this->database()->resource();
return new FirebirdResult( $resource, $this->_stmt, $this->_pkeyInsertedTo );
}
}

View File

@ -0,0 +1,77 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* Firebird driver for DataTables Database Result class
* @internal
*/
class FirebirdResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt, $pkey )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
$this->_pkey = $pkey;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
private $_pkey;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetch( $fetchType );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetchAll( $fetchType );
}
public function insertId ()
{
// Only useful after an insert of course...
$rows = $this->_stmt->fetchAll();
return $rows[0][$this->_pkey];
}
}

View File

@ -0,0 +1,121 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\MysqlResult;
/**
* MySQL driver for DataTables Database Query class
* @internal
*/
class MysqlQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$host = $opts['host'];
$db = $opts['db'];
$port = isset( $opts['port'] ) ? $opts['port'] : '';
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
if ( $port !== "" ) {
$port = "port={$port};";
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
$pdo = @new PDO(
"mysql:host={$host};{$port}dbname={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
// $start = hrtime(true);
try {
$this->_stmt->execute();
}
catch (\PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
// $this->database()->debugInfo( 'Execution complete - duration: '. (hrtime(true) - $start) . ' Time: '. microtime(true), [] );
$resource = $this->database()->resource();
return new MysqlResult( $resource, $this->_stmt );
}
}

View File

@ -0,0 +1,73 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* MySQL driver for DataTables Database Result class
* @internal
*/
class MysqlResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetch( $fetchType );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetchAll( $fetchType );
}
public function insertId ()
{
return $this->_dbh->lastInsertId();
}
}

View File

@ -0,0 +1,203 @@
<?php
/**
* Oracle database driver for DataTables libraries.
*
* Note that this software uses the oci_* methods in PHP and NOT the Oracle PDO
* driver, which is poorly supported.
*
* @author SpryMedia
* @copyright 2014 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\OracleResult;
/**
* Oracle driver for DataTables Database Query class
* @internal
*/
class OracleQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_editor_pkey_value;
protected $_identifier_limiter = array( '"', '"' );
protected $_field_quote = '"';
protected $_supportsAsAlias = false;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
}
if ( $port !== "" ) {
$port = ":{$port}";
}
if ( ! is_callable( 'oci_connect' ) ) {
echo json_encode( array(
"error" => "oci methods are not available in this PHP install to connect to Oracle"
) );
exit(0);
}
$conn = @oci_connect($user, $pass, $host.$port.'/'.$db, 'utf8');
if ( ! $conn ) {
// If we can't establish a DB connection then we return a DataTables
// error.
$e = oci_error();
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e['message']
) );
exit(0);
}
// Use ISO date and time styles
$stmt = oci_parse($conn, "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'" );
$res = oci_execute( $stmt );
$stmt = oci_parse($conn, "ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" );
$res = oci_execute( $stmt );
return $conn;
}
public static function transaction ( $conn )
{
// no op
}
public static function commit ( $conn )
{
oci_commit( $conn );
}
public static function rollback ( $conn )
{
oci_rollback( $conn );
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$resource = $this->database()->resource();
$pkey = $this->pkey();
// If insert, add the pkey column
if ( $this->_type === 'insert' && $pkey ) {
$sql .= ' RETURNING '.$this->_protect_identifiers(is_array($pkey) ? $pkey[0] : $pkey).' INTO :editor_pkey_value';
}
else if ( $this->_type === 'select' && $this->_oracle_offset !== null ) {
$sql = '
select * from (select rownum rnum, a.*
from ('.$sql.') a where rownum <= '.($this->_oracle_offset+$this->_oracle_limit).')
where rnum > '.$this->_oracle_offset;
}
$this->database()->debugInfo( $sql, $this->_bindings );
$this->_stmt = oci_parse( $resource, $sql );
// If insert, add a binding for the returned id
if ( $this->_type === 'insert' && $pkey ) {
oci_bind_by_name(
$this->_stmt,
':editor_pkey_value',
$this->_editor_pkey_value,
36
);
}
// Bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
oci_bind_by_name(
$this->_stmt,
$binding['name'],
$binding['value']
);
}
}
protected function _exec()
{
$res = @oci_execute( $this->_stmt, OCI_NO_AUTO_COMMIT );
if ( ! $res ) {
$e = oci_error( $this->_stmt );
throw new \Exception( "Oracle SQL error: ".$e['message'] );
return false;
}
$resource = $this->database()->resource();
return new OracleResult( $resource, $this->_stmt, $this->_editor_pkey_value );
}
protected function _build_table()
{
$out = array();
for ( $i=0, $ien=count($this->_table) ; $i<$ien ; $i++ ) {
$t = $this->_table[$i];
if ( strpos($t, ' as ') ) {
$a = explode( ' as ', $t );
$out[] = $this->_protect_identifiers($a[0]).' '.$this->_protect_identifiers($a[1]);
}
else {
$out[] = $t;
}
}
return ' '.implode(', ', $out).' ';
}
private $_oracle_offset = null;
private $_oracle_limit = null;
protected function _build_limit()
{
$this->_oracle_offset = $this->_offset;
$this->_oracle_limit = $this->_limit;
return ' ';
}
}

View File

@ -0,0 +1,82 @@
<?php
/**
* Oracle database driver for Editor
*
* @author SpryMedia
* @copyright 2014 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* MySQL driver for DataTables Database Result class
* @internal
*/
class OracleResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt, $pkey_val )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
$this->_pkey_val = $pkey_val;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt; // Result from oci_parse
private $_dbh; // Result from oci_connect
private $_rows = null;
private $_pkey_val;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ )
{
return oci_fetch_assoc( $this->_stmt );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ )
{
if ( ! $this->_rows ) {
$out = array();
oci_fetch_all( $this->_stmt, $out, 0, -1, OCI_FETCHSTATEMENT_BY_ROW + OCI_ASSOC );
$this->_rows = $out;
}
return $this->_rows;
}
public function insertId ()
{
return $this->_pkey_val;
}
}

View File

@ -0,0 +1,146 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\PostgresResult;
/**
* Postgres driver for DataTables Database Query class
* @internal
*/
class PostgresQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
protected $_identifier_limiter = array('"', '"');
protected $_field_quote = '"';
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
if ( $port !== "" ) {
$port = "port={$port};";
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
$pdo = @new PDO(
"pgsql:host={$host};{$port}dbname={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
// Add a RETURNING command to postgres insert queries so we can get the
// pkey value from the query reliably
if ( $this->_type === 'insert' ) {
$table = explode( ' as ', $this->_table[0] );
// Get the pkey field name
$pkRes = $resource->prepare(
"SELECT
pg_attribute.attname,
format_type(pg_attribute.atttypid, pg_attribute.atttypmod)
FROM pg_index, pg_class, pg_attribute
WHERE
pg_class.oid = '{$table[0]}'::regclass AND
indrelid = pg_class.oid AND
pg_attribute.attrelid = pg_class.oid AND
pg_attribute.attnum = any(pg_index.indkey)
AND indisprimary"
);
$pkRes->execute();
$row = $pkRes->fetch();
if ( $row && isset($row['attname'] ) ) {
$sql .= ' RETURNING '.$row['attname'].' as dt_pkey';
}
}
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
try {
$this->_stmt->execute();
}
catch (\PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
$resource = $this->database()->resource();
return new PostgresResult( $resource, $this->_stmt );
}
}

View File

@ -0,0 +1,75 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* Postgres driver for DataTables Database Result class
* @internal
*/
class PostgresResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetch( $fetchType );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetchAll( $fetchType );
}
public function insertId ()
{
// Only useful after an insert of course...
$rows = $this->_stmt->fetchAll();
return $rows[0]['dt_pkey'];
}
}

View File

@ -0,0 +1,112 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\SqliteResult;
/**
* SQLite3 driver for DataTables Database Query class
* @internal
*/
class SqliteQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
protected $_identifier_limiter = null;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
$pdo = @new PDO(
"sqlite:{$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
try {
$this->_stmt->execute();
}
catch (PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
$resource = $this->database()->resource();
return new SqliteResult( $resource, $this->_stmt );
}
}

View File

@ -0,0 +1,73 @@
<?php
/**
* DataTables PHP libraries.
*
* PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.
*
* @author SpryMedia
* @copyright 2012 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Result;
/**
* Sqlite driver for DataTables Database Result class
* @internal
*/
class SqliteResult extends Result {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Constructor
*/
function __construct( $dbh, $stmt )
{
$this->_dbh = $dbh;
$this->_stmt = $stmt;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
private $_dbh;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
public function count ()
{
return count($this->fetchAll());
}
public function fetch ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetch( $fetchType );
}
public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC )
{
return $this->_stmt->fetchAll( $fetchType );
}
public function insertId ()
{
return $this->_dbh->lastInsertId();
}
}

View File

@ -0,0 +1,153 @@
<?php
/**
* SQL Server driver for DataTables PHP libraries
*
* @author SpryMedia
* @copyright 2013 SpryMedia ( http://sprymedia.co.uk )
* @license http://editor.datatables.net/license DataTables Editor
* @link http://editor.datatables.net
*/
namespace DataTables\Database\Driver;
if (!defined('DATATABLES')) exit();
use PDO;
use DataTables\Database\Query;
use DataTables\Database\Driver\PostgresResult;
/**
* SQL Server driver for DataTables Database Query class
* @internal
*/
class SqlserverQuery extends Query {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Private properties
*/
private $_stmt;
protected $_identifier_limiter = array( '[', ']' );
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
*/
static function connect( $user, $pass='', $host='', $port='', $db='', $dsn='' )
{
if ( is_array( $user ) ) {
$opts = $user;
$user = $opts['user'];
$pass = $opts['pass'];
$port = $opts['port'];
$host = $opts['host'];
$db = $opts['db'];
$dsn = isset( $opts['dsn'] ) ? $opts['dsn'] : '';
$pdoAttr = isset( $opts['pdoAttr'] ) ? $opts['pdoAttr'] : array();
}
try {
$pdoAttr[ PDO::ATTR_ERRMODE ] = PDO::ERRMODE_EXCEPTION;
if ( in_array( 'sqlsrv', PDO::getAvailableDrivers() ) ) {
// Windows
if ( $port !== "" ) {
$port = ",{$port}";
}
$pdo = new PDO(
"sqlsrv:Server={$host}{$port};Database={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
}
else {
// Linux
if ( $port !== "" ) {
$port = ":{$port}";
}
$pdo = new PDO(
"dblib:host={$host}{$port};dbname={$db}".self::dsnPostfix( $dsn ),
$user,
$pass,
$pdoAttr
);
}
} catch (\PDOException $e) {
// If we can't establish a DB connection then we return a DataTables
// error.
echo json_encode( array(
"error" => "An error occurred while connecting to the database ".
"'{$db}'. The error reported by the server was: ".$e->getMessage()
) );
exit(0);
}
return $pdo;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Protected methods
*/
protected function _prepare( $sql )
{
$this->database()->debugInfo( $sql, $this->_bindings );
$resource = $this->database()->resource();
$this->_stmt = $resource->prepare( $sql );
// bind values
for ( $i=0 ; $i<count($this->_bindings) ; $i++ ) {
$binding = $this->_bindings[$i];
$this->_stmt->bindValue(
$binding['name'],
$binding['value'],
$binding['type'] ? $binding['type'] : \PDO::PARAM_STR
);
}
}
protected function _exec()
{
try {
$this->_stmt->execute();
}
catch (PDOException $e) {
throw new \Exception( "An SQL error occurred: ".$e->getMessage() );
error_log( "An SQL error occurred: ".$e->getMessage() );
return false;
}
$resource = $this->database()->resource();
return new SqlserverResult( $resource, $this->_stmt );
}
// SQL Server 2012+ only
protected function _build_limit()
{
$out = '';
if ( $this->_offset ) {
$out .= ' OFFSET '.$this->_offset.' ROWS';
}
if ( $this->_limit ) {
if ( ! $this->_offset ) {
$out .= ' OFFSET 0 ROWS';
}
$out .= ' FETCH NEXT '.$this->_limit. ' ROWS ONLY';
}
return $out;
}
}

Some files were not shown because too many files have changed in this diff Show More