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


PHP field::get_default方法代码示例

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


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

示例1: array

 /**
  * Method that specifies the report's columns
  * (specifies various fields involving user info, clusters, class enrolment, and module information)
  *
  * @return  table_report_column array  The list of report columns
  */
 function get_columns()
 {
     global $CURMAN, $SESSION, $CFG;
     $columns = array();
     $columns[] = new table_report_column('crs.name', get_string('column_course', $this->lang_file), 'csscourse', 'left', true);
     $columns[] = new table_report_column('cls.idnumber', get_string('column_class_id', $this->lang_file), 'cssclass', 'left', true);
     $filter_params = php_report_filtering_get_active_filter_values($this->get_report_shortname(), 'field' . $this->get_report_shortname());
     // Unserialize value of filter params to get field ids array
     $filter_params = @unserialize(base64_decode($filter_params[0]['value']));
     // Loop through these additional parameters - new columns, will  have to eventually pass the table etc...
     if (isset($filter_params) && is_array($filter_params)) {
         // Working with custom course fields - get all course fields
         $context = context_level_base::get_custom_context_level('course', 'block_curr_admin');
         $fields = field::get_for_context_level($context);
         foreach ($filter_params as $custom_course_id) {
             $custom_course_field = new field($custom_course_id);
             // Obtain custom field default values IFF set
             if (($default_value = $custom_course_field->get_default()) !== false) {
                 // save in array { record_field => default_value }
                 $this->field_default['custom_data_' . $custom_course_id] = $default_value;
             }
             //Find matching course field
             $course_field_title = $fields[$custom_course_id]->name;
             //Now, create a join statement for each custom course field and add it to the sql query
             $data_table = $CURMAN->db->prefix_table($custom_course_field->data_table());
             //field used to identify course id in custom field subquery
             $course_id_field = "ctxt_instanceid_{$custom_course_id}";
             //make sure the user can view fields for the current course
             $view_field_capability = block_php_report_field_capability($custom_course_field->owners);
             $view_field_contexts = get_contexts_by_capability_for_user('course', $view_field_capability, $this->userid);
             $view_field_filter = $view_field_contexts->sql_filter_for_context_level('ctxt.instanceid', 'course');
             // Create a custom join to be used later for the completed sql query
             $this->custom_joins[] = " LEFT JOIN (SELECT d.data as custom_data_{$custom_course_id}, ctxt.instanceid as ctxt_instanceid_{$custom_course_id}\n                      FROM {$CURMAN->db->prefix_table('context')} ctxt\n                      JOIN {$data_table} d ON d.contextid = ctxt.id\n                      AND d.fieldid = {$custom_course_id}\n                      WHERE\n                      ctxt.contextlevel = {$context}\n                      AND {$view_field_filter}) custom_{$custom_course_id}\n                      ON cls.courseid = custom_{$custom_course_id}.{$course_id_field}";
             $columns[] = new table_report_column('custom_' . $custom_course_id . '.custom_data_' . $custom_course_id, $fields[$custom_course_id]->name, 'csscustom_course_field', 'left', true);
         }
     }
     // completion elements completed/total
     $columns[] = new table_report_horizontal_bar_column("(SELECT COUNT(*)\n                                                                FROM {$CURMAN->db->prefix_table(CRSCOMPTABLE)} comp\n                                                                JOIN {$CURMAN->db->prefix_table(CLSTABLE)} cls2\n                                                                  ON cls2.courseid = comp.courseid\n                                                                JOIN {$CURMAN->db->prefix_table(STUTABLE)} stu\n                                                                  ON stu.classid = cls2.id\n                                                                JOIN {$CURMAN->db->prefix_table(GRDTABLE)} clsgr\n                                                                  ON clsgr.classid = cls2.id\n                                                                 AND clsgr.userid = stu.userid\n                                                                 AND clsgr.locked = 1\n                                                                 AND clsgr.grade >= comp.completion_grade\n                                                                 AND clsgr.completionid = comp.id\n                                                               WHERE cls2.id = cls.id\n                                                                 AND stu.userid = crlmuser.id\n                                                             ) AS stucompletedprogress", get_string('bar_column_progress', $this->lang_file), 'progress_bar', "(SELECT COUNT(*)\n                                                                FROM {$CURMAN->db->prefix_table(CRSCOMPTABLE)} comp\n                                                                JOIN {$CURMAN->db->prefix_table(CLSTABLE)} cls2\n                                                                  ON cls2.courseid = comp.courseid\n                                                               WHERE cls2.id = cls.id\n                                                             ) AS numprogress", 'center', '$p');
     $columns[] = new table_report_column('0 AS completedprogress', get_string('column_progress', $this->lang_file), 'cssprogress', 'center', true);
     $columns[] = new table_report_column('cls.startdate', get_string('column_start_date', $this->lang_file), 'cssstart_date', 'center', true);
     $columns[] = new table_report_column('cls.enddate', get_string('column_end_date', $this->lang_file), 'cssend_date', 'center', true);
     $columns[] = new table_report_column('pretest.score AS pretestscore', get_string('column_pretest_score', $this->lang_file), 'csspretest_score', 'center', true);
     $columns[] = new table_report_column('posttest.score AS posttestscore', get_string('column_posttest_score', $this->lang_file), 'cssposttest_score', 'center', true);
     // discussion posts
     $columns[] = new table_report_column("(SELECT COUNT(*)\n                                                 FROM {$CFG->prefix}forum_discussions disc\n                                                 JOIN {$CFG->prefix}forum_posts post\n                                                   ON post.discussion = disc.id\n                                                WHERE disc.course = clsmdl.moodlecourseid\n                                                  AND post.userid = user.id\n                                              ) AS numposts", get_string('column_discussion_posts', $this->lang_file), 'cssdiscussion_posts', 'center', true);
     // resources accessed
     $columns[] = new table_report_column("(SELECT COUNT(*)\n                                                 FROM {$CFG->prefix}log log\n                                                 JOIN {$CFG->prefix}resource rsc\n                                                   ON rsc.id = log.info\n                                                WHERE log.module = 'resource'\n                                                  AND log.action = 'view'\n                                                  AND log.userid = user.id\n                                                  AND log.course = clsmdl.moodlecourseid\n                                              ) AS numresources", get_string('column_resources_accessed', $this->lang_file), 'cssresources_accessed', 'center', true);
     return $columns;
 }
