BLUE
PHP 7.4.33
Path:
/var/www/multi-event-cfp.bitkit.dk/httpdocs/app/Repositories
Run
Logout
Edit File
Size: 37.58 KB
Close
/var/www/multi-event-cfp.bitkit.dk/httpdocs/app/Repositories/EventRepository.php
Text
Base64
<?php namespace App\Repositories; use App\Http\Requests\EventRequest; use App\Models\Event; use App\Models\EventUser; use App\Models\Score; use App\Models\SystemEmail; use App\Models\File; use App\Models\User; use App\Rules\EventFormSettingsRule; use App\Support\Entity; use Exception; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Exceptions\HttpResponseException; use Illuminate\Http\Request; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Validator; use Illuminate\Validation\ValidationException; use App\Repositories\SessionRepository; class EventRepository extends Repository { protected $sessionRepository; public function __construct($event = null) { $this->for($event); $this->sessionRepository = new SessionRepository(); } public function for($value = null) { $this->for = $value ? array_wrap($value) : null; return $this; } public function model(): ?Event { return new Event; } public function query($as = null) { $model = $this->model(); return $model->newQuery(); } /** * Replace the content of a specific field and key in the given contents array. * * @param array $contents * @param array $contentsSettings * @param string $fieldId * @param string $key * * @return array */ function replaceContent($contents, $contentsSettings, $fieldId, $key) { $contentIndex = array_search($fieldId, array_column($contents, 'field_id')); $settingsIndex = array_search($fieldId, array_column($contentsSettings, 'field_id')); if ($contentIndex !== false && $settingsIndex !== false) { $contentFieldIndex = array_search($key, array_column($contents[$contentIndex]['contents'], 'key')); $settingsFieldIndex = array_search($key, array_column($contentsSettings[$settingsIndex]['contents'], 'key')); if ($contentFieldIndex !== false && $settingsFieldIndex !== false) { $contents[$contentIndex]['contents'][$contentFieldIndex] = $contentsSettings[$settingsIndex]['contents'][$settingsFieldIndex]; } } return $contents; } /** * Replace content in the specified field using a key. * * @param array $contents * @param array $contentsSettings * @param string $fieldId * @param string $key * * @return array */ function replaceContentByKey($contents, $contentsSettings, $fieldId, $key) { return $this->replaceContent($contents, $contentsSettings, $fieldId, $key); } /** * Create a new event based on the provided request. * * @param EventRequest $request * * @return Entity * * @throws Exception */ public function create(EventRequest $request): Entity { // Validate and retrieve input data $inputs = $request->validated(); $eventSettings = config('event_settings'); $contents = json_encode(config('contents')); $emailSettings = json_decode(json_encode(config('mail_settings')), true); // Extract inputs using list [$cloneEvent, $cloneEventSlug, $cloneEventSettings] = [$request->clone_event, $request->clone_event_slug, $request->clone_event_settings]; // Check if cloning an event if ($cloneEvent && $cloneEventSlug && $cloneEventSettings) { // clone event data $cloneEventData = Event::whereSlugName($cloneEventSlug)->first(); if ($cloneEventData && $cloneEventSettings['contents']) { // content config settings $contentsSettings = json_decode(json_encode(config('contents')), true); // clone event contents $contents = json_decode(json_encode($cloneEventData['contents']), true); // replace content using key foreach (['submitter_login_image', 'submitter_login_video', 'submitter_disabled_image'] as $key) { $fieldId = ($key === 'submitter_disabled_image') ? 'submitter_disabled' : 'submitter_login'; $contents = $this->replaceContentByKey($contents, $contentsSettings, $fieldId, $key); } // change submitter register content $contentIndex = array_search('submitter_register', array_column($contents, 'field_id')); $settingsIndex = array_search('submitter_register', array_column($contentsSettings, 'field_id')); $contents[$contentIndex]['contents'] = $contentsSettings[$settingsIndex]['contents']; // replace contents with event name and year $contents = json_encode($contents); $contents = str_replace([$cloneEventData['event_name'], $cloneEventData['year']], [$inputs['event_name'], $inputs['year']], $contents); $inputs['contents'] = json_decode($contents, true); } else { // Replace contents with event name and year $contents = str_replace(['{event_name}', '{year}'], [$inputs['event_name'], $inputs['year']], $contents); $inputs['contents'] = json_decode($contents, true); } // Replace other settings foreach (['form_settings', 'score_settings', 'general_settings', 'platform_settings', 'theme'] as $setting) { if ($cloneEventData && $cloneEventSettings[$setting]) { // Handle 'theme' and 'general_settings' settings if ($setting === 'theme') { $themeSettings = json_decode(json_encode($eventSettings->$setting), true); $theme = json_decode(json_encode($cloneEventData[$setting]), true); $theme['logo'] = $themeSettings['logo']; $inputs[$setting] = $theme; } elseif ($setting === 'general_settings') { $generalSettingsConfig = json_decode(json_encode($eventSettings->$setting), true); $generalSettings = json_decode(json_encode($cloneEventData[$setting]), true); $generalSettings['submitter_abstract_section']['request_to_edit'] = true; // changes for 'general_settings' $fileKeysToUpdate = ['presentation_templates', 'written_paper_templates']; $imageKeysToUpdate = ['submitter_page_top_section', 'reviewer_page_top_section']; // Update keys with 'files' foreach ($fileKeysToUpdate as $key) { $generalSettings[$key]['files'] = $generalSettingsConfig[$key]['files']; } // Update keys with 'image' foreach ($imageKeysToUpdate as $key) { $generalSettings[$key]['image'] = $generalSettingsConfig[$key]['image']; } $inputs[$setting] = $generalSettings; } else { $inputs[$setting] = $cloneEventData[$setting]; } } else { // use default settings $property = ($setting === 'form_settings') ? 'form' : (($setting === 'score_settings') ? 'score_criteria' : $setting); $inputs[$setting] = json_decode(json_encode($eventSettings->$property), true); } } } else { // Replace contents with event name and year $contents = str_replace(['{event_name}', '{year}'], [$inputs['event_name'], $inputs['year']], $contents); $inputs['contents'] = json_decode($contents, true); foreach (['form_settings', 'score_settings', 'general_settings', 'platform_settings', 'theme'] as $setting) { $property = ($setting === 'form_settings') ? 'form' : (($setting === 'score_settings') ? 'score_criteria' : $setting); $inputs[$setting] = json_decode(json_encode($eventSettings->$property), true); } } // Set default status $inputs['status'] = 'open'; // Check if required settings are present if (!$inputs['form_settings'] || !$inputs['score_settings'] || !$inputs['contents'] || !$inputs['platform_settings'] || !$inputs['theme'] || !$inputs['general_settings']) { throw new Exception('Config not found'); } // Create and save the new event $event = new Event($inputs); $event->save(); // Create and save event admins $userRepository = new UserRepository($event->id); $response = $userRepository->createEventAdmin($inputs['admins'], $event); // Save event emails $this->saveEventEmails($emailSettings, $event->id); return $response->merge(['event' => $event, 'event_admins' => $inputs['admins']]); } /** * @param Request $request * @return Entity * @throws ValidationException */ public function update(Request $request): Entity { $input = $request->input(); $validator = Validator::make($input, [ 'id' => "required", 'event_name' => "string", 'slug_name' => "string", 'edition_ids' => 'nullable|string', 'division' => 'nullable|string', 'year' => "integer", 'admins' => 'required|array' ]); $event = Event::find($input['id']); if (!$event) $validator->errors()->add('id', 'Event not found'); $validator->after(function ($validator) use ($input, $event) { if (!$event) return; if ($event->slug_name != $input['slug_name']) { $otherEvents = Event::whereSlugName($input['slug_name'])->count(); if ($otherEvents > 0) $validator->errors()->add('slug_name', 'The slug name already exists for another event'); } }); if ($validator->fails()) { validationErrorResponse($validator->errors()); } $input = $validator->validated(); $event->update($input); $userRepository = new UserRepository($event->id); $currentAdmins = $event->users('event_admin')->get(); $currentAdminEmails = $currentAdmins->pluck('email')->toArray(); $admins = new Entity($input['admins']); $adminEmails = $admins->pluck('email')->toArray(); $removedAdmins = array_diff($currentAdminEmails, $adminEmails); $newAdminEmails = array_diff($adminEmails, $currentAdminEmails); $remainingAdminEmails = array_diff($adminEmails, $newAdminEmails); //creating new admins $newAdmins = []; foreach ($newAdminEmails as $newAdminEmail) { $key = array_keys($adminEmails, $newAdminEmail)[0]; $newAdmins[] = $admins->get($key); } $response = $userRepository->createEventAdmin($newAdmins); //updating existing admins foreach ($remainingAdminEmails as $remainingAdminEmail) { $user = User::whereEmail($remainingAdminEmail)->first(); $eventUser = getEventUser($event, $user); $key = array_keys($adminEmails, $remainingAdminEmail)[0]; $eventUser->developer_options = $admins->get($key)['developer_options']; $eventUser->all_user_api_access = $admins->get($key)['all_user_api_access']; $eventUser->user_export_access = $admins->get($key)['user_export_access']; $eventUser->abstract_export_access = $admins->get($key)['abstract_export_access']; $eventUser->presentation_files_download_access = $admins->get($key)['presentation_files_download_access']; $eventUser->access_level = $admins->get($key)['access_level'] ?? 'full'; $eventUser->vip_categories = ($admins->get($key)['access_level'] === 'limited') ? ($admins->get($key)['vip_categories'] ?? []) : null; $eventUser->save(); } //removing admins $userRepository->removeEventUser($event->id, $removedAdmins, 'event_admin'); return $response->merge([ 'event' => $event, 'event_admins' => $input['admins'] ]); } public function deleteEventFiles(Event $event) { $files = File::whereModel(get_class($event)) ->whereModelId($event->id) ->get(); foreach ($files as $file) { $filePath = $file->filepath . '/' . $file->save_name; Storage::delete($filePath); $file->delete(); } //delete event directory Storage::deleteDirectory('public/media/events/' . $event->id); } public function deleteEventSystemEmails(Event $event) { $emails = SystemEmail::whereEventId($event->id) ->get(); foreach ($emails as $email) { $email->delete(); } } public function delete($id): bool { $user = authUser(); $event = Event::find($id); if ($event) { if (!$event->published) { $userRepository = $user->useRepository($id); $eventUsers = $event->users()->pluck('email'); $userRepository->removeEventUser($event->id, $eventUsers); $this->deleteEventFiles($event); $this->deleteEventSystemEmails($event); $event->delete(); } else validationErrorResponse(['Cannot delete published event']); } else validationErrorResponse(['Event not found']); return true; } /** * @return string[] * Default select columns */ public function selectColumns(): array { return [ 'events.id', 'events.status', 'events.event_name', 'events.slug_name', 'events.year', 'events.edition_ids', 'events.division', 'events.created_at', 'events.updated_at', 'events.publish_step', 'events.published', 'events.published_date' ]; } public function applyOrder($query, $arguments) { $columns = [ 'event_name' => 'events.event_name', 'slug_name' => 'events.slug_name', 'year' => 'events.year', 'created_at' => 'events.created_at', 'updated_at' => 'events.updated_at', 'publish_step' => 'events.publish_step', 'published' => 'events.published' ]; $sortMethod = $arguments->order === 'desc' ? 'desc' : 'asc'; if (array_key_exists($arguments->sort, $columns)) { $sortBy['column'] = $columns[$arguments->sort]; $sortBy['method'] = $sortMethod; return $query->orderByRaw($sortBy['column'] . ' ' . $sortBy['method']); } $sortBy['column'] = 'event_name'; $sortBy['method'] = $sortMethod; return $query->orderByRaw($sortBy['column'] . ' ' . $sortBy['method']); } /** * @param Builder $query * @param $arguments * @return Builder */ public function applyEventScope(Builder $query, $arguments): Builder { if ($arguments->event_id) $query->where('events.id', '=', $arguments->event_id) ->addSelect([ 'events.contents', 'events.form_settings', 'events.score_settings', 'events.theme', 'events.platform_settings', 'events.general_settings' ]); return $query; } public function applyUserScope(Builder $query, $arguments): Builder { if ($arguments->user ?? false) { $query->leftJoin('event_user as eu', 'events.id', '=', 'eu.event_id') ->leftJoin('users as u', 'eu.user_id', '=', 'u.id') ->leftJoin('model_has_roles as mhs', function ($join) use ($arguments) { $join->on('mhs.model_id', '=', 'eu.id') ->where('mhs.model_type', '=', EventUser::class); }) ->join('roles as r', function ($join) use ($arguments) { $join->on('r.id', '=', 'mhs.role_id') ->where('r.name', '=', $arguments->user); }) ->groupBy('events.id') ->addSelect([ DB::raw("GROUP_CONCAT(u.email) as $arguments->user" . "s") ]); return $query; } return $query; } public function applyScope($query, $arguments) { //apply scope for single event if event id exists $this->applyEventScope($query, $arguments); //apply scope for getting users $this->applyUserScope($query, $arguments); //scope for sorting $this->applyOrder($query, $arguments); return $query; } /** * @param $arguments * @param null $callback * @return Builder * @throws Exception */ public function scope($arguments, $callback = null): Builder { //get query builder $query = $this->query() ->select($this->selectColumns()); //applying different scopes based on the arguments $this->applyScope($query, $arguments); //resolve if there is any callback functions available return $this->resolve($query, $arguments, $callback); } /** * @throws Exception */ public function listing(Request $request, $paginate) { //building arguments $arguments = $this->arguments($request); //building query $query = $this->scope($arguments); return ($paginate && $arguments->paging != 'All') ? $query->paginate($arguments->paging) : $query->get(); } public function updateEventTheme(Request $request, Event $event, $input, $continue = true): string { $validator = Validator::make($input, [ 'id' => ['required', 'integer'], 'publish_step' => ['required', 'integer'], 'theme' => ['required', 'json'] ]); if ($validator->fails() && $continue) validationErrorResponse($validator->errors()); $theme = json_decode($input['theme']); if ($request->hasFile('logo')) { $file = $request->file('logo'); $fileName = $file->getClientOriginalName(); $extension = explode('.', $fileName); $extension = end($extension); $eventLogo = File::find($theme->logo->file_id ?? null); if (!$eventLogo) $eventLogo = new File([ 'model_id' => $event->id, 'model' => get_class($event), 'filename' => $fileName, 'extension' => $extension, 'type' => $file->getMimeType(), 'context' => 'event.logo', 'public' => true ]); else { $currentSaveName = $eventLogo->save_name; $currentFilePath = $eventLogo->filepath; Storage::delete($currentFilePath . '/' . $currentSaveName); $eventLogo->filename = $fileName; $eventLogo->extension = $extension; $eventLogo->type = $file->getMimeType(); } $eventLogo->save(); $eventLogo->filepath = "public/media/events/{$event->id}/images"; $saveName = 'event_logo_v' . time() . '.' . $eventLogo->extension; Storage::putFileAs($eventLogo->filepath, $file, $saveName, 'public'); $publicPath = "storage/media/events/{$event->id}/images/" . $saveName; $eventLogo->public_path = $publicPath; $eventLogo->save_name = $saveName; $eventLogo->save(); $theme->logo->file_id = $eventLogo->id; $theme->logo->filename = $eventLogo->filename; $theme->logo->save_name = $eventLogo->save_name; $theme->logo->filepath = $eventLogo->filepath; $theme->logo->public_path = $eventLogo->public_path; $theme->logo->extension = $eventLogo->extension; $theme->logo->value = $eventLogo->public_path; } $event->theme = $theme; return "Theme updated"; } /** * @param Request $request * @param Event $event * @param $input * @param null $continue * @return string */ public function updateEventContents(Request $request, Event $event, $input, $continue = null): string { $validator = Validator::make($input, [ 'id' => ['required', 'integer'], 'publish_step' => ['required', 'integer'], 'contents' => ['required', 'json'] ]); if ($validator->fails() && $continue) validationErrorResponse($validator->errors()); $contents = json_decode($input['contents']); $contents = collect($contents); if ($request->hasFile('submitter_login_image')) { $fieldId = 'submitter_login'; $fieldKey = $contents->search(function ($item, $key) use ($fieldId) { return $item->field_id == $fieldId; }); $field = $contents->get($fieldKey); $fieldContents = collect($field->contents); $keyValue = 'submitter_login_image'; $contentKey = $fieldContents->search(function ($item) use ($keyValue) { return $item->key == $keyValue; }); $content = $fieldContents->get($contentKey); $file = $request->file('submitter_login_image'); $submitterLoginImageFile = $event->saveFile( $file, $content->file_id ?? null, "{$event->id}/images/", 'event.submitter_login_image', 'submitter_login_image' ); //updating file attributes into contents $this->updatingFileAttributesIntoContents($submitterLoginImageFile, $content, $fieldContents, $contentKey, $field, $contents, $fieldKey); } if ($request->hasFile('submitter_disabled_image')) { $fieldId = 'submitter_disabled'; $fieldKey = $contents->search(function ($item, $key) use ($fieldId) { return $item->field_id == $fieldId; }); $field = $contents->get($fieldKey); $fieldContents = collect($field->contents); $keyValue = 'submitter_disabled_image'; $contentKey = $fieldContents->search(function ($item) use ($keyValue) { return $item->key == $keyValue; }); $content = $fieldContents->get($contentKey); $file = $request->file('submitter_disabled_image'); $submitterDisabledImageFile = $event->saveFile( $file, $content->file_id ?? null, "{$event->id}/images/", 'event.submitter_disabled_image', 'submitter_disabled_image' ); //updating file attributes into contents $this->updatingFileAttributesIntoContents($submitterDisabledImageFile, $content, $fieldContents, $contentKey, $field, $contents, $fieldKey); } if ($request->file('submitter_login_video')) { $fieldId = 'submitter_login'; $fieldKey = $contents->search(function ($item, $key) use ($fieldId) { return $item->field_id == $fieldId; }); $field = $contents->get($fieldKey); $fieldContents = collect($field->contents); $keyValue = 'submitter_login_video'; $contentKey = $fieldContents->search(function ($item) use ($keyValue) { return $item->key == $keyValue; }); $content = $fieldContents->get($contentKey); $file = $request->file('submitter_login_video'); $submitterLoginVideoFile = $event->saveFile( $file, $content->file_id ?? null, "{$event->id}/videos/", 'event.submitter_login_video', 'submitter_login_video' ); //updating file attributes into contents $this->updatingFileAttributesIntoContents($submitterLoginVideoFile, $content, $fieldContents, $contentKey, $field, $contents, $fieldKey); } $event->contents = $contents; return "Contents updated"; } /** * @param Request $request * @param Event $event * @return array */ public function publishEvent(Request $request, Event $event): array { $input = $request->input(); $continue = $request->get('continue', true); $message = null; $publishStep = $input['publish_step']; switch ($publishStep) { case 1: $validator = Validator::make($input, [ 'id' => ['required', 'integer'], 'publish_step' => ['required', 'integer'], 'form_settings' => ['required', 'array', new EventFormSettingsRule()] ]); if ($validator->fails() && $continue) validationErrorResponse($validator->errors()); $event->form_settings = json_decode(json_encode($input['form_settings'])); $message = "Form settings updated"; break; case 2: $message = $this->updateEventContents($request, $event, $input, $continue); break; case 3: $message = $this->updateEventTheme($request, $event, $input, $continue); break; case 4: $validator = Validator::make($input, [ 'id' => ['required', 'integer'], 'publish_step' => ['required', 'integer'], 'score_settings' => ['required', 'array'] ]); if ($validator->fails() && $continue) validationErrorResponse($validator->errors()); $event->score_settings = json_decode(json_encode($input['score_settings'])); $message = "Score settings updated"; break; case 5: $validator = Validator::make($input, [ 'id' => ['required', 'integer'], 'publish_step' => ['required', 'integer'], 'platform_settings' => ['required', 'array'] ]); if ($validator->fails() && $continue) validationErrorResponse($validator->errors()); $event->platform_settings = json_decode(json_encode($input['platform_settings'])); $message = "Platform settings updated"; break; case 6: $event = $this->updateGeneralSettings($request, $event, $input); $message = "General settings updated"; if ($continue && !$event->published) { $event->published = true; $event->published_date = date('Y-m-d H:i:s'); } break; default: validationErrorResponse(['Invalid step']); break; } if ($event->publish_step < $publishStep && $continue) $event->publish_step = $publishStep; $event->save(); $event->refresh(); return [$event, $message]; } public function updateGeneralSettings(Request $request, Event $event, $input): Event { $removedFiles = $request->get('removed_files'); $removedFiles = json_decode($removedFiles, true); $generalSettings = json_decode($input['general_settings'], true); // Check for session form settings changes and update sessions if ( isset($event->general_settings['session_form_settings']) && isset($generalSettings['session_form_settings']) ) { $this->sessionRepository->updateSessionsOnFormSettingsChange($event, $event->general_settings['session_form_settings'], $generalSettings['session_form_settings']); } // Check for room or track name changes and update sessions if ( isset($event->general_settings['session_room_type_fields']) && isset($generalSettings['session_room_type_fields']) ) { $this->sessionRepository->updateSessionsOnRoomTypeFieldsChange($event, $event->general_settings['session_room_type_fields'], $generalSettings['session_room_type_fields']); } //presentation template handling if ($generalSettings['presentation_templates']['enabled']) { $files = $generalSettings['presentation_templates']['files']; if ($request->hasFile('presentation_templates_files')) { $templateFiles = $request->file('presentation_templates_files'); $fileContents = []; foreach ($templateFiles as $file) { $fileObj = $event->saveFile( $file, null, "{$event->id}/files/templates/", "presentation_template.file", null, false ); $fileContents[] = $fileObj->getFileObject(); } $files = array_values(array_filter(array_merge($files, $fileContents))); $generalSettings['presentation_templates']['files'] = $files; } //handling removed files if (isset($removedFiles['presentation_template_files'])) { $fileIds = $removedFiles['presentation_template_files']; foreach ($fileIds as $fileId) { $this->deleteFile($fileId); } } } //written paper template handling if ($generalSettings['written_paper_templates']['enabled']) { $files = $generalSettings['written_paper_templates']['files']; if ($request->hasFile('written_paper_templates_files')) { $templateFiles = $request->file('written_paper_templates_files'); $fileContents = []; foreach ($templateFiles as $file) { $fileObj = $event->saveFile( $file, null, "{$event->id}/files/templates/written-paper/", "written_paper_templates.file", null, false ); $fileContents[] = $fileObj->getFileObject(); } $files = array_values(array_filter(array_merge($files, $fileContents))); $generalSettings['written_paper_templates']['files'] = $files; } //handling removed files if (isset($removedFiles['written_paper_template_files'])) { $fileIds = $removedFiles['written_paper_template_files']; foreach ($fileIds as $fileId) { $this->deleteFile($fileId); } } } //submitter page top section handling if ($generalSettings['submitter_page_top_section']['enabled']) { if ($request->hasFile('submitter_page_top_section_image')) { $content = $event['general_settings']['submitter_page_top_section']['image']; $file = $request->file('submitter_page_top_section_image'); $submitterTopSectionImageFile = $event->saveFile( $file, $content['file_id'] ?? null, "{$event->id}/images/", 'event.submitter_page_top_section_image', 'submitter_page_top_section_image' ); $files = $submitterTopSectionImageFile->getFileObject();; $generalSettings['submitter_page_top_section']['image'] = $files; } } //reviewer page top section handling if ($generalSettings['reviewer_page_top_section']['enabled']) { if ($request->hasFile('reviewer_page_top_section_image')) { $content = $event['general_settings']['reviewer_page_top_section']['image']; $file = $request->file('reviewer_page_top_section_image'); $reviewerTopSectionImageFile = $event->saveFile( $file, $content['file_id'] ?? null, "{$event->id}/images/", 'event.reviewer_page_top_section_image', 'reviewer_page_top_section_image' ); $files = $reviewerTopSectionImageFile->getFileObject();; $generalSettings['reviewer_page_top_section']['image'] = $files; } } $event->general_settings = $generalSettings; return $event; } public function getEventMetaData(Event $event, $page = null): Entity { $meta = new Entity(); // scored abstracts count $scoredAbstractsCount = Score::where('event_id', $event->id)->count(); // is there is scored abstracts $hasScoredAbstracts = $scoredAbstractsCount > 0; // score settings $scoreSettings = $event->score_settings; // return first score as well if ($hasScoredAbstracts) { $firstScore = Score::select('score')->where('event_id', $event->id)->first(); $scoreSettings['first_score'] = $firstScore; } // update score settings $scoreSettings['scored_abstracts'] = $hasScoredAbstracts; $meta->set([ 'event_id' => $event->id, 'event_name' => $event->event_name, 'event_slug' => $event->slug_name, 'platform_settings' => $event->platform_settings, 'theme' => $event->theme, 'contents' => $event->contents, 'form_settings' => $event->form_settings, 'score_settings' => $scoreSettings, 'general_settings' => $event->general_settings ]); return $meta; } /** * @param File $file * @param $content * @param Collection $fieldContents * @param $contentKey * @param $field * @param Collection $contents * @param $fieldKey */ public function updatingFileAttributesIntoContents(File $file, $content, Collection $fieldContents, $contentKey, $field, Collection $contents, $fieldKey): void { $content = $file->getFileObject($content); $fieldContents->put($contentKey, $content); $field->contents = $fieldContents; $contents->put($fieldKey, $field); } public function getEventCounts(Event $event): Entity { $submitters = $event->users('event_submitter')->count(); $abstracts = $event->abstracts()->count(); $presentations = $event->presentations()->count(); return new Entity([ 'submitters' => $submitters, 'abstracts' => $abstracts, 'presentations' => $presentations ]); } /** * Save event emails * @param $emailSettings * Format:{abstract_submitted": [{"key": "abstract_submitted_to_admin","description": "","recipient": "admin","subject":"","variables": [],"status": true},]} * @param $eventId * @return void */ public function saveEventEmails($emailSettings, $eventId) { $data = []; foreach ($emailSettings as $key => $value) { foreach ($value as $d) { $data['mail_type'] = $key; $data['event_id'] = $eventId; $data['key'] = $d['key']; $data['recipient'] = $d['recipient']; $data['variables'] = $d['variables']; $data['subject'] = $d['subject']; $data['body'] = $d['body']; $data['title'] = $d['title']; $data['description'] = $d['description']; $data['status'] = $d['status']; $eventEmails = new SystemEmail($data); $eventEmails->save(); } } } /** * get event users * @param $role type * @param $event_id id * @return void */ public function getEventUsersByRole(String $role, Int $event_id){ $userRepository = new UserRepository(); $request = new Request(); $request->replace([ 'event_role' => $role, 'role' => 'event_admin', 'event_user' => new EventUser(), 'event' => new Event(), ]); $request->event->id = $event_id; $result = $userRepository->listing($request, false); return $result; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 17
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
AbstractsRepository.php
75.27 KB
lrw-rw-r--
2026-04-30 09:24:04
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
AmendSpeakerTermsRepository.php
1.21 KB
lrw-rw-r--
2025-04-21 06:11:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ApiRepository.php
65 B
lrw-r--r--
2024-02-09 12:37:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
AuthRepository.php
8.53 KB
lrw-rw-r--
2025-03-03 05:39:26
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
EmailLogRepository.php
4.14 KB
lrw-rw-r--
2025-10-28 05:24:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
EmailRepository.php
8.53 KB
lrw-rw-r--
2025-10-28 05:24:35
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
EventRepository.php
37.58 KB
lrw-rw-r--
2026-04-07 05:00:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PresentationCommentRepository.php
8.71 KB
lrw-r--r--
2024-02-09 12:37:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PresentationRepository.php
59.48 KB
lrwxrwxr-x
2026-04-30 09:24:03
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Repository.php
4.78 KB
lrw-r--r--
2024-02-09 12:37:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ScheduleEmailRepository.php
10.79 KB
lrw-rw-r--
2025-04-21 06:11:52
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ScoreRepository.php
11.37 KB
lrw-rw-r--
2024-07-24 04:42:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SessionRepository.php
72.51 KB
lrw-rw-r--
2026-04-22 04:31:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SlotRepository.php
11.43 KB
lrw-rw-r--
2024-09-20 05:02:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SpeakerNotesRepository.php
6.57 KB
lrw-rw-r--
2026-03-31 07:16:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SystemEmailRepository.php
4.26 KB
lrw-r--r--
2024-02-09 12:37:30
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
UserRepository.php
128.96 KB
lrw-rw-r--
2026-05-07 09:06:13
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).