more work
This commit is contained in:
@@ -10,29 +10,16 @@
|
||||
global $event;
|
||||
$form = array();
|
||||
$header_link_max_count = 3;
|
||||
$social_media_link_max_count = 5;
|
||||
$social_media_link_max_count = 3;
|
||||
|
||||
$prefix = "<h2>Configure HTML email template</h2>";
|
||||
|
||||
// load any existing values from the drupal variable table
|
||||
$colors = json_decode(variable_get('booking_mailtemplate_colors'), TRUE);
|
||||
$header_links = json_decode(variable_get('booking_mailtemplate_header_links'), TRUE);
|
||||
$social_links = json_decode(variable_get('booking_mailtemplate_social_links'), TRUE);
|
||||
|
||||
watchdog('booking_debug', "<pre>Mail template navigation links loaded\n@info</pre>", array('@info' => print_r($header_links, true)));
|
||||
|
||||
/*
|
||||
//query for existing header links
|
||||
$query = db_select('booking_mailtemplate_fields', 'm');
|
||||
$query->condition('m.booking_mailtemplate_media_type', 'header', '=');
|
||||
$query->fields('m');
|
||||
$header_links = $query->execute()->fetchAllAssoc('mid');
|
||||
|
||||
//query for existing social media links
|
||||
$query = db_select('booking_mailtemplate_fields', 'm');
|
||||
$query->condition('m.booking_mailtemplate_media_type', 'socialmedia', '=');
|
||||
$query->fields('m');
|
||||
$social_media_links = $query->execute()->fetchAllAssoc('mid');
|
||||
*/
|
||||
//watchdog('booking_debug', "<pre>Mail template navigation links loaded\n@info</pre>", array('@info' => print_r($header_links, true)));
|
||||
|
||||
$form['colors'] = array(
|
||||
'#type' => 'fieldset',
|
||||
@@ -80,6 +67,14 @@
|
||||
'#maxlength' => 50,
|
||||
'#default_value' => empty($colors['booking_mailtemplate_text_color']) ? '#FFFFFF' : $colors['booking_mailtemplate_text_color'],
|
||||
);
|
||||
$form['colors']['booking_mailtemplate_subjectheading_text_color'] = array (
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Subject Heading Text Colour'),
|
||||
'#description' => t('Specify CSS compatible value'),
|
||||
'#size' => 10,
|
||||
'#maxlength' => 50,
|
||||
'#default_value' => empty($colors['booking_mailtemplate_subjectheading_text_color']) ? '#FFFFFF' : $colors['booking_mailtemplate_subjectheading_text_color'],
|
||||
);
|
||||
$form['colors']['booking_mailtemplate_link_color'] = array (
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Link Colour'),
|
||||
@@ -140,7 +135,7 @@
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
|
||||
//add form elements for header links
|
||||
//add form elements for social media links
|
||||
for ($i = 1; $i <= $social_media_link_max_count; $i++) {
|
||||
$social_link_text = 'booking_mailtemplate_sociallink_text' . $i;
|
||||
$social_image_url = 'booking_mailtemplate_socialimage_url' . $i;
|
||||
@@ -150,21 +145,21 @@
|
||||
'#title' => t('Hover text for social link ' . $i),
|
||||
'#size' => 150,
|
||||
'#maxlength' => 300,
|
||||
'#default_value' => variable_get($social_link_text, 'Link Title'),
|
||||
'#default_value' => empty($social_links[$i]['text']) ? '' : $social_links[$i]['text'],
|
||||
);
|
||||
$form['social-links'][$social_image_url] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('URL to social image ' . $i),
|
||||
'#size' => 150,
|
||||
'#maxlength' => 500,
|
||||
'#default_value' => variable_get($social_image_url, $GLOBALS['base_url'] . '/sites/all/modules/booking/images/logo.png'),
|
||||
'#default_value' => empty($social_links[$i]['imageurl']) ? $GLOBALS['base_url'] : $social_links[$i]['imageurl'],
|
||||
);
|
||||
$form['social-links'][$social_link_url] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('URL for social link ' . $i),
|
||||
'#size' => 150,
|
||||
'#maxlength' => 500,
|
||||
'#default_value' => variable_get($social_link_url, $GLOBALS['base_url']),
|
||||
'#default_value' => empty($social_links[$i]['linkurl']) ? $GLOBALS['base_url'] : $social_links[$i]['linkurl'],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -185,18 +180,16 @@
|
||||
function booking_mailtemplate_form_submit($form, &$form_state)
|
||||
{
|
||||
global $event;
|
||||
$values = $form_state['input'];
|
||||
$colors_variable_list = array('booking_mailtemplate_background_color', 'booking_mailtemplate_content_background_color',
|
||||
'booking_mailtemplate_navigation_background_color',
|
||||
'booking_mailtemplate_header_background_color', 'booking_mailtemplate_text_color', 'booking_mailtemplate_link_color',
|
||||
);
|
||||
$header_links_variable_list = array();
|
||||
$social_links_variable_list = array();
|
||||
|
||||
$color_data = array();
|
||||
$header_data = array();
|
||||
$social_data = array();
|
||||
// 'booking_mailtemplate_header_image_url', 'booking_mailtemplate_header_link_url');
|
||||
|
||||
$values = $form_state['input'];
|
||||
$colors_variable_list = array('booking_mailtemplate_background_color', 'booking_mailtemplate_content_background_color',
|
||||
'booking_mailtemplate_navigation_background_color', 'booking_mailtemplate_subjectheading_text_color',
|
||||
'booking_mailtemplate_header_background_color', 'booking_mailtemplate_text_color', 'booking_mailtemplate_link_color',
|
||||
'booking_mailtemplate_header_image_url', 'booking_mailtemplate_header_link_url',
|
||||
);
|
||||
|
||||
//set all the values that are just using the builtin drupal variable definitions
|
||||
foreach ($values as $key => $value) {
|
||||
@@ -204,6 +197,7 @@ function booking_mailtemplate_form_submit($form, &$form_state)
|
||||
//variable_set($key, $value);
|
||||
$color_data[$key] = $value;
|
||||
}
|
||||
// update navigation header links
|
||||
elseif (strpos($key, "booking_mailtemplate_headerlink") === 0) {
|
||||
//get the ID for this header navigation link
|
||||
preg_match("/.*(\d+)$/", $key, $matches);
|
||||
@@ -213,15 +207,23 @@ function booking_mailtemplate_form_submit($form, &$form_state)
|
||||
'link' => $values['booking_mailtemplate_headerlink_url' . $id],
|
||||
);
|
||||
}
|
||||
// update social media links
|
||||
elseif (strpos($key, "booking_mailtemplate_social") === 0) {
|
||||
//get the ID for this header navigation link
|
||||
preg_match("/.*(\d+)$/", $key, $matches);
|
||||
$id = $matches[1];
|
||||
$social_data[$id] = array(
|
||||
'text' => $values['booking_mailtemplate_sociallink_text' . $id],
|
||||
'imageurl' => $values['booking_mailtemplate_socialimage_url' . $id],
|
||||
'linkurl' => $values['booking_mailtemplate_sociallink_url' . $id],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
watchdog('booking_debug', "<pre>Mail template navigation links\n@info</pre>", array('@info' => print_r($header_data, true)));
|
||||
//watchdog('booking_debug', "<pre>Mail template navigation links\n@info</pre>", array('@info' => print_r($header_data, true)));
|
||||
|
||||
// store the data into the standard drupal variable table
|
||||
variable_set('booking_mailtemplate_colors', json_encode($color_data));
|
||||
variable_set('booking_mailtemplate_header_links', json_encode($header_data));
|
||||
|
||||
//update header links
|
||||
|
||||
//update social media links
|
||||
|
||||
variable_set('booking_mailtemplate_header_links', json_encode($header_data));
|
||||
}
|
@@ -220,7 +220,7 @@ max-width: 100% !important; } }
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="background-color:transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width: 700px;"><tr class="layout-full-width" style="background-color:<?php print $colors['booking_mailtemplate_navigation_background_color'] ?>;"><![endif]-->
|
||||
|
||||
<?php foreach ($links as $linkitem) : ?>
|
||||
<?php foreach ($header_links as $linkitem) : ?>
|
||||
<!--[if (mso)|(IE)]><td align="center" width="233" style=" width:233px; padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><![endif]-->
|
||||
<div class="col num4" style="max-width: 320px;min-width: 233px;display: table-cell;vertical-align: top;background-color: <?php print $colors['booking_mailtemplate_navigation_background_color'] ?>;">
|
||||
<div style="background-color: transparent; width: 100% !important;">
|
||||
@@ -252,7 +252,7 @@ max-width: 100% !important; } }
|
||||
<!--[if (!mso)&(!IE)]><!--><div style="border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;"><!--<![endif]-->
|
||||
<!-- Subject -->
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 20px; padding-bottom: 10px;"><![endif]-->
|
||||
<div style="font-size:36px;line-height:43px;font-family:Verdana, Geneva, sans-serif;color:<?php print $colors['booking_mailtemplate_navigation_background_color'] ?>;text-align:left;">
|
||||
<div style="font-size:36px;line-height:43px;font-family:Verdana, Geneva, sans-serif;color:<?php print $colors['booking_mailtemplate_subjectheading_text_color'] ?>;text-align:left;">
|
||||
<p style="margin: 0;text-align: center"><strong><?php print $subject ?></strong></p>
|
||||
</div>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
@@ -283,33 +283,19 @@ max-width: 100% !important; } }
|
||||
<div align="center" style="padding-right: 10px; padding-left: 10px; padding-bottom: 10px;">
|
||||
<div style="line-height:10px;font-size:1px"> </div>
|
||||
<div style="display: table; max-width:171px;">
|
||||
<!--[if (mso)|(IE)]><table width="151" cellpadding="0" cellspacing="0" border="0"><tr><td style="border-collapse:collapse; padding-right: 10px; padding-left: 10px; padding-bottom: 10px;" align="center"><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse; mso-table-lspace: 0pt;mso-table-rspace: 0pt; width:151px;"><tr><td width="32" style="width:32px; padding-right: 15px;" valign="top"><![endif]-->
|
||||
<table align="left" border="0" cellspacing="0" cellpadding="0" width="32" height="32" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;Margin-right: 15px">
|
||||
<?php foreach ($social_links as $linkitem) : ?>
|
||||
<?php if (isset($linkitem['text'])) : ?>
|
||||
<!--[if (mso)|(IE)]><table width="151" cellpadding="0" cellspacing="0" border="0"><tr><td style="border-collapse:collapse; padding-right: 10px; padding-left: 10px; padding-bottom: 10px;" align="center"><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse; mso-table-lspace: 0pt;mso-table-rspace: 0pt; width:151px;"><tr><td width="32" style="width:32px; padding-right: 15px;" valign="top"><![endif]-->
|
||||
<table align="left" border="0" cellspacing="0" cellpadding="0" width="32" height="32" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;Margin-right: 15px">
|
||||
<tbody><tr style="vertical-align: top"><td align="left" valign="middle" style="word-break: break-word;border-collapse: collapse !important;vertical-align: top">
|
||||
<a href="https://instagram.com/studyweek2018/" title="Instagram" target="_blank">
|
||||
<img src="<?php echo $GLOBALS['base_url']; ?>/sites/all/modules/booking/images/instagram@2x.png" alt="Instagram" title="Instagram" width="32" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !important;border: none;height: auto;float: none;max-width: 32px !important">
|
||||
<a href="<?php print $linkitem['linkurl'] ?>" title="<?php print $linkitem['text'] ?>" target="_blank">
|
||||
<img src="<?php print $linkitem['imageurl'] ?>" alt="<?php print $linkitem['text'] ?>" title="<?php print $linkitem['text'] ?>" width="32" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !important;border: none;height: auto;float: none;max-width: 32px !important">
|
||||
</a>
|
||||
<div style="line-height:5px;font-size:1px"> </div>
|
||||
</td></tr>
|
||||
</tbody></table>
|
||||
<!--[if (mso)|(IE)]></td><td width="32" style="width:32px; padding-right: 15px;" valign="top"><![endif]-->
|
||||
<table align="left" border="0" cellspacing="0" cellpadding="0" width="32" height="32" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;Margin-right: 15px">
|
||||
<tbody><tr style="vertical-align: top"><td align="left" valign="middle" style="word-break: break-word;border-collapse: collapse !important;vertical-align: top">
|
||||
<a href="https://www.facebook.com/studyweek2018" title="Facebook" target="_blank">
|
||||
<img src="<?php echo $GLOBALS['base_url']; ?>/sites/all/modules/booking/images/facebook@2x.png" alt="Facebook" title="Facebook" width="32" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !important;border: none;height: auto;float: none;max-width: 32px !important">
|
||||
</a>
|
||||
<div style="line-height:5px;font-size:1px"> </div>
|
||||
</td></tr>
|
||||
</tbody></table>
|
||||
<!--[if (mso)|(IE)]></td><td width="32" style="width:32px; padding-right: 0;" valign="top"><![endif]-->
|
||||
<table align="left" border="0" cellspacing="0" cellpadding="0" width="32" height="32" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;Margin-right: 0">
|
||||
<tbody><tr style="vertical-align: top"><td align="left" valign="middle" style="word-break: break-word;border-collapse: collapse !important;vertical-align: top">
|
||||
<a href="http://youtube.com/sydneycyc" title="YouTube" target="_blank">
|
||||
<img src="<?php echo $GLOBALS['base_url']; ?>/sites/all/modules/booking/images/youtube@2x.png" alt="YouTube" title="YouTube" width="32" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: block !important;border: none;height: auto;float: none;max-width: 32px !important">
|
||||
</a>
|
||||
<div style="line-height:5px;font-size:1px"> </div>
|
||||
</td></tr>
|
||||
</tbody></table>
|
||||
</tbody></table>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user