[ Index ]

PHP Cross Reference of PageLines Framework

title

Body

[close]

/sections/callout/ -> section.php (source)

   1  <?php
   2  /*
   3      Section: Callout
   4      Author: PageLines
   5      Author URI: http://www.pagelines.com
   6      Description: Shows a callout banner with optional graphic call to action
   7      Class Name: PageLinesCallout
   8      Cloning: true
   9      Workswith: templates, main, header, morefoot
  10  */
  11  
  12  /**
  13   * Callout Section
  14   *
  15   * @package PageLines Framework
  16   * @author PageLines
  17   */
  18  class PageLinesCallout extends PageLinesSection {
  19  
  20      var $tabID = 'callout_meta';
  21  
  22  
  23      /**
  24      *
  25      * @TODO document
  26      *
  27      */
  28  	function section_optionator( $settings ){
  29          $settings = wp_parse_args($settings, $this->optionator_default);
  30  
  31              $page_metatab_array = array(
  32                  'pagelines_callout_text' => array(
  33                          'type'                 => 'text_multi',
  34                          'inputlabel'         => 'Enter text for your callout banner section',
  35                          'title'             => $this->name.' Text',
  36                          'selectvalues'    => array(
  37                              'pagelines_callout_header'        => array('inputlabel'=>'Callout Header', 'default'=> ''),
  38                              'pagelines_callout_subheader'    => array('inputlabel'=>'Callout Subtext', 'default'=> '')
  39                          ),
  40                          'shortexp'             => 'The text for the callout banner section',
  41                          'exp'                 => 'This text will be used as the title/text for the callout section of the theme.'
  42  
  43                  ),
  44                  'pagelines_callout_align' => array(
  45                      'type'             => 'select',
  46                      'inputlabel'     => 'Select Alignment',
  47                      'title'         => 'Callout Alignment',
  48                      'shortexp'         => 'Aligns the action left or right (defaults right)',
  49                      'exp'             => 'Default alignment for the callout "action" is on the right.',
  50                      'selectvalues'    => array(
  51                          'right'        => array('name'    =>'Align Right'),
  52                          'left'        => array('name'    =>'Align Left'),
  53                          'center'    => array('name'    =>'Align Center'),
  54                      ),
  55                  ),
  56                  'pagelines_callout_cta' => array(
  57                      'type'        => 'multi_option',
  58                      'title'        => __('Callout Action Button', 'pagelines'),
  59                      'shortexp'    => __('Enter the options for the Callout button', 'pagelines'),
  60                      'selectvalues'    => array(
  61                          'pagelines_callout_button_link' => array(
  62                              'type' => 'text',
  63                              'inputlabel' => 'Button link destination (URL - Required)',
  64                          ),
  65                          'pagelines_callout_button_text' => array(
  66                              'type'             => 'text',
  67                              'inputlabel'     => 'Callout Button Text',
  68                          ),
  69                          'pagelines_callout_button_target' => array(
  70                              'type'            => 'check',
  71                              'default'        => false,
  72                              'inputlabel'    => 'Open link in new window.',
  73                          ),
  74                          'pagelines_callout_button_theme' => array(
  75                              'type'            => 'select',
  76                              'default'        => false,
  77                              'inputlabel'    => 'Select Button Color',
  78                              'selectvalues'    => array(
  79                                  'primary'    => array('name' => 'Blue'),
  80                                  'warning'    => array('name' => 'Orange'),
  81                                  'important'    => array('name' => 'Red'),
  82                                  'success'    => array('name' => 'Green'),
  83                                  'info'        => array('name' => 'Light Blue'),
  84                                  'reverse'    => array('name' => 'Grey'),
  85                              ),
  86                          ),
  87                      ),
  88                  ),
  89                  'pagelines_callout_image' => array(
  90                      'type'             => 'image_upload',
  91                      'imagepreview'     => '270',
  92                      'inputlabel'     => 'Upload custom image',
  93                      'title'         => $this->name.' Image',
  94                      'shortexp'         => 'Input Full URL to your custom header or logo image.',
  95                      'exp'             => 'Overrides the button output with a custom image.'
  96                  ),
  97  
  98              );
  99  
 100              $metatab_settings = array(
 101                      'id'         => $this->tabID,
 102                      'name'         => 'Callout',
 103                      'icon'         => $this->icon,
 104                      'clone_id'    => $settings['clone_id'],
 105                      'active'    => $settings['active']
 106                  );
 107  
 108              register_metatab($metatab_settings, $page_metatab_array);
 109  
 110      }
 111  
 112      /**
 113      * Section template.
 114      */
 115   	function section_template() {
 116  
 117          $call_title = ploption( 'pagelines_callout_header', $this->tset );
 118          $call_sub = ploption( 'pagelines_callout_subheader', $this->tset );
 119          $call_img = ploption( 'pagelines_callout_image', $this->oset );
 120          $call_link = ploption( 'pagelines_callout_button_link', $this->tset );
 121          $call_btext = ploption( 'pagelines_callout_button_text', $this->tset );
 122          $call_btheme = ploption( 'pagelines_callout_button_theme', $this->tset );
 123          $target = ( ploption( 'pagelines_callout_button_target', $this->oset ) ) ? 'target="_blank"' : '';
 124          $call_action_text = (ploption('pagelines_callout_action_text', $this->oset)) ? ploption('pagelines_callout_action_text', $this->oset) : __('Start Here', 'pagelines');
 125  
 126          $styling_class = ($call_sub) ? 'with-callsub' : '';
 127  
 128          $alignment = ploption('pagelines_callout_align', $this->oset);
 129  
 130          $call_align = ($alignment == 'left') ? '' : 'rtimg';
 131  
 132          if($call_title || $call_img){ ?>
 133  
 134  <?php if($alignment == 'center'): ?>
 135  <div class="callout-area fix callout-center <?php echo $styling_class;?>">
 136      <div class="callout_text">
 137          <div class="callout_text-pad">
 138              <?php $this->draw_text($call_title, $call_sub, $call_img); ?>
 139          </div>
 140      </div>
 141      <div class="callout_action <?php echo $call_align;?>">
 142          <?php $this->draw_action($call_link, $target, $call_img, $call_btheme, $call_btext); ?>
 143      </div>
 144  
 145  </div>
 146  <?php else: ?>
 147  <div class="callout-area media fix <?php echo $styling_class;?>">
 148      <div class="callout_action img <?php echo $call_align;?>">
 149          <?php $this->draw_action($call_link, $target, $call_img, $call_btheme, $call_btext); ?>
 150      </div>
 151      <div class="callout_text bd">
 152          <div class="callout_text-pad">
 153              <?php $this->draw_text($call_title, $call_sub, $call_img); ?>
 154          </div>
 155      </div>
 156  </div>
 157  <?php endif; ?>
 158  <?php
 159  
 160          } else
 161              echo setup_section_notify($this, __('Set Callout page options to activate.', 'pagelines') );
 162  
 163      }
 164  
 165  	function draw_action($call_link, $target, $call_img, $call_btheme, $call_btext){
 166          if( $call_img )
 167              printf('<div class="callout_image"><a %s href="%s" ><img src="%s" /></a></div>', $target, $call_link, $call_img);
 168          else
 169              printf('<a %s class="btn btn-%s btn-large" href="%s">%s</a> ', $target, $call_btheme, $call_link, $call_btext);
 170  
 171      }
 172  
 173  	function draw_text($call_title, $call_sub, $call_img){
 174          printf( '<h2 class="callout_head %s">%s</h2>', (!$call_img) ? 'noimage' : '', $call_title);
 175  
 176          if($call_sub)
 177              printf( '<p class="callout_sub subhead %s">%s</p>', (!$call_img) ? 'noimage' : '', $call_sub);
 178      }
 179  
 180  }


Generated: Thu May 23 23:52:43 2013 Cross-referenced by PHPXref 0.7.1