class Countries extends AuthPageExtendedController

Class Countries

Traits

Trait AjaxDataTable.

Constants

COOKIE_EXPIRATION_MIN

Minimum cookie time expiration.

MENU_DELIMITER

Symbol to split menu/submenu items.

Properties

string|null $username Contains the user's name or null from Controller
string $shortName Class short name. from Controller
Session $session To manage PHP Sessions. from Controller
TemplateRender $renderer Manage the renderer. from Controller
Request $request Request from client. from Controller
Response $response Response to client. from Controller
DebugTool $debugTool The debug tool used. from Controller
Logger $logger The logger. from Controller
protected Container|null $container Contains dependencies. from Controller
protected Translator $translator The translator manager. from Controller
private array $vars Array that contains the variables that will be passed to the template. from Controller
User $user The user logged. from AuthController
string|null $logkey User log key. from AuthController
private string $defaultRedirect Page to redirect. from AuthController
string $title Page title. from AuthPageController
string $icon Page icon. from AuthPageController
string $description Page description. from AuthPageController
array $menu Page menu place. from AuthPageController
bool $canAccess Can user access? from AuthPageController
bool $canCreate Can user create? from AuthPageController
bool $canRead Can user read? from AuthPageController
bool $canUpdate Can user update? from AuthPageController
bool $canDelete Can user delete? from AuthPageController
bool $canPrint Can user print? from AuthPageController
bool $canExport Can user export? from AuthPageController
bool $canSendMail Can user send mail? from AuthPageController
UserRole[] $roles The roles where user is assigned. from AuthPageController
string $url Contiene la url que se usarĂ¡ en el formulario. from AuthPageController
array $postData Contains all data received from $_POST. from AuthPageExtendedController
Table $model Main table model. from AuthPageExtendedController
string $tableName The table relate to the model. from AuthPageExtendedController
array $viewData The data view details for each data field. from AuthPageExtendedController
string $encType Type of encryption for form. from AuthPageExtendedController
array $tableData Data received or sended in post. from AuthPageExtendedController
string $code Code to table id. from AuthPageExtendedController
protected array $oldData Contains all data from table. from AuthPageExtendedController
protected array $fieldsStruct Contains the field structure. from AuthPageExtendedController
protected string|null $currentId Contains the primary key of register in use. from AuthPageExtendedController
protected string $status Can contain: listing, adding or editing. from AuthPageExtendedController

Methods

__construct()

Countries constructor.

Response
sendResponseTemplate(array $data = [])

Add new vars to render, render the template and send the Response.

from Controller
Response
sendResponse(string $reply, int $status = Response::HTTP_OK)

Send the Response with data received.

RedirectResponse
redirect(string $destiny = '')

Send a RedirectResponse to destiny receive.

from Controller
Response
runMethod(string $methodName)

No description

void
addToVar(string $name, mixed $value)

Add a new element to a value saved in the array that is passed to the template.

from Controller
string
addResource(string $resourceName, boolean $relative = true)

Check if the resource is in the application's resource folder (for example, in the css or js folders of the skin folder). It's a specific file.

from Controller
void
addCSS(string $file)

addCSS includes the CSS files to template.

from Controller
void
addJS(string $file)

addJS includes the JS files to template.

from Controller
array
getArrayPost()

Return body parameters $_POST values.

from Controller
array
getArrayGet()

Return query string parameters $_GET values.

from Controller
array
getArrayServer()

Return server and execution environment parameters from $_SERVER values.

from Controller
array
getArrayHeaders()

Return headers from $_SERVER header values.

from Controller
array
getArrayFiles()

Return uploaded files from $_FILES.

from Controller
array
getArrayCookies()

Return cookies from $_COOKIES.

from Controller
checkAuth()

Check that user is logged in.

bool
checkLoginWeb()

Check if user is logged-in from Login.

bool
checkLoginAPI()

Check if user is logged-in from API.

adjustCookieUser(int $time = 0, int $remember = 0)

Adjust auth cookie user.

RedirectResponse
logout()

Close the user session and go to the main page

void
setPageDetails()

