| 1 |
<?php |
<?php |
| 2 |
// $Id: favorite_nodes.module,v 1.8.2.8 2008/09/29 16:46:00 kbahey Exp $ |
// $Id: favorite_nodes.module,v 1.8.2.9 2009/01/09 04:01:09 kbahey Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 140 |
|
|
| 141 |
switch ($op) { |
switch ($op) { |
| 142 |
case 'view': |
case 'view': |
|
$user->content['faveliste'] = array( |
|
|
'#type' => 'user_profile_category', |
|
|
'#title' => t('My favorites'), |
|
|
'#value' => theme('item_list', $items), |
|
|
); |
|
| 143 |
$fav_list = array(); |
$fav_list = array(); |
| 144 |
foreach (_node_types_natcasesort() as $type) { |
foreach (_node_types_natcasesort() as $type) { |
| 145 |
if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) { |
if (variable_get(FAVORITE_NODES_NODE_TYPE . $type->type, 0)) { |
| 146 |
$uid = intval($user->uid); |
$uid = intval($user->uid); |
| 147 |
$favorites = favorite_nodes_get($uid, $type->type, variable_get(FAVORITE_NODES_BLOCK_LIMIT, 5)); |
$favorites = favorite_nodes_get($uid, $type->type, variable_get(FAVORITE_NODES_PROFILE_LIMIT, 5)); |
| 148 |
$items = array(); |
$items = array(); |
| 149 |
if (!empty($favorites)) { |
if (!empty($favorites)) { |
| 150 |
|
$user->content['favorite_nodes_list'] = array( |
| 151 |
|
'#type' => 'user_profile_category', |
| 152 |
|
'#title' => t('My favorites'), |
| 153 |
|
); |
| 154 |
foreach ($favorites as $favorite) { |
foreach ($favorites as $favorite) { |
| 155 |
$items[] = l($favorite->title, "node/$favorite->nid"); |
$items[] = l($favorite->title, "node/$favorite->nid"); |
| 156 |
} |
} |
| 495 |
$limit = variable_get(FAVORITE_NODES_PAGE_LIMIT, 10); |
$limit = variable_get(FAVORITE_NODES_PAGE_LIMIT, 10); |
| 496 |
} |
} |
| 497 |
$row = array(); |
$row = array(); |
| 498 |
if ($type && variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) { |
if ($limit != 0 && $type && variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) { |
| 499 |
$sql = "SELECT n.nid, n.title, f.uid, f.last FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid = f.nid WHERE n.type = '%s' AND f.uid = %d ORDER by f.last DESC"; |
$sql = "SELECT n.nid, n.title, f.uid, f.last FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid = f.nid WHERE n.type = '%s' AND f.uid = %d ORDER by f.last DESC"; |
| 500 |
$sql_count = "SELECT COUNT(*) FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid = f.nid WHERE n.type = '%s' AND f.uid = %d"; |
$sql_count = "SELECT COUNT(*) FROM {node} n INNER JOIN {favorite_nodes} f ON n.nid = f.nid WHERE n.type = '%s' AND f.uid = %d"; |
| 501 |
|
|