Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. function getsearchresultscid($FROM, $to, $sort, $arrange, $value, $rating, $cid){
  2. $n=0;
  3. $result="";
  4. // All nominations
  5. if ($cid=="*"){$sql=mysql_query("SELECT comments.id, date_format(comments.date_app, '%d/%m/%Y') AS date, comments.name, comments.nominee, comments.department, comments.comment, comments.recommended, comments.rating, company.company, comments.cid, comments.custom1, certificates.certificate AS certificate, adhoc_comments.name as adhoc_name FROM (comments left join company on comments.cid=company.id) left join certificates on comments.id = certificates.id left join adhoc_comments on comments.id = adhoc_comments.id WHERE comments.date_app > '$FROM' AND comments.date_app < '$to' AND comments.type = 'nomination' AND comments.authorised = '1' AND comments.rating $value $rating AND (comments.custom1 = '0' OR (comments.custom1 = '1' AND (company.id = '103' OR company.id = '112')) OR comments.date_app > '$FROM' AND comments.date_app < '$to' AND comments.type = 'nomination' AND comments.authorised = '2' AND comments.rating $value $rating AND comments.custom1 = '0') ORDER BY $sort $arrange");}
  6.  
  7. // Companies that want us to judge internal nominations
  8. elseif ($cid=="103" || $cid=="112" ){$sql=mysql_query("SELECT comments.id, date_format(comments.date_app, '%d/%m/%Y') AS date, comments.name, comments.nominee, comments.department, comments.comment, comments.recommended, comments.rating, company.company, comments.cid, comments.custom1, certificates.certificate AS certificate, adhoc_comments.name as adhoc_name FROM (comments left join company on comments.cid=company.id) left join certificates on comments.id = certificates.id left join adhoc_comments on comments.id = adhoc_comments.id WHERE comments.date_app > '$FROM' AND comments.date_app < '$to' AND comments.type = 'nomination' AND comments.authorised = '1' AND comments.rating $value $rating OR comments.date_app > '$FROM' AND comments.date_app < '$to' AND comments.type = 'nomination' AND comments.authorised = '2' AND comments.rating $value $rating AND comments.custom1 = '0' ORDER BY $sort $arrange");}
  9. else
  10.  
  11. // Search by company
  12. {$sql=mysql_query("SELECT comments.id, date_format(comments.date_app, '%d/%m/%Y') AS date, comments.name, comments.nominee, comments.department, comments.comment, comments.recommended, comments.rating, company.company, comments.cid, comments.custom1, certificates.certificate AS certificate, adhoc_comments.name as adhoc_name FROM (comments left join company on comments.cid=company.id) left join certificates on comments.id = certificates.id left join adhoc_comments on comments.id = adhoc_comments.id WHERE comments.date_app > '$FROM' AND comments.date_app < '$to' AND comments.type = 'nomination' AND comments.authorised = '1' AND comments.rating $value $rating AND comments.cid = $cid AND comments.custom1 = '0' OR comments.date > '$FROM' AND comments.date < '$to' AND comments.type = 'nomination' AND comments.authorised = '2' AND comments.rating $value $rating AND comments.cid = $cid AND comments.custom1 = '0' ORDER BY $sort $arrange");}
  13.  
  14. while($row=mysql_fetch_array($sql))
  15. {$result[$n]['id']=$row['id'];
  16. $result[$n]['date']=$row['date'];
  17. $result[$n]['name']=$row['name'];
  18. $result[$n]['company']=$row['company'];
  19. $result[$n]['nominee']=$row['nominee'];
  20. $result[$n]['department']=$row['department'];
  21. $result[$n]['comment']=htmlentities($row['comment']);
  22. $result[$n]['rating']=$row['rating'];
  23. $result[$n]['cid']=$row['cid'];
  24. $result[$n]['custom1']=$row['custom1'];
  25. $result[$n]['certificate']=$row['certificate'];
  26. $result[$n]['adhoc_name']=$row['adhoc_name'];
  27.  
  28. if($row['custom1']=="1"){$result[$n]['internal']="Int";}else{$result[$n]['internal']="Ext";}
  29.  
  30. if($row['certificate']=="1"){$result[$n]['certificate']="C";}else{$result[$n]['certificate']="";}
  31. if ($row['adhoc_name']!=""){$result[$n]['adhoc_name']="L";}else{$result[$n]['adhoc_name']="";}
  32. $n++;
  33. }
  34. return $result;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement