本文整理汇总了PHP中table_sql类的典型用法代码示例。如果您正苦于以下问题:PHP table_sql类的具体用法?PHP table_sql怎么用?PHP table_sql使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了table_sql类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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());
}
示例2: __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);
}
示例3: 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);
}
示例4: __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);
}
示例5: 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);
}
示例6: __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;
}
示例7: __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);
}
示例8: 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');
}
示例9: __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);
}
示例10: __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);
}
示例11: 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');
}
示例12: __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);
}
示例13: __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);
}
示例14: __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);
}
示例15: __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');
}