Set the page details.

array
pageDetails()

Returns the page details.

Response
indexMethod()

The start point of the controller.

Response
createMethod()

Create new record.

Response
readMethod()

Read existing record.

Response
updateMethod()

Update existing record.

Response
deleteMethod()

Default delete method for delete an individual register.

loadPerms()

Load perms for this user.

bool
canAction(string $action)

Verify if this user can do an action.

array
getUserMenu()

Return a list of pages for generate user menu.

array
getPageDetails()

Returns the page details as array.

ajaxTableDataMethod()

Return the table data using AJAX

initialize()

Initialize common properties

searchData(array $data, int $recordsFiltered, array $requestData = [])

Realize the search to database table.

array
getDefaultColumnsSearch()

Return a default list of col.

fillActions($data)

Fill 'col-action' fields with action buttons.

array
getActionButtons(string $id = '')

Returns a list of actions buttons. By default returns Read/Update/Delete actions.

getTableHeader()

Returns the header for table.

getTableBody()

Returns the content for the body of table.

getListFields()

Returns a list of fields for the tablename.

getTableFooter()

Returns a footer list of fields for the table.

array
getExtraActions()

Returns a list of extra actions.

string
getStatus()

Returns the actual status of the controller.

Response
addMethod()

Create new record, used as alias

array
getRecordData()

Obtains an array of data from register $this->currentId.

Response
showMethod()

Read existing record, used as alias

Response
editMethod()

Update existing record, used as alias

RedirectResponse
cancel()

Cancels goes to main controller status.

save()

Save the data.

void
getDataPost()

Returns the data received from $_POST

Response
removeMethod()

Default delete method for delete an individual register, used as alias

accessDenied()

Access denied page.

Response
listData()

List all records on model.

array
setDefaults(array $record)

Se le pasa un registro con datos de la tabla actual, y cumplimenta los que falten con los datos por defecto.

Details

at line 22
__construct()

Countries constructor.

in Controller at line 135
Response sendResponseTemplate(array $data = [])

Add new vars to render, render the template and send the Response.

Parameters

array $data

Return Value

Response

in AjaxDataTableTrait at line 155
abstract Response sendResponse(string $reply, int $status = Response::HTTP_OK)

Send the Response with data received.

Parameters

string $reply
int $status

Return Value

Response

in Controller at line 163
RedirectResponse redirect(string $destiny = '')

Send a RedirectResponse to destiny receive.

Parameters

string $destiny

Return Value

RedirectResponse

in AuthPageController at line 212
Response runMethod(string $methodName)

Parameters

string $methodName

Return Value

Response

in Controller at line 195
void addToVar(string $name, mixed $value)

Add a new element to a value saved in the array that is passed to the template.

It is used when what we are saving is an array and we want to add a new element to that array. IMPORTANT: The element only is added if is not empty.

Parameters

string $name
mixed $value

Return Value

void

in Controller at line 216
string addResource(string $resourceName, boolean $relative = true)

Check if the resource is in the application's resource folder (for example, in the css or js folders of the skin folder). It's a specific file.

If it can not be found, check if it is in the templates folder (for example in the css or js folders of the templates folder). It's a common file.

If it is not in either of the two, no route is specified (it will surely give loading error).

Parameters

string $resourceName is the name of the file (with extension)
boolean $relative set to false for use an absolute path.

Return Value

string the complete path of resource.

in Controller at line 240
void addCSS(string $file)

addCSS includes the CSS files to template.

Parameters

string $file

Return Value

void

in Controller at line 252
void addJS(string $file)

addJS includes the JS files to template.

Parameters

string $file

Return Value

void

in Controller at line 262
array getArrayPost()

Return body parameters $_POST values.

Return Value

array

in Controller at line 272
array getArrayGet()

Return query string parameters $_GET values.

Return Value

array

in Controller at line 282
array getArrayServer()

Return server and execution environment parameters from $_SERVER values.

Return Value

array

in Controller at line 292
array getArrayHeaders()

Return headers from $_SERVER header values.

Return Value

array

