Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getsearchresultscid($FROM, $to, $sort, $arrange, $value, $rating, $cid){
- $n=0;
- $result="";
- // All nominations
- 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");}
- // Companies that want us to judge internal nominations
- 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");}
- else
- // Search by company
- {$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");}
- while($row=mysql_fetch_array($sql))
- {$result[$n]['id']=$row['id'];
- $result[$n]['date']=$row['date'];
- $result[$n]['name']=$row['name'];
- $result[$n]['company']=$row['company'];
- $result[$n]['nominee']=$row['nominee'];
- $result[$n]['department']=$row['department'];
- $result[$n]['comment']=htmlentities($row['comment']);
- $result[$n]['rating']=$row['rating'];
- $result[$n]['cid']=$row['cid'];
- $result[$n]['custom1']=$row['custom1'];
- $result[$n]['certificate']=$row['certificate'];
- $result[$n]['adhoc_name']=$row['adhoc_name'];
- if($row['custom1']=="1"){$result[$n]['internal']="Int";}else{$result[$n]['internal']="Ext";}
- if($row['certificate']=="1"){$result[$n]['certificate']="C";}else{$result[$n]['certificate']="";}
- if ($row['adhoc_name']!=""){$result[$n]['adhoc_name']="L";}else{$result[$n]['adhoc_name']="";}
- $n++;
- }
- return $result;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement