Example #1
0
 public static function recordActionInternal($owner, $text)
 {
     if ($owner->classNameShort() == UserLog::classNameShort() || $owner->classNameShort() == Session::classNameShort() || Mindy::app()->getUser()->is_staff === false) {
         return;
     } else {
         $url = method_exists($owner, 'getAbsoluteUrl') ? $owner->getAbsoluteUrl() : null;
         $message = strtr('{model} {url} ' . $text, ['{model}' => $owner->classNameShort()]);
         $app = Mindy::app();
         $module = $owner->getModule();
         UserLog::objects()->create(['user' => $app->getUser()->getIsGuest() ? null : $app->getUser(), 'module' => $owner->getModuleName(), 'model' => $owner->classNameShort(), 'url' => $url, 'ip' => $app->getUser()->getIp(), 'name' => (string) $owner, 'message' => $module->t($message, ['{url}' => $url ? "<a href='" . $owner->getAbsoluteUrl() . "'>" . (string) $owner . "</a>" : (string) $owner])]);
     }
 }