generate() public method

Generate the table
public generate ( mixed $table_data = NULL ) : string
$table_data mixed
return string
示例#1
0
 /**
  * Setup columns
  *
  * @access	public
  * @param	string	data callback function
  */
 public function generate($table_data = NULL)
 {
     if (!$this->jq_template) {
         return parent::generate($table_data);
     }
     $this->_compile_template();
     $open_bak = $this->template['table_open'];
     // prep the jquery template
     $temp = $this->template['row_start'];
     foreach ($this->column_config as $column => $config) {
         $html = FALSE;
         if (is_array($config)) {
             $html = isset($config['html']) ? (bool) $config['html'] : FALSE;
         }
         // handle data of array('data' => 'content', 'attr' => 'value')
         $temp .= '{{if $.isPlainObject(' . $column . ')}}';
         $temp .= substr($this->template['cell_start'], 0, -1);
         $temp .= '{{each ' . $column . '}}';
         $temp .= '{{if $index != "data"}} ${$index}="${$value}" {{/if}}';
         $temp .= '{{/each}}';
         $temp .= '>';
         $temp .= $html ? '{{html ' . $column . '.data}}' : '${' . $column . '.data}';
         $temp .= '{{else}}';
         $temp .= $this->template['cell_start'];
         $temp .= $html ? '{{html ' . $column . '}}' : '${' . $column . '}';
         $temp .= '{{/if}}';
         $temp .= $this->template['cell_end'] . "\n";
     }
     $temp .= $this->template['row_end'];
     $template = $temp;
     // add data to our headings for the sort mechanism
     $column_k = array_keys($this->column_config);
     foreach ($this->heading as $k => &$heading) {
         if (!is_array($heading)) {
             $heading = array('data' => $heading);
         }
         if (!$this->column_config[$column_k[$k]]['sort']) {
             $heading['class'] = 'no-sort';
         }
         $heading['data-table_column'] = $column_k[$k];
     }
     if (!$this->base_url) {
         $this->base_url = $this->EE->cp->get_safe_refresh();
     }
     $jq_config = array('base_url' => $this->base_url, 'columns' => $this->column_config, 'template' => $template, 'empty_cells' => $this->empty_cells, 'no_results' => $this->no_results, 'pagination' => $this->pagination_tmpl, 'uniqid' => $this->uniqid, 'sort' => $this->sort, 'rows' => $this->raw_data);
     $table_config_data = 'data-table_config="' . form_prep($this->EE->javascript->generate_json($jq_config, TRUE)) . '"';
     $this->template['table_open'] = str_replace('<table', '<table ' . $table_config_data, $open_bak);
     $table = parent::generate();
     $this->template['table_open'] = $open_bak;
     return $table;
 }
