Advertisement
jegtheme

contact-template.php

Feb 25th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.84 KB | None | 0 0
  1. <?php
  2.    
  3.     global $post;
  4.    
  5.     $res = array();
  6.     $locs = j_get_option('mapdata');
  7.     if(!empty($locs)) :
  8.         foreach ($locs as $i => $l) :      
  9.             $res[$i] = array(
  10.                 "x"         => $l->x,
  11.                 "y"         => $l->y,
  12.                 "title"     => $l->title,
  13.                 "address"   => array($l->firstlane, $l->secondlane),
  14.                 "phone"     => explode(",",$l->phone)
  15.             );
  16.         endforeach;
  17.     endif;
  18.    
  19.     $usemap = j_get_option('use_contact_map', 1);
  20. ?>
  21.  
  22. <div id="contact_block">
  23.  
  24.     <div class="contact_form">
  25.         <div class="contact_form_inner">
  26.             <h1><?php j_e('contact_us_lang'); ?></h1>
  27.             <div class="contact_content">
  28.                 <div class="contact_left">
  29.                     <h2><?php j_e('contact_detail_lang'); ?></h2>
  30.                     <div class="contact_note">
  31.                         <?php echo do_shortcode($post->post_content); ?>
  32.                     </div>
  33.                     <ul>
  34.                         <li>
  35.                             <i class="icon-envelope"></i>
  36.                             <div class="loc-content">
  37.                                 <div><?php echo j_get_option('email_from'); ?></div>
  38.                             </div>
  39.                         </li>
  40.                         <?php if($usemap) : ?>
  41.                             <li class="view-map">
  42.                                 <i class="icon-map-marker"></i>
  43.                                 <div class="loc-content">
  44.                                     <div><?php j_e('click_view_map'); ?></div>
  45.                                 </div>
  46.                             </li>
  47.                         <?php endif; ?>
  48.                     </ul>
  49.                 </div>
  50.                 <div class="contact_right contact-wrapper">
  51.                     <h2><?php j_e('contact_form_lang'); ?></h2>
  52.                     <form id="contactform">
  53.                         <div class="input-wrapper">
  54.                             <label for="contact_name"><?php j_e('contact_lang', 'Name')?> : <span class="contact_error"></span> </label>
  55.                             <input id="contact_name" class="textfield" type="text" value="" name="contact_name">
  56.                         </div>
  57.                         <div class="input-wrapper">
  58.                             <label for="contact_email"><?php j_e('contact_email', 'Your email')?> : <span class="contact_error"></span> </label>
  59.                             <input id="contact_email" class="textfield" type="text" value="" name="contact_email">
  60.                         </div>
  61.                         <div class="input-wrapper">
  62.                             <label for="contact_message"><?php j_e('contact_message');?> : <span class="contact_error"></span> </label>
  63.                             <textarea id="contact_message" class="required" name="contact_message"></textarea>
  64.                         </div>
  65.                         <div class="input-wrapper contact_button">
  66.                             <button class="btn btn-inverse"><i class="icon-white icon-ok"></i> <?php j_e('contact_send') ?></button>
  67.                             <div class="contact_loader">&nbsp;</div>
  68.                         </div>
  69.                     </form>
  70.                 </div>
  71.             </div>
  72.             <?php if($usemap) { ?>
  73.                 <div class="icon-white icon-chevron-right hideform">hidethis</div>
  74.             <?php } ?>
  75.         </div>
  76.         <div class="contactflag">
  77.             <div class="contactflagwrapper">
  78.                 <div class="misc-mail"></div>
  79.             </div>
  80.         </div>
  81.     </div>
  82.  
  83.     <div id="contact_canvas"></div>
  84.     <div class="contact_helper">
  85.         <div class="btn-group">
  86.             <button class="btn contactotop"><i class="icon-chevron-up"></i></button>
  87.             <button class="btn contacttobottom"><i class="icon-chevron-down"></i></button>
  88.             <button class="btn cntactocenter"><i class="icon-screenshot"></i></button>
  89.         </div>
  90.     </div>
  91.  
  92.    
  93.     <?php if($usemap) { ?>
  94.     <div class="contact_location">
  95.         <div class="contact_location_inner">
  96.             <h1><?php j_e('contact_location_lang'); ?></h1>
  97.             <div class="icon-white icon-chevron-left hidelocation">hidethis</div>
  98.             <div class="locationlist">
  99.                 <?php foreach($res as $index => $loc) : ?>
  100.                 <div data-alt="<?php j_e('getdirection_lang', 'Click to get direction'); ?>" class="locdetail" data-x="<?php echo $loc['x']?>" data-y="<?php echo $loc['y']?>" data-index="<?php echo $index; ?>">                 
  101.                     <h2><?php echo $loc['title'] ?></h2>
  102.                     <ul>
  103.                         <?php if(isset($loc['address'])) : ?>
  104.                         <li>
  105.                             <i class="icon-map-marker icon-standard"></i>
  106.                             <div class="loc-content">
  107.                                 <?php foreach($loc['address'] as $address) : ?>
  108.                                 <div><?php echo $address?></div>
  109.                                 <?php endforeach; ?>
  110.                             </div>
  111.                         </li>                      
  112.                         <?php endif; ?>
  113.                        
  114.                         <?php if(!empty($loc['phone'][0])) : ?>
  115.                         <li>
  116.                             <i class="phone-icon"></i>
  117.                             <div class="loc-content">
  118.                                 <?php foreach($loc['phone'] as $phone) : ?>
  119.                                 <div><?php echo $phone; ?></div>       
  120.                                 <?php endforeach; ?>               
  121.                             </div>
  122.                         </li>
  123.                         <?php endif; ?>
  124.                     </ul>
  125.                 </div>
  126.                 <?php endforeach;?>
  127.             </div>         
  128.         </div>     
  129.         <div class="locationflag">
  130.             <div class="locationflagwrapper">
  131.                 <div class="misc-safari"></div>
  132.             </div>
  133.         </div>
  134.     </div>
  135.     <?php } ?>
  136.    
  137.     <div id="jeg-loader"></div>
  138. </div>
  139.  
  140. <?php if(!$usemap) : ?>
  141. <style>
  142. #contact_canvas {  
  143.     background-attachment: fixed;
  144.     background-clip: border-box;
  145.     background-color: transparent;
  146.     background-origin: padding-box;
  147.    
  148.     background-repeat : no-repeat;
  149.     background-attachment : fixed;
  150.     background-position: center center;
  151.     -webkit-background-size: cover;
  152.     -moz-background-size: cover;
  153.     -o-background-size: cover;
  154.     background-size: cover;
  155.    
  156.     background-image: url("<?php echo j_get_option('contact_picture_background'); ?>");
  157. }
  158.  
  159. @media only screen and (max-width:767px) {
  160.     #contact_block #contact_canvas {
  161.         display: none;
  162.     }
  163. }
  164. </style>
  165. <?php endif; ?>
  166.  
  167. <!-- responsive item -->
  168. <script type="text/javascript" src="<?php echo JEG_JS_URL . 'jegcontact.full.js';?>"></script>
  169. <script type="text/javascript">
  170. jQuery(document).ready(function($)
  171. {
  172.     function resize_window(selector)
  173.     {
  174.         $(window).resize(function(){
  175.             var wh = $(window).height();
  176.  
  177.             var hh = $("header").height();
  178.             var fh = $("footer").height();
  179.            
  180.             ch = wh - hh - fh + 5;
  181.             $(selector).height(ch);
  182.         });
  183.  
  184.         $(window).resize();
  185.     }
  186.    
  187.     resize_window("#contact_canvas");
  188.  
  189.     /** bind jeg default **/
  190.     $(window).jegdefault({
  191.         curtain : <?php echo j_get_option('curtain', 0);?>,
  192.         rightclick  : <?php echo j_get_option('rightclick', 1);?>,
  193.         clickmsg    : "<?php echo j_e('disableclick', 'Right click disabled'); ?>"
  194.     });
  195.  
  196.     var jegcontact = $("#contact_block").jegcontact({
  197.         location            : <?php echo json_encode($res)?>,
  198.         zoomfactor          : <?php echo j_get_option('zoomfactor', 10);?>,
  199.         cantgetdirection    : "<?php j_e('cantgetdirection_lang'); ?>",
  200.         dummyposition       : "<?php j_e('dummyposition_lang'); ?>",
  201.         geonotsupport       : "<?php j_e('geonotsupport_lang'); ?>",
  202.         entername           : "<?php j_e('entername_lang'); ?>",
  203.         nameminlength       : "<?php j_e('nameminlength_lang'); ?>",
  204.         enteremail          : "<?php j_e('enteremail_lang'); ?>",
  205.         validemail          : "<?php j_e('validemail_lang'); ?>",
  206.         entermessage        : "<?php j_e('entermessage_lang'); ?>",
  207.         messageminlength    : "<?php j_e('messageminlength_lang'); ?>",
  208.         sendmessage         : "<?php j_e('sendmessage_lang'); ?>",
  209.         messagesent         : "<?php j_e('messagesent_lang'); ?>",
  210.         failsentmessage     : "<?php j_e('failsentmessage'); ?>",
  211.         showmapfirst        : "<?php echo j_get_option("show_contact_map", 0); ?>",
  212.         usemap              : "<?php echo $usemap ?>"
  213.     });
  214.    
  215.     /* remove binding element */
  216.     $("#main").bind('remove', function(ev){
  217.         if (ev.target === this) {
  218.            
  219.         }
  220.     });
  221. });
  222. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement