Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

204 lines
6.6KB

  1. <?php
  2. //Sākuma fails CV datubāzei!
  3. require 'include/head.php';
  4. require 'include/db.php';
  5. require 'include/check_session.php';
  6. echo '
  7. <div class="w3-container w3-padding-16">
  8. <h2>Atlasītajiem kritērijiem piemērotas personas</h2>';
  9. //Pārbaudīsim, vai ir periods
  10. $nop=$_POST['period1'];
  11. $lidzp=$_POST['period2'];
  12. if($nop=='')
  13. {
  14. $nop='';
  15. }
  16. else
  17. {
  18. echo '<h1>NO:'.$nop.'</h1>';
  19. $nop=strtotime($nop);
  20. }
  21. if($lidzp=='')
  22. {
  23. $lidzp=time();
  24. }
  25. else
  26. {
  27. echo '<h1>LIDZ:'.$lidzp.'</h1>';
  28. $lidzp=strtotime($lidzp);
  29. }
  30. //Šeit dalām rezultātu veidus
  31. if(isset($_POST['meklet']))
  32. {
  33. $tagsk=$_POST['mekl_sk'];
  34. $vajadzigie =0;
  35. $mekl = array();
  36. //vajadzēs ciklu kur mēs būvēsim pieprsījumu,kuru grupēsim pēc personām
  37. for ($i = 1; $i <= $tagsk; $i++) {
  38. if(isset($_POST['Tag'.$i]))
  39. {
  40. $mekl[] = 'TAGID='.$_POST['Tag'.$i];
  41. //pieprasījums ievietošanai
  42. $vajadzigie++;
  43. }
  44. }
  45. if(($vajadzigie==0) && isset($_POST['melnais_sar']))
  46. {
  47. if($nop=='')
  48. {
  49. $meklp="SELECT * FROM tbPersonas WHERE PersBlacklist=1 ORDER BY PersVards ASC";
  50. $meklpr=mysqli_query($conn,$meklp);
  51. }
  52. else
  53. {
  54. $nop=strtotime($nop);
  55. if($lidzp=='')
  56. {
  57. $lidzp=time();
  58. }
  59. else
  60. {
  61. $lidzp=strtotime($lidzp);
  62. }
  63. $meklp="SELECT * FROM tbPersonas WHERE PersBlacklist=1 AND PersPievienots between '$nop' AND '$lidzp' ORDER BY PersVards ASC";
  64. $meklpr=mysqli_query($conn,$meklp);
  65. }
  66. echo '<div class="w3-padding-24 w3-container w3-twothird">
  67. <table class="w3-table w3-striped">
  68. <tr>
  69. <th>Vārds</th>
  70. <th>Uzvārds</th>
  71. <th>E-pasts</th>
  72. <th>Pievienots</th>
  73. <th>Vairāk</th>
  74. </tr>';
  75. while($rowpv=mysqli_fetch_assoc($meklpr))
  76. {
  77. echo'<tr>';
  78. echo'<td>'.$rowpv['PersVards'].'</td>';
  79. echo'<td>'.$rowpv['PersUzvards'].'</td>';
  80. echo'<td>'.$rowpv['PersEpasts'].'</td>';
  81. echo '<td>'.date('Y-m-d', $rowp['PersPievienots']).'</td>';
  82. //echo'<td><a href="/upload/'.$row_pers['CVFails'].'"target="_blank"><button class="w3-button w3-red">CV</button></a></td>';
  83. echo'<td><form action="cvmarket.php" method="POST"><input type="hidden" value="'.$rowpv['PID'].'" name="pers_i"><input type="submit" class="w3-button w3-red" name="pers_vairak" value="Vairāk"></form></td>';
  84. echo'</tr>';
  85. }
  86. echo '</table>';
  87. echo '</div>';
  88. }
  89. else
  90. {
  91. //Izvēlamies vajadzīgo pieprasījumu. Vai tikai melnajā sarakstā, vai visus
  92. if(isset($_POST['melnais_sar']))
  93. {
  94. //dalīsim pa datumiem
  95. //Ja ir periods
  96. if($nop==''){
  97. $mekltg="SELECT *, COUNT(*) FROM tbCVTAG INNER JOIN tbPersonas ON tbCVTAG.PersonasID = tbPersonas.PID INNER JOIN tbTag ON tbCVTAG.TAGID = tbTag.TID";
  98. $mekltg.=" WHERE " . implode (" OR ", $mekl);
  99. $mekltg.=" AND tbPersonas.PersBlacklist=1 GROUP BY PersonasID ORDER BY COUNT(*) DESC";
  100. $rezultats = mysqli_query($conn,$mekltg);
  101. }
  102. else
  103. {
  104. $mekltg="SELECT *, COUNT(*) FROM tbCVTAG INNER JOIN tbPersonas ON tbCVTAG.PersonasID = tbPersonas.PID INNER JOIN tbTag ON tbCVTAG.TAGID = tbTag.TID";
  105. $mekltg.=" WHERE " . implode (" OR ", $mekl);
  106. $mekltg.=" AND tbPersonas.PersBlacklist=1 AND PersPievienots between '$nop' AND '$lidzp' GROUP BY PersonasID ORDER BY COUNT(*) DESC";
  107. $rezultats = mysqli_query($conn,$mekltg);
  108. }
  109. }
  110. else
  111. {
  112. if($nop==''){
  113. $mekltg="SELECT *, COUNT(*) FROM tbCVTAG INNER JOIN tbPersonas ON tbCVTAG.PersonasID = tbPersonas.PID INNER JOIN tbTag ON tbCVTAG.TAGID = tbTag.TID";
  114. $mekltg.=" WHERE " . implode (" OR ", $mekl);
  115. $mekltg.=" GROUP BY PersonasID ORDER BY COUNT(*) DESC";
  116. $rezultats = mysqli_query($conn,$mekltg);
  117. }
  118. else
  119. {
  120. $mekltg="SELECT *, COUNT(*) FROM tbCVTAG INNER JOIN tbPersonas ON tbCVTAG.PersonasID = tbPersonas.PID INNER JOIN tbTag ON tbCVTAG.TAGID = tbTag.TID";
  121. $mekltg.=" WHERE " . implode (" OR ", $mekl);
  122. $mekltg.=" AND PersPievienots between '$nop' AND '$lidzp' GROUP BY PersonasID ORDER BY COUNT(*) DESC";
  123. $rezultats = mysqli_query($conn,$mekltg);
  124. }
  125. }
  126. echo '
  127. <div class="w3-padding-24 w3-container w3-twothird">
  128. <table class="w3-table w3-striped">
  129. <tr>
  130. <th>Vārds</th>
  131. <th>Uzvārds</th>
  132. <th>E-pasts</th>
  133. <th>Atbilstības</th>
  134. <!--<th>CV</th>-->
  135. <th>Pievienots</th>
  136. <th>Vairāk</th>
  137. </tr>';
  138. while($row=mysqli_fetch_assoc($rezultats))
  139. {
  140. echo'<tr>';
  141. echo'<td>'.$row['PersVards'].'</td>';
  142. echo'<td>'.$row['PersUzvards'].'</td>';
  143. echo'<td>'.$row['PersEpasts'].'</td>';
  144. echo'<td>'.$row['COUNT(*)'].'/'.$vajadzigie.'</td>';
  145. echo '<td>'.date('Y-m-d', $row['PersPievienots']).'</td>';
  146. //echo'<td><a href="/upload/'.$row_pers['CVFails'].'"target="_blank"><button class="w3-button w3-red">CV</button></a></td>';
  147. echo'<td><form action="cvmarket.php" method="POST"><input type="hidden" value="'.$row['PID'].'" name="pers_i"><input type="submit" class="w3-button w3-red" name="pers_vairak" value="Vairāk"></form></td>';
  148. echo'</tr>';
  149. }
  150. echo '</table>';
  151. }
  152. }
  153. else
  154. {
  155. if(isset($_POST['meklet_pers']))
  156. {
  157. //meklēsim pēc vārda uzvārda
  158. $persdat=$_POST['vards_uzvards'];
  159. //Ja nav periods
  160. if($nop==''){
  161. $meklp="SELECT * FROM tbPersonas WHERE PersVards LIKE '%$persdat%' OR PersUzvards LIKE '%$persdat%'";
  162. }
  163. else{
  164. //ja ir periods
  165. $meklp="SELECT * FROM tbPersonas WHERE (PersVards LIKE '%$persdat%' OR PersUzvards LIKE '%$persdat%') AND PersPievienots between '$nop' AND '$lidzp' ";
  166. //echo '<h1>NO:'.$nop.'</h1>';
  167. //echo '<h1>LIDZ:'.$lidzp.'</h1>';
  168. }
  169. $meklpr=mysqli_query($conn,$meklp);
  170. echo '<div class="w3-padding-24 w3-container w3-twothird">
  171. <table class="w3-table w3-striped">
  172. <tr>
  173. <th>Vārds</th>
  174. <th>Uzvārds</th>
  175. <th>E-pasts</th>
  176. <th>Pievienots</th>
  177. <th>Vairāk</th>
  178. </tr>';
  179. while($rowpv=mysqli_fetch_assoc($meklpr))
  180. {
  181. echo'<tr>';
  182. echo'<td>'.$rowpv['PersVards'].'</td>';
  183. echo'<td>'.$rowpv['PersUzvards'].'</td>';
  184. echo'<td>'.$rowpv['PersEpasts'].'</td>';
  185. echo '<td>'.date('Y-m-d', $rowpv['PersPievienots']).'</td>';
  186. //echo'<td><a href="/upload/'.$row_pers['CVFails'].'"target="_blank"><button class="w3-button w3-red">CV</button></a></td>';
  187. echo'<td><form action="cvmarket.php" method="POST"><input type="hidden" value="'.$rowpv['PID'].'" name="pers_i"><input type="submit" class="w3-button w3-red" name="pers_vairak" value="Vairāk"></form></td>';
  188. echo'</tr>';
  189. }
  190. echo '</table>';
  191. }
  192. }
  193. echo '</div>';
  194. //echo mysqli_error($conn);
  195. //echo $mekltg;
  196. ?>

Powered by TurnKey Linux.