| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: rsvp.form.inc,v 1.3.2.5 2009/03/11 18:29:23 ulf1 Exp $ |
// $Id: rsvp.form.inc,v 1.3.2.6 2009/08/14 22:02:54 ulf1 Exp $ |
| 4 |
|
|
| 5 |
/** |
/** |
| 6 |
* @module rsvp_form |
* @module rsvp_form |
| 441 |
|
|
| 442 |
///////////////////////// |
///////////////////////// |
| 443 |
/** |
/** |
| 444 |
* Displays the 'Send confirmation message to host when gues replies' form element to set $rsvp->send_conf_owner |
* Displays the 'Send confirmation message to host when gues replies' form element to set $rsvp->option_enabled | RSVP_OPTION_SEND_CONF_OWNER |
| 445 |
* |
* |
| 446 |
* @ingroup rsvp_form |
* @ingroup rsvp_form |
| 447 |
* @param $rsvp The rsvp instance to display. |
* @param $rsvp The rsvp instance to display. |
| 458 |
'#type' => 'select', |
'#type' => 'select', |
| 459 |
'#title' => t('Send confirmation message to organizer when guest replies'), |
'#title' => t('Send confirmation message to organizer when guest replies'), |
| 460 |
'#options' => array_map('check_plain', $send_confimation), |
'#options' => array_map('check_plain', $send_confimation), |
| 461 |
'#default_value' => $rsvp->send_conf_owner, |
'#default_value' => (_rsvp_function_checkbit($rsvp->option_enabled, RSVP_OPTION_SEND_CONF_OWNER) == RSVP_OPTION_YES) ? 1 : 0, |
| 462 |
'#description' => t(''), |
'#description' => t(''), |
| 463 |
)); |
)); |
| 464 |
} |
} |
| 465 |
|
|
| 466 |
/** |
/** |
| 467 |
* Displays the 'Send confirmation message to guest when he replies' form element to set $rsvp->send_conf_guest |
* Displays the 'Send confirmation message to guest when he replies' form element to set $rsvp->option_enabled | RSVP_OPTION_SEND_CONF_GUEST |
| 468 |
* |
* |
| 469 |
* @ingroup rsvp_form |
* @ingroup rsvp_form |
| 470 |
* @param $rsvp The rsvp instance to display. |
* @param $rsvp The rsvp instance to display. |
| 481 |
'#type' => 'select', |
'#type' => 'select', |
| 482 |
'#title' => t('Send confirmation message to guest when he replies'), |
'#title' => t('Send confirmation message to guest when he replies'), |
| 483 |
'#options' => array_map('check_plain', $send_confimation), |
'#options' => array_map('check_plain', $send_confimation), |
| 484 |
'#default_value' => $rsvp->send_conf_guest, |
'#default_value' => (_rsvp_function_checkbit($rsvp->option_enabled, RSVP_OPTION_SEND_CONF_GUEST) == RSVP_OPTION_YES) ? 1 : 0, |
| 485 |
'#description' => t(''), |
'#description' => t(''), |
| 486 |
)); |
)); |
| 487 |
} |
} |
| 488 |
|
|
| 489 |
/** |
/** |
| 490 |
* Displays the 'Send messages to registered guests by privatemsg' form element to set $rsvp->send_privatemsg |
* Displays the 'Send messages to registered guests by privatemsg' form element to set $rsvp->option_enabled | RSVP_OPTION_SEND_PRIVATEMSG |
| 491 |
* |
* |
| 492 |
* @ingroup rsvp_form |
* @ingroup rsvp_form |
| 493 |
* @param $rsvp The rsvp instance to display. |
* @param $rsvp The rsvp instance to display. |
| 504 |
'#type' => 'select', |
'#type' => 'select', |
| 505 |
'#title' => t('Send messages to registered guests by privatemsg if possible'), |
'#title' => t('Send messages to registered guests by privatemsg if possible'), |
| 506 |
'#options' => array_map('check_plain', $send_privatemsg), |
'#options' => array_map('check_plain', $send_privatemsg), |
| 507 |
'#default_value' => $rsvp->send_privatemsg, |
'#default_value' => (_rsvp_function_checkbit($rsvp->option_enabled, RSVP_OPTION_SEND_PRIVATEMSG) == RSVP_OPTION_YES) ? 1 : 0, |
| 508 |
'#description' => t(''), |
'#description' => t(''), |
| 509 |
)); |
)); |
| 510 |
} |
} |
| 511 |
|
|
| 512 |
/** |
/** |
| 513 |
* Displays the 'Answer \'Maybe\' disabled' form element to set $rsvp->disable_maybe |
* Displays the 'Answer \'Maybe\' disabled' form element to set $rsvp->option_enabled | RSVP_OPTION_DISABLE_MAYBE |
| 514 |
* |
* |
| 515 |
* @ingroup rsvp_form |
* @ingroup rsvp_form |
| 516 |
* @param $rsvp The rsvp instance to display. |
* @param $rsvp The rsvp instance to display. |
| 527 |
'#type' => 'select', |
'#type' => 'select', |
| 528 |
'#title' => t('Display answer option \'Maybe\''), |
'#title' => t('Display answer option \'Maybe\''), |
| 529 |
'#options' => array_map('check_plain', $disable_maybe), |
'#options' => array_map('check_plain', $disable_maybe), |
| 530 |
'#default_value' => $rsvp->disable_maybe, |
'#default_value' => (_rsvp_function_checkbit($rsvp->option_enabled, RSVP_OPTION_DISABLE_MAYBE) == RSVP_OPTION_YES) ? 1 : 0, |
| 531 |
'#description' => t('When guests reply to invitations, they may choose \'Yes\', \'No\', or \'Maybe\' as their response. If you do not wish to offer the \'Maybe\' option, set this option to \'Hide\''), |
'#description' => t('When guests reply to invitations, they may choose \'Yes\', \'No\', or \'Maybe\' as their response. If you do not wish to offer the \'Maybe\' option, set this option to \'Hide\''), |
| 532 |
|
|
| 533 |
|
|
| 535 |
} |
} |
| 536 |
|
|
| 537 |
/** |
/** |
| 538 |
* Displays the 'Open invitation' form element to set $rsvp->open_invitation |
* Displays the 'Open invitation' form element to set $rsvp->option_enabled | RSVP_OPTION_OPENINVITATION |
| 539 |
* |
* |
| 540 |
* @ingroup rsvp_form |
* @ingroup rsvp_form |
| 541 |
* @param $rsvp The rsvp instance to display. |
* @param $rsvp The rsvp instance to display. |
| 552 |
'#type' => 'select', |
'#type' => 'select', |
| 553 |
'#title' => t('Open invitation'), |
'#title' => t('Open invitation'), |
| 554 |
'#options' => array_map('check_plain', $open_invitation), |
'#options' => array_map('check_plain', $open_invitation), |
| 555 |
'#default_value' => $rsvp->open_invitation, |
'#default_value' => (_rsvp_function_checkbit($rsvp->option_enabled, RSVP_OPTION_OPENINVITATION) == RSVP_OPTION_YES) ? 1 : 0, |
| 556 |
'#description' => t('Select if invitation is open to uninvited guests. If you select \'yes\', you have to select roles under \'Invitation message - view permissions\' to make the invitation visible to those uninvited guests to begin with. Only authenticated persons can signup to open invitations. Anonymous users are not permitted.'), |
'#description' => t('Select if invitation is open to uninvited guests. If you select \'yes\', you have to select roles under \'Invitation message - view permissions\' to make the invitation visible to those uninvited guests to begin with. Only authenticated persons can signup to open invitations. Anonymous users are not permitted.'), |
| 557 |
)); |
)); |
| 558 |
} |
} |
| 589 |
*/ |
*/ |
| 590 |
function rsvp_form_element_reply_startdate($rsvp, $field_attr = array()) { |
function rsvp_form_element_reply_startdate($rsvp, $field_attr = array()) { |
| 591 |
|
|
| 592 |
$date_local = $rsvp->reply_startdate; |
$date_local = $rsvp->reply_startdate; |
| 593 |
return array_merge($field_attr, array( |
|
| 594 |
|
$reply_start_field = array( |
| 595 |
'#type' => 'date', |
'#type' => 'date', |
| 596 |
'#title' => t('Reply start date'), |
'#title' => t('Reply start date'), |
| 597 |
'#default_value' => array('year' => (int) date('Y',$date_local ), 'month' => (int) date('m',$date_local ), 'day' => (int) date('d',$date_local ) ), |
'#default_value' => array('year' => (int) date('Y',$date_local ), 'month' => (int) date('m',$date_local ), 'day' => (int) date('d',$date_local ) ), |
| 598 |
'#description' => t('Specify the start date of a time window guests can reply to the invitation.'), |
'#description' => t('Specify the start date of a time window guests can reply to the invitation.'), |
| 599 |
/* '#description' => ' <br /> sd1:' . $rsvp->reply_startdate |
/* '#description' => ' <br /> sd1:' . $rsvp->reply_startdate |
| 600 |
. ' <br /> sd2:' . date('r', $rsvp->reply_startdate) |
. ' <br /> sd2:' . date('r', $rsvp->reply_startdate) |
| 601 |
. ' <br /> sd3:' . format_date($rsvp->reply_startdate, 'custom', 'U') |
. ' <br /> sd3:' . format_date($rsvp->reply_startdate, 'custom', 'U') |
| 602 |
. ' <br /> sd4:' . format_date($rsvp->reply_startdate, 'custom') |
. ' <br /> sd4:' . format_date($rsvp->reply_startdate, 'custom') |
| 603 |
. ' <br /> sd5:' . format_date($rsvp->reply_startdate, 'custom', 'r') |
. ' <br /> sd5:' . format_date($rsvp->reply_startdate, 'custom', 'r') |
| 604 |
. ' <br /> sd6:' . format_date($rsvp->reply_startdate, 'small', 'U') |
. ' <br /> sd6:' . format_date($rsvp->reply_startdate, 'small', 'U') |
| 605 |
. ' <br /> sd7:' . format_date($rsvp->reply_startdate, 'small'), |
. ' <br /> sd7:' . format_date($rsvp->reply_startdate, 'small'), |
| 606 |
*/ |
*/ |
| 607 |
|
|
| 608 |
|
|
| 609 |
'#required' => FALSE |
'#required' => FALSE, |
| 610 |
)); |
|
| 611 |
|
); |
| 612 |
|
|
| 613 |
|
|
| 614 |
|
return array_merge($field_attr, $reply_start_field); |
| 615 |
|
|
| 616 |
|
} |
| 617 |
|
|
| 618 |
|
/** |
| 619 |
|
* Displays the 'Reply start date option' form element to set $rsvp->option_enabled | RSVP_OPTION_REPLY_STARTDATE_ENABLED |
| 620 |
|
* |
| 621 |
|
* @ingroup rsvp_form |
| 622 |
|
* @param $rsvp The rsvp instance to display. |
| 623 |
|
* |
| 624 |
|
* @return $form array. |
| 625 |
|
* |
| 626 |
|
*/ |
| 627 |
|
function rsvp_form_element_reply_startdate_option($rsvp, $field_attr = array()) { |
| 628 |
|
|
| 629 |
|
$reply_start_option = array( |
| 630 |
|
'#type' => 'checkbox', |
| 631 |
|
'#title' => t('Invitation has reply start date'), |
| 632 |
|
'#default_value' => (_rsvp_function_checkbit($rsvp->option_enabled, RSVP_OPTION_REPLY_STARTDATE_ENABLED) == RSVP_OPTION_YES) ? 1 : 0, |
| 633 |
|
'#description' => t('Check if you want to specify a reply start date for this invitation, then choose reply start date below.') |
| 634 |
|
); |
| 635 |
|
|
| 636 |
|
return array_merge($field_attr, $reply_start_option); |
| 637 |
|
|
| 638 |
} |
} |
| 639 |
|
|
| 655 |
'#title' => t('Reply end date'), |
'#title' => t('Reply end date'), |
| 656 |
'#default_value' => array('year' => (int) date('Y', $date_local ), 'month' => (int) date('m', $date_local ), 'day' => (int) date('d', $date_local )), |
'#default_value' => array('year' => (int) date('Y', $date_local ), 'month' => (int) date('m', $date_local ), 'day' => (int) date('d', $date_local )), |
| 657 |
'#description' => t('Specify the end date of a time window guests can reply to the invitation.'), |
'#description' => t('Specify the end date of a time window guests can reply to the invitation.'), |
| 658 |
'#required' => FALSE |
'#required' => FALSE, |
| 659 |
)); |
)); |
| 660 |
|
|
| 661 |
} |
} |
| 662 |
|
|
| 663 |
|
/** |
| 664 |
|
* Displays the 'Reply start date option' form element to set $rsvp->option_enabled | RSVP_OPTION_REPLY_ENDDATE_ENABLED |
| 665 |
|
* |
| 666 |
|
* @ingroup rsvp_form |
| 667 |
|
* @param $rsvp The rsvp instance to display. |
| 668 |
|
* |
| 669 |
|
* @return $form array. |
| 670 |
|
* |
| 671 |
|
*/ |
| 672 |
|
function rsvp_form_element_reply_enddate_option($rsvp, $field_attr = array()) { |
| 673 |
|
|
| 674 |
|
$reply_end_option = array( |
| 675 |
|
'#type' => 'checkbox', |
| 676 |
|
'#title' => t('Invitation has reply end date'), |
| 677 |
|
'#default_value' => (_rsvp_function_checkbit($rsvp->option_enabled, RSVP_OPTION_REPLY_ENDDATE_ENABLED) == RSVP_OPTION_YES) ? 1 : 0, |
| 678 |
|
'#description' => t('Check if you want to specify a reply end date for this invitation, then choose reply end date below.') |
| 679 |
|
); |
| 680 |
|
|
| 681 |
|
return array_merge($field_attr, $reply_end_option); |
| 682 |
|
|
| 683 |
|
} |
| 684 |
|
|
| 685 |
|
|
| 686 |
/** |
/** |
| 687 |
* AJAX callback to replace the stylesheet select options. |
* AJAX callback to replace the stylesheet select options. |