From 25c36b4d956f338e37fc16aeb52b7e25dfed3af6 Mon Sep 17 00:00:00 2001
From: h4ckypurpl3
Date: Wed, 18 Apr 2018 13:47:47 -0500
Subject: [PATCH 1/8] =?UTF-8?q?arreglando=20un=20id=20que=20aparec=C3=ADa?=
=?UTF-8?q?=20como=20un=20div?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.php b/index.php
index e33e82b..afe1d08 100644
--- a/index.php
+++ b/index.php
@@ -1314,7 +1314,7 @@ echo $css_adicional;
-
+
From f806eff5896c4338bfad20ceb74a15a51c44cadd Mon Sep 17 00:00:00 2001
From: h4ckypurpl3
Date: Fri, 20 Apr 2018 23:23:07 -0500
Subject: [PATCH 2/8] css responsive cabecera
---
.DS_Store | Bin 8196 -> 8196 bytes
iconoclasta/.DS_Store | Bin 0 -> 6148 bytes
images/.DS_Store | Bin 0 -> 6148 bytes
index.php | 4 +-
librerias/.DS_Store | Bin 0 -> 10244 bytes
milfs/.DS_Store | Bin 0 -> 8196 bytes
milfs/css/style.css | 65 +++++++++++++++++++++++---
milfs/includes/datos.php | 6 +--
temas/.DS_Store | Bin 0 -> 6148 bytes
temas/landingpage/css/landingpage.css | 1 +
tupale/.DS_Store | Bin 0 -> 6148 bytes
11 files changed, 65 insertions(+), 11 deletions(-)
create mode 100644 iconoclasta/.DS_Store
create mode 100644 images/.DS_Store
create mode 100644 librerias/.DS_Store
create mode 100644 milfs/.DS_Store
create mode 100644 temas/.DS_Store
create mode 100644 tupale/.DS_Store
diff --git a/.DS_Store b/.DS_Store
index 005ce5543126bd5358822128086e7511b0340ccb..702bb8b3b84db590eefa4bd752eae174a80f93e8 100644
GIT binary patch
literal 8196
zcmeHMv2GJV6r8;{QBWF}2AV6W5GmVP`1?Lf|{9`0g>IhNu1JsbUa9>&UQIGn7OW8ex8KiP%Wb!9c_
zjMZoDGlA^H{&gOZYm5rd*vDAl6cH|WhAPjF8Db6(M>P=$F}yh~>#v?SI_
zC`x37y3Cts;QM=W`bf+7<HPx&Rr~`lKfawiK!y_i!T|H4GyL`_6m|dFWH4beFhv**xzFz-e$m^V`
XQd4+r9CC(D9|Tw%bWjKWssld(fqqE0K_h*UE^_24v02j5wP~i2%GVxL|44=_7Y{JQ9IJT$ZZ3!K;#gS?29xz_3|xHq@yMNMQ&(1#
z*4X0Y>X|?X?$N+LxyGpQmVJyh7L@BWn`RXu1|}C`sZ8|Gj5&QG4`ej@MX{f5{{Il&JXn^D>{6(ULh=
zbk}}+lgUbSojYCIbY)I$$EhCk^!a`2iJ}=DNwnce6peY!%ZK8}Hs2*vcSlkm-hBL=
zMzg$|+RSxFXO4NX{3N_vNCtqJmC+Et%!)4EVY(hun1Utlqs3l^n+a
diff --git a/iconoclasta/.DS_Store b/iconoclasta/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..56d18dbbe7dbb75e9952433601c40f588b4f93af
GIT binary patch
literal 6148
zcmeHKy-veG47NihTCr4OVZ4c%zQL&qBU4ufq=Y}IX)4j|c?34zjOXF=*+hgKVne91
zCEu6$>^tYXD2|DU*Im6LS`yJ5Dp)KqWJKmgCsLS2CONHfpnH1RKCU)ZJMnhIe`G+;
z?vx&=!^!RF%lS3?lx}hUI`wGUvaGv9Mf84qqbL1sji#-C@z_7fTk^R}kj)k;j~!L?
zOf9k*-X-&*%eTB&CZEh&nVd3SqrB)!@^WzooB?Ox*cd>~7MY(Z`sfTe1J1y}fP5bU
zR4^L$is{pVA+-R&8O%v=Exm-q1jA_9D`E!18Vb}?
zP&n<5^+R$ej*31y1J1yhffK!5O8vk7x&I#r`JFT13>*~$JS#Wl8jobPb@FghYXkHS
pDk6Tp;t+z1REps%rT7Ax1oj{oz-ZVj!UFLhfkcB3&cL5C@BzNyOGW?y
literal 0
HcmV?d00001
diff --git a/images/.DS_Store b/images/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..1e191642751ac726ecebd3bc3ee44a6335662383
GIT binary patch
literal 6148
zcmeHKJ!`{243(S&0$l=KI^JK%KRALrcFLL|U_%?IbAdLyxBkQamu`9bXt6Qr*ddib
zdOn@r*?xm%5fN|B?V4ysL`%3JeMp#^?2AvV^2{8_ddA!9^LpEq?lh^rmJsfO4%ASg
zBaQjh{nvQ6D|OwT-y5RO-BZyc2i&f-zwDk~22WOHB}WJaLV-{q6bJ?Wp#tdHV#_`-s6tM?QI7
zcI*v}PVB=6`<>Y*6xO@r{G{c?*)U=#5DJVHnAvhA{r?euW&R(NVigL60ym`q&+Bcy
z!7F)hoxGg%+63RjzYVooj-ag=sI3?aX~hqNx+K@w&yKyJ(vep>Fn$C?m#|RaFBG@{
D{9h
-
+
-
+
diff --git a/librerias/.DS_Store b/librerias/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..ac554ff97c2c1221798d28c0debbf9a2a4938a8d
GIT binary patch
literal 10244
zcmeHMO=}ZT6ur}rB#kXt(4wx=LPeB9yAoW55|@HdH;N0>q~A#=rW0FT
@>qVdf@t&wJ<0c^@-xLPXJWuen52A)*p?
zj%O!vP&Urjo}y^2oCrT@Y;QXRw>3Oao6ul
zD~-6_F$FGOdaa|{ajn+uB@Lo4_ix1ptJKwwnu}hf&F0}+yjM{(%eEeujmlv6%8UU_)Ck-Uj}~+
zC)TJzjqDQSy(WT;qz5>gGK5nHX-B(S^NuQ4Ap6B5leQ&G3Y*k
z-gT++6}vvjDVm&|HwFheg>RhJP5)|BT{7N%0Y)dQaEh$Q>SQHv9~ILicw>z91npC&
zeO&b(ez$2&sFW{UE0g!!5_!RI
z=kEe-(?jZky-SY;e{uPP;dk;XzsM{6PG0aAJE$IguZ63BlHsOjyiOnF6kaFiaSn2V
zkIeWjni-{zUc&c;L|pN?kC(xkK`7iF!c&kz2p#A9Ai)UOMZe^EPPY2U`(v3^_?@y!
z?{l((muGeEPhDL1BkZ^4mlPFCR;S+DJ#tl%9z%hz89Zx16LGZI?D_5nFJ
zm5%1}aEcbSKE)9gC-jx8tZx*3(tGBd-~N+PG^Aw|)-)q{=r;3&EjSPy2o9W<1NQDm
z6@IR`ng9R)X~_vZ!GYkwKX4!#tF6?QL7cu@_ayMU_6qg~*m+}I-$qje2Zr!@^Ew_s
z_;vi1^xPsx-jJ`Rv2UX(j`OBCqJ5kH_x}tyWctBcT|DhlSpRG93Y2Hu+%>)O)SHVH
P&%t5+Z~Nsbtp9%jY5_5>
literal 0
HcmV?d00001
diff --git a/milfs/.DS_Store b/milfs/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..9e1d06590bb8234a44ccc0f2ea3ad7d699c05060
GIT binary patch
literal 8196
zcmeHMyKWOf6uo0RVDmH*5~Y}slU&Np^_H)l#
zE6%LKI^+{Qo$Rh{j_TavmeDSP^{J>Cb`LJ5y12z~AszmL!(q#47r};f
zav_~uM0Rn9;ygO?3Lj3c4Aw?dz!b<8SjE&5ZBvC$-Pph1{CHP-r}bb^%@0RJpSCt?
zUo6R;*3~KA*$zlYbaMNjn%Rz(1
z_2F%>h#m#|*psb2dIZi5UN-c8!dlZ|1FLoKwe%`@Nv^WW#4B)HL&og^cMjYU^k)2>
z2L8&OZ+cY1<7fGUOKG(dKBq(pUMn-Mbq;){I2U#^M(^K#ZTb@~zt2IDpRiE<0{;WU
z<2)RDRVGlU$~d&&JkVkk9$6iQOBN&egojy+_8Uj0`|=Ao_<034&Sz(!pBMFe1esimx1i4wdnd}dzfX$EF?yd+n_
zOuPcO0;a%!tbpqbHV5liVBA}0OXaXsJjSB7zHZg@OkNB`)ozE5U`Ok+je>LE4S0tXz2@mma~DYgeAY
z1Ni>TSQ3&@S0eI1%)HFx{XZ`+kjVfr<83?wh5&kOf}K9QhLHQxYSHmCheTs*EV02o
zmdIC0jja=Z(E)jPeax}I3@P8-?){CX^DND+Xzla_UbwC|Z2lhF@JzJtTaHzdHpbn@5I|te`9t(%|)4|Rj0f=2r+u*gFB_t>C7Fs7@h22xS7-ge(qTe}+N%TVK-GZ*Hyq0Tf7yQiuO{h89Z(1Ul>??5O`|a%$?vVT
xhm*ZFV7q0L5MJSMm%cFo$@CCv4bVC3D
literal 0
HcmV?d00001
diff --git a/temas/landingpage/css/landingpage.css b/temas/landingpage/css/landingpage.css
index 0d307a8..40b4120 100644
--- a/temas/landingpage/css/landingpage.css
+++ b/temas/landingpage/css/landingpage.css
@@ -2,6 +2,7 @@ html,body {
height:100%;
background-size: cover;
padding-top:130px;
+ background-color: black !important;
}
body {
diff --git a/tupale/.DS_Store b/tupale/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..40ea4a56abf1e82ec2fbcf34638a45d930c2cb76
GIT binary patch
literal 6148
zcmeHK!D_=W43)OR3ccjGqko})5K4O7sn;C_32cLfgtfiZk5z)=DTZ>d8vP2^)jTzza?9`PzFMwKdjB=3u%j0_24l{}V;t=GHLUPHvDSGY{)DeFX6y=2oyp>
J1p~jpz&rnED;WR)
literal 0
HcmV?d00001
From 2ead080b03fff06650c1ff13c9709ea33c41a7ae Mon Sep 17 00:00:00 2001
From: kleper
Date: Mon, 2 Jul 2018 13:06:01 -0500
Subject: [PATCH 3/8] Actilizacion de milfs con los cambios de Galenux
---
milfs/LICENSE | 675 +
milfs/README.md | 76 +
milfs/addon/brigada/funciones/funciones.php | 2 +-
milfs/addon/brigada/grabar.php | 14 +-
milfs/addon/logis/funciones/funciones.php | 2 +-
milfs/addon/logis/grabar.php | 14 +-
milfs/api.php | 29 +-
milfs/copia de index.php | 196 +
milfs/copia de map.php | 118 +
milfs/copia de rt.php | 152 +
milfs/css/carousel.css | 2 +-
milfs/css/dragones.min.css | 11 +
milfs/css/estilos.php | 10 +-
milfs/css/style.css | 558 +-
milfs/funciones/.giosaveXCKCCY | 0
milfs/funciones/.goutputstream-05TT7X | 8047 ++++++++++++
milfs/funciones/experimentales.php | 16 +-
milfs/funciones/funciones.chupacabras.php | 9027 ++++++++++++++
milfs/funciones/funciones.filtros.php | 896 +-
milfs/funciones/funciones.php | 85 +-
milfs/funciones/funciones_20151115.php | 8396 +++++++++++++
milfs/funciones/funciones_20151117.php | 8278 +++++++++++++
milfs/funciones/funciones_20160319.php | 10189 ++++++++++++++++
milfs/funciones/funciones_back.php | 9399 ++++++++++++++
milfs/funciones/index.php | 594 +-
milfs/images/secure/index.php | 8 +-
milfs/includes/datos.php | 15 +-
milfs/includes/mysql | 16 +
milfs/includes/upload_generico.php | 61 -
milfs/index.php | 1 -
milfs/js/scripts.js | 31 +-
milfs/json.lab.php | 6 +-
milfs/json.php | 4 +-
milfs/kml.php | 10 +-
milfs/librerias/hybridauth/config.php | 2 +-
milfs/librerias/hybridauth/index.php | 7 +-
milfs/mapa.php | 67 +-
milfs/mapa_back.php | 62 +
milfs/mapero.php | 58 +
milfs/psi.php | 4 +-
.../Prueba_Formulario_1458164302_26967.csv | 4 +
41 files changed, 55774 insertions(+), 1368 deletions(-)
create mode 100644 milfs/LICENSE
create mode 100644 milfs/README.md
create mode 100644 milfs/copia de index.php
create mode 100644 milfs/copia de map.php
create mode 100644 milfs/copia de rt.php
create mode 100644 milfs/css/dragones.min.css
create mode 100644 milfs/funciones/.giosaveXCKCCY
create mode 100644 milfs/funciones/.goutputstream-05TT7X
create mode 100644 milfs/funciones/funciones.chupacabras.php
create mode 100644 milfs/funciones/funciones_20151115.php
create mode 100644 milfs/funciones/funciones_20151117.php
create mode 100644 milfs/funciones/funciones_20160319.php
create mode 100644 milfs/funciones/funciones_back.php
create mode 100644 milfs/mapa_back.php
create mode 100644 milfs/mapero.php
create mode 100644 milfs/tmp/Prueba_Formulario_1458164302_26967.csv
diff --git a/milfs/LICENSE b/milfs/LICENSE
new file mode 100644
index 0000000..6b156fe
--- /dev/null
+++ b/milfs/LICENSE
@@ -0,0 +1,675 @@
+GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ {one line to give the program's name and a brief idea of what it does.}
+ Copyright (C) {year} {name of author}
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ {project} Copyright (C) {year} {fullname}
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+ .
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
+
diff --git a/milfs/README.md b/milfs/README.md
new file mode 100644
index 0000000..3fec243
--- /dev/null
+++ b/milfs/README.md
@@ -0,0 +1,76 @@
+
+ __ __ ___ ___ _______ _______
+| |_| || | | | | || |
+| || | | | | ___|| _____|
+| || | | | | |___ | |_____
+| || | | |___ | ___||_____ |
+| ||_|| || | | || | _____| |
+|_| |_||___| |_______||___| |_______|
+
+
+
+**DEFINICION**
+
+MILFS es una aplicación web para en la captura de datos de forma ágil y su
+posterior proceso, a priori se puede ver como un sistema apra la creación
+de formularios pero su poder va mas allá, MILFS maneja los campos de los
+campos de los formularios de manera semántica lo que prermite su posterior
+interpretación, por ejemplo:
+
+
+Si necesitamos recabar datos en un evento creamos un formulario con los campos:
+1. Nombres
+1. Email
+1. Telefono
+
+Estos campos solo los creamos la si no existen, luego para cada evento creamos
+un nuevo formulario y usamos los campos existentes y gracias a esto en la base
+de datos se almacenará siempre la información de "Nombres" en un campo "Nombres"
+lo cual le propporciona semántica a la información.
+
+MILFS también cuenta con campos especiales como el de mapa el cual proporciona
+la posibilidad de georeferenciar los datos capturados y luego exibirlos como un
+mapa.
+
+Si deseas capturar mucha información y almacenarla de manera estructurada o quieres
+reemplazar cientos de hojas electronicas por un sistema de datos, MILF es lo
+que estabas buscando.
+
+MILFS también cuenta con un subsistema de importación que te permite subir datos
+almacenados en un archivo CSV.
+
+Sabemos que aun nos falta mucha documentación para enseñar a manejar todo el poder
+de MILFS, Pero bueno, gracias por la ayuda ;-)
+
+
+**INSTALACION**
+
+1. Volcar la base de datos MYSQL desde el archivo milfs.sql.gz
+1. Mover el directorio milfs a /var/www/html/milfs o un lugar accesible.
+1. Modificar el archivo milfs/includes/datos.php con los datos de acceso a la base de datos MySQL.
+1. Mover el directorio images_secure a un lugar no accesible via web /var/www/images_secure Dar permiso de escritura al www-data sobre images_secure y su contenido.
+1. Ingresar por http al aplicativo eje. http://localhost/milfs
+1. Loguearse con usuario admin clave admin
+1. Actualizar los datos de la instución en el área de configuración. Especialmente un email válido
+1. Salir de la aplicación
+1. Solicitar cambio de la contraseña.
+1. Revisar las instrucciones enviadas al email.
+1. La instalación básica de MILFS tiene algunos campos creados y un formulario de muestra llamado contacto.
+
+
+
+**DISFRUTALO.**
+
+
+ #====#
+ |___|__\___
+ | _ | |_ |}
+ "(_)"" ""(_)"
+
+
+Twitter: @fredy_rivera
+ @QWERTY.CO
+
+https://qwerty.co/milfs
+
+***
diff --git a/milfs/addon/brigada/funciones/funciones.php b/milfs/addon/brigada/funciones/funciones.php
index def5807..31efbb4 100644
--- a/milfs/addon/brigada/funciones/funciones.php
+++ b/milfs/addon/brigada/funciones/funciones.php
@@ -43,7 +43,7 @@ function brigadistas_grabar($formulario) {
if(is_array($valor)) {
foreach($valor as $c=>$v){
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
- ( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '".mysql_real_escape_string( $v )."')
+ ( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '".mysqli_real_escape_string($link, $v )."')
";
$sql=mysqli_query($consulta,$link);
diff --git a/milfs/addon/brigada/grabar.php b/milfs/addon/brigada/grabar.php
index 8e68500..64746ac 100644
--- a/milfs/addon/brigada/grabar.php
+++ b/milfs/addon/brigada/grabar.php
@@ -76,11 +76,11 @@ if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
$sql=mysqli_query($consulta,$link);
-if (@mysql_num_rows($sql)!=0){
-$resultado[] = mysql_result($sql,0,$por);
-$resultado[] = mysql_result($sql,0,'id');
+if (@mysqli_num_rows($sql)!=0){
+$resultado[] = mysqli_result($sql,0,$por);
+$resultado[] = mysqli_result($sql,0,'id');
$resultado[] = $consulta;
-$resultado[] = mysql_result($sql,0,"md5_$por");
+$resultado[] = mysqli_result($sql,0,"md5_$por");
}else{
$resultado[0] = '';
$resultado[1] ="";
@@ -134,9 +134,9 @@ $consulta ="SELECT form_campos.id, form_campos.campo_nombre FROM form_tipo_campo
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
- if (mysql_num_rows($sql)!='0'){
- $resultado[0]=mysql_result($sql,0,"id");
- $resultado[1]=mysql_result($sql,0,"campo_nombre");
+ if (mysqli_num_rows($sql)!='0'){
+ $resultado[0]=mysqli_result($sql,0,"id");
+ $resultado[1]=mysqli_result($sql,0,"campo_nombre");
$resultado[2] =$consulta;
}else{ $resultado[0]='';
$resultado[2] =$consulta;
diff --git a/milfs/addon/logis/funciones/funciones.php b/milfs/addon/logis/funciones/funciones.php
index 51d896c..672f1cd 100644
--- a/milfs/addon/logis/funciones/funciones.php
+++ b/milfs/addon/logis/funciones/funciones.php
@@ -43,7 +43,7 @@ function brigadistas_grabar($formulario) {
if(is_array($valor)) {
foreach($valor as $c=>$v){
$consulta = "INSERT INTO form_datos ( timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
- ( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '".mysql_real_escape_string( $v )."')
+ ( UNIX_TIMESTAMP(),'$_SESSION[id]','$id_empresa','$id_formulario','$ip' ,'$control', '$campo' , '".mysqli_real_escape_string($link, $v )."')
";
$sql=mysqli_query($consulta,$link);
diff --git a/milfs/addon/logis/grabar.php b/milfs/addon/logis/grabar.php
index 8e68500..64746ac 100644
--- a/milfs/addon/logis/grabar.php
+++ b/milfs/addon/logis/grabar.php
@@ -76,11 +76,11 @@ if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
$sql=mysqli_query($consulta,$link);
-if (@mysql_num_rows($sql)!=0){
-$resultado[] = mysql_result($sql,0,$por);
-$resultado[] = mysql_result($sql,0,'id');
+if (@mysqli_num_rows($sql)!=0){
+$resultado[] = mysqli_result($sql,0,$por);
+$resultado[] = mysqli_result($sql,0,'id');
$resultado[] = $consulta;
-$resultado[] = mysql_result($sql,0,"md5_$por");
+$resultado[] = mysqli_result($sql,0,"md5_$por");
}else{
$resultado[0] = '';
$resultado[1] ="";
@@ -134,9 +134,9 @@ $consulta ="SELECT form_campos.id, form_campos.campo_nombre FROM form_tipo_campo
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
- if (mysql_num_rows($sql)!='0'){
- $resultado[0]=mysql_result($sql,0,"id");
- $resultado[1]=mysql_result($sql,0,"campo_nombre");
+ if (mysqli_num_rows($sql)!='0'){
+ $resultado[0]=mysqli_result($sql,0,"id");
+ $resultado[1]=mysqli_result($sql,0,"campo_nombre");
$resultado[2] =$consulta;
}else{ $resultado[0]='';
$resultado[2] =$consulta;
diff --git a/milfs/api.php b/milfs/api.php
index e7e67cd..066d9e2 100644
--- a/milfs/api.php
+++ b/milfs/api.php
@@ -9,32 +9,15 @@ require ('funciones/convert.php');
require ("includes/markdown.php");
require ("funciones/conex.php");
$datos['id']=$_REQUEST['id'];
-if(isset($_REQUEST['identificador'])) {$datos['identificador']=$_REQUEST['identificador'];}
-if(isset($_REQUEST['dato'])) {$datos['dato']=$_REQUEST['dato'];}
-if(isset($_REQUEST['inicio'])) {$datos['inicio']=$_REQUEST['inicio'];}
-if(isset($_REQUEST['start'])) {$datos['start']=$_REQUEST['start'];}
-if(isset($_REQUEST['fin'])) {$datos['fin']=$_REQUEST['fin'];}
-if(isset($_REQUEST['end'])) {$datos['end']=$_REQUEST['end'];}
-if(isset($_REQUEST['tipo'])) {$datos['tipo']=$_REQUEST['tipo'];}
-if(isset($_REQUEST['formato'])) {$datos['formato']=$_REQUEST['formato'];}
-if(isset($_REQUEST['registros'])) {$datos['registros']=$_REQUEST['registros'];}
-if(isset($_REQUEST['pagina'])) {$datos['pagina']=$_REQUEST['pagina'];}
-if(isset($_REQUEST['plantilla'])) {$datos['plantilla']=$_REQUEST['plantilla'];}
-/*$datos['dato']=$_REQUEST['dato'];
+$datos['identificador']=$_REQUEST['identificador'];
+$datos['dato']=$_REQUEST['dato'];
$datos['inicio']=$_REQUEST['inicio'];
-$datos['start']=$_REQUEST['start'];
$datos['fin']=$_REQUEST['fin'];
-$datos['end']=$_REQUEST['end'];
-$datos['tipo']=$_REQUEST['tipo'];*/
-
-if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
-if(!isset($_REQUEST['formato'])) {
+$datos['tipo']=$_REQUEST['tipo'];
+if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');
+}
header('Content-Type: application/json');
-echo json($datos);
-}else{
-echo "".consultar_contenido_formulario("$datos[id]","$datos[registros]","$datos[pagina]","$datos[formato]",'',"$datos[plantilla]")."
";
-}
//echo "hola /// $_REQUEST[id] // " ;
-
+echo json($datos);
?>
diff --git a/milfs/copia de index.php b/milfs/copia de index.php
new file mode 100644
index 0000000..4a3f91e
--- /dev/null
+++ b/milfs/copia de index.php
@@ -0,0 +1,196 @@
+processRequests();
+//$xajax->debugOn();
+?>
+
+
+
+
+
+
+
+
+
+ printJavascript("xajax/"); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ I<3MILFS
+
+
+
+
+
+
+
+
+
+
+
+
+ xajax_formulario_modal('$_REQUEST[id]','','$_REQUEST[c]','$_REQUEST[t]')";}
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+";
+ echo "
";
+ */
+
+
+
+
+
+
+
+/*formulario_consultar('','');
+if($_REQUEST[id] !=''){$onload ="";}
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/milfs/copia de map.php b/milfs/copia de map.php
new file mode 100644
index 0000000..0a57cc4
--- /dev/null
+++ b/milfs/copia de map.php
@@ -0,0 +1,118 @@
+
+
+
+
+
+
MILFS
+
+
+
+
+
+
+
+
+
MILFS
+
+
+
+
+
+
+ printJavascript("xajax/"); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/milfs/copia de rt.php b/milfs/copia de rt.php
new file mode 100644
index 0000000..3ddb849
--- /dev/null
+++ b/milfs/copia de rt.php
@@ -0,0 +1,152 @@
+
+
+
+
+
+
MILFS
+
+
+
+
+
+
+
+
+
MILFS
+
+
+
+
+
+
+ printJavascript("xajax/"); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/milfs/css/carousel.css b/milfs/css/carousel.css
index 106fd13..3e02cca 100644
--- a/milfs/css/carousel.css
+++ b/milfs/css/carousel.css
@@ -15,7 +15,7 @@
/* Carousel base class */
.carousel {
- min-height: 800px;
+ height: 500px;
margin-bottom: 60px;
}
/* Since positioning the image, we need to help out the caption */
diff --git a/milfs/css/dragones.min.css b/milfs/css/dragones.min.css
new file mode 100644
index 0000000..3e55c1f
--- /dev/null
+++ b/milfs/css/dragones.min.css
@@ -0,0 +1,11 @@
+@import url("https://fonts.googleapis.com/css?family=News+Cycle:400,700");/*!
+ * bootswatch v3.3.6
+ * Homepage: http://bootswatch.com
+ * Copyright 2012-2016 Thomas Park
+ * Licensed under MIT
+ * Based on Bootstrap
+*//*!
+ * Bootstrap v3.3.6 (http://getbootstrap.com)
+ * Copyright 2011-2015 Twitter, Inc.
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
+ *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,*:before,*:after{background:transparent !important;color:#000 !important;-webkit-box-shadow:none !important;box-shadow:none !important;text-shadow:none !important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000 !important}.label{border:1px solid #000}.table{border-collapse:collapse !important}.table td,.table th{background-color:#fff !important}.table-bordered th,.table-bordered td{border:1px solid #ddd !important}}@font-face{font-family:'Glyphicons Halflings';src:url('../fonts/glyphicons-halflings-regular.eot');src:url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'),url('../fonts/glyphicons-halflings-regular.woff') format('woff'),url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-euro:before,.glyphicon-eur:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:Georgia,"Times New Roman",Times,serif;font-size:15px;line-height:1.42857143;color:#777777;background-color:#ffffff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#eb6864;text-decoration:none}a:hover,a:focus{color:#e22620;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{padding:4px;line-height:1.42857143;background-color:#ffffff;border:1px solid #dddddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;max-width:100%;height:auto}.img-circle{border-radius:50%}hr{margin-top:21px;margin-bottom:21px;border:0;border-top:1px solid #eeeeee}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role="button"]{cursor:pointer}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:"News Cycle","Arial Narrow Bold",sans-serif;font-weight:700;line-height:1.1;color:#000000}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:normal;line-height:1;color:#999999}h1,.h1,h2,.h2,h3,.h3{margin-top:21px;margin-bottom:10.5px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10.5px;margin-bottom:10.5px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:39px}h2,.h2{font-size:32px}h3,.h3{font-size:26px}h4,.h4{font-size:19px}h5,.h5{font-size:15px}h6,.h6{font-size:13px}p{margin:0 0 10.5px}.lead{margin-bottom:21px;font-size:17px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:22.5px}}small,.small{font-size:86%}mark,.mark{background-color:#fcf8e3;padding:.2em}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#999999}.text-primary{color:#eb6864}a.text-primary:hover,a.text-primary:focus{color:#e53c37}.text-success{color:#468847}a.text-success:hover,a.text-success:focus{color:#356635}.text-info{color:#3a87ad}a.text-info:hover,a.text-info:focus{color:#2d6987}.text-warning{color:#c09853}a.text-warning:hover,a.text-warning:focus{color:#a47e3c}.text-danger{color:#b94a48}a.text-danger:hover,a.text-danger:focus{color:#953b39}.bg-primary{color:#fff;background-color:#eb6864}a.bg-primary:hover,a.bg-primary:focus{background-color:#e53c37}.bg-success{background-color:#dff0d8}a.bg-success:hover,a.bg-success:focus{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover,a.bg-info:focus{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover,a.bg-warning:focus{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover,a.bg-danger:focus{background-color:#e4b9b9}.page-header{padding-bottom:9.5px;margin:42px 0 21px;border-bottom:1px solid #eeeeee}ul,ol{margin-top:0;margin-bottom:10.5px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none;margin-left:-5px}.list-inline>li{display:inline-block;padding-left:5px;padding-right:5px}dl{margin-top:0;margin-bottom:21px}dt,dd{line-height:1.42857143}dt{font-weight:bold}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999999}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10.5px 21px;margin:0 0 21px;font-size:18.75px;border-left:5px solid #eeeeee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#999999}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eeeeee;border-left:0;text-align:right}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}address{margin-bottom:21px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#ffffff;background-color:#333333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.25)}kbd kbd{padding:0;font-size:100%;font-weight:bold;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:10px;margin:0 0 10.5px;font-size:14px;line-height:1.42857143;word-break:break-all;word-wrap:break-word;color:#333333;background-color:#f5f5f5;border:1px solid #cccccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{margin-right:auto;margin-left:auto;padding-left:15px;padding-right:15px}.row{margin-left:-15px;margin-right:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-left:15px;padding-right:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0%}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0%}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0%}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0%}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#999999;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:21px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #dddddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #dddddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #dddddd}.table .table{background-color:#ffffff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #dddddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #dddddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*="col-"]{position:static;float:none;display:table-column}table td[class*="col-"],table th[class*="col-"]{position:static;float:none;display:table-cell}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}.table-responsive{overflow-x:auto;min-height:0.01%}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15.75px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #dddddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{padding:0;margin:0;border:0;min-width:0}legend{display:block;width:100%;padding:0;margin-bottom:21px;font-size:22.5px;line-height:inherit;color:#777777;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:bold}input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type="file"]{display:block}input[type="range"]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:9px;font-size:15px;line-height:1.42857143;color:#777777}.form-control{display:block;width:100%;height:39px;padding:8px 12px;font-size:15px;line-height:1.42857143;color:#777777;background-color:#ffffff;background-image:none;border:1px solid #cccccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.form-control::-moz-placeholder{color:#999999;opacity:1}.form-control:-ms-input-placeholder{color:#999999}.form-control::-webkit-input-placeholder{color:#999999}.form-control::-ms-expand{border:0;background-color:transparent}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eeeeee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type="search"]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type="date"].form-control,input[type="time"].form-control,input[type="datetime-local"].form-control,input[type="month"].form-control{line-height:39px}input[type="date"].input-sm,input[type="time"].input-sm,input[type="datetime-local"].input-sm,input[type="month"].input-sm,.input-group-sm input[type="date"],.input-group-sm input[type="time"],.input-group-sm input[type="datetime-local"],.input-group-sm input[type="month"]{line-height:31px}input[type="date"].input-lg,input[type="time"].input-lg,input[type="datetime-local"].input-lg,input[type="month"].input-lg,.input-group-lg input[type="date"],.input-group-lg input[type="time"],.input-group-lg input[type="datetime-local"],.input-group-lg input[type="month"]{line-height:56px}}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{min-height:21px;padding-left:20px;margin-bottom:0;font-weight:normal;cursor:pointer}.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{position:absolute;margin-left:-20px;margin-top:4px \9}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:normal;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"].disabled,input[type="checkbox"].disabled,fieldset[disabled] input[type="radio"],fieldset[disabled] input[type="checkbox"]{cursor:not-allowed}.radio-inline.disabled,.checkbox-inline.disabled,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,.checkbox.disabled label,fieldset[disabled] .radio label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:9px;padding-bottom:9px;margin-bottom:0;min-height:36px}.form-control-static.input-lg,.form-control-static.input-sm{padding-left:0;padding-right:0}.input-sm{height:31px;padding:5px 10px;font-size:13px;line-height:1.5;border-radius:3px}select.input-sm{height:31px;line-height:31px}textarea.input-sm,select[multiple].input-sm{height:auto}.form-group-sm .form-control{height:31px;padding:5px 10px;font-size:13px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:31px;line-height:31px}.form-group-sm textarea.form-control,.form-group-sm select[multiple].form-control{height:auto}.form-group-sm .form-control-static{height:31px;min-height:34px;padding:6px 10px;font-size:13px;line-height:1.5}.input-lg{height:56px;padding:14px 16px;font-size:19px;line-height:1.3333333;border-radius:6px}select.input-lg{height:56px;line-height:56px}textarea.input-lg,select[multiple].input-lg{height:auto}.form-group-lg .form-control{height:56px;padding:14px 16px;font-size:19px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:56px;line-height:56px}.form-group-lg textarea.form-control,.form-group-lg select[multiple].form-control{height:auto}.form-group-lg .form-control-static{height:56px;min-height:40px;padding:15px 16px;font-size:19px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:48.75px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:39px;height:39px;line-height:39px;text-align:center;pointer-events:none}.input-lg+.form-control-feedback,.input-group-lg+.form-control-feedback,.form-group-lg .form-control+.form-control-feedback{width:56px;height:56px;line-height:56px}.input-sm+.form-control-feedback,.input-group-sm+.form-control-feedback,.form-group-sm .form-control+.form-control-feedback{width:31px;height:31px;line-height:31px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline,.has-success.radio label,.has-success.checkbox label,.has-success.radio-inline label,.has-success.checkbox-inline label{color:#468847}.has-success .form-control{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-success .form-control:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.has-success .input-group-addon{color:#468847;border-color:#468847;background-color:#dff0d8}.has-success .form-control-feedback{color:#468847}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline,.has-warning.radio label,.has-warning.checkbox label,.has-warning.radio-inline label,.has-warning.checkbox-inline label{color:#c09853}.has-warning .form-control{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-warning .form-control:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.has-warning .input-group-addon{color:#c09853;border-color:#c09853;background-color:#fcf8e3}.has-warning .form-control-feedback{color:#c09853}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline,.has-error.radio label,.has-error.checkbox label,.has-error.radio-inline label,.has-error.checkbox-inline label{color:#b94a48}.has-error .form-control{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-error .form-control:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.has-error .input-group-addon{color:#b94a48;border-color:#b94a48;background-color:#f2dede}.has-error .form-control-feedback{color:#b94a48}.has-feedback label~.form-control-feedback{top:26px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#b7b7b7}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{margin-top:0;margin-bottom:0;padding-top:9px}.form-horizontal .radio,.form-horizontal .checkbox{min-height:30px}.form-horizontal .form-group{margin-left:-15px;margin-right:-15px}@media (min-width:768px){.form-horizontal .control-label{text-align:right;margin-bottom:0;padding-top:9px}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:15px;font-size:19px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:13px}}.btn{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:8px 12px;font-size:15px;line-height:1.42857143;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn:focus,.btn:active:focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn.active.focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus,.btn.focus{color:#ffffff;text-decoration:none}.btn:active,.btn.active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;opacity:0.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#ffffff;background-color:#999999;border-color:#999999}.btn-default:focus,.btn-default.focus{color:#ffffff;background-color:#808080;border-color:#595959}.btn-default:hover{color:#ffffff;background-color:#808080;border-color:#7a7a7a}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{color:#ffffff;background-color:#808080;border-color:#7a7a7a}.btn-default:active:hover,.btn-default.active:hover,.open>.dropdown-toggle.btn-default:hover,.btn-default:active:focus,.btn-default.active:focus,.open>.dropdown-toggle.btn-default:focus,.btn-default:active.focus,.btn-default.active.focus,.open>.dropdown-toggle.btn-default.focus{color:#ffffff;background-color:#6e6e6e;border-color:#595959}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled.focus,.btn-default[disabled].focus,fieldset[disabled] .btn-default.focus{background-color:#999999;border-color:#999999}.btn-default .badge{color:#999999;background-color:#ffffff}.btn-primary{color:#ffffff;background-color:#eb6864;border-color:#eb6864}.btn-primary:focus,.btn-primary.focus{color:#ffffff;background-color:#e53c37;border-color:#b81c18}.btn-primary:hover{color:#ffffff;background-color:#e53c37;border-color:#e4332e}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{color:#ffffff;background-color:#e53c37;border-color:#e4332e}.btn-primary:active:hover,.btn-primary.active:hover,.open>.dropdown-toggle.btn-primary:hover,.btn-primary:active:focus,.btn-primary.active:focus,.open>.dropdown-toggle.btn-primary:focus,.btn-primary:active.focus,.btn-primary.active.focus,.open>.dropdown-toggle.btn-primary.focus{color:#ffffff;background-color:#dc221c;border-color:#b81c18}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled.focus,.btn-primary[disabled].focus,fieldset[disabled] .btn-primary.focus{background-color:#eb6864;border-color:#eb6864}.btn-primary .badge{color:#eb6864;background-color:#ffffff}.btn-success{color:#ffffff;background-color:#22b24c;border-color:#22b24c}.btn-success:focus,.btn-success.focus{color:#ffffff;background-color:#1a873a;border-color:#0e471e}.btn-success:hover{color:#ffffff;background-color:#1a873a;border-color:#187f36}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{color:#ffffff;background-color:#1a873a;border-color:#187f36}.btn-success:active:hover,.btn-success.active:hover,.open>.dropdown-toggle.btn-success:hover,.btn-success:active:focus,.btn-success.active:focus,.open>.dropdown-toggle.btn-success:focus,.btn-success:active.focus,.btn-success.active.focus,.open>.dropdown-toggle.btn-success.focus{color:#ffffff;background-color:#14692d;border-color:#0e471e}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled.focus,.btn-success[disabled].focus,fieldset[disabled] .btn-success.focus{background-color:#22b24c;border-color:#22b24c}.btn-success .badge{color:#22b24c;background-color:#ffffff}.btn-info{color:#ffffff;background-color:#336699;border-color:#336699}.btn-info:focus,.btn-info.focus{color:#ffffff;background-color:#264c73;border-color:#132639}.btn-info:hover{color:#ffffff;background-color:#264c73;border-color:#24476b}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{color:#ffffff;background-color:#264c73;border-color:#24476b}.btn-info:active:hover,.btn-info.active:hover,.open>.dropdown-toggle.btn-info:hover,.btn-info:active:focus,.btn-info.active:focus,.open>.dropdown-toggle.btn-info:focus,.btn-info:active.focus,.btn-info.active.focus,.open>.dropdown-toggle.btn-info.focus{color:#ffffff;background-color:#1d3b58;border-color:#132639}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled.focus,.btn-info[disabled].focus,fieldset[disabled] .btn-info.focus{background-color:#336699;border-color:#336699}.btn-info .badge{color:#336699;background-color:#ffffff}.btn-warning{color:#ffffff;background-color:#f5e625;border-color:#f5e625}.btn-warning:focus,.btn-warning.focus{color:#ffffff;background-color:#ddce0a;border-color:#948a07}.btn-warning:hover{color:#ffffff;background-color:#ddce0a;border-color:#d3c50a}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{color:#ffffff;background-color:#ddce0a;border-color:#d3c50a}.btn-warning:active:hover,.btn-warning.active:hover,.open>.dropdown-toggle.btn-warning:hover,.btn-warning:active:focus,.btn-warning.active:focus,.open>.dropdown-toggle.btn-warning:focus,.btn-warning:active.focus,.btn-warning.active.focus,.open>.dropdown-toggle.btn-warning.focus{color:#ffffff;background-color:#bbae09;border-color:#948a07}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled.focus,.btn-warning[disabled].focus,fieldset[disabled] .btn-warning.focus{background-color:#f5e625;border-color:#f5e625}.btn-warning .badge{color:#f5e625;background-color:#ffffff}.btn-danger{color:#ffffff;background-color:#f57a00;border-color:#f57a00}.btn-danger:focus,.btn-danger.focus{color:#ffffff;background-color:#c26100;border-color:#763b00}.btn-danger:hover{color:#ffffff;background-color:#c26100;border-color:#b85c00}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{color:#ffffff;background-color:#c26100;border-color:#b85c00}.btn-danger:active:hover,.btn-danger.active:hover,.open>.dropdown-toggle.btn-danger:hover,.btn-danger:active:focus,.btn-danger.active:focus,.open>.dropdown-toggle.btn-danger:focus,.btn-danger:active.focus,.btn-danger.active.focus,.open>.dropdown-toggle.btn-danger.focus{color:#ffffff;background-color:#9e4f00;border-color:#763b00}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled.focus,.btn-danger[disabled].focus,fieldset[disabled] .btn-danger.focus{background-color:#f57a00;border-color:#f57a00}.btn-danger .badge{color:#f57a00;background-color:#ffffff}.btn-link{color:#eb6864;font-weight:normal;border-radius:0}.btn-link,.btn-link:active,.btn-link.active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#e22620;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#999999;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:14px 16px;font-size:19px;line-height:1.3333333;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:13px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:13px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-property:height, visibility;-o-transition-property:height, visibility;transition-property:height, visibility;-webkit-transition-duration:0.35s;-o-transition-duration:0.35s;transition-duration:0.35s;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid \9;border-right:4px solid transparent;border-left:4px solid transparent}.dropup,.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:15px;text-align:left;background-color:#ffffff;border:1px solid #cccccc;border:1px solid rgba(0,0,0,0.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);-webkit-background-clip:padding-box;background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9.5px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.42857143;color:#333333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{text-decoration:none;color:#ffffff;background-color:#eb6864}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#ffffff;text-decoration:none;outline:0;background-color:#eb6864}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999999}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);cursor:not-allowed}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{left:auto;right:0}.dropdown-menu-left{left:0;right:auto}.dropdown-header{display:block;padding:3px 20px;font-size:13px;line-height:1.42857143;color:#999999;white-space:nowrap}.dropdown-backdrop{position:fixed;left:0;right:0;bottom:0;top:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px dashed;border-bottom:4px solid \9;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{left:auto;right:0}.navbar-right .dropdown-menu-left{left:0;right:auto}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-top-left-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-right-radius:0;border-top-left-radius:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{float:none;display:table-cell;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle="buttons"]>.btn input[type="radio"],[data-toggle="buttons"]>.btn-group>.btn input[type="radio"],[data-toggle="buttons"]>.btn input[type="checkbox"],[data-toggle="buttons"]>.btn-group>.btn input[type="checkbox"]{position:absolute;clip:rect(0, 0, 0, 0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*="col-"]{float:none;padding-left:0;padding-right:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:56px;padding:14px 16px;font-size:19px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:56px;line-height:56px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:31px;padding:5px 10px;font-size:13px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:31px;line-height:31px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:8px 12px;font-size:15px;font-weight:normal;line-height:1;color:#777777;text-align:center;background-color:#eeeeee;border:1px solid #cccccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:13px;border-radius:3px}.input-group-addon.input-lg{padding:14px 16px;font-size:19px;border-radius:6px}.input-group-addon input[type="radio"],.input-group-addon input[type="checkbox"]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-bottom-right-radius:0;border-top-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{margin-bottom:0;padding-left:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eeeeee}.nav>li.disabled>a{color:#999999}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#999999;text-decoration:none;background-color:transparent;cursor:not-allowed}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eeeeee;border-color:#eb6864}.nav .nav-divider{height:1px;margin:9.5px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #dddddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eeeeee #eeeeee #dddddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#777777;background-color:#ffffff;border:1px solid #dddddd;border-bottom-color:transparent;cursor:default}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #dddddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #dddddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#ffffff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#ffffff;background-color:#eb6864}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #dddddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #dddddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#ffffff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:60px;margin-bottom:21px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{overflow-x:visible;padding-right:15px;padding-left:15px;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1);-webkit-overflow-scrolling:touch}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block !important;height:auto !important;padding-bottom:0;overflow:visible !important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-left:0;padding-right:0}}.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:200px}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:19.5px 15px;font-size:19px;line-height:21px;height:60px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;margin-right:15px;padding:9px 10px;margin-top:13px;margin-bottom:13px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:9.75px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:21px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:21px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:19.5px;padding-bottom:19.5px}}.navbar-form{margin-left:-15px;margin-right:-15px;padding:10px 15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);margin-top:10.5px;margin-bottom:10.5px}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .radio label,.navbar-form .checkbox label{padding-left:0}.navbar-form .radio input[type="radio"],.navbar-form .checkbox input[type="checkbox"]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;border:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-right-radius:4px;border-top-left-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:10.5px;margin-bottom:10.5px}.navbar-btn.btn-sm{margin-top:14.5px;margin-bottom:14.5px}.navbar-btn.btn-xs{margin-top:19px;margin-bottom:19px}.navbar-text{margin-top:19.5px;margin-bottom:19.5px}@media (min-width:768px){.navbar-text{float:left;margin-left:15px;margin-right:15px}}@media (min-width:768px){.navbar-left{float:left !important}.navbar-right{float:right !important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#ffffff;border-color:#eeeeee}.navbar-default .navbar-brand{color:#000000}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#000000;background-color:#eeeeee}.navbar-default .navbar-text{color:#000000}.navbar-default .navbar-nav>li>a{color:#000000}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#000000;background-color:#eeeeee}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#000000;background-color:#eeeeee}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#cccccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#dddddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#dddddd}.navbar-default .navbar-toggle .icon-bar{background-color:#cccccc}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#eeeeee}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{background-color:#eeeeee;color:#000000}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#000000}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#000000;background-color:#eeeeee}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#000000;background-color:#eeeeee}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#cccccc;background-color:transparent}}.navbar-default .navbar-link{color:#000000}.navbar-default .navbar-link:hover{color:#000000}.navbar-default .btn-link{color:#000000}.navbar-default .btn-link:hover,.navbar-default .btn-link:focus{color:#000000}.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:hover,.navbar-default .btn-link[disabled]:focus,fieldset[disabled] .navbar-default .btn-link:focus{color:#cccccc}.navbar-inverse{background-color:#eb6864;border-color:#e53c37}.navbar-inverse .navbar-brand{color:#ffffff}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#ffffff;background-color:#e74b47}.navbar-inverse .navbar-text{color:#ffffff}.navbar-inverse .navbar-nav>li>a{color:#ffffff}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#ffffff;background-color:#e74b47}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#ffffff;background-color:#e74b47}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#e53c37}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#e53c37}.navbar-inverse .navbar-toggle .icon-bar{background-color:#ffffff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#e74944}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{background-color:#e74b47;color:#ffffff}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#e53c37}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#e53c37}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#ffffff}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#ffffff;background-color:#e74b47}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#ffffff;background-color:#e74b47}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444444;background-color:transparent}}.navbar-inverse .navbar-link{color:#ffffff}.navbar-inverse .navbar-link:hover{color:#ffffff}.navbar-inverse .btn-link{color:#ffffff}.navbar-inverse .btn-link:hover,.navbar-inverse .btn-link:focus{color:#ffffff}.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:hover,.navbar-inverse .btn-link[disabled]:focus,fieldset[disabled] .navbar-inverse .btn-link:focus{color:#444444}.breadcrumb{padding:8px 15px;margin-bottom:21px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{content:"/\00a0";padding:0 5px;color:#cccccc}.breadcrumb>.active{color:#999999}.pagination{display:inline-block;padding-left:0;margin:21px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:8px 12px;line-height:1.42857143;text-decoration:none;color:#eb6864;background-color:#ffffff;border:1px solid #dddddd;margin-left:-1px}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:4px;border-top-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-bottom-right-radius:4px;border-top-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{z-index:2;color:#e22620;background-color:#eeeeee;border-color:#dddddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:3;color:#999999;background-color:#f5f5f5;border-color:#dddddd;cursor:default}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#999999;background-color:#ffffff;border-color:#dddddd;cursor:not-allowed}.pagination-lg>li>a,.pagination-lg>li>span{padding:14px 16px;font-size:19px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-bottom-right-radius:6px;border-top-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:13px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-bottom-right-radius:3px;border-top-right-radius:3px}.pager{padding-left:0;margin:21px 0;list-style:none;text-align:center}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#ffffff;border:1px solid #dddddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eeeeee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999999;background-color:#ffffff;cursor:not-allowed}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#ffffff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:hover,a.label:focus{color:#ffffff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#999999}.label-default[href]:hover,.label-default[href]:focus{background-color:#808080}.label-primary{background-color:#eb6864}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#e53c37}.label-success{background-color:#22b24c}.label-success[href]:hover,.label-success[href]:focus{background-color:#1a873a}.label-info{background-color:#336699}.label-info[href]:hover,.label-info[href]:focus{background-color:#264c73}.label-warning{background-color:#f5e625}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ddce0a}.label-danger{background-color:#f57a00}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c26100}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:13px;font-weight:bold;color:#ffffff;line-height:1;vertical-align:middle;white-space:nowrap;text-align:center;background-color:#eb6864;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge,.btn-group-xs>.btn .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#ffffff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#eb6864;background-color:#ffffff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eeeeee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:23px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:6px;padding-left:15px;padding-right:15px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-left:60px;padding-right:60px}.jumbotron h1,.jumbotron .h1{font-size:68px}}.thumbnail{display:block;padding:4px;margin-bottom:21px;line-height:1.42857143;background-color:#ffffff;border:1px solid #dddddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-left:auto;margin-right:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#eb6864}.thumbnail .caption{padding:9px;color:#777777}.alert{padding:15px;margin-bottom:21px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:bold}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#468847}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#356635}.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#3a87ad}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#2d6987}.alert-warning{background-color:#fcf8e3;border-color:#fbeed5;color:#c09853}.alert-warning hr{border-top-color:#f8e5be}.alert-warning .alert-link{color:#a47e3c}.alert-danger{background-color:#f2dede;border-color:#eed3d7;color:#b94a48}.alert-danger hr{border-top-color:#e6c1c7}.alert-danger .alert-link{color:#953b39}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{overflow:hidden;height:21px;margin-bottom:21px;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress-bar{float:left;width:0%;height:100%;font-size:13px;line-height:21px;color:#ffffff;text-align:center;background-color:#eb6864;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-transition:width 0.6s ease;-o-transition:width 0.6s ease;transition:width 0.6s ease}.progress-striped .progress-bar,.progress-bar-striped{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar,.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#22b24c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent)}.progress-bar-info{background-color:#336699}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent)}.progress-bar-warning{background-color:#f5e625}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent)}.progress-bar-danger{background-color:#f57a00}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:-o-linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent);background-image:linear-gradient(45deg, rgba(255,255,255,0.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.15) 75%, transparent 75%, transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{zoom:1;overflow:hidden}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-left,.media-right,.media-body{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{margin-bottom:20px;padding-left:0}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#ffffff;border:1px solid #dddddd}.list-group-item:first-child{border-top-right-radius:4px;border-top-left-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333333}a.list-group-item:hover,button.list-group-item:hover,a.list-group-item:focus,button.list-group-item:focus{text-decoration:none;color:#555555;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:hover,.list-group-item.disabled:focus{background-color:#eeeeee;color:#999999;cursor:not-allowed}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text{color:#999999}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{z-index:2;color:#ffffff;background-color:#eb6864;border-color:#eb6864}.list-group-item.active .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>.small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:hover .list-group-item-text,.list-group-item.active:focus .list-group-item-text{color:#ffffff}.list-group-item-success{color:#468847;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#468847}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,button.list-group-item-success:hover,a.list-group-item-success:focus,button.list-group-item-success:focus{color:#468847;background-color:#d0e9c6}a.list-group-item-success.active,button.list-group-item-success.active,a.list-group-item-success.active:hover,button.list-group-item-success.active:hover,a.list-group-item-success.active:focus,button.list-group-item-success.active:focus{color:#fff;background-color:#468847;border-color:#468847}.list-group-item-info{color:#3a87ad;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#3a87ad}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,button.list-group-item-info:hover,a.list-group-item-info:focus,button.list-group-item-info:focus{color:#3a87ad;background-color:#c4e3f3}a.list-group-item-info.active,button.list-group-item-info.active,a.list-group-item-info.active:hover,button.list-group-item-info.active:hover,a.list-group-item-info.active:focus,button.list-group-item-info.active:focus{color:#fff;background-color:#3a87ad;border-color:#3a87ad}.list-group-item-warning{color:#c09853;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#c09853}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,button.list-group-item-warning:hover,a.list-group-item-warning:focus,button.list-group-item-warning:focus{color:#c09853;background-color:#faf2cc}a.list-group-item-warning.active,button.list-group-item-warning.active,a.list-group-item-warning.active:hover,button.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus,button.list-group-item-warning.active:focus{color:#fff;background-color:#c09853;border-color:#c09853}.list-group-item-danger{color:#b94a48;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#b94a48}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,button.list-group-item-danger:hover,a.list-group-item-danger:focus,button.list-group-item-danger:focus{color:#b94a48;background-color:#ebcccc}a.list-group-item-danger.active,button.list-group-item-danger.active,a.list-group-item-danger.active:hover,button.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus,button.list-group-item-danger.active:focus{color:#fff;background-color:#b94a48;border-color:#b94a48}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:21px;background-color:#ffffff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.05);box-shadow:0 1px 1px rgba(0,0,0,0.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:17px;color:inherit}.panel-title>a,.panel-title>small,.panel-title>.small,.panel-title>small>a,.panel-title>.small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #dddddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-right-radius:3px;border-top-left-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-right-radius:0;border-top-left-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.table,.panel>.table-responsive>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel>.table caption,.panel>.table-responsive>.table caption,.panel>.panel-collapse>.table caption{padding-left:15px;padding-right:15px}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-right-radius:3px;border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #dddddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{border:0;margin-bottom:0}.panel-group{margin-bottom:21px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.panel-body,.panel-group .panel-heading+.panel-collapse>.list-group{border-top:1px solid #dddddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #dddddd}.panel-default{border-color:#dddddd}.panel-default>.panel-heading{color:#777777;background-color:#f5f5f5;border-color:#dddddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#dddddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#777777}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#dddddd}.panel-primary{border-color:#eb6864}.panel-primary>.panel-heading{color:#ffffff;background-color:#eb6864;border-color:#eb6864}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#eb6864}.panel-primary>.panel-heading .badge{color:#eb6864;background-color:#ffffff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#eb6864}.panel-success{border-color:#22b24c}.panel-success>.panel-heading{color:#468847;background-color:#22b24c;border-color:#22b24c}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#22b24c}.panel-success>.panel-heading .badge{color:#22b24c;background-color:#468847}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#22b24c}.panel-info{border-color:#336699}.panel-info>.panel-heading{color:#3a87ad;background-color:#336699;border-color:#336699}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#336699}.panel-info>.panel-heading .badge{color:#336699;background-color:#3a87ad}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#336699}.panel-warning{border-color:#f5e625}.panel-warning>.panel-heading{color:#c09853;background-color:#f5e625;border-color:#f5e625}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#f5e625}.panel-warning>.panel-heading .badge{color:#f5e625;background-color:#c09853}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#f5e625}.panel-danger{border-color:#f57a00}.panel-danger>.panel-heading{color:#b94a48;background-color:#f57a00;border-color:#f57a00}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#f57a00}.panel-danger>.panel-heading .badge{color:#f57a00;background-color:#b94a48}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#f57a00}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.embed-responsive embed,.embed-responsive object,.embed-responsive video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:22.5px;font-weight:bold;line-height:1;color:#000000;text-shadow:0 1px 0 #ffffff;opacity:0.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000000;text-decoration:none;cursor:pointer;opacity:0.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{display:none;overflow:hidden;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transform:translate(0, -25%);-ms-transform:translate(0, -25%);-o-transform:translate(0, -25%);transform:translate(0, -25%);-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0, 0);-ms-transform:translate(0, 0);-o-transform:translate(0, 0);transform:translate(0, 0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#ffffff;border:1px solid #999999;border:1px solid rgba(0,0,0,0.2);border-radius:6px;-webkit-box-shadow:0 3px 9px rgba(0,0,0,0.5);box-shadow:0 3px 9px rgba(0,0,0,0.5);-webkit-background-clip:padding-box;background-clip:padding-box;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:0.5;filter:alpha(opacity=50)}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:20px}.modal-footer{padding:20px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.5);box-shadow:0 5px 15px rgba(0,0,0,0.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:Georgia,"Times New Roman",Times,serif;font-style:normal;font-weight:normal;letter-spacing:normal;line-break:auto;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;font-size:13px;opacity:0;filter:alpha(opacity=0)}.tooltip.in{opacity:0.9;filter:alpha(opacity=90)}.tooltip.top{margin-top:-3px;padding:5px 0}.tooltip.right{margin-left:3px;padding:0 5px}.tooltip.bottom{margin-top:3px;padding:5px 0}.tooltip.left{margin-left:-3px;padding:0 5px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#ffffff;text-align:center;background-color:#000000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000000}.tooltip.top-left .tooltip-arrow{bottom:0;right:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:Georgia,"Times New Roman",Times,serif;font-style:normal;font-weight:normal;letter-spacing:normal;line-break:auto;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;word-wrap:normal;font-size:15px;background-color:#ffffff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #cccccc;border:1px solid rgba(0,0,0,0.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{margin:0;padding:8px 14px;font-size:15px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{border-width:10px;content:""}.popover.top>.arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999999;border-top-color:rgba(0,0,0,0.25);bottom:-11px}.popover.top>.arrow:after{content:" ";bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#ffffff}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999999;border-right-color:rgba(0,0,0,0.25)}.popover.right>.arrow:after{content:" ";left:1px;bottom:-10px;border-left-width:0;border-right-color:#ffffff}.popover.bottom>.arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999999;border-bottom-color:rgba(0,0,0,0.25);top:-11px}.popover.bottom>.arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#ffffff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999999;border-left-color:rgba(0,0,0,0.25)}.popover.left>.arrow:after{content:" ";right:1px;border-right-width:0;border-left-color:#ffffff;bottom:-10px}.carousel{position:relative}.carousel-inner{position:relative;overflow:hidden;width:100%}.carousel-inner>.item{display:none;position:relative;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.next,.carousel-inner>.item.active.right{-webkit-transform:translate3d(100%, 0, 0);transform:translate3d(100%, 0, 0);left:0}.carousel-inner>.item.prev,.carousel-inner>.item.active.left{-webkit-transform:translate3d(-100%, 0, 0);transform:translate3d(-100%, 0, 0);left:0}.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right,.carousel-inner>.item.active{-webkit-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);left:0}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;left:0;bottom:0;width:15%;opacity:0.5;filter:alpha(opacity=50);font-size:20px;color:#ffffff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6);background-color:rgba(0,0,0,0)}.carousel-control.left{background-image:-webkit-linear-gradient(left, rgba(0,0,0,0.5) 0, rgba(0,0,0,0.0001) 100%);background-image:-o-linear-gradient(left, rgba(0,0,0,0.5) 0, rgba(0,0,0,0.0001) 100%);background-image:-webkit-gradient(linear, left top, right top, from(rgba(0,0,0,0.5)), to(rgba(0,0,0,0.0001)));background-image:linear-gradient(to right, rgba(0,0,0,0.5) 0, rgba(0,0,0,0.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1)}.carousel-control.right{left:auto;right:0;background-image:-webkit-linear-gradient(left, rgba(0,0,0,0.0001) 0, rgba(0,0,0,0.5) 100%);background-image:-o-linear-gradient(left, rgba(0,0,0,0.0001) 0, rgba(0,0,0,0.5) 100%);background-image:-webkit-gradient(linear, left top, right top, from(rgba(0,0,0,0.0001)), to(rgba(0,0,0,0.5)));background-image:linear-gradient(to right, rgba(0,0,0,0.0001) 0, rgba(0,0,0,0.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1)}.carousel-control:hover,.carousel-control:focus{outline:0;color:#ffffff;text-decoration:none;opacity:0.9;filter:alpha(opacity=90)}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;margin-top:-10px;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%;margin-left:-10px}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%;margin-right:-10px}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;line-height:1;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;margin-left:-30%;padding-left:0;list-style:none;text-align:center}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;border:1px solid #ffffff;border-radius:10px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0)}.carousel-indicators .active{margin:0;width:12px;height:12px;background-color:#ffffff}.carousel-caption{position:absolute;left:15%;right:15%;bottom:20px;z-index:10;padding-top:20px;padding-bottom:20px;color:#ffffff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-10px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-10px}.carousel-caption{left:20%;right:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.dl-horizontal dd:before,.dl-horizontal dd:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-header:before,.modal-header:after,.modal-footer:before,.modal-footer:after{content:" ";display:table}.clearfix:after,.dl-horizontal dd:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-header:after,.modal-footer:after{clear:both}.center-block{display:block;margin-left:auto;margin-right:auto}.pull-right{float:right !important}.pull-left{float:left !important}.hide{display:none !important}.show{display:block !important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none !important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none !important}.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block{display:none !important}@media (max-width:767px){.visible-xs{display:block !important}table.visible-xs{display:table !important}tr.visible-xs{display:table-row !important}th.visible-xs,td.visible-xs{display:table-cell !important}}@media (max-width:767px){.visible-xs-block{display:block !important}}@media (max-width:767px){.visible-xs-inline{display:inline !important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block !important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block !important}table.visible-sm{display:table !important}tr.visible-sm{display:table-row !important}th.visible-sm,td.visible-sm{display:table-cell !important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block !important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline !important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block !important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block !important}table.visible-md{display:table !important}tr.visible-md{display:table-row !important}th.visible-md,td.visible-md{display:table-cell !important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block !important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline !important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block !important}}@media (min-width:1200px){.visible-lg{display:block !important}table.visible-lg{display:table !important}tr.visible-lg{display:table-row !important}th.visible-lg,td.visible-lg{display:table-cell !important}}@media (min-width:1200px){.visible-lg-block{display:block !important}}@media (min-width:1200px){.visible-lg-inline{display:inline !important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block !important}}@media (max-width:767px){.hidden-xs{display:none !important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none !important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none !important}}@media (min-width:1200px){.hidden-lg{display:none !important}}.visible-print{display:none !important}@media print{.visible-print{display:block !important}table.visible-print{display:table !important}tr.visible-print{display:table-row !important}th.visible-print,td.visible-print{display:table-cell !important}}.visible-print-block{display:none !important}@media print{.visible-print-block{display:block !important}}.visible-print-inline{display:none !important}@media print{.visible-print-inline{display:inline !important}}.visible-print-inline-block{display:none !important}@media print{.visible-print-inline-block{display:inline-block !important}}@media print{.hidden-print{display:none !important}}.navbar{font-size:18px;font-family:"News Cycle","Arial Narrow Bold",sans-serif;font-weight:700}.navbar-default .badge{background-color:#000;color:#fff}.navbar-inverse .badge{background-color:#fff;color:#eb6864}.navbar-brand{font-size:inherit;font-weight:700;text-transform:uppercase}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline,.has-warning.radio label,.has-warning.checkbox label,.has-warning.radio-inline label,.has-warning.checkbox-inline label,.has-warning .form-control-feedback{color:#f57a00}.has-warning .form-control,.has-warning .form-control:focus{border-color:#f57a00}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline,.has-error.radio label,.has-error.checkbox label,.has-error.radio-inline label,.has-error.checkbox-inline label,.has-error .form-control-feedback{color:#eb6864}.has-error .form-control,.has-error .form-control:focus{border-color:#eb6864}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline,.has-success.radio label,.has-success.checkbox label,.has-success.radio-inline label,.has-success.checkbox-inline label,.has-success .form-control-feedback{color:#22b24c}.has-success .form-control,.has-success .form-control:focus{border-color:#22b24c}.badge{padding-bottom:4px;vertical-align:3px;font-size:10px}.jumbotron h1,.jumbotron h2,.jumbotron h3,.jumbotron h4,.jumbotron h5,.jumbotron h6{font-family:"News Cycle","Arial Narrow Bold",sans-serif;font-weight:700;color:#000}.panel-primary .panel-title,.panel-success .panel-title,.panel-warning .panel-title,.panel-danger .panel-title,.panel-info .panel-title{color:#fff}
\ No newline at end of file
diff --git a/milfs/css/estilos.php b/milfs/css/estilos.php
index 19ae98e..aa1a04e 100644
--- a/milfs/css/estilos.php
+++ b/milfs/css/estilos.php
@@ -10,10 +10,10 @@ $consulta = "SELECT elemento FROM estilos GROUP BY elemento";
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
- mysql_data_seek($sql, 0);
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$elemento= dibuja_elemento($row[elemento]);
$resultado .= "$row[elemento]{
$elemento
@@ -29,8 +29,8 @@ function dibuja_elemento($elemento){
mysqli_query("SET NAMES 'utf8'");
$consulta = "SELECT * FROM estilos WHERE elemento = '$elemento' ";
$sql=mysqli_query($consulta,$link);
- if (mysql_num_rows($sql)!='0'){
- while( $row = mysql_fetch_array( $sql ) ) {
+ if (mysqli_num_rows($sql)!='0'){
+ while( $row = mysqli_fetch_array( $sql ) ) {
if($row[color] !=='') {$color = "$row[color]";}else{$color="";}
$resultado .= "$row[label]:$row[valor] $color ;\n";
}
diff --git a/milfs/css/style.css b/milfs/css/style.css
index 1cb800b..5d39f70 100644
--- a/milfs/css/style.css
+++ b/milfs/css/style.css
@@ -1,404 +1,172 @@
-body {overflow-x:hidden!important;}
-
-#cabecera-botonera-admin {
- background-color: #777677;
+ * {
+ margin: 0;
+ padding: 0;
}
-
-.btn-botonera-admin {
- margin-left: 20px;
- margin-right: 20px;
- border-left: 1px solid white;
+body {
+ background: #222;
+ font-family: Georgia, serif;
+ color: #fff;
+ font-size: 14px;
}
-
-#botonera-admin,
-#botonera-admin>a {
- color: white !important;
+#dates a {
+ color: gray;
+ text-decoration: none;
+ -webkit-transition: 0.5s;
+ -moz-transition: 0.5s;
+ -o-transition: 0.5s;
+ -ms-transition: 0.5s;
+ transition: 0.5s;
+ font-size: 12px;
}
-
-.btn-botonera-admin:hover {
- background-color: black;
+#dates a:hover,
+#dates a.selected {
+ color: red;
+ font-size: 18px;
+ }
+/*
+h1,h2,h4,h5,h6 {
+ text-align: center;
+ color: #ccc;
+ text-shadow: #000 1px 1px 2px;
+ margin-bottom: 5px;
}
-
-.btn.btn-botonera-admin:hover {
- color: white !important;
+ h1 {
+ font-size: 18px;
+ }
+ h2 {
+ font-size: 14px;
+ }
+.sociales {
+ text-align: center;
+ margin-bottom: 20px;
}
-
-.intro-social-buttons {
- padding-top: 10px !important;
-}
-
-#botonera_landing {
- display: inline-flex;
-}
-
-.boton_land {
- margin-left: 3px !important;
-}
-
-.cabecera {
- padding-bottom: 30px;
- padding-left: 80px !important;
-}
-
-#logo_cabecera {
- max-width: 60% !important;
- margin: 0 auto;
-}
-
-#encabezado_proyecto {
- padding-top: 30px;
-}
-
-.thumbnail {
- height: 100% !important;
- overflow-y: auto;
- overflow-x: hidden;
- padding: 0px 0px 70px 0px;;
- border:none;
-}
-
-.box-secciones {
-/* box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
- transition: all 0.3s cubic-bezier(.25, .8, .25, 1);*/
- border-radius: 0px !important;
- padding: 50px;
- border-bottom: 1px solid lightgrey;
-}
-
-.box-secciones:hover {
- box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
-}
-
-.img-secciones {
- max-height: 250px;
-}
-
-#buscador_centro {
- display: inline-flex;
-}
-
-#buscador_blog {
- display: inline-flex !important;
-}
-
-#fh5co-footer{
-display: inline-block;
-}
-
-
-
-
-/* nube de etiquetas */
-
-div.etiquetas {
- /* font-family: verdana,arial,helvetica;
- font-size:8pt;
- */
- padding: 5px;
-}
-
-div.etiquetas span {
- float: left;
- margin: 0 3px 0 3px;
- height: 20pt;
- white-space: nowrap;
-}
-
-span.etiquetatam1 {
- font-size: 110%;
-}
-
-span.etiquetatam2 {
- font-size: 120%;
-}
-
-span.etiquetatam3 {
- font-size: 130%;
-}
-
-span.etiquetatam4 {
- font-size: 140%;
-}
-
-span.etiquetatam5 {
- font-size: 150%;
-}
-
-span.etiquetatam6 {
- font-size: 160%;
-}
-
-span.etiquetatam7 {
- font-size: 170%;
-}
-
-span.etiquetatam8 {
- font-size: 180%;
-}
-
-span.etiquetatam9 {
- font-size: 250%;
-}
-
-span.etiquetatam10 {
- font-size: 300%;
-}
-
-
-
-
-
-
-/* nube de etiquetas */
-
-.drop-up {
- top: auto;
- bottom: 100% !important;
-
- overflow: visible;
-}
-
-.dropdown-menu {
- min-width: 300px;
- padding: 3px;
- z-index: 99999;
-}
-
-.navbar .navbar-nav {
- display: inline-block;
- float: none;
-}
-
-.navbar .navbar-collapse .navbar-principal {
- text-align: center;
- height: 30px;
- margin-top: -13px;
-}
-
-.navbar-principal>li>a,
-{
- padding-top: 0px !important;
- padding-bottom: 0 !important;
- height: 30px;
- margin-top: -13px;
-}
-
-.navbar-principal {
- min-height: 30px !important;
-}
-
-
-
-
-.topnav {
- width: 100px !important;
- display: inline;
- height: 30px;
- padding-top: -10px !important;
- padding-bottom: 0 !important;
- height: 30px;
- background: none;
- border: 0px;
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
-}
-
-
-
-
-
-
-
-
-/*width:80px; background: none; border:0px; -webkit-box-shadow: none;
--moz-box-shadow: none;
-box-shadow: none;
*/
+ #timeline {
+ width: 95%;
+ height: 500px;
+ overflow: hidden;
+ margin: 100px auto;
+ position: relative;
-@media all {
- div.saltopagina {
- display: none;
- }
-}
-
-@media print {
- div.saltopagina {
- display: block;
- page-break-before: always;
- }
- div.noprint {
- display: none;
- }
-}
-
-.modal-dialog {
- width: 95% !important;
- height: auto;
- padding: 0;
-}
-
-.modal-lg {
- width: 98% !important;
- height: auto;
-
- padding: 0;
-}
-
-.modal-xs {
- width: 40% !important;
- height: auto;
-
- padding: 0;
-}
-
-.modal-content {
- height: auto;
-}
-
-.modal-body {
- max-height: calc(100vh - 300px);
- min-height: calc(100vh - 300px);
- overflow-y: auto;
-}
-
-fieldset.fieldset-borde {
- border: 2px solid #EDEDED !important;
- border-radius: 3px;
- padding: 0 1.4em 1.4em 1.4em !important;
- margin: 0 0 1.5em 0 !important;
- -webkit-box-shadow: 0px 0px 0px 0px #000;
- box-shadow: 0px 0px 0px 0px #000;
-}
-
-legend.legend-area {
- font-size: 1.2em !important;
- font-weight: bold !important;
- text-align: left !important;
- width: auto;
- padding: 0 10px;
- border-bottom: none;
-}
-
-.fh5co-post-entry article h2 {
- font-size: 28px;
- !important;
-}
-
-#fh5co-offcanvas .fh5co-bio img {
- border-radius: 10px !important;
-}
-
-fieldset.fieldset-borde {
- border: 2px solid #EDEDED !important;
- border-radius: 3px;
- padding: 0 1.4em 1.4em 1.4em !important;
- margin: 0 0 1.5em 0 !important;
- -webkit-box-shadow: 0px 0px 0px 0px #000;
- box-shadow: 0px 0px 0px 0px #000;
-}
-
-legend.legend-area {
- font-size: 1.2em !important;
- font-weight: bold !important;
- text-align: left !important;
- width: auto;
- padding: 0 10px;
- border-bottom: none;
-}
-
-
-
-
-
-
-/*RESPONSIVE*/
-
-@media only screen and (min-width: 1200px) {
-
-
-}
-
-@media (max-width: 991px) {
- #encabezado_proyecto {
- text-align: center;
- padding-top: 0px !important;
- }
-
-
- #logo_cabecera {
- max-width: 100% !important;
- padding-top: 0px !important;
- }
- #buscador_blog {
- padding: 0px;;
- }
-}
-
-@media (max-width: 768px) {
- .modal-body {
- max-height: calc(100vh - 100px) !important;
- min-height: calc(100vh - 100px) !important;
- }
-
-#texto_articulo{
-padding: 0px !important;
-}
-
- .box-secciones {
- padding: 5px !important;
-}
-
- #menu_tupale {
- background-color: #dfdfdf;
- }
- .btn-botonera-admin {
- margin-left: 0px;
- margin-right: 0px;
- border-left: none;
- }
-
- .dropdown-menu>li>a {
- color: #333 !important;
- }
-
- .thumbnail {
- height: 100%;
- }
-
- #secciones,
- .articulo_cuadro {
- padding: 0px;
- }
- #btn_agregar {
- margin-bottom: 3px;
- }
-
- #btn_filtro{
- margin-bottom: 3px;
- }
-
-}
-
-
-@media (max-width: 480px) {
- #logo_cabecera {
- max-width: 100% !important;
- }
-
- .cabecera {
- padding-bottom: 30px;
- padding-left: 0px !important;
- }
-}
-
-
-
-
-
-
-
-
-/*FIN responsive*/
\ No newline at end of file
+ }
+ #dates {
+ width: 800px;
+ height: 60px;
+ overflow: hidden;
+ background: url('timeline/dot.gif') left 45px repeat-x;
+ }
+ #dates li {
+ list-style: none;
+ float: left;
+ width: 100px;
+ height: 50px;
+ font-size: 24px;
+ text-align: center;
+ background: url('timeline/biggerdot.png') center bottom no-repeat;
+ }
+ #dates a {
+ line-height: 18px;
+ padding-bottom: 10px;
+ }
+ #dates .selected {
+ font-size: 18px;
+ }
+
+ #issues {
+ width: 800px;
+ height: 500px;
+ overflow: hidden;
+ }
+ #issues li {
+ width: 900px;
+ height: 500px;
+ list-style: none;
+ float: left;
+ }
+ #issues li.selected img {
+ -webkit-transform: scale(1.1,1.1);
+ -moz-transform: scale(1.1,1.1);
+ -o-transform: scale(1.1,1.1);
+ -ms-transform: scale(1.1,1.1);
+ transform: scale(1.1,1.1);
+ }
+ #issues li img {
+ float: left;
+ margin: 10px 30px 10px 50px;
+ background: transparent;
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)"; /* IE 8 */
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);/* IE 6 & 7 */
+ zoom: 1;
+ -webkit-transition: all 2s ease-in-out;
+ -moz-transition: all 2s ease-in-out;
+ -o-transition: all 2s ease-in-out;
+ -ms-transition: all 2s ease-in-out;
+ transition: all 2s ease-in-out;
+ -webkit-transform: scale(0.7,0.7);
+ -moz-transform: scale(0.7,0.7);
+ -o-transform: scale(0.7,0.7);
+ -ms-transform: scale(0.7,0.7);
+ transform: scale(0.7,0.7);
+ }
+ #issues li h1 {
+
+ font-size: 48px;
+ margin: 20px 0;
+ color: red;
+ /*text-shadow: #000 1px 1px 2px;*/
+ }
+ #issues li p {
+ font-size: 14px;
+ margin-right: 70px;
+ font-weight: normal;
+ line-height: 22px;
+ /* text-shadow: #000 1px 1px 2px;*/
+ }
+
+ #grad_left,
+ #grad_right {
+ width: 100px;
+ height: 500px;
+ position: absolute;
+ top: 0;
+ }
+ #grad_left {
+ left: 0;
+ /* background: url('timeline/grad_left.png') repeat-y;*/
+ }
+ #grad_right {
+ right: 0;
+ /* background: url('timeline/grad_right.png') repeat-y;*/
+ }
+
+ #next,
+ #prev {
+ position: absolute;
+ top: 0;
+ font-size: 70px;
+ top: 170px;
+ width: 22px;
+ height: 38px;
+ background-position: 0 0;
+ background-repeat: no-repeat;
+ text-indent: -9999px;
+ overflow: hidden;
+ }
+ #next:hover,
+ #prev:hover {
+ background-position: 0 -76px;
+ }
+ #next {
+ right: 0;
+ background-image: url('timeline/next.png');
+ }
+ #prev {
+ left: 0;
+ background-image: url('timeline/prev.png');
+ }
+ #next.disabled,
+ #prev.disabled {
+ opacity: 0.2;
+ }
\ No newline at end of file
diff --git a/milfs/funciones/.giosaveXCKCCY b/milfs/funciones/.giosaveXCKCCY
new file mode 100644
index 0000000..e69de29
diff --git a/milfs/funciones/.goutputstream-05TT7X b/milfs/funciones/.goutputstream-05TT7X
new file mode 100644
index 0000000..8079cee
--- /dev/null
+++ b/milfs/funciones/.goutputstream-05TT7X
@@ -0,0 +1,8047 @@
+$fila $row[nombre]";
+ $fila++
+ }
+ }
+return $linea;
+}
+
+function buscar_imagen($form,$control,$tipo,$empresa) {
+
+ if ($form ==""){
+ $consulta = "SELECT form_datos.id_empresa, contenido , campo_nombre , id_campo FROM form_id, form_datos, form_campos
+ WHERE form_datos.id_campo = form_campos.id AND form_id.id = form_datos.form_id
+ AND form_datos.id_empresa = '$empresa'
+ AND publico ='1' AND form_campos.campo_tipo='15' ORDER BY rand() limit 1 ";
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+ $imagen = mysql_result($sql,0,"contenido");
+ }
+if($tipo == "consulta") { return $consulta; }
+ return $imagen;
+
+ }
+$publico = remplacetas('form_id','id',$id,'publico',"") ;
+if($publico[0] !="0" ){
+$campo_imagen = buscar_campo_tipo("$form","15");
+$imagen = remplacetas('form_datos','form_id',$form,'contenido'," id_campo = '$campo_imagen[0]'") ;
+//$imagen = "$imagen[0]";
+return $imagen[0];
+}
+return;
+}
+
+function wait($div){
+$respuesta = new xajaxResponse('utf-8');
+$resultado ="
Procesando ...";
+$respuesta->addAssign("$div","innerHTML","$resultado");
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("wait");
+
+
+function campos_tabla($filtro,$div) {
+
+if($filtro == 'id_empresa') { $w_empresa = " AND id_empresa = '$_SESSION[id_empresa]' ";}
+if($filtro == 'id_especialista') { $w_especialista = " AND id_especialista = '$_SESSION[id]' ";}
+if($filtro == 'llenos') {
+$consulta= " SELECT * , form_campos.id as id FROM form_campos, form_datos WHERE form_campos.id = form_datos.id_campo $w_empresa $w_especialista GROUP BY id_campo ORDER BY campo_area, campo_nombre ";
+}elseif($filtro == 'vacios') {
+$consulta= " SELECT DISTINCT(form_campos.id) as id , `id_especialista` , `id_empresa`, `campo_nombre`, `campo_descripcion`, `campo_tipo`,`campo_area`, `orden`, `activo`, `identificador`, `bloqueo` FROM form_campos WHERE id NOT IN ( SELECT distinct(id_campo) FROM form_datos GROUP BY id_campo) GROUP BY id ORDER BY campo_area, campo_nombre";
+}else{
+$consulta= " SELECT * FROM form_campos WHERE id = id $w_empresa $w_especialista ORDER BY campo_area, campo_nombre ";
+}
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $sql=mysql_query($consulta,$link);
+ //$div = "div_tabla_campos";
+ $filtros = "
+
+
+
+ Seleccione
+ Todos
+ Mis campos
+ Mi empresa
+ Vacios
+ Llenos
+
+
+
+ ";
+ if (mysql_num_rows($sql)!='0'){
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $tipo_nombre = remplacetas_noid('form_tipo_campo','id_tipo_campo',"$row[campo_tipo]",'tipo_campo_nombre',"") ;
+ $campo_tipo ="
$tipo_nombre[0] ";
+ if($_SESSION['id_empresa'] == $row['id_empresa']) {
+ $row[campo_nombre]= editar_campo("form_campos","$row[id]","campo_nombre","","","");
+ $row[campo_descripcion]= editar_campo("form_campos","$row[id]","campo_descripcion","","","");
+ $row[campo_area]= editar_campo("form_campos","$row[id]","campo_area","","","");
+ $row[activo]= editar_campo("form_campos","$row[id]","activo","","","");
+ $accion = "
";
+ $class='success';
+ }else {
+ $class='';
+ $accion ="";
+ }
+ if($_SESSION['id'] == $row['id_especialista']) {
+ $row['id_especialista'] = "
$row[id_especialista]";
+ }
+
+ $lineas .= "
$row[id] $row[campo_nombre] $row[campo_descripcion] $campo_tipo $row[campo_area] $row[activo] $row[id_empresa] $row[id_especialista] $mio $accion ";
+ }
+ $tabla = "
+
+
+ id Nombre Descripcion Tipo
+ $lineas
+
+
+ ";
+ }
+ if($div !=""){
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$tabla");
+ return $respuesta;
+ }
+ else{
+ $resultado = "$filtros $tabla";
+ return $resultado;
+}
+}
+$xajax->registerFunction("campos_tabla");
+
+function remplacetas_noid($tabla,$campo,$valor,$por,$and){
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
+$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
+//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
+$sql=mysql_query($consulta,$link);
+if (@mysql_num_rows($sql)!=0){
+$resultado[] = mysql_result($sql,0,$por);
+$resultado[] = mysql_result($sql,0,"$campo");
+$resultado[] = $consulta;
+$resultado[] = mysql_result($sql,0,"md5_$por");
+ }else{
+ $resultado[0] = '';
+ $resultado[1] ="";
+ $resultado[2] = $consulta;
+ $resultado[3] = NULL;
+ }
+return $resultado;
+}
+
+
+
+function contar_visitas($id,$tipo) {
+$id_visitas = remplacetas('form_parametrizacion','campo',$id,'id'," tabla='form_id' AND opcion='$tipo'") ;
+$visitas = remplacetas('form_parametrizacion','id',$id_visitas[0],'descripcion',"") ;
+$cantidad = $visitas[0]+1;
+if($visitas[0] =="") {
+ $consulta = "INSERT INTO form_parametrizacion set tabla='form_id', campo ='$id',opcion ='$tipo',descripcion= '$cantidad',visible ='1'";
+ }
+else {
+ $consulta = "UPDATE form_parametrizacion set tabla='form_id', campo ='$id',opcion ='$tipo',descripcion= '$cantidad',visible ='1'
+ WHERE id ='$id_visitas[0]' LIMIT 1";
+}
+$link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $sql=mysql_query($consulta,$link);
+
+return $cantidad;
+}
+
+
+function geocoder($valor,$campo){
+$respuesta = new xajaxResponse('utf-8');
+if(strlen($valor) > 3) {
+$valor = urlencode($valor);
+$json = "https://nominatim.openstreetmap.org/search.php?format=json&limit=5&addressdetails=1&q=$valor";
+$data = file_get_contents("$json");
+$geocoder = json_decode($data, true);
+if($data ==="[]") {$vacio="
+
+
No se encontraron resultados
+";}
+
+foreach ($geocoder as $clave => $valor) {
+ $ciudad = $valor['address']['city'];
+ $municipio = $valor['address']['town'];
+ $pais = $valor['address']['country'];
+ $departamento = $valor['address']['state'];
+ $licencia= $valor['licence'];
+ $link = "$_SESSION[url]mapero.php?lat=$valor[lon]&lon=$valor[lat]&zoom=16&id=$campo";
+ $linea .= "
+
+
+ $valor[display_name]
+
+ $ciudad $municipio $pais $departamento
+
+
+
+ ";
+//foreach ($valor as $clave => $valor) { $linea .= "CLAVE : $clave > VALOR: $valor"; }
+}
+$resultado = "
+
+ $vacio $licencia
+
";
+}
+ //$div_contenido = "
$div
";
+ //$respuesta->addAssign("muestra_form","innerHTML","$aviso");
+ //$respuesta->addAssign("titulo_modal","innerHTML","Hola mundo");
+ //$respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addAssign("muestra_geocoder","innerHTML","$resultado");
+ //$respuesta->addscript("$('#muestraInfo').modal('toggle')");
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("geocoder");
+
+
+function mostrar_psi(){
+$respuesta = new xajaxResponse('utf-8');
+include("psi.php");
+ //$div_contenido = "
$div
";
+ $respuesta->addAssign("muestra_form","innerHTML","$aviso");
+ //$respuesta->addAssign("titulo_modal","innerHTML","Hola mundo");
+ //$respuesta->addAssign("pie_modal","innerHTML","$pie");
+ //$respuesta->addAssign("$div","innerHTML","$resultado");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("mostrar_psi");
+
+function multiempresa_crear($tabla,$formulario,$div) {
+$formulario = limpiar_caracteres($formulario);
+$link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ foreach($formulario as $c=>$v){
+
+ $valores .= " $c = '".mysql_real_escape_string($v)."',";
+ }
+ $valores = "$valores id_responsable = '$_SESSION[id]'";
+
+$respuesta = new xajaxResponse('utf-8');
+
+ $insertar = "INSERT INTO $tabla set $valores";
+ $sql=mysql_query($insertar,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+
+
+ }
+ $respuesta->addScript("javascript:xajax_multiempresa('empresa','$div')");
+ return $respuesta;
+}
+$xajax->registerFunction("multiempresa_crear");
+
+
+function multiempresa($tabla,$div){
+ if($_SESSION['id'] == 1) {
+ if($div =="") {
+ $div="contenido";
+ $resultado ="
Configuración multiempresa";
+ return $resultado;
+ }
+$link=Conectarse();
+
+mysql_query("SET NAMES 'utf8'");
+$id_empresa= $_SESSION['id_empresa'];
+$consulta = "SELECT * FROM empresa ";
+$sql=mysql_query($consulta,$link);
+
+$resultado="
+$name
+Id Nombre Sigla Email Web Dirección Teléfono
+ " ;
+if (mysql_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="";}else{$vacio =" >> Nuevo $descripcion << ";}
+
+$linea = 1;
+while( $row = mysql_fetch_array( $sql ) ) {
+$razon_social= editar_campo("empresa",$row['id'],"razon_social","","","");
+$sigla= editar_campo("empresa",$row['id'],"sigla","","","");
+$email= editar_campo("empresa",$row['id'],"email","","","");
+$web= editar_campo("empresa",$row['id'],"web","","","");
+$direccion= editar_campo("empresa",$row['id'],"direccion","","","");
+$telefono= editar_campo("empresa",$row['id'],"telefono","","","");
+$estado= editar_campo("empresa",$row['id'],"estado","","","");
+
+if($row[id] !=1) {$acciones = " Estado: $estado";}
+$resultado .= "$row[id] $razon_social $sigla $email $web $direccion $telefono $acciones ";
+$linea++;
+ }
+
+
+ }else{
+ $resultado = " No hay resultados
";
+ }
+
+$resultado .= "
+
+
Agregar empresa
+
+
+
+";
+//return $resultado;
+ //$respuesta = new xajaxResponse('utf-8');
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+ }
+}
+$xajax->registerFunction("multiempresa");
+
+
+
+
+
+
+function contar_valores_formulario($campo,$key,$valor){
+$consulta = "SELECT distinct($campo) as cantidad FROM form_datos WHERE $key LIKE '$valor' ";
+$link=Conectarse();
+mysql_query("SET NAMES 'UTF8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+$resultado = mysql_num_rows($sql);
+//$resultado = mysql_result($sql,0,"cantidad");
+}
+//$resultado .= " $consulta";
+return $resultado;
+}
+
+
+function listar_campos_formulario($id_form,$tipo){
+$consulta = "SELECT distinct(id_campo),campo_nombre FROM form_datos,form_campos WHERE form_id = '$id_form' AND form_datos.id_campo = form_campos.id ";
+$link=Conectarse();
+mysql_query("SET NAMES 'UTF8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+while( $row = mysql_fetch_array( $sql ) ) {
+ if($tipo=="nombres"){
+$resultado[] = "$row[campo_nombre]";}
+ elseif($tipo=="select"){
+ $option .= "
$row[campo_nombre] ";
+ }
+ else{
+//$resultado .= " $row[id_campo] ";
+$resultado[] = $row[id_campo];
+}
+}
+if($tipo=="select"){
+$resultado = "
+
+ Campo
+ $option
+ ";
+
+}
+//$resultado = mysql_result($sql,0,"cantidad");
+}
+//$resultado .= " $consulta";
+return $resultado;
+}
+
+
+//($formulario,$div,$registros,$pagina,$formato)
+function consultar_formulario($form,$registros,$pagina,$tipo){
+$respuesta = new xajaxResponse('utf-8');
+//if(is_array($form)) {$id_form = $form['id_form'];}else { $id_form = $form;}
+$id_empresa = $_SESSION[id_empresa];
+if(is_array($form)) {
+ $fecha_inicio = $form["inicio"];
+ if($fecha_inicio =="" ) { $fecha_inicio ="2000-01-01";}
+ $fin = $formulario["fin"];
+ if( $fin !="") { $fechas = " AND timestamp BETWEEN UNIX_TIMESTAMP('$fecha_inicio') AND UNIX_TIMESTAMP('$fin 23:59:59')";}
+ $id_form = $form['id_form'];
+ $id_campo = $form['id_campo'];
+ $busqueda = $form['busqueda'];
+if($busqueda !=''){$busca ="AND contenido LIKE '%%$form[busqueda]%%'";}else{$busca ='';}
+if($id_campo !=''){$campo ="AND id_campo = '$id_campo'";}else{$campo ='';}
+}else{
+$id_form = $form;
+}
+$consulta_principal = "SELECT control,id,form_id FROM form_datos WHERE form_id = '$id_form' AND form_datos.id_empresa = '$id_empresa' $busca $campo $fechas GROUP BY form_datos.control ORDER BY form_datos.id DESC ";
+$link=Conectarse();
+mysql_query("SET NAMES 'UTF8'");
+$sql_total=mysql_query($consulta_principal,$link);
+$total_registros = mysql_num_rows($sql_total);//formulario_contar($id_form);
+/// PAGINACION
+ if ($pagina =='') {$inicio = 0; $pagina = 1; }
+ else { $inicio = ($pagina - 1) * $registros;}
+ if($total_registros < $registros) { $limite ="";}
+ else{$limite =" LIMIT $inicio, $registros ";}
+ if($tipo == "csv" ) {$consulta_limite = "$consulta_principal";}
+ else{$consulta_limite = $consulta_principal.$limite;}
+ $sql=mysql_query($consulta_limite,$link);
+
+//$sql=mysql_query($consulta_principal,$link);
+if (mysql_num_rows($sql)!='0'){
+
+/////// FILTRO
+
+$fecha = time ();
+ $ahora = date ( "Y-m-d" , $fecha );
+ $campos = listar_campos_formulario($id_form,"select");
+ $peticion = "
+
+
+ ";
+/////// FILTRO
+
+$boton_borrar = "
+
+
+
+ ";
+
+ if($formato!='csv'){
+ $boton_exportar = "
Exportar ";}
+
+ $link = "";
+ // $page = $_GET['page'];
+ $page= $pagina;
+ $pages= ceil($total_registros / $registros); //13; // Hardcoded for testing purpose
+ $limit=10 ;
+ if ($pages >=1 && $page <= $pages)
+ {
+ $counter = 1;
+ $link = "";
+ if (($page -1) > 0) {
+ $link .= "
+
";
+ }
+
+ for ($x=$page; $x<=$pages;$x++)
+ {
+
+
+ if($counter < $limit){
+ if ($page == $x){
+ $link .= "
$x ";
+ }else{
+ $link .= "
$x ";
+ }
+ }
+ $counter++;
+ }
+ if ($page < ($pages - ($limit/2)))
+
+ { $link .= "
+
"; }
+ }
+
+ $paginacion = "";
+
+
+
+
+ $encabezado = "
+
";
+
+ $total_registros = mysql_num_rows($sql);
+ $nombres_campos = listar_campos_formulario("$id_form","nombres");
+ foreach($nombres_campos as $campo_nombre=>$nombre){
+ $listado_nombres .= "
$nombre ";
+ }
+ $listado_nombres = "
Identificador $listado_nombres ";
+$listado_campos = listar_campos_formulario("$id_form");
+
+while( $row = mysql_fetch_array( $sql ) ) {
+//$cantidad_campos = contar_valores_formulario("id_campo","control","$row[control]");
+
+$listado_campos = listar_campos_formulario("$id_form");
+
+foreach($listado_campos as $campo=>$valor){
+ $contenido = remplacetas('form_datos','control',$row[control],'contenido',"id_campo ='$valor' ") ;
+$listado_campos .= "
$contenido[0] ";
+
+ }
+ if (!is_array($listado_campos)){$listado_campos="
$listado_campos ";}else {$listado_campos=$listado_campos;}
+ $menu ="
+
+
+
+ ";
+$lineas .= "
$menu$row[control] $listado_campos ";
+
+ }
+
+$tabla ="
+
+ $listado_nombres
+
+ $lineas
+
+
";
+$resultado = "
+$encabezado
+
+
+
+$tabla
+
+
+";
+ }
+else {
+$resultado ="
No hay resultados $consulta_limite";
+$respuesta->addAlert("No hay resultados");
+return $respuesta;
+}
+if($tipo =="csv") {
+$html = str_get_html($tabla);
+ // header('Content-type: application/ms-excel');
+ // header('Content-Disposition: attachment; filename=sample.csv');
+ $nombre_archivo ="tmp/Prueba_Formulario_".mktime()."_".$_SESSION['id'].".csv";
+ //$fp = fopen("php://output", "w");
+ $fp=fopen($nombre_archivo , "w");
+ foreach($html->find('tr') as $element)
+ {
+ $td = array();
+ foreach( $element->find('th') as $row)
+ {
+ if (strpos(trim($row->class), 'actions') === false && strpos(trim($row->class), 'checker') === false) {
+ $td [] = $row->plaintext;
+ }
+ }
+ if (!empty($td)) {
+ fputcsv($fp, $td);
+ }
+
+ $td = array();
+ foreach( $element->find('td') as $row)
+ {
+ if (strpos(trim($row->class), 'actions') === false && strpos(trim($row->class), 'checker') === false) {
+ $td [] = $row->plaintext;
+ }
+ }
+ fputcsv($fp, $td);
+ }
+
+ fclose($fp);
+$boton_descarga ="
Descargar ";
+
+$datos ="$boton_descarga";
+}else {
+
+$datos = $resultado;
+}
+$div ="contenido_de_modal";
+$resultado = "
$datos
";
+ $div_contenido = "
$div
";
+ $respuesta->addAssign("muestra_form","innerHTML","$div_contenido");
+ //$respuesta->addAssign("titulo_modal","innerHTML","Hola mundo");
+ //$respuesta->addAssign("pie_modal","innerHTML","$pie");
+
+
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ if($tipo =="modal") {
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+}
+ return $respuesta;
+
+}
+$xajax->registerFunction("consultar_formulario");
+
+
+function datos_array($identificador) {
+
+$link=Conectarse();
+mysql_query("SET NAMES 'UTF8'");
+$consulta ="SELECT * FROM form_datos WHERE control = '$identificador'
+GROUP BY id_campo ORDER BY timestamp DESC ";
+$sql = mysql_query($consulta,$link) or die("error al ejecutar consulta ");
+$array = array();
+$array[identificador] = "$identificador";
+while($row = mysql_fetch_array( $sql ))
+ {
+ $contenido = remplacetas('form_datos','id',$row[id],'contenido',"") ;
+ $id_campo = remplacetas('form_datos','id',$row[id],'id_campo',"") ;
+ $nombre_campo = remplacetas('form_campos','id',$id_campo[0],'campo_nombre',"") ;
+ //$array[id_campo] = $row[id_campo];
+ $array[$nombre_campo[0]] = "$contenido[0]";
+ $array['timestamp'] = "$row[timestamp]";
+ $array['proceso'] = "$row[proceso]";
+ $array['id'] = "$row[id]";
+ $array['orden'] = "$row[orden]";
+ //$array[] = $row;
+
+
+ }
+ return $array;
+}
+
+function parametrizacion_linea($tabla,$campo,$opcion,$descripcion,$div){
+ $respuesta = new xajaxResponse('utf-8');
+
+
+ $link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$limpiar ="DELETE FROM `form_parametrizacion` WHERE tabla = '".mysql_real_escape_string($tabla)."' AND campo ='".mysql_real_escape_string($campo)."' AND opcion ='".mysql_real_escape_string($opcion)."' LIMIT 1 ";
+$sql=mysql_query($limpiar,$link);
+$consulta="INSERT INTO form_parametrizacion set tabla = '".mysql_real_escape_string($tabla)."' , campo ='".mysql_real_escape_string($campo)."', opcion ='".mysql_real_escape_string($opcion)."', descripcion ='".mysql_real_escape_string($descripcion)."', visible='1' ";
+$sql=mysql_query($consulta,$link);
+if($sql) {
+ $resultado = "
$descripcion";
+ $respuesta->addAssign("$div","innerHTML",$resultado);
+
+ }else {
+$respuesta->addAlert("$consulta");
+}
+//$respuesta->addAssign("confirmar_envio_email","innerHTML",$exito);
+return $respuesta;
+ }
+$xajax->registerFunction("parametrizacion_linea");
+
+function email_contenido($id,$control,$id_campo,$email_envio){
+
+if($email_envio =="") {
+ $email = remplacetas('form_datos','control',"$control",'contenido',"form_id = '$id' AND id_campo ='$id_campo' ") ;
+ $formulario =
+
+ "
+ ";
+return $formulario;
+ }
+ $respuesta = new xajaxResponse('utf-8');
+
+ $validar = validar_email($email_envio);
+ if($validar == '0') {
+ $respuesta->addAssign("input_email_envio","className"," input-group has-error ");
+ $respuesta->addScript("document.getElementById('email_envio').focus(); ");
+ $respuesta->addAlert("Se necesita un email válido");
+ return $respuesta;
+ }
+ $propietario = remplacetas('form_id','id',$id,'propietario',"") ;
+ $propietario = remplacetas('usuarios','id',$propietario[0],'email',"") ;
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa',"") ;
+ $id_empresa = $id_empresa[0];
+ $encabezado = empresa_datos("$id_empresa",'encabezado');
+ $direccion = remplacetas("empresa","id",$id_empresa,"direccion","");
+ $telefono = remplacetas("empresa","id",$id_empresa,"telefono","");
+ $web = remplacetas("empresa","id",$id_empresa,"web","");
+ $email = remplacetas("empresa","id",$id_empresa,"email","");
+ $imagen = remplacetas("empresa","id",$id_empresa,"imagen","");
+ $razon_social = remplacetas("empresa","id",$id_empresa,"razon_social","");
+ $slogan = remplacetas("empresa","id",$id_empresa,"slogan","");
+ $nombre_formulario = remplacetas("form_id","id",$id,"nombre","");
+
+
+$headers = "MIME-Version: 1.0\r\n";
+$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
+$headers .= "From: $razon_social[0] <$email[0]>\r\n";
+$headers .= "Reply-To: $email[0]\r\n";
+$headers .= "Return-path: $email[0]\r\n";
+$headers .= "Cc: $propietario[0]" . "\r\n";
+$impresion = formulario_imprimir("$id","$control","email");
+
+$impresion ="
+$encabezado
+$impresion
";
+$asunto= "[MILFS] $nombre_formulario[0]";
+$cuerpo ="
+$impresion
+Se ha completado el formulario $nombre_formulario[0]
+Puede revisar los datos en http://$_SERVER[HTTP_HOST]/milfs?id=$id&c=$control
+Saludos de MILFS
+";
+ if(mail("$email_envio","$asunto","$cuerpo","$headers")){ $exito .="Se envió un email a $email_envio "; }else {$exito .="error enviando correo";}
+
+$respuesta->addAssign("confirmar_envio_email","innerHTML",$exito);
+return $respuesta;
+ }
+$xajax->registerFunction("email_contenido");
+
+
+function mapa_ficha($id) {
+
+ $descripcion = remplacetas('form_id','id',$id,'descripcion') ;
+ $nombre = remplacetas('form_id','id',$id,'nombre') ;
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa') ;
+ $id_empresa = $id_empresa[0];
+ $direccion = remplacetas("empresa","id",$id_empresa,"direccion","");
+ $telefono = remplacetas("empresa","id",$id_empresa,"telefono","");
+ $web = remplacetas("empresa","id",$id_empresa,"web","");
+ $email = remplacetas("empresa","id",$id_empresa,"email","");
+ $imagen = remplacetas("empresa","id",$id_empresa,"imagen","");
+ $razon_social = remplacetas("empresa","id",$id_empresa,"razon_social","");
+ $slogan = remplacetas("empresa","id",$id_empresa,"slogan","");
+ $imagen = " ";
+ $datos ="$nombre[0] $descripcion[0] ";
+ $empresa = "$razon_social[0] |
$web[0] | $direccion[0] | $email[0]
";
+
+ //$prueba = json_decode($prueba);
+
+ $resultado ="
+
+
+
+
+ $imagen
+
+
+
$nombre[0]
+ $descripcion[0]
+
+
+
+
$razon_social[0]
+
MILFS
+
+
+
+ ";
+ return $resultado;
+}
+
+function formulario_parametrizacion($perfil,$accion,$div,$form){
+ $respuesta = new xajaxResponse('utf-8');
+$nombre = remplacetas('form_id','id',$perfil,'nombre') ;
+if($accion =='categorias') {
+
+ }
+ elseif($accion =='grabar'){
+
+ }
+ else {
+ $listado ="
+
+
+
+
+
+
Parametrización
+
Parametrización del formulario $nombre[0]. Por favor seleccione una opción
+
+
+
+
+ ";
+ $respuesta->addAssign($div,"innerHTML",$listado);
+ return $respuesta;
+ }
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta = "
+ SELECT md5(binary contenido) as md5_contenido, contenido FROM form_datos
+ WHERE form_id = '$perfil'
+ AND id_campo = '$campo'
+ GROUP BY contenido
+ ORDER BY contenido asc";
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+$resultado = "Filtro
+
+ Todos ";
+while( $row = mysql_fetch_array( $sql ) ) {
+$resultado .= " $row[contenido] ";
+ }
+$resultado .= " ";
+ }
+else{$resultado = 'nada';}
+
+if($div !="") {
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+ }else{return $resultado;}
+
+ }
+$xajax->registerFunction("formulario_parametrizacion");
+
+
+
+function lista_categorias($perfil,$categoria,$tipo) {
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+ $categoria_campo = remplacetas('form_parametrizacion','campo',$perfil,'descripcion'," tabla='form_id' and opcion = 'categoria:campo'") ;
+ $categoria_campo = $categoria_campo[0];
+ if($categoria_campo >0 ) {
+$consulta = "
+ SELECT md5(binary contenido) as md5_contenido, contenido FROM form_datos
+ WHERE form_id = '$perfil'
+ AND id_campo = '$categoria_campo'
+ GROUP BY contenido
+ ORDER BY contenido asc";
+
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+$resultado = "";
+while( $row = mysql_fetch_array( $sql ) ) {
+
+ $icono = remplacetas('form_parametrizacion','campo',$perfil,'descripcion'," tabla='form_id' and opcion = 'categoria:icon:$row[md5_contenido]'") ;
+ if($icono[0] =='') {
+ $icon = "https://raw.githubusercontent.com/humano/milfs/master/milfs/images/iconos/negro.png";
+ }else{
+
+ $icon = $icono[0];
+ }
+ $icono = "$icon";
+ $contenido= substr($row[contenido],0, $length = 15);
+$resultado .= "
$contenido ";
+ }
+$resultado .= "
";
+ }
+else{$resultado = '';}
+}
+return $resultado;
+}
+
+function parametrizacion_categoria($perfil,$accion,$div,$form){
+ $respuesta = new xajaxResponse('utf-8');
+$nombre = remplacetas('form_id','id',$perfil,'nombre') ;
+$categorias = lista_categorias($perfil,$categoria,$tipo);
+if($accion =='categorias') {
+ $resultado = "
+
+ La categorización se usa para filtrar los datos de un formulario en categorias que pueden ser usadas por ejemplo para diferenciar los datos en un mapa.
+ Es necesario que el formulario que se va a categorizar tenga multiples datos grabados en el campo que se categoriza
+ $categorias
+
+ ";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ $respuesta -> addScript("xajax_formulario_campos_select('$perfil','parametrizacion')");
+ return $respuesta;
+ }
+ elseif($accion =='grabar'){
+ if($form[tipo] =='categoria') {
+ $url_icon = "$form[icon]";
+ $es_imagen = es_imagen("$url_icon");
+ $altura = GetImageSize($url_icon);
+ $altura= $altura[1];
+ if($form[id_campo] =='') { $error = "Seleccione un campo";}
+ elseif($form[campo_filtro] =='') { $error = "Seleccione Filtro";}
+ elseif(!$es_imagen ) { $error = " [ $url_icon ] no es una imagen válida para el ícono";}
+ elseif($altura > 500 ) { $error = " El ícono no debe tener mas de 300 pixeles de alto.";}
+ elseif($form[icon] =='') {
+ $error = "Escriba la dirección del ícono";
+ }
+ else {$error='';}
+ if( $error !='') {
+ $respuesta -> addAlert("$error $revisar_url ");
+ return $respuesta;
+ }else{
+ $categoria_icono[tabla] = "form_id";
+ $categoria_icono[campo] = "$form[perfil]";
+ $categoria_icono[opcion] = "$form[tipo]:icon:$form[campo_filtro]";
+ $categoria_icono[descripcion] = "$url_icon";
+ $categoria_icono[visible] = "1";
+ $categoria_icono[accion] = "grabar";
+ $grabar_icono = parametrizacion($categoria_icono);
+
+ $categoria_campo[tabla] = "form_id";
+ $categoria_campo[campo] = "$form[perfil]";
+ $categoria_campo[opcion] = "$form[tipo]:campo";
+ $categoria_campo[descripcion] = "$form[id_campo]";
+ $categoria_campo[visible] = "1";
+ $categoria_campo[accion] = "grabar";
+ $grabar_campo = parametrizacion($categoria_campo);
+
+ $categoria_filtro[tabla] = "form_id";
+ $categoria_filtro[campo] = "$form[perfil]";
+ $categoria_filtro[opcion] = "$form[tipo]:filtro:$form[id_campo]";
+ $categoria_filtro[descripcion] = "$form[campo_filtro]";
+ $categoria_filtro[visible] = "1";
+ $categoria_filtro[accion] = "grabar";
+ $grabar_filtro = parametrizacion($categoria_filtro);
+
+
+ $resultado =" $form[campo_filtro] $form[id_campo] ($altura ) [$grabar_icono]";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+ }
+
+ }/// fin de parametrizacion categorias
+ }
+}
+$xajax->registerFunction("parametrizacion_categoria");
+
+
+function parametrizacion_plantilla_campos($formulario){
+$consulta ="SELECT * FROM form_campos ,form_contenido_campos WHERE form_campos.id = form_contenido_campos.id_campo AND form_contenido_campos.id_form = '$formulario' ORDER BY form_campos.campo_nombre";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!=0){
+$campo_imagen = buscar_campo_tipo($formulario,"15");
+$campo_imagen_nombre = $campo_imagen[1];
+$campo_imagen = $campo_imagen[0];
+while( $row = mysql_fetch_array( $sql ) ) {
+ if($row[id_campo] == $campo_imagen ) {$imagen =" "; $identificador=" ";}
+ else {$imagen=''; $identificador =" \$campo_limpio[$row[id_campo]] ";}
+$listado .= " $imagen $row[campo_nombre] [$row[id_campo]] ";
+
+}
+/*
+$campo_400[$row[id_campo]]
+ $campo_80[$row[id_campo]]
+ $campo_55[$row[id_campo]]
+*/
+$resultado = "
+
+
+";
+}
+return $resultado;
+}
+
+
+function parametrizacion_plantilla($formulario,$div,$valores) {
+ $respuesta = new xajaxResponse('utf-8');
+$campo_titulo = remplacetas('form_parametrizacion','campo',$formulario,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+$campo_titulo_nombre = remplacetas('form_campos','id',$campo_titulo[0],'campo_nombre',"") ;
+$link=Conectarse();
+$ultimo = formulario_uso("$formulario",'','ultimo') ;
+mysql_query("SET NAMES 'utf8'");
+if($valores =="boton") {
+$consulta ="SELECT * FROM form_parametrizacion WHERE campo = '$formulario' AND `opcion` REGEXP '^plantilla:' ORDER BY opcion";
+
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!=0){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+ $campos_opcion = explode(":",$row[opcion]);
+ $plantilla_nombre = $campos_opcion[1];
+$listado .= "$row[opcion] ";
+$li .= "
+ $plantilla_nombre
+
+
+
+ ";
+//mostrar_modal($form,$control,$plantilla)
+}
+$resultado = "
+
+
+
+";
+$lista ="
+
+
Las plantillas se usan para dar formato a los datos en el momento de presentarlos, se puede usar etiquetas HTML5 , CSS3 y clases de Bootstrap
+
+
+ Nombre
+ Editar
+ Ver
+
+$li
+
+
Nueva plantilla
+";
+ $respuesta->addAssign("$div","innerHTML","$lista");
+ return $respuesta;
+
+}
+else {
+
+$resultado ="
+
+
+
Aún no se han definido plantillas para este formulario
+ Crear una plantilla
+
+
+";
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+}
+}
+
+elseif($valores =="formulario" OR is_numeric($valores)) {
+ $campos = parametrizacion_plantilla_campos("$formulario");
+ $descripcion = remplacetas('form_parametrizacion','id',$valores,'descripcion',"") ;
+ $opcion = remplacetas('form_parametrizacion','id',$valores,'opcion',"") ;
+ $campos_opcion = explode(":",$opcion[0]);
+ $plantilla_nombre = $campos_opcion[1];
+ include("includes/bootsrap_class_list.php");
+$resultado ="
+
+
+";
+
+}
+
+elseif(is_array($valores)) {
+ $texto=str_replace('"',"'",$valores[text_contenedor]);
+$plantilla = htmlentities($texto);
+if($valores[nombre_plantilla] == "") {
+ $respuesta->addAlert("No ha especificado un nombre para la plantilla");
+ $respuesta->addAssign("input_nombre_plantilla","className","input-group has-error");
+ return $respuesta;
+ }
+$limpiar ="DELETE FROM `form_parametrizacion` WHERE tabla = 'form_id' AND campo ='$formulario' AND opcion ='plantilla:$valores[nombre_plantilla]' LIMIT 1 ";
+$sql=mysql_query($limpiar,$link);
+$consulta="INSERT INTO form_parametrizacion set tabla = 'form_id' , campo ='$formulario', opcion ='plantilla:$valores[nombre_plantilla]', descripcion =\"$plantilla\", visible='1' ";
+$sql=mysql_query($consulta,$link);
+$ultimo = formulario_uso("$formulario",'','ultimo') ;
+$datos = contenido_mostrar("$formulario","$ultimo[1]",'',"$valores[nombre_plantilla]");
+$preview = "
$valores[nombre_plantilla] $datos ";
+ $div_contenido = "
$preview
";
+ $respuesta->addAssign("muestra_form","innerHTML","$div_contenido");
+ $respuesta->addAssign("titulo_modal","innerHTML","$resultado");
+ $respuesta->addAssign("pie_modal","innerHTML","$pie");
+ //$respuesta->addAssign("$div","innerHTML","$resultado");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+
+
+ return $respuesta;
+
+}
+else{
+$resultado ="";
+}
+$resultado .= "";
+
+
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("parametrizacion_plantilla");
+
+
+function parametrizacion_titulo($formulario,$div,$valores) {
+$campo_titulo = remplacetas('form_parametrizacion','campo',$formulario,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+$campo_titulo_nombre = remplacetas('form_campos','id',$campo_titulo[0],'campo_nombre',"") ;
+$respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+if($valores =="") {
+$consulta ="SELECT * FROM form_campos ,form_contenido_campos WHERE form_campos.id = form_contenido_campos.id_campo AND form_contenido_campos.id_form = '$formulario' ORDER BY form_campos.campo_nombre";
+
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!=0){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+$listado .= "
$row[campo_nombre] [$row[id_campo]] ";
+}
+$resultado = "
+
+
El campo titulo, se usa como indice del formulario en algunas visualizaciones como el timeline
+
Campo de Título actual $campo_titulo_nombre[0] [$campo_titulo[0]]
+
+
+ Cambiar campo título
+
+
+ $listado
+
+
+
+";
+}
+}else {
+$limpiar ="DELETE FROM `form_parametrizacion` WHERE tabla = 'form_id' AND campo ='$formulario' AND opcion ='titulo' LIMIT 1 ";
+$sql=mysql_query($limpiar,$link);
+$consulta="INSERT INTO form_parametrizacion set tabla = 'form_id' , campo ='$formulario', opcion ='titulo', descripcion ='$valores', visible='1' ";
+$sql=mysql_query($consulta,$link);
+if($sql){
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$formulario,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+ $campo_titulo_nombre = remplacetas('form_campos','id',$campo_titulo[0],'campo_nombre',"") ;
+$resultado ="
addAssign("$div","innerHTML","$resultado");
+
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("parametrizacion_titulo");
+
+
+function mostrar_modal($form,$control,$plantilla){
+$respuesta = new xajaxResponse('utf-8');
+if( $control == "") {
+ $datos = formulario_areas($form,"");
+}else {
+$datos = contenido_mostrar("$form","$control",'',"$plantilla");
+}
+$div ="contenido_de_modal";
+
+$resultado = "
+
+ $datos
+
+
";
+ $div_contenido = "
$div
";
+ $respuesta->addAssign("muestra_form","innerHTML","$div_contenido");
+ //$respuesta->addAssign("titulo_modal","innerHTML","Hola mundo");
+ //$respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("mostrar_modal");
+
+function portal_filtro_cadena($formulario,$id_campo,$control,$div,$plantilla){
+$cadena = remplacetas('form_datos','control',"$control",'contenido',"form_id = '$formulario' AND id_campo ='$id_campo' ") ;
+$consulta ="SELECT * FROM form_campos ,form_datos
+ WHERE form_datos.form_id = '$formulario' AND form_campos.id = form_datos.id_campo AND form_datos.id_campo = '$id_campo' AND contenido = '$cadena[0]'
+ GROUP BY control ORDER BY contenido";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!=0){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+
+
+ $datos = contenido_mostrar("$formulario","$row[control]",'',"$plantilla");
+ if($plantilla == "") {
+$listado .= "
+";
+}else{$listado .= $datos; }
+}
+$resultado = "
+
+ $listado
+
+";
+}
+
+if ($div ==""){$div="mostrar_contenido";}
+else {$div = "$div";}
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+}
+$xajax->registerFunction("portal_filtro_cadena");
+
+
+
+function portal_filtro_campos($formulario,$id_campo,$div,$plantilla){
+$formulario_descripcion = remplacetas('form_id','id',"$formulario",'descripcion',"") ;
+$formulario_nombre = remplacetas('form_id','id',"$formulario",'nombre',"") ;
+$campo_nombre = remplacetas('form_campos','id',"$id_campo",'campo_nombre',"") ;
+$campo_descripcion = remplacetas('form_campos','id',"$id_campo",'campo_descripcion',"") ;
+
+$consulta ="SELECT * FROM form_campos ,form_datos WHERE form_datos.form_id = '$formulario' AND form_campos.id = form_datos.id_campo AND form_datos.id_campo = '$id_campo' GROUP BY contenido ORDER BY contenido";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!=0){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+$listado .= "
$row[contenido] ";
+}
+$resultado = "
+
+ $formulario_nombre[0] / $campo_nombre[0]
+ {json}
+ $listado
+
+";
+}
+return $resultado;
+}
+
+
+
+function portal_filtro_campos_select($formulario,$id_campo,$div,$plantilla){
+$formulario_descripcion = remplacetas('form_id','id',"$formulario",'descripcion',"") ;
+$formulario_nombre = remplacetas('form_id','id',"$formulario",'nombre',"") ;
+$campo_nombre = remplacetas('form_campos','id',"$id_campo",'campo_nombre',"") ;
+$campo_descripcion = remplacetas('form_campos','id',"$id_campo",'campo_descripcion',"") ;
+
+$consulta ="SELECT * FROM form_campos ,form_datos WHERE form_datos.form_id = '$formulario' AND form_campos.id = form_datos.id_campo AND form_datos.id_campo = '$id_campo' GROUP BY contenido ORDER BY contenido";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!=0){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+$listado .= "
$row[contenido] ";
+}
+$resultado = "
+
+ $campo_nombre[0]
+ $listado
+
+";
+}
+return $resultado;
+}
+
+
+
+function portal_listado_campos($formulario){
+$formulario_descripcion = remplacetas('form_id','id',"$formulario",'descripcion',"") ;
+$formulario_nombre = remplacetas('form_id','id',"$formulario",'nombre',"") ;
+$consulta ="SELECT * FROM form_campos ,form_contenido_campos WHERE form_campos.id = form_contenido_campos.id_campo AND form_contenido_campos.id_form = '$formulario' ORDER BY form_contenido_campos.orden";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!=0){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+$listado .= "
$row[campo_nombre] ";
+}
+$resultado = "
+
+
+ $formulario_nombre[0]
+ {json}
+ $listado
+
+
+";
+}
+return $resultado;
+}
+
+
+function portal_listado_formularios(){
+
+$consulta ="SELECT * FROM form_id WHERE publico = '1'";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!=0){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+$listado .= "
$row[nombre] ";
+}
+$resultado = "
+
+ Set de datos
+
+ ";
+}
+return $resultado;
+}
+
+
+function insertar_linea($tabla,$key,$campo,$valor,$control,$orden,$div){
+ $respuesta = new xajaxResponse('utf-8');
+ $key = limpiar_caracteres($key);
+ $valor = limpiar_caracteres($valor);
+ $ip = obtener_ip();
+ $ip = " INET_ATON('".$ip."') ";
+if($tabla =="form_datos") {
+$consulta = "INSERT INTO form_datos ( orden, timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
+ ( '$orden',UNIX_TIMESTAMP(),'$_SESSION[id]','$_SESSION[id_empresa]','$key',$ip ,'$control', '$campo' , '$valor')
+ ";
+
+}
+
+
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $sql=mysql_query($consulta,$link);
+
+if($div !='') {
+ //$respuesta->addAssign($div,"innerHTML","");
+
+ }
+
+ $respuesta->addAssign("$div","innerHTML","
El registro se insertó con éxito
");
+ return $respuesta;
+}
+$xajax->registerFunction("insertar_linea");
+
+
+function select_combo($id,$tabla,$campo_valor,$campo_descripcion,$tipo){
+
+$id_empresa= $_SESSION['id_empresa'];
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$Campo_descripcion = ucwords($campo_descripcion);
+$Campo_valor = ucwords($campo_valor);
+$nombre=$tabla."_".$campo_valor;
+$div=$nombre."_hijo";
+$combo = $id."_".$tabla;
+if($tipo!=''){
+$respuesta = new xajaxResponse('utf-8');
+$consulta ="SELECT $id , $campo_valor , $campo_descripcion FROM $tabla WHERE $campo_valor = '$tipo' AND id_empresa = '$id_empresa'";
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+$resultado .= "
$Campo_descripcion
+
";
+$resultado .= " Seleccione $Campo_descripcion ";
+while( $row = mysql_fetch_array( $sql ) ) {
+$resultado .= " $row[$campo_valor] $row[$campo_descripcion] ";
+ }
+$resultado .= " ";
+ }
+
+
+
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;}
+ELSE{ /// si no especifica $tipo
+$consulta ="SELECT $id , $campo_valor , $campo_descripcion FROM $tabla WHERE id_empresa = '$id_empresa' GROUP BY $campo_valor ";
+$sql=mysql_query($consulta,$link);
+///$Documento=mysql_result($grupo,0,"documento_numero");
+$resultado = "
$Campo_valor
+
";
+ $resultado .= " Seleccione $Campo_valor ";
+if (mysql_num_rows($sql)!='0'){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+ $explicacion= remplacetas('eapb','codigo',"$row[$campo_valor]",'nombre',"") ;
+$explicacion = $explicacion[0];
+$resultado .= "$row[$campo_valor] ";
+ }
+ }
+$resultado .= "
";
+ }/// FIN de $tipo no especifico
+
+return $resultado;
+}
+$xajax->registerFunction("select_combo");
+
+
+
+function crear_session ($form,$control) {
+
+$consulta = " SELECT distinct(id_campo),contenido FROM form_datos WHERE control = '$control' AND form_id = '$form' order by timestamp DESC ";
+$link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $sql = mysql_query($consulta,$link);
+ if (mysql_num_rows($sql)!=0){
+ $resultado ="
";
+ mysql_data_seek($sql, 0);
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $id_form = $row[form_id];
+ $campo_nombre = remplacetas('form_campos','id',$row[id_campo],'campo_nombre');
+ $nombre = strtolower( str_replace(' ','_',$campo_nombre[0]));
+ $_SESSION[$nombre] = $row[contenido];
+ $resultado .= "$_SESSION[$nombre] ";
+ }
+ $resultado .= " ";
+ }
+return $resultado ;
+}
+
+function mostrar_identificador($control,$form){
+ if($form != "") {$id_form = "$form";}
+/*$consulta = " SELECT distinct(form_id) FROM form_datos WHERE control = '$control' ";
+$link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $sql = mysql_query($consulta,$link);
+ if (mysql_num_rows($sql)!=0){
+ $session = crear_session ('16',$control);
+ $resultado ="$session
";
+ mysql_data_seek($sql, 0);
+ //while( $row = mysql_fetch_array( $sql ) ) {
+ $id_form = $row[form_id];*/
+ $impresion = formulario_imprimir("$id_form","$control","");
+ if($impresion !="") {
+ $visitas= contar_visitas($control,'identificador') ;
+ $descripcion = remplacetas('form_id','id',$id_form,'descripcion',"") ;
+ $nombre = remplacetas('form_id','id',$id_form,'nombre',"") ;
+ $resultado .= "$visitas
$nombre[0] $descripcion[0] $impresion
";
+ // }
+$resultado = "
$resultado
";
+ }else{
+$resultado ="
No hay resultados ";
+ }
+
+ // }
+return $resultado ;
+}
+
+function buscar_campo_nombre($form_id,$nombre) {
+
+$consulta ="SELECT form_campos.id FROM `form_campos` , form_contenido_campos WHERE `campo_nombre` = '$nombre' AND form_campos.id = form_contenido_campos.id_campo AND form_contenido_campos.id_form ='$form_id' LIMIT 1";
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $sql = mysql_query($consulta,$link);
+ $id_campo=mysql_result($sql,0,"id");
+return $id_campo;
+}
+
+function conversorSegundosHoras($tiempo_en_segundos) {
+ $horas = floor($tiempo_en_segundos / 3600);
+ $minutos = floor(($tiempo_en_segundos - ($horas * 3600)) / 60);
+ $segundos = $tiempo_en_segundos - ($horas * 3600) - ($minutos * 60);
+
+ return $horas . ':' . $minutos . ":" . $segundos;
+}
+
+function mensajes($tipo,$campos_form,$datos,$control) {
+ $campo_remitente = $campos_form['remitente'];
+ $campo_destinatario = $campos_form['destinatario'];
+ $campo_asunto = $campos_form['asunto'];
+ $campo_mensaje = $campos_form['mensaje'];
+ $form_id = $campos_form['formulario_id'];
+ $form_usuarios = $campos_form['formulario_usuarios'];
+ $campo_usuarios = $campos_form['campo_usuario'];
+$respuesta = new xajaxResponse('utf-8');
+if($tipo =='formulario') {
+ if($form_id =='' AND $control !='') {
+$form_id = remplacetas('form_datos','control',"$control",'form_id',"") ;
+$form_id = $form_id[0];
+
+ }
+
+//$campos = formulario_areas($form_id,'campos');
+$control_original = $control;
+if($control =="") {
+ $control = md5(rand(1,99999999).microtime());
+}
+ $campos = formulario_areas($form_id,'campos');
+$formulario ="
+
+
+
+
+
+
+$campos";
+
+$formulario ="
+
+
+
+
+ $formulario
+
+
+
+
+
+
";
+ $respuesta->addAssign("div_mensaje_$control_original","innerHTML",$formulario);
+ //$respuesta->addAlert("div_mensaje_$control_original","innerHTML",$formulario);
+return $respuesta;
+
+}
+elseif($tipo =='responder') {
+ if($form_id =='' AND $control !='') {
+$form_id = remplacetas('form_datos','control',"$control",'form_id',"") ;
+$form_id = $form_id[0];
+
+ }
+ $remitente = buscar_campo_nombre("$form_id","Para");
+ $destinatario = buscar_campo_nombre("$form_id","De");
+ $mensaje = buscar_campo_nombre("$form_id","Mensaje");
+ $asunto = buscar_campo_nombre("$form_id","Asunto");
+
+ $asunto_value = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$asunto' AND control='$control'") ;
+ $mensaje_value = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$mensaje' AND control='$control'") ;
+ $remitente_value = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$remitente' AND control='$control'") ;
+ $destinatario_value = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$destinatario' AND control='$control'") ;
+
+$formulario ="
+
+
+
+
+
+
+
+
+ Asunto
+
+
+
+ Mensaje
+ $mensaje_value[0]
+
+ ";
+
+$formulario ="
+
+
+
+
+ $formulario
+
+
+
+
+
+
+";
+ $respuesta->addAssign("div_mensaje_$control","innerHTML",$formulario);
+ //$respuesta->addAlert("div_mensaje_$control_original","innerHTML",$formulario);
+return $respuesta;
+
+}
+elseif($tipo=="recuperar") {
+
+if($control =="") {
+ $control = md5(rand(1,99999999).microtime());
+}
+
+ $consulta ="SELECT *, FROM_UNIXTIME(timestamp) as fecha , DATE_FORMAT(FROM_UNIXTIME(timestamp),'%Y-%m-%d') as dia, DATE_FORMAT(FROM_UNIXTIME(timestamp),'%H:%i') as hora FROM form_datos WHERE form_id ='$form_id' AND id_campo = '$campo_destinatario' AND contenido ='$_SESSION[usuario_milfs]' GROUP BY control, timestamp order by timestamp DESC ";
+
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+
+ $mensajes = mysql_query($consulta,$link);
+// $destinatario ="$campo_destinatario"."[0]";
+// $para = buscador_campo("$campo_destinatario","$form_id","","$destinatario","","");
+ $campos = formulario_areas($form_id,'campos');
+$formulario ="
+
+
+
+
+
+
+$campos";
+
+$formulario ="
+
+
+
+
+ $formulario
+
+
+
+
+
+
";
+
+
+
+$lista ="
+
+
+
+";
+while( $row = mysql_fetch_array( $mensajes ) ) {
+ $asunto = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$campo_asunto' AND control='$row[control]'") ;
+ $mensaje = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$campo_mensaje' AND control='$row[control]'") ;
+ $remitente = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$campo_remitente' AND control='$row[control]'") ;
+ $remitente = remplacetas('form_datos','form_id',"$form_usuarios",'contenido'," id_campo = '$campo_usuarios' AND control='$remitente[0]'") ;
+ if($remitente[0] =='') {$remitente[0]="
Sistema";}
+ $hoy=date('Y-m-d');
+ $control = $row[control];
+ if($hoy == $row[dia]){$momento = $row[hora];}else {$momento=$row[dia];}
+//function contenido_mostrar($id,$control,$div,$plantilla)
+//$contenido = contenido_mostrar("$form_id","$control","",'');
+ $lista .="
+
+ ";
+}
+ // $respuesta->addAssign("div_mensaje","innerHTML",$lista);
+ $lista .=" ";
+ return $lista;
+
+}
+
+$resultado ="hola";
+
+ $respuesta->addAssign("div_mensaje","innerHTML",$resultado);
+
+ return $respuesta;
+
+
+}
+$xajax->registerFunction("mensajes");
+
+function revisar_campo_unico($id,$campo,$id_form,$valor) {
+ $respuesta = new xajaxResponse('utf-8');
+ $div= "div_$id";
+ $existe = remplacetas('form_datos','form_id',"$id_form",'control'," BINARY contenido = '$valor' AND id_campo = '$campo'") ;
+ if($existe[0] != "") {
+ $texto ="El valor ya existe";
+$respuesta->addAssign("$div","className","text-danger");
+$respuesta->addAssign("input_$id","className","form-group has-error");
+ }else{
+ $texto ="";
+$respuesta->addAssign("$div","className","text-success");
+$respuesta->addAssign("input_$id","className","form-group has-success");
+ }
+
+ $respuesta->addAssign("$div","innerHTML",$texto);
+ return $respuesta;
+}
+$xajax->registerFunction("revisar_campo_unico");
+
+
+
+function milfs_session($form_id,$campo_usuario,$campo_password,$tipo,$datos){
+ $datos = mysql_seguridad($datos);
+ $respuesta = new xajaxResponse('utf-8');
+
+if($tipo =="") {
+
+
+
+if($_SESSION[usuario_milfs]) {
+ $formulario = "
SALIR";
+}else {
+$formulario ="
+$accion
+
+
+
+";
+
+
+}
+return $formulario;
+}
+elseif($tipo =='salir') {
+ session_destroy();
+ $respuesta->addScript("javascript:location.reload(true);");
+
+}
+elseif($tipo=='registrarse') {
+ $modificable = remplacetas('form_id','id',$id,'modificable') ;
+ if($modificable[0] != "1" and (!isset ( $_SESSION[id]) )) {
+ $formulario = "
Función no disponible, por favor comuníquese con el administrador
";
+ $respuesta->addAssign("formulario_session","innerHTML",$formulario);
+ return $respuesta;
+
+ }
+$campos = formulario_areas($form_id,'campos');
+
+$boton ="
+
+Registrarse
+";
+$control = md5(rand(1,99999999).microtime());
+ $formulario ="
+
+
+$campos
+$boton
+
+
+";
+
+ $respuesta->addAssign("formulario_session","innerHTML",$formulario);
+
+
+}
+elseif($tipo=='recuperar') {
+
+ if($datos =="") {
+//$campos = formulario_areas($form_id,'campos');
+$campos ="
+
+
Usuario
+
+
+
Código de recuperación Deja este campo vacío si aun no tienes el código de recuperación
+
+
+";
+$boton ="
+
Solicitar clave
+";
+$control = md5(rand(1,99999999).microtime());
+ $formulario ="
+
+
+$campos
+
+$boton
+
+
+
+";
+ }else{
+
+ $usuario = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$datos[usuario]' AND id_campo = '$campo_usuario'") ;
+ if($usuario[0] !="") {
+ $password = remplacetas('form_datos','control',"$usuario[0]",'contenido'," id_campo = '$campo_password' ") ;
+ if($datos[codigo] !="") {
+ if( $datos[codigo] =="$password[0]" ){
+ $control = remplacetas('form_datos','control',"$usuario[0]",'control'," id_campo = '$campo_password' ") ;
+ $campos ="
+
+
+
+
+
+
+
+ ";
+
+ $formulario ="$campos";
+ $respuesta->addAssign("formulario_session","innerHTML",$formulario);
+ return $respuesta;
+
+
+ }else {
+ $respuesta->addAlert("El código no es correcto, por favor rectifíquelo o solicítelo nuevamente dejando el campo VACIO");
+ return $respuesta;
+ }
+ }
+ $campo_email = buscar_campo_tipo("$form_id","12");
+ $usuario = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$datos[usuario]' AND id_campo = '$campo_usuario'") ;
+ $email = remplacetas('form_datos','control',"$usuario[0]",'contenido'," id_campo = '$campo_email[0]' ") ;
+ $formulario="$usuario[0] $password[0] // $campo_email[0] $email[0]";
+ $email_empresa = remplacetas('empresa','id','1','email','') ;
+ $sigla = remplacetas('empresa','id','1','sigla','') ;
+ $razon_social = remplacetas('empresa','id','1','razon_social','') ;
+ $headers = "MIME-Version: 1.0\r\n";
+ $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
+ $headers .= "From: $razon_social[0] <$email_empresa[0]>\r\n";
+ $headers .= "Reply-To: $email_empresa[0]\r\n";
+ $headers .= "Return-path: $email_empresa[0]\r\n";
+ $asunto= "[ $sigla[0] ] Código para recuperar contraseña ";
+ $cuerpo ="
+
Hola $datos[usuario]
+ El código para recuperar tu contraseña es:
+
$password[0]
+ Regresa pronto :-)
+
+ ";
+ if(mail("$email[0]","$asunto","$cuerpo","$headers")){ $formulario ="
Te hemos enviado un correo a $email[0] con el código de recuperación "; }
+ else {$formulario ="
Error enviando correo ";}
+
+ }else{
+
+ $formulario="
No pudimos encontrar tu usuario $datos[usuario] . Por favor rectifícalo y prueba nuevamente ";
+ }
+
+
+ }
+ $respuesta->addAssign("formulario_session","innerHTML",$formulario);
+
+
+}
+elseif($tipo=='confirmar_recuperar') {
+
+ if($datos[password] != $datos[confirmar_password]) {
+ $respuesta->addAlert("Los valores no son iguales");
+ return $respuesta;
+
+ }
+ $link=Conectarse();
+
+mysql_query("SET NAMES 'utf8'");
+
+
+
+
+ $consulta="UPDATE form_datos SET contenido = MD5('$datos[password]')
+ WHERE control ='$datos[control]'
+ AND contenido ='$datos[codigo]'
+ AND form_id ='$form_id'
+ AND id_campo = '$campo_password' ";
+
+ if (mysql_query($consulta,$link)){
+$resultado ="
Se cambió el password Por favor ingrese con sus nuevos datos
aquí ";
+$respuesta->addAssign("login_div","innerHTML",$resultado);
+return $respuesta;
+ };
+
+
+
+}
+
+elseif ($tipo=='ingreso'){
+
+ $usuario = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$datos[usuario]' AND id_campo = '$campo_usuario'") ;
+ $password = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = MD5('$datos[password]') AND id_campo = '$campo_password'") ;
+
+if ( $usuario[0] != "" AND $usuario[0] === $password[0]) {
+$respuesta->addAssign("login_milfs","className"," has-success ");
+$resultado ="$usuario[0] // $password[0] ";
+$_SESSION[usuario_milfs] = $usuario[0];
+$_SESSION[nombre_usuario_milfs] = $datos['usuario'];
+$respuesta->addScript("javascript:location.reload(true);");
+}else {$resultado ="
Error Los datos no son correctos :( ";
+$respuesta->addAssign("login_milfs","className"," has-error ");
+}
+
+$respuesta->addAssign("resultado","innerHTML",$resultado);
+//$respuesta->addAlert("resultado");
+
+
+}
+elseif ($tipo=='nuevo'){
+
+$usuario = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$datos[usuario]' AND id_campo = '$campo_usuario'") ;
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+
+$campos_consulta_obligatorio="
+ SELECT id_campo, obligatorio
+ FROM form_contenido_campos
+ WHERE id_form ='$form_id'
+ AND obligatorio='1'
+ ";
+
+
+ $campos_obligados= mysql_query($campos_consulta_obligatorio,$link);
+
+while( $row = mysql_fetch_array( $campos_obligados ) ) {
+$campo_valor=$datos[$row[id_campo]][0];
+
+if($row[obligatorio]=='1'){
+ $obligatorios .= "$row[id_campo]";
+if($campo_valor == '' && $row[obligatorio]=='1'){
+ $campo_nombre = remplacetas('form_campos','id',$row[id_campo],'campo_nombre');
+$error = "Revise campos obligatorios $campo_nombre[0]";
+
+ }else {$error ="";}
+if($error !=''){
+$respuesta->addAlert($error);
+$respuesta->addScript(" document.getElementById('boton_registro').disabled=false");
+ return $respuesta; }
+ }
+
+
+ }/// fin de registros obligatorios
+
+
+
+ $campos_consulta="
+ SELECT id_campo, obligatorio, id_empresa
+ FROM form_contenido_campos
+ WHERE id_form ='$form_id'
+
+ ";
+ $campos= mysql_query($campos_consulta,$link);
+$ip = obtener_ip();
+$control = $datos['control'];
+while( $row = mysql_fetch_array( $campos ) ) {
+$campo_valor=$datos[$row['id_campo']][0];
+$campo_tipo = remplacetas('form_campos','id',$row['id_campo'],'campo_tipo','');
+/// Si el campo es password (18) se guarda su equivalente en md5
+if($campo_tipo[0] =="18") {
+ $campo_valor = MD5("$campo_valor");
+}
+if($campo_tipo[0] =="19") {
+$existe = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$campo_valor' AND id_campo = '$row[id_campo]'") ;
+if($existe[0] !='') {
+$respuesta->addAlert("Revise los campos únicos !");
+$respuesta->addScript(" document.getElementById('boton_registro').disabled=false");
+
+
+ return $respuesta;
+}else{
+//$respuesta->addAlert("$existe[2]"); return $respuesta;
+}
+}
+
+ if ($campo_valor !=''){
+
+$insertar_consulta = "
+ INSERT INTO `form_datos`
+ SET
+ id_campo = '$row[id_campo]',
+ contenido = '$campo_valor',
+ control ='$control',
+ timestamp = UNIX_TIMESTAMP(),
+ form_id = '$form_id',
+ ip = '$ip',
+ id_empresa = '$row[id_empresa]'
+ ";
+
+
+ }else{
+
+
+ }
+
+if ($error ==''){
+$sql_consulta=mysql_query($insertar_consulta,$link);
+if($sql_consulta){
+$login = milfs_session("$form_id","$campo_usuario","$campo_password","","");
+$resultado ="
Gracias por registrarse, por favor ingrese con los nuevos datos. $login
";
+
+
+ }else{$resultado.= "
La consulta no se grabó
";}
+}else { }
+
+ }
+ $resultado ="
Gracias por registrarse, por favor ingrese con los nuevos datos. $login
";
+$respuesta->addAssign("login_div","innerHTML",$resultado);
+return $respuesta;
+
+
+}
+
+else{}
+return $respuesta;
+
+}
+$xajax->registerFunction("milfs_session");
+
+
+function buscar_datos($valores,$id_form,$plantilla,$div){
+ $valores = mysql_seguridad($valores);
+ if (is_array($valores) ){
+ $valor = $valores['valor'];
+ }
+ else {$valor=$valores;}
+if($valor =='') {
+$resultado="
+
+";
+return $resultado;
+ }else{
+if($id_form !="") {$w_form ="form_id = '$id_form' AND ";}
+$consulta ="SELECT * FROM form_datos WHERE $w_form contenido like '%%$valor%%' group by control LIMIT 200 ";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!=0){
+mysql_data_seek($sql, 0);
+$fila=1;
+$divider=3;
+$cols = (12/$divider);
+$i =0;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($i % $divider==0) {
+
+ $encontrados .= "
+
+
+
+ ";
+ }
+ $i++;
+ /* $contenido = htmlentities($row[contenido]);
+ $p = stripos($contenido, $valor);
+ $s1 = substr($contenido, 0, $p);
+ $s2 = substr($contenido, $p, strlen($valor));
+ $s3 = substr($contenido, ($p + strlen($valor)));
+ $r = $s1."
$s2 ".$s3;
+ */
+ $datos = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+ $contenido ="
$datos
";
+
+ $encontrados .="$contenido";
+ $fila++;
+ if( $i % $divider==0) {
+ $encontrados .= "
";
+ }
+ }
+ }
+$resultado .="
Resultados de: $valor $encontrados ";
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign("$div","innerHTML",$resultado);
+ return $respuesta;
+
+ }
+}
+$xajax->registerFunction("buscar_datos");
+
+function datos_grid($id_form,$filtro,$valor,$plantilla,$divider,$inicio,$limite) {
+ $respuesta = new xajaxResponse('utf-8');
+ $nuevo_inicio = ($inicio+$limite+1);
+if($inicio =="") {
+ $inicio = "0";
+ $script = "
+$(window).scroll(function() {
+ if ($(window).scrollTop() == $(document).height() - $(window).height()) {
+ xajax_datos_grid('$id_form','$filtro','$valor','$plantilla','$divider','$nuevo_inicio','$limite') ;
+ }
+});
+";
+//$respuesta->addScript("$script");
+//$respuesta->addAlert("$script");
+
+ }
+if($limite =="") {$limite = "250";}
+
+ if($valor !=""){
+$md5_valor = $valor;
+if($filtro !='' ){$w_filtro =" AND id_campo = '$filtro' AND md5(binary contenido) = '$md5_valor' ";}
+}
+$consulta_total= "SELECT * FROM form_datos WHERE form_id= '$id_form' $w_filtro GROUP BY control ";
+$consulta= "SELECT * FROM form_datos WHERE form_id= '$id_form' $w_filtro GROUP BY control LIMIT $inicio , $limite";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+//mysql_real_escape_string($consulta);
+$sql_total=mysql_query($consulta_total,$link);
+$total = mysql_num_rows($sql_total);
+$sql=mysql_query($consulta,$link);
+ $descripcion = remplacetas('form_id','id',$id_form,'descripcion',"") ;
+ $descripcion = $descripcion[0];
+ $buscador = buscar_datos("","$id_form","$plantilla","grid_resultado");
+ $contenido = "$descripcion";
+
+if (mysql_num_rows($sql)!=0){
+mysql_data_seek($sql, 0);
+$fila=1;
+if($divider =="") {
+$divider=3;
+}
+$cols = (12/$divider);
+$i =0;
+
+while( $row = mysql_fetch_array( $sql ) ) {
+ if($i % $divider==0) {
+
+ $contenido .= "
+
+
+
+ ";
+ }
+ $i++;
+$datos = contenido_mostrar("$id_form","$row[control]",'',"$plantilla");
+$contenido .="
$datos
";
+$fila++;
+ if( $i % $divider==0) {
+ $contenido .= "
";
+ }
+
+}
+ }
+
+
+$inicio = ($inicio+$limite+1);
+$div_mas_contenido ="mas_contenido_".$inicio."_".$limite."";
+$mostrado = ($inicio+$limite-1);
+//$limite = ($inicio+$limite-1);
+$resultado ="
$buscador
+
+
+
+ $contenido
+
+ Mostrar mas resultados
+
+ ";
+
+
+///$respuesta->addScript("$script");
+$respuesta->addAssign("contenedor","innerHTML",$resultado);
+ return $respuesta;
+}
+$xajax->registerFunction("datos_grid");
+
+
+function insertar_registro($tabla,$formulario,$div,$principal) {
+ //$valores ="$formulario[0]";
+ $formulario = limpiar_caracteres($formulario);
+ foreach($formulario as $c=>$v){
+
+ $valores .= " $c = '$v',";
+ }
+ $valores = "$valores id_empresa = '$_SESSION[id_empresa]'";
+
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $insertar = "INSERT INTO $tabla set $valores";
+// $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' limit 1; ";
+ $sql=mysql_query($insertar,$link);
+ $ultimo_id = mysql_insert_id();
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ $valores = limpiar_caracteres("$valores");
+ $grupo = editar_campo("$tabla",$ultimo_id,"$principal","","","");
+ $respuesta->addAssign($div,"innerHTML","
$formulario[$principal] ");
+
+ }
+ //$respuesta->addAlert("$insertar");
+//$areas = tabla_areas('form_areas','id','nombre,descripcion,estado,orden','',"",'Areas','');
+ //$respuesta->addScript("javascript:xajax_tabla_areas('form_areas','id','nombre,descripcion,estado,orden','','','Areas','div_campos')");
+ //$respuesta->addAssign("contenido","innerHTML","$insertar");
+ return $respuesta;
+}
+$xajax->registerFunction("insertar_registro");
+
+
+
+function formulario_area_campos($perfil,$area) {
+ $id_empresa= $_SESSION['id_empresa'];
+ $campos= "";
+
+$consulta = "
+ SELECT * FROM form_campos , form_contenido_campos
+ WHERE form_contenido_campos.id_form = '$perfil'
+ AND form_contenido_campos.id_campo = form_campos.id
+ AND campo_area='$area'
+ ORDER BY form_contenido_campos.orden";
+
+ $link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+
+
+ mysql_data_seek($sql, 0);
+ while( $row = mysql_fetch_array( $sql ) ) {
+ if( $row[obligatorio] == '1'){$obligatorio="*";}else {$obligatorio='X';}
+
+ if($row[campo_tipo] =="24") { $row[multiple] = "1";}
+ if($row[multiple] ==='1' AND $tipo =='edit'){
+ $campos .= formulario_campos_render_multiple($row[id_campo],$perfil,$control_edit);
+ }else{
+ $campos .= formulario_campos_render($row[id_campo],$perfil,$control_edit,'');
+ }
+ $muestra_form .= "$campos $obligatorio ";
+ $solo_campos .= "$campos $obligatorio ";
+
+ }
+
+
+}
+
+
+$resultado = "$muestra_form";
+ return $campos;
+
+}
+
+function formulario_areas($perfil,$tipo){
+ // $tipo ="embebido";
+ if(func_get_arg(2)=='respuesta'){$control =func_get_arg(3);}else{
+$control = md5(rand(1,99999999).microtime());
+}
+ $respuesta = new xajaxResponse('utf-8');
+ $id_empresa= $_SESSION['id_empresa'];
+ /*$consulta = "SELECT * FROM form_areas, form_campos, `form_contenido_campos`
+ WHERE form_campos.id = form_contenido_campos.id_campo
+ AND form_contenido_campos.id_form = '$perfil'
+ AND form_areas.id = form_campos.campo_area AND form_areas.id_empresa = '$id_empresa'
+ OR (form_contenido_campos.id_form = '$perfil' AND form_campos.campo_area ='0' )
+ AND form_areas.estado = '1' GROUP BY form_areas.id ORDER BY form_areas.orden";
+ */
+ $consulta= "SELECT * FROM form_campos, `form_contenido_campos`
+ WHERE form_campos.id = form_contenido_campos.id_campo
+ AND form_contenido_campos.id_form = '$perfil'
+
+ GROUP BY form_campos.campo_area
+ ";
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+ mysql_data_seek($sql, 0);
+ //$campo_titulo = remplacetas('parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+ $nombre = remplacetas('form_id','id',$perfil,'nombre','') ;
+ $descripcion = remplacetas('form_id','id',$perfil,'descripcion','') ;
+ $formulario_respuesta = remplacetas('form_id','id',$perfil,'formulario_respuesta','') ;
+ $empresa = remplacetas('form_id','id',$perfil,'id_empresa','') ;
+ $empresa = $empresa[0];
+
+ $nombre= strtoupper($nombre[0]);
+ $descripcion= $descripcion[0];
+ $respuesta= $formulario_respuesta[0];
+
+
+//// encabezado form
+
+ if($respuesta !='' AND $control !=''){$control =$control;}
+ else{$control = md5(rand(1,99999999).microtime());}
+ //$descripcion=mysql_result($sql,0,"descripcion");
+ //$nombre=mysql_result($sql,0,"nombre");
+ //$empresa=mysql_result($sql,0,"id_empresa");
+ $encabezado = empresa_datos("$empresa",'encabezado');
+ $pie = empresa_datos("$empresa",'pie');
+ $cabecera = "
+
+
+
+
+
+
+
$nombre$descripcion
+
+
+
+
";
+
+$campo_imagen = buscar_campo_tipo($perfil,"15");
+$campo_imagen_nombre = $campo_imagen[1];
+$campo_imagen_nombre = ucwords($campo_imagen_nombre);
+$campo_imagen = $campo_imagen[0];
+
+
+if ($campo_imagen[0] != "") {
+$subir_imagen = subir_imagen("$perfil","$campo_imagen"."[0]");
+if($tipo != "campos") {
+ $imagen = "
+
+ ";
+
+ }else {$imagen =" ";}
+ }
+
+ $muestra_form = "
+
+
+
+
+
+
+
+
+ ";
+ if($tipo=="edit") {$control_edit = "$control";}else {$control_edit = "";}
+
+
+////fin encabezado form
+
+
+$fila=0;
+while( $row = mysql_fetch_array( $sql ) ) {
+
+ if($row['campo_area']=="0"){$area_nombre ="";}
+ else{
+ $area_nombre = remplacetas('form_areas','id',$row['campo_area'],'nombre','') ;
+ $area_nombre = $area_nombre[0];
+ }
+ $fila = $fila +1;
+ if ($fila %2 == 0){$bg='LightCyan';}else{ $bg='FFFFFF';}
+ //$producto = remplacetas('farmacia_cum','id',$row[id_producto],'fabricante_importador') ;
+ ///// para pasar el parametro de medicamentos al formulario no pos se adiciona ".func_get_arg(2)."
+ $campos = formulario_area_campos($perfil,$row['campo_area']);
+$resultado_campos .= "$area_nombre
+$campos
+ ";
+ }
+
+
+//// botonera form
+
+$muestra_form .="$resultado_campos
+
+ ";
+
+//// fin botonera form
+
+ }
+
+//// cierre form
+
+$muestra_form .="
+
+
+
";
+if($tipo=='campos') {
+
+ $resultado = "$resultado_campos $imagen ";
+ return $resultado;
+}
+if($tipo=='embebido') {
+$resultado = "
+$muestra_form
+
Poweredy by MILFS
+
Políticas de privacidad y protección de datos.
+";
+return $resultado;
+
+}
+
+$resultado = "
+$cabecera
+$muestra_form
+
Poweredy by MILFS
+
Políticas de privacidad y protección de datos.
+
+";
+return $resultado;
+
+/// fin cierre form
+ // $resultado .= "$consulta";
+//$respuesta->addAssign($div,"style.display","block");
+//$respuesta->addAssign($div,"innerHTML",$resultado);
+//return $respuesta;
+ //print $muestra_form;
+// return $muestra_form;
+ }
+
+ $xajax->registerFunction("formulario_areas");
+
+
+
+function tabla_areas($tabla,$value,$descripcion,$onchange,$where,$nombre,$div){
+
+ if($div =="") {
+ $div="div_campos";
+ $resultado = "
+
Modificar areas
+ ";
+ return $resultado;
+ }
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+$campo1 = $campos[0];
+$campo2 = $campos[1];
+$campo3 = $campos[2];
+$campo4 = $campos[3];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysql_query("SET NAMES 'utf8'");
+$id_empresa= $_SESSION['id_empresa'];
+if($where =='AGRUPADO'){$group="group by $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT * FROM $tabla WHERE 1 $w AND id_empresa='$_SESSION[id_empresa]' $group ORDER BY orden ";
+$sql=mysql_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+
+$resultado="
+$name
+Id $campo1 $campo2 $campo3 $campo4
+ " ;
+if (mysql_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="";}else{$vacio =" >> Nuevo $descripcion << ";}
+
+$linea = 1;
+while( $row = mysql_fetch_array( $sql ) ) {
+$editar_campo1= editar_campo("$tabla",$row['id'],"$campo1","","","");
+$editar_campo2= editar_campo("$tabla",$row['id'],"$campo2","","","");
+$editar_campo3= editar_campo("$tabla",$row['id'],"$campo3","","","");
+$editar_campo4= editar_campo("$tabla",$row['id'],"$campo4","","","");
+$eliminar = " ";
+$resultado .= "$row[$value] $editar_campo1 $editar_campo2 $editar_campo3 $editar_campo4 $eliminar ";
+$linea++;
+ }
+
+
+ }else{
+ $resultado = " No hay resultados
";
+ }
+
+$resultado .= "
+
+
+
+
+
+Agregar área
+
+
+
+
+
+
+
+
+
+
+
+
+";
+//return $resultado;
+ //$respuesta = new xajaxResponse('utf-8');
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+
+}
+$xajax->registerFunction("tabla_areas");
+
+
+
+
+function importar_coleccion($form){
+$div ="confirmar_importacion";
+//$archivos = listado_archivos("$form[path]");
+//$archivos = listar_archivos("$form[path]",'cantidad','',$form);
+
+ $directorio = opendir("$form[path]"); //ruta actual
+$resultado = " ";
+while ($archivo = readdir($directorio)) //obtenemos un archivo y luego otro sucesivamente
+{
+ if (is_dir($archivo))//verificamos si es o no un directorio
+ {
+ // $resultado .= "[".$archivo . "]
"; //de ser un directorio lo envolvemos entre corchetes
+ }
+ else
+ {$autor="";
+ $ext = explode(".", $archivo);
$ext = strtolower($ext[count($ext) - 1]);
if ($ext == "jpeg") {$ext = "jpg"; }
+ if ($ext == "jpg") {
+ $cantidad_imagenes++ ;
+
+ $exif = leer_exif("$form[path]/$archivo");
+ //$name = $exif['exif']['FileName']." ".$form['38']['0']."*" ;
+ $form['0']['0'] = "$archivo";
+ $autor= $exif['exif']['Artist'];
+ $creator = $form['40'][0];
+ if($autor !="" ) { $remplazo = array('40' => array("$autor")); }else{ $remplazo; }
+
+ }
+ //$form = array_replace_recursive($form, $reemplazo);
+ $resultado .= $archivo ." / $name ".$form['0'][0]."
";
+ }
+}
+
+/*
+foreach($form as $c=>$v){
+
+//LISTA ELEMENTOS DE UN ARRAY
+if (is_array($v) ){
+ foreach($v as $C=>$V){
+ $campo .= "( $c : $V )
";
+ if($V != '') {
+ }
+ }
+}
+}
+*/
+//$resultado="$archivos $campo";
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+
+}
+$xajax->registerFunction("importar_coleccion");
+
+
+
+
+function listar_archivos( $path ,$opcion, $div,$datos){
+ // Abrimos la carpeta que nos pasan como parámetro
+
+ $resultado ="";
+ //$link = Conectarse();
+ $dir = opendir($path);
+ $cantidad =0;
+ $cantidad_imagenes =0;
+//$datos['61'] = array ( 0 => "otro valor");//"OTRO VALOR";
+ if(is_file($path)) {$esarchivo="Escriba la ruta a un directorio en el servidor
"; }
+ // Leo todos los ficheros de la carpeta
+ //if($esarchivo =="") {
+ // $elemento = readdir($dir);
+ //}
+ while ($elemento = readdir($dir) ){
+
+ // Tratamos los elementos . y .. que tienen todas las carpetas
+ if( $elemento != "." && $elemento != ".."){
+ // Si es una carpeta
+ if( is_dir($path.$elemento) ){
+ // Muestro la carpeta
+ // $resultado .= "
CARPETA: ". $elemento ."
";
+ // Si es un fichero
+ } else {
+ $ext = explode(".", $elemento);
$ext = strtolower($ext[count($ext) - 1]);
if ($ext == "jpeg") {$ext = "jpg"; }
+ if ($ext == "jpg") {$cantidad_imagenes++ ;
+
+ $exif = leer_exif("$path/$elemento");
+ $name = $exif['exif']['FileName'];
+ $title= "$name ";
+ $date= $exif['exif']['DateTimeOriginal'];
+ $autor= $exif['exif']['Artist'];
+ if(!isset($autor)) { $autor = $datos['40'][0]; }
+ $licencia= $exif['exif']['Copyright'];
+ if($licencia ==="") { }
+ else{
+// $datos['61'][0]= " XX $licencia XXX";
+ }
+
+
+ //$datos['61'][0] = $licencia;
+ if(isset($exif['exif']['UndefinedTag:0xC4A5'])) {
+ $exif['exif']['UndefinedTag:0xC4A5']= base64_encode($exif['exif']['UndefinedTag:0xC4A5']);
+ }
+ if(isset($exif['exif']['MakerNote'])) {
+ $exif['exif']['MakerNote']= base64_encode($exif['exif']['MakerNote']);
+ }
+ if ( $exif['lon'] =="" )
+ {
+ $geo = $datos['58'][0];
+ $mundo ="";
+ $datos['58'][0] = $datos['58'][0];
+
+ }
+ else {
+ $geo = "$exif[lon] $exif[lat] 18" ;//$datos['58'][0];
+ $mundo ="
";
+ $datos['58'][0]= "$geo";
+
+
+ }
+
+ // $remplazos = array('40');
+ // else { $mapa="";}
+ //$json = json_encode($exif['exif'],JSON_PRETTY_PRINT);
+ //if ( $exif['lon'] =="" ){$datos['58'][0] = $geo;}else {$datos['58'][0] = $datos['58'][0];}
+ $resultado .= "
$geo $mundo / ".$datos['58'][0]." ".$datos['999'][0]." $title / $autor / ".$datos['61'][0]." ".$datos['68'][0]." ";
+
+ }
+
+ $cantidad ++;
+
+ $campo .= "";
+
+
+ }
+ }
+
+ }
+
+
+ if($div !="" ) {
+ if($opcion == "cantidad") {
+ $resultado = "
+
+ $esarchivo $cantidad archivos, $cantidad_imagenes imágenes jpg, $mapa georeferenciadas
+
+
";
+ }
+
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+ }else {
+
+
+
+ return " $campo $resultado"; }
+}
+$xajax->registerFunction("listar_archivos");
+
+
+
+// Convertir un string "1/123" a su representación float
+function exif_float($value) {
+ $pos = strpos($value, '/');
+ if ($pos === false) return (float) $value;
+ $a = (float) substr($value, 0, $pos);
+ $b = (float) substr($value, $pos+1);
+ return ($b == 0) ? ($a) : ($a / $b);
+}
+
+function leer_exif($file){
+ //$file = "/var/www/html/milfs/images/gps.jpg";
+ $exif = exif_read_data( "$file" );
+ $resultado['exif'] = $exif;
+ $resultado['file']= $file;
+ $resultado['FileName']=$exif['FileName'];
+
+if($exif === false) {
+//return false;
+}
+
+if ( !empty($exif['GPSLongitude']) && !empty($exif['GPSLatitude']) ) {
+ $d = (float) $exif['GPSLongitude'][0];
+ $m = exif_float($exif['GPSLongitude'][1] );
+ $s = exif_float( $exif['GPSLongitude'][2] );
+
+ $gps_longitude = (float)$d + $m/60 + $s/3600;
+ if ( $exif['GPSLongitudeRef'] == 'W')
+ $gps_longitude = -$gps_longitude;
+
+ $d = $exif['GPSLatitude'][0];
+ $m = exif_float($exif['GPSLatitude'][1] );
+ $s = exif_float( $exif['GPSLatitude'][2] );
+
+ $gps_latitude = (float)$d + $m/60 + $s/3600;
+ if ( $exif['GPSLatitudeRef'] == 'S')
+ $gps_latitude = -$gps_latitude;
+ if($gps_latitude !='') {
+ $resultado['lat'] = $gps_latitude;
+ $resultado['lon'] = $gps_longitude;
+
+ //$resultado = "$_SESSION[url]/mapa.php?lon=$gps_latitude&lat=$gps_longitude&zoom=18";
+ }else{}
+
+}
+
+
+ $resultado['DateTime'] = $exif['DateTimeOriginal'];
+ $resultado['estado'] = "oK";
+
+//$resultado = "$gps_longitude $gps_latitude";
+
+ return $resultado;
+}
+
+function relacion_render($form_id,$id_campo,$valor,$cantidad){
+
+
+
+
+
+$claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$claves = $claves[0];
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $limit = explode(':',$claves[2]) ;
+ $limit = $limit[1];
+if($valor !="") {
+$valor_actual = contenido_mostrar("$formulario",$valor,'','5');
+$link = "
Ver referencia ";
+}
+
+ return " $valor_actual $link";
+$div ="div_relacion_$name";
+
+$consulta = "SELECT contenido, control FROM form_datos WHERE form_id ='$formulario' and id_campo ='$key' GROUP BY control LIMIT $limit ";
+if($name =="") {
+//return "$valor_actual";
+}
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+
+
+if (mysql_num_rows($sql)!='0'){
+$onchange = " xajax_contenido_mostrar('$formulario',(this.value),'$div','5')";
+$resultado="
+Seleccione
+ " ;
+
+while( $row = mysql_fetch_array( $sql ) ) {
+
+ if($row[control] == "$valor") {
+
+ $selected = "selected";
+ }else{ $selected = "";}
+ $resultado .= " $row[contenido] ";
+
+ }
+
+$resultado .= "
+
$valor_actual
";
+ }else{$resultado = "
No hay resultados $consulta
";}
+
+
+ return $resultado;
+
+}
+$xajax->registerFunction("relacion_render");
+
+function buscador_base($id_campo,$form_id,$valor,$name,$control,$tipo){
+$div ="div_buscador_base_$name";
+$onchange = " xajax_buscador_select_base('$id_campo','$form_id',(this.value),'$name','$control','$tipo'); document.getElementById('$name').value='';";
+$onclick = " xajax_buscador_select_base('$id_campo','$form_id','','$name','$control','$tipo'); document.getElementById('$name').value=''; (this).value='';";
+$resultado ="
+
+
+
";
+return $resultado;
+
+}
+$xajax->registerFunction("buscador_base");
+
+
+function buscador_select_base($id_campo,$form_id,$valor,$name,$control,$tipo){
+ $div ="div_buscador_base_$name";
+ $respuesta = new xajaxResponse('utf-8');
+ if($valor=="") {
+$resultado="";
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+ }
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$consulta=$claves;
+$claves = $claves[0];
+
+ $claves = explode(' ',$claves);
+ $tabla = explode(':',$claves[0]) ;
+ $tabla = $tabla[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $descripcion1 = explode(':',$claves[2]) ;
+ $descripcion1 = $descripcion1[1];
+ $descripcion2 = explode(':',$claves[3]) ;
+ $descripcion2 = $descripcion2[1];
+ $descripcion3 = explode(':',$claves[4]) ;
+ $descripcion3 = $descripcion3[1];
+
+if($valor !="") {
+//$valor_actual = contenido_mostrar("$formulario",$valor,'','5');
+}
+
+$consulta = "SELECT * FROM $tabla WHERE $descripcion1 like '$valor%%' GROUP BY $key limit 50 ";
+
+$sql=mysql_query($consulta,$link);
+
+if (mysql_num_rows($sql)!='0'){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+//$campo_descripcion= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$descripcion' ");
+//$campo_key= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$key' ");
+ if($row[control] == "$valor") {
+
+ $selected = "selected";
+ }else{ $selected = "";}
+ $resultado .= "
+ $row[$descripcion1] $row[$descripcion2] $row[$descripcion3] ";
+
+ }
+
+$resultado .= "
+
";
+ }else{$resultado = "
No hay resultados
";}
+
+
+
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+
+}
+$xajax->registerFunction("buscador_select_base");
+
+
+
+function buscador_campo($id_campo,$form_id,$valor,$name,$control,$tipo){
+$div ="div_buscador_$name";
+$onchange = " xajax_buscador_select('$id_campo','$form_id',(this.value),'$name','$control','$tipo'); document.getElementById('$name').value='';";
+$onclick = " xajax_buscador_select('$id_campo','$form_id','','$name','$control','$tipo'); document.getElementById('$name').value=''; (this).value='';";
+$resultado ="
+
+
+
";
+return $resultado;
+
+}
+$xajax->registerFunction("buscador_campo");
+
+
+function imprimir_buscador_campo($id_campo,$valor) {
+
+ $claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$consulta=$claves;
+$claves = $claves[0];
+
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $descripcion = explode(':',$claves[2]) ;
+ $descripcion = $descripcion[1];
+ $campo1 = remplacetas("form_datos","control","$valor","contenido","form_id = '$formulario' AND id_campo = '$key' ");
+ $campo2 = remplacetas("form_datos","control","$valor","contenido","form_id = '$formulario' AND id_campo = '$descripcion' ");
+ $imprimir ="$campo1[0] $campo2[0]";
+ return $imprimir ;
+}
+
+function imprimir_base($id_campo,$valor) {
+
+ $claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$consulta=$claves;
+$claves = $claves[0];
+
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $descripcion = explode(':',$claves[2]) ;
+ $descripcion = $descripcion[1];
+ $descripcion2 = explode(':',$claves[3]) ;
+ $descripcion2 = $descripcion2[1];
+ $campo1 = remplacetas("$formulario","$key","$valor","$descripcion","");
+ $campo2 = remplacetas("$formulario","$key","$valor","$descripcion2","");
+ $imprimir ="$campo1[0] $campo2[0]";
+ return $imprimir ;
+}
+
+function buscador_select($id_campo,$form_id,$valor,$name,$control,$tipo){
+ $div ="div_buscador_$name";
+ $respuesta = new xajaxResponse('utf-8');
+ if($valor=="") {
+$resultado="";
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+ }
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$consulta=$claves;
+$claves = $claves[0];
+
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $descripcion = explode(':',$claves[2]) ;
+ $descripcion = $descripcion[1];
+
+if($valor !="") {
+//$valor_actual = contenido_mostrar("$formulario",$valor,'','5');
+}
+
+$consulta = "SELECT contenido, control FROM form_datos WHERE form_id ='$formulario' and (id_campo ='$key' OR id_campo ='$descripcion' )AND contenido like '$valor%%' GROUP BY control limit 50 ";
+
+$sql=mysql_query($consulta,$link);
+
+if (mysql_num_rows($sql)!='0'){
+
+while( $row = mysql_fetch_array( $sql ) ) {
+$campo_descripcion= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$descripcion' ");
+$campo_key= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$key' ");
+ if($row[control] == "$valor") {
+
+ $selected = "selected";
+ }else{ $selected = "";}
+ $resultado .= "
+ $campo_key[0] $campo_descripcion[0] ";
+
+ }
+
+$resultado .= "
+
";
+ }else{$resultado = "
No hay resultados
";}
+
+
+
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+
+}
+$xajax->registerFunction("buscador_select");
+
+
+
+function relacion_select($id_campo,$form_id,$valor,$name,$control,$tipo){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$claves = $claves[0];
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $limit = explode(':',$claves[2]) ;
+ $limit = $limit[1];
+ if($limit =="" ) {$limit = 20;}
+if($valor !="") {
+$valor_actual = contenido_mostrar("$formulario",$valor,'','5');
+}
+
+$div ="div_relacion_$name";
+
+$consulta = "SELECT contenido, control FROM form_datos WHERE form_id ='$formulario' and id_campo ='$key' GROUP BY control LIMIT $limit ";
+if($name =="") {
+//return "$valor_actual";
+}
+$sql=mysql_query($consulta,$link);
+
+
+if (mysql_num_rows($sql)!='0'){
+$onchange = " xajax_contenido_mostrar('$formulario',(this.value),'$div','5')";
+$resultado="
+Seleccione
+ " ;
+
+while( $row = mysql_fetch_array( $sql ) ) {
+
+ if($row[control] == "$valor") {
+
+ $selected = "selected";
+ }else{ $selected = "";}
+ $resultado .= " $row[contenido] ";
+
+ }
+
+$resultado .= "
+
$valor_actual
";
+ }else{$resultado = "
No hay resultados $consulta
";}
+
+
+ return $resultado;
+
+}
+$xajax->registerFunction("relacion_select");
+
+function combo_select($id_campo,$form_id,$valor,$name,$control,$control_combo){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+if($control_combo !="") {
+ $div ="combo_$name";
+$and ="AND campo_valor LIKE '$control_combo:%%'";
+}else{
+$onchange ="xajax_combo_select('$id_campo','$valor','$valor','$name','$control',(this.value)) ";
+$div ="combo_$name";
+$name ="primario_$name";
+}
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' $and ";
+$sql=mysql_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+
+$resultado=" $valor
+Seleccione
+ " ;
+ // $resultado = array_unique($entrada);
+while( $row = mysql_fetch_array( $sql ) ) {
+ $campos = explode(':',$row[campo_valor]);
+
+ IF($control_combo ==""){
+ $campo_primario[]=$campos[0];
+ $campo_primario = array_unique($campo_primario);
+ }
+ else {
+ $campo_primario[] = "$campos[0] $campos[1]";
+ }
+ //$identificador = $identificador[0];
+//if($row[campo_valor] ==="$valor"){$selected="selected";}else{$selected ="";}
+//$resultado .= " $campos[0] ";
+ }
+
+foreach($campo_primario as $C=>$V){
+$resultado .= "$V ";
+}
+$resultado .= "
+
";
+ }else{$resultado = "
No hay resultados
";}
+if($control_combo =='') {
+ return $resultado;
+ }
+else{
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+}
+}
+$xajax->registerFunction("combo_select");
+
+
+function aplicacion_carrusel($nombre,$id,$plantilla){
+ if($id =='') {
+ $id = remplacetas('form_id','nombre',$nombre,'id',"") ;
+ $id = $id[0];
+ }
+ if($nombre =='') {
+ $nombre = remplacetas('form_id','id',$id,'nombre',"") ;
+ $nombre = $nombre[0];
+ }
+ $descripcion = remplacetas('form_id','id',$id,'descripcion',"") ;
+ $descripcion = $descripcion[0];
+
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+ if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+ $campo_titulo = $campo_titulo[0];
+ $consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+ $link=Conectarse();
+ $sql=mysql_query($consulta,$link);
+ if (mysql_num_rows($sql)!='0'){
+ $control = mysql_result($sql,0,control);
+ $nombre = remplacetas('form_id','id',$id,'nombre',"") ;
+ $descripcion = remplacetas('form_id','id',$id,'descripcion',"") ;
+
+ mysql_data_seek($sql, 0);
+// $contenido = "
$nombre[0] ";
+// $contenido .= "
$descripcion[0] ";
+
+ $orden = 0;
+while( $row = mysql_fetch_array( $sql ) ) {
+
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ if($orden === 0) {$activo = "active";}else{$activo="";}
+ $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+ $campo = buscar_campo_tipo($id,"15");
+ $id_campo = $campo[0];
+ $imagen = remplacetas('form_datos','control',$row[control],'contenido',"id_campo = '$id_campo'") ;
+ $items .= "
+
+
+ $contenido_desplegado
+
+
";
+ $indicador .= "
";
+ $titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ //$contenido .= "$contenido_desplegado ";
+ $orden = ($orden +1 );
+ }
+$contenido .= "
+
+
+
$nombre[0] $descripcion[0]
+
+
+
+ ";
+ //$contenido = " $links
";
+ }
+
+
+return $contenido;
+}
+
+
+function formulario_embebido($id){
+ //$impresion = formulario_modal("$id",$form_respuesta,$control,"embebido");
+ $impresion = formulario_areas($id,"embebido");
+
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre') ;
+ $formulario_descripcion = remplacetas('form_id','id',$id,'descripcion') ;
+ $visitas= contar_visitas($id,'formulario') ;
+ $muestra_form = "
+
+
+
+ ( $visitas )
+
+ $impresion
+
+
+
+
+
+
+
";
+ return $muestra_form ;
+}
+
+
+function formulario_embebido_campos($id,$opcion){
+ $impresion = formulario_modal("$id",$form_respuesta,$control,"$opcion");
+
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre') ;
+ $formulario_descripcion = remplacetas('form_id','id',$id,'descripcion') ;
+
+ $muestra_form = "
+
+
+
$formulario_descripcion[0]
+ $impresion
+
+
+
";
+ return $muestra_form ;
+}
+
+function json($datos){
+if ( !isset ( $_SESSION['id_empresa'] ) ) { $publico = "AND
+form_id.publico = '1' "; $w_publico = "WHERE form_id.publico = '1'
+"; }
+else { $publico = "AND form_id.id_empresa = '$_SESSION[id_empresa]'
+"; $w_publico = "WHERE form_id.id_empresa = '$_SESSION[id_empresa]' ";
+}
+$datos = mysql_seguridad($datos);
+$link=Conectarse();
+mysql_query("SET NAMES 'UTF8'");
+if($datos[id] !=''){
+if($datos[tipo] =='simple') {
+$campos ="control " ;
+$consulta = "SELECT $campos
+FROM `form_datos` , `form_campos` ,form_id
+WHERE form_datos.id_campo = `form_campos`.id
+AND form_datos.form_id = `form_id`.id
+AND (form_id = '$datos[id]' )
+$publico
+GROUP BY form_datos.control
+ORDER BY form_datos.timestamp DESC";
+
+$sql = mysql_query($consulta,$link) or die("error al ejecutar consulta ");
+ if (mysql_num_rows($sql)!='0'){
+$i = 1;
+$features = array();
+// $features[] = $consulta;
+while($row = mysql_fetch_array( $sql ))
+ {
+ if($datos[tipo]=="simple"){
+ $contenido = remplacetas('form_datos','id',$row[id_dato],'contenido',"") ;
+ $id_campo = remplacetas('form_datos','id',$row[id_dato],'id_campo',"") ;
+ $nombre_campo =
+remplacetas('form_campos','id',$id_campo[0],'campo_nombre',"") ;
+ $nuevos_datos = $datos;
+ $nuevos_datos[identificador]="$row[control]";
+ $nuevos_datos[tipo]="array";
+ //$features[$row[control]] = datos_array($row[control]) ;
+//json($nuevos_datos);//" $contenido[0]";//$row[id_campo];
+ $features[] = datos_array($row[control]) ;
+//json($nuevos_datos);//" $contenido[0]";//$row[id_campo];
+ }
+ else {
+ $features[] = $row;
+ }
+
+
+ $i++;
+ }
+
+
+
+}
+
+
+if($tipo == "array" ) {
+$resultado = $features;
+}else {
+
+$resultado = json_encode($features,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT);
+}
+return $resultado;
+
+}
+else {
+$campos ="form_datos.id as id_dato, form_datos.form_id AS
+id_formulario, nombre as formulario, campo_nombre, form_campos.id AS
+id_campo , contenido ,timestamp, control as identificador ,
+form_datos.orden" ;
+$consulta = "SELECT $campos
+FROM `form_datos` , `form_campos` ,form_id
+WHERE form_datos.id_campo = `form_campos`.id
+AND form_datos.form_id = `form_id`.id
+AND (form_id = '$datos[id]' )
+$publico
+ORDER BY form_datos.control ,form_datos.timestamp ";
+}
+
+}
+elseif($datos[identificador] !=''){
+if($datos[tipo] =='simple') {$campos ="form_campos.id as id_campo,
+form_datos.id as id_dato " ;}
+else {$campos ="form_datos.id as id_dato, form_datos.form_id AS
+id_formulario, nombre as formulario, campo_nombre, form_campos.id AS
+id_campo ,contenido ,timestamp, control as identificador ,
+form_datos.orden" ;}
+$consulta = "SELECT $campos
+FROM `form_datos` , `form_campos` ,form_id
+WHERE form_datos.id_campo = `form_campos`.id
+AND form_datos.form_id = `form_id`.id
+AND (control = '$datos[identificador]' )
+$publico
+";
+}
+elseif($datos[dato] !=''){
+if($datos[tipo] =='simple') {$campos ="form_campos.id as id_campo,
+form_datos.id as id_dato " ;}
+else {$campos ="form_datos.id as id_dato, form_datos.form_id AS
+id_formulario, nombre as formulario, nombre as formulario,
+campo_nombre, form_campos.id AS id_campo ,contenido ,timestamp,
+control as identificador, form_datos.orden" ;}
+$consulta = "SELECT $campos
+FROM `form_datos` , `form_campos` ,form_id
+WHERE form_datos.id_campo = `form_campos`.id
+AND form_datos.form_id = `form_id`.id
+AND (form_datos.id = '$datos[dato]' )
+$publico
+";
+}
+else {
+$consulta = "SELECT id as form_id, nombre as form_nombre, descripcion
+as form_descripcion , creacion , publico AS contenido_publico ,
+modificable AS formulario_publico
+FROM form_id $w_publico";
+}
+
+
+$sql = mysql_query($consulta,$link) or die("error al ejecutar consulta ");
+ if (mysql_num_rows($sql)!='0'){
+$i = 1;
+$features = array();
+// $features[] = $consulta;
+while($row = mysql_fetch_array( $sql ))
+ {
+ if($datos[tipo]=="simple"){
+ $contenido = remplacetas('form_datos','id',$row[id_dato],'contenido',"") ;
+ $id_campo = remplacetas('form_datos','id',$row[id_dato],'id_campo',"") ;
+ $nombre_campo =
+remplacetas('form_campos','id',$id_campo[0],'campo_nombre',"") ;
+ $features[] = "$nombre_campo[0] : $contenido[0]";//$row[id_campo];
+ }
+ else {
+ $features[] = $row;
+ }
+
+
+ $i++;
+ }
+
+
+
+}
+
+if($datos[tipo] == "array" ) {
+$resultado = $features;
+}else {
+
+$resultado = json_encode($features,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT);
+}
+
+return $resultado;
+}
+
+
+
+
+function imprime_geojson($id,$id2,$plantilla){
+ $id_form = mysql_seguridad($id);
+ $id_form2 = mysql_seguridad($id2);
+ $campo = buscar_campo_tipo($id_form,"14");
+ $campo2 = buscar_campo_tipo($id_form2,"14");
+ $id_campo = $campo[0];
+ $id_campo2 = $campo2[0];
+ if($id_form2 !=""){$w_id2 =" OR form_id = '$id_form2'"; $or_2 ="or id_campo = '$id_campo2'";}
+
+$link=Conectarse();
+
+ $consulta = "SELECT form_id as id, control, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data
+FROM `form_datos`
+WHERE (form_id = '$id_form' $w_id2 )
+AND ( id_campo ='$id_campo' $or_2 )
+group by control
+ORDER BY orden desc";
+//return $consulta;
+
+ mysql_query("SET NAMES 'UTF8'");
+ $sql = mysql_query($consulta,$link) or die("error al ejecutar consulta ");
+ if (mysql_num_rows($sql)!='0'){
+ $id = 1;
+ $features = array();
+
+while( $row = mysql_fetch_array( $sql ) ) {
+ $marcador = array();
+ $propiedades = array();
+ $identificador = explode(',',$row[data]);
+ $identificador = $identificador[0];
+ $campos = explode(" ",$identificador);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+ $formulario = formulario_imprimir($row[id],$row[control],"$plantilla");
+
+ $marcador["type"] = "Point";
+ $marcador["coordinates"] = array($lat,$lon);
+ $propiedades = formulario_imprimir_linea($row[id],$row[control],"array");//
+ //$propiedades[description] ="HOLA MUNDO";
+ $propiedades[description] ="
$formulario
";
+ $propiedades[sounds] ="";
+ $propiedades[url] ='';
+ $propiedades[icon][iconSize] =[60,60];
+ //$propiedades[icon][shadowSize] =[70,70];
+ //$propiedades[icon][shadowUrl] = "https://raw.githubusercontent.com/humano/milfs/master/milfs/images/iconos/negro.png";
+
+ //$propiedades[title] ='Hola mundo';
+ if($propiedades[icon][iconUrl] =="") {
+ $propiedades[icon][iconUrl] = "https://raw.githubusercontent.com/humano/milfs/master/milfs/images/iconos/negro.png";
+ }
+ $geometria .= "{\"type\":\"Feature\",\"geometry\":".json_encode($marcador,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT).",\"properties\":".json_encode($propiedades,JSON_NUMERIC_CHECK|JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT)."},";
+ $features[] = $marcador;
+
+ $id++;
+ }
+
+}
+//-75.58295 6.25578 16
+
+//encode and output jsonObject
+header('Content-Type: text/plain');
+//echo $consulta;
+$resultado = " { \"type\": \"FeatureCollection\",
+ \"features\": ";
+$resultado .= json_encode($features,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT);
+$resultado .= "}";
+//echo $resultado;
+$geometria = substr("$geometria",0,-1);
+$geometria = "{
+ \"type\": \"FeatureCollection\",
+ \"features\": [$geometria ]}";
+return $geometria;
+}
+
+
+function aplicacion_presentacion($id,$div,$timeout){
+ if($timeout < '1000') {$timeout =5000;};
+ $respuesta = new xajaxResponse('utf-8');
+$consulta ="SELECT * FROM form_datos WHERE form_id = '$id' ORDER BY rand() limit 1 ";
+$link=Conectarse();
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+$control = mysql_result($sql,0,control);
+$impresion = formulario_imprimir("$id","$control","");
+
+ }
+$siguiente = "
SIGUIENTE ";
+if($div ==''){
+ $presentacion = "
$siguiente $impresion
";
+ }else{
+ //$respuesta->addAlert("$consulta");
+ $respuesta->addScript("setTimeout(function(){xajax_aplicacion_presentacion('$id','presentacion_$id','$timeout')},$timeout)");
+ $respuesta->addAssign("$div","innerHTML","$siguiente $impresion");
+ return $respuesta;
+ }
+return " $presentacion";
+
+
+}
+$xajax->registerFunction("aplicacion_presentacion");
+
+function aplicaciones_listado($id_form,$tipo,$div){
+
+// if($id_empresa !=''){ $_empresa = " ";}
+ //if($tipo =='publico'){ $w_publico =" publico ='0'";}else {$w_publico =" publico ='1'";}
+ if($id_form !="") {$w_form = " AND id = '$id_form'";}
+ $w_publico =" publico ='1'";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta = "SELECT * FROM form_id WHERE $w_publico $w_form ORDER BY orden asc ";
+mysql_real_escape_string($consulta);
+$sql=mysql_query($consulta,$link);
+
+
+if (mysql_num_rows($sql)!='0'){
+ mysql_data_seek($sql, 0);
+ $resultado_li .= "
";
+ }else {$resultado_li = "";}
+
+if($tipo =='li') { return $resultado_li.$resultado;}
+elseif($tipo =='nav') { return $resultado_nav;}
+elseif($tipo =='grid') {
+if($div !="") {
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado_grid");
+ return $respuesta;
+ }else{
+ return $resultado_grid;
+ }
+}
+elseif($tipo =='banner') { return $resultado_banner;}
+elseif($tipo =='carrusel') { return $resultado_carrusel;}
+else {return $resultado;}
+}
+$xajax->registerFunction("aplicaciones_listado");
+
+
+function contenido_aplicacion($id,$plantilla){
+$div = "contenedor";
+ $respuesta = new xajaxResponse('utf-8');
+
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+$campo_titulo = $campo_titulo[0];
+$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+
+$link=Conectarse();
+$sql=mysql_query($consulta,$link);
+
+if (mysql_num_rows($sql)!='0'){
+
+ $control = mysql_result($sql,0,"control");
+ $nombre = remplacetas('form_id','id',$id,'nombre',"") ;
+ $descripcion = remplacetas('form_id','id',$id,'descripcion',"") ;
+
+ mysql_data_seek($sql, 0);
+
+ //$contenido = "
$nombre[0] ";
+ $contenido = "
$descripcion[0] ";
+
+ $orden = 0;
+
+while( $row = mysql_fetch_array( $sql ) ) {
+
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+ //return "$row[form_id] $row[control] $plantilla";
+ $titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $contenido .= "$contenido_desplegado
";
+ }
+ $contenido = " $links
";
+ }
+
+ return $contenido;
+
+}
+
+function contenido_aplicacion_nombre($nombre,$plantilla){
+ $id = remplacetas('form_id','nombre',$nombre,'id',"") ;
+ $id = $id[0];
+ if($id[0] =="") {$aviso = "
No se ha definido una aplicación con el nombre $nombre ";
+ return $aviso;}
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+$campo_titulo = $campo_titulo[0];
+$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+$link=Conectarse();
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+ $control = mysql_result($sql,0,control);
+
+ mysql_data_seek($sql, 0);
+ $contenido = " ";
+ $orden = 0;
+while( $row = mysql_fetch_array( $sql ) ) {
+
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+ $titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $contenido .= "$contenido_desplegado ";
+ }
+ $contenido = " $links
";
+ }
+
+ return $contenido;
+
+}
+
+
+
+function contenido_parallax($id){
+$div = "contenedor";
+ $respuesta = new xajaxResponse('utf-8');
+
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+$campo_titulo = $campo_titulo[0];
+$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+$link=Conectarse();
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+ $control = mysql_result($sql,0,control);
+ $contenido = "";
+ mysql_data_seek($sql, 0);
+
+ $orden = 0;
+while( $row = mysql_fetch_array( $sql ) ) {
+ //$orden = $orden+500;
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'','contenido');
+
+ $titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $nav_li .="
+
+ ";
+ $style .=" a[id= '$row[control]']:target ~ #main_$id article.article
+ {
+ -webkit-transform: translateY(-$orden"."px);
+ transform: translateY( -$orden"."px );
+ } ";
+ $links .= "
";
+ $contenido .= "
+
+ $contenido_desplegado
+
+ ";
+ $orden = $orden +800;
+ }
+ $contenido = "
+
+
+ $links
+
+
+
+
+ ";
+ }
+
+//return " $contenido";
+ $respuesta->addAssign("$div","innerHTML","$contenido");
+ return $respuesta;
+
+}
+$xajax->registerFunction("contenido_parallax");
+
+function contenido_timeline($id){
+$div = "contenedor";
+ $descripcion = remplacetas('form_id','id',$id,'descripcion') ;
+ $nombre = remplacetas('form_id','id',$id,'nombre') ;
+ $respuesta = new xajaxResponse('utf-8');
+
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+$campo_titulo = $campo_titulo[0];
+$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+$link=Conectarse();
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+ $control = mysql_result($sql,0,control);
+ //$contenido = "
+
+ $subir_imagen
+
+
+ ";
+
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+
+}
+
+return $respuesta;
+}
+$xajax->registerFunction("configuracion");
+
+
+function cambiar_imagen($imagen,$tabla,$id) {
+ $respuesta = new xajaxResponse('utf-8');
+$link = Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta = "UPDATE $tabla SET `imagen` = '".$imagen."' WHERE `id` = '$id';";
+ $sql_consulta=mysql_query($consulta,$link);
+ if($sql_consulta) {
+if($tabla =='empresa') {
+ $respuesta->addAssign("banner","style.backgroundImage","url('images/secure/?file=600/$imagen')");
+ $respuesta->addAssign("formUpload","innerHTML","");
+}
+
+ //$respuesta->addAlert("$consulta");
+return $respuesta;
+}
+}
+$xajax->registerFunction("cambiar_imagen");
+
+
+
+
+function limpiar_caracteres($valor){
+$b=array("{","}","]","[",";","¡","!","¿","?","'",'"' );
+$c=array(" "," "," "," "," "," "," "," ","'"," ");
+$resultado=str_replace($b,$c,$valor);
+return $resultado ;
+}
+
+function actualizar_campo($tabla,$key,$campo,$valor,$accion,$div) {
+ $valor = limpiar_caracteres($valor);
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' $accion limit 1; ";
+ $sql=mysql_query($edit,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ $respuesta->addAssign($div,"innerHTML",$valor);
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("actualizar_campo");
+
+
+function eliminar_campo($tabla,$key,$div) {
+ $key = limpiar_caracteres($key);
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $borrar = "DELETE FROM $tabla WHERE id = '$key' limit 1";
+// $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' limit 1; ";
+ $sql=mysql_query($borrar,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ $respuesta->addAssign($div,"innerHTML","");
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("eliminar_campo");
+
+
+function insertar_campo($tabla,$formulario,$div) {
+ //$valores ="$formulario[0]";
+ $nombre = $formulario['nombre'];
+ foreach($formulario as $c=>$v){
+
+ $valores .= " $c = '$v',";
+ }
+ $valores = "$valores id_empresa = '$_SESSION[id_empresa]'";
+ $key = limpiar_caracteres($key);
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $insertar = "INSERT INTO $tabla set $valores";
+// $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' limit 1; ";
+ $sql=mysql_query($insertar,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ //$respuesta->addAssign($div,"innerHTML","");
+
+ }
+ //$respuesta->addAlert("$insertar");
+//$areas = tabla_areas('form_areas','id','nombre,descripcion,estado,orden','',"",'Areas','');
+// $respuesta->addScript("javascript:xajax_tabla_areas('form_areas','id','nombre,descripcion,estado,orden','','','Areas','div_campos')");
+ $respuesta->addAssign("$div","innerHTML","
El registro se insertó con éxito
");
+ return $respuesta;
+}
+$xajax->registerFunction("insertar_campo");
+
+function insertar_campo_area($tabla,$formulario,$div) {
+ //$valores ="$formulario[0]";
+ $nombre = $formulario['nombre'];
+ foreach($formulario as $c=>$v){
+
+ $valores .= " $c = '$v',";
+ }
+ $valores = "$valores id_empresa = '$_SESSION[id_empresa]'";
+ $key = limpiar_caracteres($key);
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $insertar = "INSERT INTO $tabla set $valores";
+// $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' limit 1; ";
+ $sql=mysql_query($insertar,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ //$respuesta->addAssign($div,"innerHTML","");
+
+ }
+ //$respuesta->addAlert("$insertar");
+//$areas = tabla_areas('form_areas','id','nombre,descripcion,estado,orden','',"",'Areas','');
+ $respuesta->addScript("javascript:xajax_tabla_areas('form_areas','id','nombre,descripcion,estado,orden','','','Areas','div_campos')");
+ //$respuesta->addAssign("contenido","innerHTML","$insertar");
+ return $respuesta;
+}
+$xajax->registerFunction("insertar_campo_area");
+
+
+function editar_campo($tabla,$key,$campo,$valor,$accion,$div,$indice){
+ if ( !isset ( $_SESSION['id'] ) ) { return;}
+ if($indice =="") {$id = "id";}
+ else {$id = "$indice";}
+ ////NO SE PUEDE EDITAR EL CAMPO (id )
+
+//
+if(@$div=='') {$div = "div_$tabla".$campo;}
+else {$div = $div;}
+ $respuesta = new xajaxResponse('utf-8');
+ $valor = limpiar_caracteres($valor);
+
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $consulta = "SELECT $id , $campo AS valor FROM $tabla WHERE $id = '$key' LIMIT 1";
+ $sql_consulta=mysql_query($consulta,$link);
+ $Valor = mysql_result($sql_consulta,0,"valor");
+
+
+if(@$accion == 'cerrar') {
+ $campo = editar_campo("$tabla","$key","$campo","$valor","","","$indice");
+$respuesta->addAssign($div,"innerHTML",$campo);
+return $respuesta;
+ }
+elseif($accion=="input") {
+ $size= strlen($Valor);
+ $placeholder = strtoupper(limpiar_caracteres($campo));
+ $rrn = $div;
+if($size < 40) {
+
+ $resultado = "
+
+ ";
+ }else {
+ $resultado = "
+
+ ";
+ }
+ }
+elseif($accion== "grabar"){
+
+ $edit = "UPDATE $tabla SET $campo = '$valor' WHERE $id = '$key' limit 1; ";
+ $sql=mysql_query($edit,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+ $campo = editar_campo("$tabla","$key","$campo","$valor","","","$indice");
+ $respuesta->addAssign($div,"innerHTML",$campo);
+ return $respuesta;
+
+
+ }
+
+else{
+ if (mysql_num_rows($sql_consulta)!='0'){
+ $valor=mysql_result($sql_consulta,0,"valor");
+
+ /////// campos que no se muestran ///
+if($campo == 'id' OR $campo == 'id_usuario' OR $campo == 'id_grupo') {
+return ;
+}
+
+ /////////// campos que se muestran para edicion //////////////
+ $title = strtoupper(limpiar_caracteres($campo));
+ $div= rand(123,999);
+ if($valor =="") {$aviso="
$title ";}else{$aviso ="";}
+$campo ="
+
+
+
+ ";
+ }
+ else {$campo = "";}
+
+ return $campo;
+}
+
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+
+}
+
+$xajax->registerFunction("editar_campo");
+
+
+function formulario_imprimir($id,$control,$tipo) {
+
+if(is_numeric($tipo)) { $limit = "limit $tipo "; $class= "alert alert-info";}
+//if($control != "") { $w_control = "AND control = '$control' ";}
+ $id = mysql_seguridad($id);
+ $control = mysql_seguridad($control);
+ $publico = remplacetas('form_id','id',$id,'publico','') ;
+ if($publico[0] != "1" and (!isset ( $_SESSION[id]) )) {
+ $resultado ="
Acceso restringido No se puede consultar los datos.";
+ return $resultado;
+
+ }
+
+ //if($id !='') {$w_id = "AND form_id = '$id'";}else {$w_id='';}
+ if($id !='') {
+ $consulta = "SELECT *
+ FROM form_contenido_campos , form_datos
+ WHERE form_contenido_campos.id_campo = form_datos.id_campo
+ AND form_datos.control = '$control'
+ AND form_contenido_campos.id_form = '$id'
+ ORDER BY form_contenido_campos.orden ASC $limit
+ ";
+ }else {
+ $consulta = "SELECT * FROM form_datos WHERE control = '$control' GROUP BY id_campo" ;
+ }
+ $control = mysql_seguridad($control);
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if($id !='') {$id = $id;}else {$id=mysql_result($sql,0,"form_id");}
+
+
+
+ $categoria_campo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'categoria:campo'") ;
+ $categoria_campo = $categoria_campo[0];
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa','') ;
+
+
+
+if (mysql_num_rows($sql)!='0'){
+ mysql_data_seek($sql, 0);
+
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $multiple ="$row[multiple]";
+ $campo_tipo = remplacetas('form_campos','id',$row['id_campo'],'campo_tipo','');
+ $campo_tipo =$campo_tipo[0];
+ $contenido = formulario_valor_campo("$id","$row[id_campo]","","$control",'');
+ $contenido_array = $contenido;
+ // $contenido = formulario_valor_campo("$id","$row[id_campo]","","$control");
+ $md5_contenido = $contenido[4];
+ $contenido_original = $contenido[3];
+ $contenido = $contenido[3];
+
+
+
+
+ if($campo_tipo =='15' AND $tipo==""){if($contenido !=""){
+ $contenido = "
+
Mostrar
+ "; }else{$contenido="";}}
+ elseif($campo_tipo=='14'){
+ if($contenido !='') {
+ $campos = explode(" ",$contenido);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+ include("includes/datos.php");
+ if(!isset($mapbox_token)) { include("milfs/includes/datos.php"); if(!isset($mapbox_token)) {$error_token = 1; }}
+ if($error_token != 1) {
+ $contenido = "
+
+
+ "; }else{ $contenido ="
No se ha definido un token de mapbox
";}
+ }
+ }
+ elseif($campo_tipo=='4'){ $contenido = "
$contenido ";}
+ elseif($campo_tipo=='18'){ $contenido = "";}
+ elseif($campo_tipo=='23'){
+ $funcion = remplacetas("form_campos_valores","id_form_campo","$row[id_campo]","campo_valor","");
+ eval("\$contenido = ".$funcion[0].";");
+ $contenido .= "";
+
+ }
+ elseif($campo_tipo=='6'){
+ $contenido = imprimir_buscador_campo($row['id_campo'],$contenido);
+ }
+ elseif($campo_tipo=='21'){
+ $contenido = imprimir_base($row['id_campo'],$contenido);
+ }
+ elseif($campo_tipo=='10'){
+ $valor_actual = relacion_render("$id","$row[id_campo]",$contenido,'5');
+ $contenido = "$valor_actual";}
+ elseif($campo_tipo=='5' AND $contenido !=""){
+ if($tipo =="") {
+ $contenido = trim($contenido); $contenido = "
+
+
+
+ ";
+ }else {
+ $contenido =$contenido;
+ }
+ }
+
+ else {
+ $html ="$contenido";
+ $contenido = nl2br($html);
+ $contenido = Markdown($contenido);
+ }
+ $campo_nombre = remplacetas('form_campos','id',$row[id_campo],'campo_nombre');
+ $nombre[$row[id_campo]] = $campo_nombre[0] ;
+////buscar campo imagen
+$campo_imagen = buscar_campo_tipo($id,"15");
+//$campo_imagen_nombre = $campo_imagen[1];
+$campo_imagen = $campo_imagen[0];
+////
+ if($row[id_campo] == $campo_imagen AND $tipo !="" ){ $contenido = strip_tags($contenido); }
+ $campo[$row[id_campo]]=$contenido;
+ $campo_400[$row[id_campo]] = substr($contenido,0, $length = 400)."... ";//$contenido;
+ $campo_80[$row[id_campo]] = substr($contenido,0, $length = 80);//$contenido;
+ $campo_55[$row[id_campo]] = substr($contenido,0, $length = 55);//$contenido;
+ $campo_limpio[$row[id_campo]] = $contenido = strip_tags($contenido);
+
+ $campo["md5_".$row[id_campo]]=$md5_contenido;
+
+ if($row[id_campo] == $categoria_campo){
+
+
+ $categoria_filtro = remplacetas('form_parametrizacion','campo',$id,'descripcion',"tabla='form_id' and opcion = 'categoria:filtro:$row[id_campo]'") ;
+ $filtro = $categoria_filtro;
+ $categoria_filtro = $categoria_filtro[0];
+ $icono = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'categoria:icon:$md5_contenido'") ;
+ if($icono[0] =='') {
+ //$icon = "http://$_SERVER[HTTP_HOST]/milfs/images/pin.png";
+ $icon = "https://raw.githubusercontent.com/humano/milfs/master/milfs/images/iconos/negro.png";
+ }else{
+
+ $icon = $icono[0];
+ }
+ $icono = "$icon";
+ //$array[icon][iconSize] =[50,50];
+
+ }else{}
+
+if($contenido_original !="") {
+ //// si el campo es tipo password (18) no se muestra
+ if($campo_tipo !='18'){
+ if($tipo == "metadatos"){
+ $metadatos = " ".date('Y-m-d H:i:s',$contenido_array[1])." id $contenido_array[0] proceso $contenido_array[5] usuario $contenido_array[6] ip ".long2ip($contenido_array[7])." campo $row[id_campo] ";
+ }else {$metadatos='';}
+ $resultado .= "
+
+
+ $campo_nombre[0] $metadatos
+ $contenido
+ ";
+}
+}
+ }
+
+ //$resultado .="
";
+//}else {$resultado ="
No se encontraron resultados "; return $resultado;}
+//if($id=="6" OR $id=="10") {
+ if($tipo !="" AND (!is_numeric($tipo)) AND $tipo !="metadatos" ) {
+////Usa una plantilla apra cada id
+$plantilla = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'plantilla:$tipo'") ;
+$plantilla = $plantilla[0];
+if($plantilla =="") {
+///Usa una plantilla generica por nombre
+$plantilla = remplacetas('form_parametrizacion','opcion',"plantilla:$tipo",'descripcion',"campo = ''") ;
+$plantilla = $plantilla[0];
+//$plantilla = remplacetas('parametrizacion','opcion',"plantilla:$tipo",'descripcion',"campo = '$id' ") ;
+}
+if($plantilla !='') { $plantilla = html_entity_decode ( $plantilla );}
+/*else {
+$plantilla = remplacetas('parametrizacion','opcion',"plantilla:$tipo",'descripcion',"") ;
+$plantilla= $plantilla[0];
+ }
+ */
+ }
+if($plantilla != ""){
+eval("\$plantilla = \"$plantilla \";");
+ $full =" $plantilla ";
+ }else {
+ $full= "
$resultado
";
+ }
+
+ $resultado =" $full
+ ";
+ return $resultado;
+
+// }else {$resultado ="
No se encontraron resultados "; return $resultado;}
+ }else {$resultado =""; return $resultado;}
+}
+
+function formulario_respuesta($id,$control) {
+ if($id=='') {return;}
+ $id = mysql_seguridad($id);
+ $consulta = "SELECT * FROM form_id
+ WHERE formulario_respuesta = '$id'
+ ";
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+
+if (mysql_num_rows($sql)!='0'){
+ mysql_data_seek($sql, 0);
+ $resultado ="
+
Responder con:
+
";
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $resultado .= "$row[nombre] ";
+
+}
+ $resultado .="
";
+}else{$resultado ="";}
+return $resultado;
+}
+
+function subir_imagen($respuesta,$id){
+
+///vinculado con la funcion de javascript resultadoUpload(estado, file) que esta en librerias/scripts.js
+//this.form.taget= 'ventana'; this.form.action = 'destinoEspecial.html'; this.form.submit()"
+$javascript="$_SESSION[url]/includes/upload.php";
+$campo_mapa = buscar_campo_tipo($respuesta,"14");
+$campo_mapa = $campo_mapa[0];
+if ($id ==''){$id='imagen';}
+$size = ($_SESSION[upload_size]*1024*1024)." bytes";
+$resultado .="
+
+
+
+
+
+
+La imagen debe estar en formato .jpg y de tamaño máximo $_SESSION[upload_size] MB ( $size)
+
+";
+return $resultado;
+
+}
+
+function formulario_importador($accion) {
+
+ if($accion =='') {
+ $resultado="
Importador";
+
+ return $resultado;
+ }
+ $respuesta = new xajaxResponse('utf-8');
+ $formulariox =formulario_importar('','menu','');
+ $resultado="$formulariox
";
+ $respuesta->addAssign("contenido","innerHTML","$resultado");
+ return $respuesta;
+}
+$xajax->registerFunction("formulario_importador");
+
+
+function subir_archivo($perfil){
+///vinculado con la funcion de javascript resultadoUpload(estado, file) que esta en librerias/scripts.js
+$javascript="includes/upload_archivo.php";
+$resultado .="
+
+
+Archivo formulario $perfil:
+
+Máximo 1MB
+
+ ";
+
+
+return $resultado;
+
+}
+
+
+function formularios_muestra_listado($formulario){
+
+ if($formulario==''){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta = "SELECT * FROM form_id WHERE id_empresa = '$_SESSION[id_empresa]' ORDER BY nombre ";
+$sql=mysql_query($consulta,$link);
+
+
+if (mysql_num_rows($sql)!='0'){
+ mysql_data_seek($sql, 0);
+ $resultado .="
";
+ $resultado .= "Seleccionar formulario a importar ";
+$fila=0;
+while( $row = mysql_fetch_array( $sql ) ) {
+ $fila = $fila +1;
+ if ($fila %2 == 0){$bg='LightCyan';}else{ $bg='FFFFFF';}
+
+$resultado .= " $row[nombre] ";
+ }
+
+ $resultado .=" ";
+ }else {$resultado = "";}
+
+ return $resultado;
+ }else{
+ $respuesta = new xajaxResponse('utf-8');
+ $subir = subir_archivo($formulario) ;
+ $div="importador_select";
+ $resultado .= "$subir";
+$respuesta->addAssign($div,"innerHTML",$resultado);
+$respuesta->addAssign("importador_archivo","innerHTML","");
+
+
+
+return $respuesta;
+}
+}
+$xajax->registerFunction("formularios_muestra_listado");
+
+
+function formulario_importar($filename,$accion,$perfil){
+ $respuesta = new xajaxResponse('utf-8');
+ // $respuesta->addAlert("$filename,$accion,$perfil ");
+ // return $respuesta;
+
+ if($filename ===""){
+
+
+ $formulario .= formularios_muestra_listado();
+
+ $formulario .= "
+
";
+
+return $formulario;
+ }
+
+ $div = "importador_archivo";
+
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+
+ $resultado .= "Importando formulario
$perfil_nombre ($perfil)
+
";
+ $nombre = "tmp/$filename";
+ if($accion == "grabar") {
+
+ }
+ if (($handle = fopen($nombre, 'r')) !== FALSE)
+ {
+
+while (($datos = fgetcsv($handle,0,"|")) !== FALSE) {
+ $numero = count($datos);
+if($fila >=1) {
+
+ $resultado .= "";
+ $numero_columna = 0;
+ for ($c=0; $c < $numero; $c++) {
+ $columna = $datos[$c];
+
+
+if($columna !=""){
+
+ if($accion === "grabar"){
+$control=md5($perfil.$fila.time());
+$ip = obtener_ip();
+ $graba_ip = " ip = INET_ATON('".$ip."') ";
+$consulta_campos = "INSERT INTO form_datos SET timestamp= '".time()."', id_usuario='$_SESSION[id]',id_empresa='$_SESSION[id_empresa]',form_id ='$perfil',
+$graba_ip ,
+control = '$control', $consulta id_campo = '$campo[$numero_columna]' , contenido = '$columna'";
+ $verificar_campo = formulario_verificar_campo($perfil,$campo[$numero_columna]);
+ if($verificar_campo == NULL){}else{
+ $sql = mysql_query($consulta_campos,$link);
+ if($sql) {
+ $class='success';
+ $sql_resultado = " ";
+
+
+ }
+ else {
+ $class='danger';
+ }
+
+
+ }
+
+ }
+
+
+}
+ $resultado .= "$columna $sql_resultado ";
+
+ $numero_columna ++;
+ }
+ $resultado .= " ";
+ }
+ else {
+ $resultado .= "";
+
+ $posicion = 0;
+ for ($c=0; $c < $numero; $c++) {
+ $titulo = $datos[$c] ;
+ $verificar_campo = formulario_verificar_campo($perfil,$titulo);
+ if($verificar_campo == NULL){$verificar_campo =" "; $class='danger';}
+ else{$verificar_campo =" "; $class='success';}
+ $campo[$posicion] = $datos[$c];
+ $resultado .= "$verificar_campo $titulo ";
+ $posicion ++;
+
+ }
+
+
+ $resultado .= " ";
+ }
+ $fila++;
+ }
+
+
+ $resultado .= "
$fila ";
+ }
+
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+}
+
+$xajax->registerFunction("formulario_importar");
+
+
+function formulario_verificar_campo($perfil,$id_campo){
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta = "SELECT * FROM `form_contenido_campos` WHERE `id_form` = '$perfil' AND id_campo='$id_campo'";
+$sql =mysql_query($consulta,$link);
+$cant =mysql_num_rows($sql);
+
+if (mysql_num_rows($sql) == '0'){
+$existe = NULL;
+
+ }else {
+
+$control=mysql_result($sql,0,"control");
+$obligatorio=mysql_result($sql,0,"obligatorio");
+$existe[]= $control;
+$existe[]= $obligatorio;
+$existe[]= $consulta;
+
+}
+
+return $existe;
+ }
+
+function borrar_tmp($div) {
+if($div =='') {
+ $div="borra_tmp";
+$resultado ="
Limpiar ";
+
+return $resultado ;
+}
+$dir = "tmp/";
+$ficheroseliminados= 0;
+$handle = opendir($dir);
+while ($file = readdir($handle)) {
+ if (is_file($dir.$file)) {
+ if ( unlink($dir.$file) ){
+ $ficheroseliminados++;
+ }
+ }
+}
+$fecha = time ();
+$ahora = date ( "Y-m-d h:i:s" , $fecha );
+$resultado ="
$ahora
";
+ $respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+
+ }
+$xajax->registerFunction("borrar_tmp");
+
+
+function formulario_imprimir_linea($id,$control,$tipo) {
+ $id = mysql_seguridad($id);
+ //if($id !='') {$w_id = "AND form_id = '$id'";}
+ $control = mysql_seguridad($control);
+/* $consulta = "SELECT *
+ FROM form_contenido_campos
+ WHERE form_contenido_campos.id_form = '$id'
+ ORDER BY form_contenido_campos.orden ASC
+ ";
+ */
+ if($id !='') {
+ $consulta = "SELECT *
+ FROM form_contenido_campos
+ WHERE form_contenido_campos.id_form = '$id'
+
+ ORDER BY form_contenido_campos.orden ASC $limit
+ ";
+ }else {
+ $consulta = "SELECT * FROM form_datos WHERE control = '$control' GROUP BY id_campo" ;
+ }
+
+
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if($id !='') {$id = $id;}else {$id=mysql_result($sql,0,"form_id");}
+ $categoria_campo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'categoria:campo'") ;
+ $categoria_campo = $categoria_campo[0];
+
+ $titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+ $titulo = $titulo[0];
+
+$timestamp=mysql_result($sql,0,"timestamp");
+$fecha = date ( "Y-m-d h:i:s" , $timestamp);
+
+if (mysql_num_rows($sql)!='0'){
+ mysql_data_seek($sql, 0);
+// $resultado ="
";
+ $imagen = formulario_valor_campo("$id","0","","$control");
+ $imagen = $imagen[3];
+ if($imagen[3] != null AND $tipo !='titulos') {
+ $array[image]=$imagen;
+ $imagen_icon="secure/?file=150/$imagen";
+ $imagen= " ";
+
+ }else {$imagen='';}
+$td .= "$imagen ";
+
+ while( $row = mysql_fetch_array( $sql ) ) {
+
+ $campo_tipo = remplacetas('form_campos','id',$row[id_campo],'campo_tipo');
+ $campo_tipo =$campo_tipo[0];
+ $contenido = formulario_valor_campo("$id","$row[id_campo]","","$control");
+ $md5_contenido = $contenido[4];
+ //md5(binary contenido) as md5_contenido,
+ $contenido_original = $contenido;
+ //$control = $contenido[0];
+ $contenido = $contenido[3];
+ $campo_nombre = remplacetas('form_campos','id',$row[id_campo],'campo_nombre');
+ $campo_nombre[0] =" $campo_nombre[0]";
+ if($tipo=="titulos") {
+ $contenido = "$campo_nombre[0] ";
+ }
+ elseif($tipo=="titulos_csv"){
+ $csv .= '"'.$campo_nombre[0].'";';
+ }
+ elseif($tipo=="linea_csv"){
+ $csv .= '"'.$contenido.'";';
+ }
+ elseif($tipo=="array"){
+
+ if($row[id_campo] == $titulo){$array[title]=$contenido;}
+ if($row[id_campo] == $categoria_campo){
+ $array[category]=$contenido;
+
+ $categoria_filtro = remplacetas('form_parametrizacion','campo',$id,'descripcion',"tabla='form_id' and opcion = 'categoria:filtro:$row[id_campo]'") ;
+ $filtro = $categoria_filtro;
+ $categoria_filtro = $categoria_filtro[0];
+ $icono = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'categoria:icon:$md5_contenido'") ;
+ //$icono[0] = $imagen_icon;
+ if($icono[0] =='') {
+ //$icon = "https://raw.githubusercontent.com/humano/milfs/master/milfs/images/iconos/negro.png";
+ }else{
+
+ $icon = $icono[0];
+ }
+ $array[icon][iconUrl] = "$icon";
+ //$array[icon][iconSize] ="[50,50]";
+ //$array[icon][shadowSize] =[70,70];
+ //$array[icon][shadowUrl] = "http://$_SERVER[HTTP_HOST]/milfs/images/iconos/sha.png";
+
+ }else{}
+ $array[$row[id_campo]] = $contenido;
+ }
+ else{
+ $limite = 100;
+ $size= strlen($contenido);
+ $restante = ($limite - $size);
+ if($size > $limite) {
+ $contenido = substr($contenido,0, $length = 300)."... ";//$contenido;
+ }
+ if($campo_tipo=='15' AND $tipo==""){if($contenido !=""){$contenido = " "; }else{$contenido="";}}
+ if($campo_tipo=='14'){
+ if($contenido !='') {
+ $campos = explode(" ",$contenido);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+ require("includes/datos.php");
+ $contenido = "
+
+ ";
+ } else { $contenido ='';}
+ }
+ elseif($campo_tipo=='4'){ $contenido = "$contenido ";}
+ elseif($campo_tipo=='3' AND $contenido !=""){ $contenido = number_format($contenido);}
+ else {$contenido = Markdown("$contenido");}
+
+ }
+
+
+ if($tipo=="titulos") {
+$td .= " $contenido ";
+
+ }else{
+
+ $td .= " $contenido ";
+ }
+ }
+
+if($tipo=="titulos") { $identificador ="Identificador "; }else {$identificador ="$control ";}
+ $resultado .="$td $identificador ";
+}
+ if($tipo =='titulos_csv' or $tipo=='linea_csv') {
+
+return $csv;
+ }
+ if($tipo =="array") {
+ //$array["title"]="hola mundos";
+ return $array;
+ }
+ return $resultado;
+}
+
+
+// $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+function mostrar_coincidencias_plantilla($id_form,$filtro,$valor,$plantilla) {
+
+ if($valor !=""){
+$md5_valor = $valor;
+if($filtro !='' ){$w_filtro ="AND md5(binary contenido) = '$md5_valor'";}
+}
+$consulta= "SELECT * FROM form_datos WHERE form_id= '$id_form' AND id_campo = '$filtro' $w_filtro ";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+//mysql_real_escape_string($consulta);
+$sql=mysql_query($consulta,$link);
+$control=mysql_result($sql,0,"control");
+if (mysql_num_rows($sql)!=0){
+mysql_data_seek($sql, 0);
+while( $row = mysql_fetch_array( $sql ) )
+ {
+$resultado .= contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+
+ }
+ }
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign("mostrar_resultado","innerHTML",$resultado);
+ return $respuesta;
+}
+$xajax->registerFunction("mostrar_coincidencias_plantilla");
+
+
+function mostrar_coincidencias($id_form,$filtro,$valor) {
+ if($valor !=""){
+$md5_valor = $valor;
+if($filtro !='' ){$w_filtro ="AND md5(binary contenido) = '$md5_valor'";}
+}
+$consulta= "SELECT * FROM form_datos WHERE form_id= '$id_form' AND id_campo = '$filtro' $w_filtro ";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+//mysql_real_escape_string($consulta);
+$sql=mysql_query($consulta,$link);
+
+if (mysql_num_rows($sql)!=0){
+mysql_data_seek($sql, 0);
+while( $row = mysql_fetch_array( $sql ) )
+ {
+ $depliegue = formulario_imprimir_linea($row[form_id],$row[control]);
+ $titulo = formulario_imprimir_linea($row[form_id],$row[control],'titulos');
+ $campos .= " $depliegue ";
+
+ }
+ $resultado = "
";
+ }
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign("mostrar_resultado","innerHTML",$resultado);
+ return $respuesta;
+}
+$xajax->registerFunction("mostrar_coincidencias");
+
+
+function matriz_formulario($formulario,$div,$registros,$pagina,$formato){
+ $respuesta = new xajaxResponse('utf-8');
+if ( !isset ( $_SESSION['id_empresa'] ) ) {
+$respuesta->addRedirect("index.php");
+return $respuesta;
+}
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$md5_filtro = $formulario["campo_filtro"];
+//$formulario = mysql_seguridad($formulario);
+mysql_real_escape_string($formulario);
+$perfil = $formulario["form_id_id"];
+$filtro = $formulario["campo_filtro"];
+$control = md5(rand(1,99999999).microtime());
+
+$cantidad = formulario_contar($perfil);
+$formulario_nombre = remplacetas('form_id','id',$perfil,'nombre') ;
+if($filtro !='' ){$w_filtro ="AND md5(binary contenido) = '$md5_filtro'";}
+if($perfil !=''){$perfil ="AND form_id = '$perfil'";}Else{
+ $resultado ="
Por favor seleccione un formulario";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+ }
+if($cantidad < 1) {
+ $resultado ="
+
+ El formulario \"$formulario_nombre[0]\" no tiene registros
+
+ ";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+
+}
+
+$fecha_inicio = $formulario["inicio"];
+if($fecha_inicio =="" ) { $fecha_inicio ="2000-01-01";}
+$fin = $formulario["fin"];
+$id_campo = $formulario["id_campo"];
+$busqueda = $formulario["busqueda"];
+
+if($formato =='csv') {$orden = "ORDER BY form_datos_id ASC ";}else{$orden = "ORDER BY form_datos_id DESC ";}
+if($id_campo ==''){
+ $campo ='';
+
+ }else{
+ if($busqueda =='') {
+ $resultado ="
Por favor escriba una palabra para buscar";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+ }
+ $campo ="AND id_campo = '$id_campo'";
+
+ }
+
+if($busqueda !=''){$busca ="AND contenido LIKE '%%$busqueda%%'";}Else{$busca ='';}
+
+
+
+$consulta = " SELECT *,from_unixtime(timestamp) AS fecha , form_datos.id AS form_datos_id
+ FROM form_datos, form_campos
+ WHERE form_datos.id_campo = form_campos.id AND form_datos.id_empresa = '$_SESSION[id_empresa]'
+ $busca
+ $perfil
+ $campo
+ $w_filtro
+ AND timestamp BETWEEN UNIX_TIMESTAMP('$fecha_inicio')
+ AND UNIX_TIMESTAMP('$fin 23:59:59') GROUP BY control $orden";
+
+
+
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)==0){
+ $resultado ="
No hay resultados para la consulta ";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+
+ }
+if (mysql_num_rows($sql)!=0){
+ $total_registros = mysql_num_rows($sql);
+ if($formato=='csv'){
+ $nombre_archivo ="tmp/Formulario_".mktime()."_".$_SESSION['id'].".csv";
+ $boton_descarga ="
Descargar ";
+ $archivo_reporte=fopen($nombre_archivo , "w");
+ $encabezado =";;Periodo\n;;$inicio\n;;$fin \n ";
+ fputs ($archivo_reporte,$encabezado);
+ $tabla .= "ID;Fecha;Timestamp;Formulario;Campo;Contenido;Control\n";
+ fputs ($archivo_reporte,$titulo);
+ mysql_data_seek($sql, 0);
+ while( $row = mysql_fetch_array( $sql ) )
+ {
+ $titulo = formulario_imprimir_linea($row[form_id],$row[control],'titulos_csv');
+ $linea = formulario_imprimir_linea($row[form_id],$row[control],'linea_csv');
+ $formulario_nombre = remplacetas('form_id','id',$row[form_id],'nombre') ;
+ $linea = $linea."\n";
+ $lineas .= $linea;
+ }
+ $contenido ="$titulo \n $lineas";
+ //rewind($archivo_reporte);
+ fputs ($archivo_reporte,$contenido);
+ $respuesta->addAssign("boton_descarga","innerHTML",$boton_descarga);
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+
+ }
+ }
+ else{
+ $respuesta ="
No hay resultados
";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+ }
+/// PAGINACION
+ if ($pagina =='') {$inicio = 0; $pagina = 1; }
+ else { $inicio = ($pagina - 1) * $registros;}
+
+ if($total_registros < $registros) { $limite ="";}
+ else{$limite =" LIMIT $inicio, $registros ";}
+ $consulta_limite = $consulta.$limite;
+ $sql=mysql_query($consulta_limite,$link);
+ if (mysql_num_rows($sql)!='0'){
+ $botones .= "
Limpiar ";
+ if($formato!='csv'){
+ $botones .= "
+ Exportar
+ ";
+ }
+ $paginacion ="";
+ $paginacion .= $indice;
+ $encabezado = "
+
+
+
$botones $paginacion $total_registros registros
+
+
";
+$fila=0;
+ mysql_data_seek($sql, 0);
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $formulario_nombre = remplacetas('form_id','id',$row[form_id],'nombre') ;
+ $fila = $fila +1;
+ if ($fila %2 == 0){$bg='LightCyan';}else{ $bg='FFFFFF';}
+ $depliegue = formulario_imprimir_linea($row[form_id],$row[control]);
+ $titulo = formulario_imprimir_linea($row[form_id],$row[control],'titulos');
+ $menu ="
+
+
+
+ ";
+ $campos .= "
$menu $depliegue ";
+ }
+ $resultado .="
";
+ }else{
+ $resultado .="
No hay resultados para la consulta ";
+ }
+ //$resultado .="$consulta";
+$respuesta->addAssign("resultados_encabezado","innerHTML",$encabezado);
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+} $xajax->registerFunction("matriz_formulario");
+
+
+
+function remplacetas($tabla,$campo,$valor,$por,$and){
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
+//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
+$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
+$sql=mysql_query($consulta,$link);
+if (@mysql_num_rows($sql)!=0){
+$resultado[] = mysql_result($sql,0,$por);
+$resultado[] = mysql_result($sql,0,'id');
+$resultado[] = $consulta;
+$resultado[] = mysql_result($sql,0,"md5_$por");
+ }else{
+ $resultado[0] = '';
+ $resultado[1] ="";
+ $resultado[2] = $consulta;
+ $resultado[3] = NULL;
+ }
+return $resultado;
+}
+
+function formulario_campos_select($perfil,$div,$onchange){
+ $respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta = "
+ SELECT * FROM form_contenido_campos, form_campos
+ WHERE form_contenido_campos.id_campo = form_campos.id
+ AND id_form = '$perfil'
+ ORDER BY campo_nombre ASC";
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+
+ $categoria = remplacetas('form_parametrizacion','campo',$perfil,'descripcion'," opcion = 'categoria'") ;
+ $categoria = $categoria[0];
+$resultado = "
Campo
+
+ Todos los campos ";
+while( $row = mysql_fetch_array( $sql ) ) {
+$resultado .= " $row[campo_nombre] ";
+if($div =='') {
+ if ($row[id_campo] == "$categoria"){
+ $class="active";
+ $filtro = formulario_campos_filtro("$perfil","$row[id_campo]","");
+ }else { $class=""; $filtro ='';}
+ $listado .="$row[id_campo] $row[campo_nombre] $filtro ";
+ }
+ }
+$resultado .= "
+
"; }
+else{$resultado = '';}
+
+if($div =='') {return $listado;}
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+
+ }
+$xajax->registerFunction("formulario_campos_select");
+
+
+function formulario_campos_filtro($perfil,$campo,$div,$onchange){
+ $respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta = "
+ SELECT md5(binary contenido) as md5_contenido, contenido FROM form_datos
+ WHERE form_id = '$perfil'
+ AND id_campo = '$campo'
+ GROUP BY contenido
+ ORDER BY contenido asc";
+
+
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+$resultado = "
+ Filtro
+
+ Seleccione ";
+while( $row = mysql_fetch_array( $sql ) ) {
+$resultado .= " $row[contenido] ";
+ }
+$resultado .= "
+
";
+ }
+else{$resultado = "
No se encontraron resultados
";}
+
+if($div !="") {
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+ }else{return $resultado;}
+
+ }
+$xajax->registerFunction("formulario_campos_filtro");
+
+
+//$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo","$id_campo");
+function formulario_consultar($div){
+ if($div==''){
+ $div = "contenido";
+ $resultado = "
Consultas";
+ return $resultado;
+ }
+ $formulario = select('form_id','id','nombre','xajax_formulario_campos_select((this.value),\'div_campos\')',"id_empresa = '$_SESSION[id_empresa]'",'');
+ $fecha = time ();
+ $ahora = date ( "Y-m-d" , $fecha );
+ $peticion = "
+
+
+
+
+
+
+
+
+ Formulario
+ $formulario
+
+
+
+
+
+
+
+
Consultar
+
+
+";
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($div,"innerHTML",$peticion);
+return $respuesta;
+}
+$xajax->registerFunction("formulario_consultar");
+
+
+function formulario_campos_procesar($form,$tipo_accion){
+ //$form = mysql_seguridad($form);
+$respuesta = new xajaxResponse('utf-8');
+$campo_nombre = $form["campo_nombre"];
+if($campo_nombre =='') {
+$respuesta->addAlert("El Nombre del campo no puede estar vacío");
+$respuesta->addAssign("grupo_campo_nombre","className"," input-group has-error ");
+return $respuesta;
+}
+
+//$campo_nombre = ucfirst(strtolower($campo_nombre));
+$campo_descripcion = $form["campo_descripcion"];
+$campo_tipo = $form["campo_tipo"];
+$campo_area = $form["campo_area"];
+$misma_area = $form["misma_area"];
+$campo_orden = $form["campo_orden"];
+$campo_identificador = $form["campo_identificador"];
+$activo = $form["activo"];
+$tipo = $form["tipo"];
+$editar = $form["editar"];
+$id_campo_editar = $form["id_campo_editar"];
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+if ($editar == 'editar' AND $tipo_accion =='editar'){
+mysql_query("
+ UPDATE `form_campos`
+ SET `campo_nombre` = '$campo_nombre',
+ `campo_descripcion` = '$campo_descripcion',
+ `orden` = '$campo_orden' ,
+ `campo_area` = '$campo_area',
+ `campo_tipo` = '$campo_tipo',
+ `id_empresa` = '$_SESSION[id_empresa]',
+ `activo` = '$activo'
+ WHERE `form_campos`.`id` ='$id_campo_editar'
+ LIMIT 1",$link);
+$w_campo = "id = '$id_campo_editar'";
+
+ }else {
+$id_empresa = $_SESSION['id_empresa'];
+$id_especialista = $_SESSION['id'];
+ $buscar_campo_nombre = remplacetas('form_campos','campo_nombre',$campo_nombre,'campo_nombre'," id_empresa = '$id_empresa' AND campo_area = '$campo_area' ") ;
+ if($buscar_campo_nombre[0] == $campo_nombre) {
+ $respuesta->addAlert("El Nombre del campo ( $campo_nombre ) ya existe en la misma área ");
+ $respuesta->addAssign("grupo_campo_nombre","className"," input-group has-error ");
+ return $respuesta;
+ }
+if($campo_identificador == "") { $campo_identificador = md5($_SESSION[id_usuario]."-".microtime()); }
+$consulta = "
+ INSERT INTO `form_campos`
+ (`id_especialista`, `campo_nombre`,`campo_descripcion`,`campo_tipo`, `campo_area`, `orden`, `activo`, `identificador`, `id_empresa`)
+ VALUES ('$id_especialista','$campo_nombre','$campo_descripcion','$campo_tipo','$campo_area','$campo_orden','1','$campo_identificador','$id_empresa')";
+ $sql =mysql_query($consulta,$link);
+ $ultimo_id = mysql_insert_id();
+$w_campo= "identificador = '$campo_identificador'";
+if($sql) {
+ $listado_campos = select('form_campos','id','campo_nombre',"xajax_formulario_crear_campo('',(this.value),'div_campos')","id_empresa = '$_SESSION[id_empresa]' AND activo = '1'",'campo_editar');
+ $campos_formulario ="
+
+
+ El campo se creó con éxito
+ Crear un nuevo campo
+ Modificar campo $listado_campos
+ ";
+ if($form['agregar_id_form'] !="") {
+ $respuesta->AddScript("xajax_agregar_campos('grabar_campos','contenido','$ultimo_id','$form[agregar_id_form]') ");
+ ///$respuesta->addAssign("$div","innerHTML",$resultado);
+ //return $respuesta;
+ }
+ }else {$campos_formulario = "
Problemas al grabar el campo $consulta";}
+ }
+
+if($id_campo_editar !='' AND $tipo_accion =='editar'){$id_form_campo = $id_campo_editar;}else {
+//$id_form_campo = mysql_insert_id($link);
+$id_form_campo = $ultimo_id;
+}
+//$respuesta->addAlert("( $campo_tipo / $id_form_campo / $ultimo_id / $form[opciones] ) $consulta");
+//$respuesta->addAssign("contenido","innerHTML","$consulta_campos_valores");
+//return $respuesta;
+if($campo_tipo == '23' ){
+$grabar_campos_valores = "(".$id_form_campo.",'".$form[opciones]."')";
+}
+/// separacion por comas
+else {
+$opciones=str_replace(', ',',',"$form[opciones]");
+$opciones = explode(",",$opciones);
+
+foreach($opciones as $c=>$v){
+
+ //if($v !='') {$v = ucfirst(strtolower($v));
+ if($v !='') {$v = $v;
+
+$grabar_campos_valores .= "( $id_form_campo ,'$v'),";
+ }
+
+ }
+$grabar_campos_valores =substr ("$grabar_campos_valores",0,-1);
+} /// fin de separacion por comas
+
+$borrar_campos_valores = "DELETE FROM `form_campos_valores` WHERE `id_form_campo` = '$id_form_campo'";
+$consulta_campos_valores = "INSERT INTO form_campos_valores (id_form_campo,campo_valor) VALUES ".$grabar_campos_valores."";
+
+ $sql_borrar_campos_valores =mysql_query($borrar_campos_valores,$link);
+ $sql_campos_valores =mysql_query($consulta_campos_valores,$link);
+
+ $campos=mysql_query("
+ SELECT id_form_campo, campo_nombre, campo_descripcion, tipo_campo_accion, campo_area, orden
+ FROM `consulta_campos` , `tipo_campo`
+ WHERE $w_campo
+
+ AND form_campos.campo_tipo = form_tipo_campo.id_tipo_campo
+ LIMIT 1",$link);
+
+
+$campos_formulario .= "
";
+while( $row = mysql_fetch_array( $campos ) ) {
+if ($row['tipo_campo_accion']=='textarea'){
+$campos_formulario .= "
".$row['orden']."";}
+else{
+$campos_formulario .= "
".$row['orden']." ";
+ } }
+
+$respuesta->addAssign("formulario_campos_$misma_area","innerHTML",$campos_formulario);
+return $respuesta;
+}$xajax->registerFunction("formulario_campos_procesar");
+
+function formulario_opciones_select($tipo,$id_campo){
+ $respuesta = new xajaxResponse('utf-8');
+ $div = 'opciones_select';
+if($id_campo !=''){
+$consulta= "SELECT * FROM form_campos_valores WHERE id_form_campo = '$id_campo'";
+$link = Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+while( $row = mysql_fetch_array( $sql ) ) {
+ $valores .= "$row[campo_valor],";
+ }
+ $valores = substr($valores,0,-1);
+ }
+ }
+if($tipo =='8'){
+$resultado = "
$valores ";
+ }
+elseif($tipo =='9'){
+$resultado = "
$valores ";
+ }
+elseif($tipo =='16'){
+ if($valores =='') {$valores = "1,10";}
+$resultado = "
$valores ";
+ }
+elseif($tipo =='17'){
+ $resultado ="
";
+}
+else{
+$resultado = "
$valores ";
+}
+$respuesta->addAssign("$div","innerHTML",$resultado);
+return $respuesta;
+}
+$xajax->registerFunction("formulario_opciones_select");
+
+
+
+function crear_campos_formulario($form,$id_form){
+$form = mysql_seguridad($form);
+$respuesta = new xajaxResponse('utf-8');
+if($form['div'] !="") { $div = $form['div'];}else{$div="div_campos";}
+
+$especialista = $form["id_especialista"];
+$id_campo_editar = $form["id_campo_editar"];
+$resultado = "
+
+$id_campo_editar";
+$link = Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$capa = "crear_campos_consulta_$area";
+$formulario ="manejo_campos_$area";
+
+if ($id_campo_editar > 0){
+$sql=mysql_query("SELECT * FROM form_campos WHERE id = '$id_campo_editar' AND activo ='1'",$link);
+while( $row = mysql_fetch_array( $sql ) ) {
+$resultado .="";
+$campo_descripcion =$row['campo_descripcion'];
+$campo_nombre =$row['campo_nombre'];
+$orden =$row['orden'];
+$especialista =$row['id_especialista'];
+
+$formulario ="manejo_campos_$id_campo_editar";
+$editar="
+
+
+
";
+$Campo_tipo_definido= $row['campo_tipo'];
+}
+ }
+
+$Tipo_campo ="
Tipo:
+
";
+$tipos=mysql_query("
+ SELECT *
+ FROM `form_tipo_campo`
+ WHERE activo = '1'
+ ",$link);
+while( $row = mysql_fetch_array( $tipos ) ) {
+
+if($row['id_tipo_campo'] == $Campo_tipo_definido){
+$Tipo_campo .= " > ".$row['id_tipo_campo']." - ".$row['tipo_campo_nombre']." < ";
+ }
+$Tipo_campo .= " ".$row['id_tipo_campo']." - ".$row['tipo_campo_nombre']." ";
+}
+$Tipo_campo .="
";
+
+
+if($id_form !="") {
+
+$agregar_a_formulario = "
+
+
+
+ Incluir este campo en el formulario actual
+
+
+ ";
+}else {$agregar_a_formulario = "";}
+
+$identificador = md5($_SESSION[id_usuario]."-".microtime());
+$areas = select('form_areas','id','nombre','',"id_empresa = '$_SESSION[id_empresa]'",'campo_area');
+$resultado .= "
+
+
";
+$resultado = "
+
+
+ Crear un nuevo campo
+ $resultado
+
+";
+$respuesta->addAssign("$div","innerHTML",$resultado);
+return $respuesta;
+}
+$xajax->registerFunction("crear_campos_formulario");
+
+function formulario_crear_campo($area,$campo,$div){
+$respuesta = new xajaxResponse('utf-8');
+ if($div==''){
+ $div = "contenido";
+ $cerrar = "
[X] ";
+$resultado = "
Campos ";
+
+ return $resultado;
+ }
+ //$div="div_campos";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta_campos ="SELECT id, campo_nombre, campo_descripcion, tipo_campo_accion, campo_area, form_campos.activo, form_campos.campo_tipo
+ FROM `form_campos` , `form_tipo_campo`
+ WHERE id_empresa = '$_SESSION[id_empresa]' AND id = $campo
+ AND form_campos.campo_tipo = form_tipo_campo.id_tipo_campo
+ ORDER BY orden ASC";
+ $campos=mysql_query($consulta_campos,$link);
+if($campo ==''){
+
+ $listado_campos = select('form_campos','id','campo_nombre',"xajax_formulario_crear_campo('',(this.value),'$div')","id_empresa = '$_SESSION[id_empresa]' AND activo = '1'",'campo_editar');
+$areas = tabla_areas('form_areas','id','nombre,descripcion,estado,orden','',"",'Areas','');
+$tabla_campos = campos_tabla('id_especialista','');
+$campos_formulario = "
+
+
+
+
+
+
+
+
+
+
+
+
+
$tabla_campos
+";
+}else{
+$campos_formulario .= "
";
+while( $row = mysql_fetch_array( $campos ) ) {
+// if($row[campo_tipo] =='8'){
+ $respuesta->addScript("xajax_formulario_opciones_select('$row[campo_tipo]','$campo') ");
+// }
+ $Tipo_campo ="
Tipo:
+
";
+$tipos=mysql_query("
+ SELECT *
+ FROM `form_tipo_campo`
+ WHERE activo = '1'
+ ",$link);
+while( $row_tipo = mysql_fetch_array( $tipos ) ) {
+
+if($row_tipo['id_tipo_campo'] == $row[campo_tipo] ){
+$Tipo_campo .= " > ".$row_tipo['id_tipo_campo']." - ".$row_tipo['tipo_campo_nombre']." < ";
+ }
+$Tipo_campo .= " ".$row_tipo['id_tipo_campo']." - ".$row_tipo['tipo_campo_nombre']." ";
+}
+$Tipo_campo .="
";
+
+if($row[activo] =='1'){$activo = "
Activo: el campo puede ser usado en formularios ";}
+else{$activo = "
Inactivo: El campo NO se usará ";}
+$formulario = "editar_campos";
+$areas = select('form_areas',"id",'nombre','',"id_empresa = '$_SESSION[id_empresa]'",'campo_area',"$row[campo_area]");
+
+$campos_formulario .= "
+
+
+
+
+
+
+
";
+
+ }
+ }///fin de edicion
+
+
+
+$respuesta->addAssign($div,"innerHTML",$campos_formulario);
+
+return $respuesta;
+}
+$xajax->registerFunction("formulario_crear_campo");
+
+function agregar_campos($tipo,$div,$id,$formulario){
+$respuesta = new xajaxResponse('utf-8');
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+if($tipo==''){
+ $div="contenido";
+$resultado = "
Editar";
+print $resultado;
+return;
+ }
+ if($tipo=='consultar_listado'){
+ $consulta="SELECT * FROM form_id WHERE id_empresa = '$_SESSION[id_empresa]' ORDER BY nombre ASC";
+ $sql =mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+$resultado .="Formulario:
";
+$resultado .= "Selecciona ";
+while( $row = mysql_fetch_array( $sql ) ) {
+$resultado .= "$row[nombre] ";
+ }
+$resultado .=" $cerrar";
+ }else {
+$resultado = "
No hay formularios para editar
";
+ }
+ }
+
+if ($tipo=='consultar_campos'){
+ $consulta="
+ SELECT form_contenido_campos.id_campo, form_contenido_campos.id,
+ campo_nombre, obligatorio,control,multiple,form_contenido_campos.orden
+ FROM form_contenido_campos, form_campos
+ WHERE form_campos.id_empresa = '$_SESSION[id_empresa]' AND form_contenido_campos.id_form = $id
+ AND form_contenido_campos.id_campo = form_campos.id
+ ORDER BY form_contenido_campos.orden";
+ $sql =mysql_query($consulta,$link);
+ $consulta_nombre="SELECT * FROM form_id WHERE id ='$id'";
+ $sql_nombre =mysql_query($consulta_nombre,$link);
+ $nombre =mysql_result($sql_nombre,0,"nombre");
+ //if (mysql_num_rows($sql)!='0'){
+$resultado ="$cerrar
$nombre
+ ";
+$resultado .= "
+
+ Campo
+
+
+ Obligatorio
+
+
+ Orden
+
+
+ Multiple
+
+
+ Borrar
+
+
+
";
+
+while( $row = mysql_fetch_array( $sql ) ) {
+ /* $multiple = remplacetas('form_parametrizacion','campo',"$id",'descripcion'," tabla='form_id' and opcion = '$row[id]' AND descripcion REGEXP '^multiple:' ") ;
+ $multiple = explode(":",$multiple[0]);
+ $multiple = $multiple[1];*/
+
+ //$multiple = $multiple[0];
+$resultado .= "
+
+ $row[id_campo] $row[campo_nombre]
+
+
+
+
+
+
+
";
+ }
+
+$consulta_campos_todos ="SELECT form_campos.id, form_campos.campo_nombre, form_campos.campo_descripcion FROM form_campos WHERE form_campos.id_empresa = '$_SESSION[id_empresa]'
+ ORDER BY campo_nombre ";
+$sql_consulta_campo =mysql_query($consulta_campos_todos,$link);
+
+$crear_nuevo ="
+
+
+
+
+
+
+";
+ while( $row = mysql_fetch_array( $sql_consulta_campo ) ) {
+$valores .= "
$row[campo_nombre] [$row[id]] ";
+ }
+$resultado .="
+
+
+
+$crear_nuevo ";
+
+ }/// fin de consultar_campos
+
+if($tipo=='grabar_campos'){
+ if ($id=="nuevo")
+{
+
+
+}
+elseif($id =="") { $div='atencion';$resultado="
Seleccione un campo";}
+else {
+$id_form=func_get_arg(3);
+$consulta = "SELECT id_campo FROM form_contenido_campos WHERE id_empresa = '$_SESSION[id_empresa]' AND id_campo= '$id' AND id_form= $id_form";
+$sql_consulta =mysql_query($consulta,$link);
+$id_empresa= $_SESSION['id_empresa'];
+if(mysql_num_rows($sql_consulta) =='0') {
+$microtime = microtime();
+$consulta_grabar=" INSERT INTO form_contenido_campos (
+`id_campo` ,
+`id_empresa` ,
+`id_form` ,
+`obligatorio`,
+`control`
+)
+VALUES (
+'$id', '$id_empresa', '$id_form', '0', md5('$microtime' + rand())
+)";
+$sql_consulta_grabar =mysql_query($consulta_grabar,$link);
+$respuesta->addScript("xajax_agregar_campos('consultar_campos','$div','$id_form')");
+return $respuesta;
+ }else{
+$div='atencion';$resultado="
El campo ya pertenece a esta consulta ";
+ }
+ }
+
+ }///fin de grabar_campos
+
+if($tipo=='eliminar'){
+$confirmar=func_get_arg(3);
+
+
+if($id==''){
+$id_c=func_get_arg(4);
+$capa_original=func_get_arg(5);
+$resultado = "
+ Seguro que desea eliminar el campo de esta consulta?
+
[SI]
+
[NO]
+
+ ";}
+ else{
+ if($id=='x'){ /// si se pasa una x como argumento se regresa a la capa original
+$resultado .= "
+
+ ";
+ }else{
+$consulta="DELETE FROM `form_contenido_campos` WHERE `control` = '$confirmar' LIMIT 1";
+$sql_consulta_eliminar = mysql_query($consulta,$link);
+$div=func_get_arg(5);
+$id_consulta=func_get_arg(4);
+$respuesta->addScript("xajax_agregar_campos('consultar_campos','$div','$id_consulta')");
+
+ }
+ }
+
+ }/// fin de eliminar
+if($tipo == 'obligatorio'){
+if($id == '0'){$id='1';}else{$id='0';}
+$control = func_get_arg(3);
+$consulta= "UPDATE `form_contenido_campos` SET `obligatorio` = '$id' WHERE `control` = '$control' LIMIT 1 ";
+$sql_consulta_grabar =mysql_query($consulta,$link);
+$a ="
$id
+ ";
+$respuesta->addAssign($div,"innerHTML",$a);
+return $respuesta;
+
+ }/// fin de obligatorio
+if($tipo == 'orden'){ /// orden
+$control = func_get_arg(3);
+$consulta= "UPDATE `form_contenido_campos` SET `orden` = '$id' WHERE `control` = '$control' LIMIT 1 ";
+$sql_consulta_grabar =mysql_query($consulta,$link);
+$a ="
$id
+ ";
+
+$respuesta->addAssign($div,"innerHTML",$a);
+return $respuesta;
+
+ }/// fin de obligatorio
+
+if($tipo == 'prellenado'){
+if($id == '0'){$id='1';}else{$id='0';}
+$control = func_get_arg(3);
+$consulta= "UPDATE `consulta_tipo_campos` SET `prellenado` = '$id' WHERE `control` = '$control' LIMIT 1 ";
+$sql_consulta_grabar =mysql_query($consulta,$link);
+$a ="
$id
+ ";
+$respuesta->addAssign($div,"innerHTML",$a);
+return $respuesta;
+
+ }/// fin de oprellenado
+$respuesta->addAssign($div,"style.display","block");
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+
+ }
+$xajax->registerFunction("agregar_campos");
+
+function formulario_nuevo($formulario,$div){
+ $formulario = mysql_seguridad($formulario);
+ $respuesta = new xajaxResponse('utf-8');
+ $id=mysql_real_escape_string($id);
+ $id_empresa= $_SESSION['id'];
+ if($div==''){
+ $div = "contenido";
+
+$resultado .= "
Formulario ";
+
+ return $resultado;
+ }
+if($formulario ==''){
+ $formulario_nombre = "nuevo_formulario";
+ $formulario_respuesta = select('form_id','id','nombre','',"id_empresa = '$_SESSION[id_empresa]'",'formulario_respuesta','');
+$resultado .= "
+
+Crear un formulario
+
+ Nombre para el formulario
+
+
+
+ Descripción
+
+
+
+ Formulario anidado con:
+ $formulario_respuesta
+
+
+ Grupo:
+
+
+
+
+ Privado
+
+ Público
+
+
+
+
+
+ Grabar
+
+
+ ";
+
+ }else{
+$control = md5(rand(1,99999999).microtime());
+
+$nombre = $formulario['nombre']; // aa
+$descripcion = $formulario['descripcion']; // dxddc
+$publico = $formulario['publico']; // dxddc
+$grupo = $formulario['grupo'];
+
+if($publico =='') {$publico ='0';}
+$propietario= $_SESSION['id'];
+$formulario_respuesta = $formulario['formulario_respuesta']; // dxddc
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta = "INSERT INTO `form_id` ( `nombre`, `descripcion`, `activo`, `modificable`, `publico`, `propietario`, `formulario_respuesta`, `id_empresa`)
+VALUES ('$nombre', '$descripcion', '1', '1', '$publico', '$propietario','$formulario_respuesta','$_SESSION[id_empresa]');";
+$sql=mysql_query($consulta,$link);
+$ultimo_id = mysql_insert_id();
+ if($grupo !="") {
+ $consulta_grupo = "INSERT INTO form_grupo set id = '$ultimo_id',grupo = '$grupo'";
+ $sql_grupo=mysql_query($consulta_grupo,$link);
+ }
+
+$respuesta->addscript("xajax_formulario_listado('','contenido'); ");
+}
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+}$xajax->registerFunction("formulario_nuevo");
+
+
+function formulario_listado($filtro_grupo,$div){
+if ( !isset ( $_SESSION['id_empresa'] ) ) {
+ $respuesta = new xajaxResponse('utf-8');
+$respuesta->addRedirect("index.php");
+return $respuesta;
+}
+
+ $id_empresa= $_SESSION['id_empresa'];
+ if($div==''){
+ $div = "contenido";
+$resultado = "
Formularios ";
+
+ return $resultado;;
+ }
+$control = md5(rand(1,99999999).microtime());
+$respuesta = new xajaxResponse('utf-8');
+$_SESSION['grupo_formularios'] = $filtro_grupo;
+
+$link=Conectarse();
+ $id=mysql_real_escape_string('$id');
+mysql_query("SET NAMES 'utf8'");
+if($filtro_grupo =="") {
+$consulta = "SELECT * FROM form_id WHERE id_empresa ='$_SESSION[id_empresa]' ORDER BY orden ASC";
+ }
+else {
+$consulta = "
+SELECT * FROM form_id, form_grupo
+WHERE form_grupo.id = form_id.id
+AND form_grupo.grupo = '$filtro_grupo'
+AND form_id.id_empresa ='$_SESSION[id_empresa]' ORDER BY orden ASC";
+}
+$sql=mysql_query($consulta,$link);
+if($filtro_grupo !="") {
+ $leyenda_filtro_grupo ="
Grupo $filtro_grupo ";
+
+ }else{ $leyenda_filtro_grupo ="
Formularios "; unset($_SESSION['grupo_formularios']);}
+$resultado_link = "
Formularios ";
+$respuesta->addAssign("link_formulario","innerHTML",$resultado_link);
+
+
+$divider = 1;
+$columnas = intval(12/$divider);
+ $listado_grupos = select_empresa('form_grupo','grupo','grupo',"xajax_formulario_listado((this.value),'contenido')","AGRUPADO",'','',"$id_empresa");
+ $listado_grupos ="
+
+ Seleccione un grupo de formularios
+ $listado_grupos
+
+
+ ";
+
+ $nuevo_formulario = "
+
";
+ $resultado = "
+
+ $nuevo_formulario
+
+
+ $listado_grupos
+
+ $leyenda_filtro_grupo
+
+ ";
+
+if (mysql_num_rows($sql)!='0' ){
+ $i =0;
+
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $id= $row['id'];
+ $C = $id;
+
+ $cantidad = formulario_contar($row['id']);
+ if($cantidad >0) {$cantidad ="
Llenado: $cantidad veces ";}else{$cantidad = "";}
+ $propietario = remplacetas('usuarios','id',$row['propietario'],'email',"") ;
+ $estado = remplacetas('form_id','id',$id,'publico',"") ;
+ $nombre_formulario = remplacetas('form_id','id',$id,'nombre',"") ;
+ $descripcion_formulario = remplacetas('form_id','id',$id,'descripcion',"") ;
+ $estado = "
+
+ Contenido privado
+
+ Público
+
+ ";
+ $modificable = remplacetas('form_id','id',$id,'modificable',"") ;
+ $modificable = "
+
+ Formulario privado
+
+ Público
+
+ ";
+
+
+ $primer = formulario_uso("$id",'','primer') ;
+ if($primer[0] !='') {$primer = "
Primer registro: ".date ( "Y-m-d h:i:s" , $primer[0])." ";}else{$primer='';}
+ $ultimo = formulario_uso("$id",'','ultimo') ;
+ $ultimo_control = $ultimo[1];
+ if($ultimo[0] !='') {$ultimo = "
Último registro: ".date ( "Y-m-d h:i:s" , $ultimo[0])." ";}else{$ultimo='';}
+
+ $nombre = editar_campo("form_id",$row['id'],"nombre","","","");
+ $orden = editar_campo("form_id",$row['id'],"orden","","","");
+ $descripcion = editar_campo("form_id",$row['id'],"descripcion","","","");
+ $geo = buscar_campo_tipo($id,"14");
+ $email_envio = remplacetas('form_parametrizacion','campo',"$row[id]",'descripcion'," tabla='form_id' and opcion = 'email'") ;
+ if($geo[0] !='') { $mapa= "
Mapa";}else {$mapa='';}
+
+ if($i % $divider==0) {
+
+$item .= "
+
+
+
+ ";
+ }
+ $i++;
+ $grupo_actual = remplacetas('form_grupo','id',$row['id'],'grupo',"") ;
+ if(is_null($grupo_actual[3])) {
+ $valores_grupo[id]=$row[id];
+ $valores_grupo[grupo]="";
+ $grupo = "
+
+ ";
+ // $grupo = "Grupo ".editar_campo("form_grupo",$row['id'],"grupo","","","");
+ }else
+ {
+ $grupo = "".editar_campo("form_grupo",$row['id'],"grupo","","","");
+ }
+
+$item .= "
+
+
+
+
+
+
+
+ Creación: $row[creacion] / $propietario[0]
+ $cantidad
+ $ultimo
+ $primer
+ $mapa
+
+
+
+
+
$row[id]
+
+
+
+
+
+
+
+
+
+
+
+
Agregar o quitar campos
+
+
+
+
+
+
+
+ Nombre: $nombre
+ Descripción: $descripcion
+ Orden: $orden Grupo: $grupo
+
+
+
+
+
+
+
+ $estado
+
+
+ $modificable
+
+
+
+
+
+ ";
+
+
+ if($i%$divider==0) {
+ $item .= "
";
+ }
+
+ }
+
+
+ //$resultado .="";
+ }
+
+
+else{ $resultado .= "
Aún no se han diseñado formularios ";}
+
+ $resultado_formulario ="
+
+ $item
+
";
+ $resultado = "$resultado $resultado_formulario ";
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+}$xajax->registerFunction("formulario_listado");
+
+function formulario_eliminar($id,$tipo) {
+ $respuesta = new xajaxResponse('utf-8');
+ $nombre = remplacetas('form_id','id',$id,'nombre',"") ;
+ $nombre_form = $nombre[0];
+ if($tipo =='') {
+$resultado ="
";
+}elseif($tipo=='cancelar') {
+ $resultado ="
Eliminar";
+}elseif($tipo =='eliminar'){
+$consulta = "DELETE FROM form_id WHERE form_id.id = '$id' ";
+$link=Conectarse();
+ $sql=mysql_query($consulta,$link);
+ if($sql) {
+ $respuesta->addAlert("Se eliminó el formulario \" $nombre_form \" ");
+ $respuesta->addAssign("panel_$id","innerHTML","");
+ return $respuesta;
+
+ }
+}
+else {}
+$respuesta->addAssign("eliminar_$id","innerHTML",$resultado);
+
+return $respuesta;
+}$xajax->registerFunction("formulario_eliminar");
+
+
+function campo_multiple($id_campo,$id_form,$control,$item){
+//if ( !isset ( $_SESSION['id'] ) ) { return;}
+
+ if($item==''){$item=1;}
+ $id= $item;
+$render = formulario_campos_render($id_campo,$id_form,$control,$item+1);
+ $ingredientes = "
+
+ $render
+
+
+
+
+ ";
+ $boton= "
+ Agregar campo
+
";
+$div = "id_campo_$id_campo"."_".$id;
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($div,"innerHTML",$ingredientes);
+$respuesta->addAssign("boton_".$id_campo."","innerHTML","$boton ");
+return $respuesta;
+
+}
+$xajax->registerFunction("campo_multiple");
+
+
+function formulario_campos_render($id_campo,$id_form,$control,$item,$id_dato){
+
+
+$consulta ="
+ SELECT *
+ FROM form_contenido_campos,form_campos, form_tipo_campo
+ WHERE form_contenido_campos.id_form = '$id_form'
+ AND form_contenido_campos.id_campo = '$id_campo'
+ AND form_contenido_campos.id_campo = form_campos.id
+ AND form_tipo_campo.id_tipo_campo = form_campos.campo_tipo ";
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $sql=mysql_query($consulta,$link);
+ if (mysql_num_rows($sql)!='0'){
+ if($id_dato !='') {
+ $value = remplacetas('form_datos','id',$id_dato,'contenido'," control = '$control'") ;
+ $multiple='0';
+ }
+ else {
+ $value = remplacetas('form_datos','id_campo',$id_campo,'contenido'," control = '$control'") ;
+ $multiple=mysql_result($sql,0,"multiple");
+ }
+ if($item=='') {$item ="0";}else {$item=$item;}
+
+ if($value[0] !='') {$value= "$value[0]";}ELSE{$value='';}
+ $campo_nombre=mysql_result($sql,0,"campo_nombre");
+ $campo_descripcion=mysql_result($sql,0,"campo_descripcion");
+ $campo_tipo_accion=mysql_result($sql,0,"tipo_campo_accion");
+ $campo_obligatorio=mysql_result($sql,0,"obligatorio");
+ if($campo_obligatorio =='1') {$obligatorio ="danger";}else{$obligatorio ="default";}
+
+ if($campo_tipo_accion == 'text'){$render = "
";}
+ elseif($campo_tipo_accion == 'date'){$render = "
";}
+ elseif($campo_tipo_accion == 'rango'){
+ $rango = rango("form_campos_valores","campo_valor","id_form_campo","$id_campo","$value","".$id_campo."[".$item."]",""); $render = $rango;}
+ elseif($campo_tipo_accion == 'mapa'){
+ $campos = explode(" ",$value);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+ if($lat =="") {
+ $localizacion = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ;
+ //$render= $localizacion[0];
+ $campos = explode(" ",$localizacion[0]);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+
+ }
+ $render .= "
+
+
+
+
+
+ ";
+ $cols='12';
+ }
+elseif($campo_tipo_accion == 'email'){$render = "
+
+
Escriba un email válido
";}
+ elseif($campo_tipo_accion == 'envio'){$render = "
+
+
Se enviará un email
";}
+ elseif($campo_tipo_accion == 'textarea'){
+ $render = "
$value ";
+ $cols='12';
+ }
+ //$subir_imagen = subir_imagen('');
+ elseif($campo_tipo_accion == 'imagen'){
+ $style ="display:hidden";
+ // $gps = leer_exif($file);
+ $render= "
"; //subir_imagen('',$id_campo[$item]);
+ $cols='12'; }
+
+ elseif($campo_tipo_accion == 'html'){
+ $render = "
+
+
$value ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'limit'){
+ $limite = limite("".$id_campo."[".$item."]",'','limite');
+ $rows = ceil($limite / 50 )+1;
+ $render = "$limite /
+
+
+
$value
+ ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'select'){
+
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = select_edit($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "$select "; $cols='12'; }
+ elseif($campo_tipo_accion == 'radio'){
+ $select = radio_edit($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "$select ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'radio_agrupado_campos'){
+
+ $campos_valores = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ;
+ $mensaje = remplacetas('form_campos','id',$id_campo,'campo_descripcion',"") ;
+ $campos = explode(":",$campos_valores[0]);
+ $titulos = explode(";",$campos[0]);
+ $campos_incluidos = explode(";",$campos[1]);
+ for($i=0;$i
$campos_incluidos[$i] ";
+ //$select = radio_agrupado_linea($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "
+ $mensaje[0]
+ $listado_titulos
+ $listado_campos
+
";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'radio_agrupado_linea'){
+
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = radio_agrupado_linea($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = " ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'checkbox'){
+
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = checkbox_edit($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "$select ";}
+ elseif($campo_tipo_accion == 'combo'){
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = combo_select($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'relacion'){
+ $select = relacion_select($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'buscador'){
+ $select = buscador_campo($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'base'){
+ $select = buscador_base($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";}
+ elseif($campo_tipo_accion == 'vinculado'){
+ $vinculado = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ;
+ $select = formulario_areas($vinculado[0],'campos');
+ $render = "
+ $select
+ ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'number'){
+ $render = "
+
+ (solo números)
";}
+
+ elseif($campo_tipo_accion == 'password'){
+ $render = "
+
+ ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'unico'){
+ $render ="
+
";
+ }
+ else{$render = " ";}
+ if($multiple =='1'){
+
+
+ $campo_multiple = "
+
+ ";
+}
+ if($item == 0) { $label = " $campo_nombre ";}
+ else {$label = "$campo_nombre $campo_obligatorio ";}
+ ///// CAMPOS QUE NO SE MOSTRARAN
+ if($campo_tipo_accion == 'imagen'){
+ $label="";
+ }
+ if($cols =="") {$cols = "6";}
+ $input = "
+
+$campo_multiple
+ ";
+
+
+if($campo_tipo_accion != "oculto") {
+ $input= $input;
+ }else { $input ="";}
+
+ }
+ return $input;
+}
+
+
+function validar_email($email) {
+
+if (preg_match('/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/',$email)) {
+ return 1;
+}else{
+ return 0;
+}
+}
+
+function formulario_valor_campo_ORIGINAL($perfil,$id_campo,$valor,$id_control){
+
+
+//if($id_control !=""){ $control ="AND `control` = '$id_control'";}else {$control ="";}
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$valor=mysql_real_escape_string($valor);
+if($valor !=""){ $valor ="AND md5(contenido) LIKE '$valor'";}else {$valor ="";}
+$consulta = "SELECT * FROM `form_datos` WHERE `form_id` = '$perfil' AND id_campo='$id_campo' $valor AND `control` = '$id_control' ORDER BY timestamp DESC limit 1";
+$sql =mysql_query($consulta,$link);
+$cant =mysql_num_rows($sql);
+
+if (mysql_num_rows($sql) == '0'){
+ $existe = NULL;
+ }else {
+
+$control=mysql_result($sql,0,"control");
+$timestamp=mysql_result($sql,0,"timestamp");
+mysql_data_seek($sql, 0);
+if($cant === 1) {
+ $contenido=mysql_result($sql,0,"contenido");
+ }else {
+while( $row = mysql_fetch_array( $sql ) ) {
+ $contenido .= "$row[contenido] ";
+ }
+ }
+$existe[]= $control;
+$existe[] = $timestamp;
+$existe[] = $consulta;
+$existe[] = $contenido;
+}
+return $existe;
+ }
+
+
+
+function formulario_valor_campo($perfil,$id_campo,$valor,$id_control,$orden){
+
+
+//if($id_control !=""){ $control ="AND `control` = '$id_control'";}else {$control ="";}
+$campo_multiple = remplacetas("form_contenido_campos","id_campo",$id_campo,"multiple"," id_form ='$perfil'");
+$tipo_campo = remplacetas("form_campos","id","$id_campo","campo_tipo","");
+$campo_multiple = $campo_multiple[0];
+if($tipo_campo[0] =="24") {$campo_multiple = "1";}
+/// SI EL CAMPO ES MULTIPLE O CHECK BOX MUESTRA LAS MULTIPLES ENTRADAS
+if($campo_multiple !="1" ){ $limite =" asc limit 1 ";}else {$limite =" asc ";}
+if(@$orden !=""){ $campo_orden =" AND orden ='$orden' ";}else {$campo_orden ="";}
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$valor=mysql_real_escape_string($valor);
+if($valor !=""){ $valor ="AND md5(contenido) LIKE '$valor'";}else {$valor ="";}
+/*
+$consulta = "SELECT * FROM `form_datos`
+WHERE `form_id` = '$perfil'
+AND id_campo='$id_campo' $valor
+AND `control` = '$id_control' $campo_orden
+GROUP BY orden
+ORDER BY timestamp $limite ";
+*/
+ $consulta = "SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador
+ FROM `form_datos`
+ WHERE form_id = '$perfil'
+ AND id_campo ='$id_campo' $valor
+ AND control ='$id_control' $campo_orden
+ group by orden
+ ORDER BY orden $limite";
+
+$sql =mysql_query($consulta,$link);
+$cant =mysql_num_rows($sql);
+
+if (mysql_num_rows($sql) == '0'){
+ $existe = NULL;
+ }else {
+
+$control=mysql_result($sql,0,"control");
+$timestamp=mysql_result($sql,0,"timestamp");
+$orden=mysql_result($sql,0,"orden");
+$id_usuario=mysql_result($sql,0,"id_usuario");
+$ip=mysql_result($sql,0,"ip");
+mysql_data_seek($sql, 0);
+if($cant === 1) {
+ //$contenido=mysql_result($sql,0,"contenido");
+ $identificador=mysql_result($sql,0,"identificador");
+ $identificador = explode(',',$identificador);
+ $identificador = $identificador[0];
+ $contenido_campo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $md5_contenido = $contenido_campo[3];
+ //$md5_contenido = remplacetas('form_datos','id',$identificador,' md5(binary contenido) as md5_contenido ',"") ; //md5(binary contenido) as md5_contenido,
+ //$md5_contenido = $md5_contenido[0];
+ $contenido = "$contenido_campo[0] ";
+ }else {
+while( $row = mysql_fetch_array( $sql ) ) {
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ $contenido_campo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $contenido .= "$contenido_campo[0] ";
+ }
+ }
+// $contenido .="$consulta";
+$existe[]= $control;
+$existe[] = $timestamp;
+$existe[] = $consulta;
+$existe[] = "$contenido";
+$existe[] = $md5_contenido;
+$existe[] = $orden;
+$existe[] = $id_usuario;
+$existe[] = $ip;
+}
+return $existe;
+ }
+
+function formulario_grabar($formulario) {
+ $respuesta = new xajaxResponse('utf-8');
+ //$formulario = mysql_seguridad($formulario);
+ $ip = obtener_ip();
+ $graba_ip = "INET_ATON('".$ip."') ";
+ $consulta_grabada ='0';
+ $control = $formulario[control]; //
+ $form_id = $formulario[form_id]; //
+ $tipo = $formulario[tipo]; //
+ if($formulario[imagen] !=''){$formulario[0][0] = $formulario[imagen];}
+
+ $consulta_form = "SELECT * FROM form_contenido_campos,form_campos
+ WHERE form_contenido_campos.id_campo = form_campos.id
+ AND id_form = '$form_id' ";
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+// $sql=mysql_query($consulta_form,$link);
+
+// if (mysql_num_rows($sql)!='0'){
+// mysql_data_seek($sql, 0);
+// while( $row = mysql_fetch_array( $sql ) ) {
+
+
+//////
+ if(isset ( $_SESSION[id_empresa])){$id_empresa = $_SESSION[id_empresa]; }else{
+ $id_empresa = remplacetas('form_id','id',$formulario[form_id],'id_empresa',"") ;
+ $id_empresa = $id_empresa[0];
+ }
+foreach($formulario as $c=>$v){
+
+
+//LISTA ELEMENTOS DE UN ARRAY
+if (is_array($v) ){
+ foreach($v as $C=>$V){
+ $campo_tipo = remplacetas("form_campos","id",$c,"campo_tipo","");
+ $campo_nombre = remplacetas("form_campos","id",$c,"campo_nombre","");
+ if($V != '') {
+
+
+
+$datos .= "$$c = \$formulario['$c'][$C]; // $V /$campo_tipo[0]
";
+ if($campo_tipo[0] =='12' OR $campo_tipo[0] =='13') {
+ $validar = validar_email($V);
+ if($validar == '0') {
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ $respuesta->addAlert("Se necesita un email válido");
+ return $respuesta;
+ }else {
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-success ");
+ }
+ }
+ if($campo_tipo[0] =='3' ) {
+ $validar = is_numeric($V);
+ if(is_numeric($V) ) {
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-success ");
+ //return $respuesta;
+ }else{
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ $respuesta->addAlert("El campo $campo_nombre[0] solo acepta valores numéricos");
+ return $respuesta;
+ }
+ }
+
+ if($campo_tipo[0]=='17') {
+ $limite = limite("$c",'','limite');
+ $size= strlen($V);
+ $restante = ($limite - $size);
+ if( $restante < 0) {
+
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addAlert("ATENCION: El campo $campo_nombre[0] no debe tener mas de $limite caractéres, sobran $restante");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ return $respuesta;
+ }
+ }
+
+
+
+ }
+else{ //busca campos vacios
+
+$campo_obligatorio = remplacetas("form_contenido_campos","id_campo",$c,"obligatorio","id_form = '$formulario[form_id]'");
+if($campo_obligatorio[0] =='1'){
+
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addAlert("ATENCION: El campo $campo_nombre[0] es obligatorio");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ return $respuesta;
+ }
+
+}
+
+$md5 = md5($V);
+$igual = formulario_valor_campo("$form_id","$c","$md5","$formulario[control]","$C");
+$existe = formulario_valor_campo("$form_id","$c","","$formulario[control]","$C");
+//$valor_anterior .= $existe[3]."| ";
+if(!is_null($existe) AND $tipo =='edit' AND $V =='') {
+ $consulta_vacio ="
+ INSERT INTO `form_datos` (`id`, `id_campo`,`orden`,`form_id`, `id_usuario`, `contenido`, `timestamp`, `control`, ip , id_empresa)
+ VALUES (NULL, '$c','$C', '$formulario[form_id]', '$_SESSION[id]', '', UNIX_TIMESTAMP(), '$formulario[control]',$graba_ip,'$id_empresa');";
+
+ $sql=mysql_query($consulta_vacio,$link);
+ if($sql) {
+ $consulta_grabada ='1';
+ }
+}
+if(is_null($igual) ){$repetido = 0;}else{
+$repetido = 1;
+}
+
+//$debug .= " (c= $c md5 = $md5 , igual = $igual, repetid =$repetido ) ";
+//$respuesta->addAssign("respuesta_$control","innerHTML","$valor_anterior");
+//return $respuesta;
+//$respuesta->addAlert("$debug");
+//return $respuesta;
+
+if(($V !='' ) && (is_numeric($c)) AND $repetido !=1 ) {
+
+ $V = mysql_real_escape_string($V);
+ $consulta ="
+ INSERT INTO `form_datos` (`id`, `id_campo`,`orden`,`form_id`, `id_usuario`, `contenido`, `timestamp`, `control`, ip , id_empresa)
+ VALUES (NULL, '$c','$C', '$formulario[form_id]', '$_SESSION[id]', '$V', UNIX_TIMESTAMP(), '$formulario[control]',$graba_ip,'$id_empresa');";
+
+ $sql=mysql_query($consulta,$link);
+ $debug .= "$consulta = $sql ,";
+ if($sql) {
+ $consulta_grabada ='1';
+ }
+ }
+
+ } ///fin del array
+
+ }///fin del array primario
+ else {
+ if($v !='') {$datos .= "$$c = \$formulario['$c']; // $v
";}
+ }
+ }
+
+
+
+
+// }
+// }
+
+
+if($consulta_grabada =='1') {
+if($tipo == "embebidoX" )
+{
+ $exito ="
+
+ $formulario[mensaje]
+
+ ";
+ $mail = '1';
+ }
+ elseif($tipo == "solocampos" ){
+
+
+ $exito ="
+
+ $formulario[mensaje]
+
+ ";
+
+ $mail='0';
+ }
+ else{
+ $campo_envio = buscar_campo_tipo($formulario[form_id],"13");
+ if($campo_envio[0] != "") {
+$envio = email_contenido("$formulario[form_id]","$formulario[control]","$campo_envio[0]",'');
+ }
+
+if($tipo = "embebido") {
+$otro_formulario ="
+
+ Llenar otro formulario
+
+";
+}else {
+ $otro_formulario = "
+
+ Llenar otro formulario
+
+
+ ";
+}
+$impresion = formulario_imprimir("","$formulario[control]","preview");
+//$impresion = mostrar_identificador($formulario['control']);
+ $exito ="
+
+ $impresion
+
+
+ Gracias por llenar el formulario $formulario[form_nombre]
+
+
+ $otro_formulario
+
+
+ $envio
+
+
+
";
+
+// $mail ='1';
+ }
+
+//if($mail =='1') {
+
+ //$propietario = remplacetas('form_id','id',$formulario[form_id],'propietario',"") ;
+ //$propietario = remplacetas('usuarios','id',$propietario[0],'email',"") ;
+ $email_envio = remplacetas('form_parametrizacion','campo',"$formulario[form_id]",'descripcion'," tabla='form_id' and opcion = 'email'") ;
+ if($email_envio[0] !="") {
+ $impresion = formulario_imprimir("","$formulario[control]","preview");
+ $id_empresa = remplacetas('form_id','id',$formulario[form_id],'id_empresa',"") ;
+ $id_empresa = $id_empresa[0];
+
+ $direccion = remplacetas("empresa","id",$id_empresa,"direccion","");
+ $telefono = remplacetas("empresa","id",$id_empresa,"telefono","");
+ $web = remplacetas("empresa","id",$id_empresa,"web","");
+ $email = remplacetas("empresa","id",$id_empresa,"email","");
+ $imagen = remplacetas("empresa","id",$id_empresa,"imagen","");
+ $razon_social = remplacetas("empresa","id",$id_empresa,"razon_social","");
+ $slogan = remplacetas("empresa","id",$id_empresa,"slogan","");
+ $nombre_formulario = remplacetas("form_id","id",$formulario[form_id],"nombre","");
+
+$headers = "MIME-Version: 1.0\r\n";
+$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
+$headers .= "From: $razon_social[0] <$email[0]>\r\n";
+$headers .= "Reply-To: $email[0]\r\n";
+$headers .= "Return-path: $email[0]\r\n";
+$headers .= "Cc: $email_envio[0]" . "\r\n";
+
+$asunto= "[MILFS] $nombre_formulario[0]";
+$cuerpo ="
+$impresion
+Se ha completado el formulario $nombre_formulario[0]
+Puede revisar los datos en http://$_SERVER[HTTP_HOST]/milfs?id=$formulario[form_id]&c=$formulario[control]
+Saludos de MILFS
+";
+ if(mail("$email[0]","$asunto","$cuerpo","$headers")){ $exito .=""; }else {$exito .="error enviando correo";}
+ //$exito .= "$email[0] $headers ";
+ }
+ /// }
+ $respuesta->addAssign("div_$control","innerHTML","$exito ");
+ return $respuesta;
+ }
+//$respuesta->addAssign("respuesta_$control","innerHTML","$resultado");
+return $respuesta;
+}
+$xajax->registerFunction("formulario_grabar");
+
+function mysql_seguridad($inp) {
+ if(is_array($inp))
+ return array_map(__METHOD__, $inp);
+
+ if(!empty($inp) && is_string($inp)) {
+ return str_replace(array('\\', "\0", "'", '"', "\x1a"), array('\\\\', '\\0', "\\*", "\\*", '\\Z'), $inp);
+ }
+
+ return $inp;
+}
+
+function formulario_campos_render_multiple($id_campo,$id_form,$control,$item) {
+
+ $consulta = "SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador
+ FROM `form_datos`
+ WHERE form_id = '$id_form'
+ AND id_campo ='$id_campo'
+ AND control ='$control'
+ group by orden ORDER BY orden asc";
+ $link=Conectarse();
+ //$resultado .= "$consulta";
+ mysql_query("SET NAMES 'utf8'");
+ $sql =mysql_query($consulta,$link);
+ if (mysql_num_rows($sql)!='0' ){
+ mysql_data_seek($sql, 0);
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ //$identificador = $row[identificador];
+ $resultado .= $identificador;
+ $resultado .= formulario_campos_render($row[id_campo],$id_form,$control,$row[orden],$identificador);
+ $item = $item + 1;
+ }
+ }
+ $resultado .= formulario_campos_render($id_campo,$id_form,'',$item,'');
+
+ return $resultado;
+}
+
+
+
+function formulario_modal($id,$form_respuesta,$control,$tipo) {
+ $respuesta = new xajaxResponse('utf-8');
+ $formulario_respuesta = formulario_respuesta("$id","$control");
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa',"",'') ;
+ $id_empresa = $id_empresa[0];
+ $encabezado = empresa_datos("$id_empresa",'encabezado');
+ $pie = "$formulario_respuesta";
+ $pie .= empresa_datos("$id_empresa",'pie');
+ $formulario_descripcion = remplacetas('form_id','id',$id,'descripcion','') ;
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre','') ;
+ $cabecera ="".$formulario_nombre['0']." ".$formulario_descripcion['0']."
";
+
+ $nuevo_formulario = "Llenar otro formulario ";
+if($control !='' AND $tipo =='' ) {
+ $impresion = formulario_imprimir("$id","$control","");
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre') ;
+ $muestra_form = "$impresion
";
+ $respuesta->addAssign("muestra_form","innerHTML","$muestra_form");
+ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+ $respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+ }
+
+ $modificable = remplacetas('form_id','id',$id,'modificable') ;
+ if($modificable[0] != "1" and (!isset ( $_SESSION[id]) )) {
+ $resultado ="
Acceso restringido No se puede consultar los datos.";
+ $respuesta->addAssign("muestra_form","innerHTML","$resultado");
+ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+ $respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+ }
+
+
+$consulta = "
+ SELECT * FROM form_id, form_contenido_campos
+ WHERE form_id.id = form_contenido_campos.id_form
+ AND form_id.id = '$id' ORDER BY form_contenido_campos.orden ASC
+ ";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+ if($respuesta !='' AND $control !=''){$control =$control;}
+ else{$control = md5(rand(1,99999999).microtime());}
+ $descripcion=mysql_result($sql,0,"descripcion");
+ $nombre=mysql_result($sql,0,"nombre");
+ $id_empresa=mysql_result($sql,0,"id_empresa");
+ $encabezado = empresa_datos("$id_empresa",'encabezado');
+ $pie = empresa_datos("$id_empresa",'pie');
+ $cabecera = "
+
+
+
+
+
+
+
$nombre $descripcion
+
+
+
+
+
";
+
+$campo_imagen = buscar_campo_tipo($id,"15");
+$campo_imagen_nombre = $campo_imagen[1];
+$campo_imagen = $campo_imagen[0];
+
+
+if ($campo_imagen[0] != "") {
+$subir_imagen = subir_imagen("$id","$campo_imagen"."[0]");
+ }
+ $muestra_form = "
+
+
+
+
+
+
+
+
+
+
+ ";
+ if($tipo=="edit") {$control_edit = "$control";}else {$control_edit = "";}
+
+ mysql_data_seek($sql, 0);
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $tipo_campo = remplacetas("form_campos","id","$row[id_campo]","campo_tipo","");
+ //if($tipo_campo[0] =="24") { $row[multiple] = "1";}
+ if($row[multiple] ==='1' AND $tipo =='edit'){
+ $campos = formulario_campos_render_multiple($row[id_campo],$id,$control_edit);
+ }else{
+ $campos = formulario_campos_render($row[id_campo],$id,$control_edit,'');
+ }
+ $muestra_form .= "$campos ";
+ $solo_campos .= "$campos ";
+ }
+ $muestra_form .="
+
+ ";
+ }
+
+$muestra_form .="
+
+
+
";
+ $muestra_form = "$muestra_form
";
+if($tipo=='campos') {
+ return $solo_campos;
+}
+if($tipo=='embebido') {
+ return $muestra_form;
+}
+
+$respuesta->addAssign("muestra_form","innerHTML","$muestra_form");
+$respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+$respuesta->addAssign("pie_modal","innerHTML","$pie");
+$respuesta->addscript("$('#muestraInfo').modal('toggle')");
+//$respuesta->addscript("$('textarea').markdown({autofocus:false,savable:false})");
+//$respuesta->addscript("$(document).ready(function () { $(\"#24[0]\").cleditor(); })");
+//$(document).ready(function () { $("#input").cleditor(); });
+
+
+
+return $respuesta;
+}
+$xajax->registerFunction("formulario_modal");
+
+
+
+function limpia_div($capa){
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($capa,"style.padding","0px");
+$respuesta->addClear($capa,"innerHTML");
+
+return $respuesta;
+}$xajax->registerFunction("limpia_div");
+
+
+function select_key($tabla,$key,$value,$descripcion,$onchange,$where,$nombre,$valor){
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+$campo1 = $campos[0];
+$campo2 = $campos[1];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysql_query("SET NAMES 'utf8'");
+$id_empresa= $_SESSION['id_empresa'];
+if($where =='AGRUPADO'){$group="GROUP BY $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT $value, $descripcion FROM $tabla WHERE 1 $w $group ORDER BY $campo1 ";
+$sql=mysql_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$key;}else{$name = "$nombre";}
+if (mysql_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="";}else{$vacio =" >> Nuevo $descripcion << ";}
+$resultado="
+Seleccione
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[$key]=="") {$resultado.="";}else{
+if($row[$key] ==="$valor"){$selected="selected";}else{$selected ="";}
+
+$resultado .= " ".substr($row[$campo1], 0, 150 )." ".substr($row[$campo2], 0, 30 )." ";
+ }
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function select($tabla,$value,$descripcion,$onchange,$where,$nombre,$valor){
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+$campo1 = $campos[0];
+$campo2 = $campos[1];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysql_query("SET NAMES 'utf8'");
+$id_empresa= $_SESSION['id_empresa'];
+if($where =='AGRUPADO'){$group="GROUP BY $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT $value, $descripcion FROM $tabla WHERE 1 $w $group ORDER BY $campo1 ";
+$sql=mysql_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+if (mysql_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="Todos los valores ";}else{$vacio =" ";}
+$resultado="
+$nombre $vacio
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[$value]=="") {$resultado.="";}else{
+if($row[$value] ==="$valor"){$selected="selected";}else{$selected ="";}
+$mostrar_id = "[$row[$value]]";
+$resultado .= " ".substr($row[$campo1], 0, 150 )." ".substr($row[$campo2], 0, 30 )." $mostrar_id ";
+ }
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function select_empresa($tabla,$value,$descripcion,$onchange,$where,$nombre,$valor,$id_empresa){
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+$campo1 = $campos[0];
+$campo2 = $campos[1];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysql_query("SET NAMES 'utf8'");
+$id_empresa= $_SESSION['id_empresa'];
+if($where =='AGRUPADO'){$group="GROUP BY $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT $value, $descripcion FROM $tabla WHERE id_empresa = '$id_empresa' $w $group ORDER BY $campo1 ";
+$sql=mysql_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+if (mysql_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="Todos los valores ";}else{$vacio =" ";}
+$resultado="
+$nombre $vacio
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[$value]=="") {$resultado.="";}else{
+if($row[$value] ==="$valor"){$selected="selected";}else{$selected ="";}
+$mostrar_id = "[$row[$value]]";
+$resultado .= " ".substr($row[$campo1], 0, 150 )." ".substr($row[$campo2], 0, 30 )." $mostrar_id ";
+ }
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados $consulta
";}
+
+return $resultado;
+}
+
+function select_edit($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+
+$resultado="
+Seleccione
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor"){$selected="selected";}else{$selected ="";}
+$resultado .= " $row[campo_valor] ";
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+
+
+
+function radio_agrupado_linea($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores , form_campos WHERE form_campos_valores.id_form_campo = form_campos.id AND id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+$valor = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+$nombre_linea = mysql_result($sql,0,"campo_nombre");
+$descripcion_linea = mysql_result($sql,0,"campo_descripcion");
+ mysql_data_seek($sql, 0);
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor[0]"){$selected="checked";}else{$selected ="";}
+$lineas .= " $row[campo_valor] ";
+ }
+$resultado .= "$nombre_linea
$lineas ";
+ }else{$resultado = " No hay resultados $consulta
";}
+
+return $resultado;
+}
+
+function radio_linea($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores , form_campos WHERE form_campos_valores.id_form_campo = form_campos.id AND id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+$nombre_linea = mysql_result($sql,0,"campo_nombre");
+$descripcion_linea = mysql_result($sql,0,"campo_descripcion");
+ mysql_data_seek($sql, 0);
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor"){$selected="checked";}else{$selected ="";}
+$lineas .= "$row[campo_valor] ";
+ }
+$resultado .= "$nombre_linea
$lineas ";
+ }else{$resultado = " No hay resultados $consulta
";}
+
+return $resultado;
+}
+function radio_edit($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+
+$resultado="
+
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor"){$selected="checked";}else{$selected ="";}
+$resultado .= " $row[campo_valor]
";
+ }
+$resultado .= "";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+
+function checkbox_edit($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+ $name = explode("[",$name);
+ $name = $name[0];
+ $fila="0";
+
+while( $row = mysql_fetch_array( $sql ) ) {
+ $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' and contenido ='$row[campo_valor]' ");
+
+ $nombre= "$name"."[".$fila."]";
+//if($row[campo_valor] ==="$valor"){$selected="checked";}else{$selected ="";}
+if($value[0] ==="$row[campo_valor]"){$selected="checked";}else{$selected ="";}
+$resultado .= "
+
+
+ $row[campo_valor] $selected
+
+
";
+ $fila++;
+ }
+$resultado .= "";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+
+function rango($tabla,$campo,$key,$valor,$selected,$nombre,$onchange){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT min($campo) as min , max($campo) as max FROM $tabla WHERE $key ='$valor' ";
+$sql=mysql_query($consulta,$link);
+
+if (mysql_num_rows($sql)!='0'){
+ $min=mysql_result($sql,0,"min");
+ $max=mysql_result($sql,0,"max");
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+$resultado="
+ $min
+
+ $max $selected
+
" ;
+
+
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function limite($id_campo,$contenido,$tipo){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT campo_valor FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+
+if (mysql_num_rows($sql)!='0'){
+ $limite=mysql_result($sql,0,"campo_valor");
+
+ }else{}
+ if($tipo =='limite') { return $limite;}
+$respuesta = new xajaxResponse('utf-8');
+if($contenido !='') {
+
+ $size= strlen($contenido);
+ $restante = ($limite - $size);
+ $div_input = "input_$id_campo";
+ if( $restante<=1) {
+$respuesta->addAssign("aviso_$id_campo","className","alert-danger ");
+$respuesta->addAssign("$div_input","className","has-error ");
+ }
+ elseif( $restante<=10) {
+$respuesta->addAssign("aviso_$id_campo","className","alert-warning ");
+$respuesta->addAssign("$div_input","className","has-warning ");
+ }else{
+$respuesta->addAssign("aviso_$id_campo","className","alert-succes ");
+$respuesta->addAssign("$div_input","className","has-success ");
+}
+ $respuesta->addAssign("aviso_$id_campo","innerHTML","$restante");
+
+ return $respuesta;
+ }
+ $respuesta->addAssign("aviso_$id_campo","innerHTML","$limite");
+ return $respuesta;
+ //return $limite;
+}
+$xajax->registerFunction("limite");
+
+function confirma_campo($valor_1,$valor_2,$campo,$campo_confirmacion){
+ $respuesta = new xajaxResponse('utf-8');
+ $pos = strpos($campo,"email");
+
+if($pos == "") { //// si no es un email
+ }
+ else {//// si es un email se revisa
+ $email = validar_email("$valor_1");
+ if($email === 0 ) {
+ $respuesta->addAssign("$campo","value","");
+ $respuesta->addAssign("$campo"."_grupo","className"," input-group has-error ");
+ $respuesta->addAssign("$campo_confirmacion"."_grupo","className"," input-group has-error ");
+ $respuesta->addAlert("El email no es valido ");
+ $respuesta->addScript("document.getElementById('$campo').focus(); ");
+ return $respuesta;
+ }
+ else{
+ }
+ }
+
+
+
+ if($valor_1 != $valor_2){$resultado = "Los valores NO son iguales";
+ $respuesta->addAlert("$resultado");
+ /// $respuesta->addAssign("$campo","style.color","red");
+
+
+ $respuesta->addAssign("$campo","value","$pos");
+ $respuesta->addAssign("$campo_confirmacion","value","");
+ $respuesta->addAssign("$campo"."_grupo","className"," input-group has-error ");
+ $respuesta->addAssign("$campo_confirmacion"."_grupo","className"," input-group has-error ");
+ $respuesta->addScript("document.getElementById('$campo').focus(); ");
+ // document.getElementById('mobileno').focus();
+
+
+ }else{
+ //$respuesta->addAssign("$campo_confirmacion","style.color","green");
+
+ $respuesta->addAssign("$campo","className"," form-control ");
+ $respuesta->addAssign("$campo_confirmacion","className"," form-control ");
+ $respuesta->addAssign("$campo"."_grupo","className"," input-group has-success ");
+ $respuesta->addAssign("$campo_confirmacion"."_grupo","className"," input-group has-success ");
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("confirma_campo");
+
+
+function validar_campo($valor,$campo,$tabla,$div,$id){
+$valor = mysql_seguridad($valor);
+$respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta="SELECT $campo FROM $tabla WHERE $campo = '$valor' LIMIT 1";
+$sql =mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0' ){
+$verificacion = "atencion"; $existe='';
+
+$respuesta->addAssign($campo,"value","");
+///$respuesta->addAlert("El valor $valor $existe existe");
+$resultado = "Grrr $valor $existe existe ";
+$respuesta->addAssign("$id","style.backgroundColor","pink");
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+ }else {$verificacion ="check"; $existe='NO';}
+$resultado = "Ok, buen $campo ! ";
+$respuesta->addAssign("$id","style.backgroundColor","#CBE7CB");
+//$resultado .= "$valor,$campo,$tabla,$div";
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+
+return $respuesta;
+}
+$xajax->registerFunction("validar_campo");
+
+
+function comprobar_email($email,$tipo,$campo){
+$email = mysql_seguridad($email);
+$respuesta = new xajaxResponse('utf-8');
+if($tipo =='tercero') {$id_campo='tercero_email';}
+
+
+else{$id_campo = 'email';}
+
+if($campo !=''){
+$id_campo="$campo";
+}
+
+
+if ($email == "" AND $tipo==''){
+ $respuesta->addAlert("El campo email es obligatorio ");
+ $respuesta->addAssign("$id_campo","style.backgroundColor","pink");
+ $respuesta->addAssign("$id_campo","value","");
+ return $respuesta;
+ }
+
+ $mail_correcto = 0;
+ //compruebo unas cosas primeras
+ if ((strlen($email) >= 6) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@")){
+ if ((!strstr($email,"'")) && (!strstr($email,"\"")) && (!strstr($email,"\\")) && (!strstr($email,"\$")) && (!strstr($email," "))) {
+ //miro si tiene caracter .
+ if (substr_count($email,".")>= 1){
+ //obtengo la terminacion del dominio
+ $term_dom = substr(strrchr ($email, '.'),1);
+ //compruebo que la terminación del dominio sea correcta
+ if (strlen($term_dom)>1 && strlen($term_dom)<5 && (!strstr($term_dom,"@")) ){
+ //compruebo que lo de antes del dominio sea correcto
+ $antes_dom = substr($email,0,strlen($email) - strlen($term_dom) - 1);
+ $caracter_ult = substr($antes_dom,strlen($antes_dom)-1,1);
+ if ($caracter_ult != "@" && $caracter_ult != "."){
+ $mail_correcto = 1;
+ }
+ }
+ }
+ }
+ }
+ if ($mail_correcto AND $tipo=='' )
+ {
+$consulta= "SELECT email FROM usuarios WHERE email = '$email' LIMIT 1 ";
+ $link=Conectarse();
+$sql=mysql_query($consulta,$link);
+$revisa=mysql_result($sql,0,"email");
+if ($revisa != ''){
+
+ $respuesta->addAlert("$email: ya está registrado ");
+ $respuesta->addAssign("email","style.color","red");
+ $respuesta->addAssign("email","value","");
+ return $respuesta;
+ }
+ $respuesta->addAssign("email","style.color","green");}
+ elseif ($mail_correcto AND $tipo==='revisar' ) {
+ $revisar = remplacetas("usuarios","email",$email,"email","");
+ if($revisar[0] != '') {
+
+ $respuesta->addAssign("$campo","style.color","white");
+ $respuesta->addAssign("$id_campo","style.backgroundColor","green");
+ }else{
+ $respuesta->addAlert("$email: No existe en el sistema)");
+ $respuesta->addAssign("$campo","value","");
+ }
+ return $respuesta;
+ }
+
+ elseif ($mail_correcto AND $tipo==='tercero' ) {
+ $documento = remplacetas("terceros","email",$email,"documento","");
+ if($documento[1] =='') { /// si el tercero NO existe
+
+ }else { /// si el tercero existe en el sistema
+
+ $tipo_persona = remplacetas("terceros","id",$documento[1],"tipo_persona","");
+
+ if($tipo_persona[0] =='1') {
+ $razon_social = remplacetas("terceros","id",$documento[1],"razon_social","");
+ $resultado .= " $razon_social[0]] Nit: $documento[0]";
+ } else {
+ $primer_nombre = remplacetas("terceros","id",$documento[1],"p_nombre","");
+ $segundo_nombre = remplacetas("terceros","id",$documento[1],"s_nombre","");
+ $primer_apellido = remplacetas("terceros","id",$documento[1],"p_apellido","");
+ $segundo_apellido = remplacetas("terceros","id",$documento[1],"s_apellido","");
+ $resultado .=" \r $primer_nombre[0] $segundo_nombre[0] $primer_apellido[0] $segundo_apellido[0] \r Documento: $documento[0]";
+ }
+
+ $respuesta->addAlert("$email: $resultado");
+ $respuesta->addAssign("tercero_documento","value","$documento[0]");
+ $respuesta->addAssign("tercero_primer_nombre","value","$primer_nombre[0]");
+ $respuesta->addAssign("tercero_segundo_nombre","value","$segundo_nombre[0]");
+ $respuesta->addAssign("tercero_primer_apellido","value","$primer_apellido[0]");
+ $respuesta->addAssign("tercero_segundo_apellido","value","$segundo_apellido[0]");
+ $respuesta->addAssign("tercero_razon_social","value","$razon_social[0]");
+ $respuesta->addAssign("tercero_id","value","$documento[1]");
+
+ }
+
+ }
+ else
+ {$respuesta->addAlert("$email: no es un correo válido");
+ $respuesta->addAssign("$id_campo","style.backgroundColor","pink");
+ $respuesta->addAssign("$id_campo","value","");
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("comprobar_email");
+
+function obtener_ip()
+
+{
+
+ if (isset($_SERVER["HTTP_CLIENT_IP"]))
+ {
+ return $_SERVER["HTTP_CLIENT_IP"];
+ }
+ elseif (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
+ {
+ return $_SERVER["HTTP_X_FORWARDED_FOR"];
+ }
+ elseif (isset($_SERVER["HTTP_X_FORWARDED"]))
+ {
+ return $_SERVER["HTTP_X_FORWARDED"];
+ }
+ elseif (isset($_SERVER["HTTP_FORWARDED_FOR"]))
+ {
+ return $_SERVER["HTTP_FORWARDED_FOR"];
+ }
+ elseif (isset($_SERVER["HTTP_FORWARDED"]))
+ {
+ return $_SERVER["HTTP_FORWARDED"];
+ }
+ else
+ {
+ return $_SERVER["REMOTE_ADDR"];
+ }
+
+ }
+
+function milfs(){
+ $crear_campos = formulario_crear_campo('','','');
+ $listado = formulario_listado('','');
+ //$consultas = formulario_consultar('','');
+ $importador = formulario_importador('');
+ $limpiar_cache = borrar_tmp('');
+ $configuracion= configuracion('');
+
+ $login = login_boton('');
+ $menu =
+"
+
+
+
+ $crear_campos
+
+ $listado
+
+ $importador
+ $limpiar_cache
+ Presentación
+ $configuracion
+
+
+
+
+
";
+
+ return $menu;
+}
+function url_existe($url)
+{
+ $handle = @fopen($url, "r");
+ if ($handle == false)
+ return NULL;
+ fclose($handle);
+ return $url;
+}
+function es_imagen($url)
+ {
+ $imageSizeArray = getimagesize($url);
+ $imageTypeArray = $imageSizeArray[2];
+ return (bool)(in_array($imageTypeArray , array(IMAGETYPE_GIF , IMAGETYPE_JPEG ,IMAGETYPE_PNG )));
+ }
+function parametrizacion($array) {
+ //return $array;
+ $link=Conectarse();
+ mysql_real_escape_string($array);
+ $accion = $array[accion];
+ $tabla = $array[tabla];
+ $campo = $array[campo];
+ $opcion = $array[opcion];
+ $descripcion= $array[descripcion];
+ $visible= $array[visible];
+ $id= $array[id];
+
+ if($accion =='grabar'){
+ $consulta= "INSERT INTO form_parametrizacion set tabla='$tabla', campo ='$campo',opcion ='$opcion' , descripcion ='$descripcion' ,visible='$visible'";
+ }
+ // return $consulta;
+ $sql=mysql_query($consulta,$link);
+ if($sql){return "Campo grabado"; }else{return "";}
+
+}
+
+?>
\ No newline at end of file
diff --git a/milfs/funciones/experimentales.php b/milfs/funciones/experimentales.php
index f0d461f..c7af436 100644
--- a/milfs/funciones/experimentales.php
+++ b/milfs/funciones/experimentales.php
@@ -126,13 +126,13 @@ $consulta ="SELECT * FROM form_datos WHERE $w_form contenido like '%%$valor%%'
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
-mysql_data_seek($sql, 0);
+if (mysqli_num_rows($sql)!=0){
+mysqli_data_seek($sql, 0);
$fila=1;
$divider=1;
$cols = (12/$divider);
$i =0;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($i % $divider==0) {
$encontrados .= "
@@ -189,17 +189,17 @@ $consulta_total= "SELECT * FROM form_datos WHERE form_id= '$id_form' $w_filtro G
$consulta= "SELECT * FROM form_datos WHERE form_id= '$id_form' $w_filtro GROUP BY control LIMIT $inicio , $limite";
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
-//mysql_real_escape_string($consulta);
+//mysqli_real_escape_string($link,$consulta);
$sql_total=mysqli_query($consulta_total,$link);
-$total = mysql_num_rows($sql_total);
+$total = mysqli_num_rows($sql_total);
$sql=mysqli_query($consulta,$link);
$descripcion = remplacetas('form_id','id',$id_form,'descripcion',"") ;
$descripcion = " $descripcion[0]";
$buscador = buscar_datos("","$id_form","$plantilla","grid_resultado");
$contenido = "$descripcion $buscador
";
-if (mysql_num_rows($sql)!=0){
-mysql_data_seek($sql, 0);
+if (mysqli_num_rows($sql)!=0){
+mysqli_data_seek($sql, 0);
$fila=1;
if($divider =="") {
$divider=3;
@@ -207,7 +207,7 @@ $divider=3;
$cols = (12/$divider);
$i =0;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($i % $divider==0) {
$contenido .= "
diff --git a/milfs/funciones/funciones.chupacabras.php b/milfs/funciones/funciones.chupacabras.php
new file mode 100644
index 0000000..43728bf
--- /dev/null
+++ b/milfs/funciones/funciones.chupacabras.php
@@ -0,0 +1,9027 @@
+
+ Respuestas:
+ ";
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ $respuesta = mostrar_identificador("$identificador","$row[form_id]","",'simple');
+ $fecha = date($format, $row['timestamp']);
+ $resultado .= " $respuesta $timestamp ";
+
+}
+ $resultado .="
+ ";
+}else{$resultado ="";}
+$resultado = "$resultado $formulario_respuesta";
+return $resultado;
+}
+
+
+function formulario_respuesta($id,$identificador) {
+ if($id=='') {return;}
+ $id = mysql_seguridad($id);
+ $consulta = "SELECT * FROM form_id
+ WHERE formulario_respuesta = '$id'
+ ";
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
+ $resultado ="
+ ";
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ $resultado .= "$row[nombre] $row[descripcion] ";
+
+}
+ $resultado .="
";
+}else{$resultado ="";}
+return $resultado;
+}
+function consultar_contenido_formulario($form,$registros,$pagina,$tipo){
+ $imagen ="";
+ $busca ="";
+ $busqueda ="";
+ $fechas ="";
+ $campo ="";
+ $lineas ="";
+ $linea ="";
+ $formato ="";
+ $listado_nombres ="";
+$respuesta = new xajaxResponse('utf-8');
+
+
+$id_form = $form;
+$consulta_principal = "SELECT control,id,form_id FROM form_datos WHERE form_id = '$id_form' GROUP BY form_datos.control ORDER BY form_datos.id DESC ";
+$link=Conectarse();
+mysqli_query("SET NAMES 'UTF8'");
+$sql_total=mysqli_query($consulta_principal,$link);
+$total_registros = mysqli_num_rows($sql_total);//formulario_contar($id_form);
+/// PAGINACION
+ if ($pagina =='') {$inicio = 0; $pagina = 1; }
+ else { $inicio = ($pagina - 1) * $registros;}
+ if($total_registros < $registros) { $limite ="";}
+ else{$limite =" LIMIT $inicio, $registros ";}
+ $consulta_limite = $consulta_principal.$limite;
+ $sql=mysqli_query($consulta_limite,$link);
+mysqli_data_seek($sql_total, 0);
+//$sql=mysqli_query($consulta_principal,$link);
+if (mysqli_num_rows($sql)!='0'){
+
+/////// FILTRO
+
+//$fecha = time ();
+// $ahora = date ( "Y-m-d" , $fecha );
+// $campos = listar_campos_formulario($id_form,"select");
+
+
+ $link = "";
+ // $page = $_GET['page'];
+ $page= $pagina;
+ @$pages= ceil($total_registros / $registros); //13; // Hardcoded for testing purpose
+ $limit=10 ;
+ if ($pages >=1 && $page <= $pages)
+ {
+ $counter = 1;
+ $link = "";
+ if (($page -1) > 0) {
+ $link .= "
+ ";
+ }
+
+ for ($x=$page; $x<=$pages;$x++)
+ {
+
+
+ if($counter < $limit){
+ if ($page == $x){
+ $link .= "$x ";
+ }else{
+ $link .= "$x ";
+ }
+ }
+ $counter++;
+ }
+ if ($page < ($pages - ($limit/2)))
+
+ { $link .= "
+ "; }
+ }
+ $paginacion = "";
+ $encabezado = "
+
+ ";
+
+// $total_registros = mysqli_num_rows($sql);
+/* $nombres_campos = listar_campos_formulario("$id_form","nombres");
+ foreach($nombres_campos as $campo_nombre=>$nombre){
+ $listado_nombres .= "$nombre ";
+ }
+ */
+// $listado_nombres = "Identificador $listado_nombres ";
+///$listado_campos = listar_campos_formulario("$id_form",'');
+mysqli_data_seek($sql_total, 0);
+while( $row = mysqli_fetch_array( $sql ) ) {
+
+// if (!is_array($listado_campos)){$listado_campos="$listado_campos ";}else {$listado_campos=$listado_campos;}
+$linea .= landingpage_contenido_identificador("$row[control]","$id_form","landingpage",'');
+//$linea .= mostrar_identificador("$row[control]","$id_form","landingpage",'simple');;
+//$linea .= " $row[control]";
+ }
+$buscador = buscar_datos("*formato*","$form","landingpage","mostrar_resultado");
+$filtro = portal_filtro_campos_select($form,"$campo_filtro","mostrar_resultado","landingpage");
+if( $tipo !== "" AND $tipo !=="embebido" ) {
+$acciones="
+
+
+ $filtro
+
+ $buscador
+
";
+}
+$resultado = "
+
+
+$acciones
+
+$linea
+$encabezado
+
+";
+ }
+else {
+$resultado ="
No hay resultados $consulta_limite";
+$respuesta->addAlert("No hay resultados");
+return $respuesta;
+}
+
+ /*$datos = $resultado;
+ $div ="contenido_de_modal";
+ $resultado = " $datos
";
+ $div_contenido = "$div
";
+ */
+ if($tipo =="") {
+ // $respuesta->addAssign("contenido_interior","innerHTML","$div_contenido");
+ $respuesta->addAssign("mostrar_resultado","innerHTML","$resultado");
+ return $respuesta;
+ }
+ if($tipo =="contenido" OR $tipo =="embebido" ) {
+ return $resultado;
+ }
+}
+$xajax->registerFunction("consultar_contenido_formulario");
+
+
+function multiempresa_listado($tabla,$div){
+$resultado = "";
+$link=Conectarse();
+
+mysqli_query("SET NAMES 'utf8'");
+$consulta = "SELECT * FROM empresa ORDER BY id DESC ";
+$sql=mysqli_query($consulta,$link);
+
+if (mysqli_num_rows($sql)!='0'){
+
+
+mysqli_data_seek($sql, 0);
+$fila=1;
+$divider=3;
+$cols = (12/$divider);
+$i =0;
+while( $row = mysqli_fetch_array( $sql ) ) {
+ if($i % $divider==0) {
+ $encontrados .= "";
+ }
+ $i++;
+ $logo="
";
+ $contenido ="
+
";
+ $encontrados .="$contenido";
+ $fila++;
+ if( $i % $divider==0) {
+ $encontrados .= "
";
+ }
+ }
+ $resultado ="
+
+ $encontrados
+
+ ";
+ }else{
+ $resultado = " No hay resultados
";
+ }
+if($div =="") { return $resultado; }else {
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+ }
+}
+$xajax->registerFunction("multiempresa_listado");
+
+
+
+function decodifica_parametro ($string)
+{
+ $inicial = substr($string,0,1);
+ $string = mb_substr($string,1);
+ $cadena = $string;
+ //$length = strlen($base);
+
+ $size = strlen($string) - 1;
+ $string = str_split($string);
+
+ //$out = strpos($base, array_pop($string));
+//return $out;
+ /*foreach($string as $i => $char)
+ {
+
+ $out += (strpos($base, $char)* pow($length, $size - $i));
+//$out .= "$i => $char";
+ }*/
+$resultado[0]=$inicial;
+//$resultado[1]=$out;
+$resultado[1]=$cadena;
+
+ return $resultado;
+}
+
+function grabar_imagen($imagen,$control) {
+
+ $imgData = str_replace(' ','+',$imagen);
+ $imgData = substr($imgData,strpos($imgData,",")+1);
+ $imgData = base64_decode($imgData);
+
+ $nombre= $control.".png";
+ $filePath = "$_SESSION[path]/tmp/".$nombre;
+
+ $file = fopen($filePath, 'w');
+ fwrite($file, $imgData);
+ fclose($file);
+ $full= "$_SESSION[path_images_secure]/full/".$nombre;
+ if (!rename($filePath,$full)){}
+ else {
+ echo generar_miniatura($nombre,"150");
+ echo generar_miniatura($nombre,"300");
+ echo generar_miniatura($nombre,"600");
+ }
+
+ //return "$nombre";
+ return "$nombre";
+}
+
+
+function generar_miniatura($file,$width) {
//$archivo = $file;
+$archivo = "$_SESSION[path_images_secure]/full/".$file;
// Ponemos el . antes del nombre del archivo porque estamos considerando que la ruta está a partir del archivo thumb.php
$file_info = getimagesize($archivo);
// Obtenemos la relación de aspecto
$ratio = $file_info[0] / $file_info[1];
// Calculamos las nuevas dimensiones
$newwidth = $width;
$newheight = round($newwidth / $ratio);
// Sacamos la extensión del archivo
$ext = explode(".", $file);
$ext = strtolower($ext[count($ext) - 1]);
if ($ext == "jpeg") $ext = "jpg";
// Dependiendo de la extensión llamamos a distintas funciones
switch ($ext) {
case "jpg":
$img = imagecreatefromjpeg($archivo);
break;
case "png":
$img = imagecreatefrompng($archivo);
break;
case "gif":
$img = imagecreatefromgif($archivo);
break;
}
// Creamos la miniatura
$thumb = imagecreatetruecolor($newwidth, $newheight);
+imagealphablending( $thumb, false );
+imagesavealpha( $thumb, true );
// La redimensionamos
imagecopyresampled($thumb, $img, 0, 0, 0, 0, $newwidth, $newheight, $file_info[0], $file_info[1]);
// La mostramos como jpg
//header("Content-type: image/jpeg");
imagejpeg($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 80);
+imagepng($thumb,"$_SESSION[path_images_secure]/".$width."/$file", 9);
+//imagegif($thumb,"$_SESSION[path_images_secure]/".$width."/$file");
+//imagejpeg($thumb,null, 80);
+}
+
+function generar_vcard($identificador){
+$impresion = mostrar_identificador("$identificador","","vcard",'simple');
+$impresion = formulario_imprimir("$id_form","$identificador","$plantilla");
+$nombre ="vcard_".$identificador.".vcf";
+$vcard ="BEGIN:VCARD
+VERSION:3.0
+N:Gump;Forrest
+FN:Forrest Gump
+ORG:Bubba Gump Shrimp Co.
+TITLE:Shrimp Man
+PHOTO;VALUE=URL;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif
+TEL;TYPE=WORK,VOICE:(111) 555-1212
+TEL;TYPE=HOME,VOICE:(404) 555-1212
+ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
+LABEL;TYPE=WORK:100 Waters Edge\nBaytown, LA 30314\nUnited States of America
+ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
+LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America
+EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com
+REV:20080424T195243Z
+END:VCARD";
+$archivo = "milfs/tmp/$nombre";
+$file=fopen($archivo,"w") or die("Problemas en la creacion");//En esta linea lo que hace PHP es crear el archivo, si ya existe lo sobreescribe
+fputs($file,$impresion);//En esta linea abre el archivo creado anteriormente e ingresa el resultado de tu script PHP
+fclose($file);//Finalmente lo cierra
+/*
+$ruta="/tmp/vcard_".$identificador.".vcf";
+header ("Content-Disposition: attachment; filename=".$ruta);
+header ("Content-Type: application/octet-stream");
+header ("Content-Length: ".filesize($ruta));
+readfile($ruta);
+*/
+return $archivo;
+
+
+}
+
+function autoriza_formulario_mostrar($password,$form,$control) {
+ $respuesta = new xajaxResponse('utf-8');
+ if($password =="") { unset($_SESSION['permiso_identificador']); $respuesta->addScript("javascript:location.reload(true);"); return $respuesta;}
+ $campo = buscar_campo_tipo($form,"18");
+ $campo_password = $campo[0];
+ $comprobar_clave = remplacetas('form_datos','form_id',"$form",'contenido'," BINARY contenido = MD5('$password') AND id_campo = '$campo_password'") ;
+ $password = md5($password);
+ $aviso = "";
+
+if($comprobar_clave[0] !== $password ) {
+ unset($_SESSION['permiso_identificador']);
+ $respuesta->addAlert("La clave no es válida ");
+ $aviso = "$comprobar_clave[2] !== $control";
+ $respuesta->addAssign("pie_modal","innerHTML",$aviso);
+ return $respuesta;
+ }
+ else{
+ $_SESSION['permiso_identificador']="$control";
+ //$respuesta->addAssign("pie_modal","innerHTML",$aviso);
+ $respuesta->addScript("javascript:location.reload(true);");
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("autoriza_formulario_mostrar");
+
+
+//($control,$form,$plantilla,$tipo)
+function landingpage_contenido_identificador($identificador,$form,$plantilla,$tipo){
+ $linea="";
+
+ $id_empresa = remplacetas('form_datos','control',$identificador,'id_empresa',"") ;
+ //$form = remplacetas('form_datos','control',$identificador,'form_id',"") ;
+
+ $respuestas = respuestas_formulario($form,$identificador);
+ $imagen = buscar_imagen($form[0],$identificador,"","$id_empresa[0]");
+ $plantilla = remplacetas('form_parametrizacion','opcion',"plantilla:$plantilla",'id',"campo = '$form'") ;
+
+ $uri = "$_SESSION[site]i$identificador";
+ $qr = "http://qwerty.co/qr/?d=$uri";
+ if($imagen !="") {
+
+ $mostrar_imagen =" ";
+ $miniatura = "
+ $uri";
+
+ }else {
+ $miniatura ="i$identificador ";
+ $mostrar_imagen = " ";
+
+
+
+ }
+
+ //
+ //$impresion = contenido_mostrar("","$row[control]",'',"landingpage");
+ if($plantilla[0] !="" ) {
+ $impresion = mostrar_identificador($identificador,"","landingpage");
+ } else{
+ $contenido = mostrar_identificador($identificador,"","");
+ $impresion = "
+
+
+
+
+
+
+
+
+
+
+
+
+ $contenido
+ $miniatura
+
+
+ $mostrar_imagen
+
+
+
+
+
+
+
+
+
+
+
+ ";
+
+ }
+ $linea = "
+ $impresion
+
+
+
+ ";
+
+ return $linea;
+ }
+
+
+function landingpage_contenido_formulario($form,$registros,$pagina,$div_original){
+ $cantidad = formulario_contar($form);
+ $div="contenido_interior";
+ //if($registros =="") {$registros ="10";}
+ $consulta= "SELECT control FROM form_datos WHERE form_id = '$form' GROUP BY control ORDER BY id DESC ";
+ $id_empresa = remplacetas('form_id','id',$form,'id_empresa',"") ;
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ //$sql=mysqli_query($consulta,$link);
+ if ($pagina =='') {$inicio = 0; $pagina = 1; }
+ else { $inicio = ($pagina - 1) * $registros;}
+ if($cantidad < $registros) { $limite ="";}
+ else{$limite =" LIMIT $inicio, $registros ";}
+
+ $consulta_limite = $consulta.$limite;
+ $sql=mysqli_query($consulta_limite,$link);
+
+ $paginacion ="";
+ $paginacion .= $indice;
+/*
+ /// PAGINACION
+ if ($pagina =='') {$inicio = 0; $pagina = 1; }
+ else { $inicio = ($pagina - 1) * $registros;}
+ if($cantidad < $registros) { $limite ="";}
+ else{$limite =" LIMIT $inicio, $registros ";}
+
+ $consulta_limite = $consulta.$limite;
+ $sql=mysqli_query($consulta_limite,$link);
+ $page= $pagina;
+ @$pages= ceil($cantidad / $registros); //13; // Hardcoded for testing purpose
+ $limit= 20 ;
+ if ($pages >=1 && $page <= $pages)
+ {
+ $counter = 1;
+ $link = "";
+ if (($page -1) > 0) {
+ $link .= "
+ ";
+ }
+
+ for ($x=$page; $x<=$pages;$x++)
+ {
+
+
+ if($counter < $limit){
+ if ($page == $x){
+ $link .= "$x ";
+ }else{
+ $link .= "$x ";
+ }
+ }
+ $counter++;
+ }
+ if ($page < ($pages - ($limit/2)))
+
+ { $link .= "
+ "; }
+ }
+
+ $paginacion = "";
+
+ */
+
+ //// PAGINACION
+if (mysqli_num_rows($sql)!='0'){
+ $linea=" ( $cantidad ) $paginacion";
+ $fila = 1;
+ mysqli_data_seek($sql, 0);
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $impresion = mostrar_identificador($row['control'],"","landingpage");
+ $imagen = buscar_imagen($form,$row['control'],"","$id_empresa[0]");
+ if($imagen !="") { $clase = "col-lg-5 col-sm-6";}else {$clase = "col-lg-12 col-sm-12";}
+ $uri = " Ver mas ... ";
+ $linea .= landingpage_contenido_identificador($row['control']);
+ }
+ $resultado_linea="$linea
";
+ }
+ if($div_original=="") {
+
+ return $resultado_linea;
+ }else {
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$linea");
+
+ return $respuesta;
+
+ }
+ }
+$xajax->registerFunction("landingpage_contenido_formulario");
+/*
+$respuesta = new xajaxResponse('utf-8');
+$resultado =" $mensaje Procesando ... ";
+$respuesta->addAssign("$div","innerHTML","$resultado");
+
+ return $respuesta;
+
+}
+
+*/
+function landingpage_contenido($id_empresa){
+$consulta= "SELECT * FROM form_id WHERE publico ='1' AND id_empresa= '$id_empresa' ORDER BY orden ASC";
+$miniatura ="";
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+ $linea="";
+ $fila = 1;
+ //include("includes/datos.php");
+ $error_token = "";
+ $contenido = "";
+ if(!isset($mapbox_token)) { include("milfs/includes/datos.php"); if(!isset($mapbox_token)) {$error_token = 1; } else {$error_token = "";}}
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ $contenido = "Mas información ";
+ $imagen = buscar_imagen($row['id'],'','','');
+ $geo = buscar_campo_tipo($row['id'],"14");
+ $ultimo_mapa = remplacetas('form_datos','form_id',$row['id'],'contenido'," id_campo = '$geo[0]'") ;
+ if($ultimo_mapa[0] !="") {
+ $campos = explode(" ",$ultimo_mapa[0]);
+ $lat = $campos['0'];
+ @$lon = $campos['1'];
+ @$zoom = $campos['2'];
+
+ if($error_token != 1) {
+ $url_pin =urlencode("$_SESSION[site]milfs/images/iconos/negro.png");
+ $miniatura = "
+
+
+ "; }else{ $miniatura ="No se ha definido un token de mapbox
";}
+ }
+ if($geo[0] !='') { $mapa= "$miniatura ";}else {$mapa='';}
+ if ( $fila%2==0){
+
+ $linea .= "
+
+
+
+
+
+
+
+
+
$row[nombre]
+
$row[descripcion]
+ $mapa
+
+
+
+ $contenido
+
+
+
+
+
+
+
+
+ ";
+
+ }else{
+ $linea .= "
+
+
+
+
+
+
+
+
+
+
$row[nombre]
+
$row[descripcion]
+ $mapa
+
+
+
+ $contenido
+
+
+
+
+
+
+
+ ";
+ }
+
+
+ //$linea .= "$fila $plantilla$row[nombre] ";
+ $fila++;
+ }
+ }
+return $linea;
+}
+
+function buscar_imagen($form,$control,$tipo,$empresa) {
+ $imagen="";
+ if($control !="") { $w_control = "AND form_datos.control ='$control'";}else{$w_control ="";}
+ if ($form ==""){
+ $consulta = "SELECT form_datos.id_empresa, contenido , campo_nombre , id_campo FROM form_id, form_datos, form_campos
+ WHERE form_datos.id_campo = form_campos.id AND form_id.id = form_datos.form_id
+ AND form_datos.id_empresa = '$empresa'
+ AND publico ='1' AND form_campos.campo_tipo='15' ORDER BY rand() limit 1 ";
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+ $imagen = mysqli_result($sql,0,"contenido");
+ }
+if($tipo == "consulta") { return $consulta; }
+ return $imagen;
+
+ }
+$publico = remplacetas('form_id','id',"$form",'publico',"") ;
+if($publico[0] !="0" ){
+$campo_imagen = buscar_campo_tipo("$form","15");
+$imagen = remplacetas('form_datos','form_id',$form,'contenido'," id_campo = '$campo_imagen[0]' $w_control") ;
+//$imagen = "$imagen[0]";
+return $imagen[0];
+}
+return;
+}
+
+function wait($div,$mensaje){
+$respuesta = new xajaxResponse('utf-8');
+$resultado =" $mensaje Procesando ... ";
+$respuesta->addAssign("$div","innerHTML","$resultado");
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("wait");
+
+
+function campos_tabla($filtro,$div) {
+$mio ="";
+$lineas ="";
+$w_empresa ="";
+$w_especialista ="";
+if($filtro == 'id_empresa') { $w_empresa = " AND id_empresa = '$_SESSION[id_empresa]' ";}
+if($filtro == 'id_especialista') { $w_especialista = " AND id_especialista = '$_SESSION[id]' ";}
+if($filtro == 'llenos') {
+$consulta= " SELECT * , form_campos.id as id FROM form_campos, form_datos WHERE form_campos.id = form_datos.id_campo $w_empresa $w_especialista GROUP BY id_campo ORDER BY campo_area, campo_nombre ";
+}elseif($filtro == 'vacios') {
+$consulta= " SELECT DISTINCT(form_campos.id) as id , `id_especialista` , `id_empresa`, `campo_nombre`, `campo_descripcion`, `campo_tipo`,`campo_area`, `orden`, `activo`, `identificador`, `bloqueo` FROM form_campos WHERE id NOT IN ( SELECT distinct(id_campo) FROM form_datos GROUP BY id_campo) GROUP BY id ORDER BY campo_area, campo_nombre";
+}else{
+$consulta= " SELECT * FROM form_campos WHERE id = id $w_empresa $w_especialista ORDER BY campo_area, campo_nombre ";
+}
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $sql=mysqli_query($consulta,$link);
+ //$div = "div_tabla_campos";
+ $filtros = "
+
+
+
+ Seleccione
+ Todos
+ Mis campos
+ Mi empresa
+ Vacios
+ Llenos
+
+
+
+ ";
+ if (mysqli_num_rows($sql)!='0'){
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ $tipo_nombre = remplacetas_noid('form_tipo_campo','id_tipo_campo',"$row[campo_tipo]",'tipo_campo_nombre',"") ;
+ $campo_tipo ="$tipo_nombre[0] ";
+ if($_SESSION['id_empresa'] == $row['id_empresa']) {
+ $row['campo_nombre']= editar_campo("form_campos","$row[id]","campo_nombre","","","","");
+ $row['campo_descripcion']= editar_campo("form_campos","$row[id]","campo_descripcion","","","","");
+ $row['campo_area']= editar_campo("form_campos","$row[id]","campo_area","","","","");
+ $row['activo']= editar_campo("form_campos","$row[id]","activo","","","","","");
+ $accion = " ";
+ $class='success';
+ }else {
+ $class='';
+ $accion ="";
+ }
+ if($_SESSION['id'] == $row['id_especialista']) {
+ $row['id_especialista'] = " $row[id_especialista]";
+ }
+
+ $lineas .= "$row[id] $row[campo_nombre] $row[campo_descripcion] $campo_tipo $row[campo_area] $row[activo] $row[id_empresa] $row[id_especialista] $mio $accion ";
+ }
+ $tabla = "
+
+
+ id Nombre Descripcion Tipo
+ $lineas
+
+
+ ";
+ }
+ if($div !=""){
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$tabla");
+ return $respuesta;
+ }
+ else{
+ $resultado = "$filtros $tabla";
+ return $resultado;
+}
+}
+$xajax->registerFunction("campos_tabla");
+
+function remplacetas_noid($tabla,$campo,$valor,$por,$and){
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
+$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
+//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
+$sql=mysqli_query($consulta,$link);
+if (@mysqli_num_rows($sql)!=0){
+$resultado[] = mysqli_result($sql,0,$por);
+$resultado[] = mysqli_result($sql,0,"$campo");
+$resultado[] = $consulta;
+$resultado[] = mysqli_result($sql,0,"md5_$por");
+ }else{
+ $resultado[0] = '';
+ $resultado[1] ="";
+ $resultado[2] = $consulta;
+ $resultado[3] = NULL;
+ }
+return $resultado;
+}
+
+
+
+function contar_visitas($id,$tipo) {
+$id_visitas = remplacetas('form_parametrizacion','campo',$id,'id'," tabla='form_id' AND opcion='$tipo'") ;
+$visitas = remplacetas('form_parametrizacion','id',$id_visitas[0],'descripcion',"") ;
+$cantidad = $visitas[0]+1;
+if($visitas[0] =="") {
+ $consulta = "INSERT INTO form_parametrizacion set tabla='form_id', campo ='$id',opcion ='$tipo',descripcion= '$cantidad',visible ='1'";
+ }
+else {
+ $consulta = "UPDATE form_parametrizacion set tabla='form_id', campo ='$id',opcion ='$tipo',descripcion= '$cantidad',visible ='1'
+ WHERE id ='$id_visitas[0]' LIMIT 1";
+}
+$link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $sql=mysqli_query($consulta,$link);
+$cantidad = "$cantidad $_SESSION[analizador]";
+return $cantidad;
+}
+
+
+function geocoder($valor,$campo){
+$respuesta = new xajaxResponse('utf-8');
+if(strlen($valor) > 3) {
+$valor = urlencode($valor);
+$json = "https://nominatim.openstreetmap.org/search.php?format=json&limit=5&addressdetails=1&q=$valor";
+$data = file_get_contents("$json");
+$geocoder = json_decode($data, true);
+if($data ==="[]") {$vacio="
+
+ No se encontraron resultados
+";}
+
+foreach ($geocoder as $clave => $valor) {
+ $ciudad = $valor['address']['city'];
+ $municipio = $valor['address']['town'];
+ $pais = $valor['address']['country'];
+ $departamento = $valor['address']['state'];
+ $licencia= $valor['licence'];
+ $link = "$_SESSION[url]mapero.php?lat=$valor[lon]&lon=$valor[lat]&zoom=16&id=$campo";
+ $linea .= "
+
+
+ $valor[display_name]
+
+ $ciudad $municipio $pais $departamento
+
+
+
+ ";
+//foreach ($valor as $clave => $valor) { $linea .= "CLAVE : $clave > VALOR: $valor"; }
+}
+$resultado = "
+
+ $vacio $licencia
+
";
+}
+ //$div_contenido = "$div
";
+ //$respuesta->addAssign("muestra_form","innerHTML","$aviso");
+ //$respuesta->addAssign("titulo_modal","innerHTML","Hola mundo");
+ //$respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addAssign("muestra_geocoder","innerHTML","$resultado");
+ //$respuesta->addscript("$('#muestraInfo').modal('toggle')");
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("geocoder");
+
+
+function mostrar_psi(){
+$respuesta = new xajaxResponse('utf-8');
+include("psi.php");
+ //$div_contenido = "$div
";
+ $respuesta->addAssign("muestra_form","innerHTML","$aviso");
+ //$respuesta->addAssign("titulo_modal","innerHTML","Hola mundo");
+ //$respuesta->addAssign("pie_modal","innerHTML","$pie");
+ //$respuesta->addAssign("$div","innerHTML","$resultado");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("mostrar_psi");
+
+function multiempresa_crear($tabla,$formulario,$div) {
+$formulario = limpiar_caracteres($formulario);
+$link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ foreach($formulario as $c=>$v){
+
+ $valores .= " $c = '".mysqli_real_escape_string($link,$v)."',";
+ }
+ $valores = "$valores id_responsable = '$_SESSION[id]'";
+
+$respuesta = new xajaxResponse('utf-8');
+
+ $insertar = "INSERT INTO $tabla set $valores";
+ $sql=mysqli_query($insertar,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+
+
+ }
+ $respuesta->addScript("javascript:xajax_multiempresa('empresa','$div')");
+ return $respuesta;
+}
+$xajax->registerFunction("multiempresa_crear");
+
+
+function multiempresa($tabla,$div){
+ if($_SESSION['id'] == 1) {
+ if($div =="") {
+ $div="contenido";
+ $resultado =" Configuración multiempresa ";
+ return $resultado;
+ }
+$link=Conectarse();
+
+mysqli_query("SET NAMES 'utf8'");
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}$consulta = "SELECT * FROM empresa ";
+$sql=mysqli_query($consulta,$link);
+
+$resultado="
+$name
+Id Nombre Sigla Email Web Dirección Teléfono
+ " ;
+if (mysqli_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="";}else{$vacio =" >> Nuevo $descripcion << ";}
+
+$linea = 1;
+while( $row = mysqli_fetch_array( $sql ) ) {
+$razon_social= editar_campo("empresa",$row['id'],"razon_social","","","");
+$sigla= editar_campo("empresa",$row['id'],"sigla","","","");
+$email= editar_campo("empresa",$row['id'],"email","","","");
+$web= editar_campo("empresa",$row['id'],"web","","","");
+$direccion= editar_campo("empresa",$row['id'],"direccion","","","");
+$telefono= editar_campo("empresa",$row['id'],"telefono","","","");
+$estado= editar_campo("empresa",$row['id'],"estado","","","");
+
+if($row[id] !=1) {$acciones = " Estado: $estado";}
+$resultado .= "$row[id] $razon_social $sigla $email $web $direccion $telefono $acciones ";
+$linea++;
+ }
+
+
+ }else{
+ $resultado = " No hay resultados
";
+ }
+
+$resultado .= "
+
+Agregar empresa
+
+
+
+";
+//return $resultado;
+ //$respuesta = new xajaxResponse('utf-8');
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+ }
+}
+$xajax->registerFunction("multiempresa");
+
+
+
+
+
+
+function contar_valores_formulario($campo,$key,$valor){
+$consulta = "SELECT distinct($campo) as cantidad FROM form_datos WHERE $key LIKE '$valor' ";
+$link=Conectarse();
+mysqli_query("SET NAMES 'UTF8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+$resultado = mysqli_num_rows($sql);
+//$resultado = mysqli_result($sql,0,"cantidad");
+}
+//$resultado .= " $consulta";
+return $resultado;
+}
+
+
+function listar_campos_formulario($id_form,$tipo){
+ $tipo="$tipo";
+$consulta = "SELECT distinct(id_campo),campo_nombre FROM form_datos,form_campos WHERE form_id = '$id_form' AND form_datos.id_campo = form_campos.id ";
+$link=Conectarse();
+mysqli_query("SET NAMES 'UTF8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+while( $row = mysqli_fetch_array( $sql ) ) {
+ if($tipo=="nombres"){
+$resultado[] = "$row[campo_nombre]";}
+ elseif($tipo=="select"){
+ $option .= "$row[campo_nombre] ";
+ }
+ else{
+//$resultado .= " $row[id_campo] ";
+$resultado[] = $row['id_campo'];
+}
+}
+if($tipo=="select"){
+$resultado = "
+
+ Campo
+ $option
+ ";
+
+}
+//$resultado = mysqli_result($sql,0,"cantidad");
+}
+//$resultado .= " $consulta";
+return $resultado;
+}
+
+
+//($formulario,$div,$registros,$pagina,$formato)
+function consultar_formulario($form,$registros,$pagina,$tipo){
+ $imagen ="";
+ $busca ="";
+ $busqueda ="";
+ $fechas ="";
+ $campo ="";
+ $lineas ="";
+ $linea ="";
+ $formato ="";
+ $listado_nombres ="";
+$respuesta = new xajaxResponse('utf-8');
+//if(is_array($form)) {$id_form = $form['id_form'];}else { $id_form = $form;}
+$id_empresa = $_SESSION['id_empresa'];
+if(is_array($form)) {
+ $fecha_inicio = $form["inicio"];
+ if($fecha_inicio =="" ) { $fecha_inicio ="2000-01-01";}
+ $fin = $form["fin"];
+ if( $fin !="") { $fechas = " AND timestamp BETWEEN UNIX_TIMESTAMP('$fecha_inicio') AND UNIX_TIMESTAMP('$fin 23:59:59')";}
+ $id_form = $form['id_form'];
+ @$id_campo = $form['id_campo'];
+ $busqueda = $form['busqueda'];
+if($busqueda !=''){$busca ="AND contenido LIKE '%%$form[busqueda]%%'";}else{$busca ='';}
+if($id_campo !=''){$campo ="AND id_campo = '$id_campo'";}else{$campo ='';}
+}else{
+$id_form = $form;
+}
+$consulta_principal = "SELECT control,id,form_id FROM form_datos WHERE form_id = '$id_form' AND form_datos.id_empresa = '$id_empresa' $busca $campo $fechas GROUP BY form_datos.control ORDER BY form_datos.id DESC ";
+$link=Conectarse();
+mysqli_query("SET NAMES 'UTF8'");
+$sql_total=mysqli_query($consulta_principal,$link);
+$total_registros = mysqli_num_rows($sql_total);//formulario_contar($id_form);
+/// PAGINACION
+ if ($pagina =='') {$inicio = 0; $pagina = 1; }
+ else { $inicio = ($pagina - 1) * $registros;}
+ if($total_registros < $registros) { $limite ="";}
+ else{$limite =" LIMIT $inicio, $registros ";}
+ if($tipo == "csv" ) {$consulta_limite = "$consulta_principal";}
+ else{$consulta_limite = $consulta_principal.$limite;}
+ $sql=mysqli_query($consulta_limite,$link);
+
+//$sql=mysqli_query($consulta_principal,$link);
+if (mysqli_num_rows($sql)!='0'){
+
+/////// FILTRO
+
+$fecha = time ();
+ $ahora = date ( "Y-m-d" , $fecha );
+ $campos = listar_campos_formulario($id_form,"select");
+ $peticion = "
+
+
+
+
+
+
+
+
+ ";
+/////// FILTRO
+
+$boton_borrar = "
+
+
+
+ ";
+
+ if($formato!='csv'){
+ $boton_exportar = " Exportar ";}
+
+ $link = "";
+ // $page = $_GET['page'];
+ $page= $pagina;
+ @$pages= ceil($total_registros / $registros); //13; // Hardcoded for testing purpose
+ $limit=10 ;
+ if ($pages >=1 && $page <= $pages)
+ {
+ $counter = 1;
+ $link = "";
+ if (($page -1) > 0) {
+ $link .= "
+ ";
+ }
+
+ for ($x=$page; $x<=$pages;$x++)
+ {
+
+
+ if($counter < $limit){
+ if ($page == $x){
+ $link .= "$x ";
+ }else{
+ $link .= "$x ";
+ }
+ }
+ $counter++;
+ }
+ if ($page < ($pages - ($limit/2)))
+
+ { $link .= "
+ "; }
+ }
+
+ $paginacion = "";
+
+
+
+
+ $encabezado = "
+ ";
+
+ $total_registros = mysqli_num_rows($sql);
+ $nombres_campos = listar_campos_formulario("$id_form","nombres");
+ foreach($nombres_campos as $campo_nombre=>$nombre){
+ $listado_nombres .= "$nombre ";
+ }
+ $listado_nombres = "Identificador $listado_nombres ";
+$listado_campos = listar_campos_formulario("$id_form",'');
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+//$cantidad_campos = contar_valores_formulario("id_campo","control","$row[control]");
+
+$listado_campos = listar_campos_formulario("$id_form",'');
+
+foreach($listado_campos as $campo=>$valor){
+ //$imagen = buscar_imagen($if_form,$row['control'],"","");
+ $contenido = remplacetas('form_datos','control',$row['control'],'contenido',"id_campo ='$valor' ") ;
+ $id_dato = remplacetas('form_datos','control',$row['control'],'id',"id_campo ='$valor' ") ;
+ $tipo_campo = remplacetas('form_campos','id',$valor,'campo_tipo',"") ;
+ if($tipo_campo[0] ==15 AND $contenido[0] != "") {
+ @$listado_campos .= "
+
+
+
+
+
+ ";
+ }
+ elseif(($tipo_campo[0] ==1 or $tipo_campo[0] ==2 or $tipo_campo[0] ==3 or $tipo_campo[0] ==4 or $tipo_campo[0] ==12 or $tipo_campo[0] ==13 )AND $contenido[0] != "") {
+ $editar_contenido = editar_campo("form_datos","$id_dato[0]","contenido","");
+ @$listado_campos .= "$editar_contenido ";
+ }
+ else {
+@$listado_campos .= "$contenido[0] ";
+}
+
+ }
+ if (!is_array($listado_campos)){$listado_campos="$listado_campos ";}else {$listado_campos=$listado_campos;}
+ $menu ="
+
+
+
+ ";
+$lineas .= " $menu$row[control] $listado_campos ";
+
+ }
+
+$tabla ="
+
+ $listado_nombres
+
+ $lineas
+
+
";
+$resultado = "
+$encabezado
+
+
+
+$tabla
+
+
+";
+ }
+else {
+$resultado ="
No hay resultados $consulta_limite";
+$respuesta->addAlert("No hay resultados");
+return $respuesta;
+}
+if($tipo =="csv") {
+$html = str_get_html($tabla);
+ // header('Content-type: application/ms-excel');
+ // header('Content-Disposition: attachment; filename=sample.csv');
+ $nombre_archivo ="tmp/Prueba_Formulario_".mktime()."_".$_SESSION['id'].".csv";
+ //$fp = fopen("php://output", "w");
+ $fp=fopen($nombre_archivo , "w");
+ foreach($html->find('tr') as $element)
+ {
+ $td = array();
+ foreach( $element->find('th') as $row)
+ {
+ if (strpos(trim($row->class), 'actions') === false && strpos(trim($row->class), 'checker') === false) {
+ $td [] = $row->plaintext;
+ }
+ }
+ if (!empty($td)) {
+ fputcsv($fp, $td);
+ }
+
+ $td = array();
+ foreach( $element->find('td') as $row)
+ {
+ if (strpos(trim($row->class), 'actions') === false && strpos(trim($row->class), 'checker') === false) {
+ $td [] = $row->plaintext;
+ }
+ }
+ fputcsv($fp, $td);
+ }
+
+ fclose($fp);
+$boton_descarga ="Descargar ";
+
+$datos ="$boton_descarga";
+}else {
+
+$datos = $resultado;
+}
+$div ="contenido_de_modal";
+$resultado = " $datos
";
+ $div_contenido = "$div
";
+ $respuesta->addAssign("muestra_form","innerHTML","$div_contenido");
+ //$respuesta->addAssign("titulo_modal","innerHTML","Hola mundo");
+ //$respuesta->addAssign("pie_modal","innerHTML","$pie");
+
+
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ if($tipo =="modal") {
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+}
+ return $respuesta;
+
+}
+$xajax->registerFunction("consultar_formulario");
+
+
+function datos_array($identificador) {
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'UTF8'");
+$consulta ="SELECT * FROM form_datos WHERE control = '$identificador'
+GROUP BY id_campo ORDER BY timestamp DESC ";
+$sql = mysqli_query($consulta,$link) or die("error al ejecutar consulta ");
+$array = array();
+$array[identificador] = "$identificador";
+while($row = mysqli_fetch_array( $sql ))
+ {
+ $contenido = remplacetas('form_datos','id',$row[id],'contenido',"") ;
+ $id_campo = remplacetas('form_datos','id',$row[id],'id_campo',"") ;
+ $nombre_campo = remplacetas('form_campos','id',$id_campo[0],'campo_nombre',"") ;
+ //$array[id_campo] = $row[id_campo];
+ $array[$nombre_campo[0]] = "$contenido[0]";
+ $array['timestamp'] = "$row[timestamp]";
+ $array['proceso'] = "$row[proceso]";
+ $array['id'] = "$row[id]";
+ $array['orden'] = "$row[orden]";
+ //$array[] = $row;
+
+
+ }
+ return $array;
+}
+
+function parametrizacion_linea($tabla,$campo,$opcion,$descripcion,$div){
+ $respuesta = new xajaxResponse('utf-8');
+if($campo =="") {
+$resultado = "
+
+
+
+ Hiperparametrizador Experimental
+
+
+ Descripción
+
+
+
+
+
+";
+return $resultado;
+}
+ $link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$limpiar ="DELETE FROM `form_parametrizacion` WHERE tabla = '".mysqli_real_escape_string($link,$tabla)."' AND campo ='".mysqli_real_escape_string($link,$campo)."' AND opcion ='".mysqli_real_escape_string($link,$opcion)."' AND id_empresa = '$_SESSION[id_empresa]' LIMIT 1 ";
+$sql=mysqli_query($limpiar,$link);
+$consulta="INSERT INTO form_parametrizacion set tabla = '".mysqli_real_escape_string($link,$tabla)."' , campo ='".mysqli_real_escape_string($link,$campo)."', opcion ='".mysqli_real_escape_string($link,$opcion)."', descripcion ='".mysqli_real_escape_string($link,$descripcion)."', visible='1' , id_empresa = '$_SESSION[id_empresa]'";
+$sql=mysqli_query($consulta,$link);
+if($sql) {
+ $resultado = "$descripcion";
+ $respuesta->addAssign("$div","innerHTML",$resultado);
+
+ }else {
+//$respuesta->addAlert("$consulta");
+}
+//$respuesta->addAssign("confirmar_envio_email","innerHTML",$exito);
+return $respuesta;
+ }
+$xajax->registerFunction("parametrizacion_linea");
+
+function email_contenido($id,$control,$id_campo,$email_envio){
+
+if($email_envio =="") {
+ $email = remplacetas('form_datos','control',"$control",'contenido',"form_id = '$id' AND id_campo ='$id_campo' ") ;
+ $formulario =
+
+ "
+ ";
+return $formulario;
+ }
+ $respuesta = new xajaxResponse('utf-8');
+
+ $validar = validar_email($email_envio);
+ if($validar == '0') {
+ $respuesta->addAssign("input_email_envio","className"," input-group has-error ");
+ $respuesta->addScript("document.getElementById('email_envio').focus(); ");
+ $respuesta->addAlert("Se necesita un email válido");
+ return $respuesta;
+ }
+ $propietario = remplacetas('form_id','id',$id,'propietario',"") ;
+ $propietario = remplacetas('usuarios','id',$propietario[0],'email',"") ;
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa',"") ;
+ $id_empresa = $id_empresa[0];
+ $encabezado = empresa_datos("$id_empresa",'encabezado');
+ $direccion = remplacetas("empresa","id",$id_empresa,"direccion","");
+ $telefono = remplacetas("empresa","id",$id_empresa,"telefono","");
+ $web = remplacetas("empresa","id",$id_empresa,"web","");
+ $email = remplacetas("empresa","id",$id_empresa,"email","");
+ $imagen = remplacetas("empresa","id",$id_empresa,"imagen","");
+ $razon_social = remplacetas("empresa","id",$id_empresa,"razon_social","");
+ $slogan = remplacetas("empresa","id",$id_empresa,"slogan","");
+ $nombre_formulario = remplacetas("form_id","id",$id,"nombre","");
+
+
+$headers = "MIME-Version: 1.0\r\n";
+$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
+$headers .= "From: $razon_social[0] <$email[0]>\r\n";
+$headers .= "Reply-To: $email[0]\r\n";
+$headers .= "Return-path: $email[0]\r\n";
+$headers .= "Cc: $propietario[0]" . "\r\n";
+$impresion = formulario_imprimir("$id","$control","email");
+
+$impresion ="
+$encabezado
+$impresion
";
+$asunto= "[MILFS] $nombre_formulario[0]";
+$cuerpo ="
+
+$impresion
+
+Se ha completado el formulario $nombre_formulario[0]
+Puede revisar los datos en $_SESSION[site]i$control
+Saludos de MILFS
+";
+ if(mail("$email_envio","$asunto","$cuerpo","$headers")){ $exito .="Se envió un email a $email_envio "; }else {$exito .="error enviando correo";}
+
+$respuesta->addAssign("confirmar_envio_email","innerHTML",$exito);
+return $respuesta;
+ }
+$xajax->registerFunction("email_contenido");
+
+
+function mapa_ficha($id) {
+
+ $descripcion = remplacetas('form_id','id',$id,'descripcion','') ;
+ $nombre = remplacetas('form_id','id',$id,'nombre','') ;
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa','') ;
+ $id_empresa = $id_empresa[0];
+ $direccion = remplacetas("empresa","id",$id_empresa,"direccion","");
+ $telefono = remplacetas("empresa","id",$id_empresa,"telefono","");
+ $web = remplacetas("empresa","id",$id_empresa,"web","");
+ $email = remplacetas("empresa","id",$id_empresa,"email","");
+ $imagen = remplacetas("empresa","id",$id_empresa,"imagen","");
+ $razon_social = remplacetas("empresa","id",$id_empresa,"razon_social","");
+ $slogan = remplacetas("empresa","id",$id_empresa,"slogan","");
+ $imagen = " ";
+ $datos ="$nombre[0] $descripcion[0] ";
+ $empresa = "$razon_social[0] |
$web[0] | $direccion[0] | $email[0]
";
+
+ //$prueba = json_decode($prueba);
+
+ $resultado ="
+
+
+
+
+ $imagen
+
+
+
$nombre[0]
+ $descripcion[0]
+
+
+
+
$razon_social[0]
+
MILFS
+
+
+
+ ";
+ return $resultado;
+}
+
+function formulario_parametrizacion($perfil,$accion,$div,$form){
+ $respuesta = new xajaxResponse('utf-8');
+$nombre = remplacetas('form_id','id',$perfil,'nombre') ;
+if($accion =='categorias') {
+
+ }
+ elseif($accion =='grabar'){
+
+ }
+ else {
+ $listado ="
+
+
+
+
+
+
Parametrización
+
Parametrización del formulario $nombre[0]. Por favor seleccione una opción
+
+
+
+
+ ";
+ $respuesta->addAssign($div,"innerHTML",$listado);
+ return $respuesta;
+ }
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$consulta = "
+ SELECT md5(binary contenido) as md5_contenido, contenido FROM form_datos
+ WHERE form_id = '$perfil'
+ AND id_campo = '$campo'
+ GROUP BY contenido
+ ORDER BY contenido asc";
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+$resultado = "Filtro
+
+ Todos ";
+while( $row = mysqli_fetch_array( $sql ) ) {
+$resultado .= " $row[contenido] ";
+ }
+$resultado .= " ";
+ }
+else{$resultado = 'nada';}
+
+if($div !="") {
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+ }else{return $resultado;}
+
+ }
+$xajax->registerFunction("formulario_parametrizacion");
+
+
+
+function lista_categorias($perfil,$categoria,$tipo) {
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+ $categoria_campo = remplacetas('form_parametrizacion','campo',$perfil,'descripcion'," tabla='form_id' and opcion = 'categoria:campo'") ;
+ $categoria_campo = $categoria_campo[0];
+ if($categoria_campo >0 ) {
+$consulta = "
+ SELECT md5(binary contenido) as md5_contenido, contenido FROM form_datos
+ WHERE form_id = '$perfil'
+ AND id_campo = '$categoria_campo'
+ GROUP BY contenido
+ ORDER BY contenido asc";
+
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+$resultado = "";
+while( $row = mysqli_fetch_array( $sql ) ) {
+
+ $icono = remplacetas('form_parametrizacion','campo',$perfil,'descripcion'," tabla='form_id' and opcion = 'categoria:icon:$row[md5_contenido]'") ;
+ if($icono[0] =='') {
+ $icon = "$_SESSION[site]milfs/images/iconos/negro.png";
+ }else{
+
+ $icon = $icono[0];
+ }
+ $icono = "$icon";
+ $contenido= substr($row[contenido],0, $length = 15);
+$resultado .= "
$contenido ";
+ }
+$resultado .= "
";
+ }
+else{$resultado = '';}
+}
+return $resultado;
+}
+
+function parametrizacion_categoria($perfil,$accion,$div,$form){
+ $respuesta = new xajaxResponse('utf-8');
+$nombre = remplacetas('form_id','id',$perfil,'nombre') ;
+$categorias = lista_categorias($perfil,$categoria,$tipo);
+if($accion =='categorias') {
+ $resultado = "
+
+ La categorización se usa para filtrar los datos de un formulario en categorias que pueden ser usadas por ejemplo para diferenciar los datos en un mapa.
+ Es necesario que el formulario que se va a categorizar tenga multiples datos grabados en el campo que se categoriza
+ $categorias
+
+
+
+
+ Icono para la categoría
+
+
+ URL
+
+
+
+
+ Grabar
+
+ ";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ $respuesta -> addScript("xajax_formulario_campos_select('$perfil','parametrizacion')");
+ return $respuesta;
+ }
+ elseif($accion =='grabar'){
+ if($form[tipo] =='categoria') {
+ $url_icon = "$form[icon]";
+ $es_imagen = es_imagen("$url_icon");
+ $altura = GetImageSize($url_icon);
+ $altura= $altura[1];
+ if($form[id_campo] =='') { $error = "Seleccione un campo";}
+ elseif($form[campo_filtro] =='') { $error = "Seleccione Filtro";}
+ elseif(!$es_imagen ) { $error = " [ $url_icon ] no es una imagen válida para el ícono";}
+ elseif($altura > 500 ) { $error = " El ícono no debe tener mas de 300 pixeles de alto.";}
+ elseif($form[icon] =='') {
+ $error = "Escriba la dirección del ícono";
+ }
+ else {$error='';}
+ if( $error !='') {
+ $respuesta -> addAlert("$error $revisar_url ");
+ return $respuesta;
+ }else{
+ $categoria_icono[tabla] = "form_id";
+ $categoria_icono[campo] = "$form[perfil]";
+ $categoria_icono[opcion] = "$form[tipo]:icon:$form[campo_filtro]";
+ $categoria_icono[descripcion] = "$url_icon";
+ $categoria_icono[visible] = "1";
+ $categoria_icono[accion] = "grabar";
+ $grabar_icono = parametrizacion($categoria_icono);
+
+ $categoria_campo[tabla] = "form_id";
+ $categoria_campo[campo] = "$form[perfil]";
+ $categoria_campo[opcion] = "$form[tipo]:campo";
+ $categoria_campo[descripcion] = "$form[id_campo]";
+ $categoria_campo[visible] = "1";
+ $categoria_campo[accion] = "grabar";
+ $grabar_campo = parametrizacion($categoria_campo);
+
+ $categoria_filtro[tabla] = "form_id";
+ $categoria_filtro[campo] = "$form[perfil]";
+ $categoria_filtro[opcion] = "$form[tipo]:filtro:$form[id_campo]";
+ $categoria_filtro[descripcion] = "$form[campo_filtro]";
+ $categoria_filtro[visible] = "1";
+ $categoria_filtro[accion] = "grabar";
+ $grabar_filtro = parametrizacion($categoria_filtro);
+
+
+ $resultado =" $form[campo_filtro] $form[id_campo] ($altura ) [$grabar_icono]";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+ }
+
+ }/// fin de parametrizacion categorias
+ }
+}
+$xajax->registerFunction("parametrizacion_categoria");
+
+
+function parametrizacion_plantilla_campos($formulario){
+$consulta ="SELECT * FROM form_campos ,form_contenido_campos WHERE form_campos.id = form_contenido_campos.id_campo AND form_contenido_campos.id_form = '$formulario' ORDER BY form_campos.campo_nombre";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!=0){
+$campo_imagen = buscar_campo_tipo($formulario,"15");
+$campo_imagen_nombre = $campo_imagen[1];
+$campo_imagen = $campo_imagen[0];
+while( $row = mysqli_fetch_array( $sql ) ) {
+ if($row[id_campo] == $campo_imagen ) {$imagen =" "; $identificador=" ";}
+ else {$imagen=''; $identificador =" \$campo_limpio[$row[id_campo]] ";}
+$listado .= " $imagen $row[campo_nombre] [$row[id_campo]] ";
+
+}
+/*
+$campo_400[$row[id_campo]]
+ $campo_80[$row[id_campo]]
+ $campo_55[$row[id_campo]]
+*/
+$resultado = "
+
+
+
+
+
+
+
+
+ $listado
+ Fecha
+
+
+";
+}
+return $resultado;
+}
+
+
+function parametrizacion_plantilla($formulario,$div,$valores) {
+ $respuesta = new xajaxResponse('utf-8');
+$campo_titulo = remplacetas('form_parametrizacion','campo',$formulario,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+$campo_titulo_nombre = remplacetas('form_campos','id',$campo_titulo[0],'campo_nombre',"") ;
+$link=Conectarse();
+$ultimo = formulario_uso("$formulario",'','ultimo') ;
+mysqli_query("SET NAMES 'utf8'");
+if($valores =="boton") {
+$consulta ="SELECT * FROM form_parametrizacion WHERE campo = '$formulario' AND `opcion` REGEXP '^plantilla:' ORDER BY opcion";
+
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!=0){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $campos_opcion = explode(":",$row[opcion]);
+ $plantilla_nombre = $campos_opcion[1];
+$listado .= "$row[opcion] ";
+$li .= "
+ $plantilla_nombre
+
+
+
+ ";
+//mostrar_modal($form,$control,$plantilla)
+}
+$resultado = "
+
+
+
+";
+$lista ="
+
+
Las plantillas se usan para dar formato a los datos en el momento de presentarlos, se puede usar etiquetas HTML5 , CSS3 y clases de Bootstrap
+
+
+ Nombre
+ Editar
+ Ver
+
+$li
+
+
Nueva plantilla
+";
+ $respuesta->addAssign("$div","innerHTML","$lista");
+ return $respuesta;
+
+}
+else {
+
+$resultado ="
+
+
+
Aún no se han definido plantillas para este formulario
+ Crear una plantilla
+
+
+";
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+}
+}
+
+elseif($valores =="formulario" OR is_numeric($valores)) {
+ $campos = parametrizacion_plantilla_campos("$formulario");
+ $descripcion = remplacetas('form_parametrizacion','id',$valores,'descripcion',"") ;
+ $opcion = remplacetas('form_parametrizacion','id',$valores,'opcion',"") ;
+ $campos_opcion = explode(":",$opcion[0]);
+ $plantilla_nombre = $campos_opcion[1];
+ include("includes/bootsrap_class_list.php");
+$resultado ="
+
+
+
+
+
+
+
+ A
A
')); \">
+
+
A
+
A
+
div
+
H1
+
H2
+
H3
+
+
<li>
+
+
MB
+
+
+
+
+
+ $descripcion[0]
+
+
+ $campos
+
+
+
+
+";
+
+}
+
+elseif(is_array($valores)) {
+ $texto=str_replace('"',"'",$valores[text_contenedor]);
+$plantilla = htmlentities($texto);
+if($valores[nombre_plantilla] == "") {
+ $respuesta->addAlert("No ha especificado un nombre para la plantilla");
+ $respuesta->addAssign("input_nombre_plantilla","className","input-group has-error");
+ return $respuesta;
+ }
+$limpiar ="DELETE FROM `form_parametrizacion` WHERE tabla = 'form_id' AND campo ='$formulario' AND opcion ='plantilla:$valores[nombre_plantilla]' LIMIT 1 ";
+$sql=mysqli_query($limpiar,$link);
+$consulta="INSERT INTO form_parametrizacion set tabla = 'form_id' , campo ='$formulario', opcion ='plantilla:$valores[nombre_plantilla]', descripcion =\"$plantilla\", visible='1' ";
+$sql=mysqli_query($consulta,$link);
+$ultimo = formulario_uso("$formulario",'','ultimo') ;
+$datos = contenido_mostrar("$formulario","$ultimo[1]",'',"$valores[nombre_plantilla]");
+$preview = "
$valores[nombre_plantilla] $datos ";
+ $div_contenido = "
$preview
";
+ $respuesta->addAssign("muestra_form","innerHTML","$div_contenido");
+ $respuesta->addAssign("titulo_modal","innerHTML","$resultado");
+ $respuesta->addAssign("pie_modal","innerHTML","$pie");
+ //$respuesta->addAssign("$div","innerHTML","$resultado");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+
+
+ return $respuesta;
+
+}
+else{
+$resultado ="";
+}
+$resultado .= "";
+
+
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("parametrizacion_plantilla");
+
+
+function parametrizacion_titulo($formulario,$div,$valores) {
+$campo_titulo = remplacetas('form_parametrizacion','campo',$formulario,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+$campo_titulo_nombre = remplacetas('form_campos','id',$campo_titulo[0],'campo_nombre',"") ;
+$respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+if($valores =="") {
+$consulta ="SELECT * FROM form_campos ,form_contenido_campos WHERE form_campos.id = form_contenido_campos.id_campo AND form_contenido_campos.id_form = '$formulario' ORDER BY form_campos.campo_nombre";
+
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!=0){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+$listado .= "
$row[campo_nombre] [$row[id_campo]] ";
+}
+$resultado = "
+
+
El campo titulo, se usa como indice del formulario en algunas visualizaciones como el timeline
+
Campo de Título actual $campo_titulo_nombre[0] [$campo_titulo[0]]
+
+
+ Cambiar campo título
+
+
+ $listado
+
+
+
+";
+}
+}else {
+$limpiar ="DELETE FROM `form_parametrizacion` WHERE tabla = 'form_id' AND campo ='$formulario' AND opcion ='titulo' LIMIT 1 ";
+$sql=mysqli_query($limpiar,$link);
+$consulta="INSERT INTO form_parametrizacion set tabla = 'form_id' , campo ='$formulario', opcion ='titulo', descripcion ='$valores', visible='1' ";
+$sql=mysqli_query($consulta,$link);
+if($sql){
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$formulario,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+ $campo_titulo_nombre = remplacetas('form_campos','id',$campo_titulo[0],'campo_nombre',"") ;
+$resultado ="
addAssign("$div","innerHTML","$resultado");
+
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("parametrizacion_titulo");
+
+
+function mostrar_modal($form,$control,$plantilla){
+$respuesta = new xajaxResponse('utf-8');
+if( $control == "") {
+ $datos = formulario_areas($form,"");
+}else {
+$datos = contenido_mostrar("$form","$control",'',"$plantilla");
+}
+$div ="contenido_de_modal";
+
+$resultado = "
+
+ $datos
+
+
";
+ $div_contenido = "
$div
";
+ $respuesta->addAssign("muestra_form","innerHTML","$div_contenido");
+ //$respuesta->addAssign("titulo_modal","innerHTML","Hola mundo");
+ //$respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+
+ return $respuesta;
+
+}
+$xajax->registerFunction("mostrar_modal");
+
+function portal_filtro_cadena($formulario,$id_campo,$control,$div,$plantilla){
+$cadena = remplacetas('form_datos','control',"$control",'contenido',"form_id = '$formulario' AND id_campo ='$id_campo' ") ;
+$consulta ="SELECT * FROM form_campos ,form_datos
+ WHERE form_datos.form_id = '$formulario' AND form_campos.id = form_datos.id_campo AND form_datos.id_campo = '$id_campo' AND contenido = '$cadena[0]'
+ GROUP BY control ORDER BY contenido";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!=0){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+
+
+ $datos = contenido_mostrar("$formulario","$row[control]",'',"$plantilla");
+ if($plantilla == "") {
+$listado .= "
+";
+}else{$listado .= $datos; }
+}
+$resultado = "
+
+ $listado
+
+";
+}
+
+if ($div ==""){$div="mostrar_contenido";}
+else {$div = "$div";}
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+}
+$xajax->registerFunction("portal_filtro_cadena");
+
+
+
+function portal_filtro_campos($formulario,$id_campo,$div,$plantilla){
+$formulario_descripcion = remplacetas('form_id','id',"$formulario",'descripcion',"") ;
+$formulario_nombre = remplacetas('form_id','id',"$formulario",'nombre',"") ;
+$campo_nombre = remplacetas('form_campos','id',"$id_campo",'campo_nombre',"") ;
+$campo_descripcion = remplacetas('form_campos','id',"$id_campo",'campo_descripcion',"") ;
+
+$consulta ="SELECT * FROM form_campos ,form_datos WHERE form_datos.form_id = '$formulario' AND form_campos.id = form_datos.id_campo AND form_datos.id_campo = '$id_campo' GROUP BY contenido ORDER BY contenido";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!=0){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+$listado .= "
$row[contenido] ";
+}
+$resultado = "
+
+ $formulario_nombre[0] / $campo_nombre[0]
+ {json}
+ $listado
+
+";
+}
+return $resultado;
+}
+
+
+
+function portal_filtro_campos_select($formulario,$id_campo,$div,$plantilla){
+
+if($id_campo =="") {
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$formulario,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+ $id_campo = $campo_titulo[0];
+ if($id_campo =="") { $resultado = ""; return $resultado;}
+ }
+$formulario_descripcion = remplacetas('form_id','id',"$formulario",'descripcion',"") ;
+$formulario_nombre = remplacetas('form_id','id',"$formulario",'nombre',"") ;
+$campo_nombre = remplacetas('form_campos','id',"$id_campo",'campo_nombre',"") ;
+$campo_descripcion = remplacetas('form_campos','id',"$id_campo",'campo_descripcion',"") ;
+
+$consulta ="SELECT *
+ FROM form_campos ,form_datos
+ WHERE form_datos.form_id = '$formulario'
+ AND form_campos.id = form_datos.id_campo
+ AND form_datos.id_campo = '$id_campo'
+ GROUP BY contenido
+ ORDER BY contenido";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!=0){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+$listado .= "
$row[contenido] ";
+}
+$resultado = "
+
+ $campo_nombre[0]
+ $listado
+
+";
+}
+$resultado ="
+
+ Filtro
+ $resultado
+
";
+return $resultado;
+}
+
+
+
+function portal_listado_campos($formulario){
+$formulario_descripcion = remplacetas('form_id','id',"$formulario",'descripcion',"") ;
+$formulario_nombre = remplacetas('form_id','id',"$formulario",'nombre',"") ;
+$consulta ="SELECT * FROM form_campos ,form_contenido_campos WHERE form_campos.id = form_contenido_campos.id_campo AND form_contenido_campos.id_form = '$formulario' ORDER BY form_contenido_campos.orden";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!=0){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+$listado .= "
$row[campo_nombre] ";
+}
+$resultado = "
+
+
+ $formulario_nombre[0]
+ {json}
+ $listado
+
+
+";
+}
+return $resultado;
+}
+
+
+function portal_listado_formularios(){
+
+$consulta ="SELECT * FROM form_id WHERE publico = '1'";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!=0){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+$listado .= "
$row[nombre] ";
+}
+$resultado = "
+
+ Set de datos
+
+ ";
+}
+return $resultado;
+}
+
+
+function insertar_linea($tabla,$key,$campo,$valor,$control,$orden,$div){
+ $respuesta = new xajaxResponse('utf-8');
+ $key = limpiar_caracteres($key);
+ $valor = limpiar_caracteres($valor);
+ $ip = obtener_ip();
+ $ip = " INET_ATON('".$ip."') ";
+if($tabla =="form_datos") {
+$consulta = "INSERT INTO form_datos ( orden, timestamp,id_usuario,id_empresa,form_id,ip,control,id_campo,contenido) VALUES
+ ( '$orden',UNIX_TIMESTAMP(),'$_SESSION[id]','$_SESSION[id_empresa]','$key',$ip ,'$control', '$campo' , '$valor')
+ ";
+
+}
+
+
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $sql=mysqli_query($consulta,$link);
+
+if($div !='') {
+ //$respuesta->addAssign($div,"innerHTML","");
+
+ }
+
+ $respuesta->addAssign("$div","innerHTML","
El registro se insertó con éxito
");
+ return $respuesta;
+}
+$xajax->registerFunction("insertar_linea");
+
+
+function select_combo($id,$tabla,$campo_valor,$campo_descripcion,$tipo){
+
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$Campo_descripcion = ucwords($campo_descripcion);
+$Campo_valor = ucwords($campo_valor);
+$nombre=$tabla."_".$campo_valor;
+$div=$nombre."_hijo";
+$combo = $id."_".$tabla;
+if($tipo!=''){
+$respuesta = new xajaxResponse('utf-8');
+$consulta ="SELECT $id , $campo_valor , $campo_descripcion FROM $tabla WHERE $campo_valor = '$tipo' AND id_empresa = '$id_empresa'";
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+$resultado .= "
$Campo_descripcion
+
";
+$resultado .= " Seleccione $Campo_descripcion ";
+while( $row = mysqli_fetch_array( $sql ) ) {
+$resultado .= " $row[$campo_valor] $row[$campo_descripcion] ";
+ }
+$resultado .= " ";
+ }
+
+
+
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;}
+ELSE{ /// si no especifica $tipo
+$consulta ="SELECT $id , $campo_valor , $campo_descripcion FROM $tabla WHERE id_empresa = '$id_empresa' GROUP BY $campo_valor ";
+$sql=mysqli_query($consulta,$link);
+///$Documento=mysqli_result($grupo,0,"documento_numero");
+$resultado = "
$Campo_valor
+
";
+ $resultado .= " Seleccione $Campo_valor ";
+if (mysqli_num_rows($sql)!='0'){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $explicacion= remplacetas('eapb','codigo',"$row[$campo_valor]",'nombre',"") ;
+$explicacion = $explicacion[0];
+$resultado .= "$row[$campo_valor] ";
+ }
+ }
+$resultado .= "
";
+ }/// FIN de $tipo no especifico
+
+return $resultado;
+}
+$xajax->registerFunction("select_combo");
+
+
+
+function crear_session ($form,$control) {
+
+$consulta = " SELECT distinct(id_campo),contenido FROM form_datos WHERE control = '$control' AND form_id = '$form' order by timestamp DESC ";
+$link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $sql = mysqli_query($consulta,$link);
+ if (mysqli_num_rows($sql)!=0){
+ $resultado ="
";
+ mysqli_data_seek($sql, 0);
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ $id_form = $row[form_id];
+ $campo_nombre = remplacetas('form_campos','id',$row[id_campo],'campo_nombre');
+ $nombre = strtolower( str_replace(' ','_',$campo_nombre[0]));
+ $_SESSION[$nombre] = $row[contenido];
+ $resultado .= "$_SESSION[$nombre] ";
+ }
+ $resultado .= " ";
+ }
+return $resultado ;
+}
+
+function mostrar_identificador($control,$form,$plantilla,$tipo){
+ $resultado="";
+ $tipo="$tipo";
+ if($form != "") {$id_form = "$form";}else {$id_form ="";}
+
+ $impresion = formulario_imprimir("$id_form","$control","$plantilla");
+ if($impresion !="") {
+ $visitas= contar_visitas($control,'identificador') ;
+ $visitas= "
$visitas";
+ $descripcion = remplacetas('form_id','id',$id_form,'descripcion',"") ;
+ $nombre = remplacetas('form_id','id',$id_form,'nombre',"") ;
+ if($tipo=="") {
+ $resultado = "
+
+ $visitas
+
$nombre[0]
+ $descripcion[0]
+
+ $impresion
+
+
+ "; }else {
+$resultado = "$impresion";
+ }
+ }else{
+$resultado ="
No hay resultados ";
+ }
+
+return $resultado ;
+}
+
+function buscar_campo_nombre($form_id,$nombre) {
+
+$consulta ="SELECT form_campos.id FROM `form_campos` , form_contenido_campos WHERE `campo_nombre` = '$nombre' AND form_campos.id = form_contenido_campos.id_campo AND form_contenido_campos.id_form ='$form_id' LIMIT 1";
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $sql = mysqli_query($consulta,$link);
+ $id_campo=mysqli_result($sql,0,"id");
+return $id_campo;
+}
+
+function conversorSegundosHoras($tiempo_en_segundos) {
+ $horas = floor($tiempo_en_segundos / 3600);
+ $minutos = floor(($tiempo_en_segundos - ($horas * 3600)) / 60);
+ $segundos = $tiempo_en_segundos - ($horas * 3600) - ($minutos * 60);
+
+ return $horas . ':' . $minutos . ":" . $segundos;
+}
+
+function mensajes($tipo,$campos_form,$datos,$control) {
+ $campo_remitente = $campos_form['remitente'];
+ $campo_destinatario = $campos_form['destinatario'];
+ $campo_asunto = $campos_form['asunto'];
+ $campo_mensaje = $campos_form['mensaje'];
+ $form_id = $campos_form['formulario_id'];
+ $form_usuarios = $campos_form['formulario_usuarios'];
+ $campo_usuarios = $campos_form['campo_usuario'];
+$respuesta = new xajaxResponse('utf-8');
+if($tipo =='formulario') {
+ if($form_id =='' AND $control !='') {
+$form_id = remplacetas('form_datos','control',"$control",'form_id',"") ;
+$form_id = $form_id[0];
+
+ }
+
+//$campos = formulario_areas($form_id,'campos');
+$control_original = $control;
+if($control =="") {
+ $control = md5(rand(1,99999999).microtime());
+}
+ $campos = formulario_areas($form_id,'campos');
+$formulario ="
+
+
+
+
+
+
+$campos";
+
+$formulario ="
+
+
+
+
+ $formulario
+
+
+
+
+
+
";
+ $respuesta->addAssign("div_mensaje_$control_original","innerHTML",$formulario);
+ //$respuesta->addAlert("div_mensaje_$control_original","innerHTML",$formulario);
+return $respuesta;
+
+}
+elseif($tipo =='responder') {
+ if($form_id =='' AND $control !='') {
+$form_id = remplacetas('form_datos','control',"$control",'form_id',"") ;
+$form_id = $form_id[0];
+
+ }
+ $remitente = buscar_campo_nombre("$form_id","Para");
+ $destinatario = buscar_campo_nombre("$form_id","De");
+ $mensaje = buscar_campo_nombre("$form_id","Mensaje");
+ $asunto = buscar_campo_nombre("$form_id","Asunto");
+
+ $asunto_value = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$asunto' AND control='$control'") ;
+ $mensaje_value = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$mensaje' AND control='$control'") ;
+ $remitente_value = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$remitente' AND control='$control'") ;
+ $destinatario_value = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$destinatario' AND control='$control'") ;
+
+$formulario ="
+
+
+
+
+
+
+
+
+ Asunto
+
+
+
+ Mensaje
+ $mensaje_value[0]
+
+ ";
+
+$formulario ="
+
+
+
+
+ $formulario
+
+
+
+
+
+
+";
+ $respuesta->addAssign("div_mensaje_$control","innerHTML",$formulario);
+ //$respuesta->addAlert("div_mensaje_$control_original","innerHTML",$formulario);
+return $respuesta;
+
+}
+elseif($tipo=="recuperar") {
+
+if($control =="") {
+ $control = md5(rand(1,99999999).microtime());
+}
+
+ $consulta ="SELECT *, FROM_UNIXTIME(timestamp) as fecha , DATE_FORMAT(FROM_UNIXTIME(timestamp),'%Y-%m-%d') as dia, DATE_FORMAT(FROM_UNIXTIME(timestamp),'%H:%i') as hora FROM form_datos WHERE form_id ='$form_id' AND id_campo = '$campo_destinatario' AND contenido ='$_SESSION[usuario_milfs]' GROUP BY control, timestamp order by timestamp DESC ";
+
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+
+ $mensajes = mysqli_query($consulta,$link);
+// $destinatario ="$campo_destinatario"."[0]";
+// $para = buscador_campo("$campo_destinatario","$form_id","","$destinatario","","");
+ $campos = formulario_areas($form_id,'campos');
+$formulario ="
+
+
+
+
+
+
+$campos";
+
+$formulario ="
+
+
+
+
+ $formulario
+
+
+
+
+
+
";
+
+
+
+$lista ="
+
+
+
+";
+while( $row = mysqli_fetch_array( $mensajes ) ) {
+ $asunto = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$campo_asunto' AND control='$row[control]'") ;
+ $mensaje = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$campo_mensaje' AND control='$row[control]'") ;
+ $remitente = remplacetas('form_datos','form_id',"$form_id",'contenido'," id_campo = '$campo_remitente' AND control='$row[control]'") ;
+ $remitente = remplacetas('form_datos','form_id',"$form_usuarios",'contenido'," id_campo = '$campo_usuarios' AND control='$remitente[0]'") ;
+ if($remitente[0] =='') {$remitente[0]="
Sistema";}
+ $hoy=date('Y-m-d');
+ $control = $row[control];
+ if($hoy == $row[dia]){$momento = $row[hora];}else {$momento=$row[dia];}
+//function contenido_mostrar($id,$control,$div,$plantilla)
+//$contenido = contenido_mostrar("$form_id","$control","",'');
+ $lista .="
+
+ ";
+}
+ // $respuesta->addAssign("div_mensaje","innerHTML",$lista);
+ $lista .=" ";
+ return $lista;
+
+}
+
+$resultado ="hola";
+
+ $respuesta->addAssign("div_mensaje","innerHTML",$resultado);
+
+ return $respuesta;
+
+
+}
+$xajax->registerFunction("mensajes");
+
+function revisar_campo_unico($id,$campo,$id_form,$valor) {
+ $respuesta = new xajaxResponse('utf-8');
+ $div= "div_$id";
+ $existe = remplacetas('form_datos','form_id',"$id_form",'control'," BINARY contenido = '$valor' AND id_campo = '$campo'") ;
+ if($existe[0] != "") {
+ $texto ="El valor ya existe";
+$respuesta->addAssign("$div","className","text-danger");
+$respuesta->addAssign("input_$id","className","form-group has-error");
+ }else{
+ $texto ="";
+$respuesta->addAssign("$div","className","text-success");
+$respuesta->addAssign("input_$id","className","form-group has-success");
+ }
+
+ $respuesta->addAssign("$div","innerHTML",$texto);
+ return $respuesta;
+}
+$xajax->registerFunction("revisar_campo_unico");
+
+
+
+function milfs_session($form_id,$campo_usuario,$campo_password,$tipo,$datos){
+ $datos = mysql_seguridad($datos);
+ $respuesta = new xajaxResponse('utf-8');
+
+if($tipo =="") {
+
+
+
+if($_SESSION[usuario_milfs]) {
+ $formulario = "
SALIR";
+}else {
+$formulario ="
+$accion
+
+
+
+";
+
+
+}
+return $formulario;
+}
+elseif($tipo =='salir') {
+ session_destroy();
+ $respuesta->addScript("javascript:location.reload(true);");
+
+}
+elseif($tipo=='registrarse') {
+ $modificable = remplacetas('form_id','id',$id,'modificable') ;
+ if($modificable[0] != "1" and (!isset ( $_SESSION[id]) )) {
+ $formulario = "
Función no disponible, por favor comuníquese con el administrador
";
+ $respuesta->addAssign("formulario_session","innerHTML",$formulario);
+ return $respuesta;
+
+ }
+$campos = formulario_areas($form_id,'campos');
+
+$boton ="
+
+Registrarse
+";
+$control = md5(rand(1,99999999).microtime());
+ $formulario ="
+
+
+$campos
+$boton
+
+
+";
+
+ $respuesta->addAssign("formulario_session","innerHTML",$formulario);
+
+
+}
+elseif($tipo=='recuperar') {
+
+ if($datos =="") {
+//$campos = formulario_areas($form_id,'campos');
+$campos ="
+
+
Usuario
+
+
+
Código de recuperación Deja este campo vacío si aun no tienes el código de recuperación
+
+
+";
+$boton ="
+
Solicitar clave
+";
+$control = md5(rand(1,99999999).microtime());
+ $formulario ="
+
+
+$campos
+
+$boton
+
+
+
+";
+ }else{
+
+ $usuario = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$datos[usuario]' AND id_campo = '$campo_usuario'") ;
+ if($usuario[0] !="") {
+ $password = remplacetas('form_datos','control',"$usuario[0]",'contenido'," id_campo = '$campo_password' ") ;
+ if($datos[codigo] !="") {
+ if( $datos[codigo] =="$password[0]" ){
+ $control = remplacetas('form_datos','control',"$usuario[0]",'control'," id_campo = '$campo_password' ") ;
+ $campos ="
+
+
+
+
+
+
+
+ ";
+
+ $formulario ="$campos";
+ $respuesta->addAssign("formulario_session","innerHTML",$formulario);
+ return $respuesta;
+
+
+ }else {
+ $respuesta->addAlert("El código no es correcto, por favor rectifíquelo o solicítelo nuevamente dejando el campo VACIO");
+ return $respuesta;
+ }
+ }
+ $campo_email = buscar_campo_tipo("$form_id","12");
+ $usuario = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$datos[usuario]' AND id_campo = '$campo_usuario'") ;
+ $email = remplacetas('form_datos','control',"$usuario[0]",'contenido'," id_campo = '$campo_email[0]' ") ;
+ $formulario="$usuario[0] $password[0] // $campo_email[0] $email[0]";
+ $email_empresa = remplacetas('empresa','id','1','email','') ;
+ $sigla = remplacetas('empresa','id','1','sigla','') ;
+ $razon_social = remplacetas('empresa','id','1','razon_social','') ;
+ $headers = "MIME-Version: 1.0\r\n";
+ $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
+ $headers .= "From: $razon_social[0] <$email_empresa[0]>\r\n";
+ $headers .= "Reply-To: $email_empresa[0]\r\n";
+ $headers .= "Return-path: $email_empresa[0]\r\n";
+ $asunto= "[ $sigla[0] ] Código para recuperar contraseña ";
+ $cuerpo ="
+
Hola $datos[usuario]
+ El código para recuperar tu contraseña es:
+
$password[0]
+ Regresa pronto :-)
+
+ ";
+ if(mail("$email[0]","$asunto","$cuerpo","$headers")){ $formulario ="
Te hemos enviado un correo a $email[0] con el código de recuperación "; }
+ else {$formulario ="
Error enviando correo ";}
+
+ }else{
+
+ $formulario="
No pudimos encontrar tu usuario $datos[usuario] . Por favor rectifícalo y prueba nuevamente ";
+ }
+
+
+ }
+ $respuesta->addAssign("formulario_session","innerHTML",$formulario);
+
+
+}
+elseif($tipo=='confirmar_recuperar') {
+
+ if($datos[password] != $datos[confirmar_password]) {
+ $respuesta->addAlert("Los valores no son iguales");
+ return $respuesta;
+
+ }
+ $link=Conectarse();
+
+mysqli_query("SET NAMES 'utf8'");
+
+
+
+
+ $consulta="UPDATE form_datos SET contenido = MD5('$datos[password]')
+ WHERE control ='$datos[control]'
+ AND contenido ='$datos[codigo]'
+ AND form_id ='$form_id'
+ AND id_campo = '$campo_password' ";
+
+ if (mysqli_query($consulta,$link)){
+$resultado ="
Se cambió el password Por favor ingrese con sus nuevos datos
aquí ";
+$respuesta->addAssign("login_div","innerHTML",$resultado);
+return $respuesta;
+ };
+
+
+
+}
+
+elseif ($tipo=='ingreso'){
+
+ $usuario = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$datos[usuario]' AND id_campo = '$campo_usuario'") ;
+ $password = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = MD5('$datos[password]') AND id_campo = '$campo_password'") ;
+
+if ( $usuario[0] != "" AND $usuario[0] === $password[0]) {
+$respuesta->addAssign("login_milfs","className"," has-success ");
+$resultado ="$usuario[0] // $password[0] ";
+$_SESSION['usuario_milfs'] = $usuario[0];
+$_SESSION['nombre_usuario_milfs'] = $datos['usuario'];
+$respuesta->addScript("javascript:location.reload(true);");
+}else {$resultado ="
Error Los datos no son correctos :( ";
+$respuesta->addAssign("login_milfs","className"," has-error ");
+}
+
+$respuesta->addAssign("resultado","innerHTML",$resultado);
+//$respuesta->addAlert("resultado");
+
+
+}
+elseif ($tipo=='nuevo'){
+
+$usuario = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$datos[usuario]' AND id_campo = '$campo_usuario'") ;
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+
+$campos_consulta_obligatorio="
+ SELECT id_campo, obligatorio
+ FROM form_contenido_campos
+ WHERE id_form ='$form_id'
+ AND obligatorio='1'
+ ";
+
+
+ $campos_obligados= mysqli_query($campos_consulta_obligatorio,$link);
+
+while( $row = mysqli_fetch_array( $campos_obligados ) ) {
+$campo_valor=$datos[$row[id_campo]][0];
+
+if($row[obligatorio]=='1'){
+ $obligatorios .= "$row[id_campo]";
+if($campo_valor == '' && $row[obligatorio]=='1'){
+ $campo_nombre = remplacetas('form_campos','id',$row[id_campo],'campo_nombre');
+$error = "Revise campos obligatorios $campo_nombre[0]";
+
+ }else {$error ="";}
+if($error !=''){
+$respuesta->addAlert($error);
+$respuesta->addScript(" document.getElementById('boton_registro').disabled=false");
+ return $respuesta; }
+ }
+
+
+ }/// fin de registros obligatorios
+
+
+
+ $campos_consulta="
+ SELECT id_campo, obligatorio, id_empresa
+ FROM form_contenido_campos
+ WHERE id_form ='$form_id'
+
+ ";
+ $campos= mysqli_query($campos_consulta,$link);
+$ip = obtener_ip();
+$control = $datos['control'];
+while( $row = mysqli_fetch_array( $campos ) ) {
+$campo_valor=$datos[$row['id_campo']][0];
+$campo_tipo = remplacetas('form_campos','id',$row['id_campo'],'campo_tipo','');
+/// Si el campo es password (18) se guarda su equivalente en md5
+if($campo_tipo[0] =="18") {
+ $campo_valor = MD5("$campo_valor");
+}
+if($campo_tipo[0] =="19") {
+$existe = remplacetas('form_datos','form_id',"$form_id",'control'," BINARY contenido = '$campo_valor' AND id_campo = '$row[id_campo]'") ;
+if($existe[0] !='') {
+$respuesta->addAlert("Revise los campos únicos !");
+$respuesta->addScript(" document.getElementById('boton_registro').disabled=false");
+
+
+ return $respuesta;
+}else{
+//$respuesta->addAlert("$existe[2]"); return $respuesta;
+}
+}
+
+ if ($campo_valor !=''){
+
+$insertar_consulta = "
+ INSERT INTO `form_datos`
+ SET
+ id_campo = '$row[id_campo]',
+ contenido = '$campo_valor',
+ control ='$control',
+ timestamp = UNIX_TIMESTAMP(),
+ form_id = '$form_id',
+ ip = '$ip',
+ id_empresa = '$row[id_empresa]'
+ ";
+
+
+ }else{
+
+
+ }
+
+if ($error ==''){
+$sql_consulta=mysqli_query($insertar_consulta,$link);
+if($sql_consulta){
+$login = milfs_session("$form_id","$campo_usuario","$campo_password","","");
+$resultado ="
Gracias por registrarse, por favor ingrese con los nuevos datos. $login
";
+
+
+ }else{$resultado.= "
La consulta no se grabó
";}
+}else { }
+
+ }
+ $resultado ="
Gracias por registrarse, por favor ingrese con los nuevos datos. $login
";
+$respuesta->addAssign("login_div","innerHTML",$resultado);
+return $respuesta;
+
+
+}
+
+else{}
+return $respuesta;
+
+}
+$xajax->registerFunction("milfs_session");
+
+
+function buscar_datos($valores,$id_form,$plantilla,$div){
+ $valores = mysql_seguridad($valores);
+ $respuesta = new xajaxResponse('utf-8');
+if($valores =="") {
+ $alerta = "
Por favor escriba que desea buscar ";
+$respuesta->addAssign("$div","innerHTML",$alerta);
+ return $respuesta;
+}
+ if (is_array($valores) ){
+ $valor = $valores['valor'];
+ }
+ else {$valor=$valores;}
+if($valor =='*formato*') {
+$resultado="
+
+";
+return $resultado;
+ }else{
+if($id_form !="") {$w_form ="form_id = '$id_form' AND ";}
+$consulta ="SELECT * FROM form_datos WHERE $w_form contenido like '%%$valor%%' group by control LIMIT 200 ";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!=0){
+mysqli_data_seek($sql, 0);
+$fila=1;
+$divider=2;
+$cols = (12/$divider);
+$i =0;
+while( $row = mysqli_fetch_array( $sql ) ) {
+if($i % $divider==0) {
+
+ $encontrados .= "
+
+
+
+ ";
+ }
+ $i++;
+ /* $contenido = htmlentities($row[contenido]);
+ $p = stripos($contenido, $valor);
+ $s1 = substr($contenido, 0, $p);
+ $s2 = substr($contenido, $p, strlen($valor));
+ $s3 = substr($contenido, ($p + strlen($valor)));
+ $r = $s1."
$s2 ".$s3;
+ */
+ $datos = landingpage_contenido_identificador($row['control']);
+ //$datos = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+ $contenido ="
$datos
";
+
+ $encontrados .="$contenido";
+ $fila++;
+ if( $i % $divider==0) {
+ $encontrados .= "
";
+ }
+ }
+ }
+$resultado .="
Resultados de: $valor $encontrados ";
+
+$respuesta->addAssign("$div","innerHTML",$resultado);
+ return $respuesta;
+
+ }
+}
+$xajax->registerFunction("buscar_datos");
+
+function datos_grid($id_form,$filtro,$valor,$plantilla,$divider,$inicio,$limite) {
+ $respuesta = new xajaxResponse('utf-8');
+ $nuevo_inicio = ($inicio+$limite+1);
+if($inicio =="") {
+ $inicio = "0";
+ $script = "
+$(window).scroll(function() {
+ if ($(window).scrollTop() == $(document).height() - $(window).height()) {
+ xajax_datos_grid('$id_form','$filtro','$valor','$plantilla','$divider','$nuevo_inicio','$limite') ;
+ }
+});
+";
+//$respuesta->addScript("$script");
+//$respuesta->addAlert("$script");
+
+ }
+if($limite =="") {$limite = "250";}
+
+ if($valor !=""){
+$md5_valor = $valor;
+if($filtro !='' ){$w_filtro =" AND id_campo = '$filtro' AND md5(binary contenido) = '$md5_valor' ";}
+}
+$consulta_total= "SELECT * FROM form_datos WHERE form_id= '$id_form' $w_filtro GROUP BY control ";
+$consulta= "SELECT * FROM form_datos WHERE form_id= '$id_form' $w_filtro GROUP BY control LIMIT $inicio , $limite";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+//mysqli_real_escape_string($link,$consulta);
+$sql_total=mysqli_query($consulta_total,$link);
+$total = mysqli_num_rows($sql_total);
+$sql=mysqli_query($consulta,$link);
+ $descripcion = remplacetas('form_id','id',$id_form,'descripcion',"") ;
+ $descripcion = $descripcion[0];
+ $buscador = buscar_datos("","$id_form","$plantilla","grid_resultado");
+ $contenido = "$descripcion";
+
+if (mysqli_num_rows($sql)!=0){
+mysqli_data_seek($sql, 0);
+$fila=1;
+if($divider =="") {
+$divider=3;
+}
+$cols = (12/$divider);
+$i =0;
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+ if($i % $divider==0) {
+
+ $contenido .= "
+
+
+
+ ";
+ }
+ $i++;
+$datos = contenido_mostrar("$id_form","$row[control]",'',"$plantilla");
+$contenido .="
$datos
";
+$fila++;
+ if( $i % $divider==0) {
+ $contenido .= "
";
+ }
+
+}
+ }
+
+
+$inicio = ($inicio+$limite+1);
+$div_mas_contenido ="mas_contenido_".$inicio."_".$limite."";
+$mostrado = ($inicio+$limite-1);
+//$limite = ($inicio+$limite-1);
+$resultado ="
$buscador
+
+
+
+ $contenido
+
+ Mostrar mas resultados
+
+ ";
+
+
+///$respuesta->addScript("$script");
+$respuesta->addAssign("contenedor","innerHTML",$resultado);
+ return $respuesta;
+}
+$xajax->registerFunction("datos_grid");
+
+
+function insertar_registro($tabla,$formulario,$div,$principal) {
+ //$valores ="$formulario[0]";
+ $formulario = limpiar_caracteres($formulario);
+ foreach($formulario as $c=>$v){
+
+ $valores .= " $c = '$v',";
+ }
+ $valores = "$valores id_empresa = '$_SESSION[id_empresa]'";
+
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $insertar = "INSERT INTO $tabla set $valores";
+// $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' limit 1; ";
+ $sql=mysqli_query($insertar,$link);
+ $ultimo_id = mysqli_insert_id($link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ $valores = limpiar_caracteres("$valores");
+ $grupo = editar_campo("$tabla",$ultimo_id,"$principal","","","");
+ $respuesta->addAssign($div,"innerHTML","
$formulario[$principal] ");
+
+ }
+ //$respuesta->addAlert("$insertar");
+//$areas = tabla_areas('form_areas','id','nombre,descripcion,estado,orden','',"",'Areas','');
+ //$respuesta->addScript("javascript:xajax_tabla_areas('form_areas','id','nombre,descripcion,estado,orden','','','Areas','div_campos')");
+ //$respuesta->addAssign("contenido","innerHTML","$insertar");
+ return $respuesta;
+}
+$xajax->registerFunction("insertar_registro");
+
+
+
+function formulario_area_campos($perfil,$area,$control) {
+ $tipo="";
+ $control_edit ="$control";
+ $solo_campos ="";
+ $muestra_form ="";
+ if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];} $campos= "";
+
+$consulta = "
+ SELECT * FROM form_campos , form_contenido_campos
+ WHERE form_contenido_campos.id_form = '$perfil'
+ AND form_contenido_campos.id_campo = form_campos.id
+ AND campo_area='$area'
+ ORDER BY form_contenido_campos.orden";
+
+ $link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+
+
+ mysqli_data_seek($sql, 0);
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ if( $row['obligatorio'] == '1'){$obligatorio="*";}else {$obligatorio='X';}
+
+ if($row['campo_tipo'] =="24") { $row['multiple'] = "1";}
+ if($row['multiple'] ==='1' AND $tipo =='edit'){
+ $campos .= formulario_campos_render_multiple($row['id_campo'],$perfil,$control_edit);
+ }else{
+ $campos .= formulario_campos_render($row['id_campo'],$perfil,$control_edit,'','');
+ }
+ $muestra_form .= "$campos $obligatorio ";
+ $solo_campos .= "$campos $obligatorio ";
+
+ }
+
+
+}
+
+
+$resultado = "$muestra_form";
+ return $campos;
+
+}
+
+function formulario_areas($perfil,$tipo,$form_respuesta,$control_respuesta){
+ $id="";
+ $resultado_campos ="";
+ $subir_imagen ="";
+ $campo_imagen_nombre ="";
+ if($form_respuesta =='respuesta'){$control = $control_respuesta;}
+ //elseif($form_respuesta =='edicion'){$control = $control_respuesta;}
+ else{
+$control = md5(rand(1,99999999).microtime());
+}
+ $respuesta = new xajaxResponse('utf-8');
+ if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}
+ /*$consulta = "SELECT * FROM form_areas, form_campos, `form_contenido_campos`
+ WHERE form_campos.id = form_contenido_campos.id_campo
+ AND form_contenido_campos.id_form = '$perfil'
+ AND form_areas.id = form_campos.campo_area AND form_areas.id_empresa = '$id_empresa'
+ OR (form_contenido_campos.id_form = '$perfil' AND form_campos.campo_area ='0' )
+ AND form_areas.estado = '1' GROUP BY form_areas.id ORDER BY form_areas.orden";
+ */
+ $consulta= "SELECT * FROM form_campos, `form_contenido_campos`
+ WHERE form_campos.id = form_contenido_campos.id_campo
+ AND form_contenido_campos.id_form = '$perfil'
+
+ GROUP BY form_campos.campo_area
+ ";
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
+ //$campo_titulo = remplacetas('parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+ $nombre = remplacetas('form_id','id',$perfil,'nombre','') ;
+ $descripcion = remplacetas('form_id','id',$perfil,'descripcion','') ;
+ $formulario_respuesta = remplacetas('form_id','id',$perfil,'formulario_respuesta','') ;
+ $empresa = remplacetas('form_id','id',$perfil,'id_empresa','') ;
+ $empresa = $empresa[0];
+
+ $nombre= strtoupper($nombre[0]);
+ $descripcion= $descripcion[0];
+ $form_respuesta= $formulario_respuesta[0];
+
+
+//// encabezado form
+
+ if($tipo =='edit') {$control= $control_respuesta;}
+ elseif($form_respuesta !='' AND $control !=''){$control =$control;}
+ else{$control = md5(rand(1,99999999).microtime());}
+ //$descripcion=mysqli_result($sql,0,"descripcion");
+ //$nombre=mysqli_result($sql,0,"nombre");
+ //$empresa=mysqli_result($sql,0,"id_empresa");
+ $encabezado = empresa_datos("$empresa",'encabezado');
+ $pie = empresa_datos("$empresa",'pie');
+ $cabecera = "
+
+
+
+
+
+
+
+
$nombre$descripcion
+
+
+
+
";
+
+$campo_imagen = buscar_campo_tipo($perfil,"15");
+if($campo_imagen[0] !="") {
+$campo_imagen_nombre = $campo_imagen[1];
+$campo_imagen_nombre = ucwords($campo_imagen_nombre);
+$campo_imagen = $campo_imagen[0];
+ }
+
+if ($campo_imagen[0] != "") {
+$subir_imagen = subir_imagen("$perfil","$campo_imagen"."[0]");
+if($tipo != "campos") {
+ $imagen = "
+
+
+ ";
+
+ }else {$imagen =" ";}
+ }
+
+ $muestra_form = "
+
+
+
+
+
+
+
+
+ ";
+ if($tipo=="edit") {$control_edit = "$control";}else {$control_edit = "";}
+
+
+////fin encabezado form
+
+
+$fila=0;
+while( $row = mysqli_fetch_array( $sql ) ) {
+
+ if($row['campo_area']=="0"){$area_nombre ="";}
+ else{
+ $area_nombre = remplacetas('form_areas','id',$row['campo_area'],'nombre','') ;
+ $area_nombre = $area_nombre[0];
+ }
+ $fila = $fila +1;
+
+ //$producto = remplacetas('farmacia_cum','id',$row[id_producto],'fabricante_importador') ;
+ ///// para pasar el parametro de medicamentos al formulario no pos se adiciona ".func_get_arg(2)."
+ $campos = formulario_area_campos($perfil,$row['campo_area'],"$control_edit");
+$resultado_campos .= "
+
+$area_nombre
+$campos
+ ";
+ }
+
+
+//// botonera form
+
+$muestra_form .="$resultado_campos
+
+ ";
+
+//// fin botonera form
+
+ }
+
+//// cierre form
+
+$muestra_form .="
+
+
+
";
+if($tipo=='campos') {
+
+ $resultado = "$resultado_campos $imagen ";
+ return $resultado;
+}
+if($tipo=='embebido') {
+$resultado = "
+$muestra_form
+
Poweredy by MILFS
+
Políticas de privacidad y protección de datos.
+";
+return $resultado;
+
+}
+
+$resultado = "
+$cabecera
+$muestra_form
+
Poweredy by MILFS
+
Políticas de privacidad y protección de datos.
+
+";
+return $resultado;
+
+/// fin cierre form
+ // $resultado .= "$consulta";
+//$respuesta->addAssign($div,"style.display","block");
+//$respuesta->addAssign($div,"innerHTML",$resultado);
+//return $respuesta;
+ //print $muestra_form;
+// return $muestra_form;
+ }
+
+ $xajax->registerFunction("formulario_areas");
+
+
+
+function tabla_areas($tabla,$value,$descripcion,$onchange,$where,$nombre,$div){
+ $group ="";
+ if($div =="") {
+ $div="div_campos";
+ $resultado = "
+
Modificar areas
+ ";
+ return $resultado;
+ }
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+$campo1 = $campos[0];
+$campo2 = $campos[1];
+$campo3 = $campos[2];
+$campo4 = $campos[3];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysqli_query("SET NAMES 'utf8'");
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}if($where =='AGRUPADO'){$group="group by $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT * FROM $tabla WHERE 1 $w AND id_empresa='$_SESSION[id_empresa]' $group ORDER BY orden ";
+$sql=mysqli_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+
+$resultado="
+$name
+Id $campo1 $campo2 $campo3 $campo4
+ " ;
+if (mysqli_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="";}else{$vacio =" >> Nuevo $descripcion << ";}
+
+$linea = 1;
+while( $row = mysqli_fetch_array( $sql ) ) {
+$editar_campo1= editar_campo("$tabla",$row['id'],"$campo1","","","","");
+$editar_campo2= editar_campo("$tabla",$row['id'],"$campo2","","","","");
+$editar_campo3= editar_campo("$tabla",$row['id'],"$campo3","","","","");
+$editar_campo4= editar_campo("$tabla",$row['id'],"$campo4","","","","");
+$eliminar = " ";
+$resultado .= "$row[$value] $editar_campo1 $editar_campo2 $editar_campo3 $editar_campo4 $eliminar ";
+$linea++;
+ }
+
+
+ }else{
+ $resultado = " No hay resultados
";
+ }
+
+$resultado .= "
+
+
+
+
+
+Agregar área
+
+
+
+
+
+
+
+
+
+
+
+
+";
+//return $resultado;
+ //$respuesta = new xajaxResponse('utf-8');
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+
+}
+$xajax->registerFunction("tabla_areas");
+
+
+
+
+function importar_coleccion($form){
+$div ="confirmar_importacion";
+//$archivos = listado_archivos("$form[path]");
+//$archivos = listar_archivos("$form[path]",'cantidad','',$form);
+
+ $directorio = opendir("$form[path]"); //ruta actual
+$resultado = " ";
+while ($archivo = readdir($directorio)) //obtenemos un archivo y luego otro sucesivamente
+{
+ if (is_dir($archivo))//verificamos si es o no un directorio
+ {
+ // $resultado .= "[".$archivo . "]
"; //de ser un directorio lo envolvemos entre corchetes
+ }
+ else
+ {$autor="";
+ $ext = explode(".", $archivo);
$ext = strtolower($ext[count($ext) - 1]);
if ($ext == "jpeg") {$ext = "jpg"; }
+ if ($ext == "jpg") {
+ $cantidad_imagenes++ ;
+
+ $exif = leer_exif("$form[path]/$archivo");
+ //$name = $exif['exif']['FileName']." ".$form['38']['0']."*" ;
+ $form['0']['0'] = "$archivo";
+ $autor= $exif['exif']['Artist'];
+ $creator = $form['40'][0];
+ if($autor !="" ) { $remplazo = array('40' => array("$autor")); }else{ $remplazo; }
+
+ }
+ //$form = array_replace_recursive($form, $reemplazo);
+ $resultado .= $archivo ." / $name ".$form['0'][0]."
";
+ }
+}
+
+/*
+foreach($form as $c=>$v){
+
+//LISTA ELEMENTOS DE UN ARRAY
+if (is_array($v) ){
+ foreach($v as $C=>$V){
+ $campo .= "( $c : $V )
";
+ if($V != '') {
+ }
+ }
+}
+}
+*/
+//$resultado="$archivos $campo";
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+
+}
+$xajax->registerFunction("importar_coleccion");
+
+
+
+
+function listar_archivos( $path ,$opcion, $div,$datos){
+ // Abrimos la carpeta que nos pasan como parámetro
+
+ $resultado ="";
+ //$link = Conectarse();
+ $dir = opendir($path);
+ $cantidad =0;
+ $cantidad_imagenes =0;
+//$datos['61'] = array ( 0 => "otro valor");//"OTRO VALOR";
+ if(is_file($path)) {$esarchivo="Escriba la ruta a un directorio en el servidor
"; }
+ // Leo todos los ficheros de la carpeta
+ //if($esarchivo =="") {
+ // $elemento = readdir($dir);
+ //}
+ while ($elemento = readdir($dir) ){
+
+ // Tratamos los elementos . y .. que tienen todas las carpetas
+ if( $elemento != "." && $elemento != ".."){
+ // Si es una carpeta
+ if( is_dir($path.$elemento) ){
+ // Muestro la carpeta
+ // $resultado .= "
CARPETA: ". $elemento ."
";
+ // Si es un fichero
+ } else {
+ $ext = explode(".", $elemento);
$ext = strtolower($ext[count($ext) - 1]);
if ($ext == "jpeg") {$ext = "jpg"; }
+ if ($ext == "jpg") {$cantidad_imagenes++ ;
+
+ $exif = leer_exif("$path/$elemento");
+ $name = $exif['exif']['FileName'];
+ $title= "$name ";
+ $date= $exif['exif']['DateTimeOriginal'];
+ $autor= $exif['exif']['Artist'];
+ if(!isset($autor)) { $autor = $datos['40'][0]; }
+ $licencia= $exif['exif']['Copyright'];
+ if($licencia ==="") { }
+ else{
+// $datos['61'][0]= " XX $licencia XXX";
+ }
+
+
+ //$datos['61'][0] = $licencia;
+ if(isset($exif['exif']['UndefinedTag:0xC4A5'])) {
+ $exif['exif']['UndefinedTag:0xC4A5']= base64_encode($exif['exif']['UndefinedTag:0xC4A5']);
+ }
+ if(isset($exif['exif']['MakerNote'])) {
+ $exif['exif']['MakerNote']= base64_encode($exif['exif']['MakerNote']);
+ }
+ if ( $exif['lon'] =="" )
+ {
+ $geo = $datos['58'][0];
+ $mundo ="";
+ $datos['58'][0] = $datos['58'][0];
+
+ }
+ else {
+ $geo = "$exif[lon] $exif[lat] 18" ;//$datos['58'][0];
+ $mundo ="
";
+ $datos['58'][0]= "$geo";
+
+
+ }
+
+ // $remplazos = array('40');
+ // else { $mapa="";}
+ //$json = json_encode($exif['exif'],JSON_PRETTY_PRINT);
+ //if ( $exif['lon'] =="" ){$datos['58'][0] = $geo;}else {$datos['58'][0] = $datos['58'][0];}
+ $resultado .= "
$geo $mundo / ".$datos['58'][0]." ".$datos['999'][0]." $title / $autor / ".$datos['61'][0]." ".$datos['68'][0]." ";
+
+ }
+
+ $cantidad ++;
+
+ $campo .= "";
+
+
+ }
+ }
+
+ }
+
+
+ if($div !="" ) {
+ if($opcion == "cantidad") {
+ $resultado = "
+
+ $esarchivo $cantidad archivos, $cantidad_imagenes imágenes jpg, $mapa georeferenciadas
+
+
";
+ }
+
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+ }else {
+
+
+
+ return " $campo $resultado"; }
+}
+$xajax->registerFunction("listar_archivos");
+
+
+
+// Convertir un string "1/123" a su representación float
+function exif_float($value) {
+ $pos = strpos($value, '/');
+ if ($pos === false) return (float) $value;
+ $a = (float) substr($value, 0, $pos);
+ $b = (float) substr($value, $pos+1);
+ return ($b == 0) ? ($a) : ($a / $b);
+}
+
+function leer_exif($file){
+ //$file = "/var/www/html/milfs/images/gps.jpg";
+ $exif = exif_read_data( "$file" );
+ $resultado['exif'] = $exif;
+ $resultado['file']= $file;
+ $resultado['FileName']=$exif['FileName'];
+
+if($exif === false) {
+//return false;
+}
+
+if ( !empty($exif['GPSLongitude']) && !empty($exif['GPSLatitude']) ) {
+ $d = (float) $exif['GPSLongitude'][0];
+ $m = exif_float($exif['GPSLongitude'][1] );
+ $s = exif_float( $exif['GPSLongitude'][2] );
+
+ $gps_longitude = (float)$d + $m/60 + $s/3600;
+ if ( $exif['GPSLongitudeRef'] == 'W')
+ $gps_longitude = -$gps_longitude;
+
+ $d = $exif['GPSLatitude'][0];
+ $m = exif_float($exif['GPSLatitude'][1] );
+ $s = exif_float( $exif['GPSLatitude'][2] );
+
+ $gps_latitude = (float)$d + $m/60 + $s/3600;
+ if ( $exif['GPSLatitudeRef'] == 'S')
+ $gps_latitude = -$gps_latitude;
+ if($gps_latitude !='') {
+ $resultado['lat'] = $gps_latitude;
+ $resultado['lon'] = $gps_longitude;
+
+ //$resultado = "$_SESSION[url]/mapa.php?lon=$gps_latitude&lat=$gps_longitude&zoom=18";
+ }else{}
+
+}
+
+
+ $resultado['DateTime'] = $exif['DateTimeOriginal'];
+ $resultado['estado'] = "oK";
+
+//$resultado = "$gps_longitude $gps_latitude";
+
+ return $resultado;
+}
+
+function relacion_render($form_id,$id_campo,$valor,$cantidad){
+
+
+
+
+
+$claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$claves = $claves[0];
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $limit = explode(':',$claves[2]) ;
+ $limit = $limit[1];
+if($valor !="") {
+$valor_actual = contenido_mostrar("$formulario",$valor,'','5');
+$link = "
Ver referencia ";
+}
+
+ return " $valor_actual $link";
+$div ="div_relacion_$name";
+
+$consulta = "SELECT contenido, control FROM form_datos WHERE form_id ='$formulario' and id_campo ='$key' GROUP BY control LIMIT $limit ";
+if($name =="") {
+//return "$valor_actual";
+}
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+
+
+if (mysqli_num_rows($sql)!='0'){
+$onchange = " xajax_contenido_mostrar('$formulario',(this.value),'$div','5')";
+$resultado="
+Seleccione
+ " ;
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+
+ if($row[control] == "$valor") {
+
+ $selected = "selected";
+ }else{ $selected = "";}
+ $resultado .= " $row[contenido] ";
+
+ }
+
+$resultado .= "
+
$valor_actual
";
+ }else{$resultado = "
No hay resultados $consulta
";}
+
+
+ return $resultado;
+
+}
+$xajax->registerFunction("relacion_render");
+
+function buscador_base($id_campo,$form_id,$valor,$name,$control,$tipo){
+$div ="div_buscador_base_$name";
+$onchange = " xajax_buscador_select_base('$id_campo','$form_id',(this.value),'$name','$control','$tipo'); document.getElementById('$name').value='';";
+$onclick = " xajax_buscador_select_base('$id_campo','$form_id','','$name','$control','$tipo'); document.getElementById('$name').value=''; (this).value='';";
+$resultado ="
+
+
+
";
+return $resultado;
+
+}
+$xajax->registerFunction("buscador_base");
+
+
+function buscador_select_base($id_campo,$form_id,$valor,$name,$control,$tipo){
+ $div ="div_buscador_base_$name";
+ $respuesta = new xajaxResponse('utf-8');
+ if($valor=="") {
+$resultado="";
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+ }
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$consulta=$claves;
+$claves = $claves[0];
+
+ $claves = explode(' ',$claves);
+ $tabla = explode(':',$claves[0]) ;
+ $tabla = $tabla[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $descripcion1 = explode(':',$claves[2]) ;
+ $descripcion1 = $descripcion1[1];
+ $descripcion2 = explode(':',$claves[3]) ;
+ $descripcion2 = $descripcion2[1];
+ $descripcion3 = explode(':',$claves[4]) ;
+ $descripcion3 = $descripcion3[1];
+
+if($valor !="") {
+//$valor_actual = contenido_mostrar("$formulario",$valor,'','5');
+}
+
+$consulta = "SELECT * FROM $tabla WHERE $descripcion1 like '$valor%%' GROUP BY $key limit 50 ";
+
+$sql=mysqli_query($consulta,$link);
+
+if (mysqli_num_rows($sql)!='0'){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+//$campo_descripcion= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$descripcion' ");
+//$campo_key= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$key' ");
+ if($row[control] == "$valor") {
+
+ $selected = "selected";
+ }else{ $selected = "";}
+ $resultado .= "
+ $row[$descripcion1] $row[$descripcion2] $row[$descripcion3] ";
+
+ }
+
+$resultado .= "
+
";
+ }else{$resultado = "
No hay resultados
";}
+
+
+
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+
+}
+$xajax->registerFunction("buscador_select_base");
+
+
+
+function buscador_campo($id_campo,$form_id,$valor,$name,$control,$tipo){
+$div ="div_buscador_$name";
+$onchange = " xajax_buscador_select('$id_campo','$form_id',(this.value),'$name','$control','$tipo'); document.getElementById('$name').value='';";
+$onclick = " xajax_buscador_select('$id_campo','$form_id','','$name','$control','$tipo'); document.getElementById('$name').value=''; (this).value='';";
+$resultado ="
+
+
+
";
+return $resultado;
+
+}
+$xajax->registerFunction("buscador_campo");
+
+
+function imprimir_buscador_campo($id_campo,$valor) {
+
+ $claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$consulta=$claves;
+$claves = $claves[0];
+
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $descripcion = explode(':',$claves[2]) ;
+ $descripcion = $descripcion[1];
+ $campo1 = remplacetas("form_datos","control","$valor","contenido","form_id = '$formulario' AND id_campo = '$key' ");
+ $campo2 = remplacetas("form_datos","control","$valor","contenido","form_id = '$formulario' AND id_campo = '$descripcion' ");
+ $imprimir ="$campo1[0] $campo2[0]";
+ return $imprimir ;
+}
+
+function imprimir_base($id_campo,$valor) {
+
+ $claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$consulta=$claves;
+$claves = $claves[0];
+
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $descripcion = explode(':',$claves[2]) ;
+ $descripcion = $descripcion[1];
+ $descripcion2 = explode(':',$claves[3]) ;
+ $descripcion2 = $descripcion2[1];
+ $campo1 = remplacetas("$formulario","$key","$valor","$descripcion","");
+ $campo2 = remplacetas("$formulario","$key","$valor","$descripcion2","");
+ $imprimir ="$campo1[0] $campo2[0]";
+ return $imprimir ;
+}
+
+function buscador_select($id_campo,$form_id,$valor,$name,$control,$tipo){
+ $div ="div_buscador_$name";
+ $respuesta = new xajaxResponse('utf-8');
+ if($valor=="") {
+$resultado="";
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+ }
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$consulta=$claves;
+$claves = $claves[0];
+
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $descripcion = explode(':',$claves[2]) ;
+ $descripcion = $descripcion[1];
+
+if($valor !="") {
+//$valor_actual = contenido_mostrar("$formulario",$valor,'','5');
+}
+
+$consulta = "SELECT contenido, control FROM form_datos WHERE form_id ='$formulario' and (id_campo ='$key' OR id_campo ='$descripcion' )AND contenido like '$valor%%' GROUP BY control limit 50 ";
+
+$sql=mysqli_query($consulta,$link);
+
+if (mysqli_num_rows($sql)!='0'){
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+$campo_descripcion= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$descripcion' ");
+$campo_key= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$key' ");
+ if($row[control] == "$valor") {
+
+ $selected = "selected";
+ }else{ $selected = "";}
+ $resultado .= "
+ $campo_key[0] $campo_descripcion[0] ";
+
+ }
+
+$resultado .= "
+
";
+ }else{$resultado = "
No hay resultados
";}
+
+
+
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+
+}
+$xajax->registerFunction("buscador_select");
+
+
+
+function relacion_select($id_campo,$form_id,$valor,$name,$control,$tipo){
+$link=Conectarse();
+$valor_actual ="";
+mysqli_query("SET NAMES 'utf8'");
+
+$claves = remplacetas("form_campos_valores","id_form_campo","$id_campo","campo_valor","");
+$claves = $claves[0];
+ $claves = explode(' ',$claves);
+ $formulario = explode(':',$claves[0]) ;
+ $formulario = $formulario[1];
+ $key = explode(':',$claves[1]) ;
+ $key = $key[1];
+ $limit = explode(':',$claves[2]) ;
+ $limit = $limit[1];
+ if($limit =="" ) {$limit = 20;}
+if($valor !="") {
+$valor_actual = contenido_mostrar("$formulario",$valor,'','5');
+}
+
+$div ="div_relacion_$name";
+
+$consulta = "SELECT contenido, control FROM form_datos WHERE form_id ='$formulario' and id_campo ='$key' GROUP BY control LIMIT $limit ";
+if($name =="") {
+//return "$valor_actual";
+}
+$sql=mysqli_query($consulta,$link);
+
+
+if (mysqli_num_rows($sql)!='0'){
+$onchange = " xajax_contenido_mostrar('$formulario',(this.value),'$div','5')";
+$resultado="
+Seleccione
+ " ;
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+
+ if($row['control'] == "$valor") {
+
+ $selected = "selected";
+ }else{ $selected = "";}
+ $resultado .= " $row[contenido] ";
+
+ }
+
+$resultado .= "
+
$valor_actual
";
+ }else{$resultado = "
No hay resultados $consulta
";}
+
+
+ return $resultado;
+
+}
+$xajax->registerFunction("relacion_select");
+
+function combo_select($id_campo,$form_id,$valor,$name,$control,$control_combo){
+ $selected="";
+ $and="";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+if($control_combo !="") {
+ $div ="combo_$name";
+$and ="AND campo_valor LIKE '$control_combo:%%'";
+}else{
+$onchange ="xajax_combo_select('$id_campo','$valor','$valor','$name','$control',(this.value)) ";
+$div ="combo_$name";
+$name ="primario_$name";
+}
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' $and ";
+$sql=mysqli_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysqli_num_rows($sql)!='0'){
+
+$resultado=" $valor
+Seleccione
+ " ;
+ // $resultado = array_unique($entrada);
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $campos = explode(':',$row['campo_valor']);
+
+ IF($control_combo ==""){
+ $campo_primario[]=$campos[0];
+ $campo_primario = array_unique($campo_primario);
+ }
+ else {
+ $campo_primario[] = "$campos[0] $campos[1]";
+ }
+ //$identificador = $identificador[0];
+//if($row[campo_valor] ==="$valor"){$selected="selected";}else{$selected ="";}
+//$resultado .= " $campos[0] ";
+ }
+
+foreach($campo_primario as $C=>$V){
+$resultado .= "$V ";
+}
+$resultado .= "
+
";
+ }else{$resultado = "
No hay resultados
";}
+if($control_combo =='') {
+ return $resultado;
+ }
+else{
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado");
+ return $respuesta;
+}
+}
+$xajax->registerFunction("combo_select");
+
+
+function aplicacion_carrusel($nombre,$id,$plantilla){
+ if($id =='') {
+ $id = remplacetas('form_id','nombre',$nombre,'id',"") ;
+ $id = $id[0];
+ }
+ if($nombre =='') {
+ $nombre = remplacetas('form_id','id',$id,'nombre',"") ;
+ $nombre = $nombre[0];
+ }
+ $descripcion = remplacetas('form_id','id',$id,'descripcion',"") ;
+ $descripcion = $descripcion[0];
+
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+ if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+ $campo_titulo = $campo_titulo[0];
+ $consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+ $link=Conectarse();
+ $sql=mysqli_query($consulta,$link);
+ if (mysqli_num_rows($sql)!='0'){
+ $control = mysqli_result($sql,0,control);
+ $nombre = remplacetas('form_id','id',$id,'nombre',"") ;
+ $descripcion = remplacetas('form_id','id',$id,'descripcion',"") ;
+
+ mysqli_data_seek($sql, 0);
+// $contenido = "
$nombre[0] ";
+// $contenido .= "
$descripcion[0] ";
+
+ $orden = 0;
+while( $row = mysqli_fetch_array( $sql ) ) {
+
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ if($orden === 0) {$activo = "active";}else{$activo="";}
+ $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+ $campo = buscar_campo_tipo($id,"15");
+ $id_campo = $campo[0];
+ $imagen = remplacetas('form_datos','control',$row[control],'contenido',"id_campo = '$id_campo'") ;
+ $items .= "
+
+
+ $contenido_desplegado
+
+
";
+ $indicador .= "
";
+ $titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ //$contenido .= "$contenido_desplegado ";
+ $orden = ($orden +1 );
+ }
+$contenido .= "
+
+
+
$nombre[0] $descripcion[0]
+
+
+
+ ";
+ //$contenido = " $links
";
+ }
+
+
+return $contenido;
+}
+
+
+function formulario_embebido($id){
+ //$impresion = formulario_modal("$id",$form_respuesta,$control,"embebido");
+ //($perfil,$tipo,$form_respuesta,$control_respuesta)
+
+ $impresion = formulario_areas($id,"embebido",'','');
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre','') ;
+ $formulario_descripcion = remplacetas('form_id','id',$id,'descripcion','') ;
+ $visitas= contar_visitas($id,'formulario') ;
+ $muestra_form = "
+
+
+
+
$visitas
+
+ $impresion
+
+
+
+
+
+
+
";
+ return $muestra_form ;
+}
+
+
+function formulario_embebido_ajax($id,$opciones,$tipo){
+ //$impresion = formulario_modal("$id",$form_respuesta,$control,"embebido");
+ //($perfil,$tipo,$form_respuesta,$control_respuesta)
+ $respuesta = new xajaxResponse('utf-8');
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa',"") ;
+ if(isset($_SESSION['permiso_identificador'])) {
+ $permiso_identificador = $_SESSION['permiso_identificador'] ;
+ $salir= "$permiso_identificador
Salir
";
+ }
+ else{ $permiso_identificador = ""; $salir="";}
+
+
+
+ if($tipo =='edit' AND $_SESSION['id_empresa'] !== $id_empresa[0] AND $permiso_identificador != $opciones) {
+ $password = buscar_campo_tipo($id,"18");
+
+ $aviso = "
ATENCIÓNNo está autorizado ";
+ $seguridad ="
+
+
+ ";
+ $resultado ="
+
+ $salir
+ $aviso
+ $seguridad
+
+ ";
+ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+ $respuesta->addAssign("muestra_form","innerHTML","$resultado");
+ $pie = empresa_datos("$id_empresa",'pie');
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+ }
+
+ if($tipo=="respuesta") { $form_respuesta = "respuesta";}
+ $impresion = formulario_areas("$id","$tipo","$form_respuesta","$opciones");
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre','') ;
+ $formulario_descripcion = remplacetas('form_id','id',$id,'descripcion','') ;
+ $visitas= contar_visitas($id,'formulario') ;
+ $muestra_form = "
+
+
+
$visitas
+
+ $impresion
+
+
+ ";
+ // return $muestra_form ;
+
+ //$respuesta->addAssign("$div","innerHTML","$resultado");
+ //$div_contenido = "
$div
";
+ $respuesta->addAssign("muestra_form","innerHTML","$muestra_form");
+ //$respuesta->addAssign("titulo_modal","innerHTML","Hola mundo");
+ //$respuesta->addAssign("pie_modal","innerHTML","$pie");
+ //$respuesta->addAssign("$div","innerHTML","$resultado");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+
+}
+$xajax->registerFunction("formulario_embebido_ajax");
+
+function formulario_embebido_campos($id,$opcion){
+ $impresion = formulario_modal("$id",$form_respuesta,$control,"$opcion");
+
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre') ;
+ $formulario_descripcion = remplacetas('form_id','id',$id,'descripcion') ;
+
+ $muestra_form = "
+
+
+
$formulario_descripcion[0]
+ $impresion
+
+
+
";
+ return $muestra_form ;
+}
+
+function json($datos){
+if ( !isset ( $_SESSION['id_empresa'] ) ) { $publico = "AND
+form_id.publico = '1' "; $w_publico = "WHERE form_id.publico = '1'
+"; }
+else { $publico = "AND form_id.id_empresa = '$_SESSION[id_empresa]'
+"; $w_publico = "WHERE form_id.id_empresa = '$_SESSION[id_empresa]' ";
+}
+$datos = mysql_seguridad($datos);
+$link=Conectarse();
+mysqli_query("SET NAMES 'UTF8'");
+if($datos[id] !=''){
+if($datos[tipo] =='simple') {
+$campos ="control " ;
+$consulta = "SELECT $campos
+FROM `form_datos` , `form_campos` ,form_id
+WHERE form_datos.id_campo = `form_campos`.id
+AND form_datos.form_id = `form_id`.id
+AND (form_id = '$datos[id]' )
+$publico
+GROUP BY form_datos.control
+ORDER BY form_datos.timestamp DESC";
+
+$sql = mysqli_query($consulta,$link) or die("error al ejecutar consulta ");
+ if (mysqli_num_rows($sql)!='0'){
+$i = 1;
+$features = array();
+// $features[] = $consulta;
+while($row = mysqli_fetch_array( $sql ))
+ {
+ if($datos[tipo]=="simple"){
+ $contenido = remplacetas('form_datos','id',$row[id_dato],'contenido',"") ;
+ $id_campo = remplacetas('form_datos','id',$row[id_dato],'id_campo',"") ;
+ $nombre_campo =
+remplacetas('form_campos','id',$id_campo[0],'campo_nombre',"") ;
+ $nuevos_datos = $datos;
+ $nuevos_datos[identificador]="$row[control]";
+ $nuevos_datos[tipo]="array";
+ //$features[$row[control]] = datos_array($row[control]) ;
+//json($nuevos_datos);//" $contenido[0]";//$row[id_campo];
+ $features[] = datos_array($row[control]) ;
+//json($nuevos_datos);//" $contenido[0]";//$row[id_campo];
+ }
+ else {
+ $features[] = $row;
+ }
+
+
+ $i++;
+ }
+
+
+
+}
+
+
+if($tipo == "array" ) {
+$resultado = $features;
+}else {
+
+$resultado = json_encode($features,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT);
+}
+return $resultado;
+
+}
+else {
+$campos ="form_datos.id as id_dato, form_datos.form_id AS
+id_formulario, nombre as formulario, campo_nombre, form_campos.id AS
+id_campo , contenido ,timestamp, control as identificador ,
+form_datos.orden" ;
+$consulta = "SELECT $campos
+FROM `form_datos` , `form_campos` ,form_id
+WHERE form_datos.id_campo = `form_campos`.id
+AND form_datos.form_id = `form_id`.id
+AND (form_id = '$datos[id]' )
+$publico
+ORDER BY form_datos.control ,form_datos.timestamp ";
+}
+
+}
+elseif($datos[identificador] !=''){
+if($datos[tipo] =='simple') {$campos ="form_campos.id as id_campo,
+form_datos.id as id_dato " ;}
+else {$campos ="form_datos.id as id_dato, form_datos.form_id AS
+id_formulario, nombre as formulario, campo_nombre, form_campos.id AS
+id_campo ,contenido ,timestamp, control as identificador ,
+form_datos.orden" ;}
+$consulta = "SELECT $campos
+FROM `form_datos` , `form_campos` ,form_id
+WHERE form_datos.id_campo = `form_campos`.id
+AND form_datos.form_id = `form_id`.id
+AND (control = '$datos[identificador]' )
+$publico
+";
+}
+elseif($datos[dato] !=''){
+if($datos[tipo] =='simple') {$campos ="form_campos.id as id_campo,
+form_datos.id as id_dato " ;}
+else {$campos ="form_datos.id as id_dato, form_datos.form_id AS
+id_formulario, nombre as formulario, nombre as formulario,
+campo_nombre, form_campos.id AS id_campo ,contenido ,timestamp,
+control as identificador, form_datos.orden" ;}
+$consulta = "SELECT $campos
+FROM `form_datos` , `form_campos` ,form_id
+WHERE form_datos.id_campo = `form_campos`.id
+AND form_datos.form_id = `form_id`.id
+AND (form_datos.id = '$datos[dato]' )
+$publico
+";
+}
+else {
+$consulta = "SELECT id as form_id, nombre as form_nombre, descripcion
+as form_descripcion , creacion , publico AS contenido_publico ,
+modificable AS formulario_publico
+FROM form_id $w_publico";
+}
+
+
+$sql = mysqli_query($consulta,$link) or die("error al ejecutar consulta ");
+ if (mysqli_num_rows($sql)!='0'){
+$i = 1;
+$features = array();
+// $features[] = $consulta;
+while($row = mysqli_fetch_array( $sql ))
+ {
+ if($datos[tipo]=="simple"){
+ $contenido = remplacetas('form_datos','id',$row[id_dato],'contenido',"") ;
+ $id_campo = remplacetas('form_datos','id',$row[id_dato],'id_campo',"") ;
+ $nombre_campo =
+remplacetas('form_campos','id',$id_campo[0],'campo_nombre',"") ;
+ $features[] = "$nombre_campo[0] : $contenido[0]";//$row[id_campo];
+ }
+ else {
+ $features[] = $row;
+ }
+
+
+ $i++;
+ }
+
+
+
+}
+
+if($datos[tipo] == "array" ) {
+$resultado = $features;
+}else {
+
+$resultado = json_encode($features,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT);
+}
+
+return $resultado;
+}
+
+
+
+
+function imprime_geojson($id,$id2,$plantilla){
+ $id_form = mysql_seguridad($id);
+ $id_form2 = mysql_seguridad($id2);
+ $campo = buscar_campo_tipo($id_form,"14");
+ $campo2 = buscar_campo_tipo($id_form2,"14");
+ $id_campo = $campo[0];
+ $id_campo2 = $campo2[0];
+ if($id_form2 !=""){$w_id2 =" OR form_id = '$id_form2'"; $or_2 ="or id_campo = '$id_campo2'";}
+
+$link=Conectarse();
+
+ $consulta = "SELECT form_id as id, control, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data
+FROM `form_datos`
+WHERE (form_id = '$id_form' $w_id2 )
+AND ( id_campo ='$id_campo' $or_2 )
+group by control
+ORDER BY orden desc";
+//return $consulta;
+
+ mysqli_query("SET NAMES 'UTF8'");
+ $sql = mysqli_query($consulta,$link) or die("error al ejecutar consulta ");
+ if (mysqli_num_rows($sql)!='0'){
+ $id = 1;
+ $features = array();
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $marcador = array();
+ $propiedades = array();
+ $identificador = explode(',',$row[data]);
+ $identificador = $identificador[0];
+ $campos = explode(" ",$identificador);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+ $formulario = formulario_imprimir($row[id],$row[control],"$plantilla");
+
+ $marcador["type"] = "Point";
+ $marcador["coordinates"] = array($lat,$lon);
+ $propiedades = formulario_imprimir_linea($row[id],$row[control],"array");//
+ //$propiedades[description] ="HOLA MUNDO";
+ $propiedades[description] ="
$formulario
";
+ $propiedades[sounds] ="";
+ $propiedades[url] ='';
+ $propiedades[icon][iconSize] =[60,60];
+ //$propiedades[icon][shadowSize] =[70,70];
+ //$propiedades[icon][shadowUrl] = "https://raw.githubusercontent.com/humano/milfs/master/milfs/images/iconos/negro.png";
+
+ //$propiedades[title] ='Hola mundo';
+ if($propiedades[icon][iconUrl] =="") {
+ $propiedades[icon][iconUrl] = "$_SESSION[site]/milfs/images/iconos/negro.png";
+ }
+ $geometria .= "{\"type\":\"Feature\",\"geometry\":".json_encode($marcador,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT).",\"properties\":".json_encode($propiedades,JSON_NUMERIC_CHECK|JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT)."},";
+ $features[] = $marcador;
+
+ $id++;
+ }
+
+}
+//-75.58295 6.25578 16
+
+//encode and output jsonObject
+header('Content-Type: text/plain');
+//echo $consulta;
+$resultado = " { \"type\": \"FeatureCollection\",
+ \"features\": ";
+$resultado .= json_encode($features,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT);
+$resultado .= "}";
+//echo $resultado;
+$geometria = substr("$geometria",0,-1);
+$geometria = "{
+ \"type\": \"FeatureCollection\",
+ \"features\": [$geometria ]}";
+return $geometria;
+}
+
+
+function aplicacion_presentacion($id,$div,$timeout){
+ if($timeout < '1000') {$timeout =5000;};
+ $respuesta = new xajaxResponse('utf-8');
+$consulta ="SELECT * FROM form_datos WHERE form_id = '$id' ORDER BY rand() limit 1 ";
+$link=Conectarse();
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+$control = mysqli_result($sql,0,control);
+$impresion = formulario_imprimir("$id","$control","");
+
+ }
+$siguiente = "
SIGUIENTE ";
+if($div ==''){
+ $presentacion = "
$siguiente $impresion
";
+ }else{
+ //$respuesta->addAlert("$consulta");
+ $respuesta->addScript("setTimeout(function(){xajax_aplicacion_presentacion('$id','presentacion_$id','$timeout')},$timeout)");
+ $respuesta->addAssign("$div","innerHTML","$siguiente $impresion");
+ return $respuesta;
+ }
+return " $presentacion";
+
+
+}
+$xajax->registerFunction("aplicacion_presentacion");
+
+function aplicaciones_listado($id_form,$tipo,$div){
+
+// if($id_empresa !=''){ $_empresa = " ";}
+ //if($tipo =='publico'){ $w_publico =" publico ='0'";}else {$w_publico =" publico ='1'";}
+ if($id_form !="") {$w_form = " AND id = '$id_form'";}
+ $w_publico =" publico ='1'";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$consulta = "SELECT * FROM form_id WHERE $w_publico $w_form ORDER BY orden asc ";
+mysqli_real_escape_string($link,$consulta);
+$sql=mysqli_query($consulta,$link);
+
+
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
+ $resultado_li .= "
";
+ }else {$resultado_li = "";}
+
+if($tipo =='li') { return $resultado_li.$resultado;}
+elseif($tipo =='nav') { return $resultado_nav;}
+elseif($tipo =='grid') {
+if($div !="") {
+ $respuesta = new xajaxResponse('utf-8');
+ $respuesta->addAssign("$div","innerHTML","$resultado_grid");
+ return $respuesta;
+ }else{
+ return $resultado_grid;
+ }
+}
+elseif($tipo =='banner') { return $resultado_banner;}
+elseif($tipo =='carrusel') { return $resultado_carrusel;}
+else {return $resultado;}
+}
+$xajax->registerFunction("aplicaciones_listado");
+
+
+function contenido_aplicacion($id,$plantilla){
+$div = "contenedor";
+ $respuesta = new xajaxResponse('utf-8');
+
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+$campo_titulo = $campo_titulo[0];
+$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+
+$link=Conectarse();
+$sql=mysqli_query($consulta,$link);
+
+if (mysqli_num_rows($sql)!='0'){
+
+ $control = mysqli_result($sql,0,"control");
+ $nombre = remplacetas('form_id','id',$id,'nombre',"") ;
+ $descripcion = remplacetas('form_id','id',$id,'descripcion',"") ;
+
+ mysqli_data_seek($sql, 0);
+
+ //$contenido = "
$nombre[0] ";
+ $contenido = "
$descripcion[0] ";
+
+ $orden = 0;
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+ //return "$row[form_id] $row[control] $plantilla";
+ $titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $contenido .= "$contenido_desplegado
";
+ }
+ $contenido = " $links
";
+ }
+
+ return $contenido;
+
+}
+
+function contenido_aplicacion_nombre($nombre,$plantilla){
+ $id = remplacetas('form_id','nombre',$nombre,'id',"") ;
+ $id = $id[0];
+ if($id[0] =="") {$aviso = "
No se ha definido una aplicación con el nombre $nombre ";
+ return $aviso;}
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+$campo_titulo = $campo_titulo[0];
+$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+$link=Conectarse();
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+ $control = mysqli_result($sql,0,control);
+
+ mysqli_data_seek($sql, 0);
+ $contenido = " ";
+ $orden = 0;
+while( $row = mysqli_fetch_array( $sql ) ) {
+
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+ $titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $contenido .= "$contenido_desplegado ";
+ }
+ $contenido = " $links
";
+ }
+
+ return $contenido;
+
+}
+
+
+
+function contenido_parallax($id){
+$div = "contenedor";
+ $respuesta = new xajaxResponse('utf-8');
+
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+$campo_titulo = $campo_titulo[0];
+$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+$link=Conectarse();
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+ $control = mysqli_result($sql,0,control);
+ $contenido = "";
+ mysqli_data_seek($sql, 0);
+
+ $orden = 0;
+while( $row = mysqli_fetch_array( $sql ) ) {
+ //$orden = $orden+500;
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'','contenido');
+
+ $titulo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $nav_li .="
+
+ ";
+ $style .=" a[id= '$row[control]']:target ~ #main_$id article.article
+ {
+ -webkit-transform: translateY(-$orden"."px);
+ transform: translateY( -$orden"."px );
+ } ";
+ $links .= "
";
+ $contenido .= "
+
+ $contenido_desplegado
+
+ ";
+ $orden = $orden +800;
+ }
+ $contenido = "
+
+
+ $links
+
+
+
+
+ ";
+ }
+
+//return " $contenido";
+ $respuesta->addAssign("$div","innerHTML","$contenido");
+ return $respuesta;
+
+}
+$xajax->registerFunction("contenido_parallax");
+
+function contenido_timeline($id){
+$div = "contenedor";
+ $descripcion = remplacetas('form_id','id',$id,'descripcion') ;
+ $nombre = remplacetas('form_id','id',$id,'nombre') ;
+ $respuesta = new xajaxResponse('utf-8');
+
+ $campo_titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+if($campo_titulo[0] !='') {$w_campo = "AND id_campo = '$campo_titulo[0]'";}
+$campo_titulo = $campo_titulo[0];
+$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
+$link=Conectarse();
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+ $control = mysqli_result($sql,0,control);
+ //$contenido = "
+
+
+ $parametrizacion
+
+
+ $subir_imagen
+
+
+ ";
+
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+
+}
+
+return $respuesta;
+}
+$xajax->registerFunction("configuracion");
+
+
+function cambiar_imagen($imagen,$tabla,$id) {
+ $respuesta = new xajaxResponse('utf-8');
+$link = Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$consulta = "UPDATE $tabla SET `imagen` = '".$imagen."' WHERE `id` = '$id';";
+ $sql_consulta=mysqli_query($consulta,$link);
+ if($sql_consulta) {
+if($tabla =='empresa') {
+ $respuesta->addAssign("banner","style.backgroundImage","url('images/secure/?file=600/$imagen')");
+ $respuesta->addAssign("formUpload","innerHTML","");
+}
+
+ //$respuesta->addAlert("$consulta");
+return $respuesta;
+}
+}
+$xajax->registerFunction("cambiar_imagen");
+
+
+
+
+function limpiar_caracteres($valor){
+$b=array("{","}","]","[",";","¡","!","¿","?","'",'"' );
+$c=array(" "," "," "," "," "," "," "," ","'"," ");
+$resultado=str_replace($b,$c,$valor);
+return $resultado ;
+}
+
+function actualizar_campo($tabla,$key,$campo,$valor,$accion,$div) {
+ $valor = limpiar_caracteres($valor);
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' $accion limit 1; ";
+ $sql=mysqli_query($edit,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ $respuesta->addAssign($div,"innerHTML",$valor);
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("actualizar_campo");
+
+
+function eliminar_campo($tabla,$key,$div) {
+ $key = limpiar_caracteres($key);
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $borrar = "DELETE FROM $tabla WHERE id = '$key' limit 1";
+// $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' limit 1; ";
+ $sql=mysqli_query($borrar,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ $respuesta->addAssign($div,"innerHTML","");
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("eliminar_campo");
+
+
+function insertar_campo($tabla,$formulario,$div) {
+ //$valores ="$formulario[0]";
+ $nombre = $formulario['nombre'];
+ foreach($formulario as $c=>$v){
+
+ $valores .= " $c = '$v',";
+ }
+ $valores = "$valores id_empresa = '$_SESSION[id_empresa]'";
+ $key = limpiar_caracteres($key);
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $insertar = "INSERT INTO $tabla set $valores";
+// $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' limit 1; ";
+ $sql=mysqli_query($insertar,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ //$respuesta->addAssign($div,"innerHTML","");
+
+ }
+ //$respuesta->addAlert("$insertar");
+//$areas = tabla_areas('form_areas','id','nombre,descripcion,estado,orden','',"",'Areas','');
+// $respuesta->addScript("javascript:xajax_tabla_areas('form_areas','id','nombre,descripcion,estado,orden','','','Areas','div_campos')");
+ $respuesta->addAssign("$div","innerHTML","
El registro se insertó con éxito
");
+ return $respuesta;
+}
+$xajax->registerFunction("insertar_campo");
+
+function insertar_campo_area($tabla,$formulario,$div) {
+ //$valores ="$formulario[0]";
+ $nombre = $formulario['nombre'];
+ foreach($formulario as $c=>$v){
+
+ $valores .= " $c = '$v',";
+ }
+ $valores = "$valores id_empresa = '$_SESSION[id_empresa]'";
+ $key = limpiar_caracteres($key);
+$respuesta = new xajaxResponse('utf-8');
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $insertar = "INSERT INTO $tabla set $valores";
+// $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' limit 1; ";
+ $sql=mysqli_query($insertar,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+if($div !='') {
+ //$respuesta->addAssign($div,"innerHTML","");
+
+ }
+ //$respuesta->addAlert("$insertar");
+//$areas = tabla_areas('form_areas','id','nombre,descripcion,estado,orden','',"",'Areas','');
+ $respuesta->addScript("javascript:xajax_tabla_areas('form_areas','id','nombre,descripcion,estado,orden','','','Areas','div_campos')");
+ //$respuesta->addAssign("contenido","innerHTML","$insertar");
+ return $respuesta;
+}
+$xajax->registerFunction("insertar_campo_area");
+
+
+function editar_campo($tabla,$key,$campo,$valor,$accion,$div,$indice){
+ $indice=$indice;
+ if ( !isset ( $_SESSION['id'] ) ) { return;}
+ if($indice =="") {$id = "id";}
+ else {$id = "$indice";}
+ ////NO SE PUEDE EDITAR EL CAMPO (id )
+
+//
+if(@$div=='') {$div = "div_$tabla".$campo;}
+else {$div = $div;}
+ $respuesta = new xajaxResponse('utf-8');
+ $valor = limpiar_caracteres($valor);
+
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $consulta = "SELECT $id , $campo AS valor FROM $tabla WHERE $id = '$key' LIMIT 1";
+ $sql_consulta=mysqli_query($consulta,$link);
+ $Valor = mysqli_result($sql_consulta,0,"valor");
+
+
+if(@$accion == 'cerrar') {
+ $campo = editar_campo("$tabla","$key","$campo","$valor","","","$indice");
+$respuesta->addAssign($div,"innerHTML",$campo);
+return $respuesta;
+ }
+elseif($accion=="input") {
+ $size= strlen($Valor);
+ $placeholder = strtoupper(limpiar_caracteres($campo));
+ $rrn = $div;
+if($size < 40) {
+
+ $resultado = "
+
+ ";
+ }else {
+ $resultado = "
+
+ ";
+ }
+ }
+elseif($accion== "grabar"){
+
+ $edit = "UPDATE $tabla SET $campo = '$valor' WHERE $id = '$key' limit 1; ";
+ $sql=mysqli_query($edit,$link);
+ if(mysql_affected_rows($link) != 0){
+
+ }
+ $campo = editar_campo("$tabla","$key","$campo","$valor","","","$indice");
+ $respuesta->addAssign($div,"innerHTML",$campo);
+ return $respuesta;
+
+
+ }
+
+else{
+ if (mysqli_num_rows($sql_consulta)!='0'){
+ $valor=mysqli_result($sql_consulta,0,"valor");
+
+ /////// campos que no se muestran ///
+if($campo == 'id' OR $campo == 'id_usuario' OR $campo == 'id_grupo') {
+return ;
+}
+
+ /////////// campos que se muestran para edicion //////////////
+ $title = strtoupper(limpiar_caracteres($campo));
+ $div= rand(123,999);
+ if($valor =="") {$aviso="
$title ";}else{$aviso ="";}
+$campo ="
+
+
+
+ ";
+ }
+ else {$campo = "";}
+
+ return $campo;
+}
+
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+
+}
+
+$xajax->registerFunction("editar_campo");
+
+
+function formulario_imprimir($id,$control,$tipo) {
+$resultado ="";
+$limit ="";
+//if ($timestamp != ""){$where_timestamp = "AND form_datos.timestamp = '$timestamp' ";}ELSE { $where_timestamp = ""; }
+if(is_numeric($tipo)) { $limit = "limit $tipo "; $class= "alert alert-info";}
+//if($control != "") { $w_control = "AND control = '$control' ";}
+ $id = mysql_seguridad($id);
+ $control = mysql_seguridad($control);
+ if($id =="") {
+ $id_seguridad = remplacetas('form_datos','control',$control,'form_id','') ;
+ $publico = remplacetas('form_id','id',$id_seguridad[0],'publico','') ;
+ }else{
+ $publico = remplacetas('form_id','id',$id,'publico','') ;
+ }
+
+ if($publico[0] != "1" and (!isset ( $_SESSION['id']) )) {
+ $resultado ="
Acceso restringido Esta aplicación contiene datos privados ( $_SESSION[id] )";
+ return $resultado;
+
+ }
+
+ //if($id !='') {$w_id = "AND form_id = '$id'";}else {$w_id='';}
+ if($id !='') {
+ $consulta = "SELECT *
+ FROM form_contenido_campos , form_datos
+ WHERE form_contenido_campos.id_campo = form_datos.id_campo
+ AND form_datos.control = '$control'
+ AND form_contenido_campos.id_form = '$id'
+ $where_timestamp
+ ORDER BY form_contenido_campos.orden ASC $limit
+ ";
+ }else {
+ $consulta = "SELECT * FROM form_datos WHERE control = '$control' $where_timestamp GROUP BY id_campo" ;
+ }
+ $control = mysql_seguridad($control);
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if($id !='') {$id = $id;}else {$id=mysqli_result($sql,0,"form_id");}
+
+
+
+ $categoria_campo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'categoria:campo'") ;
+ $categoria_campo = $categoria_campo[0];
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa','') ;
+
+
+
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
+
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ @$multiple =$row['multiple'];
+ $campo_tipo = remplacetas('form_campos','id',$row['id_campo'],'campo_tipo','');
+ $campo_tipo =$campo_tipo[0];
+ $contenido = formulario_valor_campo("$id","$row[id_campo]","","$control",'');
+ $contenido_array = $contenido;
+ // $contenido = formulario_valor_campo("$id","$row[id_campo]","","$control");
+ $md5_contenido = $contenido[4];
+ $contenido_original = $contenido[3];
+ $contenido = $contenido[3];
+
+
+
+
+ if($campo_tipo =='15' AND $tipo==""){if($contenido !=""){
+ $contenido = "
+
Mostrar
+ "; }else{$contenido="";}}
+ elseif($campo_tipo=='14'){
+ if($contenido !='') {
+ $campos = explode(" ",$contenido);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+ @include("includes/datos.php");
+ $error_token ="";
+ if(!isset($mapbox_token)) { include("milfs/includes/datos.php"); if(!isset($mapbox_token)) {$error_token = 1; }}
+ if($error_token != 1) {
+ $url_pin = urlencode("$_SESSION[site]milfs/images/iconos/negro.png");
+ $contenido = "
+
+
+ "; }else{ $contenido ="
No se ha definido un token de mapbox
";}
+ }
+ }
+ elseif($campo_tipo=='4'){ $contenido = "
$contenido ";}
+ elseif($campo_tipo=='18'){ $contenido = "";}
+ elseif($campo_tipo=='23'){
+ $funcion = remplacetas("form_campos_valores","id_form_campo","$row[id_campo]","campo_valor","");
+ eval("\$contenido = ".$funcion[0].";");
+ $contenido .= "";
+
+ }
+ elseif($campo_tipo=='6'){
+ $contenido = imprimir_buscador_campo($row['id_campo'],$contenido);
+ }
+ elseif($campo_tipo=='21'){
+ $contenido = imprimir_base($row['id_campo'],$contenido);
+ }
+ elseif($campo_tipo=='10'){
+ $valor_actual = relacion_render("$id","$row[id_campo]",$contenido,'5');
+ $contenido = "$valor_actual";}
+ elseif($campo_tipo=='5' AND $contenido !=""){
+ if($tipo =="") {
+ $contenido = trim($contenido); $contenido = "
+
+
+
+ ";
+ }else {
+ $contenido =$contenido;
+ }
+ }
+
+ else {
+ $html ="$contenido";
+ $contenido = nl2br($html);
+ $contenido = Markdown($contenido);
+ }
+ $campo_nombre = remplacetas('form_campos','id',$row['id_campo'],'campo_nombre','');
+ $nombre[$row['id_campo']] = $campo_nombre[0] ;
+////buscar campo imagen
+$campo_imagen = buscar_campo_tipo($id,"15");
+//$campo_imagen_nombre = $campo_imagen[1];
+$campo_imagen = $campo_imagen[0];
+////
+ if($row['id_campo'] == $campo_imagen AND $tipo !="" ){ $contenido = strip_tags($contenido); }
+ $campo[$row['id_campo']]=$contenido;
+ $campo_400[$row['id_campo']] = substr($contenido,0, $length = 400)."... ";//$contenido;
+ $campo_80[$row['id_campo']] = substr($contenido,0, $length = 80);//$contenido;
+ $campo_55[$row['id_campo']] = substr($contenido,0, $length = 55);//$contenido;
+ $campo_limpio[$row['id_campo']] = $contenido = strip_tags($contenido);
+ $fecha = date ( "Y-m-d h:i:s" , $row['timestamp'] );
+
+ $campo["md5_".$row['id_campo']]=$md5_contenido;
+
+ if($row['id_campo'] == $categoria_campo){
+
+
+ $categoria_filtro = remplacetas('form_parametrizacion','campo',$id,'descripcion',"tabla='form_id' and opcion = 'categoria:filtro:$row[id_campo]'") ;
+ $filtro = $categoria_filtro;
+ $categoria_filtro = $categoria_filtro[0];
+ $icono = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'categoria:icon:$md5_contenido'") ;
+ if($icono[0] =='') {
+ //$icon = "http://$_SERVER[HTTP_HOST]/milfs/images/pin.png";
+ $url_pin = urlencode("$_SESSION[site]milfs/images/iconos/negro.png");
+ $icon = "$_SESSION[site]milfs/images/iconos/negro.png";
+ }else{
+
+ $icon = $icono[0];
+ }
+ $icono = "$icon";
+ //$array[icon][iconSize] =[50,50];
+
+ }else{}
+
+if($contenido_original !="") {
+ //// si el campo es tipo password (18) no se muestra
+ if($campo_tipo !='18'){
+ if($tipo == "metadatos"){
+ $metadatos = " ".date('Y-m-d H:i:s',$contenido_array[1])." id $contenido_array[0] proceso $contenido_array[5] usuario $contenido_array[6] ip ".long2ip($contenido_array[7])." campo $row[id_campo] ";
+ }else {$metadatos='';}
+ $resultado .= "
+
+
+ $campo_nombre[0] $metadatos
+ $contenido
+ ";
+}
+}
+ }
+
+ //$resultado .="
";
+//}else {$resultado ="
No se encontraron resultados "; return $resultado;}
+//if($id=="6" OR $id=="10") {
+ $plantilla="";
+ $class="";
+ if($tipo !="" AND (!is_numeric($tipo)) AND $tipo !="metadatos" ) {
+////Usa una plantilla apra cada id
+
+$plantilla = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'plantilla:$tipo'") ;
+$plantilla = $plantilla[0];
+if($plantilla =="") {
+///Usa una plantilla generica por nombre
+$plantilla = remplacetas('form_parametrizacion','opcion',"plantilla:$tipo",'descripcion',"campo = ''") ;
+$plantilla = $plantilla[0];
+//$plantilla = remplacetas('parametrizacion','opcion',"plantilla:$tipo",'descripcion',"campo = '$id' ") ;
+}
+if($plantilla !='') { $plantilla = html_entity_decode ( $plantilla );}
+/*else {
+$plantilla = remplacetas('parametrizacion','opcion',"plantilla:$tipo",'descripcion',"") ;
+$plantilla= $plantilla[0];
+ }
+ */
+ }
+if($plantilla != ""){
+eval("\$plantilla = \"$plantilla \";");
+ $full =" $plantilla ";
+ }else {
+ $full= "
$resultado
";
+ }
+
+ $resultado ="$full";
+ return $resultado;
+
+// }else {$resultado ="
No se encontraron resultados "; return $resultado;}
+ }else {$resultado =""; return $resultado;}
+}
+
+
+function subir_imagen($respuesta,$id){
+$resultado ="";
+///vinculado con la funcion de javascript resultadoUpload(estado, file) que esta en librerias/scripts.js
+//this.form.taget= 'ventana'; this.form.action = 'destinoEspecial.html'; this.form.submit()"
+$javascript="$_SESSION[url]/includes/upload.php";
+$campo_mapa = buscar_campo_tipo($respuesta,"14");
+$campo_mapa = $campo_mapa[0];
+if ($id ==''){$id='imagen';}
+$size = ($_SESSION['upload_size']*1024*1024)." bytes";
+$resultado ="
+
+
+
+
+
+
+La imagen debe estar en formato .jpg y de tamaño máximo $_SESSION[upload_size] MB ( $size)
+
+";
+return $resultado;
+
+}
+
+
+function formulario_importador($accion) {
+
+ if($accion =='') {
+ $resultado="
Importador";
+
+ return $resultado;
+ }
+ $respuesta = new xajaxResponse('utf-8');
+ $formulariox =formulario_importar('','menu','');
+ $resultado="$formulariox
";
+ $respuesta->addAssign("contenido","innerHTML","$resultado");
+ return $respuesta;
+}
+$xajax->registerFunction("formulario_importador");
+
+
+function subir_archivo($perfil){
+///vinculado con la funcion de javascript resultadoUpload(estado, file) que esta en librerias/scripts.js
+$javascript="includes/upload_archivo.php";
+$resultado ="
+
+
+
+
+Máximo 1MB
+
+ ";
+
+
+return $resultado;
+
+}
+
+ /*
+function formularios_muestra_listado($formulario){
+
+ if($formulario==''){
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$consulta = "SELECT * FROM form_id WHERE id_empresa = '$_SESSION[id_empresa]' ORDER BY nombre ";
+$sql=mysqli_query($consulta,$link);
+
+
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
+ $resultado .="
";
+ $resultado .= "Seleccionar formulario a importar ";
+$fila=0;
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $fila = $fila +1;
+ if ($fila %2 == 0){$bg='LightCyan';}else{ $bg='FFFFFF';}
+
+$resultado .= " $row[nombre] ";
+ }
+
+ $resultado .=" ";
+ }else {$resultado = "";}
+
+ return $resultado;
+ }else{
+ $respuesta = new xajaxResponse('utf-8');
+ $subir = subir_archivo($formulario) ;
+ $div="importador_select";
+ $resultado .= "$subir";
+$respuesta->addAssign($div,"innerHTML",$resultado);
+$respuesta->addAssign("importador_archivo","innerHTML","");
+
+
+
+return $respuesta;
+}
+}
+$xajax->registerFunction("formularios_muestra_listado");
+ */
+
+function formulario_importar_subir($formulario){
+ $pie="";
+ $respuesta = new xajaxResponse('utf-8');
+ $formulario_nombre = remplacetas('form_id','id',$formulario,'nombre','') ;
+ //$formulario_descripcion = remplacetas('form_id','id',$formulario,'descripcion','') ;
+ $encabezado = "
Importar $formulario_nombre[0] ";
+ $subir = subir_archivo($formulario) ;
+ $div="contenido";
+
+ $muestra_form = "
+
+ $subir
+
+
+ ";
+ $respuesta->addAssign("muestra_form","innerHTML","$muestra_form");
+ $respuesta->addAssign("titulo_modal","innerHTML","$encabezado");
+ $respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+return $respuesta;
+
+}
+$xajax->registerFunction("formulario_importar_subir");
+
+
+function formulario_importar($filename,$accion,$perfil){
+$formulario = "";
+$consulta = "";
+$div = "importador_archivo";
+$respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$resultado = "
+
+
+
+
+ Importando formulario ";
+$nombre = "/tmp/$filename";
+if($accion == "grabar") {
+}
+if (($handle = fopen($nombre, 'r')) !== FALSE)
+ {
+ $fila= 0;
+ set_time_limit(0);
+while (($datos = fgetcsv($handle,0,"|")) !== FALSE) {
+$numero = count($datos);
+if($fila >=1) {
+$resultado .= "";
+$numero_columna = 0;
+for ($c=0; $c < $numero; $c++) {
+$columna = $datos[$c];
+if($columna !=""){
+if($accion === "grabar"){
+$control=md5($perfil.$fila.time());
+$ip = obtener_ip();
+$graba_ip = " ip = INET_ATON('".$ip."') ";
+$consulta_campos = "INSERT INTO form_datos SET timestamp= '".time()."', id_usuario='$_SESSION[id]',id_empresa='$_SESSION[id_empresa]',form_id ='$perfil',
+$graba_ip ,
+control = '$control', $consulta id_campo = '$campo[$numero_columna]' , contenido = '$columna'";
+ // $verificar_campo = formulario_verificar_campo($perfil,$campo[$numero_columna]);
+ $elregistro= $campo[$numero_columna];
+ //if($verificar_campo == NULL){}else{
+ if(is_numeric($elregistro)) { $elregistro =$elregistro;}else {$elregistro = -9;}
+ //$verificar_campo = formulario_verificar_campo($perfil,$titulo);
+ $campo_existe = remplacetas('form_campos','id',$elregistro,'campo_nombre','');
+ if($campo_existe[0] == ""){}else{
+ $sql = mysqli_query($consulta_campos,$link);
+ if($sql) {
+ $class='success';
+ $resultado = "GRABADO $fila".time();
+ //$sql_resultado = "oK";
+ }
+ else {
+ $class='danger';
+ }
+ }
+ }
+}
+//$resultado .= "$columna $sql_resultado ";
+$numero_columna ++;
+ }
+ $resultado .= " ";
+ }
+ else {
+ $resultado .= "";
+
+ $posicion = 0;
+ for ($c=0; $c < $numero; $c++) {
+ $titulo = $datos[$c] ;
+ $campo[$posicion] = $datos[$c];
+ if(is_numeric($titulo)) { $titulo =$titulo;}else {$titulo = -9;}
+ $verificar_campo = formulario_verificar_campo($perfil,$titulo);
+ $campo_existe = remplacetas('form_campos','id',$titulo,'campo_nombre','');
+ if($verificar_campo == NULL){$verificar_campo_aviso =" No existe "; $class='danger';
+ if($campo_existe[0] !='') { $verificar_campo_aviso =" No está en el formulario ";$class='warning';}
+ }
+
+ else{$verificar_campo_aviso =""; $class='success';}
+
+ $resultado .= "$titulo $campo_existe[0]$verificar_campo_aviso ";
+ $posicion ++;
+ }
+
+
+ $resultado .= " ";
+ }
+ $fila++;
+ }
+
+
+ $resultado .= "
+
$fila ".time()." " ;
+ }
+
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+}
+
+$xajax->registerFunction("formulario_importar");
+
+
+
+function formulario_verificar_campo($perfil,$id_campo){
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$consulta = "SELECT * FROM `form_contenido_campos` WHERE `id_form` = '$perfil' AND id_campo='$id_campo'";
+$sql =mysqli_query($consulta,$link);
+$cant =mysqli_num_rows($sql);
+
+if (mysqli_num_rows($sql) == '0'){
+$existe = NULL;
+
+ }else {
+
+$control=mysqli_result($sql,0,"control");
+$obligatorio=mysqli_result($sql,0,"obligatorio");
+$existe[]= $control;
+$existe[]= $obligatorio;
+$existe[]= $consulta;
+
+}
+
+return $existe;
+ }
+
+function borrar_tmp($div) {
+if($div =='') {
+ $div="borra_tmp";
+$resultado ="
Limpiar ";
+
+return $resultado ;
+}
+$dir = "tmp/";
+$ficheroseliminados= 0;
+$handle = opendir($dir);
+while ($file = readdir($handle)) {
+ if (is_file($dir.$file)) {
+ if ( unlink($dir.$file) ){
+ $ficheroseliminados++;
+ }
+ }
+}
+$fecha = time ();
+$ahora = date ( "Y-m-d h:i:s" , $fecha );
+$resultado ="
$ahora
";
+ $respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+
+ }
+$xajax->registerFunction("borrar_tmp");
+
+
+function formulario_imprimir_linea($id,$control,$tipo) {
+ $id = mysql_seguridad($id);
+ //if($id !='') {$w_id = "AND form_id = '$id'";}
+ $control = mysql_seguridad($control);
+/* $consulta = "SELECT *
+ FROM form_contenido_campos
+ WHERE form_contenido_campos.id_form = '$id'
+ ORDER BY form_contenido_campos.orden ASC
+ ";
+ */
+ if($id !='') {
+ $consulta = "SELECT *
+ FROM form_contenido_campos
+ WHERE form_contenido_campos.id_form = '$id'
+
+ ORDER BY form_contenido_campos.orden ASC $limit
+ ";
+ }else {
+ $consulta = "SELECT * FROM form_datos WHERE control = '$control' GROUP BY id_campo" ;
+ }
+
+
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if($id !='') {$id = $id;}else {$id=mysqli_result($sql,0,"form_id");}
+ $categoria_campo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'categoria:campo'") ;
+ $categoria_campo = $categoria_campo[0];
+
+ $titulo = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
+ $titulo = $titulo[0];
+
+$timestamp=mysqli_result($sql,0,"timestamp");
+$fecha = date ( "Y-m-d h:i:s" , $timestamp);
+
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
+// $resultado ="
";
+ $imagen = formulario_valor_campo("$id","0","","$control");
+ $imagen = $imagen[3];
+ if($imagen[3] != null AND $tipo !='titulos') {
+ $array[image]=$imagen;
+ $imagen_icon="secure/?file=150/$imagen";
+ $imagen= " ";
+
+ }else {$imagen='';}
+$td .= "$imagen ";
+
+ while( $row = mysqli_fetch_array( $sql ) ) {
+
+ $campo_tipo = remplacetas('form_campos','id',$row[id_campo],'campo_tipo');
+ $campo_tipo =$campo_tipo[0];
+ $contenido = formulario_valor_campo("$id","$row[id_campo]","","$control",'');
+ $md5_contenido = $contenido[4];
+ //md5(binary contenido) as md5_contenido,
+ $contenido_original = $contenido;
+ //$control = $contenido[0];
+ $contenido = $contenido[3];
+ $campo_nombre = remplacetas('form_campos','id',$row[id_campo],'campo_nombre');
+ $campo_nombre[0] =" $campo_nombre[0]";
+ if($tipo=="titulos") {
+ $contenido = "$campo_nombre[0] ";
+ }
+ elseif($tipo=="titulos_csv"){
+ $csv .= '"'.$campo_nombre[0].'";';
+ }
+ elseif($tipo=="linea_csv"){
+ $csv .= '"'.$contenido.'";';
+ }
+ elseif($tipo=="array"){
+
+ if($row[id_campo] == $titulo){$array[title]=$contenido;}
+ if($row[id_campo] == $categoria_campo){
+ $array[category]=$contenido;
+
+ $categoria_filtro = remplacetas('form_parametrizacion','campo',$id,'descripcion',"tabla='form_id' and opcion = 'categoria:filtro:$row[id_campo]'") ;
+ $filtro = $categoria_filtro;
+ $categoria_filtro = $categoria_filtro[0];
+ $icono = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'categoria:icon:$md5_contenido'") ;
+ //$icono[0] = $imagen_icon;
+ if($icono[0] =='') {
+ //$icon = "https://raw.githubusercontent.com/humano/milfs/master/milfs/images/iconos/negro.png";
+ }else{
+
+ $icon = $icono[0];
+ }
+ $array[icon][iconUrl] = "$icon";
+ //$array[icon][iconSize] ="[50,50]";
+ //$array[icon][shadowSize] =[70,70];
+ //$array[icon][shadowUrl] = "http://$_SERVER[HTTP_HOST]/milfs/images/iconos/sha.png";
+
+ }else{}
+ $array[$row[id_campo]] = $contenido;
+ }
+ else{
+ $limite = 100;
+ $size= strlen($contenido);
+ $restante = ($limite - $size);
+ if($size > $limite) {
+ $contenido = substr($contenido,0, $length = 300)."... ";//$contenido;
+ }
+ if($campo_tipo=='15' AND $tipo==""){if($contenido !=""){$contenido = " "; }else{$contenido="";}}
+ if($campo_tipo=='14'){
+ if($contenido !='') {
+ $campos = explode(" ",$contenido);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+ require("includes/datos.php");
+ $url_pin =urlencode("$_SESSION[site]milfs/images/iconos/negro.png");
+ $contenido = "
+
+ ";
+ } else { $contenido ='';}
+ }
+ elseif($campo_tipo=='4'){ $contenido = "$contenido ";}
+ elseif($campo_tipo=='3' AND $contenido !=""){ $contenido = number_format($contenido);}
+ else {$contenido = Markdown("$contenido");}
+
+ }
+
+
+ if($tipo=="titulos") {
+$td .= " $contenido ";
+
+ }else{
+
+ $td .= " $contenido ";
+ }
+ }
+
+if($tipo=="titulos") { $identificador ="Identificador "; }else {$identificador ="$control ";}
+ $resultado .="$td $identificador ";
+}
+ if($tipo =='titulos_csv' or $tipo=='linea_csv') {
+
+return $csv;
+ }
+ if($tipo =="array") {
+ //$array["title"]="hola mundos";
+ return $array;
+ }
+ return $resultado;
+}
+
+
+// $contenido_desplegado = contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+function mostrar_coincidencias_plantilla($id_form,$filtro,$valor,$plantilla) {
+
+ if($valor !=""){
+$md5_valor = $valor;
+if($filtro !='' ){$w_filtro ="AND md5(binary contenido) = '$md5_valor'";}
+}
+$consulta= "SELECT * FROM form_datos WHERE form_id= '$id_form' AND id_campo = '$filtro' $w_filtro ";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+//mysqli_real_escape_string($link,$consulta);
+$sql=mysqli_query($consulta,$link);
+$control=mysqli_result($sql,0,"control");
+if (mysqli_num_rows($sql)!=0){
+mysqli_data_seek($sql, 0);
+while( $row = mysqli_fetch_array( $sql ) )
+ {
+$resultado .= contenido_mostrar("$row[form_id]","$row[control]",'',"$plantilla");
+
+ }
+ }
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign("mostrar_resultado","innerHTML",$resultado);
+ return $respuesta;
+}
+$xajax->registerFunction("mostrar_coincidencias_plantilla");
+
+
+function mostrar_coincidencias($id_form,$filtro,$valor) {
+ if($valor !=""){
+$md5_valor = $valor;
+if($filtro !='' ){$w_filtro ="AND md5(binary contenido) = '$md5_valor'";}
+}
+$consulta= "SELECT * FROM form_datos WHERE form_id= '$id_form' AND id_campo = '$filtro' $w_filtro ";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+//mysqli_real_escape_string($link,$consulta);
+$sql=mysqli_query($consulta,$link);
+
+if (mysqli_num_rows($sql)!=0){
+mysqli_data_seek($sql, 0);
+while( $row = mysqli_fetch_array( $sql ) )
+ {
+ $depliegue = formulario_imprimir_linea($row[form_id],$row[control]);
+ $titulo = formulario_imprimir_linea($row[form_id],$row[control],'titulos');
+ $campos .= " $depliegue ";
+
+ }
+ $resultado = "
";
+ }
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign("mostrar_resultado","innerHTML",$resultado);
+ return $respuesta;
+}
+$xajax->registerFunction("mostrar_coincidencias");
+
+
+function matriz_formulario($formulario,$div,$registros,$pagina,$formato){
+ $respuesta = new xajaxResponse('utf-8');
+if ( !isset ( $_SESSION['id_empresa'] ) ) {
+$respuesta->addRedirect("index.php");
+return $respuesta;
+}
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$md5_filtro = $formulario["campo_filtro"];
+//$formulario = mysql_seguridad($formulario);
+mysqli_real_escape_string($link,$formulario);
+$perfil = $formulario["form_id_id"];
+$filtro = $formulario["campo_filtro"];
+$control = md5(rand(1,99999999).microtime());
+
+$cantidad = formulario_contar($perfil);
+$formulario_nombre = remplacetas('form_id','id',$perfil,'nombre','') ;
+if($filtro !='' ){$w_filtro ="AND md5(binary contenido) = '$md5_filtro'";}
+if($perfil !=''){$perfil ="AND form_id = '$perfil'";}Else{
+ $resultado ="
Por favor seleccione un formulario";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+ }
+if($cantidad < 1) {
+ $resultado ="
+
+ El formulario \"$formulario_nombre[0]\" no tiene registros
+
+ ";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+
+}
+
+$fecha_inicio = $formulario["inicio"];
+if($fecha_inicio =="" ) { $fecha_inicio ="2000-01-01";}
+$fin = $formulario["fin"];
+$id_campo = $formulario["id_campo"];
+$busqueda = $formulario["busqueda"];
+
+if($formato =='csv') {$orden = "ORDER BY form_datos_id ASC ";}else{$orden = "ORDER BY form_datos_id DESC ";}
+if($id_campo ==''){
+ $campo ='';
+
+ }else{
+ if($busqueda =='') {
+ $resultado ="
Por favor escriba una palabra para buscar";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+ }
+ $campo ="AND id_campo = '$id_campo'";
+
+ }
+
+if($busqueda !=''){$busca ="AND contenido LIKE '%%$busqueda%%'";}Else{$busca ='';}
+
+
+
+$consulta = " SELECT *,from_unixtime(timestamp) AS fecha , form_datos.id AS form_datos_id
+ FROM form_datos, form_campos
+ WHERE form_datos.id_campo = form_campos.id AND form_datos.id_empresa = '$_SESSION[id_empresa]'
+ $busca
+ $perfil
+ $campo
+ $w_filtro
+ AND timestamp BETWEEN UNIX_TIMESTAMP('$fecha_inicio')
+ AND UNIX_TIMESTAMP('$fin 23:59:59') GROUP BY control $orden";
+
+
+
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)==0){
+ $resultado ="
No hay resultados para la consulta ";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+
+ }
+if (mysqli_num_rows($sql)!=0){
+ $total_registros = mysqli_num_rows($sql);
+ if($formato=='csv'){
+ $nombre_archivo ="tmp/Formulario_".mktime()."_".$_SESSION['id'].".csv";
+ $boton_descarga ="
Descargar ";
+ $archivo_reporte=fopen($nombre_archivo , "w");
+ $encabezado =";;Periodo\n;;$inicio\n;;$fin \n ";
+ fputs ($archivo_reporte,$encabezado);
+ $tabla .= "ID;Fecha;Timestamp;Formulario;Campo;Contenido;Control\n";
+ fputs ($archivo_reporte,$titulo);
+ mysqli_data_seek($sql, 0);
+ while( $row = mysqli_fetch_array( $sql ) )
+ {
+ $titulo = formulario_imprimir_linea($row[form_id],$row[control],'titulos_csv');
+ $linea = formulario_imprimir_linea($row[form_id],$row[control],'linea_csv');
+ $formulario_nombre = remplacetas('form_id','id',$row[form_id],'nombre') ;
+ $linea = $linea."\n";
+ $lineas .= $linea;
+ }
+ $contenido ="$titulo \n $lineas";
+ //rewind($archivo_reporte);
+ fputs ($archivo_reporte,$contenido);
+ $respuesta->addAssign("boton_descarga","innerHTML",$boton_descarga);
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+
+ }
+ }
+ else{
+ $respuesta ="
No hay resultados
";
+ $respuesta->addAssign($div,"innerHTML",$resultado);
+ return $respuesta;
+ }
+/// PAGINACION
+ if ($pagina =='') {$inicio = 0; $pagina = 1; }
+ else { $inicio = ($pagina - 1) * $registros;}
+
+ if($total_registros < $registros) { $limite ="";}
+ else{$limite =" LIMIT $inicio, $registros ";}
+ $consulta_limite = $consulta.$limite;
+ $sql=mysqli_query($consulta_limite,$link);
+ if (mysqli_num_rows($sql)!='0'){
+ $botones .= "
Limpiar ";
+ if($formato!='csv'){
+ $botones .= "
+ Exportar
+ ";
+ }
+ $paginacion ="";
+ $paginacion .= $indice;
+ $encabezado = "
+
+
+
$botones $paginacion $total_registros registros
+
+
";
+$fila=0;
+ mysqli_data_seek($sql, 0);
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ $formulario_nombre = remplacetas('form_id','id',$row[form_id],'nombre') ;
+ $fila = $fila +1;
+ if ($fila %2 == 0){$bg='LightCyan';}else{ $bg='FFFFFF';}
+ $depliegue = formulario_imprimir_linea($row[form_id],$row[control]);
+ $titulo = formulario_imprimir_linea($row[form_id],$row[control],'titulos');
+ $menu ="
+
+
+
+ ";
+ $campos .= "
$menu $depliegue ";
+ }
+ $resultado .="
";
+ }else{
+ $resultado .="
No hay resultados para la consulta ";
+ }
+ //$resultado .="$consulta";
+$respuesta->addAssign("resultados_encabezado","innerHTML",$encabezado);
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+} $xajax->registerFunction("matriz_formulario");
+
+
+
+function remplacetas($tabla,$campo,$valor,$por,$and){
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
+//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
+$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
+$sql=mysqli_query($consulta,$link);
+if (@mysqli_num_rows($sql)!=0){
+$resultado[] = mysqli_result($sql,0,$por);
+$resultado[] = mysqli_result($sql,0,'id');
+$resultado[] = $consulta;
+$resultado[] = mysqli_result($sql,0,"md5_$por");
+ }else{
+ $resultado[0] = '';
+ $resultado[1] ="";
+ $resultado[2] = $consulta;
+ $resultado[3] = NULL;
+ }
+return $resultado;
+}
+
+function formulario_campos_select($perfil,$div,$onchange){
+ $respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$consulta = "
+ SELECT * FROM form_contenido_campos, form_campos
+ WHERE form_contenido_campos.id_campo = form_campos.id
+ AND id_form = '$perfil'
+ ORDER BY campo_nombre ASC";
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+
+ $categoria = remplacetas('form_parametrizacion','campo',$perfil,'descripcion'," opcion = 'categoria'") ;
+ $categoria = $categoria[0];
+$resultado = "
Campo
+
+ Todos los campos ";
+while( $row = mysqli_fetch_array( $sql ) ) {
+$resultado .= " $row[campo_nombre] ";
+if($div =='') {
+ if ($row[id_campo] == "$categoria"){
+ $class="active";
+ $filtro = formulario_campos_filtro("$perfil","$row[id_campo]","");
+ }else { $class=""; $filtro ='';}
+ $listado .="$row[id_campo] $row[campo_nombre] $filtro ";
+ }
+ }
+$resultado .= "
+
"; }
+else{$resultado = '';}
+
+if($div =='') {return $listado;}
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+
+ }
+$xajax->registerFunction("formulario_campos_select");
+
+
+function formulario_campos_filtro($perfil,$campo,$div,$onchange){
+ $respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$consulta = "
+ SELECT md5(binary contenido) as md5_contenido, contenido FROM form_datos
+ WHERE form_id = '$perfil'
+ AND id_campo = '$campo'
+ GROUP BY contenido
+ ORDER BY contenido asc";
+
+
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+$resultado = "
+ Filtro
+
+ Seleccione ";
+while( $row = mysqli_fetch_array( $sql ) ) {
+$resultado .= " $row[contenido] ";
+ }
+$resultado .= "
+
";
+ }
+else{$resultado = "
No se encontraron resultados
";}
+
+if($div !="") {
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+ }else{return $resultado;}
+
+ }
+$xajax->registerFunction("formulario_campos_filtro");
+
+
+//$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo","$id_campo");
+function formulario_consultar($div){
+ if($div==''){
+ $div = "contenido";
+ $resultado = "
Consultas";
+ return $resultado;
+ }
+ $formulario = select('form_id','id','nombre','xajax_formulario_campos_select((this.value),\'div_campos\')',"id_empresa = '$_SESSION[id_empresa]'",'');
+ $fecha = time ();
+ $ahora = date ( "Y-m-d" , $fecha );
+ $peticion = "
+
+
+
+
+
+
+
+
+ Formulario
+ $formulario
+
+
+
+
+
+
+
+
Consultar
+
+
+";
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($div,"innerHTML",$peticion);
+return $respuesta;
+}
+$xajax->registerFunction("formulario_consultar");
+
+
+function formulario_campos_procesar($form,$tipo_accion){
+ //$form = mysql_seguridad($form);
+ $campos_formulario ="";
+$grabar_campos_valores ="";
+$respuesta = new xajaxResponse('utf-8');
+$campo_nombre = $form["campo_nombre"];
+if($campo_nombre =='') {
+$respuesta->addAlert("El Nombre del campo no puede estar vacío");
+$respuesta->addAssign("grupo_campo_nombre","className"," input-group has-error ");
+return $respuesta;
+}
+
+//$campo_nombre = ucfirst(strtolower($campo_nombre));
+@$campo_descripcion = $form["campo_descripcion"];
+@$campo_tipo = $form["campo_tipo"];
+@$campo_area = $form["campo_area"];
+@$misma_area = $form["misma_area"];
+@$campo_orden = $form["campo_orden"];
+@$campo_identificador = $form["campo_identificador"];
+@$activo = $form["activo"];
+@$tipo = $form["tipo"];
+@$editar = $form["editar"];
+@$id_campo_editar = $form["id_campo_editar"];
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+if ($editar == 'editar' AND $tipo_accion =='editar'){
+mysqli_query("
+ UPDATE `form_campos`
+ SET `campo_nombre` = '$campo_nombre',
+ `campo_descripcion` = '$campo_descripcion',
+ `orden` = '$campo_orden' ,
+ `campo_area` = '$campo_area',
+ `campo_tipo` = '$campo_tipo',
+ `id_empresa` = '$_SESSION[id_empresa]',
+ `activo` = '$activo'
+ WHERE `form_campos`.`id` ='$id_campo_editar'
+ LIMIT 1");
+$w_campo = "id = '$id_campo_editar'";
+
+ }else {
+$id_empresa = $_SESSION['id_empresa'];
+$id_especialista = $_SESSION['id'];
+ $buscar_campo_nombre = remplacetas('form_campos','campo_nombre',$campo_nombre,'campo_nombre'," id_empresa = '$id_empresa' AND campo_area = '$campo_area' ") ;
+ if($buscar_campo_nombre[0] == $campo_nombre) {
+ $respuesta->addAlert("El Nombre del campo ( $campo_nombre ) ya existe en la misma área ");
+ $respuesta->addAssign("grupo_campo_nombre","className"," input-group has-error ");
+ return $respuesta;
+ }
+if($campo_identificador == "") { $campo_identificador = md5($_SESSION['id_usuario']."-".microtime()); }
+$consulta = "
+ INSERT INTO `form_campos`
+ (`id_especialista`, `campo_nombre`,`campo_descripcion`,`campo_tipo`, `campo_area`, `orden`, `activo`, `identificador`, `id_empresa`)
+ VALUES ('$id_especialista','$campo_nombre','$campo_descripcion','$campo_tipo','$campo_area','$campo_orden','1','$campo_identificador','$id_empresa')";
+ $sql =mysqli_query($consulta,$link);
+ $ultimo_id = mysqli_insert_id($link);
+$w_campo= "identificador = '$campo_identificador'";
+if($sql) {
+ $listado_campos = select('form_campos','id','campo_nombre',"xajax_formulario_crear_campo('',(this.value),'div_campos')","id_empresa = '$_SESSION[id_empresa]' AND activo = '1'",'campo_editar','');
+ $campos_formulario ="
+
+
+ El campo se creó con éxito
+ Crear un nuevo campo
+ Modificar campo $listado_campos
+ ";
+ if(@$form['agregar_id_form'] !="") {
+ $respuesta->AddScript("xajax_agregar_campos('grabar_campos','contenido','$ultimo_id','$form[agregar_id_form]') ");
+ ///$respuesta->addAssign("$div","innerHTML",$resultado);
+ //return $respuesta;
+ }
+ }else {$campos_formulario = "
Problemas al grabar el campo $consulta";}
+ }
+
+if($id_campo_editar !='' AND $tipo_accion =='editar'){$id_form_campo = $id_campo_editar;}else {
+//$id_form_campo = mysql_insert_id($link);
+$id_form_campo = $ultimo_id;
+}
+//$respuesta->addAlert("( $campo_tipo / $id_form_campo / $ultimo_id / $form[opciones] ) $consulta");
+//$respuesta->addAssign("contenido","innerHTML","$consulta_campos_valores");
+//return $respuesta;
+if($campo_tipo == '23' ){
+$grabar_campos_valores = "(".$id_form_campo.",'".$form[opciones]."')";
+}
+/// separacion por comas
+else {
+$opciones=str_replace(', ',',',"$form[opciones]");
+$opciones = explode(",",$opciones);
+
+foreach($opciones as $c=>$v){
+
+ //if($v !='') {$v = ucfirst(strtolower($v));
+ if($v !='') {$v = $v;
+
+$grabar_campos_valores .= "( $id_form_campo ,'$v'),";
+ }
+
+ }
+$grabar_campos_valores =substr ("$grabar_campos_valores",0,-1);
+} /// fin de separacion por comas
+
+$borrar_campos_valores = "DELETE FROM `form_campos_valores` WHERE `id_form_campo` = '$id_form_campo'";
+$consulta_campos_valores = "INSERT INTO form_campos_valores (id_form_campo,campo_valor) VALUES ".$grabar_campos_valores."";
+
+ $sql_borrar_campos_valores =mysqli_query($borrar_campos_valores,$link);
+ $sql_campos_valores =mysqli_query($consulta_campos_valores,$link);
+
+ $campos=mysqli_query("
+ SELECT id_form_campo, campo_nombre, campo_descripcion, tipo_campo_accion, campo_area, orden
+ FROM `consulta_campos` , `tipo_campo`
+ WHERE $w_campo
+
+ AND form_campos.campo_tipo = form_tipo_campo.id_tipo_campo
+ LIMIT 1");
+
+
+$campos_formulario .= "
";
+while( @$row = mysqli_fetch_array( $campos ) ) {
+if ($row['tipo_campo_accion']=='textarea'){
+$campos_formulario .= "
".$row['orden']."";}
+else{
+$campos_formulario .= "
".$row['orden']." ";
+ } }
+
+$respuesta->addAssign("formulario_campos_$misma_area","innerHTML",$campos_formulario);
+return $respuesta;
+}$xajax->registerFunction("formulario_campos_procesar");
+
+function formulario_opciones_select($tipo,$id_campo){
+ $valores="";
+ $respuesta = new xajaxResponse('utf-8');
+ $div = 'opciones_select';
+if($id_campo !=''){
+$consulta= "SELECT * FROM form_campos_valores WHERE id_form_campo = '$id_campo'";
+$link = Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $valores .= "$row[campo_valor],";
+ }
+ $valores = substr($valores,0,-1);
+ }
+ }
+if($tipo =='8'){
+$resultado = "
$valores ";
+ }
+elseif($tipo =='9'){
+$resultado = "
$valores ";
+ }
+elseif($tipo =='16'){
+ if($valores =='') {$valores = "1,10";}
+$resultado = "
$valores ";
+ }
+elseif($tipo =='17'){
+ $resultado ="
";
+}
+else{
+$resultado = "
$valores ";
+}
+$respuesta->addAssign("$div","innerHTML",$resultado);
+return $respuesta;
+}
+$xajax->registerFunction("formulario_opciones_select");
+
+
+
+function crear_campos_formulario($form,$id_form){
+ $id_form=$id_form;
+ $area="";
+ $Campo_tipo_definido="";
+ $Tipo_campo="";
+ $campo_nombre ="";
+ $campo_descripcion ="";
+ $editar ="";
+
+$form = mysql_seguridad($form);
+$respuesta = new xajaxResponse('utf-8');
+if($form['div'] !="") { $div = $form['div'];}else{$div="div_campos";}
+
+@$especialista = $form["id_especialista"];
+@$id_campo_editar = $form["id_campo_editar"];
+$resultado = "
+
+$id_campo_editar";
+$link = Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$capa = "crear_campos_consulta_$area";
+$formulario ="manejo_campos_$area";
+
+if ($id_campo_editar > 0){
+$sql=mysqli_query("SELECT * FROM form_campos WHERE id = '$id_campo_editar' AND activo ='1'");
+while( $row = mysqli_fetch_array( $sql ) ) {
+$resultado .="";
+$campo_descripcion =$row['campo_descripcion'];
+$campo_nombre =$row['campo_nombre'];
+$orden =$row['orden'];
+$especialista =$row['id_especialista'];
+
+$formulario ="manejo_campos_$id_campo_editar";
+$editar="
+
+
+
";
+$Campo_tipo_definido= $row['campo_tipo'];
+}
+ }
+
+$Tipo_campo ="
Tipo:
+
";
+$tipos=mysqli_query("
+ SELECT *
+ FROM `form_tipo_campo`
+ WHERE activo = '1'
+ ");
+while( $row = mysqli_fetch_array( $tipos ) ) {
+
+if($row['id_tipo_campo'] == $Campo_tipo_definido){
+$Tipo_campo .= " > ".$row['id_tipo_campo']." - ".$row['tipo_campo_nombre']." < ";
+ }
+$Tipo_campo .= " ".$row['id_tipo_campo']." - ".$row['tipo_campo_nombre']." ";
+}
+$Tipo_campo .="
";
+
+
+if($id_form !="") {
+
+$agregar_a_formulario = "
+
+
+
+ Incluir este campo en el formulario actual
+
+
+ ";
+}else {$agregar_a_formulario = "";}
+
+$identificador = md5($_SESSION['id']."-".microtime());
+$areas = select('form_areas','id','nombre','',"id_empresa = '$_SESSION[id_empresa]'",'campo_area',"");
+$resultado .= "
+
+
";
+$resultado = "
+
+
+ Crear un nuevo campo
+ $resultado
+
+";
+$respuesta->addAssign("$div","innerHTML",$resultado);
+return $respuesta;
+}
+$xajax->registerFunction("crear_campos_formulario");
+
+function formulario_crear_campo($area,$campo,$div){
+ $campos_formulario="";
+ $misma_area="";
+$respuesta = new xajaxResponse('utf-8');
+ if($div==''){
+ $div = "contenido";
+ $cerrar = "
[X] ";
+$resultado = "
Campos ";
+
+ return $resultado;
+ }
+ //$div="div_campos";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$consulta_campos ="SELECT id, campo_nombre, campo_descripcion, tipo_campo_accion, campo_area, form_campos.activo, form_campos.campo_tipo
+ FROM `form_campos` , `form_tipo_campo`
+ WHERE id_empresa = '$_SESSION[id_empresa]' AND id = $campo
+ AND form_campos.campo_tipo = form_tipo_campo.id_tipo_campo
+ ORDER BY orden ASC";
+ $campos=mysqli_query($consulta_campos,$link);
+if($campo ==''){
+
+ $listado_campos = select('form_campos','id','campo_nombre',"xajax_formulario_crear_campo('',(this.value),'$div')","id_empresa = '$_SESSION[id_empresa]' AND activo = '1'",'campo_editar','');
+$areas = tabla_areas('form_areas','id','nombre,descripcion,estado,orden','',"",'Areas','');
+$tabla_campos = campos_tabla('id_especialista','');
+$campos_formulario = "
+
+
+
+
+
+
+
+
+
+
+
+
+
$tabla_campos
+";
+}else{
+$campos_formulario .= "
";
+while( $row = mysqli_fetch_array( $campos ) ) {
+// if($row[campo_tipo] =='8'){
+ $respuesta->addScript("xajax_formulario_opciones_select('$row[campo_tipo]','$campo') ");
+// }
+ $Tipo_campo ="
Tipo:
+
";
+$tipos=mysqli_query("
+ SELECT *
+ FROM `form_tipo_campo`
+ WHERE activo = '1'
+ ");
+while( $row_tipo = mysqli_fetch_array( $tipos ) ) {
+
+if($row_tipo['id_tipo_campo'] == $row['campo_tipo'] ){
+$Tipo_campo .= " > ".$row_tipo['id_tipo_campo']." - ".$row_tipo['tipo_campo_nombre']." < ";
+ }
+$Tipo_campo .= " ".$row_tipo['id_tipo_campo']." - ".$row_tipo['tipo_campo_nombre']." ";
+}
+$Tipo_campo .="
";
+
+if($row['activo'] =='1'){$activo = "
Activo: el campo puede ser usado en formularios ";}
+else{$activo = "
Inactivo: El campo NO se usará ";}
+$formulario = "editar_campos";
+$areas = select('form_areas',"id",'nombre','',"id_empresa = '$_SESSION[id_empresa]'",'campo_area',"$row[campo_area]");
+
+$campos_formulario .= "
+
+
+
+
+
+
+
";
+
+ }
+ }///fin de edicion
+
+
+
+$respuesta->addAssign($div,"innerHTML",$campos_formulario);
+
+return $respuesta;
+}
+$xajax->registerFunction("formulario_crear_campo");
+
+function agregar_campos($tipo,$div,$id,$formulario){
+$respuesta = new xajaxResponse('utf-8');
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+if($tipo==''){
+ $div="contenido";
+$resultado = "
Editar";
+print $resultado;
+return;
+ }
+ if($tipo=='consultar_listado'){
+ $consulta="SELECT * FROM form_id WHERE id_empresa = '$_SESSION[id_empresa]' ORDER BY nombre ASC";
+ $sql =mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+$resultado .="Formulario:
";
+$resultado .= "Selecciona ";
+while( $row = mysqli_fetch_array( $sql ) ) {
+$resultado .= "$row[nombre] ";
+ }
+$resultado .=" $cerrar";
+ }else {
+$resultado = "
No hay formularios para editar
";
+ }
+ }
+
+if ($tipo=='consultar_campos'){
+ $consulta="
+ SELECT form_contenido_campos.id_campo, form_contenido_campos.id,
+ campo_nombre, obligatorio,control,multiple,form_contenido_campos.orden
+ FROM form_contenido_campos, form_campos
+ WHERE form_campos.id_empresa = '$_SESSION[id_empresa]' AND form_contenido_campos.id_form = $id
+ AND form_contenido_campos.id_campo = form_campos.id
+ ORDER BY form_contenido_campos.orden";
+ $sql =mysqli_query($consulta,$link);
+ $consulta_nombre="SELECT * FROM form_id WHERE id ='$id'";
+ $sql_nombre =mysqli_query($consulta_nombre,$link);
+ $nombre =mysqli_result($sql_nombre,0,"nombre");
+ //if (mysqli_num_rows($sql)!='0'){
+$resultado ="$cerrar
$nombre
+ ";
+$resultado .= "
+
+ Campo
+
+
+ Obligatorio
+
+
+ Orden
+
+
+ Multiple
+
+
+ Borrar
+
+
+
";
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+ /* $multiple = remplacetas('form_parametrizacion','campo',"$id",'descripcion'," tabla='form_id' and opcion = '$row[id]' AND descripcion REGEXP '^multiple:' ") ;
+ $multiple = explode(":",$multiple[0]);
+ $multiple = $multiple[1];*/
+
+ //$multiple = $multiple[0];
+$resultado .= "
+
+ $row[id_campo] $row[campo_nombre]
+
+
+
+
+
+
+
";
+ }
+
+$consulta_campos_todos ="SELECT form_campos.id, form_campos.campo_nombre, form_campos.campo_descripcion FROM form_campos WHERE form_campos.id_empresa = '$_SESSION[id_empresa]'
+ ORDER BY campo_nombre ";
+$sql_consulta_campo =mysqli_query($consulta_campos_todos,$link);
+
+$crear_nuevo ="
+
+
+
+
+
+
+";
+ while( $row = mysqli_fetch_array( $sql_consulta_campo ) ) {
+$valores .= "
$row[campo_nombre] [$row[id]] ";
+ }
+$resultado .="
+
+
+
+$crear_nuevo ";
+
+ }/// fin de consultar_campos
+
+if($tipo=='grabar_campos'){
+ if ($id=="nuevo")
+{
+
+
+}
+elseif($id =="") { $div='atencion';$resultado="
Seleccione un campo";}
+else {
+$id_form=func_get_arg(3);
+$consulta = "SELECT id_campo FROM form_contenido_campos WHERE id_empresa = '$_SESSION[id_empresa]' AND id_campo= '$id' AND id_form= $id_form";
+$sql_consulta =mysqli_query($consulta,$link);
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}if(mysqli_num_rows($sql_consulta) =='0') {
+$microtime = microtime();
+$consulta_grabar=" INSERT INTO form_contenido_campos (
+`id_campo` ,
+`id_empresa` ,
+`id_form` ,
+`obligatorio`,
+`control`
+)
+VALUES (
+'$id', '$id_empresa', '$id_form', '0', md5('$microtime' + rand())
+)";
+$sql_consulta_grabar =mysqli_query($consulta_grabar,$link);
+$respuesta->addScript("xajax_agregar_campos('consultar_campos','$div','$id_form')");
+return $respuesta;
+ }else{
+$div='atencion';$resultado="
El campo ya pertenece a esta consulta ";
+ }
+ }
+
+ }///fin de grabar_campos
+
+if($tipo=='eliminar'){
+$confirmar=func_get_arg(3);
+
+
+if($id==''){
+$id_c=func_get_arg(4);
+$capa_original=func_get_arg(5);
+$resultado = "
+ Seguro que desea eliminar el campo de esta consulta?
+
[SI]
+
[NO]
+
+ ";}
+ else{
+ if($id=='x'){ /// si se pasa una x como argumento se regresa a la capa original
+$resultado .= "
+
+ ";
+ }else{
+$consulta="DELETE FROM `form_contenido_campos` WHERE `control` = '$confirmar' LIMIT 1";
+$sql_consulta_eliminar = mysqli_query($consulta,$link);
+$div=func_get_arg(5);
+$id_consulta=func_get_arg(4);
+$respuesta->addScript("xajax_agregar_campos('consultar_campos','$div','$id_consulta')");
+
+ }
+ }
+
+ }/// fin de eliminar
+if($tipo == 'obligatorio'){
+if($id == '0'){$id='1';}else{$id='0';}
+$control = func_get_arg(3);
+$consulta= "UPDATE `form_contenido_campos` SET `obligatorio` = '$id' WHERE `control` = '$control' LIMIT 1 ";
+$sql_consulta_grabar =mysqli_query($consulta,$link);
+$a ="
$id
+ ";
+$respuesta->addAssign($div,"innerHTML",$a);
+return $respuesta;
+
+ }/// fin de obligatorio
+if($tipo == 'orden'){ /// orden
+$control = func_get_arg(3);
+$consulta= "UPDATE `form_contenido_campos` SET `orden` = '$id' WHERE `control` = '$control' LIMIT 1 ";
+$sql_consulta_grabar =mysqli_query($consulta,$link);
+$a ="
$id
+ ";
+
+$respuesta->addAssign($div,"innerHTML",$a);
+return $respuesta;
+
+ }/// fin de obligatorio
+
+if($tipo == 'prellenado'){
+if($id == '0'){$id='1';}else{$id='0';}
+$control = func_get_arg(3);
+$consulta= "UPDATE `consulta_tipo_campos` SET `prellenado` = '$id' WHERE `control` = '$control' LIMIT 1 ";
+$sql_consulta_grabar =mysqli_query($consulta,$link);
+$a ="
$id
+ ";
+$respuesta->addAssign($div,"innerHTML",$a);
+return $respuesta;
+
+ }/// fin de oprellenado
+$respuesta->addAssign($div,"style.display","block");
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+
+ }
+$xajax->registerFunction("agregar_campos");
+
+function formulario_nuevo($formulario,$div){
+ $resultado ="";
+ $formulario = mysql_seguridad($formulario);
+ $respuesta = new xajaxResponse('utf-8');
+ //$formulario=mysqli_real_escape_string($link,$formulario);
+ $id_empresa= $_SESSION['id'];
+ if($div==''){
+ $div = "contenido";
+
+$resultado .= "
Formulario ";
+
+ return $resultado;
+ }
+if($formulario ==''){
+ $formulario_nombre = "nuevo_formulario";
+ $formulario_respuesta = select('form_id','id','nombre','',"id_empresa = '$_SESSION[id_empresa]'",'formulario_respuesta','');
+$resultado .= "
+
+Crear un formulario
+
+ Nombre para el formulario
+
+
+
+ Descripción
+
+
+
+ Formulario anidado con:
+ $formulario_respuesta
+
+
+ Grupo:
+
+
+
+
+ Privado
+
+ Público
+
+
+
+
+
+ Grabar
+
+
+ ";
+
+ }else{
+$control = md5(rand(1,99999999).microtime());
+
+$nombre = $formulario['nombre']; // aa
+$descripcion = $formulario['descripcion']; // dxddc
+$publico = $formulario['publico']; // dxddc
+$grupo = $formulario['grupo'];
+$id_empresa = $_SESSION['id_empresa'];
+
+if($publico =='') {$publico ='0';}
+$propietario= $_SESSION['id'];
+$formulario_respuesta = $formulario['formulario_respuesta']; // dxddc
+$link=Conectarse();
+@$formulario=mysqli_real_escape_string($link,$formulario);
+mysqli_query("SET NAMES 'utf8'");
+$consulta = "INSERT INTO `form_id` ( `nombre`, `descripcion`, `activo`, `modificable`, `publico`, `propietario`, `formulario_respuesta`, `id_empresa`)
+VALUES ('$nombre', '$descripcion', '1', '1', '$publico', '$propietario','$formulario_respuesta','$id_empresa');";
+$sql=mysqli_query($consulta,$link);
+$ultimo_id = mysqli_insert_id($link);
+ if($grupo !="") {
+ $consulta_grupo = "INSERT INTO form_grupo set id = '$ultimo_id',grupo = '$grupo' ,id_empresa= '$id_empresa'";
+ $sql_grupo=mysqli_query($consulta_grupo,$link);
+ }
+
+$respuesta->addscript("xajax_formulario_listado('','contenido'); ");
+}
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+}$xajax->registerFunction("formulario_nuevo");
+
+
+function formulario_listado($filtro_grupo,$div){
+ $item="";
+ $grupo_formularios="";
+if ( !isset ( $_SESSION['id_empresa'] ) ) {
+ $respuesta = new xajaxResponse('utf-8');
+$respuesta->addRedirect("index.php");
+return $respuesta;
+}
+
+ if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];} if($div==''){
+ $div = "contenido";
+ if(isset($_SESSION['grupo_formularios'])) { $sesion_grupo_formularios = $_SESSION['grupo_formularios'];}else { $sesion_grupo_formularios = "";}
+$resultado = "
Formularios ";
+
+ return $resultado;;
+ }
+$control = md5(rand(1,99999999).microtime());
+$respuesta = new xajaxResponse('utf-8');
+$_SESSION['grupo_formularios'] = $filtro_grupo;
+
+$link=Conectarse();
+ $id=mysqli_real_escape_string($link,'$id');
+mysqli_query("SET NAMES 'utf8'");
+if($filtro_grupo =="") {
+$consulta = "SELECT * FROM form_id WHERE id_empresa ='$_SESSION[id_empresa]' ORDER BY orden ASC";
+ }
+else {
+$consulta = "
+SELECT * FROM form_id, form_grupo
+WHERE form_grupo.id = form_id.id
+AND form_grupo.grupo = '$filtro_grupo'
+AND form_id.id_empresa ='$_SESSION[id_empresa]' ORDER BY orden ASC";
+}
+$sql=mysqli_query($consulta,$link);
+if($filtro_grupo !="") {
+ $leyenda_filtro_grupo ="
Grupo $filtro_grupo ";
+
+ }else{ $leyenda_filtro_grupo ="
Formularios "; unset($_SESSION['grupo_formularios']);}
+$resultado_link = "
Formularios ";
+$respuesta->addAssign("link_formulario","innerHTML",$resultado_link);
+
+
+$divider = 1;
+$columnas = intval(12/$divider);
+ $listado_grupos = select_empresa('form_grupo','grupo','grupo',"xajax_formulario_listado((this.value),'contenido')","AGRUPADO",'','',"$id_empresa");
+ $listado_grupos ="
+
+ Seleccione un grupo de formularios
+ $listado_grupos
+
+
+ ";
+
+ $nuevo_formulario = "
+
";
+ $resultado = "
+
+ $nuevo_formulario
+
+
+ $listado_grupos
+
+ $leyenda_filtro_grupo
+
+ ";
+
+if (mysqli_num_rows($sql)!='0' ){
+ $i =0;
+
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ $id= $row['id'];
+ $C = $id;
+
+ $cantidad = formulario_contar($row['id']);
+ if($cantidad >0) {$cantidad ="
Llenado: $cantidad veces ";}else{$cantidad = "";}
+ $propietario = remplacetas('usuarios','id',$row['propietario'],'email',"") ;
+ $estado = remplacetas('form_id','id',$id,'publico',"") ;
+ $nombre_formulario = remplacetas('form_id','id',$id,'nombre',"") ;
+ $descripcion_formulario = remplacetas('form_id','id',$id,'descripcion',"") ;
+ $estado = "
+
+ Contenido privado
+
+ Público
+
+ ";
+ $modificable = remplacetas('form_id','id',$id,'modificable',"") ;
+ $modificable = "
+
+ Formulario privado
+
+ Público
+
+ ";
+
+
+ $primer = formulario_uso("$id",'','primer') ;
+ if(@$primer[0] !='') {$primer = "
Primer registro: ".date ( "Y-m-d h:i:s" , $primer[0])." ";}else{$primer='';}
+ $ultimo = formulario_uso("$id",'','ultimo') ;
+ @$ultimo_control = $ultimo[1];
+ if(@$ultimo[0] !='') {$ultimo = "
Último registro: ".date ( "Y-m-d h:i:s" , $ultimo[0])." ";}else{$ultimo='';}
+
+ $nombre = editar_campo("form_id",$row['id'],"nombre","","","","");
+ $orden = editar_campo("form_id",$row['id'],"orden","","","","");
+ $descripcion = editar_campo("form_id",$row['id'],"descripcion","","","","");
+ $geo = buscar_campo_tipo($id,"14");
+ $email_envio = remplacetas('form_parametrizacion','campo',"$row[id]",'descripcion'," tabla='form_id' and opcion = 'email'") ;
+ $mensaje_envio = remplacetas('form_parametrizacion','campo',"$row[id]",'descripcion'," tabla='form_id' and opcion = 'mensaje_envio'") ;
+ if($geo[0] !='') { $mapa= "
Mapa";}else {$mapa='';}
+
+ if($i % $divider==0) {
+
+//$item .= "";
+ }
+ $i++;
+ $grupo_actual = remplacetas('form_grupo','id',$row['id'],'grupo',"") ;
+ if(is_null($grupo_actual[3])) {
+ $valores_grupo['id']=$row['id'];
+ $valores_grupo['grupo']="";
+ $grupo = "
+
+ ";
+ // $grupo = "Grupo ".editar_campo("form_grupo",$row['id'],"grupo","","","");
+ }else
+ {
+ $grupo = "".editar_campo("form_grupo",$row['id'],"grupo","","","","");
+ }
+
+$item .= "
+
+
+
+
+
+
+
+ Creación: $row[creacion] / $propietario[0]
+ $cantidad
+ $ultimo
+ $primer
+ $mapa
+
+
+
+
+
$row[id]
+
+
+
+
+
+
+
+
+
+
+
+
Agregar o quitar campos
+
+
+
+
+
+
+
+ Nombre: $nombre
+ Descripción: $descripcion
+ Orden: $orden Grupo: $grupo
+
+
+
Mensaje de respuesta
+
+
$mensaje_envio[0]
+
Soporta CSS3, HTML5 y Bootstrap
+
Grabar y previsualizar
+
+
+
+
+
Previsualización
+
+ $mensaje_envio[0]
+
+
+
+
+
+
+
+
+
+
+ $estado
+
+
+ $modificable
+
+
+
+
+
+ ";
+
+
+ if($i%$divider==0) {
+ $item .= "
";
+ }
+
+ }
+
+
+ //$resultado .="";
+ }
+
+
+else{ $resultado .= "
Aún no se han diseñado formularios ";}
+
+ $resultado_formulario ="
+
+ $item
+
";
+ $resultado = "$resultado $resultado_formulario ";
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+}$xajax->registerFunction("formulario_listado");
+
+function formulario_eliminar($id,$tipo) {
+ $respuesta = new xajaxResponse('utf-8');
+ $nombre = remplacetas('form_id','id',$id,'nombre',"") ;
+ $nombre_form = $nombre[0];
+ if($tipo =='') {
+$resultado ="
";
+}elseif($tipo=='cancelar') {
+ $resultado ="
Eliminar";
+}elseif($tipo =='eliminar'){
+$consulta = "DELETE FROM form_id WHERE form_id.id = '$id' ";
+$link=Conectarse();
+ $sql=mysqli_query($consulta,$link);
+ if($sql) {
+ $respuesta->addAlert("Se eliminó el formulario \" $nombre_form \" ");
+ $respuesta->addAssign("panel_$id","innerHTML","");
+ return $respuesta;
+
+ }
+}
+else {}
+$respuesta->addAssign("eliminar_$id","innerHTML",$resultado);
+
+return $respuesta;
+}$xajax->registerFunction("formulario_eliminar");
+
+
+function campo_multiple($id_campo,$id_form,$control,$item){
+//if ( !isset ( $_SESSION['id'] ) ) { return;}
+
+ if($item==''){$item=1;}
+ $id= $item;
+$render = formulario_campos_render($id_campo,$id_form,$control,$item+1);
+ $ingredientes = "
+
+ $render
+
+
+
+
+ ";
+ $boton= "
+ Agregar campo
+
";
+$div = "id_campo_$id_campo"."_".$id;
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($div,"innerHTML",$ingredientes);
+$respuesta->addAssign("boton_".$id_campo."","innerHTML","$boton ");
+return $respuesta;
+
+}
+$xajax->registerFunction("campo_multiple");
+
+
+function formulario_campos_render($id_campo,$id_form,$control,$item,$id_dato){
+$cols ="";
+$style="";
+$campo_multiple="";
+$render="";
+
+$consulta ="
+ SELECT *
+ FROM form_contenido_campos,form_campos, form_tipo_campo
+ WHERE form_contenido_campos.id_form = '$id_form'
+ AND form_contenido_campos.id_campo = '$id_campo'
+ AND form_contenido_campos.id_campo = form_campos.id
+ AND form_tipo_campo.id_tipo_campo = form_campos.campo_tipo ";
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+ $sql=mysqli_query($consulta,$link);
+ if (mysqli_num_rows($sql)!='0'){
+ if($id_dato !='') {
+ $value = remplacetas('form_datos','id',$id_dato,'contenido'," control = '$control'") ;
+ $multiple='0';
+ $esta_editando =1;
+ }
+ else {
+ $value = remplacetas('form_datos','id_campo',$id_campo,'contenido'," control = '$control'") ;
+ $multiple=mysqli_result($sql,0,"multiple");
+ }
+ if($item=='') {$item ="0";}else {$item=$item;}
+
+ if($value[0] !='') {$value= "$value[0]";}ELSE{$value='';}
+ $campo_nombre=mysqli_result($sql,0,"campo_nombre");
+ $campo_descripcion=mysqli_result($sql,0,"campo_descripcion");
+ $campo_tipo_accion=mysqli_result($sql,0,"tipo_campo_accion");
+ $campo_obligatorio=mysqli_result($sql,0,"obligatorio");
+ if($campo_obligatorio =='1') {$obligatorio ="danger";}else{$obligatorio ="default";}
+
+ if($campo_tipo_accion == 'text'){$render = "
";}
+ elseif($campo_tipo_accion == 'date'){$render = "
";}
+ elseif($campo_tipo_accion == 'rango'){
+ $rango = rango("form_campos_valores","campo_valor","id_form_campo","$id_campo","$value","".$id_campo."[".$item."]",""); $render = $rango;}
+ elseif($campo_tipo_accion == 'mapa'){
+ $lat="";
+ $lon="";
+ $zoom="";
+ if($value !=""){
+
+ $campos = explode(" ",$value);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+ if($lat =="") {
+ $localizacion = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ;
+ //$render= $localizacion[0];
+ $campos = explode(" ",$localizacion[0]);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+
+ }
+ }
+ $render .= "
+
+
+
+
+
+ ";
+ $cols='12';
+ }
+elseif($campo_tipo_accion == 'email'){$render = "
+
+
Escriba un email válido
";}
+ elseif($campo_tipo_accion == 'envio'){$render = "
+
+
Se enviará un email
";}
+ elseif($campo_tipo_accion == 'textarea'){
+ $render = "
$value ";
+ $cols='12';
+ }
+ //$subir_imagen = subir_imagen('');
+ elseif($campo_tipo_accion == 'imagen'){
+ $style ="display:hidden";
+ // $gps = leer_exif($file);
+ $render= "
"; //subir_imagen('',$id_campo[$item]);
+ $cols='12'; }
+
+ elseif($campo_tipo_accion == 'html'){
+ $render = "
+
+
$value ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'limit'){
+ $limite = limite("".$id_campo."[".$item."]",'','limite');
+ $rows = ceil($limite / 50 )+1;
+ $render = "$limite /
+
+
+
$value
+ ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'select'){
+
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = select_edit($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "$select "; $cols='12'; }
+ elseif($campo_tipo_accion == 'radio'){
+ $select = radio_edit($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "$select ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'radio_agrupado_campos'){
+ //radio_agrupado_linea($id_campo,$form_id,$valor,$name,$control)
+ $campos_valores = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ;
+ $mensaje = remplacetas('form_campos','id',$id_campo,'campo_descripcion',"") ;
+ $campos = explode(":",$campos_valores[0]);
+ $titulos = explode(";",$campos[0]);
+ $campos_incluidos = explode(";",$campos[1]);
+ for($i=0;$i
$campos_incluidos[$i] ";
+ //$select = radio_agrupado_linea($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "
+
+
+
+ $mensaje[0]
+ $listado_titulos
+ $listado_campos
+
+
+
";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'radio_agrupado_linea'){
+
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = radio_agrupado_linea($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = " ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'checkbox'){
+
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = checkbox_edit($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "$select ";}
+ elseif($campo_tipo_accion == 'combo'){
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = combo_select($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'relacion'){
+ $select = relacion_select($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'buscador'){
+ $select = buscador_campo($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'base'){
+ $select = buscador_base($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";}
+ elseif($campo_tipo_accion == 'vinculado'){
+ $vinculado = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ;
+ $select = formulario_areas($vinculado[0],'campos');
+ $render = "
+ $select
+ ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'number'){
+ $render = "
+
+ (solo números)
";}
+
+ elseif($campo_tipo_accion == 'password'){
+ if( $control != "") {
+ $render="";$label=""; $campo_tipo_accion="oculto";
+ }else {
+ $render = "
+
+ ";
+ }
+ //else {}
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'unico'){
+ $render ="
+
";
+ }
+ else{$render = " ";}
+ if($multiple =='1'){
+
+
+ $campo_multiple = "
+
+ ";
+}
+ if($item == 0) { $label = " $campo_nombre ";}
+ else {$label = "$campo_nombre $campo_obligatorio ";}
+ ///// CAMPOS QUE NO SE MOSTRARAN
+ if($campo_tipo_accion == 'imagen'){
+ $label="";
+ $campo_descripcion="";
+ }
+ if($cols =="") {$cols = "6";}
+ $input = "
+
+$campo_multiple
+ ";
+
+
+if($campo_tipo_accion != "oculto") {
+ $input= $input;
+ }else { $input ="";}
+
+ }
+ return $input;
+}
+
+
+function validar_email($email) {
+
+if (preg_match('/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/',$email)) {
+ return 1;
+}else{
+ return 0;
+}
+}
+
+function formulario_valor_campo_ORIGINAL($perfil,$id_campo,$valor,$id_control){
+
+
+//if($id_control !=""){ $control ="AND `control` = '$id_control'";}else {$control ="";}
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$valor=mysqli_real_escape_string($link,$valor);
+if($valor !=""){ $valor ="AND md5(contenido) LIKE '$valor'";}else {$valor ="";}
+$consulta = "SELECT * FROM `form_datos` WHERE `form_id` = '$perfil' AND id_campo='$id_campo' $valor AND `control` = '$id_control' ORDER BY timestamp DESC limit 1";
+$sql =mysqli_query($consulta,$link);
+$cant =mysqli_num_rows($sql);
+
+if (mysqli_num_rows($sql) == '0'){
+ $existe = NULL;
+ }else {
+
+$control=mysqli_result($sql,0,"control");
+$timestamp=mysqli_result($sql,0,"timestamp");
+mysqli_data_seek($sql, 0);
+if($cant === 1) {
+ $contenido=mysqli_result($sql,0,"contenido");
+ }else {
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $contenido .= "$row[contenido] ";
+ }
+ }
+$existe[]= $control;
+$existe[] = $timestamp;
+$existe[] = $consulta;
+$existe[] = $contenido;
+}
+return $existe;
+ }
+
+
+
+function formulario_valor_campo($perfil,$id_campo,$valor,$id_control,$orden){
+$contenido="";
+
+//if($id_control !=""){ $control ="AND `control` = '$id_control'";}else {$control ="";}
+$campo_multiple = remplacetas("form_contenido_campos","id_campo",$id_campo,"multiple"," id_form ='$perfil'");
+$tipo_campo = remplacetas("form_campos","id","$id_campo","campo_tipo","");
+$campo_multiple = $campo_multiple[0];
+if($tipo_campo[0] =="24") {$campo_multiple = "1";}
+/// SI EL CAMPO ES MULTIPLE O CHECK BOX MUESTRA LAS MULTIPLES ENTRADAS
+if($campo_multiple !="1" ){ $limite =" asc limit 1 ";}else {$limite =" asc ";}
+if(@$orden !=""){ $campo_orden =" AND orden ='$orden' ";}else {$campo_orden ="";}
+
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$valor=mysqli_real_escape_string($link,$valor);
+if($valor !=""){ $valor ="AND md5(contenido) LIKE '$valor'";}else {$valor ="";}
+/*
+$consulta = "SELECT * FROM `form_datos`
+WHERE `form_id` = '$perfil'
+AND id_campo='$id_campo' $valor
+AND `control` = '$id_control' $campo_orden
+GROUP BY orden
+ORDER BY timestamp $limite ";
+*/
+ $consulta = "SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador
+ FROM `form_datos`
+ WHERE form_id = '$perfil'
+ AND id_campo ='$id_campo' $valor
+ AND control ='$id_control' $campo_orden
+ group by orden
+ ORDER BY orden $limite";
+
+$sql =mysqli_query($consulta,$link);
+$cant =mysqli_num_rows($sql);
+
+if (mysqli_num_rows($sql) == '0'){
+ $existe = NULL;
+ }else {
+
+$control=mysqli_result($sql,0,"control");
+$timestamp=mysqli_result($sql,0,"timestamp");
+$orden=mysqli_result($sql,0,"orden");
+$id_usuario=mysqli_result($sql,0,"id_usuario");
+$ip=mysqli_result($sql,0,"ip");
+mysqli_data_seek($sql, 0);
+$md5_contenido = "";
+if($cant === 1) {
+ //$contenido=mysqli_result($sql,0,"contenido");
+ $identificador=mysqli_result($sql,0,"identificador");
+ $identificador = explode(',',$identificador);
+ $identificador = $identificador[0];
+ $contenido_campo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $md5_contenido = $contenido_campo[3];
+ //$md5_contenido = remplacetas('form_datos','id',$identificador,' md5(binary contenido) as md5_contenido ',"") ; //md5(binary contenido) as md5_contenido,
+ //$md5_contenido = $md5_contenido[0];
+ $contenido = "$contenido_campo[0] ";
+ }else {
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $identificador = explode(',',$row['identificador']);
+ $identificador = $identificador[0];
+ $contenido_campo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $contenido .= "$contenido_campo[0] ";
+ }
+ }
+// $contenido .="$consulta";
+$existe[]= $control;
+$existe[] = $timestamp;
+$existe[] = $consulta;
+$existe[] = "$contenido";
+$existe[] = $md5_contenido;
+$existe[] = $orden;
+$existe[] = $id_usuario;
+$existe[] = $ip;
+}
+return $existe;
+ }
+
+function formulario_grabar($formulario) {
+ $debug="";
+ $respuesta = new xajaxResponse('utf-8');
+ $datos="";
+ $envio="";
+ //$formulario = mysql_seguridad($formulario);
+ $ip = obtener_ip();
+ $graba_ip = "INET_ATON('".$ip."') ";
+ $consulta_grabada ='0';
+ $control = $formulario['control']; //
+ $form_id = $formulario['form_id']; //
+ $tipo = $formulario['tipo']; //
+ if(@$formulario['imagen'] !=''){$formulario[0][0] = $formulario['imagen'];}
+
+ $consulta_form = "SELECT * FROM form_contenido_campos,form_campos
+ WHERE form_contenido_campos.id_campo = form_campos.id
+ AND id_form = '$form_id' ";
+ $link=Conectarse();
+ mysqli_query("SET NAMES 'utf8'");
+// $sql=mysqli_query($consulta_form,$link);
+
+// if (mysqli_num_rows($sql)!='0'){
+// mysqli_data_seek($sql, 0);
+// while( $row = mysqli_fetch_array( $sql ) ) {
+
+
+//////
+ if(isset ( $_SESSION['id_empresa'])){$id_empresa = $_SESSION['id_empresa']; }else{
+ $id_empresa = remplacetas('form_id','id',$formulario['form_id'],'id_empresa',"") ;
+ $id_empresa = $id_empresa[0];
+ }
+foreach($formulario as $c=>$v){
+
+
+//LISTA ELEMENTOS DE UN ARRAY
+if (is_array($v) ){
+ foreach($v as $C=>$V){
+ $campo_tipo = remplacetas("form_campos","id",$c,"campo_tipo","");
+ $campo_nombre = remplacetas("form_campos","id",$c,"campo_nombre","");
+ if($V != '') {
+
+
+
+$datos .= "$$c = \$formulario['$c'][$C]; // $V /$campo_tipo[0]
";
+ if($campo_tipo[0] =='12' OR $campo_tipo[0] =='13') {
+ $validar = validar_email($V);
+ if($validar == '0') {
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ $respuesta->addAlert("Se necesita un email válido");
+ return $respuesta;
+ }else {
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-success ");
+ }
+ }
+ if($campo_tipo[0] =='3' ) {
+ $validar = is_numeric($V);
+ if(is_numeric($V) ) {
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-success ");
+ //return $respuesta;
+ }else{
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ $respuesta->addAlert("El campo $campo_nombre[0] solo acepta valores numéricos");
+ return $respuesta;
+ }
+ }
+
+ if($campo_tipo[0]=='17') {
+ $limite = limite("$c",'','limite');
+ $size= strlen($V);
+ $restante = ($limite - $size);
+ if( $restante < 0) {
+
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addAlert("ATENCION: El campo $campo_nombre[0] no debe tener mas de $limite caractéres, sobran $restante");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ return $respuesta;
+ }
+ }
+
+
+
+ }
+else{ //busca campos vacios
+
+$campo_obligatorio = remplacetas("form_contenido_campos","id_campo",$c,"obligatorio","id_form = '$formulario[form_id]'");
+if($campo_obligatorio[0] =='1'){
+
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addAlert("ATENCION: El campo $campo_nombre[0] es obligatorio");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ return $respuesta;
+ }
+
+}
+
+$md5 = md5($V);
+$igual = formulario_valor_campo("$form_id","$c","$md5","$formulario[control]","$C");
+$existe = formulario_valor_campo("$form_id","$c","","$formulario[control]","$C");
+//$valor_anterior .= $existe[3]."| ";
+$debug .= "$existe";
+if(!is_null($existe) AND $tipo =='edit' AND $V =='') {
+ $consulta_vacio ="
+ INSERT INTO `form_datos` (`id`, `id_campo`,`orden`,`form_id`, `id_usuario`, `contenido`, `timestamp`, `control`, ip , id_empresa)
+ VALUES (NULL, '$c','$C', '$formulario[form_id]', '$_SESSION[id]', '', UNIX_TIMESTAMP(), '$formulario[control]',$graba_ip,'$id_empresa');";
+
+ $sql=mysqli_query($consulta_vacio,$link);
+ if($sql) {
+ $consulta_grabada ='1';
+ }
+}
+if(is_null($igual) ){$repetido = 0;}else{
+$repetido = 1;
+}
+
+
+//return $respuesta;
+//$respuesta->addAlert("$debug");
+//return $respuesta;
+$debug .= "V = $V /$c /$repetido / $igual ";
+if(($V !='' ) && (is_numeric($c)) AND $repetido !=1 ) {
+//$debug = "Hola mundo";
+ $V = mysqli_real_escape_string($link,$V);
+ $campo_tipo = remplacetas("form_campos","id",$c,"campo_tipo","");
+
+if(@$campo_tipo[0] =="18") {
+ $V = md5("$V");
+}else{$V=$V;}
+
+
+ $consulta ="
+ INSERT INTO `form_datos` (`id`, `id_campo`,`orden`,`form_id`, `id_usuario`, `contenido`, `timestamp`, `control`, ip , id_empresa)
+ VALUES (NULL, '$c','$C', '$formulario[form_id]', '".@$_SESSION[id]."', '$V', UNIX_TIMESTAMP(), '$formulario[control]',$graba_ip,'$id_empresa');";
+
+ $sql=mysqli_query($consulta,$link);
+ $debug .= "$consulta = $sql ,";
+ if($sql) {
+ $consulta_grabada ='1';
+ }
+ }
+
+ } ///fin del array
+
+ }///fin del array primario
+ else {
+ if($v !='') { //$datos .= "$$c = \$formulario['$c']; // $v
";
+ }
+ }
+ }
+
+
+
+
+// }
+// }
+
+$debug .= " $link ";
+//$respuesta->addAssign("pie_modal","innerHTML","$debug");
+
+if($consulta_grabada =='1') {
+if($tipo == "embebidoX" )
+{
+ $exito ="
+
+ $formulario[mensaje]
+
+ ";
+ $mail = '1';
+ }
+ elseif($tipo == "solocampos" ){
+
+
+ $exito ="
+
+ $formulario[mensaje]
+
+ ";
+
+ $mail='0';
+ }
+ else{
+ $campo_envio = buscar_campo_tipo($formulario['form_id'],"13");
+ if($campo_envio[0] != "") {
+$envio = email_contenido("$formulario[form_id]","$formulario[control]","$campo_envio[0]",'');
+ }
+
+if($tipo = "embebido") {
+$otro_formulario ="
+
+ Llenar otro formulario
+
+";
+}else {
+ $otro_formulario = "
+
+ Llenar otro formulario
+
+
+ ";
+}
+$impresion = formulario_imprimir("","$formulario[control]","preview");
+$mensaje_agradecimiento = remplacetas('form_parametrizacion','campo',"$formulario[form_id]",'descripcion'," tabla='form_id' and opcion = 'mensaje_envio'") ;
+//$impresion = mostrar_identificador($formulario['control']);
+ $exito ="
+
+ $mensaje_agradecimiento[0]
+
+
+ $impresion
+
+
+ Gracias por llenar el formulario $formulario[form_nombre]
+
+
+ $otro_formulario
+
+
+ $envio
+
+
+
";
+
+// $mail ='1';
+ }
+
+//if($mail =='1') {
+
+ //$propietario = remplacetas('form_id','id',$formulario[form_id],'propietario',"") ;
+ //$propietario = remplacetas('usuarios','id',$propietario[0],'email',"") ;
+ $email_envio = remplacetas('form_parametrizacion','campo',"$formulario[form_id]",'descripcion'," tabla='form_id' and opcion = 'email'") ;
+ if($email_envio[0] !="") {
+ $impresion = formulario_imprimir("","$formulario[control]","preview");
+ $id_empresa = remplacetas('form_id','id',$formulario[form_id],'id_empresa',"") ;
+ $id_empresa = $id_empresa[0];
+
+ $direccion = remplacetas("empresa","id",$id_empresa,"direccion","");
+ $telefono = remplacetas("empresa","id",$id_empresa,"telefono","");
+ $web = remplacetas("empresa","id",$id_empresa,"web","");
+ $email = remplacetas("empresa","id",$id_empresa,"email","");
+ $imagen = remplacetas("empresa","id",$id_empresa,"imagen","");
+ $razon_social = remplacetas("empresa","id",$id_empresa,"razon_social","");
+ $slogan = remplacetas("empresa","id",$id_empresa,"slogan","");
+ $nombre_formulario = remplacetas("form_id","id",$formulario[form_id],"nombre","");
+
+$headers = "MIME-Version: 1.0\r\n";
+$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
+$headers .= "From: $razon_social[0] <$email[0]>\r\n";
+$headers .= "Reply-To: $email[0]\r\n";
+$headers .= "Return-path: $email[0]\r\n";
+$headers .= "Cc: $email_envio[0]" . "\r\n";
+
+$asunto= "$nombre_formulario[0]";
+$cuerpo ="
+$mensaje_agradecimiento[0]
+$impresion
+Se ha completado el formulario $nombre_formulario[0]
+Puede revisar los datos en $_SESSION[site]i$formulario[control]
+Saludos de MILFS
+";
+ if(mail("$email[0]","$asunto","$cuerpo","$headers")){ $exito .=""; }else {$exito .="error enviando correo";}
+ //$exito .= "$email[0] $headers ";
+ }
+ /// }
+ $respuesta->addAssign("div_$control","innerHTML","$exito ");
+ return $respuesta;
+ }else{
+ $mensaje ="
+
+
Todo bien pero al parecer no se moficaron registros ";
+ $respuesta->addAssign("div_$control","innerHTML","$mensaje");
+ }
+//$respuesta->addAssign("respuesta_$control","innerHTML","$resultado");
+return $respuesta;
+}
+$xajax->registerFunction("formulario_grabar");
+
+function mysql_seguridad($inp) {
+ if(is_array($inp))
+ return array_map(__METHOD__, $inp);
+
+ if(!empty($inp) && is_string($inp)) {
+ return str_replace(array('\\', "\0", "'", '"', "\x1a"), array('\\\\', '\\0', "\\*", "\\*", '\\Z'), $inp);
+ }
+
+ return $inp;
+}
+
+function formulario_campos_render_multiple($id_campo,$id_form,$control,$item) {
+
+ $consulta = "SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador
+ FROM `form_datos`
+ WHERE form_id = '$id_form'
+ AND id_campo ='$id_campo'
+ AND control ='$control'
+ group by orden ORDER BY orden asc";
+ $link=Conectarse();
+ //$resultado .= "$consulta";
+ mysqli_query("SET NAMES 'utf8'");
+ $sql =mysqli_query($consulta,$link);
+ if (mysqli_num_rows($sql)!='0' ){
+ mysqli_data_seek($sql, 0);
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ //$identificador = $row[identificador];
+ $resultado .= $identificador;
+ $resultado .= formulario_campos_render($row[id_campo],$id_form,$control,$row[orden],$identificador);
+ $item = $item + 1;
+ }
+ }
+ $resultado .= formulario_campos_render($id_campo,$id_form,'',$item,'');
+
+ return $resultado;
+}
+
+
+
+function formulario_modal($id,$form_respuesta,$control,$tipo) {
+
+ $respuesta = new xajaxResponse('utf-8');
+ $solo_campos ="";
+ $subir_imagen ="";
+
+ if(isset($_SESSION['permiso_identificador'])) {
+ $permiso_identificador = $_SESSION['permiso_identificador'] ;
+ $salir= "Salir
";
+ }
+ else{ $permiso_identificador = ""; $salir="";}
+ $formulario_respuesta = formulario_respuesta("$id","$control");
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa',"",'') ;
+ $id_empresa = $id_empresa[0];
+ $encabezado = empresa_datos("$id_empresa",'encabezado');
+ $pie = "$formulario_respuesta";
+ $pie .= empresa_datos("$id_empresa",'pie');
+ $formulario_descripcion = remplacetas('form_id','id',$id,'descripcion','') ;
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre','') ;
+ $cabecera ="".$formulario_nombre['0']." ".$formulario_descripcion['0']."
";
+
+ $nuevo_formulario = "Llenar otro formulario ";
+if($control !='' AND $tipo =='' ) {
+ $impresion = formulario_imprimir("$id","$control","");
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre','') ;
+ $muestra_form = "$impresion
";
+ $respuesta->addAssign("muestra_form","innerHTML","$muestra_form");
+ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+ $respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+ }
+
+ $modificable = remplacetas('form_id','id',$id,'modificable','') ;
+ if($modificable[0] != "1" and (!isset ( $_SESSION[id]) )) {
+ $resultado ="
Acceso restringido No se puede consultar los datos.";
+ $respuesta->addAssign("muestra_form","innerHTML","$resultado");
+ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+ $respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+ }
+
+
+$consulta = "
+ SELECT * FROM form_id, form_contenido_campos
+ WHERE form_id.id = form_contenido_campos.id_form
+ AND form_id.id = '$id' ORDER BY form_contenido_campos.orden ASC
+ ";
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$sql=mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0'){
+ if($respuesta !='' AND $control !=''){$control =$control;}
+ else{$control = md5(rand(1,99999999).microtime());}
+ $descripcion=mysqli_result($sql,0,"descripcion");
+ $nombre=mysqli_result($sql,0,"nombre");
+ $id_empresa=mysqli_result($sql,0,"id_empresa");
+ $encabezado = empresa_datos("$id_empresa",'encabezado');
+ $pie = empresa_datos("$id_empresa",'pie');
+
+ $cabecera = "
+ $salir
+
+
+
+
+
+
+
+
+
$nombre $descripcion
+
+
+
+
+
";
+
+$campo_imagen = buscar_campo_tipo($id,"15");
+@$campo_imagen_nombre = $campo_imagen[1];
+@$campo_imagen = $campo_imagen[0];
+
+
+if (@$campo_imagen[0] != "") {
+$subir_imagen = subir_imagen("$id","$campo_imagen"."[0]");
+ }
+ $muestra_form = "
+
+
+
+
+
+
+
+
+
+
+ ";
+ if($tipo=="edit") {
+
+ //if(null === @$_SESSION['id'] AND $permiso_identificador != $control) {
+ if($_SESSION['id_empresa'] !== $id_empresa AND $permiso_identificador != $control) {
+ $password = buscar_campo_tipo($id,"18");
+
+ $aviso = "
ATENCIÓNNo está autorizado ";
+ $seguridad ="
+
+
+ ";
+ $resultado ="
+
+
+ $aviso
+ $seguridad
+
+ ";
+ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+ $respuesta->addAssign("muestra_form","innerHTML","$resultado");
+ $pie = empresa_datos("$id_empresa",'pie');
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+ }
+ //// si no esta logueado nose puede editar ////
+ $control_edit = "$control";
+
+ }else {$control_edit = "";}
+
+ mysqli_data_seek($sql, 0);
+ while( $row = mysqli_fetch_array( $sql ) ) {
+ $tipo_campo = remplacetas("form_campos","id","$row[id_campo]","campo_tipo","");
+ //if($tipo_campo[0] =="24") { $row[multiple] = "1";}
+ if($row['multiple'] ==='1' AND $tipo =='edit'){
+ $campos = formulario_campos_render_multiple($row['id_campo'],$id,$control_edit);
+ }else{
+ $campos = formulario_campos_render($row['id_campo'],$id,$control_edit,'','');
+ }
+ $muestra_form .= "$campos ";
+ $solo_campos .= "$campos ";
+ }
+ $muestra_form .="
+
+ ";
+ }
+
+$muestra_form .="
+
+
+
";
+ $muestra_form = "$muestra_form
";
+if($tipo=='campos') {
+ return $solo_campos;
+}
+if($tipo=='embebido') {
+ return $muestra_form;
+}
+
+$respuesta->addAssign("muestra_form","innerHTML","$muestra_form");
+$respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+$respuesta->addAssign("pie_modal","innerHTML","$pie");
+$respuesta->addscript("$('#muestraInfo').modal('toggle')");
+//$respuesta->addscript("$('textarea').markdown({autofocus:false,savable:false})");
+//$respuesta->addscript("$(document).ready(function () { $(\"#24[0]\").cleditor(); })");
+//$(document).ready(function () { $("#input").cleditor(); });
+
+
+
+return $respuesta;
+}
+$xajax->registerFunction("formulario_modal");
+
+
+
+function limpia_div($capa){
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($capa,"style.padding","0px");
+$respuesta->addClear($capa,"innerHTML");
+
+return $respuesta;
+}$xajax->registerFunction("limpia_div");
+
+
+function select_key($tabla,$key,$value,$descripcion,$onchange,$where,$nombre,$valor){
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+$campo1 = $campos[0];
+$campo2 = $campos[1];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysqli_query("SET NAMES 'utf8'");
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}if($where =='AGRUPADO'){$group="GROUP BY $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT $value, $descripcion FROM $tabla WHERE 1 $w $group ORDER BY $campo1 ";
+$sql=mysqli_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$key;}else{$name = "$nombre";}
+if (mysqli_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="";}else{$vacio =" >> Nuevo $descripcion << ";}
+$resultado="
+Seleccione
+ " ;
+while( $row = mysqli_fetch_array( $sql ) ) {
+if($row[$key]=="") {$resultado.="";}else{
+if($row[$key] ==="$valor"){$selected="selected";}else{$selected ="";}
+
+$resultado .= " ".substr($row[$campo1], 0, 150 )." ".substr($row[$campo2], 0, 30 )." ";
+ }
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function select($tabla,$value,$descripcion,$onchange,$where,$nombre,$valor){
+$group ="";
+@$valor=$valor;
+@$value =$value;
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+@$campo1 = $campos[0];
+@$campo2 = $campos[1];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysqli_query("SET NAMES 'utf8'");
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}if($where =='AGRUPADO'){$group="GROUP BY $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT $value, $descripcion FROM $tabla WHERE 1 $w $group ORDER BY $campo1 ";
+$sql=mysqli_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+if (mysqli_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="Todos los valores ";}else{$vacio =" ";}
+$resultado="
+$nombre $vacio
+ " ;
+while( $row = mysqli_fetch_array( $sql ) ) {
+if($row[$value]=="") {$resultado.="";}else{
+if($row[$value] ==="$valor"){$selected="selected";}else{$selected ="";}
+$mostrar_id = "[$row[$value]]";
+$resultado .= " ".substr(@$row[$campo1], 0, 150 )." ".substr(@$row[$campo2], 0, 30 )." $mostrar_id ";
+ }
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function select_empresa($tabla,$value,$descripcion,$onchange,$where,$nombre,$valor,$id_empresa){
+ $w ="";
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+$campo1 = $campos[0];
+@$campo2 = $campos[1];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysqli_query("SET NAMES 'utf8'");
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}if($where =='AGRUPADO'){$group="GROUP BY $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT $value, $descripcion FROM $tabla WHERE id_empresa = '$id_empresa' $w $group ORDER BY $campo1 ";
+$sql=mysqli_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+if (mysqli_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="Todos los valores ";}else{$vacio =" ";}
+$resultado="
+$nombre $vacio
+ " ;
+while( $row = mysqli_fetch_array( $sql ) ) {
+if($row[$value]=="") {$resultado.="";}else{
+if($row[$value] ==="$valor"){$selected="selected";}else{$selected ="";}
+$mostrar_id = "[$row[$value]]";
+$resultado .= " ".substr(@$row[$campo1], 0, 150 )." ".substr(@$row[$campo2], 0, 30 )." $mostrar_id ";
+ }
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function select_edit($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysqli_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysqli_num_rows($sql)!='0'){
+
+$resultado="
+Seleccione
+ " ;
+while( $row = mysqli_fetch_array( $sql ) ) {
+if($row['campo_valor'] ==="$valor"){$selected="selected";}else{$selected ="";}
+$resultado .= " $row[campo_valor] ";
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+
+
+
+function radio_agrupado_linea($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores , form_campos WHERE form_campos_valores.id_form_campo = form_campos.id AND id_form_campo ='$id_campo' ";
+$sql=mysqli_query($consulta,$link);
+$valor = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysqli_num_rows($sql)!='0'){
+$nombre_linea = mysqli_result($sql,0,"campo_nombre");
+$descripcion_linea = mysqli_result($sql,0,"campo_descripcion");
+ mysqli_data_seek($sql, 0);
+while( $row = mysqli_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor[0]"){$selected="checked";}else{$selected ="";}
+$lineas .= " $row[campo_valor] ";
+ }
+$resultado .= "$nombre_linea
$lineas ";
+ }else{$resultado = " No hay resultados $consulta
";}
+
+return $resultado;
+}
+
+function radio_linea($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores , form_campos WHERE form_campos_valores.id_form_campo = form_campos.id AND id_form_campo ='$id_campo' ";
+$sql=mysqli_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysqli_num_rows($sql)!='0'){
+$nombre_linea = mysqli_result($sql,0,"campo_nombre");
+$descripcion_linea = mysqli_result($sql,0,"campo_descripcion");
+ mysqli_data_seek($sql, 0);
+while( $row = mysqli_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor"){$selected="checked";}else{$selected ="";}
+$lineas .= "$row[campo_valor] ";
+ }
+$resultado .= "$nombre_linea
$lineas ";
+ }else{$resultado = " No hay resultados $consulta
";}
+
+return $resultado;
+}
+function radio_edit($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysqli_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysqli_num_rows($sql)!='0'){
+
+$resultado="
+
+ " ;
+while( $row = mysqli_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor"){$selected="checked";}else{$selected ="";}
+$resultado .= " $row[campo_valor]
";
+ }
+$resultado .= "";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+
+function checkbox_edit($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysqli_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysqli_num_rows($sql)!='0'){
+ $name = explode("[",$name);
+ $name = $name[0];
+ $fila="0";
+
+while( $row = mysqli_fetch_array( $sql ) ) {
+ $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' and contenido ='$row[campo_valor]' ");
+
+ $nombre= "$name"."[".$fila."]";
+//if($row[campo_valor] ==="$valor"){$selected="checked";}else{$selected ="";}
+if($value[0] ==="$row[campo_valor]"){$selected="checked";}else{$selected ="";}
+$resultado .= "
+
+
+ $row[campo_valor] $selected
+
+
";
+ $fila++;
+ }
+$resultado .= "";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+
+function rango($tabla,$campo,$key,$valor,$selected,$nombre,$onchange){
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT min($campo) as min , max($campo) as max FROM $tabla WHERE $key ='$valor' ";
+$sql=mysqli_query($consulta,$link);
+
+if (mysqli_num_rows($sql)!='0'){
+ $min=mysqli_result($sql,0,"min");
+ $max=mysqli_result($sql,0,"max");
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+$resultado="
+ $min
+
+ $max $selected
+
" ;
+
+
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function limite($id_campo,$contenido,$tipo){
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT campo_valor FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysqli_query($consulta,$link);
+
+if (mysqli_num_rows($sql)!='0'){
+ $limite=mysqli_result($sql,0,"campo_valor");
+
+ }else{}
+ if($tipo =='limite') { return $limite;}
+$respuesta = new xajaxResponse('utf-8');
+if($contenido !='') {
+
+ $size= strlen($contenido);
+ $restante = ($limite - $size);
+ $div_input = "input_$id_campo";
+ if( $restante<=1) {
+$respuesta->addAssign("aviso_$id_campo","className","alert-danger ");
+$respuesta->addAssign("$div_input","className","has-error ");
+ }
+ elseif( $restante<=10) {
+$respuesta->addAssign("aviso_$id_campo","className","alert-warning ");
+$respuesta->addAssign("$div_input","className","has-warning ");
+ }else{
+$respuesta->addAssign("aviso_$id_campo","className","alert-succes ");
+$respuesta->addAssign("$div_input","className","has-success ");
+}
+ $respuesta->addAssign("aviso_$id_campo","innerHTML","$restante");
+
+ return $respuesta;
+ }
+ $respuesta->addAssign("aviso_$id_campo","innerHTML","$limite");
+ return $respuesta;
+ //return $limite;
+}
+$xajax->registerFunction("limite");
+
+function confirma_campo($valor_1,$valor_2,$campo,$campo_confirmacion){
+ $respuesta = new xajaxResponse('utf-8');
+ $pos = strpos($campo,"email");
+
+if($pos == "") { //// si no es un email
+ }
+ else {//// si es un email se revisa
+ $email = validar_email("$valor_1");
+ if($email === 0 ) {
+ $respuesta->addAssign("$campo","value","");
+ $respuesta->addAssign("$campo"."_grupo","className"," input-group has-error ");
+ $respuesta->addAssign("$campo_confirmacion"."_grupo","className"," input-group has-error ");
+ $respuesta->addAlert("El email no es valido ");
+ $respuesta->addScript("document.getElementById('$campo').focus(); ");
+ return $respuesta;
+ }
+ else{
+ }
+ }
+
+
+
+ if($valor_1 != $valor_2){$resultado = "Los valores NO son iguales";
+ $respuesta->addAlert("$resultado");
+ /// $respuesta->addAssign("$campo","style.color","red");
+
+
+ $respuesta->addAssign("$campo","value","$pos");
+ $respuesta->addAssign("$campo_confirmacion","value","");
+ $respuesta->addAssign("$campo"."_grupo","className"," input-group has-error ");
+ $respuesta->addAssign("$campo_confirmacion"."_grupo","className"," input-group has-error ");
+ $respuesta->addScript("document.getElementById('$campo').focus(); ");
+ // document.getElementById('mobileno').focus();
+
+
+ }else{
+ //$respuesta->addAssign("$campo_confirmacion","style.color","green");
+
+ $respuesta->addAssign("$campo","className"," form-control ");
+ $respuesta->addAssign("$campo_confirmacion","className"," form-control ");
+ $respuesta->addAssign("$campo"."_grupo","className"," input-group has-success ");
+ $respuesta->addAssign("$campo_confirmacion"."_grupo","className"," input-group has-success ");
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("confirma_campo");
+
+
+function validar_campo($valor,$campo,$tabla,$div,$id){
+$valor = mysql_seguridad($valor);
+$respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysqli_query("SET NAMES 'utf8'");
+$consulta="SELECT $campo FROM $tabla WHERE $campo = '$valor' LIMIT 1";
+$sql =mysqli_query($consulta,$link);
+if (mysqli_num_rows($sql)!='0' ){
+$verificacion = "atencion"; $existe='';
+
+$respuesta->addAssign($campo,"value","");
+///$respuesta->addAlert("El valor $valor $existe existe");
+$resultado = "Grrr $valor $existe existe ";
+$respuesta->addAssign("$id","style.backgroundColor","pink");
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+ }else {$verificacion ="check"; $existe='NO';}
+$resultado = "Ok, buen $campo ! ";
+$respuesta->addAssign("$id","style.backgroundColor","#CBE7CB");
+//$resultado .= "$valor,$campo,$tabla,$div";
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+
+return $respuesta;
+}
+$xajax->registerFunction("validar_campo");
+
+
+function comprobar_email($email,$tipo,$campo){
+$email = mysql_seguridad($email);
+$respuesta = new xajaxResponse('utf-8');
+if($tipo =='tercero') {$id_campo='tercero_email';}
+
+
+else{$id_campo = 'email';}
+
+if($campo !=''){
+$id_campo="$campo";
+}
+
+
+if ($email == "" AND $tipo==''){
+ $respuesta->addAlert("El campo email es obligatorio ");
+ $respuesta->addAssign("$id_campo","style.backgroundColor","pink");
+ $respuesta->addAssign("$id_campo","value","");
+ return $respuesta;
+ }
+
+ $mail_correcto = 0;
+ //compruebo unas cosas primeras
+ if ((strlen($email) >= 6) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@")){
+ if ((!strstr($email,"'")) && (!strstr($email,"\"")) && (!strstr($email,"\\")) && (!strstr($email,"\$")) && (!strstr($email," "))) {
+ //miro si tiene caracter .
+ if (substr_count($email,".")>= 1){
+ //obtengo la terminacion del dominio
+ $term_dom = substr(strrchr ($email, '.'),1);
+ //compruebo que la terminación del dominio sea correcta
+ if (strlen($term_dom)>1 && strlen($term_dom)<5 && (!strstr($term_dom,"@")) ){
+ //compruebo que lo de antes del dominio sea correcto
+ $antes_dom = substr($email,0,strlen($email) - strlen($term_dom) - 1);
+ $caracter_ult = substr($antes_dom,strlen($antes_dom)-1,1);
+ if ($caracter_ult != "@" && $caracter_ult != "."){
+ $mail_correcto = 1;
+ }
+ }
+ }
+ }
+ }
+ if ($mail_correcto AND $tipo=='' )
+ {
+$consulta= "SELECT email FROM usuarios WHERE email = '$email' LIMIT 1 ";
+ $link=Conectarse();
+$sql=mysqli_query($consulta,$link);
+$revisa=mysqli_result($sql,0,"email");
+if ($revisa != ''){
+
+ $respuesta->addAlert("$email: ya está registrado ");
+ $respuesta->addAssign("email","style.color","red");
+ $respuesta->addAssign("email","value","");
+ return $respuesta;
+ }
+ $respuesta->addAssign("email","style.color","green");}
+ elseif ($mail_correcto AND $tipo==='revisar' ) {
+ $revisar = remplacetas("usuarios","email",$email,"email","");
+ if($revisar[0] != '') {
+
+ $respuesta->addAssign("$campo","style.color","white");
+ $respuesta->addAssign("$id_campo","style.backgroundColor","green");
+ }else{
+ $respuesta->addAlert("$email: No existe en el sistema)");
+ $respuesta->addAssign("$campo","value","");
+ }
+ return $respuesta;
+ }
+
+ elseif ($mail_correcto AND $tipo==='tercero' ) {
+ $documento = remplacetas("terceros","email",$email,"documento","");
+ if($documento[1] =='') { /// si el tercero NO existe
+
+ }else { /// si el tercero existe en el sistema
+
+ $tipo_persona = remplacetas("terceros","id",$documento[1],"tipo_persona","");
+
+ if($tipo_persona[0] =='1') {
+ $razon_social = remplacetas("terceros","id",$documento[1],"razon_social","");
+ $resultado .= " $razon_social[0]] Nit: $documento[0]";
+ } else {
+ $primer_nombre = remplacetas("terceros","id",$documento[1],"p_nombre","");
+ $segundo_nombre = remplacetas("terceros","id",$documento[1],"s_nombre","");
+ $primer_apellido = remplacetas("terceros","id",$documento[1],"p_apellido","");
+ $segundo_apellido = remplacetas("terceros","id",$documento[1],"s_apellido","");
+ $resultado .=" \r $primer_nombre[0] $segundo_nombre[0] $primer_apellido[0] $segundo_apellido[0] \r Documento: $documento[0]";
+ }
+
+ $respuesta->addAlert("$email: $resultado");
+ $respuesta->addAssign("tercero_documento","value","$documento[0]");
+ $respuesta->addAssign("tercero_primer_nombre","value","$primer_nombre[0]");
+ $respuesta->addAssign("tercero_segundo_nombre","value","$segundo_nombre[0]");
+ $respuesta->addAssign("tercero_primer_apellido","value","$primer_apellido[0]");
+ $respuesta->addAssign("tercero_segundo_apellido","value","$segundo_apellido[0]");
+ $respuesta->addAssign("tercero_razon_social","value","$razon_social[0]");
+ $respuesta->addAssign("tercero_id","value","$documento[1]");
+
+ }
+
+ }
+ else
+ {$respuesta->addAlert("$email: no es un correo válido");
+ $respuesta->addAssign("$id_campo","style.backgroundColor","pink");
+ $respuesta->addAssign("$id_campo","value","");
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("comprobar_email");
+
+function obtener_ip()
+
+{
+
+ if (isset($_SERVER["HTTP_CLIENT_IP"]))
+ {
+ return $_SERVER["HTTP_CLIENT_IP"];
+ }
+ elseif (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
+ {
+ return $_SERVER["HTTP_X_FORWARDED_FOR"];
+ }
+ elseif (isset($_SERVER["HTTP_X_FORWARDED"]))
+ {
+ return $_SERVER["HTTP_X_FORWARDED"];
+ }
+ elseif (isset($_SERVER["HTTP_FORWARDED_FOR"]))
+ {
+ return $_SERVER["HTTP_FORWARDED_FOR"];
+ }
+ elseif (isset($_SERVER["HTTP_FORWARDED"]))
+ {
+ return $_SERVER["HTTP_FORWARDED"];
+ }
+ else
+ {
+ return $_SERVER["REMOTE_ADDR"];
+ }
+
+ }
+
+function milfs(){
+ $crear_campos = formulario_crear_campo('','','');
+ $listado = formulario_listado('','');
+ //$consultas = formulario_consultar('','');
+ $importador = formulario_importador('');
+ $limpiar_cache = borrar_tmp('');
+ $configuracion= configuracion('');
+
+ $login = login_boton('');
+ $menu =
+"
+
+
+
+ $crear_campos
+
+ $listado
+
+
+ $configuracion
+
+
+
+
+
";
+
+ return $menu;
+}
+function url_existe($url)
+{
+ $handle = @fopen($url, "r");
+ if ($handle == false)
+ return NULL;
+ fclose($handle);
+ return $url;
+}
+function es_imagen($url)
+ {
+ $imageSizeArray = getimagesize($url);
+ $imageTypeArray = $imageSizeArray[2];
+ return (bool)(in_array($imageTypeArray , array(IMAGETYPE_GIF , IMAGETYPE_JPEG ,IMAGETYPE_PNG )));
+ }
+function parametrizacion($array) {
+ //return $array;
+ $link=Conectarse();
+ mysqli_real_escape_string($link,$array);
+ $accion = $array[accion];
+ $tabla = $array[tabla];
+ $campo = $array[campo];
+ $opcion = $array[opcion];
+ $descripcion= $array[descripcion];
+ $visible= $array[visible];
+ $id= $array[id];
+
+ if($accion =='grabar'){
+ $consulta= "INSERT INTO form_parametrizacion set tabla='$tabla', campo ='$campo',opcion ='$opcion' , descripcion ='$descripcion' ,visible='$visible'";
+ }
+ // return $consulta;
+ $sql=mysqli_query($consulta,$link);
+ if($sql){return "Campo grabado"; }else{return "";}
+
+}
+
+?>
\ No newline at end of file
diff --git a/milfs/funciones/funciones.filtros.php b/milfs/funciones/funciones.filtros.php
index 561ebb1..d1b1031 100644
--- a/milfs/funciones/funciones.filtros.php
+++ b/milfs/funciones/funciones.filtros.php
@@ -45,9 +45,9 @@ $link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
- if (mysql_num_rows($sql)!='0'){
+ if (mysqli_num_rows($sql)!='0'){
- while( $row = mysql_fetch_array( $sql ) ) {
+ while( $row = mysqli_fetch_array( $sql ) ) {
$dato[] =$row;
$lineas .="$row[cantidad] $row[contenido] ";
}
@@ -122,9 +122,9 @@ $consulta = "SELECT * FROM `form_campos_valores` WHERE `id_form_campo` = '$id_ca
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$opciones .="
$row[campo_valor]
@@ -181,9 +181,9 @@ $consulta= "
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$listado = filtro_opciones_campo($row[id_campo],$formulario);
$filtro .="
@@ -238,9 +238,9 @@ $consulta ="SELECT *
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($tipo =='relacion') {
///($form_id,$id_campo,$valor,$cantidad)
$valor_actual = relacion_render("$formulario","$id_campo","$row[contenido]",'0','relacion_drop');
@@ -287,8 +287,8 @@ $lis="";
$consulta = "SELECT *,$value, $descripcion FROM $tabla WHERE 1 $group ORDER BY $campo1 ";
$sql=mysqli_query($consulta,$link);
- if (mysql_num_rows($sql)!='0'){
- while( $row = mysql_fetch_array( $sql ) ) {
+ if (mysqli_num_rows($sql)!='0'){
+ while( $row = mysqli_fetch_array( $sql ) ) {
if($row[$value]=="") {$resultado.="";}else{
$mostrar_id = "[$row[$value]]";
$lis.= " ".substr(@$row[$campo1], 0, 150 )." ".substr(@$row[$campo2], 0, 30 )." $mostrar_id ";
@@ -370,15 +370,15 @@ $consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador
//$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control $ordenar";
$link=Conectarse();
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
- $control = mysql_result($sql,0,control);
+if (mysqli_num_rows($sql)!='0'){
+ $control = mysqli_result($sql,0,control);
//$contenido = "
+
+
+
+
+
+
+
+
+
+ $tabla_campos
+";
+}else{
+$campos_formulario .= "
";
+while( $row = mysql_fetch_array( $campos ) ) {
+// if($row[campo_tipo] =='8'){
+ $respuesta->addScript("xajax_formulario_opciones_select('$row[campo_tipo]','$campo') ");
+// }
+ $Tipo_campo ="Tipo:
+ ";
+$tipos=mysql_query("
+ SELECT *
+ FROM `form_tipo_campo`
+ WHERE activo = '1'
+ ",$link);
+while( $row_tipo = mysql_fetch_array( $tipos ) ) {
+
+if($row_tipo['id_tipo_campo'] == $row['campo_tipo'] ){
+$Tipo_campo .= " > ".$row_tipo['id_tipo_campo']." - ".$row_tipo['tipo_campo_nombre']." < ";
+ }
+$Tipo_campo .= " ".$row_tipo['id_tipo_campo']." - ".$row_tipo['tipo_campo_nombre']." ";
+}
+$Tipo_campo .="
";
+
+if($row['activo'] =='1'){$activo = "Activo: el campo puede ser usado en formularios ";}
+else{$activo = "Inactivo: El campo NO se usará ";}
+$formulario = "editar_campos";
+$areas = select('form_areas',"id",'nombre','',"id_empresa = '$_SESSION[id_empresa]'",'campo_area',"$row[campo_area]");
+
+$campos_formulario .= "
+
+
+
+
+
+
+
";
+
+ }
+ }///fin de edicion
+
+
+
+$respuesta->addAssign($div,"innerHTML",$campos_formulario);
+
+return $respuesta;
+}
+$xajax->registerFunction("formulario_crear_campo");
+
+function agregar_campos($tipo,$div,$id,$formulario){
+$respuesta = new xajaxResponse('utf-8');
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+if($tipo==''){
+ $div="contenido";
+$resultado = " Editar ";
+print $resultado;
+return;
+ }
+ if($tipo=='consultar_listado'){
+ $consulta="SELECT * FROM form_id WHERE id_empresa = '$_SESSION[id_empresa]' ORDER BY nombre ASC";
+ $sql =mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+$resultado .="Formulario: ";
+$resultado .= "Selecciona ";
+while( $row = mysql_fetch_array( $sql ) ) {
+$resultado .= "$row[nombre] ";
+ }
+$resultado .=" $cerrar";
+ }else {
+$resultado = " No hay formularios para editar
";
+ }
+ }
+
+if ($tipo=='consultar_campos'){
+ $consulta="
+ SELECT form_contenido_campos.id_campo, form_contenido_campos.id,
+ campo_nombre, obligatorio,control,multiple,form_contenido_campos.orden
+ FROM form_contenido_campos, form_campos
+ WHERE form_campos.id_empresa = '$_SESSION[id_empresa]' AND form_contenido_campos.id_form = $id
+ AND form_contenido_campos.id_campo = form_campos.id
+ ORDER BY form_contenido_campos.orden";
+ $sql =mysql_query($consulta,$link);
+ $consulta_nombre="SELECT * FROM form_id WHERE id ='$id'";
+ $sql_nombre =mysql_query($consulta_nombre,$link);
+ $nombre =mysql_result($sql_nombre,0,"nombre");
+ $id_formulario = $id;
+ //if (mysql_num_rows($sql)!='0'){
+$resultado ="$cerrar$nombre
+ ";
+$resultado .= "
+
+ Campo
+
+
+
+
+
+ Orden
+
+
+ Multiple
+
+
+ Borrar
+
+
+
";
+
+while( $row = mysql_fetch_array( $sql ) ) {
+ /* $multiple = remplacetas('form_parametrizacion','campo',"$id",'descripcion'," tabla='form_id' and opcion = '$row[id]' AND descripcion REGEXP '^multiple:' ") ;
+ $multiple = explode(":",$multiple[0]);
+ $multiple = $multiple[1];*/
+
+ //$multiple = $multiple[0];
+ $privado = remplacetas('form_parametrizacion','campo',"$id_formulario",'opcion'," tabla='form_id' AND descripcion ='$row[id_campo]' AND opcion REGEXP '^privacidad:' ") ;
+ $privado = explode(":",$privado[0]);
+ $privado = $privado[1];
+
+
+ //$multiple = $multiple[0];
+$resultado .= "
+
+ $row[id_campo] $row[campo_nombre]
+
+
+ Obligatorio
+
+
+ 0
+
+ 1
+
+
+ Privacidad
+
+ 0
+
+ 1
+
+
+
+
+
+
+
+
";
+ }
+
+$consulta_campos_todos ="SELECT form_campos.id, form_campos.campo_nombre, form_campos.campo_descripcion FROM form_campos WHERE form_campos.id_empresa = '$_SESSION[id_empresa]'
+ ORDER BY campo_nombre ";
+$sql_consulta_campo =mysql_query($consulta_campos_todos,$link);
+
+$crear_nuevo ="
+
+
+
+
+
+
+";
+ while( $row = mysql_fetch_array( $sql_consulta_campo ) ) {
+$valores .= "$row[campo_nombre] [$row[id]] ";
+ }
+$resultado .="
+
+
+
+$crear_nuevo ";
+
+ }/// fin de consultar_campos
+
+if($tipo=='grabar_campos'){
+ if ($id=="nuevo")
+{
+
+
+}
+elseif($id =="") { $div='atencion';$resultado=" Seleccione un campo";}
+else {
+$id_form=func_get_arg(3);
+$consulta = "SELECT id_campo FROM form_contenido_campos WHERE id_empresa = '$_SESSION[id_empresa]' AND id_campo= '$id' AND id_form= $id_form";
+$sql_consulta =mysql_query($consulta,$link);
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}if(mysql_num_rows($sql_consulta) =='0') {
+$microtime = microtime();
+$consulta_grabar=" INSERT INTO form_contenido_campos (
+`id_campo` ,
+`id_empresa` ,
+`id_form` ,
+`obligatorio`,
+`control`
+)
+VALUES (
+'$id', '$id_empresa', '$id_form', '0', md5('$microtime' + rand())
+)";
+$sql_consulta_grabar =mysql_query($consulta_grabar,$link);
+$respuesta->addScript("xajax_agregar_campos('consultar_campos','$div','$id_form')");
+return $respuesta;
+ }else{
+$div='atencion';$resultado=" El campo ya pertenece a esta consulta ";
+ }
+ }
+
+ }///fin de grabar_campos
+
+if($tipo=='eliminar'){
+$confirmar=func_get_arg(3);
+
+
+if($id==''){
+$id_c=func_get_arg(4);
+$capa_original=func_get_arg(5);
+$resultado = "
+ Seguro que desea eliminar el campo de esta consulta?
+ [SI]
+ [NO]
+
+ ";}
+ else{
+ if($id=='x'){ /// si se pasa una x como argumento se regresa a la capa original
+$resultado .= "
+
+ ";
+ }else{
+$consulta="DELETE FROM `form_contenido_campos` WHERE `control` = '$confirmar' LIMIT 1";
+$sql_consulta_eliminar = mysql_query($consulta,$link);
+$div=func_get_arg(5);
+$id_consulta=func_get_arg(4);
+$respuesta->addScript("xajax_agregar_campos('consultar_campos','$div','$id_consulta')");
+
+ }
+ }
+
+ }/// fin de eliminar
+if($tipo == 'obligatorio'){
+if($id == '0'){$id='1';}else{$id='0';}
+$control = func_get_arg(3);
+$consulta= "UPDATE `form_contenido_campos` SET `obligatorio` = '$id' WHERE `control` = '$control' LIMIT 1 ";
+$sql_consulta_grabar =mysql_query($consulta,$link);
+$a ="$id
+ ";
+$respuesta->addAssign($div,"innerHTML",$a);
+return $respuesta;
+
+ }/// fin de obligatorio
+if($tipo == 'orden'){ /// orden
+$control = func_get_arg(3);
+$consulta= "UPDATE `form_contenido_campos` SET `orden` = '$id' WHERE `control` = '$control' LIMIT 1 ";
+$sql_consulta_grabar =mysql_query($consulta,$link);
+$a =" $id
+ ";
+
+$respuesta->addAssign($div,"innerHTML",$a);
+return $respuesta;
+
+ }/// fin de obligatorio
+
+if($tipo == 'prellenado'){
+if($id == '0'){$id='1';}else{$id='0';}
+$control = func_get_arg(3);
+$consulta= "UPDATE `consulta_tipo_campos` SET `prellenado` = '$id' WHERE `control` = '$control' LIMIT 1 ";
+$sql_consulta_grabar =mysql_query($consulta,$link);
+$a ="$id
+ ";
+$respuesta->addAssign($div,"innerHTML",$a);
+return $respuesta;
+
+ }/// fin de oprellenado
+$respuesta->addAssign($div,"style.display","block");
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+
+ }
+$xajax->registerFunction("agregar_campos");
+
+function formulario_nuevo($formulario,$div){
+ $resultado ="";
+ $formulario = mysql_seguridad($formulario);
+ $respuesta = new xajaxResponse('utf-8');
+ //$formulario=mysql_real_escape_string($formulario);
+ $id_empresa= $_SESSION['id'];
+ if($div==''){
+ $div = "contenido";
+
+$resultado .= " Formulario ";
+
+ return $resultado;
+ }
+if($formulario ==''){
+ $formulario_nombre = "nuevo_formulario";
+ $formulario_respuesta = select('form_id','id','nombre','',"id_empresa = '$_SESSION[id_empresa]'",'formulario_respuesta','');
+$resultado .= "
+
+Crear un formulario
+
+ Nombre para el formulario
+
+
+
+ Descripción
+
+
+
+ Formulario anidado con:
+ $formulario_respuesta
+
+
+ Grupo:
+
+
+
+
+ Privado
+
+ Público
+
+
+
+
+
+ Grabar
+
+
+ ";
+
+ }else{
+$control = md5(rand(1,99999999).microtime());
+
+$nombre = $formulario['nombre']; // aa
+$descripcion = $formulario['descripcion']; // dxddc
+$publico = $formulario['publico']; // dxddc
+$grupo = $formulario['grupo'];
+$id_empresa = $_SESSION['id_empresa'];
+
+if($publico =='') {$publico ='0';}
+$propietario= $_SESSION['id'];
+$formulario_respuesta = $formulario['formulario_respuesta']; // dxddc
+$link=Conectarse();
+@$formulario=mysql_real_escape_string($formulario);
+mysql_query("SET NAMES 'utf8'");
+$consulta = "INSERT INTO `form_id` ( `nombre`, `descripcion`, `activo`, `modificable`, `publico`, `propietario`, `formulario_respuesta`, `id_empresa`)
+VALUES ('$nombre', '$descripcion', '1', '1', '$publico', '$propietario','$formulario_respuesta','$id_empresa');";
+$sql=mysql_query($consulta,$link);
+$ultimo_id = mysql_insert_id();
+ if($grupo !="") {
+ $consulta_grupo = "INSERT INTO form_grupo set id = '$ultimo_id',grupo = '$grupo' ,id_empresa= '$id_empresa'";
+ $sql_grupo=mysql_query($consulta_grupo,$link);
+ }
+
+$respuesta->addscript("xajax_formulario_listado('','contenido'); ");
+}
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+}$xajax->registerFunction("formulario_nuevo");
+
+
+function formulario_listado($filtro_grupo,$div){
+ $item="";
+ $grupo_formularios="";
+if ( !isset ( $_SESSION['id_empresa'] ) ) {
+ $respuesta = new xajaxResponse('utf-8');
+$respuesta->addRedirect("index.php");
+return $respuesta;
+}
+
+ if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];} if($div==''){
+ $div = "contenido";
+ if(isset($_SESSION['grupo_formularios'])) { $sesion_grupo_formularios = $_SESSION['grupo_formularios'];}else { $sesion_grupo_formularios = "";}
+$resultado = " Formularios ";
+
+ return $resultado;;
+ }
+$control = md5(rand(1,99999999).microtime());
+$respuesta = new xajaxResponse('utf-8');
+$_SESSION['grupo_formularios'] = $filtro_grupo;
+
+$link=Conectarse();
+ $id=mysql_real_escape_string('$id');
+mysql_query("SET NAMES 'utf8'");
+if($filtro_grupo =="") {
+$consulta = "SELECT * FROM form_id WHERE id_empresa ='$_SESSION[id_empresa]' ORDER BY orden ASC";
+ }
+else {
+$consulta = "
+SELECT * FROM form_id, form_grupo
+WHERE form_grupo.id = form_id.id
+AND form_grupo.grupo = '$filtro_grupo'
+AND form_id.id_empresa ='$_SESSION[id_empresa]' ORDER BY orden ASC";
+}
+$sql=mysql_query($consulta,$link);
+if($filtro_grupo !="") {
+ $leyenda_filtro_grupo ="Grupo $filtro_grupo ";
+
+ }else{ $leyenda_filtro_grupo ="Formularios "; unset($_SESSION['grupo_formularios']);}
+$resultado_link = " Formularios ";
+$respuesta->addAssign("link_formulario","innerHTML",$resultado_link);
+
+
+$divider = 1;
+$columnas = intval(12/$divider);
+ $listado_grupos = select_empresa('form_grupo','grupo','grupo',"xajax_formulario_listado((this.value),'contenido')","AGRUPADO",'','',"$id_empresa");
+ $listado_grupos ="
+
+ Seleccione un grupo de formularios
+ $listado_grupos
+
+
+ ";
+
+ $nuevo_formulario = "
+ ";
+ $resultado = "
+
+ $nuevo_formulario
+
+
+ $listado_grupos
+
+ $leyenda_filtro_grupo
+
+ ";
+
+if (mysql_num_rows($sql)!='0' ){
+ $i =0;
+
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $id= $row['id'];
+ $C = $id;
+
+ $cantidad = formulario_contar($row['id']);
+ if($cantidad >0) {$cantidad ="Llenado: $cantidad veces ";}else{$cantidad = "";}
+ $propietario = remplacetas('usuarios','id',$row['propietario'],'email',"") ;
+ $estado = remplacetas('form_id','id',$id,'publico',"") ;
+ $nombre_formulario = remplacetas('form_id','id',$id,'nombre',"") ;
+ $descripcion_formulario = remplacetas('form_id','id',$id,'descripcion',"") ;
+ $estado = "
+
+ Contenido privado
+
+ Público
+
+ ";
+ $modificable = remplacetas('form_id','id',$id,'modificable',"") ;
+ $modificable = "
+
+ Formulario privado
+
+ Público
+
+ ";
+
+
+ $primer = formulario_uso("$id",'','primer') ;
+ if(@$primer[0] !='') {$primer = "Primer registro: ".date ( "Y-m-d h:i:s" , $primer[0])." ";}else{$primer='';}
+ $ultimo = formulario_uso("$id",'','ultimo') ;
+ @$ultimo_control = $ultimo[1];
+ if(@$ultimo[0] !='') {$ultimo = "Último registro: ".date ( "Y-m-d h:i:s" , $ultimo[0])." ";}else{$ultimo='';}
+
+ $nombre = editar_campo("form_id",$row['id'],"nombre","","","","");
+ $orden = editar_campo("form_id",$row['id'],"orden","","","","");
+ $descripcion = editar_campo("form_id",$row['id'],"descripcion","","","","");
+ $geo = buscar_campo_tipo($id,"14");
+ $email_envio = remplacetas('form_parametrizacion','campo',"$row[id]",'descripcion'," tabla='form_id' and opcion = 'email'") ;
+ $mensaje_envio = remplacetas('form_parametrizacion','campo',"$row[id]",'descripcion'," tabla='form_id' and opcion = 'mensaje_envio'") ;
+ if($geo[0] !='') { $mapa= " Mapa ";}else {$mapa='';}
+
+ if($i % $divider==0) {
+
+//$item .= "";
+ }
+ $i++;
+ $grupo_actual = remplacetas('form_grupo','id',$row['id'],'grupo',"") ;
+ if(is_null($grupo_actual[3])) {
+ $valores_grupo['id']=$row['id'];
+ $valores_grupo['grupo']="";
+ $grupo = "
+
+ ";
+ // $grupo = "Grupo ".editar_campo("form_grupo",$row['id'],"grupo","","","");
+ }else
+ {
+ $grupo = "".editar_campo("form_grupo",$row['id'],"grupo","","","","");
+ }
+
+$item .= "
+
+
+
+
+
+
+
+ Creación: $row[creacion] / $propietario[0]
+ $cantidad
+ $ultimo
+ $primer
+ $mapa
+
+
+
+
+
$row[id]
+
+
+
+
+
+
+
+
+
+
+
+
Agregar o quitar campos
+
+
+
+
+
+
+
+ Nombre: $nombre
+ Descripción: $descripcion
+ Orden: $orden Grupo: $grupo
+
+
+
Mensaje de respuesta
+
+
$mensaje_envio[0]
+
Soporta CSS3, HTML5 y Bootstrap
+
Grabar y previsualizar
+
+
+
+
+
Previsualización
+
+ $mensaje_envio[0]
+
+
+
+
+
+
+
+
+
+
+ $estado
+
+
+ $modificable
+
+
+
+
+
+ ";
+
+
+ if($i%$divider==0) {
+ $item .= "
";
+ }
+
+ }
+
+
+ //$resultado .="";
+ }
+
+
+else{ $resultado .= "
Aún no se han diseñado formularios
";}
+
+ $resultado_formulario ="
+
+ $item
+
";
+ $resultado = "$resultado $resultado_formulario ";
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+return $respuesta;
+}$xajax->registerFunction("formulario_listado");
+
+function formulario_eliminar($id,$tipo) {
+ $respuesta = new xajaxResponse('utf-8');
+ $nombre = remplacetas('form_id','id',$id,'nombre',"") ;
+ $nombre_form = $nombre[0];
+ if($tipo =='') {
+$resultado =" ";
+}elseif($tipo=='cancelar') {
+ $resultado =" Eliminar ";
+}elseif($tipo =='eliminar'){
+$consulta = "DELETE FROM form_id WHERE form_id.id = '$id' ";
+$link=Conectarse();
+ $sql=mysql_query($consulta,$link);
+ if($sql) {
+ $respuesta->addAlert("Se eliminó el formulario \" $nombre_form \" ");
+ $respuesta->addAssign("panel_$id","innerHTML","");
+ return $respuesta;
+
+ }
+}
+else {}
+$respuesta->addAssign("eliminar_$id","innerHTML",$resultado);
+
+return $respuesta;
+}$xajax->registerFunction("formulario_eliminar");
+
+
+function campo_multiple($id_campo,$id_form,$control,$item){
+//if ( !isset ( $_SESSION['id'] ) ) { return;}
+
+ if($item==''){$item=1;}
+ $id= $item;
+$render = formulario_campos_render($id_campo,$id_form,$control,$item+1);
+ $ingredientes = "
+
+ $render
+
+
+
+
+ ";
+ $boton= "".($item+1)."
+ Agregar campo
+
";
+$div = "id_campo_$id_campo"."_".$id;
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($div,"innerHTML",$ingredientes);
+$respuesta->addAssign("boton_".$id_campo."","innerHTML","$boton ");
+return $respuesta;
+
+}
+$xajax->registerFunction("campo_multiple");
+
+
+function formulario_campos_render($id_campo,$id_form,$control,$item,$id_dato){
+$cols ="";
+$style="";
+$campo_multiple="";
+$render="";
+
+$consulta ="
+ SELECT *
+ FROM form_contenido_campos,form_campos, form_tipo_campo
+ WHERE form_contenido_campos.id_form = '$id_form'
+ AND form_contenido_campos.id_campo = '$id_campo'
+ AND form_contenido_campos.id_campo = form_campos.id
+ AND form_tipo_campo.id_tipo_campo = form_campos.campo_tipo ";
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+ $sql=mysql_query($consulta,$link);
+ if (mysql_num_rows($sql)!='0'){
+ if($id_dato !='') {
+ $value = remplacetas('form_datos','id',$id_dato,'contenido'," control = '$control'") ;
+ $multiple='0';
+ $esta_editando =1;
+ }
+ else {
+ $value = remplacetas('form_datos','id_campo',$id_campo,'contenido'," control = '$control'") ;
+ $multiple=mysql_result($sql,0,"multiple");
+ }
+ if($item=='') {$item ="0";}else {$item=$item;}
+
+ if($value[0] !='') {$value= "$value[0]";}ELSE{$value='';}
+ $campo_nombre=mysql_result($sql,0,"campo_nombre");
+ $campo_descripcion=mysql_result($sql,0,"campo_descripcion");
+ $campo_tipo_accion=mysql_result($sql,0,"tipo_campo_accion");
+ $campo_obligatorio=mysql_result($sql,0,"obligatorio");
+ if($campo_obligatorio =='1') {$obligatorio ="danger";}else{$obligatorio ="default";}
+
+ if($campo_tipo_accion == 'text'){$render = " ";}
+ elseif($campo_tipo_accion == 'date'){$render = " ";}
+ elseif($campo_tipo_accion == 'rango'){
+ $rango = rango("form_campos_valores","campo_valor","id_form_campo","$id_campo","$value","".$id_campo."[".$item."]",""); $render = $rango;}
+ elseif($campo_tipo_accion == 'mapa'){
+ $lat="";
+ $lon="";
+ $zoom="";
+ if($value !=""){
+
+ $campos = explode(" ",$value);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+ if($lat =="") {
+ $localizacion = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ;
+ //$render= $localizacion[0];
+ $campos = explode(" ",$localizacion[0]);
+ $lat = $campos[0];
+ $lon = $campos[1];
+ $zoom = $campos[2];
+
+ }
+ }
+ $render .= "
+
+
+
+
+
+ ";
+ $cols='12';
+ }
+elseif($campo_tipo_accion == 'email'){$render = "
+
+ Escriba un email válido
";}
+ elseif($campo_tipo_accion == 'envio'){$render = "
+
+ Se enviará un email
";}
+ elseif($campo_tipo_accion == 'textarea'){
+ $render = " $value ";
+ $cols='12';
+ }
+ //$subir_imagen = subir_imagen('');
+ elseif($campo_tipo_accion == 'imagen'){
+ $style ="display:hidden";
+ // $gps = leer_exif($file);
+ $render= " "; //subir_imagen('',$id_campo[$item]);
+ $cols='12'; }
+
+ elseif($campo_tipo_accion == 'html'){
+ $render = "
+
+ $value ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'limit'){
+ $limite = limite("".$id_campo."[".$item."]",'','limite');
+ $rows = ceil($limite / 50 )+1;
+ $render = "$limite /
+
+
+ $value
+ ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'select'){
+
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = select_edit($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "$select "; $cols='12'; }
+ elseif($campo_tipo_accion == 'radio'){
+ $select = radio_edit($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "$select ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'radio_agrupado_campos'){
+ //radio_agrupado_linea($id_campo,$form_id,$valor,$name,$control)
+ $campos_valores = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ;
+ $mensaje = remplacetas('form_campos','id',$id_campo,'campo_descripcion',"") ;
+ $campos = explode(":",$campos_valores[0]);
+ $titulos = explode(";",$campos[0]);
+ $campos_incluidos = explode(";",$campos[1]);
+ for($i=0;$i$campos_incluidos[$i] ";
+ //$select = radio_agrupado_linea($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "
+
+
+
+ $mensaje[0]
+ $listado_titulos
+ $listado_campos
+
+
+
";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'radio_agrupado_linea'){
+
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = radio_agrupado_linea($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = " ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'checkbox'){
+
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = checkbox_edit($id_campo,$id_form,$value,$id_campo."[".$item."]",$control);
+ $render = "$select ";}
+ elseif($campo_tipo_accion == 'combo'){
+ //$select = select('form_campos_valores','campo_valor','campo_valor','',"id_form_campo = $id_campo",$id_campo."[".$item."]");
+ $select = combo_select($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'relacion'){
+ $select = relacion_select($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'buscador'){
+ $select = buscador_campo($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'base'){
+ $select = buscador_base($id_campo,$id_form,$value,$id_campo."[".$item."]",$control,"");
+ $render = "$select ";}
+ elseif($campo_tipo_accion == 'vinculado'){
+ $vinculado = remplacetas('form_campos_valores','id_form_campo',$id_campo,'campo_valor',"") ;
+ $select = formulario_areas($vinculado[0],'campos');
+ $render = "
+ $select
+ ";
+ $cols='12';
+ }
+ elseif($campo_tipo_accion == 'number'){
+ $render = "
+
+ (solo números)
";}
+
+ elseif($campo_tipo_accion == 'password'){
+ if( $control != "") {
+ $render="";$label=""; $campo_tipo_accion="oculto";
+ }else {
+ $render = "
+
+ ";
+ }
+ //else {}
+ $cols='12'; }
+ elseif($campo_tipo_accion == 'unico'){
+ $render ="
+
";
+ }
+ else{$render = " ";}
+ if($multiple =='1'){
+
+
+ $campo_multiple = "
+
+ ";
+}
+ if($item == 0) { $label = " $campo_nombre ";}
+ else {$label = "$campo_nombre $campo_obligatorio ";}
+ ///// CAMPOS QUE NO SE MOSTRARAN
+ if($campo_tipo_accion == 'imagen'){
+ $label="";
+ $campo_descripcion="";
+ }
+ if($cols =="") {$cols = "6";}
+ $input = "
+
+
+$campo_multiple
+
+ ";
+
+
+if($campo_tipo_accion != "oculto") {
+ $input= $input;
+ }else { $input ="";}
+
+ }
+ return $input;
+}
+
+
+function validar_email($email) {
+
+if (preg_match('/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/',$email)) {
+ return 1;
+}else{
+ return 0;
+}
+}
+
+function formulario_valor_campo_ORIGINAL($perfil,$id_campo,$valor,$id_control){
+
+
+//if($id_control !=""){ $control ="AND `control` = '$id_control'";}else {$control ="";}
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$valor=mysql_real_escape_string($valor);
+if($valor !=""){ $valor ="AND md5(contenido) LIKE '$valor'";}else {$valor ="";}
+$consulta = "SELECT * FROM `form_datos` WHERE `form_id` = '$perfil' AND id_campo='$id_campo' $valor AND `control` = '$id_control' ORDER BY timestamp DESC limit 1";
+$sql =mysql_query($consulta,$link);
+$cant =mysql_num_rows($sql);
+
+if (mysql_num_rows($sql) == '0'){
+ $existe = NULL;
+ }else {
+
+$control=mysql_result($sql,0,"control");
+$timestamp=mysql_result($sql,0,"timestamp");
+mysql_data_seek($sql, 0);
+if($cant === 1) {
+ $contenido=mysql_result($sql,0,"contenido");
+ }else {
+while( $row = mysql_fetch_array( $sql ) ) {
+ $contenido .= "$row[contenido] ";
+ }
+ }
+$existe[]= $control;
+$existe[] = $timestamp;
+$existe[] = $consulta;
+$existe[] = $contenido;
+}
+return $existe;
+ }
+
+
+
+function formulario_valor_campo($perfil,$id_campo,$valor,$id_control,$orden,$timestamp){
+$contenido="";
+if ($timestamp != ""){$where_timestamp = "AND form_datos.timestamp = '$timestamp' ";}ELSE { $where_timestamp = ""; }
+//if($id_control !=""){ $control ="AND `control` = '$id_control'";}else {$control ="";}
+$campo_multiple = remplacetas("form_contenido_campos","id_campo",$id_campo,"multiple"," id_form ='$perfil'");
+$tipo_campo = remplacetas("form_campos","id","$id_campo","campo_tipo","");
+$campo_multiple = $campo_multiple[0];
+if($tipo_campo[0] =="24") {$campo_multiple = "1";}
+/// SI EL CAMPO ES MULTIPLE O CHECK BOX MUESTRA LAS MULTIPLES ENTRADAS
+if($campo_multiple !="1" ){ $limite =" asc limit 1 ";}else {$limite =" asc ";}
+if(@$orden !=""){ $campo_orden =" AND orden ='$orden' ";}else {$campo_orden ="";}
+
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$valor=mysql_real_escape_string($valor);
+if($valor !=""){ $valor ="AND md5(contenido) LIKE '$valor'";}else {$valor ="";}
+/*
+$consulta = "SELECT * FROM `form_datos`
+WHERE `form_id` = '$perfil'
+AND id_campo='$id_campo' $valor
+AND `control` = '$id_control' $campo_orden
+GROUP BY orden
+ORDER BY timestamp $limite ";
+*/
+ $consulta = "SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador
+ FROM `form_datos`
+ WHERE form_id = '$perfil'
+ AND id_campo ='$id_campo' $valor
+ AND control ='$id_control' $campo_orden
+ $where_timestamp
+ group by orden
+ ORDER BY orden $limite";
+
+$sql =mysql_query($consulta,$link);
+$cant =mysql_num_rows($sql);
+
+if (mysql_num_rows($sql) == '0'){
+ $existe = NULL;
+ }else {
+
+$control=mysql_result($sql,0,"control");
+$timestamp=mysql_result($sql,0,"timestamp");
+$orden=mysql_result($sql,0,"orden");
+$id_usuario=mysql_result($sql,0,"id_usuario");
+$ip=mysql_result($sql,0,"ip");
+mysql_data_seek($sql, 0);
+$md5_contenido = "";
+if($cant === 1) {
+ //$contenido=mysql_result($sql,0,"contenido");
+ $identificador=mysql_result($sql,0,"identificador");
+ $identificador = explode(',',$identificador);
+ $identificador = $identificador[0];
+ $contenido_campo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $md5_contenido = $contenido_campo[3];
+ //$md5_contenido = remplacetas('form_datos','id',$identificador,' md5(binary contenido) as md5_contenido ',"") ; //md5(binary contenido) as md5_contenido,
+ //$md5_contenido = $md5_contenido[0];
+ $contenido = "$contenido_campo[0] ";
+ }else {
+while( $row = mysql_fetch_array( $sql ) ) {
+ $identificador = explode(',',$row['identificador']);
+ $identificador = $identificador[0];
+ $contenido_campo = remplacetas('form_datos','id',$identificador,'contenido',"") ;
+ $contenido .= "$contenido_campo[0] ";
+ }
+ }
+// $contenido .="$consulta";
+$existe[]= $control;
+$existe[] = $timestamp;
+$existe[] = $consulta;
+$existe[] = "$contenido";
+$existe[] = $md5_contenido;
+$existe[] = $orden;
+$existe[] = $id_usuario;
+$existe[] = $ip;
+}
+return $existe;
+ }
+
+function formulario_grabar($formulario) {
+ $debug="";
+ $respuesta = new xajaxResponse('utf-8');
+ $datos="";
+ $envio="";
+ //$formulario = mysql_seguridad($formulario);
+ $ip = obtener_ip();
+ $graba_ip = "INET_ATON('".$ip."') ";
+ $consulta_grabada ='0';
+ $control = $formulario['control']; //
+ $form_id = $formulario['form_id']; //
+ $tipo = $formulario['tipo']; //
+ if(@$formulario['imagen'] !=''){$formulario[0][0] = $formulario['imagen'];}
+
+ $consulta_form = "SELECT * FROM form_contenido_campos,form_campos
+ WHERE form_contenido_campos.id_campo = form_campos.id
+ AND id_form = '$form_id' ";
+ $link=Conectarse();
+ mysql_query("SET NAMES 'utf8'");
+// $sql=mysql_query($consulta_form,$link);
+
+// if (mysql_num_rows($sql)!='0'){
+// mysql_data_seek($sql, 0);
+// while( $row = mysql_fetch_array( $sql ) ) {
+
+
+//////
+ if(isset ( $_SESSION['id_empresa'])){$id_empresa = $_SESSION['id_empresa']; }else{
+ $id_empresa = remplacetas('form_id','id',$formulario['form_id'],'id_empresa',"") ;
+ $id_empresa = $id_empresa[0];
+ }
+foreach($formulario as $c=>$v){
+
+
+//LISTA ELEMENTOS DE UN ARRAY
+if (is_array($v) ){
+ foreach($v as $C=>$V){
+ $campo_tipo = remplacetas("form_campos","id",$c,"campo_tipo","");
+ $campo_nombre = remplacetas("form_campos","id",$c,"campo_nombre","");
+ if($V != '') {
+
+
+
+$datos .= "$$c = \$formulario['$c'][$C]; // $V /$campo_tipo[0]
";
+ if($campo_tipo[0] =='12' OR $campo_tipo[0] =='13') {
+ $validar = validar_email($V);
+ if($validar == '0') {
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ $respuesta->addAlert("Se necesita un email válido");
+ return $respuesta;
+ }else {
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-success ");
+ }
+ }
+ if($campo_tipo[0] =='3' ) {
+ $validar = is_numeric($V);
+ if(is_numeric($V) ) {
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-success ");
+ //return $respuesta;
+ }else{
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ $respuesta->addAlert("El campo $campo_nombre[0] solo acepta valores numéricos");
+ return $respuesta;
+ }
+ }
+
+ if($campo_tipo[0]=='17') {
+ $limite = limite("$c",'','limite');
+ $size= strlen($V);
+ $restante = ($limite - $size);
+ if( $restante < 0) {
+
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addAlert("ATENCION: El campo $campo_nombre[0] no debe tener mas de $limite caractéres, sobran $restante");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ return $respuesta;
+ }
+ }
+
+
+
+ }
+else{ //busca campos vacios
+
+$campo_obligatorio = remplacetas("form_contenido_campos","id_campo",$c,"obligatorio","id_form = '$formulario[form_id]'");
+if($campo_obligatorio[0] =='1'){
+
+ $respuesta->addAssign("input_".$c."[".$C."]","className"," form-group has-error ");
+ $respuesta->addAlert("ATENCION: El campo $campo_nombre[0] es obligatorio");
+ $respuesta->addScript("document.getElementById('".$c."[".$C."]').focus(); ");
+ return $respuesta;
+ }
+
+}
+
+$md5 = md5($V);
+$igual = formulario_valor_campo("$form_id","$c","$md5","$formulario[control]","$C");
+$existe = formulario_valor_campo("$form_id","$c","","$formulario[control]","$C");
+//$valor_anterior .= $existe[3]."| ";
+$debug .= "$existe";
+if(!is_null($existe) AND $tipo =='edit' AND $V =='') {
+ $consulta_vacio ="
+ INSERT INTO `form_datos` (`id`, `id_campo`,`orden`,`form_id`, `id_usuario`, `contenido`, `timestamp`, `control`, ip , id_empresa)
+ VALUES (NULL, '$c','$C', '$formulario[form_id]', '$_SESSION[id]', '', UNIX_TIMESTAMP(), '$formulario[control]',$graba_ip,'$id_empresa');";
+
+ $sql=mysql_query($consulta_vacio,$link);
+ if($sql) {
+ $consulta_grabada ='1';
+ }
+}
+if(is_null($igual) ){$repetido = 0;}else{
+$repetido = 1;
+}
+
+
+//return $respuesta;
+//$respuesta->addAlert("$debug");
+//return $respuesta;
+$debug .= "V = $V /$c /$repetido / $igual ";
+if(($V !='' ) && (is_numeric($c)) AND $repetido !=1 ) {
+//$debug = "Hola mundo";
+ $V = mysql_real_escape_string($V);
+ $campo_tipo = remplacetas("form_campos","id",$c,"campo_tipo","");
+
+if(@$campo_tipo[0] =="18") {
+ $V = md5("$V");
+}else{$V=$V;}
+
+
+ $consulta ="
+ INSERT INTO `form_datos` (`id`, `id_campo`,`orden`,`form_id`, `id_usuario`, `contenido`, `timestamp`, `control`, ip , id_empresa)
+ VALUES (NULL, '$c','$C', '$formulario[form_id]', '".@$_SESSION[id]."', '$V', UNIX_TIMESTAMP(), '$formulario[control]',$graba_ip,'$id_empresa');";
+
+ $sql=mysql_query($consulta,$link);
+ $debug .= "$consulta = $sql ,";
+ if($sql) {
+ $consulta_grabada ='1';
+ }
+ }
+
+ } ///fin del array
+
+ }///fin del array primario
+ else {
+ if($v !='') { //$datos .= "$$c = \$formulario['$c']; // $v
";
+ }
+ }
+ }
+
+
+
+
+// }
+// }
+
+$debug .= " $link ";
+//$respuesta->addAssign("pie_modal","innerHTML","$debug");
+
+if($consulta_grabada =='1') {
+if($tipo == "embebidoX" )
+{
+ $exito ="
+
+ $formulario[mensaje]
+
+ ";
+ $mail = '1';
+ }
+ elseif($tipo == "solocampos" ){
+
+
+ $exito ="
+
+ $formulario[mensaje]
+
+ ";
+
+ $mail='0';
+ }
+ else{
+ $campo_envio = buscar_campo_tipo($formulario['form_id'],"13");
+ if($campo_envio[0] != "") {
+$envio = email_contenido("$formulario[form_id]","$formulario[control]","$campo_envio[0]",'');
+ }
+
+if($tipo = "embebido") {
+$otro_formulario ="
+
+ Llenar otro formulario
+
+";
+}else {
+ $otro_formulario = "
+
+ Llenar otro formulario
+
+
+ ";
+}
+$impresion = formulario_imprimir("","$formulario[control]","preview");
+$mensaje_agradecimiento = remplacetas('form_parametrizacion','campo',"$formulario[form_id]",'descripcion'," tabla='form_id' and opcion = 'mensaje_envio'") ;
+//$impresion = mostrar_identificador($formulario['control']);
+ $exito ="
+
+ $mensaje_agradecimiento[0]
+
+
+ $impresion
+
+
+ Gracias por llenar el formulario $formulario[form_nombre]
+
+
+ $otro_formulario
+
+
+ $envio
+
+
+
";
+
+// $mail ='1';
+ }
+
+//if($mail =='1') {
+
+ //$propietario = remplacetas('form_id','id',$formulario[form_id],'propietario',"") ;
+ //$propietario = remplacetas('usuarios','id',$propietario[0],'email',"") ;
+ $email_envio = remplacetas('form_parametrizacion','campo',"$formulario[form_id]",'descripcion'," tabla='form_id' and opcion = 'email'") ;
+ if($email_envio[0] !="") {
+ $impresion = formulario_imprimir("","$formulario[control]","preview");
+ $id_empresa = remplacetas('form_id','id',$formulario[form_id],'id_empresa',"") ;
+ $id_empresa = $id_empresa[0];
+
+ $direccion = remplacetas("empresa","id",$id_empresa,"direccion","");
+ $telefono = remplacetas("empresa","id",$id_empresa,"telefono","");
+ $web = remplacetas("empresa","id",$id_empresa,"web","");
+ $email = remplacetas("empresa","id",$id_empresa,"email","");
+ $imagen = remplacetas("empresa","id",$id_empresa,"imagen","");
+ $razon_social = remplacetas("empresa","id",$id_empresa,"razon_social","");
+ $slogan = remplacetas("empresa","id",$id_empresa,"slogan","");
+ $nombre_formulario = remplacetas("form_id","id",$formulario[form_id],"nombre","");
+
+$headers = "MIME-Version: 1.0\r\n";
+$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
+$headers .= "From: $razon_social[0] <$email[0]>\r\n";
+$headers .= "Reply-To: $email[0]\r\n";
+$headers .= "Return-path: $email[0]\r\n";
+$headers .= "Cc: $email_envio[0]" . "\r\n";
+
+$asunto= "$nombre_formulario[0]";
+$cuerpo ="
+$mensaje_agradecimiento[0]
+$impresion
+ Se ha completado el formulario $nombre_formulario[0]
+Puede revisar los datos en $_SESSION[site]i$formulario[control]
+Saludos de MILFS
+";
+ if(mail("$email[0]","$asunto","$cuerpo","$headers")){ $exito .=""; }else {$exito .="error enviando correo";}
+ //$exito .= "$email[0] $headers ";
+ }
+ /// }
+ $respuesta->addAssign("div_$control","innerHTML","$exito ");
+ return $respuesta;
+ }else{
+ $mensaje ="
+
+
Todo bien pero al parecer no se modicaron registros ";
+ $respuesta->addAssign("div_$control","innerHTML","$mensaje");
+ }
+//$respuesta->addAssign("respuesta_$control","innerHTML","$resultado");
+return $respuesta;
+}
+$xajax->registerFunction("formulario_grabar");
+
+function mysql_seguridad($inp) {
+ if(is_array($inp))
+ return array_map(__METHOD__, $inp);
+
+ if(!empty($inp) && is_string($inp)) {
+ return str_replace(array('\\', "\0", "'", '"', "\x1a"), array('\\\\', '\\0', "\\*", "\\*", '\\Z'), $inp);
+ }
+
+ return $inp;
+}
+
+function formulario_campos_render_multiple($id_campo,$id_form,$control,$item) {
+
+ $consulta = "SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador
+ FROM `form_datos`
+ WHERE form_id = '$id_form'
+ AND id_campo ='$id_campo'
+ AND control ='$control'
+ group by orden ORDER BY orden asc";
+ $link=Conectarse();
+ //$resultado .= "$consulta";
+ mysql_query("SET NAMES 'utf8'");
+ $sql =mysql_query($consulta,$link);
+ if (mysql_num_rows($sql)!='0' ){
+ mysql_data_seek($sql, 0);
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $identificador = explode(',',$row[identificador]);
+ $identificador = $identificador[0];
+ //$identificador = $row[identificador];
+ $resultado .= $identificador;
+ $resultado .= formulario_campos_render($row[id_campo],$id_form,$control,$row[orden],$identificador);
+ $item = $item + 1;
+ }
+ }
+ $resultado .= formulario_campos_render($id_campo,$id_form,'',$item,'');
+
+ return $resultado;
+}
+
+
+
+function formulario_modal($id,$form_respuesta,$control,$tipo) {
+
+ $respuesta = new xajaxResponse('utf-8');
+ $solo_campos ="";
+ $subir_imagen ="";
+
+ if(isset($_SESSION['permiso_identificador'])) {
+ $permiso_identificador = $_SESSION['permiso_identificador'] ;
+ $salir= "Salir
";
+ }
+ else{ $permiso_identificador = ""; $salir="";}
+ $formulario_respuesta = formulario_respuesta("$id","$control");
+ $id_empresa = remplacetas('form_id','id',$id,'id_empresa',"",'') ;
+ $id_empresa = $id_empresa[0];
+ $encabezado = empresa_datos("$id_empresa",'encabezado');
+ $pie = "$formulario_respuesta";
+ $pie .= empresa_datos("$id_empresa",'pie');
+ $formulario_descripcion = remplacetas('form_id','id',$id,'descripcion','') ;
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre','') ;
+ $cabecera ="".$formulario_nombre['0']." ".$formulario_descripcion['0']."
";
+
+ $nuevo_formulario = "Llenar otro formulario ";
+if($control !='' AND $tipo =='' ) {
+ $impresion = formulario_imprimir("$id","$control","");
+ $formulario_nombre = remplacetas('form_id','id',$id,'nombre','') ;
+ $muestra_form = "$impresion
";
+ $respuesta->addAssign("muestra_form","innerHTML","$muestra_form");
+ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+ $respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+ }
+
+ $modificable = remplacetas('form_id','id',$id,'modificable','') ;
+ if($modificable[0] != "1" and (!isset ( $_SESSION[id]) )) {
+ $resultado ="
Acceso restringido No se puede consultar los datos.";
+ $respuesta->addAssign("muestra_form","innerHTML","$resultado");
+ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+ $respuesta->addAssign("pie_modal","innerHTML","$pie");
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+ }
+
+
+$consulta = "
+ SELECT * FROM form_id, form_contenido_campos
+ WHERE form_id.id = form_contenido_campos.id_form
+ AND form_id.id = '$id' ORDER BY form_contenido_campos.orden ASC
+ ";
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$sql=mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0'){
+ if($respuesta !='' AND $control !=''){$control =$control;}
+ else{$control = md5(rand(1,99999999).microtime());}
+ $descripcion=mysql_result($sql,0,"descripcion");
+ $nombre=mysql_result($sql,0,"nombre");
+ $id_empresa=mysql_result($sql,0,"id_empresa");
+ $encabezado = empresa_datos("$id_empresa",'encabezado');
+ $pie = empresa_datos("$id_empresa",'pie');
+
+ $cabecera = "
+ $salir
+
+
+
+
+
+
+
+
+
$nombre $descripcion
+
+
+
+
+
";
+
+$campo_imagen = buscar_campo_tipo($id,"15");
+@$campo_imagen_nombre = $campo_imagen[1];
+@$campo_imagen = $campo_imagen[0];
+
+
+if (@$campo_imagen[0] != "") {
+$subir_imagen = subir_imagen("$id","$campo_imagen"."[0]");
+ }
+ $muestra_form = "
+
+
+
+
+
+
+
+
+
+
+ ";
+ if($tipo=="edit") {
+
+ //if(null === @$_SESSION['id'] AND $permiso_identificador != $control) {
+ if($_SESSION['id_empresa'] !== $id_empresa AND $permiso_identificador != $control) {
+ $password = buscar_campo_tipo($id,"18");
+
+ $aviso = "
ATENCIÓNNo está autorizado ";
+ $seguridad ="
+
+
+ ";
+ $resultado ="
+
+
+ $aviso
+ $seguridad
+
+ ";
+ $respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+ $respuesta->addAssign("muestra_form","innerHTML","$resultado");
+ $pie = empresa_datos("$id_empresa",'pie');
+ $respuesta->addscript("$('#muestraInfo').modal('toggle')");
+ return $respuesta;
+ }
+ //// si no esta logueado nose puede editar ////
+ $control_edit = "$control";
+
+ }else {$control_edit = "";}
+
+ mysql_data_seek($sql, 0);
+ while( $row = mysql_fetch_array( $sql ) ) {
+ $tipo_campo = remplacetas("form_campos","id","$row[id_campo]","campo_tipo","");
+ //if($tipo_campo[0] =="24") { $row[multiple] = "1";}
+ if($row['multiple'] ==='1' AND $tipo =='edit'){
+ $campos = formulario_campos_render_multiple($row['id_campo'],$id,$control_edit);
+ }else{
+ $campos = formulario_campos_render($row['id_campo'],$id,$control_edit,'','');
+ }
+ $muestra_form .= "$campos ";
+ $solo_campos .= "$campos ";
+ }
+ $muestra_form .="
+
+ ";
+ }
+
+$muestra_form .="
+
+
+
";
+ $muestra_form = "$muestra_form
";
+if($tipo=='campos') {
+ return $solo_campos;
+}
+if($tipo=='embebido') {
+ return $muestra_form;
+}
+
+$respuesta->addAssign("muestra_form","innerHTML","$muestra_form");
+$respuesta->addAssign("titulo_modal","innerHTML","$cabecera");
+$respuesta->addAssign("pie_modal","innerHTML","$pie");
+$respuesta->addscript("$('#muestraInfo').modal('toggle')");
+//$respuesta->addscript("$('textarea').markdown({autofocus:false,savable:false})");
+//$respuesta->addscript("$(document).ready(function () { $(\"#24[0]\").cleditor(); })");
+//$(document).ready(function () { $("#input").cleditor(); });
+
+
+
+return $respuesta;
+}
+$xajax->registerFunction("formulario_modal");
+
+
+
+function limpia_div($capa){
+$respuesta = new xajaxResponse('utf-8');
+$respuesta->addAssign($capa,"style.padding","0px");
+$respuesta->addClear($capa,"innerHTML");
+
+return $respuesta;
+}$xajax->registerFunction("limpia_div");
+
+
+function select_key($tabla,$key,$value,$descripcion,$onchange,$where,$nombre,$valor){
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+$campo1 = $campos[0];
+$campo2 = $campos[1];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysql_query("SET NAMES 'utf8'");
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}if($where =='AGRUPADO'){$group="GROUP BY $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT $value, $descripcion FROM $tabla WHERE 1 $w $group ORDER BY $campo1 ";
+$sql=mysql_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$key;}else{$name = "$nombre";}
+if (mysql_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="";}else{$vacio =" >> Nuevo $descripcion << ";}
+$resultado="
+Seleccione
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[$key]=="") {$resultado.="";}else{
+if($row[$key] ==="$valor"){$selected="selected";}else{$selected ="";}
+
+$resultado .= " ".substr($row[$campo1], 0, 150 )." ".substr($row[$campo2], 0, 30 )." ";
+ }
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function select($tabla,$value,$descripcion,$onchange,$where,$nombre,$valor){
+$group ="";
+@$valor=$valor;
+@$value =$value;
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+@$campo1 = $campos[0];
+@$campo2 = $campos[1];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysql_query("SET NAMES 'utf8'");
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}if($where =='AGRUPADO'){$group="GROUP BY $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT $value, $descripcion FROM $tabla WHERE 1 $w $group ORDER BY $campo1 ";
+$sql=mysql_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+if (mysql_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="Todos los valores ";}else{$vacio =" ";}
+$resultado="
+$nombre $vacio
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[$value]=="") {$resultado.="";}else{
+if($row[$value] ==="$valor"){$selected="selected";}else{$selected ="";}
+$mostrar_id = "[$row[$value]]";
+$resultado .= " ".substr(@$row[$campo1], 0, 150 )." ".substr(@$row[$campo2], 0, 30 )." $mostrar_id ";
+ }
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function select_empresa($tabla,$value,$descripcion,$onchange,$where,$nombre,$valor,$id_empresa){
+ $w ="";
+$link=Conectarse();
+$campos = explode(",",$descripcion);
+$campo1 = $campos[0];
+@$campo2 = $campos[1];
+$debug = "($tabla,$value,$descripcion,$onchange,$where)";
+mysql_query("SET NAMES 'utf8'");
+if(isset($_SESSION['id_empresa'])) {$id_empresa= $_SESSION['id_empresa'];}if($where =='AGRUPADO'){$group="GROUP BY $value ";}
+elseif($where != ''){$w = "AND ".$where;}else{ $w="";}
+$busca = array("[","]");
+if( strpos( $onchange,'[') !== false ){$fila=str_replace($busca,'',$onchange);$onchange='';};
+$consulta = "SELECT $value, $descripcion FROM $tabla WHERE id_empresa = '$id_empresa' $w $group ORDER BY $campo1 ";
+$sql=mysql_query($consulta,$link);
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+if (mysql_num_rows($sql)!='0'){
+ if($onchange !=''){$vacio ="Todos los valores ";}else{$vacio =" ";}
+$resultado="
+$nombre $vacio
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[$value]=="") {$resultado.="";}else{
+if($row[$value] ==="$valor"){$selected="selected";}else{$selected ="";}
+$mostrar_id = "[$row[$value]]";
+$resultado .= " ".substr(@$row[$campo1], 0, 150 )." ".substr(@$row[$campo2], 0, 30 )." $mostrar_id ";
+ }
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function select_edit($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+
+$resultado="
+Seleccione
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row['campo_valor'] ==="$valor"){$selected="selected";}else{$selected ="";}
+$resultado .= " $row[campo_valor] ";
+ }
+$resultado .= " ";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+
+
+
+function radio_agrupado_linea($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores , form_campos WHERE form_campos_valores.id_form_campo = form_campos.id AND id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+$valor = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+$nombre_linea = mysql_result($sql,0,"campo_nombre");
+$descripcion_linea = mysql_result($sql,0,"campo_descripcion");
+ mysql_data_seek($sql, 0);
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor[0]"){$selected="checked";}else{$selected ="";}
+$lineas .= " $row[campo_valor] ";
+ }
+$resultado .= "$nombre_linea
$lineas ";
+ }else{$resultado = " No hay resultados $consulta
";}
+
+return $resultado;
+}
+
+function radio_linea($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores , form_campos WHERE form_campos_valores.id_form_campo = form_campos.id AND id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+$nombre_linea = mysql_result($sql,0,"campo_nombre");
+$descripcion_linea = mysql_result($sql,0,"campo_descripcion");
+ mysql_data_seek($sql, 0);
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor"){$selected="checked";}else{$selected ="";}
+$lineas .= "$row[campo_valor] ";
+ }
+$resultado .= "$nombre_linea
$lineas ";
+ }else{$resultado = " No hay resultados $consulta
";}
+
+return $resultado;
+}
+function radio_edit($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+
+$resultado="
+
+ " ;
+while( $row = mysql_fetch_array( $sql ) ) {
+if($row[campo_valor] ==="$valor"){$selected="checked";}else{$selected ="";}
+$resultado .= " $row[campo_valor]
";
+ }
+$resultado .= "";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+
+function checkbox_edit($id_campo,$form_id,$valor,$name,$control){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
+if (mysql_num_rows($sql)!='0'){
+ $name = explode("[",$name);
+ $name = $name[0];
+ $fila="0";
+
+while( $row = mysql_fetch_array( $sql ) ) {
+ $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' and contenido ='$row[campo_valor]' ");
+
+ $nombre= "$name"."[".$fila."]";
+//if($row[campo_valor] ==="$valor"){$selected="checked";}else{$selected ="";}
+if($value[0] ==="$row[campo_valor]"){$selected="checked";}else{$selected ="";}
+$resultado .= "
+
+
+ $row[campo_valor] $selected
+
+
";
+ $fila++;
+ }
+$resultado .= "";
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+
+function rango($tabla,$campo,$key,$valor,$selected,$nombre,$onchange){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT min($campo) as min , max($campo) as max FROM $tabla WHERE $key ='$valor' ";
+$sql=mysql_query($consulta,$link);
+
+if (mysql_num_rows($sql)!='0'){
+ $min=mysql_result($sql,0,"min");
+ $max=mysql_result($sql,0,"max");
+if($nombre==''){$name=$tabla."_".$value;}else{$name = "$nombre";}
+$resultado="
+ $min
+
+ $max $selected
+
" ;
+
+
+ }else{$resultado = " No hay resultados
";}
+
+return $resultado;
+}
+
+function limite($id_campo,$contenido,$tipo){
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+
+$consulta = "SELECT campo_valor FROM form_campos_valores WHERE id_form_campo ='$id_campo' ";
+$sql=mysql_query($consulta,$link);
+
+if (mysql_num_rows($sql)!='0'){
+ $limite=mysql_result($sql,0,"campo_valor");
+
+ }else{}
+ if($tipo =='limite') { return $limite;}
+$respuesta = new xajaxResponse('utf-8');
+if($contenido !='') {
+
+ $size= strlen($contenido);
+ $restante = ($limite - $size);
+ $div_input = "input_$id_campo";
+ if( $restante<=1) {
+$respuesta->addAssign("aviso_$id_campo","className","alert-danger ");
+$respuesta->addAssign("$div_input","className","has-error ");
+ }
+ elseif( $restante<=10) {
+$respuesta->addAssign("aviso_$id_campo","className","alert-warning ");
+$respuesta->addAssign("$div_input","className","has-warning ");
+ }else{
+$respuesta->addAssign("aviso_$id_campo","className","alert-succes ");
+$respuesta->addAssign("$div_input","className","has-success ");
+}
+ $respuesta->addAssign("aviso_$id_campo","innerHTML","$restante");
+
+ return $respuesta;
+ }
+ $respuesta->addAssign("aviso_$id_campo","innerHTML","$limite");
+ return $respuesta;
+ //return $limite;
+}
+$xajax->registerFunction("limite");
+
+function confirma_campo($valor_1,$valor_2,$campo,$campo_confirmacion){
+ $respuesta = new xajaxResponse('utf-8');
+ $pos = strpos($campo,"email");
+
+if($pos == "") { //// si no es un email
+ }
+ else {//// si es un email se revisa
+ $email = validar_email("$valor_1");
+ if($email === 0 ) {
+ $respuesta->addAssign("$campo","value","");
+ $respuesta->addAssign("$campo"."_grupo","className"," input-group has-error ");
+ $respuesta->addAssign("$campo_confirmacion"."_grupo","className"," input-group has-error ");
+ $respuesta->addAlert("El email no es valido ");
+ $respuesta->addScript("document.getElementById('$campo').focus(); ");
+ return $respuesta;
+ }
+ else{
+ }
+ }
+
+
+
+ if($valor_1 != $valor_2){$resultado = "Los valores NO son iguales";
+ $respuesta->addAlert("$resultado");
+ /// $respuesta->addAssign("$campo","style.color","red");
+
+
+ $respuesta->addAssign("$campo","value","$pos");
+ $respuesta->addAssign("$campo_confirmacion","value","");
+ $respuesta->addAssign("$campo"."_grupo","className"," input-group has-error ");
+ $respuesta->addAssign("$campo_confirmacion"."_grupo","className"," input-group has-error ");
+ $respuesta->addScript("document.getElementById('$campo').focus(); ");
+ // document.getElementById('mobileno').focus();
+
+
+ }else{
+ //$respuesta->addAssign("$campo_confirmacion","style.color","green");
+
+ $respuesta->addAssign("$campo","className"," form-control ");
+ $respuesta->addAssign("$campo_confirmacion","className"," form-control ");
+ $respuesta->addAssign("$campo"."_grupo","className"," input-group has-success ");
+ $respuesta->addAssign("$campo_confirmacion"."_grupo","className"," input-group has-success ");
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("confirma_campo");
+
+
+function validar_campo($valor,$campo,$tabla,$div,$id){
+$valor = mysql_seguridad($valor);
+$respuesta = new xajaxResponse('utf-8');
+$link=Conectarse();
+mysql_query("SET NAMES 'utf8'");
+$consulta="SELECT $campo FROM $tabla WHERE $campo = '$valor' LIMIT 1";
+$sql =mysql_query($consulta,$link);
+if (mysql_num_rows($sql)!='0' ){
+$verificacion = "atencion"; $existe='';
+
+$respuesta->addAssign($campo,"value","");
+///$respuesta->addAlert("El valor $valor $existe existe");
+$resultado = "Grrr $valor $existe existe ";
+$respuesta->addAssign("$id","style.backgroundColor","pink");
+$respuesta->addAssign($div,"innerHTML",$resultado);
+return $respuesta;
+ }else {$verificacion ="check"; $existe='NO';}
+$resultado = "Ok, buen $campo ! ";
+$respuesta->addAssign("$id","style.backgroundColor","#CBE7CB");
+//$resultado .= "$valor,$campo,$tabla,$div";
+$respuesta->addAssign($div,"innerHTML",$resultado);
+
+
+return $respuesta;
+}
+$xajax->registerFunction("validar_campo");
+
+
+function comprobar_email($email,$tipo,$campo){
+$email = mysql_seguridad($email);
+$respuesta = new xajaxResponse('utf-8');
+if($tipo =='tercero') {$id_campo='tercero_email';}
+
+
+else{$id_campo = 'email';}
+
+if($campo !=''){
+$id_campo="$campo";
+}
+
+
+if ($email == "" AND $tipo==''){
+ $respuesta->addAlert("El campo email es obligatorio ");
+ $respuesta->addAssign("$id_campo","style.backgroundColor","pink");
+ $respuesta->addAssign("$id_campo","value","");
+ return $respuesta;
+ }
+
+ $mail_correcto = 0;
+ //compruebo unas cosas primeras
+ if ((strlen($email) >= 6) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@")){
+ if ((!strstr($email,"'")) && (!strstr($email,"\"")) && (!strstr($email,"\\")) && (!strstr($email,"\$")) && (!strstr($email," "))) {
+ //miro si tiene caracter .
+ if (substr_count($email,".")>= 1){
+ //obtengo la terminacion del dominio
+ $term_dom = substr(strrchr ($email, '.'),1);
+ //compruebo que la terminación del dominio sea correcta
+ if (strlen($term_dom)>1 && strlen($term_dom)<5 && (!strstr($term_dom,"@")) ){
+ //compruebo que lo de antes del dominio sea correcto
+ $antes_dom = substr($email,0,strlen($email) - strlen($term_dom) - 1);
+ $caracter_ult = substr($antes_dom,strlen($antes_dom)-1,1);
+ if ($caracter_ult != "@" && $caracter_ult != "."){
+ $mail_correcto = 1;
+ }
+ }
+ }
+ }
+ }
+ if ($mail_correcto AND $tipo=='' )
+ {
+$consulta= "SELECT email FROM usuarios WHERE email = '$email' LIMIT 1 ";
+ $link=Conectarse();
+$sql=mysql_query($consulta,$link);
+$revisa=mysql_result($sql,0,"email");
+if ($revisa != ''){
+
+ $respuesta->addAlert("$email: ya está registrado ");
+ $respuesta->addAssign("email","style.color","red");
+ $respuesta->addAssign("email","value","");
+ return $respuesta;
+ }
+ $respuesta->addAssign("email","style.color","green");}
+ elseif ($mail_correcto AND $tipo==='revisar' ) {
+ $revisar = remplacetas("usuarios","email",$email,"email","");
+ if($revisar[0] != '') {
+
+ $respuesta->addAssign("$campo","style.color","white");
+ $respuesta->addAssign("$id_campo","style.backgroundColor","green");
+ }else{
+ $respuesta->addAlert("$email: No existe en el sistema)");
+ $respuesta->addAssign("$campo","value","");
+ }
+ return $respuesta;
+ }
+
+ elseif ($mail_correcto AND $tipo==='tercero' ) {
+ $documento = remplacetas("terceros","email",$email,"documento","");
+ if($documento[1] =='') { /// si el tercero NO existe
+
+ }else { /// si el tercero existe en el sistema
+
+ $tipo_persona = remplacetas("terceros","id",$documento[1],"tipo_persona","");
+
+ if($tipo_persona[0] =='1') {
+ $razon_social = remplacetas("terceros","id",$documento[1],"razon_social","");
+ $resultado .= " $razon_social[0]] Nit: $documento[0]";
+ } else {
+ $primer_nombre = remplacetas("terceros","id",$documento[1],"p_nombre","");
+ $segundo_nombre = remplacetas("terceros","id",$documento[1],"s_nombre","");
+ $primer_apellido = remplacetas("terceros","id",$documento[1],"p_apellido","");
+ $segundo_apellido = remplacetas("terceros","id",$documento[1],"s_apellido","");
+ $resultado .=" \r $primer_nombre[0] $segundo_nombre[0] $primer_apellido[0] $segundo_apellido[0] \r Documento: $documento[0]";
+ }
+
+ $respuesta->addAlert("$email: $resultado");
+ $respuesta->addAssign("tercero_documento","value","$documento[0]");
+ $respuesta->addAssign("tercero_primer_nombre","value","$primer_nombre[0]");
+ $respuesta->addAssign("tercero_segundo_nombre","value","$segundo_nombre[0]");
+ $respuesta->addAssign("tercero_primer_apellido","value","$primer_apellido[0]");
+ $respuesta->addAssign("tercero_segundo_apellido","value","$segundo_apellido[0]");
+ $respuesta->addAssign("tercero_razon_social","value","$razon_social[0]");
+ $respuesta->addAssign("tercero_id","value","$documento[1]");
+
+ }
+
+ }
+ else
+ {$respuesta->addAlert("$email: no es un correo válido");
+ $respuesta->addAssign("$id_campo","style.backgroundColor","pink");
+ $respuesta->addAssign("$id_campo","value","");
+ }
+ return $respuesta;
+}
+$xajax->registerFunction("comprobar_email");
+
+function obtener_ip()
+
+{
+
+ if (isset($_SERVER["HTTP_CLIENT_IP"]))
+ {
+ return $_SERVER["HTTP_CLIENT_IP"];
+ }
+ elseif (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
+ {
+ return $_SERVER["HTTP_X_FORWARDED_FOR"];
+ }
+ elseif (isset($_SERVER["HTTP_X_FORWARDED"]))
+ {
+ return $_SERVER["HTTP_X_FORWARDED"];
+ }
+ elseif (isset($_SERVER["HTTP_FORWARDED_FOR"]))
+ {
+ return $_SERVER["HTTP_FORWARDED_FOR"];
+ }
+ elseif (isset($_SERVER["HTTP_FORWARDED"]))
+ {
+ return $_SERVER["HTTP_FORWARDED"];
+ }
+ else
+ {
+ return $_SERVER["REMOTE_ADDR"];
+ }
+
+ }
+
+function milfs(){
+ $crear_campos = formulario_crear_campo('','','');
+ $listado = formulario_listado('','');
+ //$consultas = formulario_consultar('','');
+ $importador = formulario_importador('');
+ $limpiar_cache = borrar_tmp('');
+ $configuracion= configuracion('');
+
+ $login = login_boton('');
+ $menu =
+"
+
+
+
+ $crear_campos
+
+ $listado
+
+
+ $configuracion
+
+
+
+
+
";
+
+ return $menu;
+}
+function url_existe($url)
+{
+ $handle = @fopen($url, "r");
+ if ($handle == false)
+ return NULL;
+ fclose($handle);
+ return $url;
+}
+function es_imagen($url)
+ {
+ $imageSizeArray = getimagesize($url);
+ $imageTypeArray = $imageSizeArray[2];
+ return (bool)(in_array($imageTypeArray , array(IMAGETYPE_GIF , IMAGETYPE_JPEG ,IMAGETYPE_PNG )));
+ }
+function parametrizacion($array) {
+ //return $array;
+ $link=Conectarse();
+ mysql_real_escape_string($array);
+ $accion = $array[accion];
+ $tabla = $array[tabla];
+ $campo = $array[campo];
+ $opcion = $array[opcion];
+ $descripcion= $array[descripcion];
+ $visible= $array[visible];
+ $id= $array[id];
+
+ if($accion =='grabar'){
+ $consulta= "INSERT INTO form_parametrizacion set tabla='$tabla', campo ='$campo',opcion ='$opcion' , descripcion ='$descripcion' ,visible='$visible'";
+ }
+ // return $consulta;
+ $sql=mysql_query($consulta,$link);
+ if($sql){return "Campo grabado"; }else{return "";}
+
+}
+
+?>
diff --git a/milfs/funciones/index.php b/milfs/funciones/index.php
index 1721912..c8517bd 100644
--- a/milfs/funciones/index.php
+++ b/milfs/funciones/index.php
@@ -14,13 +14,13 @@ $link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
- mysql_data_seek($sql, 0);
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
$resultado ="
Respuestas:
";
- while( $row = mysql_fetch_array( $sql ) ) {
+ while( $row = mysqli_fetch_array( $sql ) ) {
$respuesta = mostrar_identificador("$identificador","$row[form_id]","",'simple');
$fecha = date($format, $row['timestamp']);
$resultado .= " $respuesta $timestamp ";
@@ -45,11 +45,11 @@ $link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
- mysql_data_seek($sql, 0);
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
$resultado ="
";
- while( $row = mysql_fetch_array( $sql ) ) {
+ while( $row = mysqli_fetch_array( $sql ) ) {
$resultado .= "$row[nombre] $row[descripcion] ";
}
@@ -75,7 +75,7 @@ $consulta_principal = "SELECT control,id,form_id FROM form_datos WHERE form_id =
$link=Conectarse();
mysqli_query("SET NAMES 'UTF8'");
$sql_total=mysqli_query($consulta_principal,$link);
-$total_registros = mysql_num_rows($sql_total);//formulario_contar($id_form);
+$total_registros = mysqli_num_rows($sql_total);//formulario_contar($id_form);
/// PAGINACION
if ($pagina =='') {$inicio = 0; $pagina = 1; }
else { $inicio = ($pagina - 1) * $registros;}
@@ -83,9 +83,9 @@ $total_registros = mysql_num_rows($sql_total);//formulario_contar($id_form);
else{$limite =" LIMIT $inicio, $registros ";}
$consulta_limite = $consulta_principal.$limite;
$sql=mysqli_query($consulta_limite,$link);
-mysql_data_seek($sql_total, 0);
+mysqli_data_seek($sql_total, 0);
//$sql=mysqli_query($consulta_principal,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
/////// FILTRO
@@ -141,7 +141,7 @@ if (mysql_num_rows($sql)!='0'){
";
-// $total_registros = mysql_num_rows($sql);
+// $total_registros = mysqli_num_rows($sql);
/* $nombres_campos = listar_campos_formulario("$id_form","nombres");
foreach($nombres_campos as $campo_nombre=>$nombre){
$listado_nombres .= "$nombre ";
@@ -149,8 +149,8 @@ if (mysql_num_rows($sql)!='0'){
*/
// $listado_nombres = "Identificador $listado_nombres ";
///$listado_campos = listar_campos_formulario("$id_form",'');
-mysql_data_seek($sql_total, 0);
-while( $row = mysql_fetch_array( $sql ) ) {
+mysqli_data_seek($sql_total, 0);
+while( $row = mysqli_fetch_array( $sql ) ) {
// if (!is_array($listado_campos)){$listado_campos="$listado_campos ";}else {$listado_campos=$listado_campos;}
$linea .= landingpage_contenido_identificador("$row[control]","$id_form","landingpage",'');
@@ -212,15 +212,15 @@ mysqli_query("SET NAMES 'utf8'");
$consulta = "SELECT * FROM empresa ORDER BY id DESC ";
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
-mysql_data_seek($sql, 0);
+mysqli_data_seek($sql, 0);
$fila=1;
$divider=3;
$cols = (12/$divider);
$i =0;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($i % $divider==0) {
$encontrados .= "";
}
@@ -546,11 +546,11 @@ function landingpage_contenido_formulario($form,$registros,$pagina,$div_original
*/
//// PAGINACION
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
$linea=" ( $cantidad ) $paginacion";
$fila = 1;
- mysql_data_seek($sql, 0);
-while( $row = mysql_fetch_array( $sql ) ) {
+ mysqli_data_seek($sql, 0);
+while( $row = mysqli_fetch_array( $sql ) ) {
$impresion = mostrar_identificador($row['control'],"","landingpage");
$imagen = buscar_imagen($form,$row['control'],"","$id_empresa[0]");
if($imagen !="") { $clase = "col-lg-5 col-sm-6";}else {$clase = "col-lg-12 col-sm-12";}
@@ -587,14 +587,14 @@ $miniatura ="";
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
$linea="";
$fila = 1;
//include("includes/datos.php");
$error_token = "";
$contenido = "";
if(!isset($mapbox_token)) { include("milfs/includes/datos.php"); if(!isset($mapbox_token)) {$error_token = 1; } else {$error_token = "";}}
- while( $row = mysql_fetch_array( $sql ) ) {
+ while( $row = mysqli_fetch_array( $sql ) ) {
$contenido = "
Mas información ";
$imagen = buscar_imagen($row['id'],'','','');
$geo = buscar_campo_tipo($row['id'],"14");
@@ -688,8 +688,8 @@ function buscar_imagen($form,$control,$tipo,$empresa) {
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
- $imagen = mysql_result($sql,0,"contenido");
+if (mysqli_num_rows($sql)!='0'){
+ $imagen = mysqli_result($sql,0,"contenido");
}
if($tipo == "consulta") { return $consulta; }
return $imagen;
@@ -748,8 +748,8 @@ $consulta= " SELECT * FROM form_campos WHERE id = id $w_empresa $w_especialista
";
- if (mysql_num_rows($sql)!='0'){
- while( $row = mysql_fetch_array( $sql ) ) {
+ if (mysqli_num_rows($sql)!='0'){
+ while( $row = mysqli_fetch_array( $sql ) ) {
$tipo_nombre = remplacetas_noid('form_tipo_campo','id_tipo_campo',"$row[campo_tipo]",'tipo_campo_nombre',"") ;
$campo_tipo ="$tipo_nombre[0] ";
if($_SESSION['id_empresa'] == $row['id_empresa']) {
@@ -798,11 +798,11 @@ if(@$and !=''){$AND = "AND $and";}else{$AND ="";}
$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by $campo DESC limit 1";
//$consulta = "SELECT * , md5(binary $por ) as md5_".$por." FROM $tabla WHERE $campo = '$valor' $AND order by id DESC limit 1";
$sql=mysqli_query($consulta,$link);
-if (@mysql_num_rows($sql)!=0){
-$resultado[] = mysql_result($sql,0,$por);
-$resultado[] = mysql_result($sql,0,"$campo");
+if (@mysqli_num_rows($sql)!=0){
+$resultado[] = mysqli_result($sql,0,$por);
+$resultado[] = mysqli_result($sql,0,"$campo");
$resultado[] = $consulta;
-$resultado[] = mysql_result($sql,0,"md5_$por");
+$resultado[] = mysqli_result($sql,0,"md5_$por");
}else{
$resultado[0] = '';
$resultado[1] ="";
@@ -907,7 +907,7 @@ $link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
foreach($formulario as $c=>$v){
- $valores .= " $c = '".mysql_real_escape_string($v)."',";
+ $valores .= " $c = '".mysqli_real_escape_string($link,$v)."',";
}
$valores = "$valores id_responsable = '$_SESSION[id]'";
@@ -945,11 +945,11 @@ $resultado="
$name
Id Nombre Sigla Email Web Dirección Teléfono
" ;
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
if($onchange !=''){$vacio ="";}else{$vacio =" >> Nuevo $descripcion << ";}
$linea = 1;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$razon_social= editar_campo("empresa",$row['id'],"razon_social","","","");
$sigla= editar_campo("empresa",$row['id'],"sigla","","","");
$email= editar_campo("empresa",$row['id'],"email","","","");
@@ -1020,9 +1020,9 @@ $consulta = "SELECT distinct($campo) as cantidad FROM form_datos WHERE $key LIKE
$link=Conectarse();
mysqli_query("SET NAMES 'UTF8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
-$resultado = mysql_num_rows($sql);
-//$resultado = mysql_result($sql,0,"cantidad");
+if (mysqli_num_rows($sql)!='0'){
+$resultado = mysqli_num_rows($sql);
+//$resultado = mysqli_result($sql,0,"cantidad");
}
//$resultado .= " $consulta";
return $resultado;
@@ -1035,8 +1035,8 @@ $consulta = "SELECT distinct(id_campo),campo_nombre FROM form_datos,form_campos
$link=Conectarse();
mysqli_query("SET NAMES 'UTF8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
-while( $row = mysql_fetch_array( $sql ) ) {
+if (mysqli_num_rows($sql)!='0'){
+while( $row = mysqli_fetch_array( $sql ) ) {
if($tipo=="nombres"){
$resultado[] = "$row[campo_nombre]";}
elseif($tipo=="select"){
@@ -1055,7 +1055,7 @@ $resultado = "
";
}
-//$resultado = mysql_result($sql,0,"cantidad");
+//$resultado = mysqli_result($sql,0,"cantidad");
}
//$resultado .= " $consulta";
return $resultado;
@@ -1093,7 +1093,7 @@ $consulta_principal = "SELECT control,id,form_id FROM form_datos WHERE form_id =
$link=Conectarse();
mysqli_query("SET NAMES 'UTF8'");
$sql_total=mysqli_query($consulta_principal,$link);
-$total_registros = mysql_num_rows($sql_total);//formulario_contar($id_form);
+$total_registros = mysqli_num_rows($sql_total);//formulario_contar($id_form);
/// PAGINACION
if ($pagina =='') {$inicio = 0; $pagina = 1; }
else { $inicio = ($pagina - 1) * $registros;}
@@ -1104,7 +1104,7 @@ $total_registros = mysql_num_rows($sql_total);//formulario_contar($id_form);
$sql=mysqli_query($consulta_limite,$link);
//$sql=mysqli_query($consulta_principal,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
/////// FILTRO
@@ -1217,7 +1217,7 @@ $boton_borrar = "
";
- $total_registros = mysql_num_rows($sql);
+ $total_registros = mysqli_num_rows($sql);
$nombres_campos = listar_campos_formulario("$id_form","nombres");
foreach($nombres_campos as $campo_nombre=>$nombre){
$listado_nombres .= "$nombre ";
@@ -1225,7 +1225,7 @@ $boton_borrar = "
$listado_nombres = "Identificador $listado_nombres ";
$listado_campos = listar_campos_formulario("$id_form",'');
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
//$cantidad_campos = contar_valores_formulario("id_campo","control","$row[control]");
$listado_campos = listar_campos_formulario("$id_form",'');
@@ -1356,7 +1356,7 @@ GROUP BY id_campo ORDER BY timestamp DESC ";
$sql = mysqli_query($consulta,$link) or die("error al ejecutar consulta ");
$array = array();
$array[identificador] = "$identificador";
-while($row = mysql_fetch_array( $sql ))
+while($row = mysqli_fetch_array( $sql ))
{
$contenido = remplacetas('form_datos','id',$row[id],'contenido',"") ;
$id_campo = remplacetas('form_datos','id',$row[id],'id_campo',"") ;
@@ -1419,9 +1419,9 @@ return $resultado;
}
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
-$limpiar ="DELETE FROM `form_parametrizacion` WHERE tabla = '".mysql_real_escape_string($tabla)."' AND campo ='".mysql_real_escape_string($campo)."' AND opcion ='".mysql_real_escape_string($opcion)."' AND id_empresa = '$_SESSION[id_empresa]' LIMIT 1 ";
+$limpiar ="DELETE FROM `form_parametrizacion` WHERE tabla = '".mysqli_real_escape_string($link,$tabla)."' AND campo ='".mysqli_real_escape_string($link,$campo)."' AND opcion ='".mysqli_real_escape_string($link,$opcion)."' AND id_empresa = '$_SESSION[id_empresa]' LIMIT 1 ";
$sql=mysqli_query($limpiar,$link);
-$consulta="INSERT INTO form_parametrizacion set tabla = '".mysql_real_escape_string($tabla)."' , campo ='".mysql_real_escape_string($campo)."', opcion ='".mysql_real_escape_string($opcion)."', descripcion ='".mysql_real_escape_string($descripcion)."', visible='1' , id_empresa = '$_SESSION[id_empresa]'";
+$consulta="INSERT INTO form_parametrizacion set tabla = '".mysqli_real_escape_string($link,$tabla)."' , campo ='".mysqli_real_escape_string($link,$campo)."', opcion ='".mysqli_real_escape_string($link,$opcion)."', descripcion ='".mysqli_real_escape_string($link,$descripcion)."', visible='1' , id_empresa = '$_SESSION[id_empresa]'";
$sql=mysqli_query($consulta,$link);
if($sql) {
$resultado = "$descripcion";
@@ -1602,11 +1602,11 @@ $consulta = "
GROUP BY contenido
ORDER BY contenido asc";
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
$resultado = "Filtro
Todos ";
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$resultado .= " $row[contenido] ";
}
$resultado .= " ";
@@ -1637,9 +1637,9 @@ $consulta = "
ORDER BY contenido asc";
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
$resultado = "";
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$icono = remplacetas('form_parametrizacion','campo',$perfil,'descripcion'," tabla='form_id' and opcion = 'categoria:icon:$row[md5_contenido]'") ;
if($icono[0] =='') {
@@ -1747,11 +1747,11 @@ $consulta ="SELECT * FROM form_campos ,form_contenido_campos WHERE form_campos.i
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
$campo_imagen = buscar_campo_tipo($formulario,"15");
$campo_imagen_nombre = $campo_imagen[1];
$campo_imagen = $campo_imagen[0];
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($row[id_campo] == $campo_imagen ) {$imagen ="
"; $identificador="
";}
else {$imagen=''; $identificador =" \$campo_limpio[$row[id_campo]] ";}
$listado .= "
$imagen $row[campo_nombre] [$row[id_campo]] ";
@@ -1792,9 +1792,9 @@ if($valores =="boton") {
$consulta ="SELECT * FROM form_parametrizacion WHERE campo = '$formulario' AND `opcion` REGEXP '^plantilla:' ORDER BY opcion";
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$campos_opcion = explode(":",$row[opcion]);
$plantilla_nombre = $campos_opcion[1];
$listado .= "
$row[opcion] ";
@@ -1968,9 +1968,9 @@ if($valores =="") {
$consulta ="SELECT * FROM form_campos ,form_contenido_campos WHERE form_campos.id = form_contenido_campos.id_campo AND form_contenido_campos.id_form = '$formulario' ORDER BY form_campos.campo_nombre";
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$listado .= "
$row[campo_nombre] [$row[id_campo]] ";
}
$resultado = "
@@ -2048,9 +2048,9 @@ $consulta ="SELECT * FROM form_campos ,form_datos
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$datos = contenido_mostrar("$formulario","$row[control]",'',"$plantilla");
@@ -2092,9 +2092,9 @@ $consulta ="SELECT * FROM form_campos ,form_datos WHERE form_datos.form_id = '$f
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$listado .= "
$row[contenido] ";
}
$resultado = "
@@ -2132,9 +2132,9 @@ $consulta ="SELECT *
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$listado .= "
$row[contenido] ";
}
$resultado = "
@@ -2161,9 +2161,9 @@ $consulta ="SELECT * FROM form_campos ,form_contenido_campos WHERE form_campos.i
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$listado .= "
$row[campo_nombre] ";
}
$resultado = "
@@ -2186,9 +2186,9 @@ $consulta ="SELECT * FROM form_id WHERE publico = '1'";
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
+if (mysqli_num_rows($sql)!=0){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$listado .= "
$row[nombre] ";
}
$resultado = "
@@ -2246,11 +2246,11 @@ if($tipo!=''){
$respuesta = new xajaxResponse('utf-8');
$consulta ="SELECT $id , $campo_valor , $campo_descripcion FROM $tabla WHERE $campo_valor = '$tipo' AND id_empresa = '$id_empresa'";
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
$resultado .= "
$Campo_descripcion
";
$resultado .= " Seleccione $Campo_descripcion ";
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$resultado .= " $row[$campo_valor] $row[$campo_descripcion] ";
}
$resultado .= " ";
@@ -2263,14 +2263,14 @@ return $respuesta;}
ELSE{ /// si no especifica $tipo
$consulta ="SELECT $id , $campo_valor , $campo_descripcion FROM $tabla WHERE id_empresa = '$id_empresa' GROUP BY $campo_valor ";
$sql=mysqli_query($consulta,$link);
-///$Documento=mysql_result($grupo,0,"documento_numero");
+///$Documento=mysqli_result($grupo,0,"documento_numero");
$resultado = "
$Campo_valor
";
$resultado .= " Seleccione $Campo_valor ";
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$explicacion= remplacetas('eapb','codigo',"$row[$campo_valor]",'nombre',"") ;
$explicacion = $explicacion[0];
$resultado .= "$row[$campo_valor] ";
@@ -2291,10 +2291,10 @@ $consulta = " SELECT distinct(id_campo),contenido FROM form_datos WHERE control
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql = mysqli_query($consulta,$link);
- if (mysql_num_rows($sql)!=0){
+ if (mysqli_num_rows($sql)!=0){
$resultado ="";
- mysql_data_seek($sql, 0);
- while( $row = mysql_fetch_array( $sql ) ) {
+ mysqli_data_seek($sql, 0);
+ while( $row = mysqli_fetch_array( $sql ) ) {
$id_form = $row[form_id];
$campo_nombre = remplacetas('form_campos','id',$row[id_campo],'campo_nombre');
$nombre = strtolower( str_replace(' ','_',$campo_nombre[0]));
@@ -2343,7 +2343,7 @@ $consulta ="SELECT form_campos.id FROM `form_campos` , form_contenido_campos WHE
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql = mysqli_query($consulta,$link);
- $id_campo=mysql_result($sql,0,"id");
+ $id_campo=mysqli_result($sql,0,"id");
return $id_campo;
}
@@ -2524,7 +2524,7 @@ $lista ="addScript(" document.getElementById('boton_registro').disabled=false
$campos= mysqli_query($campos_consulta,$link);
$ip = obtener_ip();
$control = $datos['control'];
-while( $row = mysql_fetch_array( $campos ) ) {
+while( $row = mysqli_fetch_array( $campos ) ) {
$campo_valor=$datos[$row['id_campo']][0];
$campo_tipo = remplacetas('form_campos','id',$row['id_campo'],'campo_tipo','');
/// Si el campo es password (18) se guarda su equivalente en md5
@@ -2979,13 +2979,13 @@ $consulta ="SELECT * FROM form_datos WHERE $w_form contenido like '%%$valor%%'
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!=0){
-mysql_data_seek($sql, 0);
+if (mysqli_num_rows($sql)!=0){
+mysqli_data_seek($sql, 0);
$fila=1;
$divider=2;
$cols = (12/$divider);
$i =0;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($i % $divider==0) {
$encontrados .= "
@@ -3048,17 +3048,17 @@ $consulta_total= "SELECT * FROM form_datos WHERE form_id= '$id_form' $w_filtro G
$consulta= "SELECT * FROM form_datos WHERE form_id= '$id_form' $w_filtro GROUP BY control LIMIT $inicio , $limite";
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
-//mysql_real_escape_string($consulta);
+//mysqli_real_escape_string($link,$consulta);
$sql_total=mysqli_query($consulta_total,$link);
-$total = mysql_num_rows($sql_total);
+$total = mysqli_num_rows($sql_total);
$sql=mysqli_query($consulta,$link);
$descripcion = remplacetas('form_id','id',$id_form,'descripcion',"") ;
$descripcion = $descripcion[0];
$buscador = buscar_datos("","$id_form","$plantilla","grid_resultado");
$contenido = "$descripcion";
-if (mysql_num_rows($sql)!=0){
-mysql_data_seek($sql, 0);
+if (mysqli_num_rows($sql)!=0){
+mysqli_data_seek($sql, 0);
$fila=1;
if($divider =="") {
$divider=3;
@@ -3066,7 +3066,7 @@ $divider=3;
$cols = (12/$divider);
$i =0;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($i % $divider==0) {
$contenido .= "
@@ -3124,7 +3124,7 @@ $respuesta = new xajaxResponse('utf-8');
$insertar = "INSERT INTO $tabla set $valores";
// $edit = "UPDATE $tabla SET $campo = '$valor' WHERE id = '$key' limit 1; ";
$sql=mysqli_query($insertar,$link);
- $ultimo_id = mysql_insert_id();
+ $ultimo_id = mysqli_insert_id($link);
if(mysql_affected_rows($link) != 0){
}
@@ -3161,11 +3161,11 @@ $consulta = "
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
- mysql_data_seek($sql, 0);
- while( $row = mysql_fetch_array( $sql ) ) {
+ mysqli_data_seek($sql, 0);
+ while( $row = mysqli_fetch_array( $sql ) ) {
if( $row['obligatorio'] == '1'){$obligatorio="*";}else {$obligatorio='X';}
if($row['campo_tipo'] =="24") { $row['multiple'] = "1";}
@@ -3217,8 +3217,8 @@ $control = md5(rand(1,99999999).microtime());
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
- mysql_data_seek($sql, 0);
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
//$campo_titulo = remplacetas('parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'titulo'") ;
$nombre = remplacetas('form_id','id',$perfil,'nombre','') ;
$descripcion = remplacetas('form_id','id',$perfil,'descripcion','') ;
@@ -3236,9 +3236,9 @@ if (mysql_num_rows($sql)!='0'){
if($tipo =='edit') {$control= $control_respuesta;}
elseif($form_respuesta !='' AND $control !=''){$control =$control;}
else{$control = md5(rand(1,99999999).microtime());}
- //$descripcion=mysql_result($sql,0,"descripcion");
- //$nombre=mysql_result($sql,0,"nombre");
- //$empresa=mysql_result($sql,0,"id_empresa");
+ //$descripcion=mysqli_result($sql,0,"descripcion");
+ //$nombre=mysqli_result($sql,0,"nombre");
+ //$empresa=mysqli_result($sql,0,"id_empresa");
$encabezado = empresa_datos("$empresa",'encabezado');
$pie = empresa_datos("$empresa",'pie');
$cabecera = "
@@ -3307,7 +3307,7 @@ if($tipo != "campos") {
$fila=0;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($row['campo_area']=="0"){$area_nombre ="";}
else{
@@ -3416,11 +3416,11 @@ $resultado="
$name
Id $campo1 $campo2 $campo3 $campo4
" ;
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
if($onchange !=''){$vacio ="";}else{$vacio =" >> Nuevo $descripcion << ";}
$linea = 1;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$editar_campo1= editar_campo("$tabla",$row['id'],"$campo1","","","","");
$editar_campo2= editar_campo("$tabla",$row['id'],"$campo2","","","","");
$editar_campo3= editar_campo("$tabla",$row['id'],"$campo3","","","","");
@@ -3718,13 +3718,13 @@ mysqli_query("SET NAMES 'utf8'");
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
$onchange = " xajax_contenido_mostrar('$formulario',(this.value),'$div','5')";
$resultado="
Seleccione
" ;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($row[control] == "$valor") {
@@ -3793,9 +3793,9 @@ $consulta = "SELECT * FROM $tabla WHERE $descripcion1 like '$valor%%' GROUP BY
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
//$campo_descripcion= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$descripcion' ");
//$campo_key= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$key' ");
if($row[control] == "$valor") {
@@ -3908,9 +3908,9 @@ $consulta = "SELECT contenido, control FROM form_datos WHERE form_id ='$formula
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$campo_descripcion= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$descripcion' ");
$campo_key= remplacetas("form_datos","control","$row[control]","contenido"," id_campo = '$key' ");
if($row[control] == "$valor") {
@@ -3966,13 +3966,13 @@ if($name =="") {
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
$onchange = " xajax_contenido_mostrar('$formulario',(this.value),'$div','5')";
$resultado="
Seleccione
" ;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
if($row['control'] == "$valor") {
@@ -4008,13 +4008,13 @@ $name ="primario_$name";
$consulta = "SELECT * FROM form_campos_valores WHERE id_form_campo ='$id_campo' $and ";
$sql=mysqli_query($consulta,$link);
// $value = remplacetas("form_datos","control","$control","contenido","id_campo ='$id_campo' ");
-if (mysql_num_rows($sql)!='0'){
+if (mysqli_num_rows($sql)!='0'){
$resultado=" $valor
Seleccione
" ;
// $resultado = array_unique($entrada);
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$campos = explode(':',$row['campo_valor']);
IF($control_combo ==""){
@@ -4065,17 +4065,17 @@ function aplicacion_carrusel($nombre,$id,$plantilla){
$consulta ="SELECT *,GROUP_CONCAT(id ORDER by timestamp desc ) as identificador FROM form_datos WHERE form_id = '$id' $w_campo GROUP BY control order by contenido";
$link=Conectarse();
$sql=mysqli_query($consulta,$link);
- if (mysql_num_rows($sql)!='0'){
- $control = mysql_result($sql,0,control);
+ if (mysqli_num_rows($sql)!='0'){
+ $control = mysqli_result($sql,0,control);
$nombre = remplacetas('form_id','id',$id,'nombre',"") ;
$descripcion = remplacetas('form_id','id',$id,'descripcion',"") ;
- mysql_data_seek($sql, 0);
+ mysqli_data_seek($sql, 0);
// $contenido = " $nombre[0] ";
// $contenido .= " $descripcion[0] ";
$orden = 0;
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$identificador = explode(',',$row[identificador]);
$identificador = $identificador[0];
@@ -4286,11 +4286,11 @@ GROUP BY form_datos.control
ORDER BY form_datos.timestamp DESC";
$sql = mysqli_query($consulta,$link) or die("error al ejecutar consulta ");
- if (mysql_num_rows($sql)!='0'){
+ if (mysqli_num_rows($sql)!='0'){
$i = 1;
$features = array();
// $features[] = $consulta;
-while($row = mysql_fetch_array( $sql ))
+while($row = mysqli_fetch_array( $sql ))
{
if($datos[tipo]=="simple"){
$contenido = remplacetas('form_datos','id',$row[id_dato],'contenido',"") ;
@@ -4381,11 +4381,11 @@ FROM form_id $w_publico";
$sql = mysqli_query($consulta,$link) or die("error al ejecutar consulta ");
- if (mysql_num_rows($sql)!='0'){
+ if (mysqli_num_rows($sql)!='0'){
$i = 1;
$features = array();
// $features[] = $consulta;
-while($row = mysql_fetch_array( $sql ))
+while($row = mysqli_fetch_array( $sql ))
{
if($datos[tipo]=="simple"){
$contenido = remplacetas('form_datos','id',$row[id_dato],'contenido',"") ;
@@ -4440,11 +4440,11 @@ ORDER BY orden desc";
mysqli_query("SET NAMES 'UTF8'");
$sql = mysqli_query($consulta,$link) or die("error al ejecutar consulta ");
- if (mysql_num_rows($sql)!='0'){
+ if (mysqli_num_rows($sql)!='0'){
$id = 1;
$features = array();
-while( $row = mysql_fetch_array( $sql ) ) {
+while( $row = mysqli_fetch_array( $sql ) ) {
$marcador = array();
$propiedades = array();
$identificador = explode(',',$row[data]);
@@ -4501,8 +4501,8 @@ function aplicacion_presentacion($id,$div,$timeout){
$consulta ="SELECT * FROM form_datos WHERE form_id = '$id' ORDER BY rand() limit 1 ";
$link=Conectarse();
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
-$control = mysql_result($sql,0,control);
+if (mysqli_num_rows($sql)!='0'){
+$control = mysqli_result($sql,0,control);
$impresion = formulario_imprimir("$id","$control","");
}
@@ -4530,12 +4530,12 @@ function aplicaciones_listado($id_form,$tipo,$div){
$link=Conectarse();
mysqli_query("SET NAMES 'utf8'");
$consulta = "SELECT * FROM form_id WHERE $w_publico $w_form ORDER BY orden asc ";
-mysql_real_escape_string($consulta);
+mysqli_real_escape_string($link,$consulta);
$sql=mysqli_query($consulta,$link);
-if (mysql_num_rows($sql)!='0'){
- mysql_data_seek($sql, 0);
+if (mysqli_num_rows($sql)!='0'){
+ mysqli_data_seek($sql, 0);
$resultado_li .= "