Last active
December 10, 2015 22:38
-
-
Save wnstn/4503394 to your computer and use it in GitHub Desktop.
Module temp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function csextra_block($op = 'list', $delta = 0, $edit = array()) | |
| { | |
| switch ($op) { | |
| case 'list': | |
| $blocks[0]['info'] = t('Send To a Friend Form'); | |
| $blocks[1]['info'] = t('Sign Up for Our Newsletter'); | |
| $blocks[2]['info'] = t('Event Ticket Button`'); | |
| return $blocks; | |
| break; | |
| case 'view': | |
| if($delta == 0){ | |
| $blocks['subject'] = t('Send To a Friend Form'); | |
| $blocks['content'] = tell_a_friend(); | |
| } | |
| if($delta == 1){ | |
| $blocks['subject'] = t('Sign up For Our Newsletter'); | |
| $blocks['content'] = newsletter_signup(); | |
| } | |
| if($delta == 2){ | |
| $blocks['subject'] = t('Event Ticket Button'); | |
| $blocks['content'] = event_ticket_button(); | |
| } | |
| return $blocks; | |
| break; | |
| case 'configure': | |
| if($delta == 2 && user_access('administer homepage blocks')) { | |
| $form['event_ticket_button_block'] = array( | |
| '#type' => 'textfield', | |
| '#title' => t('Event Button Text'), | |
| '#description' => t('Text for the event button'), | |
| '#default_value' => variable_get('event_button_block_text', ''), | |
| '#size' => 40, | |
| '#max-length' => 255, | |
| ); | |
| $form['event_ticket_button_block_link'] = array( | |
| '#type' => 'textfield', | |
| '#title' => t('Event Button Link'), | |
| '#description' => t('The URL for the page the button will link to'), | |
| '#default_value' => variable_get('event_button_block_link', ''), | |
| '#size' => 40, | |
| '#max-length' => 255, | |
| ); | |
| } | |
| return $form; | |
| case 'save': | |
| if ($delta == 2) { | |
| variable_set('event_button_block_text', $edit['event_button_block_text']); | |
| variable_set('event_button_block_link', $edit['event_button_block_link']); | |
| } | |
| break; | |
| } | |
| } | |
| function tell_a_friend() | |
| { | |
| $current_node = node_load(arg(1)); | |
| if(empty($current_node->field_callout1[0]['value'])){ | |
| //setting up the webform for display | |
| $submission = array(); | |
| $enabled = TRUE; | |
| $preview = FALSE; | |
| $webform_node = node_load(9); | |
| $content = '<h2 class="title">Send To a Friend</h2>'; | |
| $content .= drupal_get_form('webform_client_form_9', $webform_node, $submission, $enabled, $preview); | |
| }else{ | |
| $content = '<div class="callout_1">'; | |
| $content .= $current_node->field_callout1[0]['value']; | |
| $content .= '</div>'; | |
| if(!empty($current_node->field_callout2[0]['value'])){ | |
| $content .= '<div class="tilde">~</div>'; | |
| } | |
| } | |
| return $content; | |
| } | |
| function newsletter_signup() | |
| { | |
| $current_node = node_load(arg(1)); | |
| if(!empty($current_node->taxonomy) && $current_node->type != 'service'){ | |
| $taxonomy_node = getTaxonomyNode($current_node->taxonomy); | |
| $taxonomy_term_name = $taxonomy_node->title; | |
| }else{ | |
| $taxonomy_term_name = $current_node->title; | |
| } | |
| if(empty($current_node->field_callout2[0]['value'])) { | |
| switch ($taxonomy_term_name) { | |
| // case 'Basic Needs': | |
| // $embed_code = '<link href="https://app.e2ma.net/css/signup.sml.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="https://app.e2ma.net/app/view:SignupForm/signupId:1410819/key:f9f553d8f4578d61aa298754b7378731/acctId:1404205"></script><div id="load_check" class="signup_form_message" >This form needs Javascript to display, which your browser doesn\'t support. <a href="https://app.e2ma.net/app/view:Join/signupId:1410819/acctId:1404205"> Sign up here</a> instead </div><script type="text/javascript">signupFormObj.drawForm();</script>'; | |
| // break; | |
| // | |
| // case 'Pregnancy and Adoption': | |
| // $embed_code = '<link href="https://app.e2ma.net/css/signup.sml.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="https://app.e2ma.net/app/view:SignupForm/signupId:1410826/key:f9f553d8f4578d61aa298754b7378731/acctId:1404205"></script><div id="load_check" class="signup_form_message" >This form needs Javascript to display, which your browser doesn\'t support. <a href="https://app.e2ma.net/app/view:Join/signupId:1410826/acctId:1404205"> Sign up here</a> instead </div><script type="text/javascript">signupFormObj.drawForm();</script>'; | |
| // break; | |
| // | |
| // case 'Refugees': | |
| // $embed_code = '<link href="https://app.e2ma.net/css/signup.sml.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="https://app.e2ma.net/app/view:SignupForm/signupId:1410827/key:f9f553d8f4578d61aa298754b7378731/acctId:1404205"></script><div id="load_check" class="signup_form_message" >This form needs Javascript to display, which your browser doesn\'t support. <a href="https://app.e2ma.net/app/view:Join/signupId:1410827/acctId:1404205"> Sign up here</a> instead </div><script type="text/javascript">signupFormObj.drawForm();</script>'; | |
| // break; | |
| // | |
| // case 'Seniors': | |
| // $embed_code = '<link href="https://app.e2ma.net/css/signup.sml.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="https://app.e2ma.net/app/view:SignupForm/signupId:1410828/key:f9f553d8f4578d61aa298754b7378731/acctId:1404205"></script><div id="load_check" class="signup_form_message" >This form needs Javascript to display, which your browser doesn\'t support. <a href="https://app.e2ma.net/app/view:Join/signupId:1410828/acctId:1404205"> Sign up here</a> instead </div><script type="text/javascript">signupFormObj.drawForm();</script>'; | |
| // break; | |
| // | |
| case 'Tennessee Office for Refugees': | |
| $embed_code = '<link href="https://app.e2ma.net/css/signup.sml.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="https://app.e2ma.net/app/view:SignupForm/signupId:1410846/key:f9f553d8f4578d61aa298754b7378731/acctId:1404205"></script><div id="load_check" class="signup_form_message" >This form needs Javascript to display, which your browser doesn\'t support. <a href="https://app.e2ma.net/app/view:Join/signupId:1410846/acctId:1404205"> Sign up here</a> instead </div><script type="text/javascript">signupFormObj.drawForm();</script>'; | |
| break; | |
| case 'Pregnancy and Adoption': | |
| $embed_code = '<link href="https://app.e2ma.net/css/signup.sml.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="https://app.e2ma.net/app/view:SignupForm/signupId:1410826/key:f9f553d8f4578d61aa298754b7378731/acctId:1404205"></script><div id="load_check" class="signup_form_message" >This form needs Javascript to display, which your browser doesn\'t support. <a href="https://app.e2ma.net/app/view:Join/signupId:1410826/acctId:1404205"> Sign up here</a> instead </div><script type="text/javascript">signupFormObj.drawForm();</script>'; | |
| break; | |
| default: | |
| $taxonomy_term_name = 'Catholic Charities'; | |
| $embed_code = '<link href="https://app.e2ma.net/css/signup.sml.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="https://app.e2ma.net/app/view:SignupForm/signupId:1409871/key:f9f553d8f4578d61aa298754b7378731/acctId:1404205"></script><div id="load_check" class="signup_form_message" >This form needs Javascript to display, which your browser doesn\'t support. <a href="https://app.e2ma.net/app/view:Join/signupId:1409871/acctId:1404205"> Sign up here</a> instead </div><script type="text/javascript">signupFormObj.drawForm();</script>'; | |
| break; | |
| return $embed_code; | |
| } | |
| $disabled_terms = array('Counseling', 'Children', 'Hispanic Services', 'Seniors', 'Counseling'); | |
| if (in_array($taxonomy_term_name, $disabled_terms)) { | |
| $content = ''; | |
| }else{ | |
| $content = '<div class="newsletter_hdr">'; | |
| $content .= '<h2>Stay In The Loop</h2>'; | |
| $content .= '<p>Subscribe to the '. $taxonomy_term_name .' Newsletter</p>'; | |
| $content .= '</div>'; | |
| $content .= '<div class="newsletter">'; | |
| $content .= $embed_code; | |
| $content .= '</div>'; | |
| } | |
| }else{ | |
| $content = '<div class="callout_2">'; | |
| $content .= $current_node->field_callout2[0]['value']; | |
| $content .= '</div>'; | |
| } | |
| return $content; | |
| } | |
| function event_ticket_button() | |
| { | |
| // $current_node = node_load(arg(1)); | |
| // $content = '<a href="'; | |
| // $content .= WHAT GOES HERE | |
| // $content .= '" title="Event Registration" class="event-registration">'; | |
| // $content .= WHAT GOES HERE | |
| // $content .= '</a>'; | |
| // return $content; | |
| } | |
| function get_service_taxnonomy_terms($node_taxonomy) | |
| { | |
| $service_terms = array(); | |
| if(is_array($node_taxonomy)){ | |
| foreach ($node_taxonomy as $key => $value) { | |
| if($value->vid == 1){ | |
| $service_terms[] = $value->tid; | |
| } | |
| } | |
| } | |
| return $service_terms; | |
| } | |
| function get_all_newsletters(){ | |
| $query = db_query("SELECT nid FROM {node} WHERE type = '%s' order by created desc", "newsletter"); | |
| while ($obj = db_fetch_object($query)) { | |
| $ids[] = $obj->nid; | |
| } | |
| return $ids; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function event_ticket_button() | |
| { | |
| $current_node = node_load(arg(1)); | |
| $block_link = variable_get('event_button_block_text', ''); | |
| $block_text = variable_get('event_button_block_link', ''); | |
| $content = '<a href="'; | |
| $content .= $block_link; | |
| $content .= '" title="Event Registration" class="event-registration">'; | |
| $content .= $block_text; | |
| $content .= '</a>'; | |
| return $content; | |
| } |
chayner
commented
Jan 10, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment