Ejemplo n.º 1
0
    function page_content()
    {
        $options = $this->args['option_template'];
        $nav = array();
        $sections = '';
        $i = 0;
        foreach ($options as $option) {
            switch ($option['type']) {
                case 'heading':
                    $option['click_hook'] = 'nav_' . ricUtil::slugify($option['title']);
                    if ($i > 0) {
                        $sections .= "</div>\n";
                    }
                    $sections .= "<div class='group' id='{$option['click_hook']}'><h2>{$option['title']}</h2>\n";
                    $nav[] = $option;
                    break;
                default:
                    $option['slug'] = RIC . $option['slug'];
                    $value = get_option($option['slug']);
                    if (!$value) {
                        $value = $option['default'];
                    }
                    $option['value'] = $value;
                    $sections .= $this->ui->machine($option, false);
                    break;
            }
            $i++;
        }
        $sections .= "</div>\n";
        ?>
	<form action="" enctype="multipart/form-data" id="ric-form">
		<div id="ric-main">
			<div id="ric-nav">
				<ul>
				<?php 
        foreach ($nav as $item) {
            echo html('li', html('a', array('title' => $item['title'], 'href' => "#{$item['click_hook']}"), $item['title']));
        }
        ?>
				</ul>
			</div>
			<div id="ric-content">
				<?php 
        echo $sections;
        ?>
			</div>
			<br class="clear" />
		</div>
		<div id="ric-save-bar">
			<?php 
        html_img('admin/images/icons/ajax/small-grey.gif', array('style' => 'display:none;', 'class' => 'ajax-loading-img ajax-loading-img-bottom', 'alt' => 'Working...'));
        ?>
			<input type="submit" value="Save All Changes" class="button submit-button" />
		</div>
	</form>

	<br class="clear" />
	<?php 
    }
Ejemplo n.º 2
0
 static function table($args = array())
 {
     $defaults = array('columns' => array('Column 1', 'Column 2'), 'data' => array(), 'table_class' => 'widefat page fixed', 'table_id' => false, 'echo' => true, 'footer' => true);
     // Parse the arguments and extract them for easy variable naming
     extract(wp_parse_args($args, $defaults));
     $r = '';
     // Table header and footer
     $head_columns = '';
     foreach ($columns as $column) {
         $slug = ricUtil::slugify($column);
         $head_columns .= '<th scope="col" id="' . $slug . '" class="manage-column" style="">' . $column . '</th>';
     }
     $r .= '<thead><tr>' . $head_columns . '</tr></thead>';
     if ($footer) {
         $r .= '<tfoot><tr>' . $head_columns . '</tr></tfoot>';
     }
     // Table data
     $i = 0;
     foreach ($data as $id => $columns) {
         $class = $i % 2 ? 'alternate iedit' : 'iedit';
         $r .= '<tr id="row-' . $id . '" class="' . $class . '">';
         foreach ($columns as $k => $v) {
             $r .= '<td class="column-' . $k . '">' . $v . '</td>';
         }
         $i++;
     }
     // Table class and ID
     $table_atts = array('class' => $table_class ? $table_class : '', 'id' => $table_id ? $table_id : '', 'cellspacing' => '0');
     $r = html('table', $table_atts, $r);
     if ($echo) {
         echo $r;
     }
     return $r;
 }