/[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.19 by evoltech, Sun Sep 20 00:07:22 2009 UTC revision 1.1.4.20 by evoltech, Tue Sep 22 01:04:54 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: comms.module,v 1.1.4.18 2009/09/19 06:52:07 evoltech Exp $  // $Id: comms.module,v 1.1.4.19 2009/09/20 00:07:22 evoltech Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 1668  function comms_groups_execute($nid, $gid Line 1668  function comms_groups_execute($nid, $gid
1668    
1669        switch ($action) {        switch ($action) {
1670          case 'add':          case 'add':
1671            foreach ($term_gids as $gid => $group_name) {            foreach ($term_gids as $igid => $group_name) {
1672              // Make sure the group isn't already added to the list, then add              // Make sure the group isn't already added to the list, then add
1673              // it.              // it.
1674              if (!in_array($gid, $node->og_groups) === TRUE) {              if (!in_array($igid, $node->og_groups) === TRUE) {
1675                $node->og_groups[] = $gid;                $node->og_groups[] = $igid;
1676                $gids[$gid] = $group_name;                $gids[$igid] = $group_name;
1677              }              }
1678            }            }
1679            if (!empty($gids)) {            if (!empty($gids)) {
1680              og_save_ancestry($node);              og_save_ancestry($node);
             $message = 'og_groups: '. implode(', ', $node->og_groups)  
               ."\nterm_gids: ". implode(', ', array_keys($term_gids)) ."\n";  
1681            }            }
1682            else {            else {
1683              $message = t('No new groups were added.');              $message = t('No new groups were added.');
# Line 1692  function comms_groups_execute($nid, $gid Line 1690  function comms_groups_execute($nid, $gid
1690              $nid, $gid);              $nid, $gid);
1691            break;            break;
1692          case 'remove':          case 'remove':
1693            foreach ($term_gids as $gid => $group_name) {            // @todo, broken for removing gids.
1694              foreach ($term_gids as $igid => $group_name) {
1695              // If the group is in the list, then remove it.              // If the group is in the list, then remove it.
1696              if ($index = array_search($gid, $node->og_groups) !== FALSE) {              if ($index = array_search($igid, $node->og_groups) !== FALSE) {
1697                array_splice($node->og_groups, $index, 1);                $gids[$igid] = $group_name;
               $gids[$gid] = $group_name;  
1698              }              }
1699            }            }
1700            if (!empty($gids)) {            if (!empty($gids)) {
1701                $node->og_groups = array_values(
1702                  array_diff($node->og_groups, array_keys($term_gids)));
1703              og_save_ancestry($node);              og_save_ancestry($node);
1704            }            }
1705            else {            else {
1706              $message = t('No groups were removed.');              $message .= t('No groups were removed.');
1707            }            }
1708    
1709            // Unbind the term from the node.            // Unbind the term from the node.

Legend:
Removed from v.1.1.4.19  
changed lines
  Added in v.1.1.4.20

  ViewVC Help
Powered by ViewVC 1.1.3