| 1 |
<?php |
<?php |
| 2 |
// $Id: taxonomy_context.module,v 1.82.4.8 2009/10/03 18:47:10 nancyw Exp $ |
// $Id: taxonomy_context.module,v 1.82.4.9 2009/10/03 19:44:14 nancyw Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 181 |
* Implementation of hook_help(). |
* Implementation of hook_help(). |
| 182 |
*/ |
*/ |
| 183 |
function taxonomy_context_help($path, $arg) { |
function taxonomy_context_help($path, $arg) { |
| 184 |
|
$output = NULL; |
| 185 |
// If we're on a 2nd or subsequent page, don't show taxonomy info. |
// If we're on a 2nd or subsequent page, don't show taxonomy info. |
| 186 |
// $path will be "taxonomy/term/%" or "taxonomy/vocabulary". |
// $path will be "taxonomy/term/%" or "taxonomy/vocabulary". |
| 187 |
if (($arg[0] == 'taxonomy' || $arg[0] == 'context') && empty($_GET['from'])) { |
if (($arg[0] == 'taxonomy' || $arg[0] == 'context') && empty($_GET['from'])) { |
| 188 |
$context = taxonomy_context_get_context(); |
$context = taxonomy_context_get_context(); |
| 189 |
switch ($arg[1]) { |
switch ($arg[1]) { |
| 190 |
case 'term': |
case 'term': |
| 191 |
|
$output .= _taxonomy_context_admin_tab(); |
| 192 |
if (variable_get('taxonomy_context_show_term', TRUE) && $context->tid) { |
if (variable_get('taxonomy_context_show_term', TRUE) && $context->tid) { |
| 193 |
$output .= taxonomy_context_show_term($context->tid); |
$output .= taxonomy_context_show_term($context->tid); |
| 194 |
} |
} |
| 405 |
} |
} |
| 406 |
|
|
| 407 |
/** |
/** |
| 408 |
|
* Fake a menu tab for settings. |
| 409 |
|
*/ |
| 410 |
|
function _taxonomy_context_admin_tab() { |
| 411 |
|
if (user_access('administer site configuration')) { |
| 412 |
|
return '<div class="tabs"><ul class="tabs primary"><li><a href="/admin/settings/taxonomy_context">Settings</a></li></ul></div>'; |
| 413 |
|
} |
| 414 |
|
return NULL; |
| 415 |
|
} |
| 416 |
|
|
| 417 |
|
/** |
| 418 |
* Menu callback: display a vocabulary's page. |
* Menu callback: display a vocabulary's page. |
| 419 |
*/ |
*/ |
| 420 |
function taxonomy_context_vocabulary_page() { |
function taxonomy_context_vocabulary_page() { |
| 421 |
|
$output = NULL; |
| 422 |
$vid = arg(2); |
$vid = arg(2); |
| 423 |
if (empty($vid)) { |
if (empty($vid)) { |
| 424 |
$vocabularies = taxonomy_get_vocabularies(); |
$vocabularies = taxonomy_get_vocabularies(); |
| 431 |
$vocabularies[] = taxonomy_vocabulary_load($vid); |
$vocabularies[] = taxonomy_vocabulary_load($vid); |
| 432 |
} |
} |
| 433 |
|
|
| 434 |
$output = '<div id="taxonomy-context-overview">'; |
$output .= _taxonomy_context_admin_tab(); |
| 435 |
|
|
| 436 |
|
$output .= '<div id="taxonomy-context-overview">'; |
| 437 |
foreach ($vocabularies as $vocabulary) { |
foreach ($vocabularies as $vocabulary) { |
| 438 |
taxonomy_context_load('vocabulary', $vocabulary); |
taxonomy_context_load('vocabulary', $vocabulary); |
| 439 |
$vocabulary = taxonomy_context_prepare($vocabulary, FALSE); |
$vocabulary = taxonomy_context_prepare($vocabulary, FALSE); |