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

PHP get_log_manager函数代码示例

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

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



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

示例1: store

 /**
  * Redirect all events to this log manager, but only if this
  * log manager is actually used.
  *
  * @param \core\event\base $event
  */
 public static function store(\core\event\base $event)
 {
     $logmanager = get_log_manager();
     if (get_class($logmanager) === 'tool_log\\log\\manager') {
         /** @var \tool_log\log\manager $logmanager */
         $logmanager->process($event);
     }
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:14,代码来源:observer.php


示例2: execute

 /**
  * Do the job.
  * Throw exceptions on errors (the job will be retried).
  */
 public function execute()
 {
     global $DB;
     $manager = get_log_manager();
     $store = new store($manager);
     $events = $DB->get_records('logstore_xapi_log');
     $store->process_events($events);
     $DB->delete_records_list('logstore_xapi_log', 'id', array_keys($events));
     mtrace("Sent learning records to LRS.");
 }
开发者ID:ninelanterns,项目名称:moodle-logstore_xapi,代码行数:14,代码来源:emit_task.php


示例3: add_to_log

/**
 * Add an entry to the legacy log table.
 *
 * @deprecated since 2.7 use new events instead
 *
 * @param    int     $courseid  The course id
 * @param    string  $module  The module name  e.g. forum, journal, resource, course, user etc
 * @param    string  $action  'view', 'update', 'add' or 'delete', possibly followed by another word to clarify.
 * @param    string  $url     The file and parameters used to see the results of the action
 * @param    string  $info    Additional description information
 * @param    int     $cm      The course_module->id if there is one
 * @param    int|stdClass $user If log regards $user other than $USER
 * @return void
 */
function add_to_log($courseid, $module, $action, $url = '', $info = '', $cm = 0, $user = 0)
{
    debugging('add_to_log() has been deprecated, please rewrite your code to the new events API', DEBUG_DEVELOPER);
    // This is a nasty hack that allows us to put all the legacy stuff into legacy storage,
    // this way we may move all the legacy settings there too.
    $manager = get_log_manager();
    if (method_exists($manager, 'legacy_add_to_log')) {
        $manager->legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user);
    }
}
开发者ID:evltuma,项目名称:moodle,代码行数:24,代码来源:deprecatedlib.php


示例4: oauth_add_to_log

/**
 * oauth_add_to_log is a quick hack to avoid add_to_log debugging
 */
function oauth_add_to_log($courseid, $module, $action, $url = '', $info = '', $cm = 0, $user = 0)
{
    if (function_exists('get_log_manager')) {
        $manager = get_log_manager();
        $manager->legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user);
    } else {
        if (function_exists('add_to_log')) {
            add_to_log($courseid, $module, $action, $url, $info, $cm, $user);
        }
    }
}
开发者ID:rodrigocnovos,项目名称:moodle-auth_googleoauth2,代码行数:14,代码来源:lib.php


示例5: test_report_participation_supports_logstore

 /**
  * Test report_log_supports_logstore.
  */
 public function test_report_participation_supports_logstore()
 {
     $logmanager = get_log_manager();
     $allstores = \core_component::get_plugin_list_with_class('logstore', 'log\\store');
     $supportedstores = array('logstore_legacy' => '\\logstore_legacy\\log\\store', 'logstore_standard' => '\\logstore_standard\\log\\store');
     // Make sure all supported stores are installed.
     $expectedstores = array_keys(array_intersect($allstores, $supportedstores));
     $stores = $logmanager->get_supported_logstores('report_outline');
     $stores = array_keys($stores);
     foreach ($expectedstores as $expectedstore) {
         $this->assertContains($expectedstore, $stores);
     }
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:16,代码来源:lib_test.php


示例6: report_participation_get_log_table_name

/**
 * Returns log table name of preferred reader, if leagcy then return empty string.
 *
 * @return string table name
 */
function report_participation_get_log_table_name()
{
    // Get prefered sql_internal_table_reader reader (if enabled).
    $logmanager = get_log_manager();
    $readers = $logmanager->get_readers();
    $logtable = '';
    // Get preferred reader.
    if (!empty($readers)) {
        foreach ($readers as $readerpluginname => $reader) {
            // If legacy reader is preferred reader.
            if ($readerpluginname == 'logstore_legacy') {
                break;
            }
            // If sql_internal_table_reader is preferred reader.
            if ($reader instanceof \core\log\sql_internal_table_reader) {
                $logtable = $reader->get_internal_log_table_name();
                break;
            }
        }
    }
    return $logtable;
}
开发者ID:evltuma,项目名称:moodle,代码行数:27,代码来源:locallib.php


示例7: report_outline_get_common_log_variables

/**
 * Returns an array of the commonly used log variables by the outline report.
 *
 * @return array the array of variables used
 */
function report_outline_get_common_log_variables()
{
    global $DB;
    static $uselegacyreader;
    static $useinternalreader;
    static $minloginternalreader;
    static $logtable = null;
    if (isset($uselegacyreader) && isset($useinternalreader) && isset($minloginternalreader)) {
        return array($uselegacyreader, $useinternalreader, $minloginternalreader, $logtable);
    }
    $uselegacyreader = false;
    // Flag to determine if we should use the legacy reader.
    $useinternalreader = false;
    // Flag to determine if we should use the internal reader.
    $minloginternalreader = 0;
    // Set this to 0 for now.
    // Get list of readers.
    $logmanager = get_log_manager();
    $readers = $logmanager->get_readers();
    // Get preferred reader.
    if (!empty($readers)) {
        foreach ($readers as $readerpluginname => $reader) {
            // If legacy reader is preferred reader.
            if ($readerpluginname == 'logstore_legacy') {
                $uselegacyreader = true;
                break;
            }
            // If sql_internal_reader is preferred reader.
            if ($reader instanceof \core\log\sql_internal_reader) {
                $useinternalreader = true;
                $logtable = $reader->get_internal_log_table_name();
                $minloginternalreader = $DB->get_field_sql('SELECT min(timecreated) FROM {' . $logtable . '}');
                break;
            }
        }
    }
    return array($uselegacyreader, $useinternalreader, $minloginternalreader, $logtable);
}
开发者ID:abhilash1994,项目名称:moodle,代码行数:43,代码来源:locallib.php


示例8: test_get_log_manager

 public function test_get_log_manager()
 {
     global $CFG;
     $this->resetAfterTest();
     $manager = get_log_manager();
     $this->assertInstanceOf('core\\log\\manager', $manager);
     $stores = $manager->get_readers();
     $this->assertInternalType('array', $stores);
     $this->assertCount(0, $stores);
     $this->assertFileExists("{$CFG->dirroot}/{$CFG->admin}/tool/log/store/standard/version.php");
     $this->assertFileExists("{$CFG->dirroot}/{$CFG->admin}/tool/log/store/legacy/version.php");
     set_config('enabled_stores', 'logstore_standard,logstore_legacy', 'tool_log');
     $manager = get_log_manager(true);
     $this->assertInstanceOf('core\\log\\manager', $manager);
     $stores = $manager->get_readers();
     $this->assertInternalType('array', $stores);
     $this->assertCount(2, $stores);
     foreach ($stores as $key => $store) {
         $this->assertInternalType('string', $key);
         $this->assertInstanceOf('core\\log\\sql_select_reader', $store);
     }
     $stores = $manager->get_readers('core\\log\\sql_internal_reader');
     $this->assertInternalType('array', $stores);
     $this->assertCount(1, $stores);
     foreach ($stores as $key => $store) {
         $this->assertInternalType('string', $key);
         $this->assertSame('logstore_standard', $key);
         $this->assertInstanceOf('core\\log\\sql_internal_reader', $store);
     }
     $stores = $manager->get_readers('core\\log\\sql_select_reader');
     $this->assertInternalType('array', $stores);
     $this->assertCount(2, $stores);
     foreach ($stores as $key => $store) {
         $this->assertInternalType('string', $key);
         $this->assertInstanceOf('core\\log\\sql_select_reader', $store);
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:37,代码来源:manager_test.php


示例9: trigger

 /**
  * Trigger event.
  */
 public final function trigger()
 {
     global $CFG;
     if ($this->restored) {
         throw new \coding_exception('Can not trigger restored event');
     }
     if ($this->triggered or $this->dispatched) {
         throw new \coding_exception('Can not trigger event twice');
     }
     $this->validate_before_trigger();
     $this->triggered = true;
     if (isset($CFG->loglifetime) and $CFG->loglifetime != -1) {
         if ($data = $this->get_legacy_logdata()) {
             $manager = get_log_manager();
             if (method_exists($manager, 'legacy_add_to_log')) {
                 if (is_array($data[0])) {
                     // Some events require several entries in 'log' table.
                     foreach ($data as $d) {
                         call_user_func_array(array($manager, 'legacy_add_to_log'), $d);
                     }
                 } else {
                     call_user_func_array(array($manager, 'legacy_add_to_log'), $data);
                 }
             }
         }
     }
     if (PHPUNIT_TEST and \phpunit_util::is_redirecting_events()) {
         $this->dispatched = true;
         \phpunit_util::event_triggered($this);
         return;
     }
     \core\event\manager::dispatch($this);
     $this->dispatched = true;
     if ($legacyeventname = static::get_legacy_eventname()) {
         events_trigger_legacy($legacyeventname, $this->get_legacy_eventdata());
     }
 }
开发者ID:CCIE-FIUSAC,项目名称:moodle,代码行数:40,代码来源:base.php


示例10: stats_temp_table_fill

/**
 * Fills the temporary stats tables with new data
 *
 * This function is meant to be called to get a new day of data
 *
 * @param int timestamp of the start time of logs view
 * @param int timestamp of the end time of logs view
 * @return bool success (true) or failure(false)
 */
function stats_temp_table_fill($timestart, $timeend)
{
    global $DB;
    // First decide from where we want the data.
    $params = array('timestart' => $timestart, 'timeend' => $timeend, 'participating' => \core\event\base::LEVEL_PARTICIPATING, 'teaching' => \core\event\base::LEVEL_TEACHING, 'loginevent1' => '\\core\\event\\user_loggedin', 'loginevent2' => '\\core\\event\\user_loggedin');
    $filled = false;
    $manager = get_log_manager();
    $stores = $manager->get_readers();
    foreach ($stores as $store) {
        if ($store instanceof \core\log\sql_internal_table_reader) {
            $logtable = $store->get_internal_log_table_name();
            if (!$logtable) {
                continue;
            }
            $sql = "SELECT COUNT('x')\n                      FROM {{$logtable}}\n                     WHERE timecreated >= :timestart AND timecreated < :timeend";
            if (!$DB->get_field_sql($sql, $params)) {
                continue;
            }
            // Let's fake the old records using new log data.
            // We want only data relevant to educational process
            // done by real users.
            $sql = "INSERT INTO {temp_log1} (userid, course, action)\n\n            SELECT userid,\n                   CASE\n                      WHEN courseid IS NULL THEN " . SITEID . "\n                      WHEN courseid = 0 THEN " . SITEID . "\n                      ELSE courseid\n                   END,\n                   CASE\n                       WHEN eventname = :loginevent1 THEN 'login'\n                       WHEN crud = 'r' THEN 'view'\n                       ELSE 'update'\n                   END\n              FROM {{$logtable}}\n             WHERE timecreated >= :timestart AND timecreated < :timeend\n                   AND (origin = 'web' OR origin = 'ws')\n                   AND (edulevel = :participating OR edulevel = :teaching OR eventname = :loginevent2)";
            $DB->execute($sql, $params);
            $filled = true;
        }
    }
    if (!$filled) {
        // Fallback to legacy data.
        $sql = "INSERT INTO {temp_log1} (userid, course, action)\n\n            SELECT userid, course, action\n              FROM {log}\n             WHERE time >= :timestart AND time < :timeend";
        $DB->execute($sql, $params);
    }
    $sql = 'INSERT INTO {temp_log2} (userid, course, action)

            SELECT userid, course, action FROM {temp_log1}';
    $DB->execute($sql);
    // We have just loaded all the temp tables, collect statistics for that.
    $DB->update_temp_table_stats();
    return true;
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:48,代码来源:statslib.php


示例11: __construct

 function __construct()
 {
     $this->logger = get_log_manager()->get_readers()['logstore_standard'];
 }
开发者ID:amsibsam,项目名称:moodle3,代码行数:4,代码来源:Course.php


示例12: get_course_time

 /**
  * Get the time the user has spent in the course
  * 
  * @param int $userid User ID (default= $USER->id)
  * @return int the total time spent in seconds
  */
 public function get_course_time($user = null)
 {
     global $CFG, $USER;
     if (empty($user)) {
         $userid = $USER->id;
     } else {
         if (is_object($user)) {
             $userid = $user->id;
         } else {
             $userid = $user;
         }
     }
     $manager = get_log_manager();
     $selectreaders = $manager->get_readers('\\core\\log\\sql_reader');
     $reader = reset($selectreaders);
     //This can take a log time to process, but it's accurate
     // it's can be done by get only first and last log entry creation time,
     // but it's far more inaccurate,  could have an option to choose.
     set_time_limit(0);
     $totaltime = 0;
     $sql = "action = 'viewed' AND target = 'course' AND courseid = :courseid AND userid = :userid";
     if ($logs = $reader->get_events_select($sql, array('courseid' => $this->get_course()->id, 'userid' => $userid), 'timecreated ASC', '', '')) {
         foreach ($logs as $log) {
             if (empty($login)) {
                 // For the first time $login is not set so the first log is also the first login
                 $login = $log->timecreated;
                 $lasthit = $log->timecreated;
             }
             $delay = $log->timecreated - $lasthit;
             if (!($delay > $CFG->sessiontimeout)) {
                 // The difference between the last log and the current log is more than
                 // the timeout
                 //Register session value so that we have found a new session!
                 $totaltime += $delay;
             }
             // Now the actual log became the previous log for the next cycle
             $lasthit = $log->timecreated;
         }
     }
     return $totaltime / 60;
 }
开发者ID:seducto,项目名称:moodle-mod_simplecertificate,代码行数:47,代码来源:locallib.php


示例13: test_get_supported_reports

 /**
  * Test logmanager::get_supported_reports returns all reports that require this store.
  */
 public function test_get_supported_reports()
 {
     $logmanager = get_log_manager();
     $allreports = \core_component::get_plugin_list('report');
     $supportedreports = array('report_log' => '/report/log', 'report_loglive' => '/report/loglive', 'report_outline' => '/report/outline', 'report_participation' => '/report/participation', 'report_stats' => '/report/stats');
     // Make sure all supported reports are installed.
     $expectedreports = array_keys(array_intersect_key($allreports, $supportedreports));
     $reports = $logmanager->get_supported_reports('logstore_standard');
     $reports = array_keys($reports);
     foreach ($expectedreports as $expectedreport) {
         $this->assertContains($expectedreport, $reports);
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:16,代码来源:store_test.php


示例14: local_my_get_logstore_info

function local_my_get_logstore_info()
{
    $logmanager = get_log_manager();
    $readers = $logmanager->get_readers('\\core\\log\\sql_select_reader');
    $reader = reset($readers);
    if (empty($reader)) {
        return false;
        // No log reader found.
    }
    $logstoreinfo = new StdClass();
    if ($reader instanceof \logstore_standard\log\store) {
        $logstoreinfo->table = 'logstore_standard_log';
        $logstoreinfo->courseparam = 'courseid';
        $logstoreinfo->timeparam = 'timecreated';
    } else {
        if ($reader instanceof \logstore_legacy\log\store) {
            $logstoreinfo->table = 'log';
            $logstoreinfo->courseparam = 'course';
            $logstoreinfo->timeparam = 'time';
        } else {
            return;
        }
    }
    return $logstoreinfo;
}
开发者ID:vfremaux,项目名称:moodle-local_my,代码行数:25,代码来源:lib.php


示例15: process_log

 protected function process_log($data)
 {
     global $DB;
     $data = (object) $data;
     $data->time = $this->apply_date_offset($data->time);
     $data->userid = $this->get_mappingid('user', $data->userid);
     $data->course = $this->get_courseid();
     $data->cmid = $this->task->get_moduleid();
     // For any reason user wasn't remapped ok, stop processing this
     if (empty($data->userid)) {
         return;
     }
     // Everything ready, let's delegate to the restore_logs_processor
     // Set some fixed values that will save tons of DB requests
     $values = array('course' => $this->get_courseid(), 'course_module' => $this->task->get_moduleid(), $this->task->get_modulename() => $this->task->get_activityid());
     // Get instance and process log record
     $data = restore_logs_processor::get_instance($this->task, $values)->process_log_record($data);
     // If we have data, insert it, else something went wrong in the restore_logs_processor
     if ($data) {
         if (empty($data->url)) {
             $data->url = '';
         }
         if (empty($data->info)) {
             $data->info = '';
         }
         // Store the data in the legacy log table if we are still using it.
         $manager = get_log_manager();
         if (method_exists($manager, 'legacy_add_to_log')) {
             $manager->legacy_add_to_log($data->course, $data->module, $data->action, $data->url, $data->info, $data->cmid, $data->userid);
         }
     }
 }
开发者ID:Jinelle,项目名称:moodle,代码行数:32,代码来源:restore_stepslib.php


示例16: can_delete_course

/**
 * Can the current user delete this course?
 * Course creators have exception,
 * 1 day after the creation they can sill delete the course.
 * @param int $courseid
 * @return boolean
 */
function can_delete_course($courseid)
{
    global $USER;
    $context = context_course::instance($courseid);
    if (has_capability('moodle/course:delete', $context)) {
        return true;
    }
    // hack: now try to find out if creator created this course recently (1 day)
    if (!has_capability('moodle/course:create', $context)) {
        return false;
    }
    $since = time() - 60 * 60 * 24;
    $course = get_course($courseid);
    if ($course->timecreated < $since) {
        return false;
        // Return if the course was not created in last 24 hours.
    }
    $logmanger = get_log_manager();
    $readers = $logmanger->get_readers('\\core\\log\\sql_reader');
    $reader = reset($readers);
    if (empty($reader)) {
        return false;
        // No log reader found.
    }
    // A proper reader.
    $select = "userid = :userid AND courseid = :courseid AND eventname = :eventname AND timecreated > :since";
    $params = array('userid' => $USER->id, 'since' => $since, 'courseid' => $course->id, 'eventname' => '\\core\\event\\course_created');
    return (bool) $reader->get_events_select_count($select, $params);
}
开发者ID:rushi963,项目名称:moodle,代码行数:36,代码来源:lib.php


示例17: test_events_traversable

 /**
  * Test sql_reader::get_events_select_iterator.
  * @return void
  */
 public function test_events_traversable()
 {
     global $DB;
     $this->resetAfterTest();
     $this->preventResetByRollback();
     $this->setAdminUser();
     set_config('enabled_stores', 'logstore_standard', 'tool_log');
     $manager = get_log_manager(true);
     $stores = $manager->get_readers();
     $store = $stores['logstore_standard'];
     $events = $store->get_events_select_iterator('', array(), '', 0, 0);
     $this->assertFalse($events->valid());
     // Here it should be already closed, but we should be allowed to
     // over-close it without exception.
     $events->close();
     $user = $this->getDataGenerator()->create_user();
     for ($i = 0; $i < 1000; $i++) {
         \core\event\user_created::create_from_userid($user->id)->trigger();
     }
     $store->flush();
     // Check some various sizes get the right number of elements.
     $this->assertEquals(1, iterator_count($store->get_events_select_iterator('', array(), '', 0, 1)));
     $this->assertEquals(2, iterator_count($store->get_events_select_iterator('', array(), '', 0, 2)));
     $iterator = $store->get_events_select_iterator('', array(), '', 0, 500);
     $this->assertInstanceOf('\\core\\event\\base', $iterator->current());
     $this->assertEquals(500, iterator_count($iterator));
     $iterator->close();
     // Look for non-linear memory usage for the iterator version.
     $mem = memory_get_usage();
     $events = $store->get_events_select('', array(), '', 0, 0);
     $arraymemusage = memory_get_usage() - $mem;
     $mem = memory_get_usage();
     $eventsit = $store->get_events_select_iterator('', array(), '', 0, 0);
     $eventsit->close();
     $itmemusage = memory_get_usage() - $mem;
     $this->assertInstanceOf('\\Traversable', $eventsit);
     $this->assertLessThan($arraymemusage / 10, $itmemusage);
     set_config('enabled_stores', '', 'tool_log');
     get_log_manager(true);
 }
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:44,代码来源:store_test.php


示例18: get_readers

 /**
  * Get a list of enabled sql_reader objects/name
  *
  * @param bool $nameonly if true only reader names will be returned.
  * @return array core\log\sql_reader object or name.
  */
 public function get_readers($nameonly = false)
 {
     if (!isset($this->logmanager)) {
         $this->logmanager = get_log_manager();
     }
     $readers = $this->logmanager->get_readers('core\\log\\sql_reader');
     if ($nameonly) {
         foreach ($readers as $pluginname => $reader) {
             $readers[$pluginname] = $reader->get_name();
         }
     }
     return $readers;
 }
开发者ID:sirromas,项目名称:lms,代码行数:19,代码来源:renderable.php


示例19: array

    }
    $plugins[$plugin] = $strpluginname;
}
core_collator::asort($plugins);
$like = $DB->sql_like('plugin', '?', true, true, false, '|');
$params = array('report|_%');
$installed = $DB->get_records_select('config_plugins', "{$like} AND name = 'version'", $params);
$versions = array();
foreach ($installed as $config) {
    $name = preg_replace('/^report_/', '', $config->plugin);
    $versions[$name] = $config->value;
    if (!isset($plugins[$name])) {
        $plugins[$name] = $name;
    }
}
$logmanager = get_log_manager();
foreach ($plugins as $plugin => $name) {
    $uninstall = '';
    if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('report_' . $plugin, 'manage')) {
        $uninstall = html_writer::link($uninstallurl, $struninstall);
    }
    $stores = $logmanager->get_supported_logstores('report_' . $plugin);
    if ($stores === false) {
        $supportedstores = get_string('logstorenotrequired', 'admin');
    } else {
        if (!empty($stores)) {
            $supportedstores = implode(', ', $stores);
        } else {
            $supportedstores = get_string('nosupportedlogstore', 'admin');
        }
    }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:reports.php


示例20: report_log_userday

/**
 * Select all log records for a given course, user, and day
 *
 * @param int $userid The id of the user as found in the 'user' table.
 * @param int $courseid The id of the course as found in the 'course' table.
 * @param string $daystart unix timestamp of the start of the day for which the logs needs to be retrived
 * @param string $logreader log reader to use.
 * @return array
 */
function report_log_userday($userid, $courseid, $daystart, $logreader = '')
{
    global $DB;
    $logmanager = get_log_manager();
    $readers = $logmanager->get_readers();
    if (empty($logreader)) {
        $reader = reset($readers);
    } else {
        $reader = $readers[$logreader];
    }
    // If reader is not a sql_internal_table_reader and not legacy store then return.
    if (!$reader instanceof \core\log\sql_internal_table_reader && !$reader instanceof logstore_legacy\log\store) {
        return array();
    }
    $daystart = (int) $daystart;
    // Note: unfortunately pg complains if you use name parameter or column alias in GROUP BY.
    if ($reader instanceof logstore_legacy\log\store) {
        $logtable = 'log';
        $timefield = 'time';
        $coursefield = 'course';
        // Anonymous actions are never logged in legacy log.
        $nonanonymous = '';
    } else {
        $logtable = $reader->get_internal_log_table_name();
        $timefield = 'timecreated';
        $coursefield = 'courseid';
        $nonanonymous = 'AND anonymous = 0';
    }
    $params = array('userid' => $userid);
    $courseselect = '';
    if ($courseid) {
        $courseselect = "AND {$coursefield} = :courseid";
        $params['courseid'] = $courseid;
    }
    return $DB->get_records_sql("SELECT FLOOR(({$timefield} - {$daystart})/" . HOURSECS . ") AS hour, COUNT(*) AS num\n                                   FROM {" . $logtable . "}\n                                  WHERE userid = :userid\n                                        AND {$timefield} > {$daystart} {$courseselect} {$nonanonymous}\n                               GROUP BY FLOOR(({$timefield} - {$daystart})/" . HOURSECS . ") ", $params);
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:45,代码来源:locallib.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_logadd函数代码示例发布时间:2022-05-15
下一篇:
PHP get_locations函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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