示例#2
0
    /**
     * Display Global Settings
     */
    function display_global_settings()
    {
        $this->_update_global_settings();
        // load the language file
        $this->EE->lang->loadfile('playa');
        // load the table lib
        $this->EE->load->library('table');
        // load the CSS
        $this->_include_theme_css('styles/global_settings.css');
        // use the default template known as
        // $cp_pad_table_template in the views
        $this->EE->table->set_template(array('table_open' => '<table class="mainTable padTable" border="0" cellspacing="0" cellpadding="0">', 'row_start' => '<tr class="even">', 'row_alt_start' => '<tr class="odd">'));
        // "Preference" and "Setting" table headings
        $this->EE->table->set_heading(array('data' => lang('preference'), 'style' => 'width: 50%'), lang('setting'));
        // -------------------------------------------
        //  License Key
        // -------------------------------------------
        $this->EE->table->add_row(lang('license_key', 'license_key'), form_input('license_key', $this->settings['license_key'], 'id="license_key" size="40"'));
        // -------------------------------------------
        //  Filter Min
        // -------------------------------------------
        $this->EE->table->add_row(lang('filter_min', 'filter_min') . '<br/>' . lang('filter_min_desc'), form_input('filter_min', $this->settings['filter_min'], 'id="filter_min" size="3" style="width: 3em;"'));
        // -------------------------------------------
        //  Relationship field conversion
        // -------------------------------------------
        // Accomodate the schema changes
        if (version_compare(APP_VER, '2.6', '<')) {
            $field_types = array('"rel"', '"mrel"');
        } else {
            $field_types = array('"relationship"');
        }
        $field_types = implode(",", $field_types);
        $query = $this->EE->db->query('SELECT cf.field_id, cf.field_label, fg.group_name
		                               FROM exp_channel_fields AS cf
		                               INNER JOIN exp_field_groups AS fg ON cf.group_id = fg.group_id
		                               WHERE cf.field_type IN (' . $field_types . ')');
        if ($query->num_rows()) {
            // load the Admin Content lang file
            $this->EE->lang->loadfile('admin_content');
            // initialize a new Table object
            $table = new CI_Table();
            // set the template
            $table->set_template(array('table_open' => '<table class="playaConvertRel" border="0" cellspacing="0" cellpadding="0"'));
            // "Field Group", "Field Name", and "Convert?" table headings
            $table->set_heading(lang('field_group'), lang('field_name'), lang('convert'));
            // add each of the Rel fields
            foreach ($query->result() as $field) {
                $table->add_row($field->group_name, $field->field_label, form_radio('convert_rel_field[' . $field->field_id . ']', 'y', FALSE, 'id="convert_rel_field_' . $field->field_id . '_y"') . NL . lang('yes', 'convert_rel_field_' . $field->field_id . '_y') . NBS . NBS . NBS . NBS . NBS . NL . form_radio('convert_rel_field[' . $field->field_id . ']', 'n', TRUE, 'id="convert_rel_field_' . $field->field_id . '_n"') . NL . lang('no', 'convert_rel_field_' . $field->field_id . '_n'));
            }
            // add the row to the main table
            $this->EE->table->add_row(lang('convert_rel_fields', 'convert_rel_fields') . '<br/>' . lang('convert_rel_fields_info'), $table->generate());
        }
        // -------------------------------------------
        //  Related Entries conversion
        // -------------------------------------------
        if ($this->EE->db->table_exists('related_entries')) {
            // Convert Related Entries?
            $this->EE->table->add_row(lang('convert_related_entries', 'convert_related_entries_y') . '<br/>' . lang('convert_related_entries_info'), form_radio('convert_related_entries', 'y', FALSE, 'id="convert_related_entries_y"') . NL . lang('yes', 'convert_related_entries_y') . NBS . NBS . NBS . NBS . NBS . NL . form_radio('convert_related_entries', 'n', TRUE, 'id="convert_related_entries_n"') . NL . lang('no', 'convert_related_entries_n'));
        }
        return $this->EE->table->generate();
    }
示例#3
0
<?php

$html = '';
$html .= heading(_('Restore'), 3) . '<hr class="backup-hr"/>';
$html .= form_open($_SERVER['REQUEST_URI'], array('id' => 'restore_browes_frm'));
$html .= form_hidden('restore_source', 'file');
$html .= form_hidden('restore_path', '');
$html .= form_hidden('action', 'backup_list');
$table = new CI_Table();
$html .= _('Select a file and click go');
$html .= br(2);
$data = '';
$data .= '<div id="list_data">';
$data .= _('Name') . ': <span id="picker_name"></span>' . br();
$data .= _('Created') . ': <span id="picker_ctime"></span>' . br();
$data .= _('Files') . ': <span id="picker_nfiles"></span>' . br();
$data .= _('Mysql DB\'s') . ': <span id="picker_nmdb"></span>' . br();
$data .= _('AstDB\'s') . ': <span id="picker_nadb"></span>' . br();
$data .= '</div>';
$table->add_row(array('data' => '', 'id' => 'list_tree'), $data);
$html .= $table->generate();
$html .= br(2);
$html .= form_submit('submit', _('Go!'));
$html .= form_submit('submit', _('Download'));
$html .= form_close();
$html .= br(15);
$html .= '<script type="text/javascript" src="modules/backup/assets/js/views/restore.js"></script>';
$html .= '<script type="text/javascript" src="modules/backup/assets/js/views/jquery.jstree.min.js"></script>';
echo $html;
示例#4
0
    foreach ($ranks as $r) {
        if ($r->rank == 0) {
            $table->add_row('<span class="nb">' . $i . '</span>', $r->history_link, '<span class="rank">' . "Not in top 100" . '</span>', $search_engines[$r->search_engine][0], '<span class="date">' . strftime("%Y-%m-%d à  %H:%M:%S", $r->date) . '</span>', $r->delete_link);
        } else {
            $table->add_row('<span class="nb">' . $i . '</span>', $r->history_link, '<span class="rank">' . $r->rank . '</span>', $search_engines[$r->search_engine][0], '<span class="date">' . strftime("%Y-%m-%d à  %H:%M:%S", $r->date) . '</span>', $r->delete_link);
        }
        /*
        		if($r->rank == 0) {
        			$table = myAddRow($table, $i, '<a href="'.$r->details_url.'">'.$r->keywords.'</a>', "Not in top 100", strftime("%d/%m/%Y %H:%M:%S",$r->date), '<a href="'.BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=seo'.AMP.'method=rank_tracker_ajax'.AMP.'rank_id='.$r->id.'" class="refresh-rank">Refresh Now</a>');
        		} else {
        			$table = myAddRow($table, $i, '<a href="'.$r->details_url.'">'.$r->keywords.'</a>', $r->rank, strftime("%d/%m/%Y %H:%M:%S",$r->date), '<a href="'.BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=seo'.AMP.'method=rank_tracker_ajax'.AMP.'rank_id='.$r->id.'" class="refresh-rank">Refresh Now</a>');
        		}
        */
        $i++;
    }
    echo $table->generate();
    ?>
	</div>
	<?php 
}
function myAddRow($table, $c1, $c2, $c3, $c4, $c5)
{
    $id = $c1;
    $c1 = '<span class="rank-id" rel="' . $id . '">' . $c1 . '</span>';
    $c2 = '<span class="rank-keywords" rel="' . $id . '">' . $c2 . '</span>';
    $c3 = '<span class="rank-rank" rel="' . $id . '">' . $c3 . '</span>';
    $c4 = '<span class="rank-date" rel="' . $id . '">' . $c4 . '</span>';
    $c5 = '<span class="rank-refresh" rel="' . $id . '">' . $c5 . '</span>';
    $table->add_row($c1, $c2, $c3, $c4, $c5);
    return $table;
}
示例#5
0
$html .= '<script type="text/javascript" src="modules/restapi/assets/js/views/logs.js"></script>';
$html .= '<link href="http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />';
$html .= '<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js" type="text/javascript"></script>';
$html .= '<script src="http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js" type="text/javascript"></script>';
if (!$logs) {
    $html .= _('No Data Found!');
    echo $html;
    exit;
}
$table = new CI_Table();
//set some classes for more controll in this table
$table->set_template(array('table_open' => '<table id="log_table_parent">', 'row_start' => '<tr class="hover">'));
$table->set_heading('', _('ID'), _('Time') . '<span class="localtime" data-done-text="' . _('Localized') . '"> (' . _('Localizing...') . ')</span>', _('Token'), _('Signature'), _('IP'), _('Server'));
//iterate over log entires
foreach ($logs as $l) {
    $log = isset($log) ? false : true;
    $table->add_row('<span class="show_event" data-id="' . $l['id'] . '">+</span>', $l['id'], '<span class="log_raw_time" data-date="' . $l['time'] . '">' . date('Y-m-d H:i:s', $l['time']) . '</span>', '<span class="hashtr">' . $l['token'] . '</span>', '<span class="hashtr">' . $l['signature'] . '</span>', $l['ip'], '<span class="hashtr">' . $l['server'] . '</span>');
    //iterate over events, if we have any
    if (isset($l['events']) && $l['events']) {
        $eTable = new CI_Table();
        $eTable->set_template(array('table_open' => '<table id="log_table_events">'));
        foreach ($l['events'] as $e) {
            $eTable->set_heading(_('Time'), _('Event'), _('Data') . '<span class="datahelp"> (' . _('click on data to expand') . ')</span>');
            $eTable->add_row('<span class="log_raw_time" data-date="' . $e['time'] . '">' . date('Y-m-d H:i:s', $e['time']) . '</span>', '<span class="log_event" title="' . $e['trigger'] . '">' . $e['event'] . '</span>', '<div class="event_data" data-state="closed"><pre>' . print_r($e['data'], true) . '</pre></div>');
        }
        $table->add_row(array('data' => $eTable->generate(), 'colspan' => 10, 'class' => 'log_events event' . $e['e_id']));
    }
}
$html .= $table->generate();
$html .= '<script type="text/javascript">' . 'SyntaxHighlighter.autoloader("php http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js");' . 'SyntaxHighlighter.defaults["toolbar"] = false;' . 'SyntaxHighlighter.defaults["gutter"] = false;' . 'SyntaxHighlighter.all();</script>';
echo $html;
示例#6
0
    if ($count == count($entries)) {
        $row[] = drawselects($e['dest'], 'DESTID', $restrict_mods, false) . form_hidden('entries[goto][]', '');
    } else {
        $row[] = drawselects($e['dest'], $count, $restrict_mods, false) . form_hidden('entries[goto][]', '');
    }
    //return to ivr
    $row[] = '
		<span class="radioset">
		<input type="radio" name="entries[ivr_ret][DESTID' . $count . ']" id="entries' . $count . 'DESTIDyes" value="1" ' . ($e['ivr_ret'] ? "CHECKED" : "") . '>
		<label for="entries' . $count . 'DESTIDyes">' . _("Yes") . '</label>
		<input type="radio" name="entries[ivr_ret][DESTID' . $count . ']" id="entries' . $count . 'DESTIDno" value="" ' . ($e['ivr_ret'] ? "" : "CHECKED") . '>
		<label for="entries' . $count . 'DESTIDno">' . _("No") . '</label>
		</span>
	';
    //delete buttom
    $row[] = '<a href="#" alt="' . _('Delete this entry. Dont forget to click Submit to save changes!') . '" class="delete_entrie"><i class="fa fa-trash"></i></a>';
    //add module hooks
    if (isset($e['hooks']) && $e['hooks']) {
        foreach ($e['hooks'] as $module => $hooks) {
            foreach ($hooks as $h) {
                $row[] = $h;
            }
        }
    }
    $table->add_row(array_values($row));
    unset($row);
}
$ret = '';
$ret .= $table->generate();
$ret .= '<a class="IVREntries" href="#" id="add_entrie"><i class="fa fa-plus"></i>' . _('Add Another Entry') . '</a>';
echo $ret;