[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 18 namespace core_question\bank; 19 20 /** 21 * A column type for the name of the question last modifier. 22 * 23 * @copyright 2009 Tim Hunt 24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 25 */ 26 class modifier_name_column extends column_base { 27 public function get_name() { 28 return 'modifiername'; 29 } 30 31 protected function get_title() { 32 return get_string('lastmodifiedby', 'question'); 33 } 34 35 protected function display_content($question, $rowclasses) { 36 if (!empty($question->modifierfirstname) && !empty($question->modifierlastname)) { 37 $u = new \stdClass(); 38 $u = username_load_fields_from_object($u, $question, 'modifier'); 39 $date = userdate($question->timemodified, get_string('strftimedatetime', 'langconfig')); 40 echo fullname($u) . '<br>' . \html_writer::tag('span', $date, array('class' => 'date')); 41 } 42 } 43 44 public function get_extra_joins() { 45 return array('um' => 'LEFT JOIN {user} um ON um.id = q.modifiedby'); 46 } 47 48 public function get_required_fields() { 49 $allnames = get_all_user_name_fields(); 50 $requiredfields = array(); 51 foreach ($allnames as $allname) { 52 $requiredfields[] = 'um.' . $allname . ' AS modifier' . $allname; 53 } 54 $requiredfields[] = 'q.timemodified'; 55 return $requiredfields; 56 } 57 58 public function is_sortable() { 59 return array( 60 'firstname' => array('field' => 'um.firstname', 'title' => get_string('firstname')), 61 'lastname' => array('field' => 'um.lastname', 'title' => get_string('lastname')), 62 'timemodified' => array('field' => 'q.timemodified', 'title' => get_string('date')) 63 ); 64 } 65 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |