Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
AIPHPDocs demo commit
Browse files Browse the repository at this point in the history
  • Loading branch information
molbal committed Jan 9, 2023
1 parent dc970de commit e4013c7
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/Http/Controllers/Profile/ActivityChartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
use Illuminate\Support\Facades\DB;

class ActivityChartController extends Controller {
/**
* Get chart container
*
* This function returns an ActivityChart object with the given year.
*
* @param int $year The year to be used for the chart
*
* @return ActivityChart An ActivityChart object
*/

public static function getChartContainer(int $year):ActivityChart {

Expand Down
16 changes: 16 additions & 0 deletions app/Http/Controllers/Profile/AltRelationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,29 @@ public function index() {
// 'chars' => $chars,
]);
}
/**
* Filter Ajax
*
* @param Request $request
*
* @return array
*/

public function filterAjax(Request $request) {
$chars = DB::table('chars')->whereRaw("chars.CHAR_ID not in (select privacy.CHAR_ID from privacy where privacy.PANEL='ALTS' and privacy.DISPLAY='private')")->where('chars.NAME', 'like', $request->get('q').'%')->limit(30)->get(['chars.CHAR_ID as id', 'chars.NAME as text']);
return [
'results' => $chars
];
}
/**
* Get all available characters for the logged in user.
*
* @param bool $excludeCurrentCharacter Whether to exclude the current character from the list. Default is true.
*
* @return Collection Collection of characters sorted by name.
*
* @throws SecurityViolationException If user is not logged in.
*/


public static function getAllMyAvailableCharacters(bool $excludeCurrentCharacter = true) {
Expand Down
23 changes: 23 additions & 0 deletions app/Http/Controllers/Profile/LeaderboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
use Illuminate\Support\Facades\DB;

class LeaderboardController extends Controller {
/**
* This function retrieves leaderboard data from the last 90, 30, and 7 days, as well as the average and quickest runtimes for each of those periods.
*
* @return view The leaderboard view with the retrieved data.
*/

public function index() {

Expand Down Expand Up @@ -52,6 +57,15 @@ public function getLeaderboard(string $from, string $to, int $limit = 10) {
group by r.CHAR_ID, c.NAME order by 2 desc limit $limit;", [$from, $to]);
});
}
/**
* Get the leaderboard average of loot from a given date range
*
* @param string $from The start date of the range
* @param string $to The end date of the range
* @param int $limit The maximum number of results to return
*
* @return array An array of leaderboard averages
*/


public function getLeaderboardAverage(string $from, string $to, int $limit = 10) {
Expand All @@ -73,6 +87,15 @@ public function getLeaderboardAverage(string $from, string $to, int $limit = 10)
group by r.CHAR_ID, c.NAME order by 2 desc limit $limit;", [$from, $to]);
});
}
/**
* Get the leaderboard runtime quickest from a given date range
*
* @param string $from Start date
* @param string $to End date
* @param int $limit Limit of records to return
*
* @return array
*/


public function getLeaderboardRuntimeQuickest(string $from, string $to, int $limit = 10) {
Expand Down
15 changes: 15 additions & 0 deletions app/Http/Controllers/Profile/NotificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ class NotificationController extends Controller
public function __construct(MailService $mailService) {
$this->mailService = $mailService;
}
/**
* Sends a notification to the character associated with a fit when a new question is asked.
*
* @param Fit $fit The fit associated with the notification.
* @param FitQuestion $fitQuestion The fit question associated with the notification.
* @param Char $sender The character who asked the fit question.
*/

public function sendNewFitQuestionNotification(Fit $fit, FitQuestion $fitQuestion, Char $sender) {
$text = __('mail-notifications.new-question', [
Expand All @@ -38,6 +45,14 @@ public function sendNewFitQuestionNotification(Fit $fit, FitQuestion $fitQuestio
$this->mailService->sendMaiItoCharacter(config('tracker.accountant.char-id'), $fit->char->CHAR_ID, 'New question on your fit '.trim($fit->NAME), $text);

}
/**
* Send a new fit answer notification
*
* @param Fit $fit The fit object
* @param FitQuestion $question The fit question object
* @param FitAnswer $fitAnswer The fit answer object
* @param Char $sender The sender character object
*/

public function sendNewFitAnswerNotification(Fit $fit, FitQuestion $question, FitAnswer $fitAnswer, Char $sender) {

Expand Down
16 changes: 16 additions & 0 deletions app/Http/Controllers/Profile/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ public function index(int $id) {

return view('profile', ['id' => $id, 'name' => $name, 'last_runs' => $runs, 'my_avg_loot' => $my_avg_loot, 'my_sum_loot' => $my_sum_loot, 'my_runs_count' => $my_runs_count, 'my_survival_ratio' => $my_survival_ratio, 'query_ships' => $query_ships, 'favoriteShipsChart' => $favoriteShipsChart, 'access' => $access, 'loot' => $loot]);
}
/**
* Download loot from the Abyss Tracker.
*
* @param int $id The character ID
* @param string $from The start date of the range
* @param string $to The end date of the range
*
* @return null|view Returns null or a view with an error message
*/

public function downloadLoot(int $id, string $from = "", string $to = "") {

Expand Down Expand Up @@ -325,6 +334,13 @@ private function getDefaultVisibility(string $panel) {
return false;
}
}
/**
* Gets all rights for a given user.
*
* @param int $userId The ID of the user to get rights for.
*
* @return array An array of rights for the given user.
*/

public function getAllRights(int $userId) : array {
$rights = ["LAST_RUNS", "TOTAL_LOOT", "TOTAL_RUNS", "LOOT", "SHIPS", "SURVIVAL"];
Expand Down
20 changes: 20 additions & 0 deletions app/Http/Controllers/Profile/SettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ public function index() {
// dd($rememberCargo);
return view('settings', ['access' => $access, 'esi_on' => $esi_on, 'cargo' => $rememberCargo]);
}
/**
* Save cargo setting for the current user.
*
* @param Request $request The request object
*
* @return \Illuminate\View\View The view to render
*/

public function saveCargo(Request $request) {
if (!session()->has("login_id")) {
Expand Down Expand Up @@ -90,6 +97,13 @@ public static function setBooleanSetting(int $userId, string $setting, bool $new
]);
Cache::forget("aft.setting.bool.{$userId}.{$setting}");
}
/**
* Add a token to the current Char
*
* @param Request $request The request containing the token name
*
* @return \Illuminate\Http\RedirectResponse The redirect response to the settings page
*/

public function addToken(Request $request) {
$request->validate([
Expand Down Expand Up @@ -195,6 +209,12 @@ private function getDefaultVisibility(string $panel) {
return false;
}
}
/**
* Gets all rights for the given user ID
*
* @param int $userId The user ID
* @return array An array containing the rights
*/

public function getAllRights(int $userId) : array {
$rights = ["LAST_RUNS", "TOTAL_LOOT", "TOTAL_RUNS", "LOOT", "SHIPS", "SURVIVAL", "ALTS"];
Expand Down

0 comments on commit e4013c7

Please sign in to comment.