(Original Author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ class FacebookHelper extends Helper { var $helpers = array('Html'); var $globalURLAdditional = ''; var $pagesString = ''; function listAddons($addons) { echo '
'; if (!empty($addons)) { foreach ($addons as $addon) { echo '
'; echo ''; if ($addon['previewCount'] > 0) echo ''.htmlentities($addon['Translation']['name']['string']).''; else echo ''.htmlentities($addon['Translation']['name']['string']).''; echo ''; echo '
'; echo '
'; if ($this->view->controller->FacebookFavorite->isFavorite($this->view->controller->fbUser, $addon['Addon']['id'], true)) { echo 'You recommend this add-on'; } echo ''.$addon['Translation']['name']['string'].'
'; echo '
'.$this->view->controller->_trimSummary($addon['Translation']['summary']['string']).'
'; if (!empty($addon['FacebookFavorite'])) { $users = array(); if (count($addon['FacebookFavorite']) > 3) { $users = array(''.count($addon['FacebookFavorite']).' friends'); } else { foreach ($addon['FacebookFavorite'] as $favUser) { $users[] = ''; } } echo '
Recommended by: '.implode(', ', $users).'
'; } echo '
'; echo '
'; } } else { echo '
No add-ons found. Please try different criteria.
'; } echo '
'; } function listAddonsOfFriends($addons) { echo '
'; if (!empty($addons)) { foreach ($addons as $addon) { echo '
'; echo ''; if ($addon[0]['pcount'] > 0) echo ''.htmlentities($addon['translations_name']['name']).''; else echo ''.htmlentities($addon['translations_name']['name']).''; echo ''; echo '
'; echo '
'; if ($this->view->controller->FacebookFavorite->isFavorite($this->view->controller->fbUser, $addon['addons']['id'], true)) { echo 'You recommend this add-on'; } echo ''.$addon['translations_name']['name'].'
'; echo '
'.$this->view->controller->_trimSummary($addon['translations_summary']['summary']).'
'; if (!empty($addon[0]['friends'])) { $users = array(); if ($addon[0]['fcount'] > 3) { $users = array(''.$addon[0]['fcount'].' friends'); } else { $favUsers = explode(',', $addon[0]['friends']); foreach ($favUsers as $favUser) { $users[] = ''; } } echo '
Recommended by: '.implode(', ', $users).'
'; } echo '
'; echo '
'; } } else { echo '
No add-ons found. Please try different criteria.
'; } echo '
'; } function pageNumbers($current, $count, $action = 'browse') { if ($count['pages'] < 2) { return; } echo ''; } function buildURL($action, $current, $excludedParams = '', $additional = '') { if (!is_array($excludedParams)) { if (empty($excludedParams)) $excludedParams = array(); else $excludedParams = array($excludedParams); } $url = FB_URL.'/'.$action; $params = array('sort', 'cat', 'type', 'page'); foreach ($params as $param) { if (!empty($current[$param]) && !in_array($param, $excludedParams)) { $url .= "/{$param}:{$current[$param]}"; } } if (!empty($additional)) { $url .= "/{$additional}"; } if (!empty($this->globalURLAdditional)) { $url .= "/{$this->globalURLAdditional}"; } return $url; } function peopleBox($facebook_users, $width = 200, $rows = 1, $params = array()) { $perRow = floor($width / 70); $totalShown = $perRow * $rows; echo '
'; echo '

'.(!empty($params['title']) ? $params['title'] : 'Recommended By').'

'; if (!empty($facebook_users)) { echo '
'; echo '
'; if (!empty($params['showAllCount']) && $params['showAllCount'] == true) { if (!empty($params['viewAllURL'])) echo ''; if ($totalShown < $params['allCount']) echo $totalShown.' of '; echo $params['allCount'].' '.($params['allCount'] == 1 ? 'person' : 'people'); if (!empty($params['viewAllURL'])) echo ''; if (!empty($params['showFriendCount']) && $params['showFriendCount'] == true) echo ', '; } if (!empty($params['showFriendCount']) && $params['showFriendCount'] == true) { if (!empty($params['viewFriendURL'])) echo ''; if ($totalShown < $params['friendCount']) echo $totalShown.' of '; echo $params['friendCount'].' '.($params['friendCount'] == 1 ? 'friend' : 'friends'); if (!empty($params['viewFriendURL'])) echo ''; } echo '
'; if (!empty($params['seeAllURL'])) echo ''; echo '
'; echo '
'; echo ''; $total = 0; for ($r = 0; $r < $rows; $r++) { if (count($facebook_users) > $total) { echo ''; for ($i = 0; $i < $perRow; $i++) { if (!empty($facebook_users[$total])) { echo ''; } $total++; } echo ''; } } echo '

Anonymous
'; echo '
'; } else { echo '
No one yet. Be the first!
'; } echo '
'; } } ?>