summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/php/controls/CalendarScaffold.php4
-rw-r--r--app/php/controls/UpcomingEvents.php4
-rw-r--r--app/php/controls/UrlBasedCalendarControl.php2
-rw-r--r--app/php/controls/UserSelection.php4
-rw-r--r--app/php/dto/TimezoneDTO.php2
-rw-r--r--app/php/facades/CalendarFacade.php8
-rw-r--r--app/php/facades/EventFacade.php5
-rw-r--r--app/php/facades/UserFacade.php16
-rw-r--r--app/php/web/ClientScriptManager.php27
-rw-r--r--app/php/web/TemplateControl.php14
10 files changed, 45 insertions, 41 deletions
diff --git a/app/php/controls/CalendarScaffold.php b/app/php/controls/CalendarScaffold.php
index 1a25cce..c95cce7 100644
--- a/app/php/controls/CalendarScaffold.php
+++ b/app/php/controls/CalendarScaffold.php
@@ -31,7 +31,7 @@ class CalendarScaffold extends FacadeTemplateControl {
}
}
- private function _rebindData($refresh = FALSE) {
+ private function _rebindData(bool $refresh = FALSE) {
$this->_rebindCategoryList(
$this->_getCategories()
);
@@ -40,7 +40,7 @@ class CalendarScaffold extends FacadeTemplateControl {
);
}
- private function _getCalendars($refresh = FALSE) {
+ private function _getCalendars(bool $refresh = FALSE) {
if ($refresh) {
$this->clearViewState('Calendars');
}
diff --git a/app/php/controls/UpcomingEvents.php b/app/php/controls/UpcomingEvents.php
index ac0271b..27fc723 100644
--- a/app/php/controls/UpcomingEvents.php
+++ b/app/php/controls/UpcomingEvents.php
@@ -1,7 +1,7 @@
<?php
Prado::using('Application.web.FacadeTemplateControl');
-
+Prado::using('Application.user.DbUser');
Prado::using('Application.facades.EventFacade');
class UpcomingEvents extends FacadeTemplateControl {
@@ -10,7 +10,7 @@ class UpcomingEvents extends FacadeTemplateControl {
return $this->getControlState('user');
}
- public function setUserToDisplay($user) {
+ public function setUserToDisplay(DbUser $user) {
$this->setControlState('user', $user);
}
diff --git a/app/php/controls/UrlBasedCalendarControl.php b/app/php/controls/UrlBasedCalendarControl.php
index b3e2253..c61bc37 100644
--- a/app/php/controls/UrlBasedCalendarControl.php
+++ b/app/php/controls/UrlBasedCalendarControl.php
@@ -5,7 +5,7 @@ Prado::using('Application.facades.CalendarFacade');
class UrlBasedCalendarControl extends FacadeTemplateControl {
- public function setCalendarUrl($url) {
+ public function setCalendarUrl(string $url = NULL) {
if ($url) {
$calendar = $this->getFacade()->resolveUrl($url);
if ($calendar) {
diff --git a/app/php/controls/UserSelection.php b/app/php/controls/UserSelection.php
index d215d7b..233f0bf 100644
--- a/app/php/controls/UserSelection.php
+++ b/app/php/controls/UserSelection.php
@@ -1,7 +1,7 @@
<?php
Prado::using('Application.web.FacadeTemplateControl');
-
+Prado::using('Application.user.DbUser');
Prado::using('Application.facades.CalendarFacade');
class UserSelection extends FacadeTemplateControl {
@@ -10,7 +10,7 @@ class UserSelection extends FacadeTemplateControl {
return $this->getControlState('user');
}
- public function setUserToDisplay($user) {
+ public function setUserToDisplay(DbUser $user = NULL) {
$this->setControlState('user', $user);
}
diff --git a/app/php/dto/TimezoneDTO.php b/app/php/dto/TimezoneDTO.php
index 5f89cca..e4078e6 100644
--- a/app/php/dto/TimezoneDTO.php
+++ b/app/php/dto/TimezoneDTO.php
@@ -10,7 +10,7 @@ class TimezoneDTO {
public $Location;
public $FirstDayOfTheWeek;
- public function __construct($name) {
+ public function __construct(string $name) {
$tz = new DateTimeZone($name);
$this->Name = $tz->getName();
$this->Offset = $tz->getOffset(new DateTime());
diff --git a/app/php/facades/CalendarFacade.php b/app/php/facades/CalendarFacade.php
index 5f24e28..48dda8e 100644
--- a/app/php/facades/CalendarFacade.php
+++ b/app/php/facades/CalendarFacade.php
@@ -96,7 +96,7 @@ class CalendarFacade extends Facade {
$preference->save();
}
- public function setPreferredCalendars(User $user, $calendars) {
+ public function setPreferredCalendars(User $user, array $calendars) {
//TODO: remove old preference, optionally
$transaction = $this->beginTransaction();
try {
@@ -113,7 +113,7 @@ class CalendarFacade extends Facade {
public function getEventsForTimeframe(CalendarDTO $calendar,
DateTime $dateFrom,
DateTime $dateTo,
- $order = 'ASC') {
+ string $order = 'ASC') {
$calendar = Calendar::finder()->findAllByUID($calendar->ID);
if ($calendar) {
$events = EventFacade::getInstance()->getEventList(
@@ -164,7 +164,7 @@ class CalendarFacade extends Facade {
}
private $_urlCache = [];
- private function _fillUrlCache($record) {
+ private function _fillUrlCache(Calendar $record = NULL) {
if ($record && $record->CustomUrl
&& !isset($this->_urlCache[$record->CustomUrl])) {
$dto = new CalendarDTO();
@@ -177,7 +177,7 @@ class CalendarFacade extends Facade {
}
}
- public function resolveUrl($url) {
+ public function resolveUrl(string $url = NULL) {
if ($url) {
if (isset($this->_urlCache[$url])) {
return $this->_urlCache[$url];
diff --git a/app/php/facades/EventFacade.php b/app/php/facades/EventFacade.php
index 08133bc..6c51716 100644
--- a/app/php/facades/EventFacade.php
+++ b/app/php/facades/EventFacade.php
@@ -2,13 +2,16 @@
Prado::using('Application.facades.Facade');
Prado::using('Application.dto.EventDTO');
+Prado::using('Application.dto.GridEventDTO');
+Prado::using('Application.dto.CalendarGridDTO');
Prado::using('Application.model.Calendar');
Prado::using('Application.facades.CalendarFacade');
Prado::using('Application.user.DbUser');
class EventFacade extends Facade {
- public function getEventList($dateFrom=NULL, $dateTo=NULL, $calendars=NULL, $order='ASC') {
+ public function getEventList(string $dateFrom=NULL, string $dateTo=NULL,
+ array $calendars=NULL, string $order='ASC') {
$calendarClause = '1=1';
if ($calendars) {
$calendarClause = sprintf(
diff --git a/app/php/facades/UserFacade.php b/app/php/facades/UserFacade.php
index 69d634a..3fbd62d 100644
--- a/app/php/facades/UserFacade.php
+++ b/app/php/facades/UserFacade.php
@@ -7,15 +7,15 @@ Prado::using('Application.dto.TimezoneDTO');
class UserFacade extends Facade {
- public function findByLogin($login) {
+ public function findByLogin(string $login) {
return User::finder()->findByLogin($login);
}
- public function checkForUsername($login) {
+ public function checkForUsername(string $login) {
return !User::finder()->count('login = ?', $login);
}
- public function registerUser($login, $password, $admin) {
+ public function registerUser(string $login, string $password, bool $admin) {
$transaction = $this->beginTransaction();
try {
$newUser = new User();
@@ -32,27 +32,27 @@ class UserFacade extends Facade {
}
}
- public function changePassword(DbUser $user, $pass) {
+ public function changePassword(DbUser $user, string $pass) {
if (!$user->IsGuest) {
$user->DbRecord->Password = $this->generatePassword($pass);
$user->DbRecord->save();
}
}
- public function verifyUserPassword($password, DbUser $user) {
+ public function verifyUserPassword(string $password, DbUser $user) {
$dbPassword = $user->IsGuest ? '' : $user->DbRecord->Password;
return $this->verifyPassword($password, $dbPassword);
}
- public function generatePassword($password) {
+ public function generatePassword(string $password) {
return password_hash($password, PASSWORD_DEFAULT);
}
- public function verifyPassword($password, $dbPassword) {
+ public function verifyPassword(string $password, string $dbPassword) {
return password_verify($password, $dbPassword);
}
- public function setTimezonePreference(DbUser $user, $timezone) {
+ public function setTimezonePreference(DbUser $user, string $timezone) {
if ($user->IsGuest) {
throw new TInvalidDataException(
'Timezone preference change impossible for guest user'
diff --git a/app/php/web/ClientScriptManager.php b/app/php/web/ClientScriptManager.php
index 3b60b7a..5ef0a4d 100644
--- a/app/php/web/ClientScriptManager.php
+++ b/app/php/web/ClientScriptManager.php
@@ -16,7 +16,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Translate URLs to filesystem paths, index return array by URLs
- private function _getBasePaths($urls) {
+ private function _getBasePaths(array $urls) {
$basePath = $this->_getBasePath();
return array_combine(
$urls,
@@ -30,7 +30,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Base cache path, suffixed with subdirectory, create on demand
- private function _getCachePath($subdir = 'assets') {
+ private function _getCachePath(string $subdir = 'assets') {
$cachePath = $this->Application->RuntimePath
. DIRECTORY_SEPARATOR
. $subdir;
@@ -57,7 +57,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Cache key for specific file set, including current theme
- private function _getFileCollectionCacheKey($files) {
+ private function _getFileCollectionCacheKey(array $files) {
sort($files);
if ($this->_page->Theme) {
$files[] = $this->_page->Theme->Name;
@@ -66,7 +66,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Last modification time of a file set
- private function _getFileCollectionMTime($files) {
+ private function _getFileCollectionMTime(array $files) {
return max(array_map('filemtime', $files));
}
@@ -104,7 +104,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Check cache file validity, comparing to source file set
- private function _isCacheValid($cacheFile, $paths) {
+ private function _isCacheValid($cacheFile, array $paths) {
return file_exists($cacheFile)
&& (filemtime($cacheFile) >= $this->_getFileCollectionMTime($paths));
}
@@ -165,7 +165,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Join multiple script files into single asset, mark all of them as rendered in parent
- private function _compileScriptFiles($files) {
+ private function _compileScriptFiles(array $files) {
foreach ($files as $file) {
$this->markScriptFileAsRendered($file);
}
@@ -189,7 +189,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Write output tag for a single, compiled JS asset, consisting of multiple local assets
- private function _renderLocalScriptFiles($writer, $localFiles) {
+ private function _renderLocalScriptFiles(THtmlWriter $writer, array $localFiles) {
if ($localFiles) {
$assetPath = $this->_compileScriptFiles($localFiles);
$writer->write(TJavascript::renderScriptFile($assetPath));
@@ -197,7 +197,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Keep track of external JS scripts rendered on the page
- private function _renderExternalScriptFiles($writer, $externalFiles) {
+ private function _renderExternalScriptFiles(THtmlWriter $writer, array $externalFiles) {
if ($externalFiles) {
foreach ($externalFiles as $file) {
$this->markScriptFileAsRendered($file);
@@ -322,7 +322,8 @@ class ClientScriptManager extends TClientScriptManager {
);
}
- // Resolve all "url(FILE)" CSS directives pointing to relative resources to specified path
+ // Resolve all "url(FILE)" CSS directives pointing
+ // to relative resources to specified path
private function _fixStyleSheetPaths($content, $originalUrl) {
$originalDir = dirname($originalUrl . '.');
return preg_replace_callback(
@@ -356,7 +357,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Join multiple stylesheet files into single asset
- private function _compileSheetFiles($files) {
+ private function _compileSheetFiles(array $files) {
$paths = $this->_getBasePaths(
array_map('reset', $files)
);
@@ -389,7 +390,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Filter only local stylesheet file entries
- private function _determineLocalSheetFiles($files) {
+ private function _determineLocalSheetFiles(array $files) {
$basePath = $this->_getBasePath();
return array_filter(
$files,
@@ -410,7 +411,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Group registered local CSS assets by media query string and render markup for compiled sheets
- private function _renderLocalSheetFiles(THtmlWriter $writer, $localFiles) {
+ private function _renderLocalSheetFiles(THtmlWriter $writer, array $localFiles) {
if ($localFiles) {
$fileTypes = [];
foreach ($localFiles as $file) {
@@ -428,7 +429,7 @@ class ClientScriptManager extends TClientScriptManager {
}
// Render markup for external stylesheets
- private function _renderExternalSheetFiles(THtmlWriter $writer, $externalFiles) {
+ private function _renderExternalSheetFiles(THtmlWriter $writer, array $externalFiles) {
if ($externalFiles) {
foreach ($externalFiles as $file) {
$this->_appendRenderedSheets([$file], $file[0]);
diff --git a/app/php/web/TemplateControl.php b/app/php/web/TemplateControl.php
index cc7f840..aa95d75 100644
--- a/app/php/web/TemplateControl.php
+++ b/app/php/web/TemplateControl.php
@@ -82,7 +82,7 @@ class TemplateControl extends TTemplateControl {
);
}
- private function _registerExternalScriptDependencies($dependencies) {
+ private function _registerExternalScriptDependencies(array $dependencies) {
foreach ($dependencies as $dependency) {
$this->Page->ClientScript->registerHeadScriptFile(
$dependency, $dependency
@@ -90,7 +90,7 @@ class TemplateControl extends TTemplateControl {
}
}
- private function _registerLibScriptDependencies($dependencies) {
+ private function _registerLibScriptDependencies(array $dependencies) {
foreach ($dependencies as $dependency) {
$this->Page->ClientScript->registerScriptFile(
'LibScript.' . $dependency,
@@ -101,13 +101,13 @@ class TemplateControl extends TTemplateControl {
}
}
- private function _registerPradoScriptDependencies($dependencies) {
+ private function _registerPradoScriptDependencies(array $dependencies) {
foreach ($dependencies as $dependency) {
$this->Page->ClientScript->registerPradoScript($dependency);
}
}
- private function _registerControlScriptDependencies($dependencies) {
+ private function _registerControlScriptDependencies(array $dependencies) {
foreach ($dependencies as $dependency) {
$this->Page->ClientScript->registerScriptFile(
'TemplateControl.' . $dependency,
@@ -141,7 +141,7 @@ class TemplateControl extends TTemplateControl {
}
}
- private function _registerExternalStyleDependencies($dependencies) {
+ private function _registerExternalStyleDependencies(array $dependencies) {
foreach ($dependencies as $dependency) {
$this->Page->ClientScript->registerStyleSheetFile(
$dependency, $dependency
@@ -149,7 +149,7 @@ class TemplateControl extends TTemplateControl {
}
}
- private function _registerLibStyleDependencies($dependencies) {
+ private function _registerLibStyleDependencies(array $dependencies) {
foreach ($dependencies as $dependency) {
$this->Page->ClientScript->registerStyleSheetFile(
'LibStyle.' . $dependency,
@@ -160,7 +160,7 @@ class TemplateControl extends TTemplateControl {
}
}
- private function _registerControlStyleDependencies($dependencies) {
+ private function _registerControlStyleDependencies(array $dependencies) {
foreach ($dependencies as $dependency) {
$this->Page->ClientScript->registerStyleSheetFile(
'TemplateControl.' . $dependency,