/[drupal]/contributions/modules/flag_content/flag_content.module
ViewVC logotype

Diff of /contributions/modules/flag_content/flag_content.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.6.2.12.2.1, Tue Mar 11 23:50:52 2008 UTC revision 1.6.2.12.2.2, Sat May 3 14:46:42 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: flag_content.module,v 1.6.2.12 2008/02/26 23:15:47 kbahey Exp $  // $Id: flag_content.module,v 1.6.2.12.2.1 2008/03/11 23:50:52 kbahey Exp $
3    
4  // Copyright 2006-2007 Khalid Baheyeldin http://2bits.com  // Copyright 2006-2007 Khalid Baheyeldin http://2bits.com
5    
# Line 521  function theme_flag_content_mail($entry Line 521  function theme_flag_content_mail($entry
521      'body'    => $body,      'body'    => $body,
522    );    );
523  }  }
524    
525    /**
526     * Implementation of hook_views_tables_alter() from Views API
527     * Add a new filter to views to allow filtering on whether a post is flagged
528     * Based on code from the Views PHP Filter module
529     */
530    function flag_content_views_tables_alter(&$table_data) {
531      if (isset($table_data['node']['filters'])) {
532        $table_data['node']['filters']['flagged'] = array (
533          'name' => t('Node: Node is Flagged'),
534          'operator' => array('=' => t('Equals')),
535          'list' => 'views_handler_operator_yesno',
536          'list-type' => 'select',
537          'cacheable' => 'no',
538          'handler' => 'flag_content_views_handler_filter_flagged',
539          'help' => t('This filter allows you to filter on whether or not a node is flagged.'),
540        );
541      }
542    }
543    
544    function flag_content_views_handler_filter_flagged($op, $filter, $filterinfo,
545                                                     &$query) {
546      if (isset ($filter['value'])) {
547        $flagged = _flag_content_get_list();
548    
549        foreach ($flagged as $k => $v) {
550          $result[] = $v->eid;
551        }
552        $nids = implode(',', $result);
553        if ($nids != '') {
554          if ($filter['operator'] == '=') {
555            $query->add_where("node.nid IN (%s)", $nids);
556          } else {
557            $query->add_where("node.nid NOT IN (%s)", $nids);
558          }
559        }
560      }
561    }

Legend:
Removed from v.1.6.2.12.2.1  
changed lines
  Added in v.1.6.2.12.2.2

  ViewVC Help
Powered by ViewVC 1.1.2