/** * Log an action. * * @since 0.1 * * @param string $subType */ protected function log($subType) { if ($this->log) { $info = $this->getLogInfo($subType); if ($info !== false) { if ($this->revAction !== false) { $info['user'] = $this->revAction->getUser(); $info['comment'] = $this->revAction->getComment(); } $info['subtype'] = $subType; EPUtils::log($info); } } }
/** * Log an action. * * @since 0.1 * * @param string $subType */ protected function log($subType) { if ($this->log) { $info = $this->getLogInfo($subType); if ($info !== false) { $info['subtype'] = $subType; EPUtils::log($info); } } }
/** * Log a change of the instructors of the course. * * @since 0.1 * * @param string $action * @param array $instructors * @param string $message */ protected function logInstructorChange($action, array $instructors, $message) { $names = array(); foreach ($instructors as $userId) { $names[] = EPInstructor::newFromId($userId)->getName(); } $info = array('type' => 'instructor', 'subtype' => $action, 'title' => $this->getTitle(), 'parameters' => array('4::instructorcount' => count($names), '5::instructors' => $GLOBALS['wgLang']->listToText($names))); if ($message !== '') { $info['comment'] = $message; } EPUtils::log($info); }
/** * Log a change of the instructors of the course. * * @since 0.1 * * @param string $action * @param string $role * @param array $users * @param string $message */ protected function logRoleChange($action, $role, array $users, $message) { $names = array(); $classes = array('instructor' => 'EPInstructor', 'campus' => 'EPCA', 'online' => 'EPOA'); $class = $classes[$role]; foreach ($users as $userId) { $names[] = $class::newFromUserId($userId)->getName(); } $info = array('type' => $role, 'subtype' => $action, 'title' => $this->getTitle(), 'parameters' => array('4::instructorcount' => count($names), '5::instructors' => $GLOBALS['wgLang']->listToText($names))); if ($message !== '') { $info['comment'] = $message; } EPUtils::log($info); }