in Controller at line 302
array getArrayFiles()

Return uploaded files from $_FILES.

Return Value

array

in Controller at line 312
array getArrayCookies()

Return cookies from $_COOKIES.

Return Value

array

in AuthController at line 67
checkAuth()

Check that user is logged in.

in AuthController at line 78
private bool checkLoginWeb()

Check if user is logged-in from Login.

Return Value

bool

in AuthController at line 104
private bool checkLoginAPI()

Check if user is logged-in from API.

Return Value

bool

in AuthController at line 127
private adjustCookieUser(int $time = 0, int $remember = 0)

Adjust auth cookie user.

Parameters

int $time
int $remember

in AuthController at line 147
RedirectResponse logout()

Close the user session and go to the main page

Return Value

RedirectResponse

in AuthPageController at line 142
protected void setPageDetails()

Set the page details.

Return Value

void

at line 32
array pageDetails()

Returns the page details.

Return Value

array

Response indexMethod()

The start point of the controller.

Return Value

Response

Response createMethod()

Create new record.

Return Value

Response

Response readMethod()

Read existing record.

Return Value

Response

Response updateMethod()

Update existing record.

Return Value

Response

Response deleteMethod()

Default delete method for delete an individual register.

Return Value

Response

in AuthPageController at line 276
private loadPerms()

Load perms for this user.

in AuthPageController at line 300
private bool canAction(string $action)

Verify if this user can do an action.

Parameters

string $action

Return Value

bool

in AuthPageController at line 337
array getUserMenu()

Return a list of pages for generate user menu.

Return Value

array

in AuthPageController at line 364
protected array getPageDetails()

Returns the page details as array.

Return Value

array

in AjaxDataTableTrait at line 25
ajaxTableDataMethod()

Return the table data using AJAX

in AjaxDataTableTrait at line 55
abstract initialize()

Initialize common properties

in AjaxDataTableTrait at line 64
private searchData(array $data, int $recordsFiltered, array $requestData = [])

Realize the search to database table.

Parameters

array $data
int $recordsFiltered
array $requestData

in AjaxDataTableTrait at line 99
array getDefaultColumnsSearch()

Return a default list of col.

Return Value

array

in AjaxDataTableTrait at line 116
private fillActions($data)

Fill 'col-action' fields with action buttons.

Parameters

$data

in AjaxDataTableTrait at line 145
abstract array getActionButtons(string $id = '')

Returns a list of actions buttons. By default returns Read/Update/Delete actions.

If some needs to be replace, replace it on final class.

Parameters

string $id

Return Value

array

in AjaxDataTableTrait at line 160
getTableHeader()

Returns the header for table.

in AjaxDataTableTrait at line 183
getTableBody()

Returns the content for the body of table.

in AjaxDataTableTrait at line 208
getListFields()

Returns a list of fields for the tablename.

in AjaxDataTableTrait at line 239
getTableFooter()

Returns a footer list of fields for the table.

array getExtraActions()

Returns a list of extra actions.

Return Value

array

string getStatus()

Returns the actual status of the controller.

Return Value

string

Response addMethod()

Create new record, used as alias

Return Value

Response

protected array getRecordData()

Obtains an array of data from register $this->currentId.

If register doesn't exists, returns an empty register with default data.

This method can do additional things in more complex situations.

Return Value

array

Response showMethod()

Read existing record, used as alias

Return Value

Response

Response editMethod()

Update existing record, used as alias

Return Value

Response

protected RedirectResponse cancel()

Cancels goes to main controller status.

Return Value

RedirectResponse

protected save()

Save the data.

This method can do additional things in more complex situations.

protected void getDataPost()

Returns the data received from $_POST

This method can do additional things in more complex situations.

Return Value

void

Response removeMethod()

Default delete method for delete an individual register, used as alias

Return Value

Response

accessDenied()

Access denied page.

Response listData()

List all records on model.

Return Value

Response

protected array setDefaults(array $record)

Se le pasa un registro con datos de la tabla actual, y cumplimenta los que falten con los datos por defecto.

Parameters

array $record

Return Value

array