Added files to the project
This commit is contained in:
commit
b6c5d3594c
4 changed files with 3555 additions and 0 deletions
22
composer.json
Normal file
22
composer.json
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "phangoapp/phamodel",
|
||||||
|
"description": "A simple class for create models",
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.8@dev",
|
||||||
|
"phautils/utils": "dev-master"
|
||||||
|
},
|
||||||
|
"license": "GPL",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Antonio de la Rosa",
|
||||||
|
"email": "webmaster@web-t-sys.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minimum-stability": "dev-master",
|
||||||
|
"require": {},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhangoApp\\PhaRouter\\": "src"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
157
src/CoreFields/PhangoField.php
Normal file
157
src/CoreFields/PhangoField.php
Normal file
|
|
@ -0,0 +1,157 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Antonio de la Rosa <webmaster@web-t-sys.com>
|
||||||
|
* @file
|
||||||
|
* @package CoreFields
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PhangoField class is the base for make class used on Webmodel::components property.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PhangoApp\PhaModels\CoreFields;
|
||||||
|
|
||||||
|
class PhangoField {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property used for set this field how indexed in the database table.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $indexed=0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property used for set this field how unique value in the database table.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $unique=0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the model where this component or field live
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $name_model='';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the field or component.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $name_component='';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method used for internal searchs for format the values.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Required define if this field is required when insert or update a row of this model...
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $required=0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $quote_open is used if you need a more flexible sql sentence,
|
||||||
|
* @warning USE THIS FUNCTION IF YOU KNOW WHAT YOU ARE DOING
|
||||||
|
*/
|
||||||
|
public $quot_open='\'';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $quote_close is used if you need a more flexible sql sentence,
|
||||||
|
* @warning USE THIS PROPERTY IF YOU KNOW WHAT YOU ARE DOING
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $quot_close='\'';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $std_error contain error in field if exists...
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $std_error='';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Label is the name of field
|
||||||
|
*/
|
||||||
|
public $label="";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Value of field...
|
||||||
|
*/
|
||||||
|
public $value="";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form define the function for use in forms...
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $form="";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array for create initial parameters for form..
|
||||||
|
*/
|
||||||
|
|
||||||
|
public $parameters=array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method used for internal tasks related with searchs. You can overwrite this method in your PhangoField object if you need translate the value that the user want search to a real value into the database.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function search_field($value)
|
||||||
|
{
|
||||||
|
|
||||||
|
return form_text($value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method used for internal tasks related with foreignkeys. By default make nothing.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function set_relationships()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used for describe the new field in a sql language format.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function get_type_sql()
|
||||||
|
{
|
||||||
|
|
||||||
|
return 'VARCHAR('.$this->size.') NOT NULL';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used for return a default value for a form.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function get_parameters_default()
|
||||||
|
{
|
||||||
|
|
||||||
|
return array($this->name_component, '', '');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used for simple checking, used for WhereSql.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function simple_check($value)
|
||||||
|
{
|
||||||
|
|
||||||
|
return $this->check($value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
1975
src/CoreFields/PrimaryField.php
Normal file
1975
src/CoreFields/PrimaryField.php
Normal file
File diff suppressed because it is too large
Load diff
1401
src/Webmodel.php
Normal file
1401
src/Webmodel.php
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue