Файл: concrete5.7.5.6/concrete/blocks/dashboard_site_activity/controller.php
Строк: 44
<?php
namespace ConcreteBlockDashboardSiteActivity;
use Loader;
use Core;
use ConcreteCoreBlockBlockController;
use User;
use UserInfo;
use ConcreteCoreUserStatistics as UserStatistics;
use ConcreteBlockFormStatistics as FormBlockStatistics;
use ConcreteCorePageStatistics as PageStatistics;
class Controller extends BlockController
{
protected $btCacheBlockRecord = true;
protected $btIsInternal = true;
public function getBlockTypeDescription()
{
return t("Displays a summary of website activity.");
}
public function getBlockTypeName()
{
return t("Dashboard Site Activity");
}
public function view()
{
$u = new User();
$ui = UserInfo::getByID($u->getUserID());
$dh = Core::make('helper/date'); /* @var $dh ConcreteCoreLocalizationServiceDate */
if (is_object($ui)) {
$this->set('uLastLogin', $dh->formatDateTime($ui->getLastLogin()));
$this->set('uName', $ui->getUserName());
$this->set('lastEditSite', $dh->formatDateTime(PageStatistics::getSiteLastEdit()));
$llu = UserStatistics::getLastLoggedInUser();
if ($llu->getUserID() == $u->getUserID()) {
$this->set('lastLoginSite', t('Your login is the most recent.'));
} else {
$this->set('lastLoginSite', $dh->formatDateTime($llu->getLastLogin()));
}
}
$this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
$now = new DateTime('now', $dh->getTimezone('user'));
$this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions($now->format('Y-m-d')));
}
}