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

Diff of /contributions/modules/createcontentblock/createcontentblock.module

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

revision 1.1.2.10, Fri Jul 25 21:18:30 2008 UTC revision 1.1.2.11, Wed Jul 30 19:00:58 2008 UTC
# Line 57  function createcontentblock_block($op = Line 57  function createcontentblock_block($op =
57  function createcontentblock_form_init() {  function createcontentblock_form_init() {
58    $init = array('options' => array());    $init = array('options' => array());
59    
60      $exempt = array();
61    if ($og = module_exists('og')) {    if ($og = module_exists('og')) {
62      $group_node = og_get_group_context();      if ($group_node = og_get_group_context()) {
63      global $user;        global $user;
64      if ($user->uid == 1 || user_access('administer organic groups') || isset($user->og_groups[$group_node->nid])) {        if (isset($user->og_groups[$group_node->nid])) {
65        // add only OG groups we have access to          // add only OG groups we have access to
66        $init['group_nid'] = $group_node->nid;          $init['group_nid'] = $group_node->nid;
67      }        }
68      else {        else {
69        $init['subscribe_nid'] = $group_node->nid;          $init['subscribe_nid'] = $group_node->nid;
70          }
71          $exempt = array_merge(variable_get('og_node_types', array('og')), variable_get('og_omitted', array()));
72      }      }
     $exempt = array_merge(variable_get('og_node_types', array('og')), variable_get('og_omitted', array()));  
   }  
   else {  
     $exempt = array();  
73    }    }
74    
75    foreach (node_get_types() as $type) {    foreach (node_get_types() as $type) {
76      if (module_invoke(node_get_types('module', $type), 'access', 'create', $type)) {      if (module_invoke(node_get_types('module', $type), 'access', 'create', $type)) {
77        $name = $type->name;        $name = $type->name;
78        if ($og) {        if ($og) {
79          if (isset($init['group_nid'])) {          if (variable_get('og_content_type_usage_'. $type->type, 'omitted') != 'omitted') {
80            if (!in_array($type->type, $exempt)) {            if (isset($init['group_nid'])) {
81              $name .= ' ('. t('this group') .')';              if (!in_array($type->type, $exempt)) {
82            }                $name .= ' ('. t('this group') .')';
         }  
         else {  
           if (!in_array($type->type, $exempt)) {  
             if (isset($init['subscribe_nid'])) {  
               unset($name);  
83              }              }
84              else {            }
85                $name .= ' ('. t('for groups') .')';            else {
86                if (!in_array($type->type, $exempt)) {
87                  if (isset($init['subscribe_nid'])) {
88                    unset($name);
89                  }
90                  else {
91                    $name .= ' ('. t('for groups') .')';
92                  }
93              }              }
94            }            }
95          }          }

Legend:
Removed from v.1.1.2.10  
changed lines
  Added in v.1.1.2.11

  ViewVC Help
Powered by ViewVC 1.1.2