| 1 |
<?php |
<?php |
| 2 |
// $Id$ |
// $Id: indexpage.module,v 1.10 2009/07/18 01:19:23 nancyw Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 106 |
} |
} |
| 107 |
else { |
else { |
| 108 |
// Do the index for a specific type. |
// Do the index for a specific type. |
| 109 |
// $sql = _indexpage_check_status("SELECT COUNT(n.nid) FROM {node} n WHERE n.type = ':type'"); |
// $sql = _indexpage_check_status("SELECT COUNT(n.nid) FROM {node} n WHERE n.type = ':type' "); |
| 110 |
$sql = _indexpage_check_status("SELECT COUNT(n.nid) FROM {node} n WHERE n.type = '$type'"); |
$sql = _indexpage_check_status("SELECT COUNT(n.nid) FROM {node} n WHERE n.type = '$type'"); |
| 111 |
$exist_type = db_result(db_query($sql, array(':type' => $type))); |
$exist_type = db_result(db_query($sql, array(':type' => $type))); |
| 112 |
if ($exist_type && variable_get('indexpage_' . $type . '_enable', 1)) { |
if ($exist_type && variable_get('indexpage_' . $type . '_enable', 1)) { |
| 189 |
} |
} |
| 190 |
|
|
| 191 |
// Index by users section. |
// Index by users section. |
| 192 |
$rows = array(); |
if ($show_users) { |
| 193 |
$sql = _indexpage_check_status("SELECT n.uid, COUNT(n.uid) as count FROM {node} n WHERE n.type=':type'") . ' GROUP BY n.uid'; |
$rows = array(); |
| 194 |
$users = db_query($sql, $type); |
$sql = _indexpage_check_status("SELECT n.uid, COUNT(n.uid) as count FROM {node} n WHERE n.type='%s'") .' GROUP BY n.uid'; |
| 195 |
while ($u = db_fetch_object($users)) { |
$users = db_query($sql, $type); |
| 196 |
$account = user_load($u->uid); |
while ($u = db_fetch_object($users)) { |
| 197 |
$rows[] = array( |
$account = user_load(array('uid' => $u->uid)); |
| 198 |
theme('username', $account, array('picture' => TRUE, 'homepage' => FALSE)), |
$rows[] = array( |
| 199 |
l($u->count, "indexpage/$type/user/$u->uid", array('attributes' => array('title' => t('Show the content this user contributed')))), |
theme('username', $account, array('picture' => TRUE, 'homepage' => FALSE)), |
| 200 |
); |
l($u->count, "indexpage/$type/user/$u->uid", array('attributes' => array('title' => t('Show the content this user contributed')))), |
| 201 |
} |
); |
| 202 |
if ($rows) { |
} |
| 203 |
$header = array(t('User Name'), t('Count')); |
if ($rows) { |
| 204 |
$fieldset = array( |
$header = array(t('User Name'), t('Count')); |
| 205 |
'#title' => t('Users who have created !name content', array('!name' => $name)), |
$fieldset = array( |
| 206 |
'#description' => t('User names link to the user profile; the counts link to a list of titles by that user.'), |
'#title' => t('Users who have created !name content', array('!name' => $name)), |
| 207 |
'#collapsible' => TRUE, |
'#description' => t('User names link to the user profile; the counts link to a list of titles by that user.'), |
| 208 |
'#collapsed' => (count($rows) > variable_get('indexpage_maxresults', 10)), |
'#collapsible' => TRUE, |
| 209 |
'#value' => theme('table', $header, $rows), |
'#collapsed' => (count($rows) > variable_get('indexpage_maxresults', 10)), |
| 210 |
); |
'#value' => theme('table', $header, $rows), |
| 211 |
$output .= '<div class="indexpage-users">' . theme('fieldset', $fieldset) . '</div>'; |
); |
| 212 |
|
$output .= '<div class="indexpage-users">'. theme('fieldset', $fieldset) .'</div>'; |
| 213 |
|
} |
| 214 |
} |
} |
| 215 |
|
|
| 216 |
|
|
| 217 |
// Index by taxonomy terms section. |
// Index by taxonomy terms section. |
| 218 |
$voc_list = array(); |
$voc_list = array(); |
| 219 |
if (variable_get('indexpage_' . $type . '_vocfilter', 1)) { |
if (variable_get('indexpage_' . $type . '_vocfilter', 1)) { |
| 368 |
if (!user_access('administer nodes')) { |
if (!user_access('administer nodes')) { |
| 369 |
$query .= ' AND n.status = 1'; |
$query .= ' AND n.status = 1'; |
| 370 |
} |
} |
| 371 |
return db_rewrite_sql($query); |
// return db_rewrite_sql($query); |
| 372 |
|
return $query; |
| 373 |
} |
} |
| 374 |
|
|
| 375 |
function indexpage_page_list($type, $filter, $uid = NULL) { |
function indexpage_page_list($type, $filter, $uid = NULL) { |