当前位置: 首页>>代码示例>>PHP>>正文


PHP flexible_table::set_control_variables方法代码示例

本文整理汇总了PHP中flexible_table::set_control_variables方法的典型用法代码示例。如果您正苦于以下问题:PHP flexible_table::set_control_variables方法的具体用法?PHP flexible_table::set_control_variables怎么用?PHP flexible_table::set_control_variables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flexible_table的用法示例。


在下文中一共展示了flexible_table::set_control_variables方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

$table->define_columns($tablecolumns);
$table->define_headers($tableheaders);
$table->define_baseurl($baseurl->out());
if (!isset($hiddenfields['lastaccess'])) {
    $table->sortable(true, 'lastaccess', SORT_DESC);
} else {
    $table->sortable(true, 'firstname', SORT_ASC);
}
$table->no_sorting('roles');
$table->no_sorting('groups');
$table->no_sorting('groupings');
$table->no_sorting('select');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'participants');
$table->set_attribute('class', 'generaltable generalbox');
$table->set_control_variables(array(TABLE_VAR_SORT => 'ssort', TABLE_VAR_HIDE => 'shide', TABLE_VAR_SHOW => 'sshow', TABLE_VAR_IFIRST => 'sifirst', TABLE_VAR_ILAST => 'silast', TABLE_VAR_PAGE => 'spage'));
$table->setup();
list($esql, $params) = get_enrolled_sql($context, null, $currentgroup, true);
$joins = array("FROM {user} u");
$wheres = array();
$userfields = array('username', 'email', 'city', 'country', 'lang', 'timezone', 'maildisplay');
$mainuserfields = user_picture::fields('u', $userfields);
$extrasql = get_extra_user_fields_sql($context, 'u', '', $userfields);
if ($isfrontpage) {
    $select = "SELECT {$mainuserfields}, u.lastaccess{$extrasql}";
    $joins[] = "JOIN ({$esql}) e ON e.id = u.id";
    // Everybody on the frontpage usually.
    if ($accesssince) {
        $wheres[] = get_user_lastaccess_sql($accesssince);
    }
} else {
开发者ID:educakanchay,项目名称:campus,代码行数:31,代码来源:index.php

示例2: StdClass


//.........这里部分代码省略.........
         $this->filteredsql = str_replace('<%%PARAMS%%>', '', $this->filteredsql);
         // needed to prepare for filter range prefetch
     }
     $sort = optional_param('tsort' . $this->instance->id, @$this->config->defaultsort, PARAM_TEXT);
     if (!empty($sort)) {
         // do not sort if already sorted in explained query
         if (!preg_match('/ORDER\\s+BY/si', $this->sql)) {
             $this->filteredsql .= " ORDER BY {$sort}";
         }
     }
     $this->filteredsql = $this->protect($this->filteredsql);
     // ######### GETTING RESULTS
     $countres = $this->count_records($error);
     // if too many results, we force paging mode
     if (empty($this->config->pagesize) && $countres > $CFG->block_dashboard_big_result_threshold && !empty($this->config->bigresult)) {
         $text .= '<span class="error">' . get_string('toomanyrecordsusepaging', 'block_dashboard') . '</span><br/>';
         $this->config->pagesize = $CFG->block_dashboard_big_result_threshold;
         $rpage = 0;
     }
     // getting real results including page and offset
     if (!empty($this->config->pagesize)) {
         $offset = $rpage * $this->config->pagesize;
     } else {
         $offset = '';
     }
     try {
         $results = $this->fetch_dashboard_data($this->filteredsql, @$this->config->pagesize, $offset);
     } catch (Exception $e) {
         return get_string('invalidorobsoletequery', 'block_dashboard', $this->config->query);
     }
     if ($results) {
         $table = new flexible_table('mod-dashboard' . $this->instance->id);
         $instancecontrolvars = array(TABLE_VAR_PAGE => 'rpage' . $this->instance->id, TABLE_VAR_SORT => 'tsort' . $this->instance->id, TABLE_VAR_HIDE => 'thide' . $this->instance->id, TABLE_VAR_SHOW => 'tshow' . $this->instance->id);
         $table->set_control_variables($instancecontrolvars);
         // use full not to collide with flexipage paging
         $tablecolumns = array();
         $tableheaders = array();
         foreach ($this->output as $field => $label) {
             $tablecolumns[] = $field;
             $tableheaders[] = $label;
         }
         $table->define_columns($tablecolumns);
         $table->define_headers($tableheaders);
         $filterquerystringadd = isset($filterquerystring) ? "&amp;{$filterquerystring}" : '';
         if (@$this->config->inblocklayout) {
             $table->define_baseurl($CFG->wwwroot . '/course/view.php?id=' . $COURSE->id . $coursepage . $filterquerystringadd);
         } else {
             $table->define_baseurl($CFG->wwwroot . '/blocks/dashboard/view.php?id=' . $COURSE->id . '&amp;blockid=' . $this->instance->id . $coursepage . $filterquerystringadd);
         }
         if (!empty($this->config->sortable)) {
             $table->sortable(true, $this->config->xaxisfield, SORT_DESC);
         }
         //sorted by xaxisfield by default
         $table->collapsible(true);
         $table->initialbars(true);
         $table->set_attribute('cellspacing', '0');
         $table->set_attribute('id', 'dashboard' . $this->instance->id);
         $table->set_attribute('class', 'dashboard');
         $table->set_attribute('width', '100%');
         foreach ($this->output as $field => $label) {
             $table->column_class($field, $field);
         }
         $table->setup();
         /*			
         $where = $table->get_sql_where();
         $sortsql = $table->get_sql_sort();
开发者ID:andrewhancox,项目名称:moodle-block_dashboard,代码行数:67,代码来源:block_dashboard.php


注:本文中的flexible_table::set_control_variables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。