1
- <?php
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
2
4
3
- /*
4
- // LDAP variables
5
- $ldaphost = "proxy.ripley.local"; // your ldap servers
6
- $ldapport = 8080; // your ldap server's port number
5
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
6
+ <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css">
7
+ <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap.min.css">
7
8
8
- // Connecting to LDAP
9
- $ldapconn = ldap_connect($ldaphost, $ldapport);
9
+ <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
10
+ <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
11
+ <script src="https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js"></script>
12
+ <script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js"></script>
13
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
14
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
15
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
16
+ <script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js"></script>
17
+ <script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js"></script>
10
18
11
- if($ldapconn){
12
- echo "Conect result {$ldapconn}";
13
- }else{
14
- echo "Could not connect to $ldaphost";
15
- }
19
+ <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
20
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
21
+ <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script>-->
16
22
17
- */
18
23
19
- // LDAP variables
20
- $ ldaphost = "proxy.ripley.local " ; // your ldap servers
21
- $ ldapport = 8080 ; // your ldap server's port number
22
- $ ldaprdn = 'Andres Gutierrez Valle (CL) ' ; // ldap rdn or dn
23
- $ ldappass = 'Amparo16 ' ; // associated password
24
+ </head>
25
+ <body>
24
26
25
- //$server = "ldaps://w1156p.ripley.local";
26
- $ server = "10.0.1.50 " ;
27
+ <div class="row col-md-10">
28
+ <div class="col-md-12">
29
+ <?php
30
+ $ link = new PDO ('mysql:host=localhost;dbname=CMS ' , 'root ' ,'faCV0512 ' );
31
+ ?>
32
+ <div class="portlet box purple">
33
+ <div class="portlet-title">
34
+ <div class="tools">
35
+ <a href="javascript:;" class="collapse" data-original-title="" title=""> </a>
36
+ </div>
37
+ </div>
38
+ <div class="portlet-body">
39
+ <br><br><br>
40
+ <table class="table table-striped table-bordered table-hover dt-responsive" width="100%" id="sample_1">
41
+ <thead>
42
+ <tr class="info">
43
+ <th>ID</th>
44
+ <th>Nombre</th>
45
+ <th width="5%" class="notReport">Activo</th>
46
+ <th width="5%" class="notReport">Operacion</th>
47
+ </tr>
48
+ </thead>
49
+ <tbody>
50
+ <?php
51
+ $ SQL =" SELECT * FROM CATEGORY ORDER BY id " ;
52
+ $ link ->setAttribute ( PDO ::ATTR_ERRMODE , PDO ::ERRMODE_EXCEPTION );
53
+ $ RES = $ link ->prepare ($ SQL );
54
+ $ RES ->execute ();
55
+ foreach ($ RES as $ k => $ row )
56
+ {
57
+ ?>
58
+ <tr class="odd gradeX">
59
+ <td><?php echo $ row [0 ] ?> </td>
60
+ <td><?php echo $ row [1 ] ?> </td>
61
+ <td >
62
+ <i class="glyphicon glyphicon-ok" style="color:#006600;"></i>
63
+ </td>
64
+ <td align ='center' >
65
+ <form name="formJournal" action="" onSubmit="journalTerminal(); return false" class="form-horizontal">
66
+ <button type="submit" name="guardar" id="guardar" style="border:0px; background:transparent;"> <i class='glyphicon glyphicon-list-alt' style='color:blue;'></i> </button>
67
+ </form>
68
+ <script type="text/javascript">
27
69
28
- // connect to ldap server
29
- $ ldapconn = ldap_connect ($ server );
70
+ function objetoAjax(){
71
+ var xmlhttp=false;
72
+ try {
73
+ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
74
+ } catch (e) {
75
+ try {
76
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
77
+ } catch (E) {
78
+ xmlhttp = false;
79
+ }
80
+ }
81
+ if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
82
+ xmlhttp = new XMLHttpRequest();
83
+ }
84
+ return xmlhttp;
85
+ }
86
+ function journalTerminal(){
87
+ //div donde se mostrará lo resultados
88
+ divResultado = document.getElementById('divJournal');
30
89
31
- if ($ ldapconn ) {
90
+ //recogemos los valores de los inputs
91
+ dateJournal= '29-04-2018' // document.formJournal.dateJournal.value;
92
+ cod_sucursal= '05-05-2018' // document.formJournal.cod_sucursal.value;
32
93
33
- echo "Conecting ...... " ;
34
- echo "<br> " ;
35
- echo "Connected to the server...Conect result: " .$ server ;
36
- echo "<br> " ;
37
- // binding to ldap server
38
- $ ldapbind = ldap_bind ($ server );
94
+ //instanciamos el objetoAjax
95
+ ajax=objetoAjax();
39
96
40
- // verify binding
41
- if ($ ldapbind ) {
42
- echo "LDAP bind successful... " ;
43
- } else {
44
- echo "LDAP bind failed... " ;
45
- }
97
+ //uso del medotod POST
98
+ //archivo que realizará la operacion
99
+ ajax.open("POST", "JOURNAL.php",true);
100
+ //cuando el objeto XMLHttpRequest cambia de estado, la función se inicia
101
+ ajax.onreadystatechange=function() {
102
+ //la función responseText tiene todos los datos pedidos al servidor
103
+ if (ajax.readyState==4) {
104
+ divResultado.innerHTML=ajax.responseText;
105
+ }else{
106
+ //divResultado.innerHTML='../MASTER/images/loaders/loader6.gif';
107
+ document.getElementById('divJournal').innerHTML='<img src="../../MASTER/images/loaders/loader6.gif" width="10%" height="10%" align="center">';
108
+ }
109
+ }
110
+ ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
111
+ ajax.send("dateJournal="+dateJournal+"&cod_sucursal="+cod_sucursal)
112
+ }
113
+ </script>
46
114
47
- }else {
48
- echo "<br> " ;
49
- echo "Could not connect to LDAP server. " ;
50
- }
115
+ </td>
116
+ </tr>
117
+ <?php
118
+ }
119
+ $ link = null ;
120
+ $ RES = null ;
121
+ ?>
122
+ </tbody>
123
+ </table>
124
+ </div>
125
+ </div>
126
+ </div>
127
+ </div>
51
128
52
129
130
+ <script>
53
131
54
- ?>
132
+ $(document).ready(function(){
133
+
134
+ /*
135
+ $('#sample_1').DataTable( {
136
+ //dom: 'Bfrtip',
137
+ buttons: [
138
+ 'print', 'pdf', 'csv'
139
+ ]
140
+ } );
141
+ */
142
+
143
+ // $('#sample_1').DataTable().destroy();
144
+
145
+ //var datatable = $('#sample_1').DataTable();
146
+
147
+ //datatable.buttons()
148
+
149
+
150
+ $('#sample_1').DataTable( {
151
+ dom: 'Bfrtip',
152
+ buttons: [
153
+ {
154
+ extend: 'print',
155
+ exportOptions: {
156
+ columns: ':not(.notReport)'
157
+ }
158
+ },
159
+ {
160
+ extend: 'pdf',
161
+ exportOptions: {
162
+ columns: ':not(.notReport)'
163
+ }
164
+ },
165
+ {
166
+ extend: 'csv',
167
+ exportOptions: {
168
+ columns: ':not(.notReport)'
169
+ }
170
+ }
171
+
172
+ ]
173
+ } );
174
+
175
+
176
+ });
177
+ </script>
178
+
179
+ </body>
180
+ </html>
0 commit comments