/var/www/vhosts/sivana.com.br/httpdocs/area-associado/filtro_curso.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?php
if (($_SESSION['asso']=='asso_siv')) {
?>

<?php include_once("../_private/conectar.php"); 
include_once(
"../admin/itens.php"); 





$id$_GET['id'];
$estado $_GET['est'];

if(!isset(
$_GET["seed"])) {        
$seed rand();   
// Caso ainda não exista uma semente, cria a semente via PHP.    
} else {       
$seed addslashes($_GET["seed"]);  
// Caso já exista uma semente, utiliza a que foi passada na url. (o addslashes é por questão de segurança)   
}    

foreach (
$_REQUEST as $campo => $valor ){ $$campo strip_tags(trim($valor)); }


                        
$selecionar "select nome, idcurriculo, curriculo.cidade,  (YEAR(CURDATE())-YEAR(data_nascimento)) - (RIGHT(CURDATE(),5)<RIGHT(data_nascimento,5)) as idade, fone, trabalha, curriculo.outros, capacitacao.curso from curriculo left outer join capacitacao on (capacitacao.curriculo_idcurriculo = curriculo.idcurriculo) where ativado='s' ";
                        if (
$outros!=''){
                            
$selecionar .= " and (curriculo.outros like '$outros%' or curso like '$outros%')";
                        }
                        if (
$senac=='s'){
                            
$selecionar .= " and idcurriculo = ANY (SELECT curriculo_idcurriculo fROM capacitacao WHERE capacitacao.lugar = 's')
"
;
                        }
                        
                        if (
$grau!=''){
                
$selecionar .= " and idcurriculo = ANY (SELECT curriculo_idcurriculo fROM formacao left outer join grau_inst on (formacao.grau_inst_idgrau_inst = grau_inst.idgrau_inst) WHERE idgrau_inst = '$grau')
"
;
                        }
                        
                        if (
$trabalha!=''){
                
$selecionar .= " and curriculo.trabalha  = '$trabalha'
"
;
                        }
                        if ((
$idadei!='') && ($idadef=='')){
                
$selecionar .= " and (YEAR(CURDATE())-YEAR(data_nascimento)) - (RIGHT(CURDATE(),5)<RIGHT(data_nascimento,5)) = '$idadei'
"
;
}                    
                    if ((
$idadei!='') && ($idadef!='')){
                
$selecionar .= " and (YEAR(CURDATE())-YEAR(data_nascimento)) - (RIGHT(CURDATE(),5)<RIGHT(data_nascimento,5)) between '$idadei' and '$idadef'
"
;
                        }
                    if (
$cidade!=''){
                
$selecionar .= " and curriculo.cidade like '$cidade%'
"
;
                        }
                        
//$selecionar .= " and(DATEDIFF( now( ) , curriculo.data_ativacao ) <= 90) group by idcurriculo order by RAND($seed)";
                        
$selecionar .= " group by idcurriculo order by RAND($seed)";
                        
                        
$sql mysql_query($selecionar) or die("erro ao selecionar".mysql_error());
                        
$total mysql_num_rows($sql);
                        
                        
                        
                    
//$count=$row_cont["total"];
                    
$count=$total;
                    
                
//COMEÇA A PAGINAÇAO //        
                        
if (isset($_GET['qtde'])){
                            
$showrecs $_GET['qtde'];
                        }else{
                            
$showrecs =20;
                        }
                            
$pagerange 10;
                        
                        if(
is_numeric(@$_GET["page"])){
                        
$page = @$_GET["page"];  
                        }else{
                        
$page =1;
                        }
                        if (!isset(
$page)) $page 1;
                        
                     
                      if (
$count $showrecs != 0) {
                        
$pagecount intval($count $showrecs) + 1;
                      }
                      else {
                        
$pagecount intval($count $showrecs);
                      }
                      
$startrec $showrecs * ($page 1);
                      if (
$startrec $count) {@mysql_data_seek($sql$startrec);}
                      
$reccount min($showrecs $page$count);
                      
                    
?>
    
<?php        
                    
                    
                        
                        
function showpagenav($page$pagecount)
                        {
                        global 
$seed;
                        
                        
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                        <td bgcolor="#F0F0F0"><table width="260" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#F0F0F0">
                        <tr valign="middle">
                        <?php if ($page 1) { ?>
                        <td align="right"><table width="65" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                        <td width="20" align="center" valign="middle" class="bt_prev">&nbsp;</td>
                        <td width="60" class="bt_dir"><a href="<?php $_SERVER['PHP_SELF'?>?p=3&page=<?php echo $page 1 ?><?php if(isset($_GET['qtde'])){ echo '&qtde='.$_GET['qtde']; }?><?php if ($_REQUEST['grau']!=''){ echo '&amp;grau='.$_REQUEST['grau'];}?><?php if ($_REQUEST['trabalha']!=''){ echo '&amp;trabalha='.$_REQUEST['trabalha'];}?><?php if ($_REQUEST['idadei']!=''){ echo '&amp;idadei='.$_REQUEST['idadei'];}?><?php if ($_REQUEST['idadef']!=''){ echo '&amp;idadef='.$_REQUEST['idadef'];}?><?php if ($_REQUEST['cidade']!=''){ echo '&amp;cidade='.$_REQUEST['cidade'];}?><?php if ($_REQUEST['outros']!=''){ echo '&amp;outros='.$_REQUEST['outros'];}?>&amp;seed=<? echo $seed;?>">Anterior</a></td>
                        </tr>
                        </table></td>
                        <?php } else {?>
                        <td align="right"><table width="65" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                        <td width="20" align="center" valign="middle" class="bt_prev">&nbsp;</td>
                        <td width="60" class="bt_dir">Anterior</td>
                        </tr>
                        </table></td>
                        <?php
                        
}
                        global     
$startrec;        
                        global 
$pagerange;
                        global 
$reccount;
                        global 
$total;
                        if (
$pagecount 1) {
                        
                        if (
$pagecount $pagerange != 0) {
                        
$rangecount intval($pagecount $pagerange) + 1;
                        }
                        else {
                        
$rangecount intval($pagecount $pagerange);
                        }
                        for (
$i 1$i $rangecount 1$i++) {
                        
$startpage = (($i 1) * $pagerange) + 1;
                        
$count min($i $pagerange$pagecount);
                        
                        if (((
$page >= $startpage) && ($page <= ($i $pagerange)))) {
                        for (
$j $startpage$j $count 1$j++) {
                        if (
$j == $page) {
                        
?>
                        <td class="bt_nav"><font size="2" face="Arial, Helvetica, sans-serif"><b><?php echo $j ?></b></font></td>
                        <?php } else { ?>
                        <td class="bt_nav"><font size="2" face="Arial, Helvetica, sans-serif"><a href="<?php $_SERVER['PHP_SELF'?>?p=3&page=<?php echo $j ?><?php if(isset($_GET['qtde'])){ echo '&qtde='.$_GET['qtde']; }?><?php if ($_REQUEST['grau']!=''){ echo '&amp;grau='.$_REQUEST['grau'];}?><?php if ($_REQUEST['trabalha']!=''){ echo '&amp;trabalha='.$_REQUEST['trabalha'];}?><?php if ($_REQUEST['idadei']!=''){ echo '&amp;idadei='.$_REQUEST['idadei'];}?><?php if ($_REQUEST['idadef']!=''){ echo '&amp;idadef='.$_REQUEST['idadef'];}?><?php if ($_REQUEST['cidade']!=''){ echo '&amp;cidade='.$_REQUEST['cidade'];}?><?php if ($_REQUEST['outros']!=''){ echo '&amp;outros='.$_REQUEST['outros'];}?>&amp;seed=<? echo $seed;?>">
<?php echo $j ?></a></font></td>
                        <?php } } } else { ?>
                        <td class="bt_nav"><font size="2" face="Arial, Helvetica, sans-serif"><a href="<?php $_SERVER['PHP_SELF'?>?page=<?php echo $startpage ?><?php if(isset($_GET['qtde'])){ echo '&qtde='.$_GET['qtde']; }?><?php if ($_REQUEST['grau']!=''){ echo '&amp;grau='.$_REQUEST['grau'];}?><?php if ($_REQUEST['trabalha']!=''){ echo '&amp;trabalha='.$_REQUEST['trabalha'];}?><?php if ($_REQUEST['idadei']!=''){ echo '&amp;idadei='.$_REQUEST['idadei'];}?><?php if ($_REQUEST['idadef']!=''){ echo '&amp;idadef='.$_REQUEST['idadef'];}?><?php if ($_REQUEST['cidade']!=''){ echo '&amp;cidade='.$_REQUEST['cidade'];}?><?php if ($_REQUEST['outros']!=''){ echo '&amp;outros='.$_REQUEST['outros'];}?>&amp;seed=<? echo $seed;?>">
<?php echo $startpage ."..." .$count ?></a></font></td>
                        <?php } } } ?>
                        <?php if ($page $pagecount) { ?>
                        <td align="left">
                        <table width="80" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                        <td align="center" valign="middle" class="bt_left"><a href="<?php $_SERVER['PHP_SELF'?>?p=3&page=<?php echo $page 1 ?><?php if(isset($_GET['qtde'])){ echo '&qtde='.$_GET['qtde']; }?><?php if ($_REQUEST['grau']!=''){ echo '&amp;grau='.$_REQUEST['grau'];}?><?php if ($_REQUEST['trabalha']!=''){ echo '&amp;trabalha='.$_REQUEST['trabalha'];}?><?php if ($_REQUEST['idadei']!=''){ echo '&amp;idadei='.$_REQUEST['idadei'];}?><?php if ($_REQUEST['idadef']!=''){ echo '&amp;idadef='.$_REQUEST['idadef'];}?><?php if ($_REQUEST['cidade']!=''){ echo '&amp;cidade='.$_REQUEST['cidade'];}?><?php if ($_REQUEST['outros']!=''){ echo '&amp;outros='.$_REQUEST['outros'];}?>&amp;seed=<? echo $seed;?>">Pr&oacute;xima</a></td>
                        <td class="bt_next">&nbsp;</td>
                        </tr>
                        </table></td>
                        <?php } else {?>
                        <td align="left">
                        <table width="80" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                        <td align="center" valign="middle" class="bt_left">Pr&oacute;xima</td>
                        <td class="bt_next">&nbsp;</td>
                        </tr>
                        </table></td>                     
                        <?php ?>
                        </tr>
                        </table></td>
                        </tr>
                        <tr>
                        <td bgcolor="#FFFFFF">
                       <table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" class="bt_registros">
                    <tr><td>
                    
                      Registros mostrados <?php echo $startrec 1 ?> - <?php echo $reccount ?> de <?php echo $total ?></td>
                    </tr>
                    </table>
                        </td>
                        </tr>
</table>
                        
                        <?php 
                    
                    
?>
                    
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="class_tit">
  <tr>
    <td width="5%" height="16" align="center"><img src="images/bts/cont.png" width="48" height="48" /></td>
    <td width="77%" style="vertical-align: middle;">BANCO DE TALENTOS (Pesquisar por Cursos)</td>
    <td width="18%" align="center"><a href="principal.php"><img src="images/bts/voltar.jpg" width="55" height="50" class="imagem" /></a></td>
  </tr>
</table>
<br />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="se_itens">
  <tr>
    <td height="52"><div class="widgetcontent span12">
      <form id="form1" name="form1" method="post" action="?p=3" onkeypress="MM_jumpMenu('parent',this,0)" class="stdform">
        

         <div class="span4 pull-left">
        <label>Digite um Curso:</label>
          <span class="field">
            <input name="outros" type="text" id="outros" size="35"  value="<?php echo $_REQUEST["outros"];?>"/></span>
            </div>
          <div class="span6  pull-left">
        <label>Idade entre</label>
           <span class="field"> 
            <input name="idadei" type="text" id="idadei" size="5" value="<?php if ($_POST['idadei']!=''){echo $_POST['idadei'];} if ($_GET['idadei']!=''){echo $_GET['idadei'];} ?>"  class="input-small"/>
 e 
 <input name="idadef" type="text" id="idadef" size="5" value="<?php if ($_POST['idadef']!=''){echo $_POST['idadef'];} if ($_GET['idadef']!=''){echo $_GET['idadef'];} ?>"class="input-small"/>
            </label></span>
          </div>
        <div class="span4 pull-left">
        <label>Grau de Escolaridade:</label>
          <span class="field"><select name="grau" id="grau">
            <option value="">Selecione</option>
            <?

   $sql_grau 
"SELECT * FROM grau_inst";
   
$resultado_grau mysql_query($sql_grau) or die ("Problema na Consulta");
    while(
$l_forminha mysql_fetch_array($resultado_grau))
       {
?>
            <option value="<?=$l_forminha['idgrau_inst'?><?php if (($_POST['grau']==$l_forminha['idgrau_inst'])|| ($_GET['grau']==$l_forminha['idgrau_inst'])){ echo 'selected="selected"';}?>>
            <?=$l_forminha['grau'?>
            </option>
            <?
       
}
?>
          </select></span>
          </div>
          
           <div class="span6">
          <label>Cidade:</label>
          <span class="field">
            <input type="text" name="cidade" id="cidade"  value="<?php if ($_POST['cidade']!=''){echo $_POST['cidade'];} if ($_GET['cidade']!=''){echo $_GET['cidade'];} ?>"/></span>
          </div>
        <div class="span4">
         <label>Pode estar trabalhando atualmente:</label>
          <span class="field">
            <select name="trabalha" id="trabalha">
              <option value="">Selecione</option>
              <option value="s" <?php if (($_POST['trabalha']=='s')|| ($_GET['trabalha']=='s')){ echo 'selected="selected"';}?>>Sim</option>
              <option value="n" <?php if (($_POST['trabalha']=='n') || ($_GET['trabalha']=='n')){ echo 'selected="selected"';}?>>N&atilde;o</option>
            </select>
          </label></span>
          </div>
        
          <div class="clearfix"></div>
        <div class="span6">
          <label>
            <input type="image" name="imageField" id="imageField" src="images/bt_pesq.gif" /></label>
            <label> <a href="?p=2"><img src="images/bt_limp.gif" width="81" height="23" border="0" /></a></label></div>
      </form>
    </div></td>
  </tr>
</table>
<br />
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="borda">
  <tr class="t_tit">
    <td width="3%">#</td>
    <td width="3%">&nbsp;</td>
    <td width="32%">Nome</td>
    <td width="21%">Capacita&ccedil;&atilde;o</td>
    <td width="7%">Grau de esc.</td>
    <td width="23%">Inform&aacute;tica</td>
    <td width="4%">Idade</td>
    <td width="3%">&nbsp;</td>
  </tr>
  <?php 
  
if ($total 0) {
    for (
$i $startrec$i $reccount$i++)    {
        
$dados mysql_fetch_assoc($sql); 
        
$style "trbranco";
        if (
$i != 0) {
         
$style "trcinza";
    }
        
$contador$i+1;
    
?> 
  <tr  class="<?php echo $style ?>">
    <td align="center" class="colun" ><?php echo $contador?></td>
    <td align="center" class="colun"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center"><a href="mostrar_cand.php?id=<?php echo base64_encode($dados['idcurriculo']);?>&pag=2<?php if ($_REQUEST['grau']!=''){ echo '&amp;grau='.$_REQUEST['grau'];}?><?php if ($_REQUEST['trabalha']!=''){ echo '&amp;trabalha='.$_REQUEST['trabalha'];}?><?php if ($_REQUEST['idadei']!=''){ echo '&amp;idadei='.$_REQUEST['idadei'];}?><?php if ($_REQUEST['idadef']!=''){ echo '&amp;idadef='.$_REQUEST['idadef'];}?><?php if ($_REQUEST['cidade']!=''){ echo '&amp;cidade='.$_REQUEST['cidade'];}?><?php if ($_REQUEST['outros']!=''){ echo '&amp;outros='.$_REQUEST['outros'];}?><?php if ($_GET['page']!=''){ echo '&amp;page='.$_GET['page'];}?>&amp;seed=<? echo $seed;?>"><img src="../admin/images/mark_f2.png" width="21" height="21" border="0" /></a></td>
        </tr>
    </table></td>
    <td align="left" class="colun"><?php echo $dados['nome']; ?></td>
    <td align="center" class="colun"><?php 
        $cur 
$dados['idcurriculo'];
        
$s_cap mysql_query("select curso from capacitacao where curriculo_idcurriculo='$cur'")or die ("Erro ao selecionar");
        while (
$s_l mysql_fetch_array($s_cap)){ 
        echo 
$s_l['curso'].'<br>'
        }
            
?>    </td>
    <td align="center" class="colun"><?php 
        $s_grau 
mysql_query("select * from formacao left outer join grau_inst on (formacao.grau_inst_idgrau_inst = grau_inst.idgrau_inst) where curriculo_idcurriculo='$cur'")or die ("Erro ao selecionar");
        while (
$s mysql_fetch_array($s_grau)){ 
        echo 
$s['grau'].'<br>'
        }
            
?></td>
    <td align="center" class="colun">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php
if (($dados['win']=="s")){
?>
Windows - 
<?php ?>                                
<?php
if (($dados['wor']=="s")){
?>
Word - 
<?php ?>    
<?php
if (($dados['exc']=="s")){
?>
Excel - 
<?php ?>                                
 <?php
if (($dados['pow']=="s")){
?>
Power Point - 
<?php ?>  
<?php
if (($dados['internet']=="s")){
?>
Internet -
<?php ?>                                
<?php
if (($dados['outros']!="")){
?>
<?php 
echo nl2br($dados['outros']); ?>
<?php 
?>                                
      </table>    </td>
    <td align="center" class="colun"><?php echo $dados['idade']; ?></td>
    <td align="center" class="colun"><?php 
        $s_cap 
mysql_query("SELECT curriculo_idcurriculo from capacitacao WHERE capacitacao.lugar = 's' and curriculo_idcurriculo='$cur' group by curriculo_idcurriculo")or die ("Erro ao selecionar");
            
$to_cap mysql_num_rows($s_cap);
            if (
$to_cap 0){
             echo 
'<img src="images/senac.gif" width="26" height="25" align="absmiddle" />';
            }
           
?></td>
  </tr>
  <?php } while ($dados mysql_fetch_assoc($sql)); 
  }else{
?>
  <tr>
  <td colspan="8"> Nao h&aacute; registros </td></tr>
  <?php ?>
</table>
<?php showpagenav($page$pagecount); 
?>

<?php
} else {
    print(
"<script language='javascript'>window.location ='index.php?login=no'</script>");
}
?>