-// Format the like/dislike text for a profile item
-// $cnt = number of people who like/dislike the item
-// $arr = array of pre-linked names of likers/dislikers
-// $type = one of 'like, 'dislike'
-// $id = item id
-// returns formatted text
-
-if(! function_exists('format_like')) {
-function format_like($cnt,$arr,$type,$id) {
- $o = '';
- if($cnt == 1)
- $o .= $arr[0] . (($type === 'like') ? t(' likes this.') : t(' doesn\'t like this.')) . EOL ;
- else {
- $o .= '<span class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');" >'
- . $cnt . ' ' . t('people') . '</span> ' . (($type === 'like') ? t('like this.') : t('don\'t like this.')) . EOL ;
- $total = count($arr);
- if($total >= MAX_LIKERS)
- $arr = array_slice($arr, 0, MAX_LIKERS - 1);
- if($total < MAX_LIKERS)
- $arr[count($arr)-1] = t('and') . ' ' . $arr[count($arr)-1];
- $str = implode(', ', $arr);
- if($total >= MAX_LIKERS)
- $str .= t(', and ') . $total - MAX_LIKERS . t(' other people');
- $str .= (($type === 'like') ? t(' like this.') : t(' don\'t like this.'));
- $o .= "\t" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
- }
- return $o;
-}}