Edición de «Cheat sheet beta1»
De KumbiaPHP Framework Wiki
Advertencia: no has iniciado sesión. Tu dirección IP se hará pública si haces cualquier edición. Si inicias sesión o creas una cuenta, tus ediciones se atribuirán a tu nombre de usuario, además de otros beneficios.
Puedes deshacer la edición. Antes de deshacer la edición, comprueba la siguiente comparación para verificar que realmente es lo que quieres hacer, y entonces guarda los cambios para así efectuar la reversión.
Revisión actual | Tu texto | ||
Línea 4: | Línea 4: | ||
Aqui definimos el orden del contenido para luego pasarlo a un PDF o PNG los colores y fuentes no importan, solo el que esten completos, buena sintaxis y en el orden adecuado | Aqui definimos el orden del contenido para luego pasarlo a un PDF o PNG los colores y fuentes no importan, solo el que esten completos, buena sintaxis y en el orden adecuado | ||
− | |||
+ | == Clases == | ||
− | |||
− | |||
− | |||
− | |||
Load::lib(string $nombre) | Load::lib(string $nombre) | ||
Load::model(string $nombre) | Load::model(string $nombre) | ||
Línea 25: | Línea 21: | ||
Session::isset_data(string $nombre) | Session::isset_data(string $nombre) | ||
+ | Upload::file_in_path(string $nombre, string $path, string $nuevo_nombre) | ||
+ | |||
+ | Upload::file(string $nombre, string $nuevo_nombre) | ||
+ | |||
+ | Upload::image(string $nombre, string $nuevo_nombre) | ||
− | |||
− | |||
− | |||
− | Filter | + | == Filter == |
− | Add_filter($filter) | + | |
− | Apply($var, [filters]) y apply_filter($var, [filters]) | + | Add_filter($filter) |
− | Get_instance() | + | |
+ | Apply($var, [filters]) y apply_filter($var, [filters]) | ||
+ | |||
+ | Get_instance() | ||
aqui faltan mas y en la wiki tambien; tambien tengo dudas si los de abajo estan en la beta1 | aqui faltan mas y en la wiki tambien; tambien tengo dudas si los de abajo estan en la beta1 | ||
+ | Filter::get(mixed $s, array $opciones) | ||
+ | |||
+ | Filter::get_array($array, array $opciones) | ||
+ | |||
+ | Filter::get_object($object, array $opciones) | ||
+ | |||
+ | |||
+ | === Filtros === | ||
+ | |||
+ | addslashes | ||
+ | |||
+ | alnum | ||
+ | |||
+ | alpha | ||
+ | |||
+ | date | ||
+ | |||
+ | digits | ||
+ | |||
+ | htmlentities | ||
+ | |||
+ | htmlspecialchars | ||
+ | |||
+ | int | ||
+ | |||
+ | ipv4 | ||
+ | |||
+ | lower | ||
+ | |||
+ | md5 | ||
+ | |||
+ | nl2br | ||
+ | |||
+ | numeric | ||
+ | |||
+ | stripslashes | ||
− | + | stripspace | |
− | |||
− | |||
− | + | striptags | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | striptags | ||
− | |||
− | |||
+ | trim | ||
+ | |||
+ | upper | ||
+ | |||
+ | |||
+ | |||
+ | == Paths == | ||
− | |||
APP | APP | ||
APP_PATH | APP_PATH | ||
Línea 73: | Línea 96: | ||
APP_CHARSET | APP_CHARSET | ||
URL_PATH | URL_PATH | ||
+ | APP_CHARSET | ||
− | + | == Helpers == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | form_tag(string $action | + | form_tag(string $action) |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | img_tag(string $src) | + | text_field_tag($nombre) |
− | swf_tag(string $src) | + | |
− | comillas($texto) | + | textarea_tag($nombre) |
+ | |||
+ | password_field_tag($nombre) | ||
+ | |||
+ | hidden_field_tag($name) | ||
+ | |||
+ | checkbox_field_tag($nombre) | ||
+ | |||
+ | radio_field_tag($nombre, $lista) | ||
+ | |||
+ | date_field_tag($nombre) | ||
+ | |||
+ | file_field_tag($nombre) | ||
+ | |||
+ | upload_image_tag($nombre) | ||
+ | |||
+ | select_tag($name, $lista) | ||
+ | |||
+ | button_tag($caption) | ||
+ | |||
+ | submit_image_tag($caption, $src) | ||
+ | |||
+ | submit_tag($caption) | ||
+ | |||
+ | end_form_tag() | ||
+ | |||
+ | |||
+ | img_tag(string $src) | ||
+ | |||
+ | swf_tag(string $src) | ||
+ | |||
+ | comillas($texto) | ||
render_partial(string $nombre) | render_partial(string $nombre) | ||
link_to(string $url, string $texto) | link_to(string $url, string $texto) | ||
+ | javascript_include_tag($archivo_js) | ||
− | + | javascript_library_tag($archivo_js) | |
− | javascript_library_tag($archivo_js | ||
− | |||
+ | stylesheet_link_tag($archivo_css, [use_variables: true]) | ||
+ | |||
+ | |||
+ | |||
+ | == Controller == | ||
+ | |||
+ | |||
+ | === Metodos === | ||
− | |||
− | |||
render(string $view) | render(string $view) | ||
post(array $valor) | post(array $valor) | ||
− | get(array $valor) | + | get(array $valor) |
− | request($valor) | + | |
− | route_to([params: valor]) | + | request($valor) |
− | redirect(string $controlador, integer $segundos) | + | |
− | cache_layout(integer $minutos) | + | route_to([params: valor]) |
− | not_found(string $controller, string $action) | + | |
− | set_response(string $tipo) | + | redirect(string $controlador, integer $segundos) |
− | is_alnum($valor) | + | |
− | load_record($registro) | + | cache_layout(integer $minutos) |
− | is_numeric($valor) | + | |
+ | not_found(string $controller, string $action) | ||
+ | |||
+ | set_response(string $tipo) | ||
+ | |||
+ | is_alnum($valor) | ||
+ | |||
+ | load_record($registro) | ||
+ | |||
+ | is_numeric($valor) | ||
+ | |||
has_post(string $nombre) //Verifica si existe una variable dentro del array $_POST | has_post(string $nombre) //Verifica si existe una variable dentro del array $_POST | ||
Línea 134: | Línea 183: | ||
has_request(string $nombre) //Verifica si existe una variable dentro del array $_REQUEST | has_request(string $nombre) //Verifica si existe una variable dentro del array $_REQUEST | ||
+ | set_persistent(string $nombre, $valor) //hace persistente valores para el controlador actual | ||
− | + | get_persistent(string $nombre) //Recupera el el valor persistente | |
− | get_persistent(string $nombre) //Recupera el | ||
− | |||
+ | destroy_persistent(string $nombre) //destruye el valor persistente | ||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | http://wiki.kumbiaphp.com/skins/common/images/button_headline.png | ||
+ | === Propiedades === | ||
− | Filtros | + | $action_name -> Nombre de la accion actual |
+ | $controller_name -> Nnmbre del controller actual | ||
+ | $template -> Nombre del template a usar | ||
+ | $debug -> Activacion del modo Debug | ||
+ | |||
+ | |||
+ | Filtros | ||
before_filter() | before_filter() | ||
after_filter() | after_filter() | ||
Línea 154: | Línea 206: | ||
− | Models | + | == Models == |
− | ACTIVE RECORD | + | ACTIVE RECORD |
+ | |||
+ | |||
+ | === Consultas === | ||
− | |||
distinct([string $atributo_entidad], [“conditions: …], [“order: …”], [“limit: …“], [“columns: …”]) | distinct([string $atributo_entidad], [“conditions: …], [“order: …”], [“limit: …“], [“columns: …”]) | ||
Línea 169: | Línea 223: | ||
find_by_*campo*(string $valor) | find_by_*campo*(string $valor) | ||
find_all_by_*campo*(string $valor) | find_all_by_*campo*(string $valor) | ||
− | + | sql (string $sql) | |
− | sql (string $sql) | ||
− | |||
-------------------------------------------------- | -------------------------------------------------- | ||
− | |||
count(string $condicion) | count(string $condicion) | ||
count_by_sql(string $sql) | count_by_sql(string $sql) | ||
sum(string $campo, [“conditions: …”]) | sum(string $campo, [“conditions: …”]) | ||
− | |||
-------------------------------------------------- | -------------------------------------------------- | ||
− | |||
average(string $campo, [“conditions: …”]) | average(string $campo, [“conditions: …”]) | ||
maximum(string $campo, [“conditions: …”]) | maximum(string $campo, [“conditions: …”]) | ||
minimum(string $campo, [“conditions: …”]) | minimum(string $campo, [“conditions: …”]) | ||
− | |||
-------------------------------------------------- | -------------------------------------------------- | ||
+ | create() | ||
+ | update() | ||
+ | update_all( [“conditions: …”]) | ||
+ | save() | ||
+ | create_from_request() | ||
+ | save_from_request() | ||
+ | delete(integer $id) | ||
+ | delete_all() | ||
− | + | === Validaciones === | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | validates_presence_of(string $campo) | |
+ | validates_length_of(string $campo, [“parametros: …”]) | ||
+ | validates_numericality_of(string $campo) | ||
+ | validates_email_in(string $campo) | ||
+ | validates_uniqueness_of(string $campo) | ||
+ | validates_date_in(string $campo) | ||
+ | validates_format_of(string $campo, string $expresion_regular) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | Parametros | + | === Parametros === |
− | |||
− | |||
− | |||
− | too_short - | + | maximum -> Valor maximo para insertar o actualizar |
+ | too_long -> mensaje de alerta para el exceso de maximun | ||
+ | minimum -> Valor minimo para insertar o actualizar | ||
+ | too_short -> mensaje de alerta para el exceso de minimum | ||
+ | in -> Rango del valor para insertar o actualizar | ||
− | |||
+ | == Callbacks == | ||
− | |||
− | before_create | + | before_create |
− | |||
− | before_save | + | after_create |
+ | before_save | ||
after_save | after_save | ||
− | + | before_update | |
− | + | after_update | |
− | before_update | + | before_delete |
− | after_update | + | after_delete |
− | |||
− | before_delete | ||
− | after_delete | ||
− | |||
before_validation | before_validation | ||
− | |||
after_validation | after_validation | ||
+ | before_validation_on_create | ||
+ | after_validation_on_create | ||
+ | before_validation_on_update | ||
+ | after_validation_on_update | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | == Convenciones == | ||
+ | id -> Nombre de llave primaria | ||
+ | tabla_id -> Nombre de llave foranea | ||
+ | campo_at -> Campo de tipo fecha fija | ||
+ | campo_in -> Campo de tipo fecha actualizable | ||
− | Asociaciones | + | == Asociaciones == |
− | belongs_to(string $relacion, [“parametros: …”]) | + | belongs_to(string $relacion, [“parametros: …”]) |
− | has_one(string $relacion, [“parametros: …”]) | + | has_one(string $relacion, [“parametros: …”]) |
− | has_many(string $relacion, [“parametros: …”]) | + | has_many(string $relacion, [“parametros: …”]) |
− | has_and_belongs_to_many(string $relacion, [“parametros: …”]) | + | has_and_belongs_to_many(string $relacion, [“parametros: …”]) |
− | |||
− | |||
− | |||
− | + | === Parametros === | |
− | through - | + | model ->Nombre del modelo |
+ | fk ->Nombre del campo foraneo | ||
+ | key -> Nombre del campo primario | ||
+ | through -> Nombre de la tabla relacional |