[ Index ]

PHP Cross Reference of PageLines Framework

title

Body

[close]

/admin/ -> class.options.panel.php (source)

   1  <?php
   2  /**
   3   *
   4   *  PageLines Panel UI
   5   *
   6   *  @package PageLines DMS
   7   *  @since 2.0
   8   *
   9   */
  10  class PLPanel {
  11  
  12  
  13      /**
  14      *
  15      * @TODO document
  16      *
  17      */
  18  	function __construct( $settings = array() ) { }
  19  
  20  
  21      /**
  22      *
  23      * @TODO document
  24      *
  25      */
  26  	function the_panel( $s = array() ){
  27          global $post_ID;
  28          global $pagelines_template;
  29  
  30          $defaults = array(
  31                  'handle'    => 'plpanel',
  32                  'title'     => '',
  33                  'tag'         => false,
  34                  'type'        => null,
  35                  'stext'     => __('Save', 'pagelines'),
  36                  'tabs'         => array(),
  37                  'hidetabs'    => false,
  38                  'post_ID'    => null,
  39                  'post_type'    => null,
  40                  'user'        => null
  41              );
  42  
  43          $this->s = wp_parse_args($s, $defaults); // settings for post type
  44  
  45          $hide_tabs = ( count($this->s['tabs']) == 1 ) ? true : $this->s['hidetabs'];
  46  
  47  
  48          if(!$hide_tabs)
  49              $this->tabs_setup( $this->s['handle'] );
  50  
  51  
  52          ?>
  53          <div id="plpanel" class="pl_mp">
  54              <?php $this->head( $this->s['title'], $this->s['tag'], $this->s['stext'] ); ?>
  55              <div id="<?php echo $this->s['handle'];?>" class="pagelines_metapanel fix">
  56                  <div class="pagelines_metapanel_pad fix">
  57                      <?php
  58  
  59                          if(!$hide_tabs)
  60                              $this->tabn( $this->s['tabs'] );
  61  
  62                          $this->load_tabs($this->s['type'], $this->s['tabs'], $hide_tabs, $this->s['post_ID'], $this->s['user']);
  63  
  64                      ?>
  65                  </div>
  66              </div>
  67              <?php $this->panel_foot( $this->s['stext'], $this->s['post_type']); ?>
  68          </div>
  69  
  70  <?php
  71  
  72      }
  73  
  74  
  75  
  76      /**
  77      *
  78      * @TODO document
  79      *
  80      */
  81  	function tabs_setup( $handle = 'plpanel' ){
  82  
  83          if(!$this->s['hidetabs']):
  84          ?>
  85  
  86          <script type="text/javascript">
  87              jQuery(document).ready(function() {
  88                  <?php printf('var %1$s = jQuery("#%1$s").tabs({cookie: { name: "%1$s-tabs" }, fx: { opacity: "toggle", duration: 150 }});', $handle); ?>
  89              });
  90          </script>
  91  
  92      <?php endif;
  93  
  94      }
  95  
  96  
  97      /**
  98      *
  99      * @TODO document
 100      *
 101      */
 102  	function head( $title, $tag, $stext ){
 103  
 104          global $post_ID;
 105          $pl_link_url = ($this->s['type'] == 'meta' && $post_ID) ? esc_url( get_permalink($post_ID) ) : home_url();
 106          $pl_link_title = ($this->s['type'] == 'meta' && $post_ID) ? __('View Page &rarr;', 'pagelines') : __('View Site &rarr;', 'pagelines');
 107          ?>
 108  
 109          <div class="ohead  mp_bar mp_head">
 110              <div class="mp_bar_pad fix ">
 111                  <div id="the_pl_button" class="sl-pagelines sl-black superlink-wrap">
 112                      <a class="superlink" href="<?php echo $pl_link_url; ?>/" target="_blank" title="<?php echo $pl_link_title;?>">
 113                          <span class="superlink-pagelines">&nbsp;<span class="slpl">View Site</span></span>
 114                      </a>
 115                  </div>
 116                  <div class="mp_title">
 117                      <span class="mp_title_text"><?php echo $title; ?></span>
 118                       <?php if($tag):?><span class='btag'><?php echo $tag;?></span><?php endif; ?>
 119                  </div>
 120  
 121                  <div class="superlink-wrap osave-wrap">
 122                      <input id="update" class="superlink osave" type="submit" value="<?php echo $stext; ?>"  name="update" />
 123                  </div>
 124              </div>
 125          </div>
 126  
 127      <?php
 128  
 129      }
 130  
 131  
 132      /**
 133      *
 134      * @TODO document
 135      *
 136      */
 137  	function tabn( $tabs ){ ?>
 138  
 139          <ul id="tabsnav" class="mp_tabs">
 140  
 141              <?php foreach( $tabs as $tab => $t):?>
 142                  <li>
 143                      <a class="<?php echo $tab;?>  metapanel-tabn <?php if(!$t->active) echo 'inactive-tab';?>" href="#<?php echo $tab;?>">
 144                          <span class="metatab_icon" style="background: url(<?php echo $t->icon; ?>) no-repeat 0 0;display: block;">
 145                              <?php
 146                                  echo $t->name;
 147  
 148                                  if(!$t->active)
 149                                      printf('<span class="tab_inactive">inactive</span>');
 150  
 151                               ?>
 152                          </span>
 153                      </a>
 154                  </li>
 155              <?php endforeach;?>
 156          </ul>
 157  
 158      <?php }
 159  
 160  
 161      /**
 162      *
 163      * @TODO document
 164      *
 165      */
 166  	function load_tabs( $type, $tabs, $hide_tabs = false, $post_ID = null, $user = null){ ?>
 167          <div class="mp_panel fix <?php if( $hide_tabs ) echo 'hide_tabs';?>">
 168              <div class="mp_panel_pad fix">
 169                  <div class="pagelines_metapanel_options">
 170                      <div class="pagelines_metapanel_options_pad">
 171                          <?php foreach( $tabs as $tab => $t ):?>
 172                              <div id="<?php echo $tab;?>" class="pagelines_metatab">
 173                                  <div class="metatab_title" style="background: url(<?php echo $t->icon; ?>) no-repeat 10px 13px;" >
 174                                      <?php
 175  
 176                                          echo $t->name;
 177  
 178                                          if(isset($post_ID) && !$t->active)
 179                                              echo OptEngine::superlink(__( 'Inactive On Template', 'pagelines' ), 'black', 'right', admin_url('admin.php?page=pagelines_templates'));
 180  
 181                                           ?>
 182                                  </div>
 183                                  <?php  $this->load_engine( $type, $t->options, $post_ID, $user); ?>
 184                              </div>
 185                          <?php endforeach;?>
 186                      </div>
 187                  </div>
 188              </div>
 189          </div>
 190      <?php }
 191  
 192  
 193      /**
 194      *
 195      * @TODO document
 196      *
 197      */
 198  	function load_engine( $type, $opts, $post_ID = null, $user = null ){
 199  
 200          $option_engine = new OptEngine( $type );
 201  
 202          $flag = ($type == 'meta') ? $post_ID : $user;
 203  
 204          foreach($opts as $oid => $o)
 205              $option_engine->option_engine($oid, $o, $flag);
 206  
 207      }
 208  
 209  
 210      /**
 211      *
 212      * @TODO document
 213      *
 214      */
 215  	function panel_foot( $save_text, $post_type){
 216          ?>
 217  
 218          <div class="ohead mp_bar mp_footer ">
 219              <div class="mp_bar_pad fix ">
 220                  <input type="hidden" name="_posttype" value="<?php echo $post_type; ?>" />
 221                  <div class="superlink-wrap osave-wrap">
 222                      <input id="update" class="superlink osave" type="submit" value="<?php echo $save_text; ?>"  name="update" />
 223                  </div>
 224              </div>
 225          </div>
 226  
 227          <?php
 228      }
 229  }


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