vocabulary_terms.inc File Reference

(1.1.2.6 2008/10/29 20:47:19 merlinofchaos)

Go to the source code of this file.

Functions

 _panels_content_vocabulary_terms ($vid, $max_depth, $depth=-1, $tid=0)
 panels_admin_content_types_vocabulary_terms ()
 panels_admin_edit_vocabulary_terms ($id, $parents, $conf=array())
 panels_admin_title_vocabulary_terms ($conf, $context)
 panels_content_vocabulary_terms ($conf, $panel_args, $context)
 panels_vocabulary_terms_panels_content_types ()


Function Documentation

_panels_content_vocabulary_terms ( vid,
max_depth,
depth = -1,
tid = 0 
)

Definition at line 51 of file vocabulary_terms.inc.

Referenced by panels_content_vocabulary_terms().

00051                                                                                    {
00052   $depth++;
00053   if ($max_depth != NULL && $depth == $max_depth) {
00054     return array();
00055   }
00056   $return = array();
00057   $query = db_query('SELECT t.name, t.tid FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d AND h.parent = %d ORDER BY t.weight ASC, t.name ASC', $vid, $tid);
00058   while ($result = db_fetch_object($query)) {
00059     $return[] = array(
00060       'data' => l($result->name, 'taxonomy/term/'. $result->tid),
00061       'children' => _panels_content_vocabulary_terms($vid, $max_depth, $depth, $result->tid),
00062     );
00063   }
00064   return $return;
00065 }

Here is the caller graph for this function:

panels_admin_content_types_vocabulary_terms (  ) 

Return all content types available.

Definition at line 70 of file vocabulary_terms.inc.

References panels_get_path().

00070                                                        {
00071   return array(
00072     'description' => array(
00073       'title' => t('Vocabulary terms'),
00074       'icon' => 'icon_node.png',
00075       'path' => panels_get_path('content_types/node'),
00076       'description' => t('All the terms in a vocabulary.'),
00077       'required context' => new panels_required_context(t('Vocabulary'), 'vocabulary'),
00078       'category' => array(t('Vocabulary context'), -9),
00079     ),
00080   );
00081 }

Here is the call graph for this function:

panels_admin_edit_vocabulary_terms ( id,
parents,
conf = array() 
)

Definition at line 87 of file vocabulary_terms.inc.

00087                                                                             {
00088   // Apply defaults
00089   if (empty($conf)) {
00090     $conf = array('max_depth' => 0, 'tree' => 1);
00091   }
00092 
00093   $form['max_depth'] = array(
00094     '#type' => 'select',
00095     '#title' => t('Maximum depth'),
00096     '#options' => array_merge(array(t('unlimited')), range(1, 9)),
00097     '#default_value' => $conf['max_depth'],
00098     '#description' => t('Define the maximum depth of terms being displayed.'),
00099   );
00100 
00101   $form['tree'] = array(
00102     '#type' => 'checkbox',
00103     '#title' => t('Display as tree'),
00104     '#default_value' => $conf['tree'],
00105     '#description' => t('If checked, the terms are displayed in a tree, otherwise in a flat list.'),
00106   );
00107 
00108   return $form;
00109 }

panels_admin_title_vocabulary_terms ( conf,
context 
)

Definition at line 83 of file vocabulary_terms.inc.

00083                                                               {
00084   return t('"@s" terms', array('@s' => $context->identifier));
00085 }

panels_content_vocabulary_terms ( conf,
panel_args,
context 
)

Output function for the 'vocabulary terms' content type. Outputs a list of terms for the input vocabulary.

Definition at line 27 of file vocabulary_terms.inc.

References _panels_content_vocabulary_terms().

00027                                                                        {
00028   $vocab = isset($context->data) ? drupal_clone($context->data) : NULL;
00029   $max_depth = (!empty($conf['max_depth']) ? (int)$conf['max_depth'] : NULL);
00030   if ($conf['tree'] == FALSE) {
00031     $terms = taxonomy_get_tree($vocab->vid, 0, -1, $max_depth);
00032     $items = array();
00033     foreach ($terms as $term) {
00034       $items[] = l($term->name, 'taxonomy/term/'. $term->tid);
00035     }
00036     $output = theme('item_list', $items);
00037   }
00038   else {
00039     $output = theme('item_list', _panels_content_vocabulary_terms($vocab->vid, $max_depth));
00040   }
00041 
00042   $block = new stdClass();
00043   $block->module  = 'node_type';
00044   $block->subject = $vocab->name;
00045   $block->content = $output;
00046   $block->delta   = $vocab->tid;
00047 
00048   return $block;
00049 }

Here is the call graph for this function:

panels_vocabulary_terms_panels_content_types (  ) 

Callback function to supply a list of content types.

Definition at line 8 of file vocabulary_terms.inc.

00008                                                         {
00009   if (module_exists('taxonomy')) {
00010     $items['vocabulary_terms'] = array(
00011       'title' => t('Term description'),
00012       'content_types' => 'panels_admin_content_types_vocabulary_terms',
00013       'single' => TRUE,
00014       'render callback' => 'panels_content_vocabulary_terms',
00015       'add callback' => 'panels_admin_edit_vocabulary_terms',
00016       'edit callback' => 'panels_admin_edit_vocabulary_terms',
00017       'title callback' => 'panels_admin_title_vocabulary_terms',
00018     );
00019     return $items;
00020   }
00021 }


Generated on Thu Jul 29 05:00:16 2010 for Panels 2 by  doxygen 1.5.6