1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 10:04:35 +02:00

Issue #4372 - Enhancement: Contact page info. Requires database update.

This commit is contained in:
Cameron
2021-02-15 10:58:49 -08:00
parent 523fae8582
commit c94b1867a3
7 changed files with 450 additions and 300 deletions

View File

@@ -103,6 +103,71 @@ class contact_shortcodes extends e_shortcode
return "<input type='text' id='contactName' title='".LANCONTACT_17."' name='author_name' required='required' size='30' ".$placeholder." class='".$class."' value=\"".$value."\" />";
}
function sc_contact_map($parm=null)
{
$pref = e107::getPref('contact_info');
if(empty($pref['address']))
{
return null;
}
$address = trim($pref['address']);
$zoom = varset($parm['zoom'], 'street');
$zoomOpts = [
'street' => 17,
'district' => 14,
'city' => 12,
];
$zoom = (int) varset($zoomOpts[$zoom],$zoom);
// &z='.$zoom.'
return '<iframe class="sc-contact-map" src="https://maps.google.com/maps?q='.$address.'&output=embed&z='.$zoom.'"></iframe>';
}
function sc_contact_info($parm=null)
{
$ipref = e107::getPref('contact_info');
$type = varset($parm['type']);
if(empty($type) || empty($ipref[$type]))
{
return null;
}
$tp = e107::getParser();
$ret = '';
switch($type)
{
case "company":
$ret = $tp->toHTML($ipref[$type], true, 'TITLE');
break;
case 'email1':
case 'email2':
case 'phone1':
case 'phone2':
case 'phone3':
case 'fax':
$ret = $tp->obfuscate($ipref[$type]);
break;
default:
$ret = $tp->toHTML($ipref[$type], true, 'BODY');
// code to be executed if n is different from all labels;
}
return $ret;
}
/* example {CONTACT_EMAIL} */

View File

@@ -12,11 +12,40 @@
if (!defined('e107_INIT')) { exit; }
$CONTACT_WRAPPER['info']['CONTACT_INFO'] = "<div>{---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=company'] = "<h4>{---}</h4>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=address'] = "<address>{GLYPH=fa-map-marker} {---}</address>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=email1'] = "<div>{GLYPH=fa-envelope} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=email2'] = "<div>{GLYPH=fa-envelope} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone1'] = "<div>{GLYPH=fas-phone-alt} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone2'] = "<div>{GLYPH=fas-phone-alt} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=phone3'] = "<div>{GLYPH=fas-phone-alt} {---}</div>";
$CONTACT_WRAPPER['info']['CONTACT_INFO: type=fax'] = "<div>{GLYPH=fa-fax} {---}</div>";
$CONTACT_TEMPLATE['info'] = "
<div id='contactInfo' >
<address>{SITECONTACTINFO}</address>
<!-- Backward Compat. Contact Info -->
{SITECONTACTINFO}
<!-- New Contact Info -->
{CONTACT_INFO: type=company}
<div class='row'>
<div class ='col-md-6 col-lg-4 h=100'>
{CONTACT_INFO: type=address}
<div class='form-group'>
{CONTACT_INFO: type=phone1}
{CONTACT_INFO: type=phone2}
{CONTACT_INFO: type=phone3}
{CONTACT_INFO: type=fax}
</div>
{CONTACT_INFO: type=email1}
{CONTACT_INFO: type=email2}
</div>
<div class ='col-md-6 col-lg-8 h=100'>
{CONTACT_MAP: zoom=city}
</div>
</div>
</div>
";

View File

@@ -33,6 +33,8 @@
<core name="comments_moderate">247</core>
<core name="comments_sort">desc</core>
<core name="compress_output">0</core>
<core name="contact_info"><![CDATA[array (
)]]></core>
<core name="contact_emailcopy">0</core>
<core name="contact_visibility">0</core>
<core name="contact_filter"></core>