/[drupal]/contributions/modules/tapatio/comms.module
ViewVC logotype

Diff of /contributions/modules/tapatio/comms.module

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

revision 1.1.4.22 by evoltech, Wed Sep 23 07:55:59 2009 UTC revision 1.1.4.23 by evoltech, Wed Sep 23 21:27:32 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: comms.module,v 1.1.4.21 2009/09/22 22:21:29 evoltech Exp $  // $Id: comms.module,v 1.1.4.22 2009/09/23 07:55:59 evoltech Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 341  function comms_submit(&$node) { Line 341  function comms_submit(&$node) {
341      $node->title = $node->sms_message;      $node->title = $node->sms_message;
342    }    }
343    
344      // Initialize the og_groups array.
345      // @todo figure out if this is necesary.
346      if (!is_array($node->og_groups)) {
347        $node->og_groups = array();
348      }
349    
350      // If associating tags is exclusively the way to add groups then we
351      // will override the $node->og_groups array, otherwise we have to merge
352      // in the new groups. There is no way to honor
353      // comms_taxonomy_group_tags_del here.
354      // @see http://drupal.org/node/571146
355      // Clear the og_groups array if this system is set up to use groups
356      // exclusively.
357      // @todo figure out if this is necesary.
358      if (variable_get('comms_taxonomy_group_tags_exclusive', 1)) {
359        $node->og_groups = array();
360      }
361    
362    $vid = variable_get('comms_taxonomy_group_tags', '');    $vid = variable_get('comms_taxonomy_group_tags', '');
363    if (!empty($vid) || empty($node->taxonomy[$vid])) {    if (!empty($vid) || empty($node->taxonomy[$vid])) {
364      // Get all groups associated with the registered tags and bind them to      // Get all groups associated with the registered tags and bind them to
365      // this comms node.      // this comms node.
366      foreach ($node->taxonomy[$vid] as $term_id) {      foreach ($node->taxonomy[$vid] as $term_id) {
367        $gids = _comms_get_gids_by_tid($term_id);        $gids = _comms_get_gids_by_tid($term_id);
368          //dpm('$gids associated with '. $term_id .': '. implode(', ', $gids));
369        if (!is_array($gids) || $gids == -1) {        if (!is_array($gids) || $gids == -1) {
370          drupal_set_message(t('comms_submit', 'We are unable to process this submission because there is a critical problem with the tapatio module.  Please contact an admin and try again later'), 'error', FALSE);          drupal_set_message(t('comms_submit', 'We are unable to process this submission because there is a critical problem with the tapatio module.  Please contact an admin and try again later'), 'error', FALSE);
371          return;          return;
372        }        }
373    
374        // If associating tags is exclusively the way to add groups then we        foreach ($gids as $gid => $name) {
375        // will override the $node->og_groups array, otherwise we have to merge          $node->og_groups[$gid] = $gid;
       // in the new groups. There is no way to honor  
       // comms_taxonomy_group_tags_del here.  
       // @see http://drupal.org/node/571146  
       if (variable_get('comms_taxonomy_group_tags_exclusive', 1)) {  
         $node->og_groups = $gids;  
       } else {  
         foreach ($gids as $gid => $name) {  
           $node->og_groups[$gid] = $gid;  
         }  
376        }        }
377      }      }
378    }    }
379      dpm('$node->og_groups: '. print_r($node->og_groups, 1));
380  }  }
381    
382  function comms_form(&$node) {  function comms_form(&$node) {
# Line 1671  function comms_groups_execute($nid, $gid Line 1682  function comms_groups_execute($nid, $gid
1682              }              }
1683            }            }
1684            if (!empty($gids)) {            if (!empty($gids)) {
1685                //$message = "Attempted to add groups: ". implode(', ', $node->og_groups);
1686              og_save_ancestry($node);              og_save_ancestry($node);
1687            }            }
1688            else {            else {

Legend:
Removed from v.1.1.4.22  
changed lines
  Added in v.1.1.4.23

  ViewVC Help
Powered by ViewVC 1.1.3