| 1 |
<?php |
<?php |
| 2 |
// $Id: taxonomy_block.module,v 1.19 2009/06/23 17:04:09 thenicespider Exp $ |
// $Id: taxonomy_block.module,v 1.20 2009/06/23 17:56:53 thenicespider Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 12 |
function taxonomy_block_help($section) { |
function taxonomy_block_help($section) { |
| 13 |
switch ($section) { |
switch ($section) { |
| 14 |
case 'admin/help#taxonomy_block': |
case 'admin/help#taxonomy_block': |
| 15 |
$output = "The taxonomy_block module used for displaying taxonomy in a block with 18n/multi-languages support"; |
$output = "The taxonomy_block module used for displaying taxonomy in a block with i18n/multi-languages support"; |
| 16 |
return $output; |
return $output; |
| 17 |
case 'admin/modules#description': |
case 'admin/modules#description': |
| 18 |
return 'The taxonomy_block module used for displaying taxonomy in a block with 18n/multi-languages support'; |
return 'The taxonomy_block module used for displaying taxonomy in a block with i18n/multi-languages support'; |
| 19 |
} |
} |
| 20 |
} |
} |
| 21 |
|
|
| 34 |
$items = array(); |
$items = array(); |
| 35 |
|
|
| 36 |
$items['admin/settings/taxonomy_block'] = array( |
$items['admin/settings/taxonomy_block'] = array( |
| 37 |
'title' => 'Taxonomy Block i18n', |
'title' => 'Taxonomy Block', |
| 38 |
'description' => 'Show taxonomy in block with i18n support', |
'description' => 'Show taxonomy in a block with i18n support', |
| 39 |
'access arguments' => array('administer taxonomy_block'), |
'access arguments' => array('administer taxonomy_block'), |
| 40 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 41 |
'page arguments' => array('taxonomy_block_admin_settings'), |
'page arguments' => array('taxonomy_block_admin_settings'), |
| 53 |
function taxonomy_block_block($op = 'list', $delta = 0) { |
function taxonomy_block_block($op = 'list', $delta = 0) { |
| 54 |
if ($op == 'list') |
if ($op == 'list') |
| 55 |
{ |
{ |
| 56 |
$blocks[0]['info'] = 'Taxonomy Block i18n'; |
$blocks[0]['info'] = 'Taxonomy Block'; |
| 57 |
return $blocks; |
return $blocks; |
| 58 |
} |
} |
| 59 |
|
|
| 65 |
|
|
| 66 |
switch($delta) { |
switch($delta) { |
| 67 |
case 0: |
case 0: |
| 68 |
$block['subject'] = 'Taxonomy Block i18n'; |
$block['subject'] = 'Taxonomy Block'; |
| 69 |
|
|
| 70 |
$output = ''; |
$output = ''; |
| 71 |
|
|
| 85 |
$output .= "<li>"; |
$output .= "<li>"; |
| 86 |
$output .= l(tt("taxonomy:term:$tid_parent:name", $name_parent), "taxonomy/term/$tid_parent"); |
$output .= l(tt("taxonomy:term:$tid_parent:name", $name_parent), "taxonomy/term/$tid_parent"); |
| 87 |
if ($node_count) { |
if ($node_count) { |
| 88 |
$count = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $tid_parent)); |
$total_parent = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $tid_parent)); |
| 89 |
$output .= " ($count)"; |
$output .= " ($total_parent)"; |
| 90 |
} |
} |
| 91 |
$output .= "</li>"; |
$output .= "</li>"; |
| 92 |
|
|
| 108 |
|
|
| 109 |
$output .= "<li>"; |
$output .= "<li>"; |
| 110 |
$output .= l(tt("taxonomy:term:$tid_child:name", $name_child), "taxonomy/term/$tid_child"); |
$output .= l(tt("taxonomy:term:$tid_child:name", $name_child), "taxonomy/term/$tid_child"); |
| 111 |
|
if ($node_count) { |
| 112 |
|
$total_child = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $tid_child)); |
| 113 |
|
$output .= " ($total_child)"; |
| 114 |
|
} |
| 115 |
$output .= "</li>"; |
$output .= "</li>"; |
| 116 |
} |
} |
| 117 |
$output .= "</ul>"; |
$output .= "</ul>"; |