diff -rup tagadelic_views/includes/views_plugin_style_tagadelic.inc tagadelic_views_new/includes/views_plugin_style_tagadelic.inc --- tagadelic_views/includes/views_plugin_style_tagadelic.inc 2009-01-30 11:12:49.000000000 +1100 +++ includes/views_plugin_style_tagadelic.inc 2011-01-21 16:36:32.000000000 +1100 @@ -6,6 +6,8 @@ class views_plugin_style_tagadelic exten $options['steps'] = array('default' => '6'); $options['size'] = array('default' => '500'); $options['vocab'] = array('default' => ''); + $options['exclude_term'] = array('default' => 0); + $options['exclude_term_arg'] = array('default' => ''); return $options; } @@ -30,5 +32,27 @@ class views_plugin_style_tagadelic exten '#title' => t('Vocabs to use.'), '#default_value' => $this->options['vocab'], ); + + $argument_options = array(); + $arguments = $this->display->handler->get_handlers('argument'); + foreach ($arguments as $id => $handler) { + $argument_options[$id] = $handler->ui_name(FALSE); + } + + $form['exclude_term'] = array( + '#type' => 'checkbox', + '#title' => t('Exclude term based on term ID argument'), + '#default_value' => $this->options['exclude_term'], + '#description' => t("If selected you can choose one of your view's arguments to provide a term ID and that term will be excluded from the tag cloud.") . '
' . t("Note: The view must contain an argument whose value is a taxonomy term ID."), + ); + $form['exclude_term_arg'] = array( + '#title' => t('Argument'), + '#description' => empty($argument_options) ? t("The value of the selected argument must be a number that matches a taxonomy term ID. Use the 'Global: Null' argument if you don't want to also restrict results via that argument. You must have added arguments to the view to use this option.") : t("The selected argument must be a number that matches a taxonomy term ID. Use the 'Global: Null' argument if you don't want to also restrict results via that argument."), + '#type' => 'select', + '#options' => $argument_options, + '#default_value' => $this->options['exclude_term_arg'], + '#process' => array('views_process_dependency'), + '#dependency' => array('edit-style-options-exclude-term' => array(TRUE)), + ); } } \ No newline at end of file diff -rup tagadelic_views/theme/theme.inc tagadelic_views_new/theme/theme.inc --- tagadelic_views/theme/theme.inc 2010-06-26 23:19:36.000000000 +1000 +++ theme/theme.inc 2011-01-21 16:32:02.000000000 +1100 @@ -59,14 +59,21 @@ function template_preprocess_views_view_ $vars['output'] = 'Could not find '. implode(', ', $vocabs_selected) .'!'; } else { + $args = array(); + $exclude_tid = ''; + if ($view->style_plugin->options['exclude_term'] && $termhandler = $view->display_handler->get_handler('argument', $view->style_plugin->options['exclude_term_arg'])) { + $args[] = $termhandler->get_value(); + $exclude_tid = ' AND td.tid <> %d '; + } + $result = db_query_range(db_rewrite_sql( 'SELECT COUNT(*) AS count, td.tid, td.vid, td.name, td.description ' . 'FROM {term_data} td INNER JOIN {term_node} tn ON td.tid = tn.tid ' . 'INNER JOIN {node} n ON tn.vid = n.vid ' . - 'WHERE ' . $base_field_name . ' IN '. $base_restrictor . $vid_restrictor . + 'WHERE ' . $base_field_name . ' IN '. $base_restrictor . $vid_restrictor . $exclude_tid . 'GROUP BY td.tid, td.vid, td.name, td.description ' . 'HAVING COUNT(*) > 0 ' . - 'ORDER BY count DESC'), 0, $options['size']); + 'ORDER BY count DESC'), $args, 0, $options['size']); $tags = tagadelic_build_weighted_tags($result, $options['steps']); $tags = tagadelic_sort_tags($tags); $vars['output'] = theme('tagadelic_weighted', $tags);