| 16 |
* were marked as 'required' by the site admin will always be usable by the group members and |
* were marked as 'required' by the site admin will always be usable by the group members and |
| 17 |
* cannot be deactivated by the group owner.</p> |
* cannot be deactivated by the group owner.</p> |
| 18 |
* |
* |
| 19 |
* @version $Id: og_content_type_admin.module,v 1.15.2.2 2008/10/09 13:43:47 paulbooker Exp $; |
* @version $Id: og_content_type_admin.module,v 1.15.2.3 2008/10/15 11:14:40 paulbooker Exp $; |
| 20 |
* @package OG_CTA |
* @package OG_CTA |
| 21 |
* @category NeighborForge |
* @category NeighborForge |
| 22 |
* @author Ryan Constantine |
* @author Ryan Constantine |
| 761 |
global $user; |
global $user; |
| 762 |
|
|
| 763 |
if ($node = og_get_group_context()) { |
if ($node = og_get_group_context()) { |
| 764 |
|
$gid = $node->nid; |
| 765 |
$sql = "SELECT octa.types_active, octa.types_allowed FROM {og_content_type_admin} octa WHERE octa.gid = %d"; |
$sql = "SELECT octa.types_active, octa.types_allowed FROM {og_content_type_admin} octa WHERE octa.gid = %d"; |
| 766 |
//if we're keeping track of this group, get it's active types, otherwise, get the defaults |
//if we're keeping track of this group, get it's active types, otherwise, get the defaults |
| 767 |
$types = db_fetch_object(db_query($sql, $node->nid)); |
$types = db_fetch_object(db_query($sql, $node->nid)); |
| 768 |
if (!count($types->types_active)) { |
if (!count($types->types_active)) { |
| 769 |
$types = db_fetch_object(db_query($sql, 0)); |
$types = db_fetch_object(db_query($sql, 0)); |
| 770 |
} |
} |
| 771 |
|
$activated_types = unserialize($types->types_active); |
| 772 |
|
$allowed_types = unserialize($types->types_allowed); |
| 773 |
|
$look_at_allowed = 1; |
| 774 |
} else { |
} else { |
| 775 |
$sql = "SELECT octa.types_active FROM {og_content_type_admin} octa WHERE octa.gid = -1"; |
$sql = "SELECT octa.types_active FROM {og_content_type_admin} octa WHERE octa.gid = -1"; |
| 776 |
$types = db_fetch_object(db_query($sql)); |
$types = db_fetch_object(db_query($sql)); |
| 777 |
|
$activated_types = unserialize($types->types_active); |
| 778 |
} |
$look_at_allowed = 0; |
| 779 |
$activated_types = unserialize($types->types_active); |
} |
| 780 |
|
|
| 781 |
foreach ($activated_types as $type => $value) { |
foreach ($activated_types as $type => $value) { |
| 782 |
$node_type = isset($type) ? str_replace('_', '-', $type) : NULL; //print " ".$type; |
$node_type = isset($type) ? str_replace('_', '-', $type) : NULL; //print " ".$type; |
| 969 |
if ($node->og_selective < OG_INVITE_ONLY) { |
if ($node->og_selective < OG_INVITE_ONLY) { |
| 970 |
$links[] = l(t('Invite friend'), "og/invite/$node->nid"); |
$links[] = l(t('Invite friend'), "og/invite/$node->nid"); |
| 971 |
} |
} |
| 972 |
$txt = format_plural($cntall-$cntpending, '1 subscriber', '@count subscribers'); |
$txt = format_plural($cntall-$cntpending, '1 member', '@count members'); |
| 973 |
$txt = og_is_picture() ? l($txt, "og/users/$node->nid/faces") : l($txt, "og/users/$node->nid"); |
$txt = og_is_picture() ? l($txt, "og/users/$node->nid/faces") : l($txt, "og/users/$node->nid"); |
| 974 |
$txt .= $cntpending ? " ($cntpending)" : ''; |
$txt .= $cntpending ? " ($cntpending)" : ''; |
| 975 |
$links[] = $txt; |
$links[] = $txt; |
| 976 |
$links[] = t('Manager: '). theme('username', $node); |
$links[] = t('Manager: '). theme('username', $node); |
| 977 |
$links[] = isset($subscription) ? l(t('My subscription'), "og/manage/$node->nid") : og_subscribe_link($node); |
$links[] = isset($subscription) ? l(t('My membership'), "og/manage/$node->nid") : og_subscribe_link($node); |
| 978 |
if (isset($node->og_website) && !empty($node->og_website)) { |
if (isset($node->og_website) && !empty($node->og_website)) { |
| 979 |
$links[] = l(t('website'), $node->og_website); |
$links[] = l(t('website'), $node->og_website); |
| 980 |
} |
} |
| 983 |
} |
} |
| 984 |
} |
} |
| 985 |
elseif ($subscription == 'requested') { |
elseif ($subscription == 'requested') { |
| 986 |
$links[] = t('Your subscription request awaits approval.'); |
$links[] = t('Your membership request awaits approval.'); |
| 987 |
$links[] = l(t('delete request'), "og/unsubscribe/$node->nid", array(), 'destination=og'); |
$links[] = l(t('delete request'), "og/unsubscribe/$node->nid", array(), 'destination=og'); |
| 988 |
} |
} |
| 989 |
elseif (!$user->uid) { |
elseif (!$user->uid) { |
| 990 |
$dest = drupal_get_destination(); |
$dest = array('query' => drupal_get_destination()); |
| 991 |
$links[] = t('You must <a href="!register">register</a>/<a href="!login">login</a> in order to post into this group.', array('!register' => url("user/register", $dest), '!login' => url("user/login", $dest))); |
$links[] = t('You must <a href="!register">register</a>/<a href="!login">login</a> in order to post into this group.', array('!register' => url("user/register", $dest), '!login' => url("user/login", $dest))); |
| 992 |
} |
} |
| 993 |
elseif ($node->og_selective < OG_INVITE_ONLY) { |
elseif ($node->og_selective < OG_INVITE_ONLY) { |
| 994 |
$links[] = og_subscribe_link($node); |
$links[] = og_subscribe_link($node); |
| 995 |
} |
} |
| 996 |
else { |
else { |
| 997 |
$links[] = t('This is a @closed group. The group administrators add/remove subscribers as needed.', array('@closed' => t('closed'))); |
$links[] = t('This is a @closed group. The group administrators add/remove members as needed.', array('@closed' => t('closed'))); |
| 998 |
} |
} |
| 999 |
$block['content'] = theme('item_list', $links). $post; |
$block['content'] = theme('item_list', $links). $post; |
| 1000 |
$block['subject'] = $node->title; |
$block['subject'] = l($node->title, "node/$node->nid"); |
| 1001 |
return $block; |
return $block; |
| 1002 |
} |
} |
| 1003 |
} // function og_content_type_admin_block_details() |
} // function og_content_type_admin_block_details() |