[ Index ]

PHP Cross Reference of PageLines Framework

title

Body

[close]

/admin/ -> class.ui.templates.php (source)

   1  <?php
   2  /**
   3   *
   4   *
   5   *  Template Builder
   6   *
   7   *
   8   *  @package PageLines DMS
   9   *  @subpackage OptionsUI
  10   *  @since 2.0.b3
  11   *
  12   */
  13  
  14  class PageLinesTemplateBuilder {
  15  
  16  
  17      /**
  18       * Construct
  19       */
  20  	function __construct( $oid, $o, $setting = PAGELINES_SETTINGS ) {
  21  
  22          global $pagelines_template;
  23          global $pl_section_factory;
  24  
  25          $oset = array( 'setting' => $setting );
  26  
  27          $this->sc_settings = ploption('section-control', $oset);
  28          $this->sc_global = ploption('section-control', array('setting' => PAGELINES_TEMPLATES));
  29          $this->sc_namespace = sprintf('%s[section-control]', $setting);
  30  
  31          $this->template_map = get_option( PAGELINES_TEMPLATE_MAP );
  32  
  33  
  34          $this->factory = $pl_section_factory->sections;
  35  
  36          $this->template = $pagelines_template;
  37  
  38      }
  39  
  40  
  41      /**
  42      *
  43      * @TODO document
  44      *
  45      */
  46  	function sc_name( $ta, $sid, $field, $sub = null){
  47  
  48  
  49          if(isset($sub))
  50              return sprintf('%s[%s][%s][%s][%s]', $this->sc_namespace, $ta, $sid, $field, $sub);
  51          else
  52              return sprintf('%s[%s][%s][%s]', $this->sc_namespace, $ta, $sid, $field);
  53  
  54      }
  55  
  56  
  57      /**
  58      *
  59      * @TODO document
  60      *
  61      */
  62  	function sc_value( $ta, $sid, $field, $sub = null){
  63  
  64          if(isset($sub))
  65              return isset($this->sc_settings[$ta][$sid][$field][$sub]) ? $this->sc_settings[$ta][$sid][$field][$sub] : null;
  66          else
  67              return isset($this->sc_settings[$ta][$sid][$field]) ? $this->sc_settings[$ta][$sid][$field] : null;
  68  
  69      }
  70  
  71  
  72  
  73      /**
  74       *
  75       *
  76       *  Template Builder (Sections Drag & Drop)
  77       *
  78       *
  79       *  @package PageLines DMS
  80       *  @subpackage Options
  81       *  @since 4.0
  82       *
  83       */
  84  	function draw_template_builder(){
  85  
  86              $this->do_confirms_and_hidden_fields();
  87  
  88              echo '<div class="tbuilder">';
  89  
  90                  $this->draw_template_select();
  91  
  92                  $this->do_template_builder();
  93  
  94              echo '</div>';
  95      }
  96  
  97  
  98      /**
  99      *
 100      * @TODO document
 101      *
 102      */
 103  	function do_confirms_and_hidden_fields(){
 104          $dtoggle = (get_option('pl_section_desc_toggle')) ? get_option('pl_section_desc_toggle') : 'show';
 105      ?>
 106          <input type="hidden" value="<?php echo $dtoggle;?>" id="describe_toggle" class="describe_toggle" name="describe_toggle"  />
 107  
 108  <?php }
 109  
 110      /**
 111       *
 112       *
 113       *  Do Template Area Selector
 114       *
 115       *
 116       */
 117  	function draw_template_select(){
 118          global $pagelines_template;
 119          global $unavailable_section_areas;
 120  
 121          ?>
 122      <div class="template-selector fix">
 123          <div class="template-selector-pad fix">
 124              <h4 class="over"><?php _e( '1. Select Template Area', 'pagelines' ); ?></h4>
 125              <div class="tgraph tgraph-templates">
 126                  <div class="tgraph-pad">
 127                      <div class="tgraph-controls">
 128                          <div class="tgraph-controls-pad fix">
 129                              <div id="ta-header" class="load-build tg-format tg-header"><div class="tg-pad">Header</div></div>
 130                              <div id="ta-templates" class="tg-format tg-templates"><div class="tg-pad">Page Templates</div></div>
 131                              <div id="ta-morefoot" class="load-build tg-format tg-morefoot <?php if(!VPRO) echo 'pro-area'; ?>">
 132                                  <div class="tg-pad">Morefoot <?php if(!VPRO) echo '<span class="protag">(Pro)</span>'; ?></div>
 133                              </div>
 134                              <div id="ta-footer" class="load-build tg-format tg-footer"><div class="tg-pad">Footer</div></div>
 135                          </div>
 136                      </div>
 137                  </div>
 138              </div>
 139              <div class="tgraph tgraph-content">
 140                  <div class="tgraph-pad">
 141                      <div class="tgraph-controls">
 142                          <div class="tgraph-controls-pad fix">
 143                              <div class="tg-content-area">
 144  
 145                                  <div class="tg-rm">
 146                                      <div clas="tgc">
 147                                          <div id="ta-content" class="tg-format tg-content-templates">
 148                                              <div class="tg-pad">Content Area</div>
 149                                          </div>
 150                                      </div>
 151                                  </div>
 152                              </div>
 153                              <div class="tg-wrap">
 154                                  <div class="tg-sidebarwrap">
 155                                      <div class="tgc">
 156                                          <div id="ta-sidebar_wrap" class="load-build tg-format <?php if(!VPRO) echo 'pro-area'; ?>">
 157                                              <div class="tg-pad">Wrap<?php if(!VPRO) echo '<span class="protag"> (Pro)</span>'; ?></div>
 158                                          </div>
 159                                      </div>
 160                                  </div>
 161                                  <div class="tg-sidebar1">
 162                                      <div class="tg-mmr">
 163                                          <div class="tgc">
 164                                              <div id="ta-sidebar1" class="load-build tg-format">
 165                                                  <div class="tg-pad">SB1</div>
 166                                              </div>
 167                                          </div>
 168                                      </div>
 169                                  </div>
 170                                  <div class="tg-sidebar2">
 171                                      <div class="tg-mml">
 172                                          <div class="tgc">
 173                                              <div id="ta-sidebar2" class="load-build tg-format <?php if(!VPRO) echo 'pro-area'; ?>">
 174                                                  <div class="tg-pad">SB2<?php if(!VPRO) echo '<span class="protag"><br />(Pro)</span>'; ?></div>
 175                                              </div>
 176                                          </div>
 177                                      </div>
 178                                  </div>
 179  
 180                              </div>
 181                          </div>
 182                      </div>
 183                  </div>
 184              </div>
 185  
 186          </div>
 187      </div>
 188      <div class="clear"></div>
 189      <?php
 190  
 191          $this->_sub_selector('templates', 'sel-templates-sub', __('For Which Type of Page?', 'pagelines'));
 192  
 193          $this->_sub_selector('main', 'sel-content-sub', __('Which Content Area Type?', 'pagelines'));
 194  
 195      }
 196  
 197  
 198      /**
 199      *
 200      * @TODO document
 201      *
 202      */
 203  	function _sub_selector($type = 'templates', $class, $title = '', $subtitle = ''){
 204          global $pagelines_template;
 205  
 206  
 207          // The Buttons
 208          $buttons = '';
 209          foreach($pagelines_template->map[$type]['templates'] as $template => $t){
 210  
 211              if( (!isset($t['version']) || ($t['version'] == 'pro' && VPRO)) && isset($t['name'])){
 212  
 213                  if( isset($t['page_type']) && $t['page_type'] == 'page')
 214                      $name = sprintf('<span class="sss-tag">Template | </span>%s', $t['name']);
 215                  else
 216                      $name = $t['name'];
 217  
 218                  $buttons .= sprintf('<div id="%s" class="sss-button"><div class="sss-button-pad">%s</div></div>', join( '-', array($type, $template) ), $name);
 219  
 220              }
 221  
 222          }
 223  
 224          // Output
 225          printf('<div class="sub-template-selector fix %s"><div class="sub-templates fix"><h4 class="over">%s</h4>%s</div></div>', $class, $title, $buttons);
 226  
 227      }
 228  
 229  
 230      /**
 231      *
 232      * @TODO document
 233      *
 234      */
 235  	function do_template_builder(){
 236  
 237          global $pagelines_template;
 238          global $unavailable_section_areas;
 239          ?>
 240          <div class="the_template_builder">
 241              <div class="the_template_builder_pad">
 242  <?php
 243              foreach($pagelines_template->map as $hook => $h){
 244  
 245                  if( isset($h['templates']) ){
 246  
 247                      foreach($h['templates'] as $tid => $t )
 248                          $this->section_banks( $tid, $t, $hook, $h );
 249  
 250                  } else
 251                      $this->section_banks( $hook, $h );
 252  
 253              }?>
 254              </div>
 255          </div>
 256      <?php }
 257  
 258      /**
 259       *
 260       *
 261       *  Get Sortable Sections (Sections Drag & Drop)
 262       *
 263       *
 264       *  @package PageLines DMS
 265       *  @subpackage Options
 266       *  @since 4.0
 267       *
 268       */
 269  	function section_banks($template, $tfield, $hook = null, $hook_info = array()){
 270  
 271              $template_slug = ( isset($hook) ) ? join('-', array( $hook, $template )) : $template;
 272              $template_area = ( isset($hook) ) ? $hook : $template;
 273  
 274              $addl = ($template_area == 'templates') ? 'Page Template Area' : ( $template_area == 'main' ? 'Content Area' : 'Global Scope');
 275              $addl = ($addl != '') ? sprintf('<span class="btag grey">%s</span>', $addl) : '';
 276              if( !isset( $tfield['name'] ) )
 277                  $tfield['name'] = '';
 278  ?><div id="template_data" class="<?php echo $template_slug; ?> layout-type-<?php echo $template_area;?>" title="">
 279          <span class="template-slug" id="<?php echo $template_slug; ?>"></span>
 280          <div class="ttitle fix" id="highlightme">
 281              <div class="ttitle-text">
 282                  <span>Editing &rarr;</span> <?php echo $tfield['name'].' '. $addl;?>
 283              </div>
 284              <div class="confirm_save"><div class="confirm_save_pad">&nbsp;</div></div>
 285          </div>
 286          <div id="section_map" class="template-edit-panel ">
 287              <h4 class='over' >2. Arrange Sections In Area With Drag &amp; Drop</h4>
 288              <div class="sbank template_layout">
 289  
 290                  <div class="sbank-area">
 291                      <div class="sbank-pad">
 292                          <div class="bank_title">
 293                              <span class="btitle">Active Sections</span>
 294                          </div>
 295                          <div class="sbank-wrap">
 296                              <div class="sbank-wrap-pad">
 297                              <ul id="sortable_template" class="connectedSortable ">
 298                                   <?php  $this->active_bank( $template, $tfield, $template_area, $template_slug ); ?>
 299                              </ul>
 300                              </div>
 301                          </div>
 302                      </div>
 303                  </div>
 304  
 305  
 306              </div>
 307              <div class="sbank available_sections">
 308                  <div class="sbank-area">
 309                      <div class="sbank-pad fix">
 310                          <div class="bank_title">Available / Disabled Sections</div>
 311                          <?php $this->passive_bank( $template, $tfield, $hook, $hook_info, $template_slug ); ?>
 312                      </div>
 313                  </div>
 314                  <div class="clear"></div>
 315              </div>
 316  
 317          </div>
 318  
 319          <div class="clear"></div>
 320          <?php $this->section_setup_controls(); ?>
 321      </div>
 322  <?php  }
 323  
 324  
 325      /**
 326      *
 327      * @TODO document
 328      *
 329      */
 330  	function active_bank( $tid, $t, $ta, $ts ){
 331  
 332          $this->avail = $this->factory;
 333          if( isset($t['sections']) && is_array($t['sections'])){
 334  
 335              foreach($t['sections'] as $sid){
 336  
 337                  $pieces = explode("ID", $sid);
 338                  $section = (string) $pieces[0];
 339                  $clone_id = (isset($pieces[1])) ? $pieces[1] : 1;
 340  
 341                   if(isset( $this->factory[$section] )){
 342  
 343                      $s = $this->factory[$section];
 344  
 345                      $section_args = array(
 346                          'section'    => $section,
 347                          'sid'        => $sid,
 348                          'template'    => $tid,
 349                          'id'        => 'section_' . $sid,
 350                          'icon'        => $s->settings['icon'],
 351                          'name'        => $s->name,
 352                          'desc'        => $s->settings['description'],
 353                          'req'        => $s->settings['required'],
 354                          'controls'    => true,
 355                          'tslug'        => $ts,
 356                          'tarea'        => $ta,
 357                          'clone'        => $clone_id,
 358                          'cloning'    => $s->settings['cloning']
 359  
 360                      );
 361  
 362                      $this->draw_section( $section_args );
 363  
 364  
 365                      if(isset($this->avail[$section]))
 366                          unset($this->avail[$section]);
 367  
 368                   }
 369              }
 370          }
 371      }
 372  
 373  
 374      /**
 375      *
 376      * @TODO document
 377      *
 378      */
 379  	function passive_bank( $template, $t, $hook, $h, $template_slug ){
 380  
 381          // Remove the sections that aren't compatible
 382          $draw = array();
 383          foreach( $this->avail as $sid => $s){
 384  
 385              /* Flip values and keys */
 386              $works_with = (is_array($s->settings['workswith'])) ? array_flip( $s->settings['workswith'] ) : array();
 387              $fails_with = (is_array($s->settings['failswith'])) ? array_flip( $s->settings['failswith'] ) : array();
 388              $markup_type = (!empty($h)) ? $h['markup'] : $t['markup'];
 389              if(!isset( $works_with[ $template ] )
 390                  && !isset( $works_with[ $hook ])
 391                  && !isset( $works_with[ $hook.'-'.$template ] )
 392                  && !isset($works_with[$markup_type])
 393                  || (
 394                      isset( $fails_with[ $template ] )
 395                      || isset($fails_with[ $hook ] )
 396                      || ( isset( $fails_with['pagelines_special_pages()'] ) && is_pagelines_special ( array( 'type' => $template ) ) )
 397                  )
 398              )
 399                  continue;
 400  
 401              $draw[ $sid ] = $s;
 402          }
 403  
 404          // Draw in Column format
 405  
 406          $col = 1;
 407          $numcol = 2;
 408          $count = 1;
 409          $total = count( $draw );
 410          $coltotal = ( $total % 2 ) ? $total+1 : $total;
 411  
 412          if(!empty($draw)){
 413              foreach($draw as $sid => $s){
 414  
 415                  $start_list = ( $count == 1 || ($coltotal / ($count - 1) ) == $numcol ) ? true : false;
 416                  $end_list = ( $count == $total || ($coltotal / ($count) ) == $numcol ) ? true : false;
 417  
 418                  if($start_list)
 419                      printf('<ul id="sortable_sections" class="connectedSortable sortcolumn colnum%s">', $col);
 420  
 421                  $section_args = array(
 422                      'id'        => 'section_' . $sid,
 423                      'template'    => $template,
 424                      'sid'        => $sid,
 425                      'section'    => $sid,
 426                      'icon'        => $s->settings['icon'],
 427                      'name'        => $s->name,
 428                      'desc'        => $s->settings['description'],
 429                      'tslug'        => $template_slug,
 430                      'tarea'        => $hook,
 431                      'cloning'    => $s->settings['cloning']
 432                  );
 433                  $this->draw_section( $section_args );
 434  
 435                  if($end_list){
 436                      printf('</ul>');
 437                      $col++;
 438                  }
 439                  $count++;
 440              }
 441          } else {
 442              printf('<ul id="sortable_sections" class="connectedSortable nosections sortcolumn"></ul>');
 443          }
 444  
 445      }
 446  
 447  
 448      /**
 449      *
 450      * @TODO document
 451      *
 452      */
 453  	function draw_section( $args ){
 454  
 455          $defaults = array(
 456              'section'        => '',
 457              'sid'            => '',
 458              'template'        => '',
 459              'id'             => '',
 460              'icon'             => '',
 461              'name'             => '',
 462              'desc'             => '',
 463              'controls'        => false,
 464              'tslug'         => '',
 465              'tarea'         => '',
 466              'req'            => false,
 467              'clone'            => '1',
 468              'cloning'        => false
 469          );
 470  
 471          $a = wp_parse_args( $args, $defaults );
 472  
 473          $check_value = (bool) $this->sc_value( $a['tslug'], $a['sid'], 'hide' );
 474  
 475      printf('<li id="%s"><div class="section-bar %s %s">', $a['id'], ($a['req']) ? 'required-section' : '', ($check_value) ? 'hidden-section' : '');
 476          printf('<div class="section-bar-pad fix" style="background: url(%s) no-repeat 10px 9px;">', $a['icon']);
 477  
 478              printf('<div class="section-controls-toggle" onClick="toggleControls(this);" %s><div class="section-controls-toggle-pad">Options</div></div>', (!$a['controls']) ? 'style="display:none;"' : '');
 479              printf('<h4 class="section-bar-title">%s <span class="the_clone_id">%s</span></h4>', $a['name'], ($a['clone'] != 1) ? '#'.$a['clone'] : '' );
 480              printf('<span class="s-description" %s >%s</span>', $this->help_control(), $a['desc']);
 481  
 482          echo '</div></div>';
 483  
 484          $this->inline_section_control($a);
 485  
 486      echo '</li>';
 487  
 488      }
 489  
 490  
 491      /**
 492      *
 493      * @TODO document
 494      *
 495      */
 496  	function inline_section_control($a){
 497  
 498  
 499          // Options
 500          $check_name = $this->sc_name( $a['tslug'], $a['sid'], 'hide' );
 501          $check_value = (bool) $this->sc_value( $a['tslug'], $a['sid'], 'hide' );
 502  
 503  
 504          printf('<div class="section-controls" %s><div class="section-controls-pad">', (!$a['controls']) ? 'style="display:none;"' : '');
 505  
 506              if($a['cloning']){
 507  
 508                  $clone_js = (VPRO) ? sprintf('onClick="cloneSection(\'%s\');"', $a['id']) : '';
 509  
 510                  $clone_text = (VPRO) ?     __( 'Clone', 'pagelines' ) : __( "Clone <span class='sss-tag'>(PRO)</span>", 'pagelines' );
 511  
 512                  $clone_class = (!VPRO) ?  'disabled_clone_button' : '';
 513  
 514                  $clone_btn = sprintf('<div class="clone_button %s" %s><div class="clone_button_pad">%s</div></div>', $clone_class, $clone_js, $clone_text );
 515  
 516                  $remove_clone = sprintf('<div class="clone_button clone_remove" style="%s" onClick="deleteSection(this, \'%s\');"><div class="clone_button_pad">Remove</div></div>', ($a['clone'] == 1) ? 'display: none;' : '', $a['id']);
 517  
 518                  printf('<div class="sc_buttons">%s %s</div>', $clone_btn, $remove_clone);
 519              }
 520  
 521              if($this->show_sc( $a['template'] )){
 522  
 523                  $clone = ($a['clone'] != 1) ? sprintf('<span class="the_clone_id">%s</span>', '#' . $a['clone']) : '';
 524                  printf('<strong>%s %s %s</strong>', $a['name'], $clone, __( 'Settings', 'pagelines' ) );
 525  
 526                  echo '<div class="section-options">';
 527  
 528  
 529                      $checkbox = sprintf('<input class="section_control_check sc_save_check" type="checkbox" id="%1$s" name="%1$s" %2$s/>', $check_name, checked( $check_value, true, false));
 530                      $label = sprintf('<label for="%s" class="%s">%s</label>', $check_name, '', __( 'Hide This By Default', 'pagelines' ) );
 531  
 532                      printf('<div class="section-options-row">%s %s</div>', $checkbox, $label);
 533  
 534  
 535                  echo '</div>';
 536  
 537              } else
 538                   echo __('No settings in this template area.', 'pagelines');
 539  
 540  
 541          echo '<div class="clear"></div></div></div>';
 542  
 543      }
 544  
 545  
 546      /**
 547       * Show section control?
 548       * On some template areas, e.g. posts, single, 404, they have their own interface.. so none is needed
 549       */
 550  	function show_sc( $t ){
 551  
 552          return ( is_pagelines_special( array( 'type' => $t ) ) ) ? false : true;
 553      }
 554  
 555  
 556  
 557      /**
 558      *
 559      * @TODO document
 560      *
 561      */
 562  	function section_setup_controls(){
 563  
 564          $onclick = "PageLinesSlideToggle('.s-description', '.describe_toggle', '.setup_control_text','Hide Section Descriptions', 'Show Section Descriptions', 'pl_section_desc_toggle');";
 565  
 566          printf('<div class="section_setup_controls fix"><span class="setup_control" onClick="%s"><span class="setup_control_text">%s Section Descriptions</span></span></div>', $onclick, ( $this->help() ) ? 'Hide' : 'Show' );
 567  
 568      }
 569  
 570      /**
 571       *
 572       *
 573       *  Show Section Control Option in MetaPanel
 574       *
 575       *
 576       *  @package PageLines DMS
 577       *  @subpackage Options
 578       *  @since 4.0
 579       *
 580       */
 581  	function section_control_interface($oid, $o){
 582  
 583          if(isset($_GET['page']) && $_GET['page'] == 'pagelines_meta')
 584              return;
 585  
 586          if( isset($o['special']) ){
 587              $this->template->adjust_template_type($o['special']);
 588              $is_special = true;
 589          } else
 590              $is_special = false;
 591  
 592          $integration = ( $o['scontrol'] == 'integration' ) ? true : false;
 593  
 594          $template_slug = join( '-', array('templates', $this->template->template_type) );
 595          $main_slug = join( '-', array('main', $this->template->template_type) );
 596  
 597          global $metapanel_options;
 598  
 599          $editing = ($is_special) ? ucfirst($o['special']) : $metapanel_options->edit_slug;
 600          ?>
 601  
 602          <div class="section_control_wrap">
 603              <div class="sc_gap fix">
 604                  <div class="sc_gap_title"><?php echo ui_key( $editing );?> - <?php _e( 'Basic Template', 'pagelines' )?></div>
 605                  <div class="sc_gap_pad">
 606  
 607                      <div class="sc_area sc_header ntb">
 608                          <div class="sc_area_pad fix">
 609                              <div class="scta_head"><?php _e( 'Header', 'pagelines' )?></div>
 610                              <?php $this->sc_inputs('header', $this->template->header, $o); ?>
 611                          </div>
 612                      </div>
 613                      <div class="sc_area sc_templates">
 614                          <div class="sc_area_pad fix">
 615  
 616                              <div class="scta_head"><?php _e( 'Template', 'pagelines' )?></div>
 617                              <?php
 618                              if($integration)
 619                                  printf('<div class="sc_inputs"><div class="emptyarea">%s %s</div></div>', ui_key( $editing ), __( 'Integration', 'pagelines' ) );
 620                              else
 621                                  $this->sc_inputs($template_slug, $this->template->templates, $o );
 622                              ?>
 623                          </div>
 624                      </div>
 625                      <div class="sc_area sc_morefoot">
 626                          <div class="sc_area_pad fix">
 627                              <div class="scta_head"><?php _e( 'Morefoot', 'pagelines' )?></div>
 628                              <?php $this->sc_inputs('morefoot', $this->template->morefoot, $o ); ?>
 629                          </div>
 630                      </div>
 631                      <div class="sc_area sc_footer nbb">
 632                          <div class="sc_area_pad fix">
 633                              <div class="scta_head"><?php _e( 'Footer', 'pagelines' )?></div>
 634                              <?php $this->sc_inputs('footer', $this->template->footer, $o ); ?>
 635                          </div>
 636                      </div>
 637                  </div>
 638              </div>
 639              <?php if(!$integration): ?>
 640                  <div class="sc_gap fix">
 641  
 642                      <div class="sc_gap_title"><?php echo ui_key( $editing );?> - <?php _e( 'Content Area', 'pagelines' )?></div>
 643                      <div class="sc_gap_pad">
 644  
 645                          <div class="sc_area sc_header ntb">
 646                              <div class="sc_area_pad fix">
 647                                  <div class="scta_head"><?php _e( 'Content', 'pagelines' )?></div>
 648                                  <?php $this->sc_inputs($main_slug, $this->template->main, $o ); ?>
 649                              </div>
 650                          </div>
 651                          <div class="sc_area sc_header">
 652                              <div class="sc_area_pad fix">
 653                                  <div class="scta_head"><?php _e( 'Wrap', 'pagelines' )?></div>
 654                                  <?php $this->sc_inputs('sidebar_wrap', $this->template->sidebar_wrap, $o ); ?>
 655                              </div>
 656                          </div>
 657                          <div class="sc_area sc_header">
 658                              <div class="sc_area_pad fix">
 659                                  <div class="scta_head"><?php _e( 'Sidebar 1', 'pagelines' )?></div>
 660                                  <?php $this->sc_inputs('sidebar1', $this->template->sidebar1, $o ); ?>
 661                              </div>
 662                          </div>
 663                          <div class="sc_area sc_header nbb">
 664                              <div class="sc_area_pad fix">
 665                                  <div class="scta_head"><?php _e( 'Sidebar 2', 'pagelines' )?></div>
 666                                  <?php $this->sc_inputs('sidebar2', $this->template->sidebar2, $o ); ?>
 667                              </div>
 668                          </div>
 669                      </div>
 670  
 671                  </div>
 672              <?php endif; ?>
 673          </div>
 674  
 675      <?php }
 676  
 677  
 678  
 679      /**
 680      *
 681      * @TODO document
 682      *
 683      */
 684  	function sc_inputs( $template_slug, $sections, $o){
 685          global $post;
 686  
 687          $is_special = (isset($o['special'])) ? true : false;
 688  
 689          // No sections in area
 690          if(empty($sections)){
 691              echo sprintf( '<div class="sc_inputs"><div class="emptyarea">%s</div></div>', __( 'Area is empty.', 'pagelines') );
 692              return;
 693          }
 694  
 695          echo '<div class="sc_inputs">';
 696          foreach($sections as $key => $sid){
 697  
 698  
 699              $pieces = explode('ID', $sid);
 700              $section = (string) $pieces[0];
 701              $clone_id = (isset($pieces[1])) ? $pieces[1] : 1;
 702  
 703              // Get section information
 704              if( isset($this->factory[ $section ]) ){
 705  
 706                  $section_data = $this->factory[ $section ];
 707  
 708                  $hidden_by_default = isset($this->sc_global[$template_slug][$sid]['hide']) ? $this->sc_global[$template_slug][$sid]['hide'] : null;
 709  
 710                  $check_type = ( $hidden_by_default ) ? 'show' : 'hide';
 711  
 712                  // Make the field 'key'
 713                  $option_name = ($is_special) ? $this->sc_name( $template_slug, $sid, $o['special'], $check_type ) : meta_option_name( array($check_type, $template_slug, $sid) );
 714                  $check_value = ($is_special) ? $this->sc_value( $template_slug, $sid, $o['special'], $check_type ) : get_pagelines_meta($option_name, $post->ID);
 715  
 716                  // The name of the section
 717                  $clone = ($clone_id != 1) ? ' #'.$clone_id : '';
 718                  $check_label = ucfirst($check_type).' ' . $section_data->name.$clone;
 719  
 720                  ?>
 721                  <div class="sc_wrap <?php echo 'type_'.$check_type;?>" >
 722                      <label class="sc_button" for="<?php echo $option_name;?>">
 723                          <span class="sc_button_pad fix" >
 724                              <?php
 725  
 726                                  printf('<span class="sc_check_wrap"><input class="sc_check" type="checkbox" id="%1$s" name="%1$s" %2$s /></span>', $option_name, checked((bool) $check_value, true, false) );
 727                                  printf('<span class="sc_label"><span class="sc_label_pad" style="background: url(%s) no-repeat 8px 5px;">%s</span></span>', $section_data->icon, $check_label);
 728  
 729                              ?>
 730                          </span>
 731                      </label>
 732                  </div><?php
 733              }
 734          }
 735          echo '</div>';
 736  
 737      }
 738  
 739  
 740  
 741      /**
 742      *
 743      * @TODO document
 744      *
 745      */
 746  	function help_control(){
 747          if(!$this->help())
 748              return 'style="display:none"';
 749      }
 750  
 751  
 752      /**
 753      *
 754      * @TODO document
 755      *
 756      */
 757  	function help(){
 758          if(  get_option('pl_section_desc_toggle') == 'hide' || get_option('pl_section_desc_toggle') == false || !get_option('pl_section_desc_toggle') )
 759              return false;
 760          else
 761              return true;
 762      }
 763  
 764  }
 765  
 766  
 767  
 768  /**
 769   * Get Template Setup - Drag & Drop Interface
 770   *
 771   * @since 2.0.0
 772   */
 773  function templates_array(){
 774  
 775      $return = array();
 776  
 777      $return['template_setup'] = array(
 778          'icon'            => PL_ADMIN_ICONS.'/dragdrop.png',
 779          'templates'        => array(
 780              'default'    => '',
 781              'type'        => 'templates',
 782              'layout'    => 'interface',
 783              'title'        => __( 'Drag &amp; Drop Template Setup', 'pagelines'),
 784              'shortexp'    => __( "Use draggable sections to control the design of your site's templates.", 'pagelines'),
 785          )
 786      );
 787  
 788      return apply_filters('pagelines_templates_opt_array', $return);
 789  }


Generated: Fri Aug 30 18:26:24 2013 Cross-referenced by PHPXref 0.7.1