本文整理汇总了PHP中table_sql::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP table_sql::__construct方法的具体用法?PHP table_sql::__construct怎么用?PHP table_sql::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table_sql
的用法示例。
在下文中一共展示了table_sql::__construct方法的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: __construct
/**
* Create a new instance of the logtable
*
* @param int $ownerid if set, display only coupons from given owner
* @param int $filter table filter
*/
public function __construct($ownerid = null, $filter = 3)
{
global $USER;
parent::__construct(__CLASS__ . '-' . $USER->id . '-' . (int) $ownerid);
$this->ownerid = (int) $ownerid;
$this->filter = (int) $filter;
$this->sortable(true, 'c.senddate', 'DESC');
$this->strdelete = get_string('action:coupon:delete', 'block_coupon');
$this->strdeleteconfirm = get_string('action:coupon:delete:confirm', 'block_coupon');
}
示例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
/**
* Constructor
* @param string $uniqueid
* @param object $quiz
* @param context $context
* @param string $qmsubselect
* @param mod_quiz_attempts_report_options $options
* @param array $groupstudents
* @param array $students
* @param array $questions
* @param moodle_url $reporturl
*/
public function __construct($uniqueid, $quiz, $context, $qmsubselect, mod_quiz_attempts_report_options $options, $groupstudents, $students, $questions, $reporturl)
{
parent::__construct($uniqueid);
$this->quiz = $quiz;
$this->context = $context;
$this->qmsubselect = $qmsubselect;
$this->groupstudents = $groupstudents;
$this->students = $students;
$this->questions = $questions;
$this->includecheckboxes = $options->checkboxcolumn;
$this->reporturl = $reporturl;
$this->options = $options;
}
示例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;
}
示例8:
function quiz_report_responses_table($quiz , $qmsubselect, $groupstudents,
$students, $questions, $candelete, $reporturl, $displayoptions, $context){
parent::__construct('mod-quiz-report-responses-report');
$this->quiz = $quiz;
$this->qmsubselect = $qmsubselect;
$this->groupstudents = $groupstudents;
$this->students = $students;
$this->questions = $questions;
$this->candelete = $candelete;
$this->reporturl = $reporturl;
$this->displayoptions = $displayoptions;
$this->context = $context;
}
示例9: __construct
/**
* Constructor.
*
* @param string $uniqueid Unique ID.
* @param int $courseid Course ID.
* @param int $groupid Group ID.
*/
public function __construct($uniqueid, $courseid, $groupid)
{
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 all the users that are enrolled and can earn XP.
$ids = array();
$users = get_enrolled_users($context, 'block/xp:earnxp', $groupid);
foreach ($users as $user) {
$ids[$user->id] = $user->id;
}
unset($users);
// Get the users which might not be enrolled or are revoked the permission, but still should
// be displayed in the report for the teachers' benefit. We need to filter out the users which
// are not a member of the group though.
if (empty($groupid)) {
$sql = 'SELECT userid FROM {block_xp} WHERE courseid = :courseid';
$params = array('courseid' => $courseid);
} else {
$sql = 'SELECT b.userid
FROM {block_xp} b
JOIN {groups_members} gm
ON b.userid = gm.userid
AND gm.groupid = :groupid
WHERE courseid = :courseid';
$params = array('courseid' => $courseid, 'groupid' => $groupid);
}
$entries = $DB->get_recordset_sql($sql, $params);
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') . ', COALESCE(x.lvl, 1) AS lvl, x.xp, ' . context_helper::get_preload_record_columns_sql('ctx');
$this->sql->from = "{user} u\n JOIN {context} ctx\n ON ctx.instanceid = u.id\n AND ctx.contextlevel = :contextlevel\n LEFT JOIN {block_xp} x\n ON (x.userid = u.id AND x.courseid = :courseid)";
$this->sql->where = "u.id {$insql}";
$this->sql->params = array_merge($inparams, array('courseid' => $courseid, 'contextlevel' => CONTEXT_USER));
// Define various table settings.
$this->sortable(true, 'lvl', SORT_DESC);
$this->no_sorting('userpic');
$this->no_sorting('progress');
$this->collapsible(false);
}
示例10: 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');
}
示例11: __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);
}
示例12: __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);
}
示例13: __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);
}
示例14: 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');
}
示例15: __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);
}