Lets you create tables manually or from database result objects, or arrays.
Author: ExpressionEngine Dev Team
Exemple #1
0
 /**
  * Class constructor
  *
  * @return	void
  */
 public function __construct($params = "")
 {
     parent::__construct();
     if (!empty($params['header'])) {
         $this->set_heading($params['header']);
     }
     if (!empty($params['class'])) {
         if (!empty($params['id'])) {
             $this->set_table_style($params['class'], $params['id']);
         } else {
             $this->set_table_style($params['class']);
         }
     }
     if (!empty($params['cell_start'])) {
         $this->set_table_cell($params['cell_start']);
     }
     $this->set_template($this->my_template);
 }
Exemple #2
0
 function clear()
 {
     parent::clear();
     $this->row_ids = array();
 }
 /**
  * Setup async table refreshing
  *
  * @access	public
  * @param	string	data callback function
  */
 public function clear()
 {
     $this->uniqid = '';
     $this->base_url = '';
     $this->no_result = '';
     $this->pagination_tmpl = '';
     $this->sort = array();
     $this->column_config = array();
     $this->jq_template = FALSE;
     parent::clear();
 }
Exemple #4
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();
    }
Exemple #5
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;
Exemple #6
0
<?php

$html = '';
$html .= heading(_('Tokens'), 2);
$html .= '<div id="line"><div class="spacer"></div><div class="spacer"></div></div>';
if (!$tokens) {
    $html .= _('No tokens associated with this user');
} else {
    $html .= form_open($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']);
    $html .= form_hidden('f', 'action');
    $html .= form_hidden('m', 'restapi');
    $html .= form_hidden('action', 'save');
    $table = new CI_Table();
    foreach ($tokens as $token) {
        $t = restapi_tokens_get($token);
        $name = $t['name'] ? $t['name'] : _('Token') . ' ' . $token;
        $label = fpbx_label($name, $t['desc']);
        $status_opts = array('enabled' => _('Enabled'), 'disabled' => _('Disabled'));
        $status = form_dropdown('token_status[' . $token . ']', $status_opts, $t['token_status']);
        $table->add_row(array('data' => heading($label, 5) . '<hr>', 'colspan' => 2));
        $table->add_row(_('Token'), $t['token']);
        $table->add_row(_('Token Key'), $t['tokenkey']);
        $table->add_row(_('Status'), $status);
    }
    $table->add_row(form_submit('save', _('Save')));
    $html .= $table->generate();
    $html .= form_close() . br();
}
echo $html;
Exemple #7
0
<?php

$html = '';
$html .= heading(_('Welcome to ') . $amp_conf['BRAND_TITLE'] . '!', 3) . '<hr/>';
//$html .= '<div id="login_form">';
$html .= form_open($_SERVER['REQUEST_URI'], 'id="loginform"');
$html .= heading(_('Initial setup'), 5) . '<hr/>';
$html .= _('Please provide the core credentials that will be used to ' . 'administer your system');
$html .= br(2);
$table = new CI_Table();
if ($errors) {
    $html .= '<span class="obe_error">';
    $html .= _('Please correct the following errors:');
    $html .= ul($errors);
    $html .= '</span>';
}
//username
$label = fpbx_label(_('Username'), _('Admin user name'));
$data = array('name' => 'username', 'value' => $username, 'required' => '', 'placeholder' => _('username'));
$table->add_row($label, form_input($data));
//password
$label = fpbx_label(_('Password'), _('Admin password'));
$data = array('name' => 'password', 'type' => 'password', 'value' => $password, 'required' => '', 'placeholder' => _('password'));
$table->add_row($label, form_input($data));
//confirm password
$label = fpbx_label(_('Confirm Password'));
$data = array('name' => 'confirm_password', 'value' => $confirm_password, 'type' => 'password', 'required' => '', 'placeholder' => _('password'));
$table->add_row($label, form_input($data));
//email address
$label = fpbx_label(_('Admin Email address'));
$data = array('name' => 'email_address', 'value' => $email_address, 'type' => 'email', 'placeholder' => _('email address'));
Exemple #8
0
<?php

$html = '';
$html .= heading(_('REST API Token'), 3);
$html .= '<hr style="width:50%;margin-left:0"/>';
$html .= form_open($_SERVER['REQUEST_URI']);
$html .= form_hidden('action', 'save');
$html .= form_hidden('id', $id);
$html .= form_hidden('token', $token);
$html .= form_hidden('tokenkey', $tokenkey);
$table = new CI_Table();
//$table->add_row(array('data' => heading(_('General Options'), 5) . '<hr>', 'colspan' => 2));
//name
$label = fpbx_label(_('Name'));
$table->add_row($label, form_input('name', $name));
$label = fpbx_label(_('Description'));
$table->add_row($label, form_input('desc', $desc));
//user
$table->add_row(array('data' => heading(_('User'), 5) . '<hr>', 'colspan' => 2));
$label = fpbx_label(_('Associated User'), _('User this key should be associated with. Will show key on ' . 'user page and will be visable to the user in the user portal. ' . 'Key will be deleted if/when user is'));
$table->add_row($label, form_dropdown('assoc_user', $user_list_none, $assoc_user));
//auth
$table->add_row(array('data' => heading(_('Authentication'), 5) . '<hr>', 'colspan' => 2));
//token
$label = fpbx_label(_('Token'));
$table->add_row($label, $token);
//secret
$label = fpbx_label(_('Token Key'));
$table->add_row($label, $tokenkey);
//status
$label = fpbx_label(_('Status'));
Exemple #9
0
 function clear()
 {
     parent::clear();
     $this->__construct();
 }
Exemple #10
0

<?php 
if ($ranks) {
    ?>
	
	<h1><?php 
    echo $this->lang->line('seo_rank_tracker_followed_ranks');
    ?>
 <a  id="refresh-ranks" href="#"><?php 
    echo $this->lang->line('seo_rank_tracker_refresh_now');
    ?>
</a></h1>
	<div id="ranks">
	<?php 
    $table = new CI_Table();
    $table->set_template($cp_table_template);
    $table->set_heading("#", $this->lang->line('seo_rank_tracker_keywords'), $this->lang->line('seo_rank_tracker_rank'), $this->lang->line('seo_rank_tracker_search_engine'), $this->lang->line('seo_rank_tracker_date'), $this->lang->line('seo_rank_tracker_delete'));
    $i = 1;
    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>');
        		}
Exemple #11
0
<div id="history">

	<div id="history-graph"></div> 

	<?php 
$table = new CI_Table();
$table->set_template($cp_table_template);
$table->set_heading("#", $this->lang->line('seo_rank_tracker_keywords'), $this->lang->line('seo_rank_tracker_rank'), $this->lang->line('seo_rank_tracker_search_engine'), $this->lang->line('seo_rank_tracker_date'));
foreach ($ranks as $r) {
    $table->add_row("-", $r->keywords, $r->rank, $r->search_engine_full, $r->date_full);
}
echo $table->generate();
?>
</div>
 
    

<script id="source"> 
$(function () {

	/* donnes */
    var d = [[1196463600000, 0], [1196550000000, 0], [1196636400000, 0], [1196722800000, 77]];
    
    <?php 
$str = "";
foreach ($ranks as $r) {
    if ($r->rank == 0) {
        $str .= "[" . $r->date . "000, -100], ";
    } else {
        $str .= "[" . $r->date . "000, -" . $r->rank . "], ";
    }
Exemple #12
0
$hostnameno = array('name' => 'appendhostname', 'id' => 'hostnameno', 'value' => 'no', 'checked' => $appendhostname == 'no');
$hostnameno = form_radio($hostnameno) . form_label(_('No'), 'hostnameno');
$label = fpbx_label(_('Append Hostname'), _('Appends the hostname to the name of the log files'));
$table->add_row($label, '<span class="radioset">' . $hostnameyes . $hostnameno . '</radioset>');
//queue log
$queuelogyes = array('name' => 'queue_log', 'id' => 'queuelogyes', 'value' => 'yes', 'checked' => $queue_log == 'yes');
$queuelogyes = form_radio($queuelogyes) . form_label(_('Yes'), 'queuelogyes');
$queuelogno = array('name' => 'queue_log', 'id' => 'queuelogno', 'value' => 'no', 'checked' => $queue_log == 'no');
$queuelogno = form_radio($queuelogno) . form_label(_('No'), 'queuelogno');
$label = fpbx_label(_('Log Queues'), _('Log queue events to a file'));
$table->add_row($label, '<span class="radioset">' . $queuelogyes . $queuelogno . '</radioset>');
$html .= $table->generate();
$html .= br(2);
//log files
$html .= heading(_('Log Files'), 5) . '<hr style="width:50%: margin-left: 0; margin-right: 50%">';
$table = new CI_Table();
$table->set_template(array('table_open' => '<table class="alt_table" id="logfile_entries">'));
//draw table header with help on every option
$has_security_option = version_compare($amp_conf['ASTVERSION'], '11.0', 'ge');
$heading = array(fpbx_label(_('File Name'), _('Name of file, relative to TODO!!!!. Use absolute path for a different location')), fpbx_label(_('Debug'), 'debug: ' . _('Messages used for debuging. ' . 'Do not report these as error\'s unless you have a ' . 'specific issue that you are attempting to debug. ' . 'Also note that Debug messages are also very verbose ' . 'and can and do fill up logfiles (and disk storage) quickly.')), fpbx_label(_('DTMF'), 'dtmf: ' . _('Keypresses as understood by asterisk. Usefull for debuging IVR and VM issues.')), fpbx_label(_('Error'), 'error: ' . _('Critical errors and issues')), fpbx_label(_('Fax'), 'fax: ' . _('Transmition and receiving of faxes')), fpbx_label(_('Notice'), 'notice: ' . _('Messages of specific actions, such as a phone registration or call completion')), fpbx_label(_('Verbose'), 'verbose: ' . _('Step-by-step messages of every step of a call flow. ' . 'Always enable and review if calls dont flow as expected')), fpbx_label(_('Warning'), 'warning: ' . _('Possible issues with dialplan syntaxt or call flow, but not critical.')));
if ($has_security_option) {
    $heading[] = fpbx_label(_('Security'), 'security: ' . _('Notification of security related events such as authentication attempts.'));
}
$heading[] = fpbx_label(_('Delete'));
$table->set_heading($heading);
//actual log files
$count = 0;
//$logfiles[] = array('name' => 'test', 'debug' => 'off', 'dtmf' => 'off', 'error' => 'on', 'fax' => 'off', 'notice' => 'on', 'verbose' => 'on', 'warning' => 'on');
foreach ($logfiles as $l) {
    $row[] = form_input(array('name' => 'logfiles[name][]', 'value' => $l['name'], 'placeholder' => _('file path/name'), 'required' => ''));
    $onoff = array('on' => _('On'), 'off' => _('Off'));
$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;
Exemple #14
0
<?php

$table = new CI_Table();
$table->set_template(array('table_open' => '<table class="table table-striped alt_table IVREntries" id="ivr_entries">'));
//build header
$h = array();
foreach ($headers as $mod => $header) {
    $h += $header;
}
$table->set_heading($h);
$count = 0;
foreach ($entries as $e) {
    $count++;
    //add ext to dial
    $row[] = form_input(array('name' => 'entries[ext][]', 'value' => $e['selection'], 'placeholder' => _('digits pressed')));
    //add destination. The last one gets a different count so that we can manipualte it on the page
    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
 function clear()
 {
     $this->row_class = array();
     parent::clear();
 }