开发者ID:remotelearner,项目名称:elis.reporting,代码行数:55,代码来源:individual_course_progress_report.class.php

示例2: array

 /**
  * Returns an array of report columns related to the specified CM custom fields
  * @param array  $cols  List of columns/fields we are displaying
  * @param string $type  The custom field type: curriculum, course, class ...
  * @return array Collection of appropriate table report columns
  */
 function get_custom_field_columns($cols, $type)
 {
     global $DB;
     $columns = array();
     if (!empty($cols)) {
         foreach ($cols as $field => $active) {
             if ($active && substr($field, 0, 7) == 'custom_') {
                 $fieldid = substr($field, 7);
                 //store the context level that's represented by this field
                 $level = \local_eliscore\context\helper::get_level_from_name($type);
                 if (!$DB->record_exists(field_contextlevel::TABLE, array('fieldid' => $fieldid, 'contextlevel' => $level))) {
                     continue;
                 }
                 $this->_fielddatacontexts[$fieldid] = $type;
                 $this->_customfieldids[] = $fieldid;
                 $name = $DB->get_field(field::TABLE, 'name', array('id' => $fieldid));
                 $column = new table_report_column('customfielddata_' . $fieldid . '.data AS customfielddata_' . $fieldid, $name, 'field_' . $fieldid);
                 $columns[] = $column;
                 //store custom field information we need later
                 $field = new field($fieldid);
                 if (($default_value = $field->get_default()) !== false) {
                     $this->_defaultfieldvalues[$fieldid] = $default_value;
                 }
                 //store the data type
                 $this->_fielddatatypes[$fieldid] = $field->datatype;
                 // ELIS-5862/ELIS-7409: keep track of datetime fields
                 if (isset($field->owners['manual']) && ($manual = new field_owner($field->owners['manual'])) && $manual->param_control == 'datetime') {
                     $this->_datetimefields[$fieldid] = !empty($manual->param_inctime);
                 }
             }
         }
     }
     return $columns;
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:40,代码来源:user_class_completion_report.class.php

示例3: array

 /**
  * Method that specifies the report's columns
  * (specifies various fields involving user info, clusters, class enrolment, and module information)
  *
  * @uses    $DB
  * @return  table_report_column array  The list of report columns
  */
 function get_columns()
 {
     global $DB;
     $columns = array();
     $columns[] = new table_report_column('crs.name', get_string('column_course', $this->lang_file), 'csscourse', 'left', true);
     $columns[] = new table_report_column('cls.idnumber', get_string('column_class_id', $this->lang_file), 'cssclass', 'left', true);
     $filter_params = php_report_filtering_get_active_filter_values($this->get_report_shortname(), 'field' . $this->get_report_shortname(), $this->filter);
     $filter_params = $filter_params[0]['value'];
     $filter_params = $filter_params ? explode(',', $filter_params) : array();
     // Loop through these additional parameters - new columns, will  have to eventually pass the table etc...
     if (isset($filter_params) && is_array($filter_params)) {
         // Working with custom course fields - get all course fields
         $fields = field::get_for_context_level(CONTEXT_ELIS_COURSE)->to_array();
         foreach ($filter_params as $custom_course_id) {
             $custom_course_field = new field($custom_course_id);
             // Obtain custom field default values IFF set
             if (($default_value = $custom_course_field->get_default()) !== false) {
                 // save in array { record_field => default_value }
                 $this->field_default['custom_data_' . $custom_course_id] = $default_value;
             }
             //Find matching course field
             $course_field_title = $fields[$custom_course_id]->name;
             //Now, create a join statement for each custom course field and add it to the sql query
             $data_table = $custom_course_field->data_table();
             //field used to identify course id in custom field subquery
             $course_id_field = "ctxt_instanceid_{$custom_course_id}";
             //make sure the user can view fields for the current course
             $view_field_capability = generalized_filter_custom_field_multiselect_values::field_capability($custom_course_field->owners);
             $view_field_contexts = get_contexts_by_capability_for_user('course', $view_field_capability, $this->userid);
             //$view_field_filter = $view_field_contexts->sql_filter_for_context_level('ctxt.instanceid', 'course');
             $filter_obj = $view_field_contexts->get_filter('instanceid', 'course');
             $filter_sql = $filter_obj->get_sql(false, 'ctxt', SQL_PARAMS_NAMED);
             $view_field_filter = 'TRUE';
             $params = array();
             if (isset($filter_sql['where'])) {
                 $view_field_filter = $filter_sql['where'];
                 $params = $filter_sql['where_parameters'];
             }
             // Create a custom join to be used later for the completed sql query
             $this->custom_joins[] = array("\n                LEFT JOIN (SELECT d.data as custom_data_{$custom_course_id}, ctxt.instanceid as ctxt_instanceid_{$custom_course_id}\n                          FROM {context} ctxt\n                          JOIN {" . $data_table . "} d\n                            ON d.contextid = ctxt.id AND d.fieldid = {$custom_course_id}\n                          WHERE ctxt.contextlevel = " . CONTEXT_ELIS_COURSE . "\n                            AND {$view_field_filter}) custom_{$custom_course_id}\n                       ON cls.courseid = custom_{$custom_course_id}.{$course_id_field}", $params);
             $columns[] = new table_report_column('custom_' . $custom_course_id . '.custom_data_' . $custom_course_id, $fields[$custom_course_id]->name, 'csscustom_course_field', 'left', true);
         }
     }
     // completion elements completed/total
     $columns[] = new table_report_horizontal_bar_column('(SELECT COUNT(*) FROM {' . coursecompletion::TABLE . '} comp
                              JOIN {' . pmclass::TABLE . '} cls2
                                ON cls2.courseid = comp.courseid
                              JOIN {' . student::TABLE . '} stu
                                ON stu.classid = cls2.id
                              JOIN {' . student_grade::TABLE . '} clsgr
                                ON clsgr.classid = cls2.id
                               AND clsgr.userid = stu.userid
                               AND clsgr.locked = 1
                               AND clsgr.grade >= comp.completion_grade
                               AND clsgr.completionid = comp.id
                             WHERE cls2.id = cls.id
                               AND stu.userid = crlmuser.id
                           ) AS stucompletedprogress', get_string('bar_column_progress', $this->lang_file), 'progress_bar', '(SELECT COUNT(*) FROM {' . coursecompletion::TABLE . '} comp
                              JOIN {' . pmclass::TABLE . '} cls2
                                ON cls2.courseid = comp.courseid
                             WHERE cls2.id = cls.id
                           ) AS numprogress', 'center', '$p');
     $columns[] = new table_report_column('0 AS completedprogress', get_string('column_progress', $this->lang_file), 'cssprogress', 'center', true);
     $columns[] = new table_report_column('cls.startdate', get_string('column_start_date', $this->lang_file), 'cssstart_date', 'center', true);
     $columns[] = new table_report_column('cls.enddate', get_string('column_end_date', $this->lang_file), 'cssend_date', 'center', true);
     $optional_columns_ppt = php_report_filtering_get_active_filter_values($this->get_report_shortname(), 'optional_columns_preposttest', $this->filter);
     $optional_columns_los = php_report_filtering_get_active_filter_values($this->get_report_shortname(), 'optional_columns_los', $this->filter);
     $optional_columns_totscore = php_report_filtering_get_active_filter_values($this->get_report_shortname(), 'optional_columns_totalscore', $this->filter);
     $this->preposttest_columns = false;
     $this->los_columns = false;
     $this->totalscore_column = false;
     if (!empty($optional_columns_ppt) && !empty($optional_columns_ppt['0']['value'])) {
         $columns[] = new table_report_column('pretest.score AS pretestscore', get_string('column_pretest_score', $this->lang_file), 'csspretest_score', 'center', true);
         $columns[] = new table_report_column('posttest.score AS posttestscore', get_string('column_posttest_score', $this->lang_file), 'cssposttest_score', 'center', true);
         $this->preposttest_columns = true;
     }
     if (!empty($optional_columns_los) && !empty($optional_columns_los['0']['value'])) {
         $max_los_sql = 'SELECT courseid, COUNT(\'x\') AS count FROM {' . coursecompletion::TABLE . '} GROUP BY courseid ORDER BY count DESC';
         $max_los = $DB->get_records_sql($max_los_sql, null, 0, 1);
         $max_los = empty($max_los) ? 0 : current($max_los)->count;
         for ($i = 1; $i <= $max_los; ++$i) {
             $columns[] = new table_report_column("'" . addslashes(get_string('na', $this->lang_file)) . "' AS lo{$i}", get_string('column_los_prefix', $this->lang_file) . "{$i}", 'csslos_columns', 'center', false);
         }
         $this->los_columns = true;
     }
     if (!empty($optional_columns_totscore) && !empty($optional_columns_totscore['0']['value'])) {
         $columns[] = new table_report_column('enrol.grade AS elisgrade', get_string('column_totalscore', $this->lang_file), 'csstotal_score', 'center', true);
         $this->totalscore_column = true;
     }
     // discussion posts
     $columns[] = new table_report_column('(SELECT COUNT(*) FROM {forum_discussions} disc
                              JOIN {forum_posts} post
                                ON post.discussion = disc.id
//.........这里部分代码省略.........
开发者ID:jamesmcq,项目名称:elis,代码行数:101,代码来源:individual_course_progress_report.class.php

示例4: array

 /**
  * Method that specifies the report's columns
  * (specifies various fields involving user info, clusters, class enrolment, and module information)
  *
  * @uses    $DB
  * @return  table_report_column array  The list of report columns
  */
 function get_columns()
 {
     global $DB;
     //add custom fields here, first the Course name, then custom fields, then progress and % students passing
     $columns = array();
     $columns[] = new table_report_column('crs.name', get_string('column_course', 'rlreport_course_progress_summary'), 'course', 'left', true);
     $filter_params = php_report_filtering_get_active_filter_values($this->get_report_shortname(), 'field' . $this->get_report_shortname(), $this->filter);
     $filter_params = $filter_params[0]['value'];
     $filter_params = $filter_params ? explode(',', $filter_params) : array();
     // Loop through these additional parameters - new columns, will  have to eventually pass the table etc...
     if (isset($filter_params) && is_array($filter_params)) {
         // Working with custom course fields - get all course fields
         $fields = field::get_for_context_level(CONTEXT_ELIS_COURSE)->to_array();
         foreach ($filter_params as $custom_course_id) {
             $custom_course_field = new field($custom_course_id);
             // Obtain custom field default values IFF set
             if (($default_value = $custom_course_field->get_default()) !== false) {
                 // save in array { record_field => default_value }
                 $this->field_default['custom_data_' . $custom_course_id] = $default_value;
             }
             //Find matching course field
             $course_field_title = $fields[$custom_course_id]->name;
             //Now, create a join statement for each custom course field and add it to the sql query
             $data_table = $custom_course_field->data_table();
             //field used to identify course id in custom field subquery
             $course_id_field = "ctxt_instanceid_{$custom_course_id}";
             //make sure the user can view fields for the current course
             $view_field_capability = generalized_filter_custom_field_multiselect_values::field_capability($custom_course_field->owners);
             $view_field_contexts = get_contexts_by_capability_for_user('course', $view_field_capability, $this->userid);
             //$view_field_filter = $view_field_contexts->sql_filter_for_context_level('ctxt.instanceid', 'course');
             $filter_obj = $view_field_contexts->get_filter('ctxt.instanceid', 'course');
             $filter_sql = $filter_obj->get_sql(false, 'ctxt', SQL_PARAMS_NAMED);
             $view_field_filter = 'TRUE';
             $params = array();
             if (isset($filter_sql['where'])) {
                 $view_field_filter = $filter_sql['where'];
                 $params = $filter_sql['where_parameters'];
             }
             // Create a custom join to be used later for the completed sql query
             $this->custom_joins[] = array(" LEFT JOIN (SELECT d.data as custom_data_{$custom_course_id}, ctxt.instanceid as ctxt_instanceid_{$custom_course_id}\n                      FROM {context} ctxt\n                      JOIN {" . $data_table . "} d ON d.contextid = ctxt.id\n                      AND d.fieldid = {$custom_course_id}\n                      WHERE\n                      ctxt.contextlevel = " . CONTEXT_ELIS_COURSE . "\n                      AND {$view_field_filter}) custom_{$custom_course_id}\n                      ON cls.courseid = custom_{$custom_course_id}.{$course_id_field}", $params);
             $columns[] = new table_report_column('custom_' . $custom_course_id . '.custom_data_' . $custom_course_id, $fields[$custom_course_id]->name, 'custom_course_field', 'left');
         }
     }
     //add progress bar and students passing
     $columns[] = new table_report_horizontal_bar_column('COUNT(DISTINCT clsgr.id) AS stucompletedprogress', get_string('bar_column_progress', 'rlreport_course_progress_summary'), 'progress_bar', 'COUNT(DISTINCT ' . $DB->sql_concat('comp.id', "'_'", 'enrol.id') . ') AS numprogress', 'center', '$e');
     $columns[] = new table_report_column('SUM(CASE WHEN enrol.completestatusid = 2 THEN 1 ELSE 0 END) AS studentspassing', get_string('column_percent_passing', 'rlreport_course_progress_summary'), 'percent_passing', 'left');
     return $columns;
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:55,代码来源:course_progress_summary_report.class.php

示例5: get_data

 /**
  * Get data for enable fields for a single record.
  *
  * @param  object $record The current database record for the current row of data.
  *
  * @return array An array of additional data, indexed by field.
  */
 public function get_data($record)
 {
     global $CFG;
     require_once $CFG->dirroot . '/local/elisprogram/lib/setup.php';
     require_once elis::lib('data/customfield.class.php');
     require_once elispm::file('accesslib.php');
     $this->init_customfield_data();
     $date_format = get_string('date_format', 'dhexport_version1elis');
     $datetime_format = get_string('datetime_format', 'dhexport_version1elis');
     $extra_data = array();
     foreach ($this->customfield_data as $fieldid => $fieldrec) {
         $fieldkey = 'field_' . $fieldid;
         if (isset($this->enabled_fields[$fieldkey])) {
             $field_recparam = 'custom_field_' . $fieldid;
             if (isset($record->{$field_recparam}) || $record->{$field_recparam} === null) {
                 $field = new field($fieldrec);
                 $value = $record->{$field_recparam};
                 // Set field to default data if no data present.
                 if ($value === null) {
                     $value = $field->get_default();
                 }
                 // Handle multivalue fields.
                 if ($this->customfield_multivaluestatus[$field->id] !== static::MULTIVALUE_NONE) {
                     $context = \local_elisprogram\context\user::instance($record->userid);
                     $data = field_data::get_for_context_and_field($context, $field);
                     if ($this->customfield_multivaluestatus[$field->id] == static::MULTIVALUE_ENABLED) {
                         $parts = array();
                         foreach ($data as $datum) {
                             $parts[] = $datum->data;
                         }
                         $value = implode(' / ', $parts);
                     } else {
                         $value = $data->current()->data;
                     }
                 }
                 // Display datetime fields as formatted date/time.
                 if ($field->owners['manual']->param_control === 'datetime') {
                     if ($value == 0) {
                         // Use a marker to indicate that it's not set.
                         $value = get_string('nodatemarker', 'dhexport_version1elis');
                     } else {
                         if ($field->owners['manual']->param_inctime) {
                             // Date and time.
                             $value = date($datetime_format, $value);
                         } else {
                             // Just date.
                             $value = date($date_format, $value);
                         }
                     }
                 }
                 // Remove html from text.
                 $control = $field->owners['manual']->param_control;
                 if ($control === 'text' || $control === 'textarea') {
                     $value = trim(html_to_text($value), "\n\r");
                 }
                 $extra_data[$fieldkey] = $value;
             }
         }
     }
     return $extra_data;
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:68,代码来源:lib.php

示例6: array

 /**
  * Method that specifies the report's columns
  * (specifies various fields involving user info, clusters, class enrolment, and module information)
  *
  * @return  table_report_column array  The list of report columns
  */
 function get_columns()
 {
     global $CURMAN, $SESSION;
     //add custom fields here, first the Course name, then custom fields, then progress and % students passing
     $columns = array();
     $columns[] = new table_report_column('crs.name', get_string('column_course', 'rlreport_course_progress_summary'), 'course', 'left', true);
     $filter_params = php_report_filtering_get_active_filter_values($this->get_report_shortname(), 'field' . $this->get_report_shortname(), $this->filter);
     // Unserialize value of filter params to get field ids array
     $filter_params = @unserialize(base64_decode($filter_params[0]['value']));
     // Loop through these additional parameters - new columns, will  have to eventually pass the table etc...
     if (isset($filter_params) && is_array($filter_params)) {
         // Working with custom course fields - get all course fields
         $context = context_level_base::get_custom_context_level('course', 'block_curr_admin');
         $fields = field::get_for_context_level($context);
         foreach ($filter_params as $custom_course_id) {
             $custom_course_field = new field($custom_course_id);
             // Obtain custom field default values IFF set
             if (($default_value = $custom_course_field->get_default()) !== false) {
                 // save in array { record_field => default_value }
                 $this->field_default['custom_data_' . $custom_course_id] = $default_value;
             }
             //Find matching course field
             $course_field_title = $fields[$custom_course_id]->name;
             //Now, create a join statement for each custom course field and add it to the sql query
             $data_table = $CURMAN->db->prefix_table($custom_course_field->data_table());
             //field used to identify course id in custom field subquery
             $course_id_field = "ctxt_instanceid_{$custom_course_id}";
             //make sure the user can view fields for the current course
             $view_field_capability = block_php_report_field_capability($custom_course_field->owners);
             $view_field_contexts = get_contexts_by_capability_for_user('course', $view_field_capability, $this->userid);
             $view_field_filter = $view_field_contexts->sql_filter_for_context_level('ctxt.instanceid', 'course');
             // Create a custom join to be used later for the completed sql query
             $this->custom_joins[] = " LEFT JOIN (SELECT d.data as custom_data_{$custom_course_id}, ctxt.instanceid as ctxt_instanceid_{$custom_course_id}\n                FROM {$CURMAN->db->prefix_table('context')} ctxt\n                      JOIN {$data_table} d ON d.contextid = ctxt.id\n                      AND d.fieldid = {$custom_course_id}\n                      WHERE\n                      ctxt.contextlevel = {$context}\n                      AND {$view_field_filter}) custom_{$custom_course_id}\n                      ON cls.courseid = custom_{$custom_course_id}.{$course_id_field}";
             $columns[] = new table_report_column('custom_' . $custom_course_id . '.custom_data_' . $custom_course_id, $fields[$custom_course_id]->name, 'custom_course_field', 'left');
         }
     }
     //add progress bar and students passing
     $columns[] = new table_report_horizontal_bar_column('COUNT(DISTINCT clsgr.id) AS stucompletedprogress', get_string('bar_column_progress', 'rlreport_course_progress_summary'), 'progress_bar', 'COUNT(DISTINCT ' . sql_concat('comp.id', "'_'", 'enrol.id') . ') AS numprogress', 'center', '$e');
     $columns[] = new table_report_column('SUM(CASE WHEN enrol.completestatusid=2 THEN 1 ELSE 0 END) AS studentspassing', get_string('column_percent_passing', 'rlreport_course_progress_summary'), 'percent_passing', 'left');
     return $columns;
 }
开发者ID:remotelearner,项目名称:elis.reporting,代码行数:47,代码来源:course_progress_summary_report.class.php


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