• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP table_sql类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: set_up_table_columns

 /**
  * Set up the table.
  * @param table_sql $table the table being constructed.
  * @param array $columns the list of columns.
  * @param array $headers the columns headings.
  * @param moodle_url $reporturl the URL of this report.
  * @param mod_quiz_attempts_report_options $options the display options.
  * @param bool $collapsible whether to allow columns in the report to be collapsed.
  */
 protected function set_up_table_columns($table, $columns, $headers, $reporturl, mod_quiz_attempts_report_options $options, $collapsible)
 {
     $table->define_columns($columns);
     $table->define_headers($headers);
     $table->sortable(true, 'uniqueid');
     $table->define_baseurl($options->get_url());
     $this->configure_user_columns($table);
     $table->no_sorting('feedbacktext');
     $table->column_class('sumgrades', 'bold');
     $table->set_attribute('id', 'attempts');
     $table->collapsible($collapsible);
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:21,代码来源:attemptsreport.php


示例2: __construct

 /**
  * Constructor
  *
  * @param int $tagcollid
  */
 public function __construct($tagcollid)
 {
     global $USER, $CFG, $PAGE;
     parent::__construct('tag-management-list-' . $USER->id);
     $this->tagcollid = $tagcollid;
     $perpage = optional_param('perpage', DEFAULT_PAGE_SIZE, PARAM_INT);
     $page = optional_param('page', 0, PARAM_INT);
     $baseurl = new moodle_url('/tag/manage.php', array('tc' => $tagcollid, 'perpage' => $perpage, 'page' => $page));
     $tablecolumns = array('select', 'name', 'fullname', 'count', 'flag', 'timemodified', 'tagtype', 'controls');
     $tableheaders = array(get_string('select', 'tag'), get_string('name', 'tag'), get_string('owner', 'tag'), get_string('count', 'tag'), get_string('flag', 'tag'), get_string('timemodified', 'tag'), get_string('officialtag', 'tag'), '');
     $this->define_columns($tablecolumns);
     $this->define_headers($tableheaders);
     $this->define_baseurl($baseurl);
     $this->column_class('select', 'mdl-align col-select');
     $this->column_class('name', 'col-name');
     $this->column_class('owner', 'col-owner');
     $this->column_class('count', 'mdl-align col-count');
     $this->column_class('flag', 'mdl-align col-flag');
     $this->column_class('timemodified', 'col-timemodified');
     $this->column_class('tagtype', 'mdl-align col-tagtype');
     $this->column_class('controls', 'mdl-align col-controls');
     $this->sortable(true, 'flag', SORT_DESC);
     $this->no_sorting('select');
     $this->no_sorting('controls');
     $this->set_attribute('cellspacing', '0');
     $this->set_attribute('id', 'tag-management-list');
     $this->set_attribute('class', 'admintable generaltable tag-management-table');
     $totalcount = "SELECT COUNT(id)\n            FROM {tag}\n            WHERE tagcollid = :tagcollid";
     $params = array('tagcollid' => $this->tagcollid);
     $this->set_count_sql($totalcount, $params);
     $this->set_sql('', '', '', $params);
     $this->collapsible(true);
     $PAGE->requires->js_call_amd('core/tag', 'init_manage_page', array());
 }
开发者ID:bewanyk,项目名称:moodle,代码行数:39,代码来源:manage_table.php


示例3: __construct

 /**
  * Constructor.
  *
  * @param string $uniqueid Unique ID.
  * @param int $courseid Course ID.
  * @param int $groupid Group ID.
  */
 public function __construct($uniqueid, $courseid, $groupid)
 {
     parent::__construct($uniqueid);
     $this->courseid = $courseid;
     // Define columns.
     $this->define_columns(array('time', 'fullname', 'xp', 'eventname'));
     $this->define_headers(array(get_string('eventtime', 'block_xp'), get_string('fullname'), get_string('xp', 'block_xp'), get_string('eventname', 'block_xp')));
     // Define SQL.
     $sqlfrom = '';
     $sqlparams = array();
     if ($groupid) {
         $sqlfrom = '{block_xp_log} x
                  JOIN {groups_members} gm
                    ON gm.groupid = :groupid
                   AND gm.userid = x.userid
             LEFT JOIN {user} u
                    ON x.userid = u.id';
         $sqlparams = array('groupid' => $groupid);
     } else {
         $sqlfrom = '{block_xp_log} x LEFT JOIN {user} u ON x.userid = u.id';
     }
     // Define SQL.
     $this->sql = new stdClass();
     $this->sql->fields = 'x.*, ' . get_all_user_name_fields(true, 'u');
     $this->sql->from = $sqlfrom;
     $this->sql->where = 'courseid = :courseid';
     $this->sql->params = array_merge(array('courseid' => $courseid), $sqlparams);
     // Define various table settings.
     $this->sortable(true, 'time', SORT_DESC);
     $this->collapsible(false);
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:38,代码来源:log_table.php


示例4: list

 /**
  * @return string sql to add to where statement.
  */
 function get_sql_where()
 {
     $filter = optional_param('filter', '', PARAM_NOTAGS);
     list($wsql, $wparams) = parent::get_sql_where();
     if ($filter !== '') {
         $wsql .= ($wsql ? ' AND ' : '') . 'tg.name LIKE :tagfilter';
         $wparams['tagfilter'] = '%' . $filter . '%';
     }
     return array($wsql, $wparams);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:13,代码来源:manage_table.php


示例5: __construct

 /**
  * Constructor
  * @param int $uniqueid all tables have to have a unique id, this is used
  *      as a key when storing table properties like sort order in the session.
  */
 public function __construct($uniqueid)
 {
     parent::__construct($uniqueid);
     // Define the list of columns to show.
     $columns = array('course_code', 'course_name', 'empctry', 'email', 'firstname', 'completion_date', 'completion_status');
     // Define the titles of columns to show in header.
     $headers = array(get_string('coursecode', 'block_ps_selfstudy'), get_string('title', 'block_ps_selfstudy'), get_string('empserial', 'block_ps_selfstudy'), get_string('email', 'block_ps_selfstudy'), get_string('name', 'block_ps_selfstudy'), get_string('completiondate', 'block_ps_selfstudy'), get_string('completionstatus', 'block_ps_selfstudy'));
     $this->sortable(true, 'course_code', SORT_ASC);
     $this->collapsible(false);
     $this->define_columns($columns);
     $this->define_headers($headers);
 }
开发者ID:andrewmrg,项目名称:ps_selfstudy,代码行数:17,代码来源:completion_table.php


示例6: array

 /**
  * Constructor
  * @param int $uniqueid all tables have to have a unique id, this is used
  *      as a key when storing table properties like sort order in the session.
  */
 function __construct($uniqueid)
 {
     parent::__construct($uniqueid);
     // Define the list of columns to show.
     $columns = array('selected', 'completed', 'institution', 'fullname', 'timecreated');
     $this->define_columns($columns);
     // Define the titles of columns to show in header.
     $headers = array('', get_string('completed', 'mod_booking'), get_string('institution', 'mod_booking'), get_string('fullname', 'mod_booking'), get_string('timecreated', 'mod_booking'));
     $this->define_headers($headers);
     $this->collapsible(false);
     $this->sortable(true);
     $this->pageable(true);
 }
开发者ID:375michael40veit,项目名称:moodle-mod_booking,代码行数:18,代码来源:unbooked_users.php


示例7: __construct

 /**
  * Sets up the table.
  *
  * @param string $courseid The id of the course.
  */
 public function __construct($courseid)
 {
     parent::__construct('enrol_lti_manage_table');
     $this->define_columns(array('name', 'url', 'secret', 'edit'));
     $this->define_headers(array(get_string('name'), get_string('url'), get_string('secret', 'enrol_lti'), get_string('edit')));
     $this->collapsible(false);
     $this->sortable(false);
     // Set the variables we need access to.
     $this->ltiplugin = enrol_get_plugin('lti');
     $this->ltienabled = enrol_is_enabled('lti');
     $this->canconfig = has_capability('moodle/course:enrolconfig', \context_course::instance($courseid));
     $this->courseid = $courseid;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:18,代码来源:manage_table.php


示例8: __construct

 /**
  * Constructor
  * @param int $uniqueid all tables have to have a unique id, this is used
  *      as a key when storing table properties like sort order in the session.
  */
 public function __construct($uniqueid)
 {
     parent::__construct($uniqueid);
     // Define the list of columns to show.
     $columns = array('course_code', 'course_platform', 'course_name', 'course_description', 'course_hours', 'course_type', 'actions');
     $this->sortable(true, 'course_code', SORT_ASC);
     $this->collapsible(false);
     $this->no_sorting('actions');
     $this->no_sorting('course_description');
     $this->define_columns($columns);
     // Define the titles of columns to show in header.
     $headers = array('Course Code', 'Course Platform', 'Course Name', 'Description', 'Hours', 'Course Type', 'Action');
     $this->define_headers($headers);
 }
开发者ID:andrewmrg,项目名称:ps_availablecourses,代码行数:19,代码来源:allcourses_table.php


示例9: array

 /**
  * Constructor
  * @param int $uniqueid all tables have to have a unique id, this is used
  *      as a key when storing table properties like sort order in the session.
  */
 function __construct($uniqueid)
 {
     parent::__construct($uniqueid);
     // Define the list of columns to show.
     $columns = array('name', 'selected');
     $this->define_columns($columns);
     // Define the titles of columns to show in header.
     $headers = array(get_string('selectcategory', 'local_saml_site'), '');
     $this->define_headers($headers);
     $this->collapsible(false);
     $this->sortable(true);
     $this->pageable(true);
     $this->rulestype[1] = get_string('usernamedomainname', 'local_saml_site');
 }
开发者ID:atlet,项目名称:moodle-local_saml_site,代码行数:19,代码来源:all_permisions.php


示例10: __construct

 /**
  * Constructor
  * @param int $uniqueid all tables have to have a unique id,  this is used
  *      as a key when storing table properties like sort order in the session.
  */
 public function __construct($uniqueid)
 {
     parent::__construct($uniqueid);
     // Define the list of columns to show.
     $columns = array('course_code', 'course_platform', 'course_name', 'course_description', 'course_hours', 'course_type', 'course_status', 'date_created', 'actions');
     $this->sortable(true, 'course_code', SORT_ASC);
     $this->collapsible(false);
     $this->no_sorting('actions');
     $this->no_sorting('course_description');
     $this->define_columns($columns);
     // Define the titles of columns to show in header.
     $headers = array(get_string('coursecode', 'block_ps_selfstudy'), get_string('platform', 'block_ps_selfstudy'), get_string('coursename', 'block_ps_selfstudy'), get_string('description', 'block_ps_selfstudy'), get_string('hours', 'block_ps_selfstudy'), get_string('coursetype', 'block_ps_selfstudy'), get_string('status', 'block_ps_selfstudy'), get_string('datecreated', 'block_ps_selfstudy'), get_string('action', 'block_ps_selfstudy'));
     $this->define_headers($headers);
 }
开发者ID:andrewmrg,项目名称:ps_selfstudy,代码行数:19,代码来源:managecourses_table.php


示例11: __construct

 /**
  * Sets up the table_log parameters.
  *
  * @param string $uniqueid unique id of form.
  * @param \moodle_url $url url where this table is displayed.
  * @param int $courseid course id.
  * @param int $perpage Number of rules to display per page.
  */
 public function __construct($uniqueid, \moodle_url $url, $courseid = 0, $perpage = 100)
 {
     parent::__construct($uniqueid);
     $this->set_attribute('class', 'toolmonitor subscriptions generaltable generalbox');
     $this->define_columns(array('name', 'description', 'course', 'plugin', 'instance', 'eventname', 'filters', 'unsubscribe'));
     $this->define_headers(array(get_string('rulename', 'tool_monitor'), get_string('description'), get_string('course'), get_string('area', 'tool_monitor'), get_string('moduleinstance', 'tool_monitor'), get_string('event', 'tool_monitor'), get_string('frequency', 'tool_monitor'), get_string('unsubscribe', 'tool_monitor')));
     $this->courseid = $courseid;
     $this->pagesize = $perpage;
     $systemcontext = \context_system::instance();
     $this->context = empty($courseid) ? $systemcontext : \context_course::instance($courseid);
     $this->collapsible(false);
     $this->sortable(false);
     $this->pageable(true);
     $this->is_downloadable(false);
     $this->define_baseurl($url);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:24,代码来源:subs.php


示例12: array

 /**
  * Constructor
  * @param int $uniqueid all tables have to have a unique id, this is used
  *      as a key when storing table properties like sort order in the session.
  */
 function __construct($uniqueid)
 {
     parent::__construct($uniqueid);
     // Define the list of columns to show.
     $columns = array('purchase_date', 'id', 'user_id', 'amount', 'items', 'gateway', 'txn_id', 'status', 'actions');
     $this->define_columns($columns);
     // Define the titles of columns to show in header.
     $headers = array(get_string('transaction_field_date', 'local_moodec'), get_string('transaction_field_id', 'local_moodec'), get_string('transaction_field_user', 'local_moodec'), get_string('transaction_field_amount', 'local_moodec'), get_string('transaction_field_items', 'local_moodec'), get_string('transaction_field_gateway', 'local_moodec'), get_string('transaction_field_txn', 'local_moodec'), get_string('transaction_field_status', 'local_moodec'), get_string('transaction_field_actions', 'local_moodec'));
     $this->define_headers($headers);
     $this->sortable(true, 'purchase_date', SORT_DESC);
     $this->no_sorting('user_id');
     $this->no_sorting('amount');
     $this->no_sorting('items');
     $this->no_sorting('txn_id');
     $this->no_sorting('gateway');
     $this->no_sorting('actions');
 }
开发者ID:Regaez,项目名称:moodle-local_moodec,代码行数:22,代码来源:transaction_table.php


示例13: __construct

 public function __construct($uniqueid)
 {
     global $PAGE, $USER;
     parent::__construct($uniqueid);
     $this->define_columns(array('userpic', 'fullname', 'total', 'posts', 'replies', 'substantive'));
     $this->define_headers(array('', get_string('fullnameuser'), get_string('totalposts', 'hsuforum'), get_string('posts', 'hsuforum'), get_string('replies', 'hsuforum'), get_string('substantive', 'hsuforum')));
     $fields = user_picture::fields('u', null, 'id');
     $params = array('forumid' => $PAGE->activityrecord->id);
     if (!has_capability('mod/hsuforum:viewposters', $PAGE->context)) {
         $params['userid'] = $USER->id;
         $usersql = ' AND u.id = :userid ';
     } else {
         $usersql = '';
     }
     $this->set_sql("{$fields},\n             COUNT(*) AS total,\n             SUM(CASE WHEN p.parent = 0 THEN 1 ELSE 0 END) AS posts,\n             SUM(CASE WHEN p.parent != 0 THEN 1 ELSE 0 END) AS replies,\n             SUM(CASE WHEN p.flags LIKE '%substantive%' THEN 1 ELSE 0 END) AS substantive", '{hsuforum_posts} p, {hsuforum_discussions} d, {hsuforum} f, {user} u', "u.id = p.userid AND p.discussion = d.id AND d.forum = f.id AND f.id = :forumid{$usersql} GROUP BY p.userid", $params);
     $this->set_count_sql("\n            SELECT COUNT(DISTINCT p.userid)\n              FROM {hsuforum_posts} p\n              JOIN {user} u ON u.id = p.userid\n              JOIN {hsuforum_discussions} d ON d.id = p.discussion\n              JOIN {hsuforum} f ON f.id = d.forum\n              WHERE f.id = :forumid{$usersql}\n        ", $params);
 }
开发者ID:cdsmith-umn,项目名称:moodle-mod_hsuforum,代码行数:17,代码来源:posters.php


示例14: __construct

 /**
  * Constructor.
  *
  * @param string $uniqueid Unique ID.
  */
 public function __construct($uniqueid, $courseid)
 {
     parent::__construct($uniqueid);
     $this->courseid = $courseid;
     // Define columns.
     $this->define_columns(array('time', 'fullname', 'xp', 'eventname', 'actions'));
     $this->define_headers(array(get_string('eventtime', 'block_xp'), get_string('fullname'), get_string('xp', 'block_xp'), get_string('eventname', 'block_xp'), ''));
     // Define SQL.
     $this->sql = new stdClass();
     $this->sql->fields = 'x.*, ' . get_all_user_name_fields(true, 'u');
     $this->sql->from = '{block_xp_log} x LEFT JOIN {user} u ON x.userid = u.id';
     $this->sql->where = 'courseid = :courseid';
     $this->sql->params = array('courseid' => $courseid);
     // Define various table settings.
     $this->sortable(true, 'time', SORT_DESC);
     $this->collapsible(false);
 }
开发者ID:scarletjester,项目名称:moodle-block_xp,代码行数:22,代码来源:log_table.php


示例15: __construct

 /**
  * Constructor
  * @param int $uniqueid all tables have to have a unique id, this is used
  *      as a key when storing table properties like sort order in the session.
  */
 public function __construct($uniqueid)
 {
     parent::__construct($uniqueid);
     // Define the list of columns to show.
     $columns = array('course_code', 'course_name', 'email', 'firstname', 'address', 'address2', 'city', 'state', 'zipcode', 'country', 'phone1', 'request_date', 'request_status');
     // Define the titles of columns to show in header.
     $headers = array(get_string('coursecode', 'block_ps_selfstudy'), get_string('title', 'block_ps_selfstudy'), get_string('email', 'block_ps_selfstudy'), get_string('firstname', 'block_ps_selfstudy'), get_string('address', 'block_ps_selfstudy'), get_string('address2', 'block_ps_selfstudy'), get_string('city', 'block_ps_selfstudy'), get_string('state', 'block_ps_selfstudy'), get_string('zip', 'block_ps_selfstudy'), get_string('country', 'block_ps_selfstudy'), get_string('phone1', 'block_ps_selfstudy'), get_string('requestdate', 'block_ps_selfstudy'), get_string('status', 'block_ps_selfstudy'));
     if (!$this->is_downloading()) {
         $columns[] = 'actions';
         $headers[] = 'Action';
     }
     global $DB;
     $this->sortable(true, 'course_code', SORT_ASC);
     $this->collapsible(false);
     $this->no_sorting('actions');
     $this->define_columns($columns);
     $this->define_headers($headers);
 }
开发者ID:andrewmrg,项目名称:ps_selfstudy,代码行数:23,代码来源:viewrequests_table.php


示例16: __construct

 /**
  * Sets up the table_log parameters.
  *
  * @param string $uniqueid unique id of form.
  * @param \moodle_url $url url where this table is displayed.
  * @param int $courseid course id.
  * @param int $perpage Number of rules to display per page.
  */
 public function __construct($uniqueid, \moodle_url $url, $courseid = 0, $perpage = 100)
 {
     global $PAGE;
     parent::__construct($uniqueid);
     $this->set_attribute('class', 'toolmonitor subscriptions generaltable generalbox');
     $this->define_columns(array('name', 'course', 'instance', 'unsubscribe', 'editrule'));
     $this->define_headers(array(get_string('name'), get_string('course'), get_string('moduleinstance', 'tool_monitor'), get_string('unsubscribe', 'tool_monitor'), get_string('editrule', 'tool_monitor')));
     $this->courseid = $courseid;
     $this->pagesize = $perpage;
     $systemcontext = \context_system::instance();
     $this->context = empty($courseid) ? $systemcontext : \context_course::instance($courseid);
     $this->collapsible(false);
     $this->sortable(false);
     $this->pageable(true);
     $this->is_downloadable(false);
     $this->define_baseurl($url);
     $this->helpiconrenderer = $PAGE->get_renderer('tool_monitor', 'helpicon');
 }
开发者ID:HuiChangZhai,项目名称:moodle,代码行数:26,代码来源:subs.php


示例17: __construct

 /**
  * Sets up the table_log parameters.
  *
  * @param string $uniqueid unique id of form.
  * @param stdClass $filterparams (optional) filter params.
  *     - int courseid: id of course
  *     - int userid: user id
  *     - int|string modid: Module id or "site_errors" to view site errors
  *     - int groupid: Group id
  *     - \core\log\sql_select_reader logreader: reader from which data will be fetched.
  *     - int edulevel: educational level.
  *     - string action: view action
  *     - int date: Date from which logs to be viewed.
  */
 public function __construct($uniqueid, $filterparams = null)
 {
     parent::__construct($uniqueid);
     $this->set_attribute('class', 'reportlog generaltable generalbox');
     $this->filterparams = $filterparams;
     // Add course column if logs are displayed for site.
     $cols = array();
     $headers = array();
     if (empty($filterparams->courseid)) {
         $cols = array('course');
         $headers = array(get_string('course'));
     }
     $this->define_columns(array_merge($cols, array('time', 'fullnameuser', 'relatedfullnameuser', 'context', 'component', 'eventname', 'description', 'origin', 'ip')));
     $this->define_headers(array_merge($headers, array(get_string('time'), get_string('fullnameuser'), get_string('eventrelatedfullnameuser', 'report_log'), get_string('eventcontext', 'report_log'), get_string('eventcomponent', 'report_log'), get_string('eventname'), get_string('description'), get_string('eventorigin', 'report_log'), get_string('ip_address'))));
     $this->collapsible(false);
     $this->sortable(false);
     $this->pageable(true);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:32,代码来源:table_log.php


示例18: __construct

 /**
  * Sets up the table_log parameters.
  *
  * @param string $uniqueid unique id of table.
  * @param \context_course $context Context of the report.
  * @param \moodle_url $url url of the page where this table would be displayed.
  * @param array $filters options are:
  *                          userids : limit to specific users (default: none)
  *                          itemid : limit to specific grade item (default: all)
  *                          grader : limit to specific graders (default: all)
  *                          datefrom : start of date range
  *                          datetill : end of date range
  *                          revisedonly : only show revised grades (default: false)
  *                          format : page | csv | excel (default: page)
  * @param string $download Represents download format, pass '' no download at this time.
  * @param int $page The current page being displayed.
  * @param int $perpage Number of rules to display per page.
  */
 public function __construct($uniqueid, \context_course $context, $url, $filters = array(), $download = '', $page = 0, $perpage = 100)
 {
     parent::__construct($uniqueid);
     $this->set_attribute('class', 'gradereport_history generaltable generalbox');
     // Set protected properties.
     $this->context = $context;
     $this->courseid = $this->context->instanceid;
     $this->pagesize = $perpage;
     $this->page = $page;
     $this->filters = (object) $filters;
     $this->gradeitems = \grade_item::fetch_all(array('courseid' => $this->courseid));
     $this->cms = get_fast_modinfo($this->courseid);
     $this->useridfield = 'userid';
     // Define columns in the table.
     $this->define_table_columns();
     // Define configs.
     $this->define_table_configs($url);
     // Set download status.
     $this->is_downloading($download, get_string('exportfilename', 'gradereport_history'));
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:38,代码来源:tablelog.php


示例19: __construct

 /**
  * Constructor.
  *
  * @param string $uniqueid Unique ID.
  */
 public function __construct($uniqueid, $courseid)
 {
     global $PAGE;
     parent::__construct($uniqueid);
     // Block XP stuff.
     $this->xpmanager = block_xp_manager::get($courseid);
     $this->xpoutput = $PAGE->get_renderer('block_xp');
     // Define columns.
     $this->define_columns(array('rank', 'userpic', 'fullname', 'lvl', 'xp', 'progress'));
     $this->define_headers(array(get_string('rank', 'block_xp'), '', get_string('fullname'), get_string('level', 'block_xp'), get_string('xp', 'block_xp'), get_string('progress', 'block_xp')));
     // Define SQL.
     $this->sql = new stdClass();
     $this->sql->fields = 'x.*, ' . user_picture::fields('u');
     $this->sql->from = '{block_xp} x LEFT JOIN {user} u ON x.userid = u.id';
     $this->sql->where = 'courseid = :courseid';
     $this->sql->params = array('courseid' => $courseid);
     // Define various table settings.
     $this->sortable(false);
     $this->no_sorting('userpic');
     $this->no_sorting('progress');
     $this->collapsible(false);
 }
开发者ID:scarletjester,项目名称:moodle-block_xp,代码行数:27,代码来源:ladder_table.php


示例20: __construct

 /**
  * Constructor.
  *
  * @param string $uniqueid Unique ID.
  */
 public function __construct($uniqueid, $courseid)
 {
     global $DB, $PAGE;
     parent::__construct($uniqueid);
     // Block XP stuff.
     $this->xpmanager = block_xp_manager::get($courseid);
     $this->xpoutput = $PAGE->get_renderer('block_xp');
     $context = context_course::instance($courseid);
     // Define columns.
     $this->define_columns(array('userpic', 'fullname', 'lvl', 'xp', 'progress', 'actions'));
     $this->define_headers(array('', get_string('fullname'), get_string('level', 'block_xp'), get_string('xp', 'block_xp'), get_string('progress', 'block_xp'), ''));
     // Get the relevant user IDs, users enrolled or users with XP.
     // This might be a performance issue at some point.
     $ids = array();
     $users = get_enrolled_users($context, 'block/xp:earnxp');
     foreach ($users as $user) {
         $ids[$user->id] = $user->id;
     }
     unset($users);
     $entries = $DB->get_recordset_sql('SELECT userid FROM {block_xp} WHERE courseid = :courseid', array('courseid' => $courseid));
     foreach ($entries as $entry) {
         $ids[$entry->userid] = $entry->userid;
     }
     $entries->close();
     list($insql, $inparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED, 'param', true, null);
     // Define SQL.
     $this->sql = new stdClass();
     $this->sql->fields = user_picture::fields('u') . ', x.lvl, x.xp';
     $this->sql->from = "{user} u LEFT JOIN {block_xp} x ON (x.userid = u.id AND x.courseid = :courseid)";
     $this->sql->where = "u.id {$insql}";
     $this->sql->params = array_merge($inparams, array('courseid' => $courseid));
     // Define various table settings.
     $this->sortable(true, 'lvl', SORT_DESC);
     $this->no_sorting('userpic');
     $this->no_sorting('progress');
     $this->collapsible(false);
 }
开发者ID:scarletjester,项目名称:moodle-block_xp,代码行数:42,代码来源:report_table.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP tag类代码示例发布时间:2022-05-23
下一篇:
PHP table_class类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap