| 1 |
<?php // $Id$ |
<?php // $Id: conference_organizing.module,v 1.3 2007/07/28 00:37:08 zacker Exp $ |
| 2 |
|
|
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 122 |
'type' => MENU_CALLBACK, |
'type' => MENU_CALLBACK, |
| 123 |
); |
); |
| 124 |
$items[] = array( |
$items[] = array( |
| 125 |
|
'path' => 'post_conference', |
| 126 |
|
'title' => '', |
| 127 |
|
'callback' => 'conference_organizing_post_conference', |
| 128 |
|
'callback_arguments' => arg(1), |
| 129 |
|
'access' => (conference_organizing_access('see conference attendees', $conference->nid) && conference_organizing_time_until_conference($conference->nid) < 0), |
| 130 |
|
'type' => MENU_CALLBACK, |
| 131 |
|
); |
| 132 |
|
$items[] = array( |
| 133 |
'path' => 'schedule', |
'path' => 'schedule', |
| 134 |
'title' => t('Conference Schedule'), |
'title' => t('Conference Schedule'), |
| 135 |
'callback' => 'conference_organizing_schedule', |
'callback' => 'conference_organizing_schedule', |
| 180 |
// Pages |
// Pages |
| 181 |
|
|
| 182 |
/** |
/** |
| 183 |
|
* Returns administration page for registration |
| 184 |
|
*/ |
| 185 |
|
function conference_organizing_admin() { |
| 186 |
|
$form['conference_organizing_enforcement'] = array( |
| 187 |
|
'#type' => 'select', |
| 188 |
|
'#title' => t('Enforcement level of user registration workflow.'), |
| 189 |
|
'#default_value' => variable_get('conference_organizing_enforcement', 'none'), |
| 190 |
|
'#options' => array( |
| 191 |
|
'none' => t('none'), |
| 192 |
|
'nudge' => t('nudge'), |
| 193 |
|
'force' => t('force'), |
| 194 |
|
), |
| 195 |
|
'#description' => t("Select 'none' for no enforcement, 'nudge' if you want helpful messages displayed to guide users through registration, and 'force' if you want to want to force users through the registration process immediately"), |
| 196 |
|
); |
| 197 |
|
$form['conference_organizing_disable_user_reg'] = array( |
| 198 |
|
'#type' => 'checkbox', |
| 199 |
|
'#title' => t('Require users to register on conference pages instead of through the normal site registration ('. l('user/register', 'user/register') .').'), |
| 200 |
|
'#default_value' => variable_get('conference_organizing_disable_user_reg', 0), |
| 201 |
|
); |
| 202 |
|
return system_settings_form($form); |
| 203 |
|
} |
| 204 |
|
|
| 205 |
|
|
| 206 |
|
/** |
| 207 |
* Callback to embed view of conference attendees |
* Callback to embed view of conference attendees |
| 208 |
*/ |
*/ |
| 209 |
function conference_organizing_attendees($nid) { |
function conference_organizing_attendees($nid) { |
| 277 |
} |
} |
| 278 |
} |
} |
| 279 |
|
|
| 280 |
|
/** |
| 281 |
|
* Returns page containing post conference information |
| 282 |
|
*/ |
| 283 |
|
function conference_organizing_post_conference($nid) { |
| 284 |
|
if (is_numeric($nid)) { |
| 285 |
|
$node = node_load($nid); |
| 286 |
|
$post_conference = check_markup($node->field_post_conference[0]['value'], 3, false); |
| 287 |
|
return theme('conference_organizing_post_conference', $post_conference); |
| 288 |
|
} |
| 289 |
|
} |
| 290 |
|
|
| 291 |
// --------------------------------------------------------------------------- |
// --------------------------------------------------------------------------- |
| 292 |
// Form alter functions |
// Form alter functions |
| 293 |
|
|
| 448 |
|
|
| 449 |
// remove og controls if we are in group context and og forms exist |
// remove og controls if we are in group context and og forms exist |
| 450 |
if (isset($form['og_nodeapi']) && is_object($group)) { |
if (isset($form['og_nodeapi']) && is_object($group)) { |
| 451 |
conference_organizing_form_alter_hide_og($form); |
conference_organizing_form_alter_hide_og($form, $group); |
| 452 |
} |
} |
| 453 |
|
|
| 454 |
// remove log text area (useless) |
// remove log text area (useless) |
| 482 |
'#type' => 'value', |
'#type' => 'value', |
| 483 |
'#value' => $node->nid, |
'#value' => $node->nid, |
| 484 |
); |
); |
| 485 |
|
$form['title']['#default_value'] = t('Notes: !node', array('!node' => $node->title)); |
| 486 |
$form['title']['#disabled'] = TRUE; |
$form['title']['#disabled'] = TRUE; |
| 487 |
} |
} |
| 488 |
// if he node is a session and there aren't notes for the session yet... |
// if he node is a session and there aren't notes for the session yet... |
| 747 |
'#type' => 'tabpage', |
'#type' => 'tabpage', |
| 748 |
); |
); |
| 749 |
|
|
| 750 |
|
// Post conference tab (only shown after conference has ended) |
| 751 |
|
if (conference_organizing_time_until_conference($conference_node->nid) < 0) { |
| 752 |
|
$post_conference .= drupal_render($form['field_post_conference']); |
| 753 |
|
|
| 754 |
|
$tabs['cod_conference']['post_conference'] = array( |
| 755 |
|
'#title' => t('Post Conference'), |
| 756 |
|
'#content' => $post_conference, |
| 757 |
|
'#type' => 'tabpage', |
| 758 |
|
); |
| 759 |
|
} |
| 760 |
|
else { |
| 761 |
|
unset($form['field_post_conference']); |
| 762 |
|
} |
| 763 |
|
|
| 764 |
// Logistics tab |
// Logistics tab |
| 765 |
$logistics = drupal_render($form['group_logistics']); |
$logistics = drupal_render($form['group_logistics']); |
| 766 |
$logistics .= drupal_render($form['locations']); |
$logistics .= drupal_render($form['locations']); |
| 811 |
unset($form['og_website']); |
unset($form['og_website']); |
| 812 |
unset($form['og_register']); |
unset($form['og_register']); |
| 813 |
unset($form['og_theme']); |
unset($form['og_theme']); |
| 814 |
unset($form['group_logistics']); // who needs logistics anyways? |
unset($form['group_logistics']); // bah who needs logistics anyways? |
| 815 |
|
unset($form['field_post_conference']); |
| 816 |
|
|
| 817 |
// mail settings |
// mail settings |
| 818 |
$form['mailsettings']['#type'] = ''; // remove fieldset |
$form['mailsettings']['#type'] = ''; // remove fieldset |
| 974 |
* Sets and Hides the OG Form |
* Sets and Hides the OG Form |
| 975 |
* TODO - can we do this more securely? |
* TODO - can we do this more securely? |
| 976 |
*/ |
*/ |
| 977 |
function conference_organizing_form_alter_hide_og(&$form) { |
function conference_organizing_form_alter_hide_og(&$form, $group) { |
| 978 |
// make all posts private for 'closed' groups and public otherwise |
// make all posts private for 'closed' groups and public otherwise |
| 979 |
if ($group->og_selective == 3) { |
if ($group->og_selective == 3) { |
| 980 |
$form['og_nodeapi']['visible']['og_public']['#default_value'] = 0; |
$form['og_nodeapi']['visible']['og_public']['#default_value'] = 0; |
| 1430 |
*/ |
*/ |
| 1431 |
function conference_organizing_get_conference_context() { |
function conference_organizing_get_conference_context() { |
| 1432 |
// if on a conference page load the conference node |
// if on a conference page load the conference node |
| 1433 |
if ((arg(0) == 'discussions' || arg(0) == 'chat' || arg(0) == 'schedule' || arg(0) == 'attendees' || arg(0) == 'logistics' || arg(0) == 'attendees') && is_numeric(arg(1))) { |
if ((arg(0) == 'discussions' || arg(0) == 'chat' || arg(0) == 'schedule' || arg(0) == 'attendees' || arg(0) == 'logistics' || arg(0) == 'attendees' || arg(0) == 'post_conference') && is_numeric(arg(1))) { |
| 1434 |
$node = node_load(arg(1)); |
$node = node_load(arg(1)); |
| 1435 |
} |
} |
| 1436 |
elseif (arg(0) == 'conference' && arg(1) == 'manage_attendees' && is_numeric(arg(2))) { |
elseif (arg(0) == 'conference' && arg(1) == 'manage_attendees' && is_numeric(arg(2))) { |
| 1606 |
} |
} |
| 1607 |
|
|
| 1608 |
/** |
/** |
| 1609 |
* Returns administration page for registration |
* Returns the time in seconds until a conference is scheduled to end |
| 1610 |
|
* |
| 1611 |
|
* @param $nid |
| 1612 |
|
* The nid of the conference to check |
| 1613 |
|
* |
| 1614 |
|
* @return |
| 1615 |
|
* Number of seconds until the conference is scheduled to end. |
| 1616 |
*/ |
*/ |
| 1617 |
function conference_organizing_admin() { |
function conference_organizing_time_until_conference($nid) { |
| 1618 |
$form['conference_organizing_enforcement'] = array( |
if (is_numeric($nid)) { |
| 1619 |
'#type' => 'select', |
$node = node_load($nid); |
| 1620 |
'#title' => t('Enforcement level of user registration workflow.'), |
return strtotime($node->field_end[0]['value']) - time(); |
| 1621 |
'#default_value' => variable_get('conference_organizing_enforcement', 'none'), |
} |
|
'#options' => array( |
|
|
'none' => t('none'), |
|
|
'nudge' => t('nudge'), |
|
|
'force' => t('force'), |
|
|
), |
|
|
'#description' => t("Select 'none' for no enforcement, 'nudge' if you want helpful messages displayed to guide users through registration, and 'force' if you want to want to force users through the registration process immediately"), |
|
|
); |
|
|
$form['conference_organizing_disable_user_reg'] = array( |
|
|
'#type' => 'checkbox', |
|
|
'#title' => t('Require users to register on conference pages instead of through the normal site registration ('. l('user/register', 'user/register') .').'), |
|
|
'#default_value' => variable_get('conference_organizing_disable_user_reg', 0), |
|
|
); |
|
|
return system_settings_form($form); |
|
| 1622 |
} |
} |
| 1623 |
|
|
| 1624 |
// --------------------------------------------------------------------------- |
// --------------------------------------------------------------------------- |
| 1778 |
'title' => t('Schedule'), |
'title' => t('Schedule'), |
| 1779 |
'href' => 'schedule/'. $group->nid |
'href' => 'schedule/'. $group->nid |
| 1780 |
); |
); |
| 1781 |
// if session proposals are allowed insert link |
// if session proposals are allowed and conference isn't over show link |
| 1782 |
if ($group->field_allow_session_proposals[0]['value'] == 1) { |
if ($group->field_allow_session_proposals[0]['value'] == 1 && (conference_organizing_time_until_conference($conference_node->nid) > 0)) { |
| 1783 |
$links[] = array( |
$links[] = array( |
| 1784 |
'title' => t('Proposed Sessions'), |
'title' => t('Proposed Sessions'), |
| 1785 |
'href' => 'proposed_sessions/'. $group->nid, |
'href' => 'proposed_sessions/'. $group->nid, |
| 1803 |
'href' => 'chat/'. $group->nid, |
'href' => 'chat/'. $group->nid, |
| 1804 |
); |
); |
| 1805 |
} |
} |
| 1806 |
|
// if session proposals are allowed and conference isn't over show link |
| 1807 |
|
if ((conference_organizing_time_until_conference($group->nid) < 0) && conference_organizing_access('see conference attendees', $group->nid, '', $user->uid)) { |
| 1808 |
|
$links[] = array( |
| 1809 |
|
'title' => t('Post Conference'), |
| 1810 |
|
'href' => 'post_conference/'. $group->nid, |
| 1811 |
|
); |
| 1812 |
|
} |
| 1813 |
if (conference_organizing_access('group member', $group->nid) == FALSE) { |
if (conference_organizing_access('group member', $group->nid) == FALSE) { |
| 1814 |
$links[] = array( |
$links[] = array( |
| 1815 |
'title' => t('Sign Up'), |
'title' => t('Sign Up'), |
| 2935 |
} |
} |
| 2936 |
|
|
| 2937 |
/** |
/** |
| 2938 |
|
* Returns theme'd page of post conference information for a conference |
| 2939 |
|
*/ |
| 2940 |
|
function theme_conference_organizing_post_conference($post_conference) { |
| 2941 |
|
$output = '<div class="conference-post-conference">'; |
| 2942 |
|
$output .= $post_conference; |
| 2943 |
|
$output .= '</div>'; |
| 2944 |
|
return $output; |
| 2945 |
|
} |
| 2946 |
|
|
| 2947 |
|
|
| 2948 |
|
/** |
| 2949 |
* Creates much nicer page for the one time login form |
* Creates much nicer page for the one time login form |
| 2950 |
*/ |
*/ |
| 2951 |
function theme_conference_organizing_one_time_login_page($instructions, $group_title) { |
function theme_conference_organizing_one_time_login_page($instructions, $group_title) { |