Added endpoint get RSVP by summit
GET /api/v1/summits/{id}/rsvp-templates Filter * title ('=@', '==') * is_enabled ('==') Order * id * title Change-Id: If21a5d2222b165f59d5679701c3a13f3215c9a41
This commit is contained in:
parent
12fc9cf490
commit
6abd51f8dc
|
@ -13,6 +13,7 @@
|
|||
**/
|
||||
use App\Http\Utils\BooleanCellFormatter;
|
||||
use App\Http\Utils\EpochCellFormatter;
|
||||
use App\Http\Utils\PagingConstants;
|
||||
use App\Models\Foundation\Summit\PromoCodes\PromoCodesConstants;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
|
@ -81,36 +82,6 @@ final class OAuth2SummitPromoCodesApiController extends OAuth2ProtectedControlle
|
|||
$this->member_repository = $member_repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $filter_element
|
||||
* @return bool
|
||||
*/
|
||||
private function validateClassName($filter_element){
|
||||
if($filter_element instanceof FilterElement){
|
||||
return in_array($filter_element->getValue(), PromoCodesConstants::$valid_class_names);
|
||||
}
|
||||
$valid = true;
|
||||
foreach($filter_element[0] as $elem){
|
||||
$valid = $valid && in_array($elem->getValue(), PromoCodesConstants::$valid_class_names);
|
||||
}
|
||||
return $valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $filter_element
|
||||
* @return bool
|
||||
*/
|
||||
private function validateTypes($filter_element){
|
||||
if($filter_element instanceof FilterElement){
|
||||
return in_array($filter_element->getValue(), PromoCodesConstants::getValidTypes());
|
||||
}
|
||||
$valid = true;
|
||||
foreach($filter_element[0] as $elem){
|
||||
$valid = $valid && in_array($elem->getValue(), PromoCodesConstants::getValidTypes());
|
||||
}
|
||||
return $valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $summit_id
|
||||
* @return mixed
|
||||
|
@ -120,7 +91,7 @@ final class OAuth2SummitPromoCodesApiController extends OAuth2ProtectedControlle
|
|||
$rules = [
|
||||
|
||||
'page' => 'integer|min:1',
|
||||
'per_page' => 'required_with:page|integer|min:5|max:100',
|
||||
'per_page' => sprintf('required_with:page|integer|min:%s|max:%s', PagingConstants::MinPageSize, PagingConstants::MaxPageSize),
|
||||
];
|
||||
|
||||
try {
|
||||
|
@ -137,7 +108,7 @@ final class OAuth2SummitPromoCodesApiController extends OAuth2ProtectedControlle
|
|||
|
||||
// default values
|
||||
$page = 1;
|
||||
$per_page = 5;
|
||||
$per_page = PagingConstants::DefaultPageSize;;
|
||||
|
||||
if (Input::has('page')) {
|
||||
$page = intval(Input::get('page'));
|
||||
|
@ -162,6 +133,32 @@ final class OAuth2SummitPromoCodesApiController extends OAuth2ProtectedControlle
|
|||
]);
|
||||
}
|
||||
|
||||
if(is_null($filter)) $filter = new Filter();
|
||||
|
||||
$filter->validate([
|
||||
'class_name' => sprintf('sometimes|in:%s',implode(',', PromoCodesConstants::$valid_class_names)),
|
||||
'code' => 'sometimes|string',
|
||||
'creator' => 'sometimes|string',
|
||||
'creator_email' => 'sometimes|string',
|
||||
'owner' => 'sometimes|string',
|
||||
'owner_email' => 'sometimes|string',
|
||||
'speaker' => 'sometimes|string',
|
||||
'speaker_email' => 'sometimes|string',
|
||||
'sponsor' => 'sometimes|string',
|
||||
'type' => sprintf('sometimes|in:%s',implode(',', PromoCodesConstants::getValidTypes())),
|
||||
], [
|
||||
'class_name.in' => sprintf
|
||||
(
|
||||
":attribute has an invalid value ( valid values are %s )",
|
||||
implode(", ", PromoCodesConstants::$valid_class_names)
|
||||
),
|
||||
'type.in' => sprintf
|
||||
(
|
||||
":attribute has an invalid value ( valid values are %s )",
|
||||
implode(", ", PromoCodesConstants::getValidTypes())
|
||||
)
|
||||
]);
|
||||
|
||||
$order = null;
|
||||
|
||||
if (Input::has('order'))
|
||||
|
@ -173,28 +170,6 @@ final class OAuth2SummitPromoCodesApiController extends OAuth2ProtectedControlle
|
|||
]);
|
||||
}
|
||||
|
||||
if(is_null($filter)) $filter = new Filter();
|
||||
|
||||
if($filter->hasFilter("class_name") && !$this->validateClassName($filter->getFilter("class_name"))){
|
||||
throw new ValidationException(
|
||||
sprintf
|
||||
(
|
||||
"class_name filter has an invalid value ( valid values are %s",
|
||||
implode(", ", PromoCodesConstants::$valid_class_names)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if($filter->hasFilter("type") && !$this->validateTypes($filter->getFilter("type"))){
|
||||
throw new ValidationException(
|
||||
sprintf
|
||||
(
|
||||
"type filter has an invalid value ( valid values are %s",
|
||||
implode(", ", PromoCodesConstants::getValidTypes())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$data = $this->promo_code_repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
|
||||
|
||||
return $this->ok
|
||||
|
@ -257,7 +232,6 @@ final class OAuth2SummitPromoCodesApiController extends OAuth2ProtectedControlle
|
|||
|
||||
if (Input::has('filter')) {
|
||||
$filter = FilterParser::parse(Input::get('filter'), [
|
||||
|
||||
'code' => ['=@', '=='],
|
||||
'creator' => ['=@', '=='],
|
||||
'creator_email' => ['=@', '=='],
|
||||
|
@ -271,6 +245,32 @@ final class OAuth2SummitPromoCodesApiController extends OAuth2ProtectedControlle
|
|||
]);
|
||||
}
|
||||
|
||||
if(is_null($filter)) $filter = new Filter();
|
||||
|
||||
$filter->validate([
|
||||
'class_name' => sprintf('sometimes|in:%s',implode(',', PromoCodesConstants::$valid_class_names)),
|
||||
'code' => 'sometimes|string',
|
||||
'creator' => 'sometimes|string',
|
||||
'creator_email' => 'sometimes|string',
|
||||
'owner' => 'sometimes|string',
|
||||
'owner_email' => 'sometimes|string',
|
||||
'speaker' => 'sometimes|string',
|
||||
'speaker_email' => 'sometimes|string',
|
||||
'sponsor' => 'sometimes|string',
|
||||
'type' => sprintf('sometimes|in:%s',implode(',', PromoCodesConstants::getValidTypes())),
|
||||
], [
|
||||
'class_name.in' => sprintf
|
||||
(
|
||||
":attribute has an invalid value ( valid values are %s )",
|
||||
implode(", ", PromoCodesConstants::$valid_class_names)
|
||||
),
|
||||
'type.in' => sprintf
|
||||
(
|
||||
":attribute has an invalid value ( valid values are %s )",
|
||||
implode(", ", PromoCodesConstants::getValidTypes())
|
||||
)
|
||||
]);
|
||||
|
||||
$order = null;
|
||||
|
||||
if (Input::has('order'))
|
||||
|
@ -282,28 +282,6 @@ final class OAuth2SummitPromoCodesApiController extends OAuth2ProtectedControlle
|
|||
]);
|
||||
}
|
||||
|
||||
if(is_null($filter)) $filter = new Filter();
|
||||
|
||||
if($filter->hasFilter("class_name") && !$this->validateClassName($filter->getFilter("class_name"))){
|
||||
throw new ValidationException(
|
||||
sprintf
|
||||
(
|
||||
"class_name filter has an invalid value ( valid values are %s",
|
||||
implode(", ", PromoCodesConstants::$valid_class_names)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if($filter->hasFilter("type") && !$this->validateTypes($filter->getFilter("type"))){
|
||||
throw new ValidationException(
|
||||
sprintf
|
||||
(
|
||||
"type filter has an invalid value ( valid values are %s",
|
||||
implode(", ", PromoCodesConstants::getValidTypes())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$data = $this->promo_code_repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
|
||||
$filename = "promocodes-" . date('Ymd');
|
||||
$list = $data->toArray();
|
||||
|
|
|
@ -0,0 +1,159 @@
|
|||
<?php namespace App\Http\Controllers;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Http\Utils\PagingConstants;
|
||||
use App\Models\Foundation\Summit\Repositories\IRSVPTemplateRepository;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use models\exceptions\EntityNotFoundException;
|
||||
use models\exceptions\ValidationException;
|
||||
use models\oauth2\IResourceServerContext;
|
||||
use models\summit\ISummitRepository;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
use utils\Filter;
|
||||
use utils\FilterParser;
|
||||
use utils\OrderParser;
|
||||
use utils\PagingInfo;
|
||||
|
||||
/**
|
||||
* Class OAuth2SummitRSVPTemplatesApiController
|
||||
* @package App\Http\Controllers
|
||||
*/
|
||||
final class OAuth2SummitRSVPTemplatesApiController extends OAuth2ProtectedController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ISummitRepository
|
||||
*/
|
||||
private $summit_repository;
|
||||
|
||||
/**
|
||||
* @var IRSVPTemplateRepository
|
||||
*/
|
||||
private $rsvp_template_repository;
|
||||
|
||||
/**
|
||||
* OAuth2SummitRSVPTemplatesApiController constructor.
|
||||
* @param ISummitRepository $summit_repository
|
||||
* @param IRSVPTemplateRepository $rsvp_template_repository
|
||||
* @param IResourceServerContext $resource_server_context
|
||||
*/
|
||||
public function __construct
|
||||
(
|
||||
ISummitRepository $summit_repository,
|
||||
IRSVPTemplateRepository $rsvp_template_repository,
|
||||
IResourceServerContext $resource_server_context
|
||||
)
|
||||
{
|
||||
parent::__construct($resource_server_context);
|
||||
$this->summit_repository = $summit_repository;
|
||||
$this->rsvp_template_repository = $rsvp_template_repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $summit_id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAllBySummit($summit_id){
|
||||
|
||||
$values = Input::all();
|
||||
$rules = [
|
||||
|
||||
'page' => 'integer|min:1',
|
||||
'per_page' => sprintf('required_with:page|integer|min:%s|max:%s', PagingConstants::MinPageSize, PagingConstants::MaxPageSize),
|
||||
];
|
||||
|
||||
try {
|
||||
|
||||
$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->resource_server_context)->find($summit_id);
|
||||
if (is_null($summit))
|
||||
return $this->error404();
|
||||
|
||||
$validation = Validator::make($values, $rules);
|
||||
|
||||
if ($validation->fails()) {
|
||||
$ex = new ValidationException();
|
||||
throw $ex->setMessages($validation->messages()->toArray());
|
||||
}
|
||||
|
||||
// default values
|
||||
$page = 1;
|
||||
$per_page = PagingConstants::DefaultPageSize;;
|
||||
|
||||
if (Input::has('page')) {
|
||||
$page = intval(Input::get('page'));
|
||||
$per_page = intval(Input::get('per_page'));
|
||||
}
|
||||
|
||||
$filter = null;
|
||||
|
||||
if (Input::has('filter')) {
|
||||
$filter = FilterParser::parse(Input::get('filter'), [
|
||||
'title' => ['=@', '=='],
|
||||
'is_enabled' => [ '=='],
|
||||
]);
|
||||
}
|
||||
|
||||
if(is_null($filter)) $filter = new Filter();
|
||||
|
||||
$filter->validate([
|
||||
'title' => 'sometimes|string',
|
||||
'is_enabled' => 'sometimes|boolean',
|
||||
]);
|
||||
|
||||
$order = null;
|
||||
|
||||
if (Input::has('order'))
|
||||
{
|
||||
$order = OrderParser::parse(Input::get('order'), [
|
||||
'id',
|
||||
'title',
|
||||
]);
|
||||
}
|
||||
|
||||
$data = $this->rsvp_template_repository->getBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
|
||||
|
||||
return $this->ok
|
||||
(
|
||||
$data->toArray
|
||||
(
|
||||
Request::input('expand', ''),
|
||||
[],
|
||||
[],
|
||||
[]
|
||||
)
|
||||
);
|
||||
}
|
||||
catch (ValidationException $ex1)
|
||||
{
|
||||
Log::warning($ex1);
|
||||
return $this->error412([ $ex1->getMessage()]);
|
||||
}
|
||||
catch (EntityNotFoundException $ex2)
|
||||
{
|
||||
Log::warning($ex2);
|
||||
return $this->error404(['message' => $ex2->getMessage()]);
|
||||
}
|
||||
catch(\HTTP401UnauthorizedException $ex3)
|
||||
{
|
||||
Log::warning($ex3);
|
||||
return $this->error401();
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->error500($ex);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -147,7 +147,7 @@ final class Filter
|
|||
* @param array $messages
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function validate(array $rules, array $messages){
|
||||
public function validate(array $rules, array $messages = []){
|
||||
$filter_key_values = $this->getFiltersKeyValues();
|
||||
foreach($rules as $field => $rule) {
|
||||
if(!isset($filter_key_values[$field])) continue;
|
||||
|
|
|
@ -164,6 +164,11 @@ Route::group([
|
|||
|
||||
Route::group(array('prefix' => '{id}'), function () {
|
||||
|
||||
// rsvp templates
|
||||
Route::group(array('prefix' => 'rsvp-templates'), function () {
|
||||
Route::get('', [ 'middleware' => 'auth.user:administrators|summit-front-end-administrators', 'uses' => 'OAuth2SummitRSVPTemplatesApiController@getAllBySummit']);
|
||||
});
|
||||
|
||||
Route::get('', [ 'middleware' => 'cache:'.Config::get('cache_api_response.get_summit_response_lifetime', 1200), 'uses' => 'OAuth2SummitApiController@getSummit'])->where('id', 'current|[0-9]+');
|
||||
|
||||
Route::get('entity-events', 'OAuth2SummitApiController@getSummitEntityEvents');
|
||||
|
@ -295,6 +300,7 @@ Route::group([
|
|||
Route::group(['prefix' => 'rooms'], function () {
|
||||
Route::post('', [ 'middleware' => 'auth.user:administrators|summit-front-end-administrators', 'uses' => 'OAuth2SummitLocationsApiController@addVenueRoom']);
|
||||
Route::group(['prefix' => '{room_id}'], function () {
|
||||
Route::get('', 'OAuth2SummitLocationsApiController@getVenueRoom');
|
||||
Route::put('', [ 'middleware' => 'auth.user:administrators|summit-front-end-administrators', 'uses' => 'OAuth2SummitLocationsApiController@updateVenueRoom']);
|
||||
Route::delete('', [ 'middleware' => 'auth.user:administrators|summit-front-end-administrators', 'uses' => 'OAuth2SummitLocationsApiController@deleteVenueRoom']);
|
||||
});
|
||||
|
|
|
@ -19,12 +19,12 @@ use ModelSerializers\SerializerRegistry;
|
|||
*/
|
||||
final class SummitVenueRoomSerializer extends SummitAbstractLocationSerializer
|
||||
{
|
||||
protected static $array_mappings = array
|
||||
(
|
||||
'VenueId' => 'venue_id:json_int',
|
||||
'FloorId' => 'floor_id:json_int',
|
||||
'Capacity' => 'capacity:json_int',
|
||||
);
|
||||
protected static $array_mappings = [
|
||||
'VenueId' => 'venue_id:json_int',
|
||||
'FloorId' => 'floor_id:json_int',
|
||||
'Capacity' => 'capacity:json_int',
|
||||
'OverrideBlackouts' => 'override_blackouts:json_boolean',
|
||||
];
|
||||
|
||||
public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
|
||||
{
|
||||
|
|
|
@ -36,6 +36,10 @@ use App\ModelSerializers\Marketplace\SpokenLanguageSerializer;
|
|||
use App\ModelSerializers\Marketplace\SupportChannelTypeSerializer;
|
||||
use App\ModelSerializers\Software\OpenStackComponentSerializer;
|
||||
use App\ModelSerializers\Software\OpenStackReleaseSerializer;
|
||||
use App\ModelSerializers\Summit\RSVP\Templates\RSVPMultiValueQuestionTemplateSerializer;
|
||||
use App\ModelSerializers\Summit\RSVP\Templates\RSVPQuestionValueTemplateSerializer;
|
||||
use App\ModelSerializers\Summit\RSVP\Templates\RSVPSingleValueTemplateQuestionSerializer;
|
||||
use App\ModelSerializers\Summit\RSVPTemplateSerializer;
|
||||
use App\ModelSerializers\Summit\ScheduledSummitLocationBannerSerializer;
|
||||
use App\ModelSerializers\Summit\SummitLocationBannerSerializer;
|
||||
use Libs\ModelSerializers\IModelSerializer;
|
||||
|
@ -107,7 +111,22 @@ final class SerializerRegistry
|
|||
self::SerializerType_Private => AdminPresentationSpeakerSerializer::class
|
||||
];
|
||||
|
||||
// RSVP
|
||||
$this->registry['RSVP'] = RSVPSerializer::class;
|
||||
$this->registry['RSVPTemplate'] = RSVPTemplateSerializer::class;
|
||||
$this->registry['RSVPQuestionValueTemplate'] = RSVPQuestionValueTemplateSerializer::class;
|
||||
|
||||
$this->registry['RSVPSingleValueTemplateQuestion'] = RSVPSingleValueTemplateQuestionSerializer::class;
|
||||
$this->registry['RSVPTextBoxQuestionTemplate'] = RSVPSingleValueTemplateQuestionSerializer::class;
|
||||
$this->registry['RSVPTextAreaQuestionTemplate'] = RSVPSingleValueTemplateQuestionSerializer::class;
|
||||
$this->registry['RSVPMemberEmailQuestionTemplate'] = RSVPSingleValueTemplateQuestionSerializer::class;
|
||||
$this->registry['RSVPMemberFirstNameQuestionTemplate'] = RSVPSingleValueTemplateQuestionSerializer::class;
|
||||
$this->registry['RSVPMemberLastNameQuestionTemplate'] = RSVPSingleValueTemplateQuestionSerializer::class;
|
||||
$this->registry['RSVPMemberLastNameQuestionTemplate'] = RSVPSingleValueTemplateQuestionSerializer::class;
|
||||
|
||||
$this->registry['RSVPCheckBoxListQuestionTemplate'] = RSVPMultiValueQuestionTemplateSerializer::class;
|
||||
$this->registry['RSVPRadioButtonListQuestionTemplate'] = RSVPMultiValueQuestionTemplateSerializer::class;
|
||||
|
||||
$this->registry['SpeakerExpertise'] = SpeakerExpertiseSerializer::class;
|
||||
$this->registry['SpeakerLanguage'] = SpeakerLanguageSerializer::class;
|
||||
$this->registry['SpeakerTravelPreference'] = SpeakerTravelPreferenceSerializer::class;
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
use models\summit\PresentationSpeakerSummitAssistanceConfirmationRequest;
|
||||
|
||||
/**
|
||||
* Class PresentationSpeakerSummitAssistanceConfirmationRequestSerializer
|
||||
* @package ModelSerializers
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
*/
|
||||
final class RSVPSerializer extends SilverStripeSerializer
|
||||
{
|
||||
protected static $array_mappings = array
|
||||
(
|
||||
protected static $array_mappings = [
|
||||
|
||||
'OwnerId' => 'owner_id:json_int',
|
||||
'EventId' => 'event_id:json_int',
|
||||
'SeatType' => 'seat_type:json_string',
|
||||
'Created' => 'created:datetime_epoch',
|
||||
);
|
||||
];
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php namespace App\ModelSerializers\Summit\RSVP\Templates;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Class RSVPLiteralContentQuestionTemplateSerializer
|
||||
* @package App\ModelSerializers\Summit\RSVP\Templates
|
||||
*/
|
||||
class RSVPLiteralContentQuestionTemplateSerializer extends RSVPQuestionTemplateSerializer
|
||||
{
|
||||
protected static $array_mappings = [
|
||||
'Content'=> 'content:json_string',
|
||||
];
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
<?php namespace App\ModelSerializers\Summit\RSVP\Templates;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Summit\Events\RSVP\RSVPMultiValueQuestionTemplate;
|
||||
use App\Models\Foundation\Summit\Events\RSVP\RSVPQuestionTemplate;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
|
||||
/**
|
||||
* Class RSVPMultiValueQuestionTemplateSerializer
|
||||
* @package App\ModelSerializers\Summit\RSVP\Templates
|
||||
*/
|
||||
class RSVPMultiValueQuestionTemplateSerializer extends RSVPQuestionTemplateSerializer
|
||||
{
|
||||
protected static $array_mappings = [
|
||||
'EmptyString'=> 'empty_string:json_string',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = [], array $relations = [], array $params = [])
|
||||
{
|
||||
$question = $this->object;
|
||||
if(! $question instanceof RSVPMultiValueQuestionTemplate) return [];
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
$question_values = [];
|
||||
foreach ($question->getValues() as $value){
|
||||
$question_values[] = SerializerRegistry::getInstance()->getSerializer($value)->serialize($expand, [], ['none']);
|
||||
}
|
||||
|
||||
$values['values'] = $question_values;
|
||||
if($question->hasDefaultValue())
|
||||
$values['default_value'] = SerializerRegistry::getInstance()->getSerializer($question->getDefaultValue())->serialize($expand, [], ['none']);;
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php namespace App\ModelSerializers\Summit\RSVP\Templates;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class RSVPQuestionTemplateSerializer
|
||||
* @package App\ModelSerializers\Summit\RSVP\Templates
|
||||
*/
|
||||
class RSVPQuestionTemplateSerializer extends SilverStripeSerializer
|
||||
{
|
||||
protected static $array_mappings = [
|
||||
'Name' => 'name:json_string',
|
||||
'Label' => 'label:json_string',
|
||||
'Order' => 'order:json_int',
|
||||
'Mandatory' => 'is_mandatory:json_boolean',
|
||||
'ReadOnly' => 'is_read_only:json_boolean',
|
||||
'ClassName' => 'class_name:json_string',
|
||||
];
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<?php namespace App\ModelSerializers\Summit\RSVP\Templates;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class RSVPQuestionValueTemplateSerializer
|
||||
* @package App\ModelSerializers\Summit\RSVP\Templates
|
||||
*/
|
||||
class RSVPQuestionValueTemplateSerializer extends SilverStripeSerializer
|
||||
{
|
||||
protected static $array_mappings = [
|
||||
'Value' => 'value:json_string',
|
||||
'Label' => 'label:json_string',
|
||||
'Order' => 'order:json_int',
|
||||
'OwnerId' => 'owner_id:json_int',
|
||||
];
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php namespace App\ModelSerializers\Summit\RSVP\Templates;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Class RSVPSingleValueTemplateQuestionSerializer
|
||||
* @package App\ModelSerializers\Summit\RSVP\Templates
|
||||
*/
|
||||
class RSVPSingleValueTemplateQuestionSerializer extends RSVPQuestionTemplateSerializer
|
||||
{
|
||||
protected static $array_mappings = [
|
||||
'InitialValue' => 'initial_value:json_string',
|
||||
];
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?php namespace App\ModelSerializers\Summit;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Models\Foundation\Summit\Events\RSVP\RSVPTemplate;
|
||||
use ModelSerializers\SerializerRegistry;
|
||||
use ModelSerializers\SilverStripeSerializer;
|
||||
/**
|
||||
* Class RSVPTemplateSerializer
|
||||
* @package App\ModelSerializers\Summit
|
||||
*/
|
||||
final class RSVPTemplateSerializer extends SilverStripeSerializer
|
||||
{
|
||||
protected static $array_mappings = [
|
||||
|
||||
'Title' => 'title:json_string',
|
||||
'Enabled' => 'is_enable:json_boolean',
|
||||
'CreatedById' => 'created_by_id:json_int',
|
||||
'SummitId' => 'summit_id:json_int',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param null $expand
|
||||
* @param array $fields
|
||||
* @param array $relations
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function serialize($expand = null, array $fields = [], array $relations = [], array $params = [])
|
||||
{
|
||||
$template = $this->object;
|
||||
if(! $template instanceof RSVPTemplate) return [];
|
||||
$values = parent::serialize($expand, $fields, $relations, $params);
|
||||
|
||||
$questions = [];
|
||||
foreach ($template->getQuestions() as $question){
|
||||
$questions[] = SerializerRegistry::getInstance()->getSerializer($question)->serialize($expand, [], ['none']);
|
||||
}
|
||||
|
||||
$values['questions'] = $questions;
|
||||
|
||||
if (!empty($expand)) {
|
||||
$exp_expand = explode(',', $expand);
|
||||
foreach ($exp_expand as $relation) {
|
||||
switch (trim($relation)) {
|
||||
|
||||
case 'created_by':
|
||||
{
|
||||
if($template->hasCreatedBy()) {
|
||||
unset($values['created_by_id']);
|
||||
$values['created_by'] = SerializerRegistry::getInstance()->getSerializer($template)->serialize($expand, [], ['none']);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,6 @@
|
|||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="repositories\main\DoctrineGroupRepository")
|
||||
* @ORM\Table(name="`Group`")
|
||||
|
|
|
@ -44,7 +44,7 @@ class PrivatePresentationCategoryGroup extends PresentationCategoryGroup
|
|||
protected $max_submission_allowed_per_user;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="models\main\Group", inversedBy="groups")
|
||||
* @ORM\ManyToMany(targetEntity="models\main\Group")
|
||||
* @ORM\JoinTable(name="PrivatePresentationCategoryGroup_AllowedGroups",
|
||||
* joinColumns={@ORM\JoinColumn(name="PrivatePresentationCategoryGroupID", referencedColumnName="ID")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="GroupID", referencedColumnName="ID")}
|
||||
|
|
|
@ -42,14 +42,14 @@ class SummitSelectedPresentation extends SilverstripeBaseModel
|
|||
private $order;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="SummitSelectedPresentationList")
|
||||
* @ORM\ManyToOne(targetEntity="SummitSelectedPresentationList", inversedBy="selected_presentations")
|
||||
* @ORM\JoinColumn(name="SummitSelectedPresentationListID", referencedColumnName="ID")
|
||||
* @var SummitSelectedPresentationList
|
||||
*/
|
||||
private $list;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Presentation")
|
||||
* @ORM\ManyToOne(targetEntity="Presentation", inversedBy="selected_presentations")
|
||||
* @ORM\JoinColumn(name="PresentationID", referencedColumnName="ID")
|
||||
* @var Presentation
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPCheckBoxListQuestionTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPCheckBoxListQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPCheckBoxListQuestionTemplate extends RSVPMultiValueQuestionTemplate
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPCheckBoxListQuestionTemplate';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPLiteralContentQuestionTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPLiteralContentQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPLiteralContentQuestionTemplate extends RSVPQuestionTemplate
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Content", type="string")
|
||||
* @var string
|
||||
*/
|
||||
protected $content;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPLiteralContentQuestionTemplate';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPMemberEmailQuestionTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPMemberEmailQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPMemberEmailQuestionTemplate extends RSVPTextBoxQuestionTemplate
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPMemberEmailQuestionTemplate';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPMemberFirstNameQuestionTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPMemberFirstNameQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPMemberFirstNameQuestionTemplate extends RSVPTextBoxQuestionTemplate
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPMemberFirstNameQuestionTemplate';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPMemberLastNameQuestionTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPMemberLastNameQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPMemberLastNameQuestionTemplate extends RSVPTextBoxQuestionTemplate
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPMemberLastNameQuestionTemplate';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPMultiValueQuestionTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPMultiValueQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPMultiValueQuestionTemplate extends RSVPQuestionTemplate
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="EmptyString", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $empty_string;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="RSVPQuestionValueTemplate", mappedBy="owner", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var RSVPQuestionValueTemplate[]
|
||||
*/
|
||||
private $values;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="RSVPQuestionValueTemplate", fetch="EXTRA_LAZY")
|
||||
* @ORM\JoinColumn(name="DefaultValueID", referencedColumnName="ID")
|
||||
* @var RSVPQuestionValueTemplate
|
||||
*/
|
||||
private $default_value;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEmptyString()
|
||||
{
|
||||
return $this->empty_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $empty_string
|
||||
*/
|
||||
public function setEmptyString($empty_string)
|
||||
{
|
||||
$this->empty_string = $empty_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RSVPQuestionValueTemplate[]
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
$criteria = Criteria::create();
|
||||
$criteria->orderBy(['order'=> 'ASC']);
|
||||
return $this->values->matching($criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $values
|
||||
*/
|
||||
public function setValues($values)
|
||||
{
|
||||
$this->values = $values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RSVPQuestionValueTemplate
|
||||
*/
|
||||
public function getDefaultValue()
|
||||
{
|
||||
return $this->default_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RSVPQuestionValueTemplate $default_value
|
||||
*/
|
||||
public function setDefaultValue(RSVPQuestionValueTemplate $default_value)
|
||||
{
|
||||
$this->default_value = $default_value;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->values = new ArrayCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPMultiValueQuestionTemplate';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDefaultValue(){
|
||||
return $this->getDefaultValueId() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDefaultValueId(){
|
||||
try{
|
||||
return is_null($this->default_value) ? 0 : $this->default_value->getId();
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPQuestionTemplate_DependsOn")
|
||||
* @ORM\Entity
|
||||
* Class RSVPQuestionDependsOn
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPQuestionDependsOn extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="RSVPQuestionTemplate", inversedBy="depends_on")
|
||||
* @ORM\JoinColumn(name="RSVPQuestionTemplateID", referencedColumnName="ID", onDelete="CASCADE")
|
||||
* @var RSVPQuestionTemplate
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="RSVPQuestionTemplate")
|
||||
* @ORM\JoinColumn(name="ChildID", referencedColumnName="ID", onDelete="CASCADE")
|
||||
* @var RSVPQuestionTemplate
|
||||
*/
|
||||
private $child;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $operator;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $visibility;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $default_value;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $boolean_op;
|
||||
|
||||
/**
|
||||
* @return RSVPQuestionTemplate
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RSVPQuestionTemplate $parent
|
||||
*/
|
||||
public function setParent($parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RSVPQuestionTemplate
|
||||
*/
|
||||
public function getChild()
|
||||
{
|
||||
return $this->child;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RSVPQuestionTemplate $child
|
||||
*/
|
||||
public function setChild($child)
|
||||
{
|
||||
$this->child = $child;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOperator()
|
||||
{
|
||||
return $this->operator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $operator
|
||||
*/
|
||||
public function setOperator($operator)
|
||||
{
|
||||
$this->operator = $operator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVisibility()
|
||||
{
|
||||
return $this->visibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $visibility
|
||||
*/
|
||||
public function setVisibility($visibility)
|
||||
{
|
||||
$this->visibility = $visibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultValue()
|
||||
{
|
||||
return $this->default_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $default_value
|
||||
*/
|
||||
public function setDefaultValue($default_value)
|
||||
{
|
||||
$this->default_value = $default_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBooleanOp()
|
||||
{
|
||||
return $this->boolean_op;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $boolean_op
|
||||
*/
|
||||
public function setBooleanOp($boolean_op)
|
||||
{
|
||||
$this->boolean_op = $boolean_op;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,186 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="RSVPQuestionTemplate")
|
||||
* @ORM\InheritanceType("JOINED")
|
||||
* @ORM\DiscriminatorColumn(name="ClassName", type="string")
|
||||
* @ORM\DiscriminatorMap({
|
||||
* "RSVPQuestionTemplate" = "RSVPQuestionTemplate",
|
||||
* "RSVPLiteralContentQuestionTemplate"= "RSVPLiteralContentQuestionTemplate",
|
||||
* "RSVPMultiValueQuestionTemplate" = "RSVPMultiValueQuestionTemplate",
|
||||
* "RSVPSingleValueTemplateQuestion" = "RSVPSingleValueTemplateQuestion",
|
||||
* "RSVPTextBoxQuestionTemplate" = "RSVPTextBoxQuestionTemplate",
|
||||
* "RSVPTextAreaQuestionTemplate" = "RSVPTextAreaQuestionTemplate",
|
||||
* "RSVPMemberEmailQuestionTemplate" = "RSVPMemberEmailQuestionTemplate",
|
||||
* "RSVPMemberFirstNameQuestionTemplate" = "RSVPMemberFirstNameQuestionTemplate",
|
||||
* "RSVPMemberLastNameQuestionTemplate" = "RSVPMemberLastNameQuestionTemplate",
|
||||
* "RSVPCheckBoxListQuestionTemplate" = "RSVPCheckBoxListQuestionTemplate",
|
||||
* "RSVPRadioButtonListQuestionTemplate" = "RSVPRadioButtonListQuestionTemplate"
|
||||
* })
|
||||
* Class RSVPQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPQuestionTemplate extends SilverstripeBaseModel
|
||||
{
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Name", type="string")
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Label", type="string")
|
||||
* @var string
|
||||
*/
|
||||
protected $label;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Mandatory", type="boolean")
|
||||
* @var boolean
|
||||
*/
|
||||
protected $is_mandatory;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="`Order`", type="string")
|
||||
* @var string
|
||||
*/
|
||||
protected $order;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="ReadOnly", type="boolean")
|
||||
* @var boolean
|
||||
*/
|
||||
protected $is_read_only;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="RSVPTemplate", fetch="EXTRA_LAZY", inversedBy="questions")
|
||||
* @ORM\JoinColumn(name="RSVPTemplateID", referencedColumnName="ID", onDelete="CASCADE")
|
||||
* @var RSVPTemplate
|
||||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="RSVPQuestionDependsOn", mappedBy="parent", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var RSVPQuestionDependsOn[]
|
||||
*/
|
||||
protected $depends_on;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $label
|
||||
*/
|
||||
public function setLabel($label)
|
||||
{
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isMandatory()
|
||||
{
|
||||
return $this->is_mandatory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $is_mandatory
|
||||
*/
|
||||
public function setIsMandatory($is_mandatory)
|
||||
{
|
||||
$this->is_mandatory = $is_mandatory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $order
|
||||
*/
|
||||
public function setOrder($order)
|
||||
{
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isReadOnly()
|
||||
{
|
||||
return $this->is_read_only;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $is_read_only
|
||||
*/
|
||||
public function setIsReadOnly($is_read_only)
|
||||
{
|
||||
$this->is_read_only = $is_read_only;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RSVPTemplate
|
||||
*/
|
||||
public function getTemplate()
|
||||
{
|
||||
return $this->template;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RSVPTemplate $template
|
||||
*/
|
||||
public function setTemplate(RSVPTemplate $template)
|
||||
{
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPQuestionTemplate';
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPQuestionValueTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPQuestionValueTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPQuestionValueTemplate extends SilverstripeBaseModel
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="Value", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="Label", type="string")
|
||||
* @var string
|
||||
*/
|
||||
private $label;
|
||||
|
||||
/**
|
||||
* @ORM\Column(name="`Order`", type="integer")
|
||||
* @var int
|
||||
*/
|
||||
private $order;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="RSVPMultiValueQuestionTemplate", inversedBy="values")
|
||||
* @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID")
|
||||
* @var RSVPMultiValueQuestionTemplate
|
||||
*/
|
||||
private $owner;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $label
|
||||
*/
|
||||
public function setLabel($label)
|
||||
{
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $order
|
||||
*/
|
||||
public function setOrder($order)
|
||||
{
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RSVPMultiValueQuestionTemplate
|
||||
*/
|
||||
public function getOwner()
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RSVPMultiValueQuestionTemplate $owner
|
||||
*/
|
||||
public function setOwner(RSVPMultiValueQuestionTemplate $owner)
|
||||
{
|
||||
$this->owner = $owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getOwnerId(){
|
||||
try{
|
||||
return is_null($this->owner) ? 0 : $this->owner->getId();
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPRadioButtonListQuestionTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPRadioButtonListQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPRadioButtonListQuestionTemplate extends RSVPMultiValueQuestionTemplate
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPRadioButtonListQuestionTemplate';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPSingleValueTemplateQuestion")
|
||||
* @ORM\Entity
|
||||
* Class RSVPSingleValueTemplateQuestion
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPSingleValueTemplateQuestion extends RSVPQuestionTemplate
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(name="InitialValue", type="string")
|
||||
* @var string
|
||||
*/
|
||||
protected $initial_value;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getInitialValue()
|
||||
{
|
||||
return $this->initial_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $initial_value
|
||||
*/
|
||||
public function setInitialValue($initial_value)
|
||||
{
|
||||
$this->initial_value = $initial_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPSingleValueTemplateQuestion';
|
||||
}
|
||||
}
|
|
@ -11,6 +11,8 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use models\main\Member;
|
||||
use models\summit\SummitOwned;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
|
@ -44,6 +46,12 @@ class RSVPTemplate extends SilverstripeBaseModel
|
|||
*/
|
||||
private $created_by;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="RSVPQuestionTemplate", mappedBy="template", cascade={"persist"}, orphanRemoval=true)
|
||||
* @var RSVPQuestionTemplate[]
|
||||
*/
|
||||
private $questions;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
@ -91,4 +99,48 @@ class RSVPTemplate extends SilverstripeBaseModel
|
|||
{
|
||||
$this->created_by = $created_by;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCreatedById(){
|
||||
try{
|
||||
return is_null($this->created_by) ? 0 : $this->created_by->getId();
|
||||
}
|
||||
catch (\Exception $ex){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCreatedBy(){
|
||||
return $this->getCreatedById() > 0;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->questions = new ArrayCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RSVPQuestionTemplate[]
|
||||
*/
|
||||
public function getQuestions()
|
||||
{
|
||||
$criteria = Criteria::create();
|
||||
$criteria->orderBy(['order'=> 'ASC']);
|
||||
return $this->questions->matching($criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $questions
|
||||
*/
|
||||
public function setQuestions($questions)
|
||||
{
|
||||
$this->questions = $questions;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPTextAreaQuestionTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPTextAreaQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPTextAreaQuestionTemplate extends RSVPSingleValueTemplateQuestion
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPTextAreaQuestionTemplate';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?php namespace App\Models\Foundation\Summit\Events\RSVP;
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\ORM\Mapping AS ORM;
|
||||
/**
|
||||
* @ORM\Table(name="RSVPTextBoxQuestionTemplate")
|
||||
* @ORM\Entity
|
||||
* Class RSVPTextBoxQuestionTemplate
|
||||
* @package App\Models\Foundation\Summit\Events\RSVP
|
||||
*/
|
||||
class RSVPTextBoxQuestionTemplate extends RSVPSingleValueTemplateQuestion
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(){
|
||||
return 'RSVPTextBoxQuestionTemplate';
|
||||
}
|
||||
}
|
|
@ -62,7 +62,7 @@ class SummitLocationBanner extends SilverstripeBaseModel
|
|||
protected $enabled;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="models\summit\SummitAbstractLocation", fetch="EXTRA_LAZY")
|
||||
* @ORM\ManyToOne(targetEntity="models\summit\SummitAbstractLocation", fetch="EXTRA_LAZY", inversedBy="banners")
|
||||
* @ORM\JoinColumn(name="LocationID", referencedColumnName="ID", onDelete="SET NULL")
|
||||
* @var SummitAbstractLocation
|
||||
*/
|
||||
|
|
|
@ -201,7 +201,10 @@ class SummitAbstractLocation extends SilverstripeBaseModel
|
|||
$new_end = $banner->getLocalEndDate();
|
||||
|
||||
foreach ($this->banners as $old_banner){
|
||||
if($old_banner instanceof ScheduledSummitLocationBanner && $old_banner->isEnabled() && $old_banner->getId() != $banner->getId()){
|
||||
if($old_banner instanceof ScheduledSummitLocationBanner
|
||||
&& $old_banner->isEnabled()
|
||||
&& $old_banner->getId() != $banner->getId()
|
||||
&& $old_banner->getType() == $banner->getType()){
|
||||
$old_start = $old_banner->getLocalStartDate();
|
||||
$old_end = $old_banner->getLocalEndDate();
|
||||
// (StartA <= EndB) and (EndA >= StartB)
|
||||
|
|
|
@ -166,7 +166,7 @@ class SummitVenueFloor extends SilverstripeBaseModel
|
|||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->rooms = new ArrayCollection();
|
||||
$this->rooms = new ArrayCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ class SpeakerSummitRegistrationPromoCode extends SummitRegistrationPromoCode
|
|||
protected $type;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="PresentationSpeaker")
|
||||
* @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="promo_codes")
|
||||
* @ORM\JoinColumn(name="SpeakerID", referencedColumnName="ID")
|
||||
* @var PresentationSpeaker
|
||||
*/
|
||||
|
|
|
@ -11,12 +11,31 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use models\summit\Summit;
|
||||
use models\utils\IBaseRepository;
|
||||
use utils\Filter;
|
||||
use utils\Order;
|
||||
use utils\PagingInfo;
|
||||
use utils\PagingResponse;
|
||||
/**
|
||||
* Interface IRSVPTemplateRepository
|
||||
* @package App\Models\Foundation\Summit\Repositories
|
||||
*/
|
||||
interface IRSVPTemplateRepository extends IBaseRepository
|
||||
{
|
||||
/**
|
||||
* @param Summit $summit
|
||||
* @param PagingInfo $paging_info
|
||||
* @param Filter|null $filter
|
||||
* @param Order|null $order
|
||||
* @return PagingResponse
|
||||
*/
|
||||
public function getBySummit
|
||||
(
|
||||
Summit $summit,
|
||||
PagingInfo $paging_info,
|
||||
Filter $filter = null,
|
||||
Order $order = null
|
||||
);
|
||||
|
||||
}
|
|
@ -53,7 +53,7 @@ class PresentationSpeakerSummitAssistanceConfirmationRequest extends Silverstrip
|
|||
private $confirmation_date;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="PresentationSpeaker")
|
||||
* @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="summit_assistances")
|
||||
* @ORM\JoinColumn(name="SpeakerID", referencedColumnName="ID")
|
||||
* @var PresentationSpeaker
|
||||
*/
|
||||
|
|
|
@ -51,7 +51,7 @@ class SpeakerAnnouncementSummitEmail extends SilverstripeBaseModel
|
|||
Use SummitOwned;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="models\summit\PresentationSpeaker")
|
||||
* @ORM\ManyToOne(targetEntity="models\summit\PresentationSpeaker", inversedBy="announcement_summit_emails")
|
||||
* @ORM\JoinColumn(name="SpeakerID", referencedColumnName="ID")
|
||||
* @var PresentationSpeaker
|
||||
*/
|
||||
|
@ -105,6 +105,4 @@ class SpeakerAnnouncementSummitEmail extends SilverstripeBaseModel
|
|||
$this->speaker = $speaker;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -35,7 +35,6 @@ final class DoctrineFolderRepository
|
|||
select * from File where ClassName = 'Folder' AND
|
||||
Name = :folder_name
|
||||
SQL;
|
||||
|
||||
// build rsm here
|
||||
$rsm = new ResultSetMappingBuilder($this->_em);
|
||||
$rsm->addRootEntityFromClassMetadata(\models\main\File::class, 'f');
|
||||
|
@ -43,7 +42,7 @@ SQL;
|
|||
|
||||
$native_query->setParameter("folder_name", $folder_name);
|
||||
|
||||
return $native_query->getSingleResult();
|
||||
return $native_query->getOneOrNullResult();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
use App\Models\Foundation\Summit\Events\RSVP\RSVPTemplate;
|
||||
use App\Models\Foundation\Summit\Repositories\IRSVPTemplateRepository;
|
||||
use App\Repositories\SilverStripeDoctrineRepository;
|
||||
use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||
use models\summit\Summit;
|
||||
use utils\Filter;
|
||||
use utils\Order;
|
||||
use utils\PagingInfo;
|
||||
use utils\PagingResponse;
|
||||
/**
|
||||
* Class DoctrineRSVPTemplateRepository
|
||||
* @package App\Repositories\Summit
|
||||
|
@ -30,4 +36,80 @@ final class DoctrineRSVPTemplateRepository
|
|||
{
|
||||
return RSVPTemplate::class;
|
||||
}
|
||||
|
||||
protected function getFilterMappings()
|
||||
{
|
||||
return [
|
||||
'title' => 't.title:json_string',
|
||||
'is_enabled' => 't.is_enabled:json_boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getOrderMappings()
|
||||
{
|
||||
return [
|
||||
'id' => 't.id',
|
||||
'title' => 't.title',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Summit $summit
|
||||
* @param PagingInfo $paging_info
|
||||
* @param Filter|null $filter
|
||||
* @param Order|null $order
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBySummit
|
||||
(
|
||||
Summit $summit,
|
||||
PagingInfo $paging_info,
|
||||
Filter $filter = null,
|
||||
Order $order = null
|
||||
)
|
||||
{
|
||||
$query = $this->getEntityManager()
|
||||
->createQueryBuilder()
|
||||
->select("t")
|
||||
->from(RSVPTemplate::class, "t")
|
||||
->leftJoin('t.summit', 's')
|
||||
->leftJoin('t.created_by', 'o')
|
||||
->where("s.id = :summit_id");
|
||||
|
||||
$query->setParameter("summit_id", $summit->getId());
|
||||
|
||||
if(!is_null($filter)){
|
||||
$filter->apply2Query($query, $this->getFilterMappings());
|
||||
}
|
||||
|
||||
if (!is_null($order)) {
|
||||
$order->apply2Query($query, $this->getOrderMappings());
|
||||
} else {
|
||||
//default order
|
||||
$query = $query->addOrderBy("t.id",'ASC');
|
||||
}
|
||||
|
||||
$query = $query
|
||||
->setFirstResult($paging_info->getOffset())
|
||||
->setMaxResults($paging_info->getPerPage());
|
||||
|
||||
$paginator = new Paginator($query, $fetchJoinCollection = true);
|
||||
$total = $paginator->count();
|
||||
$data = [];
|
||||
|
||||
foreach($paginator as $entity)
|
||||
$data[] = $entity;
|
||||
|
||||
return new PagingResponse
|
||||
(
|
||||
$total,
|
||||
$paging_info->getPerPage(),
|
||||
$paging_info->getCurrentPage(),
|
||||
$paging_info->getLastPage($total),
|
||||
$data
|
||||
);
|
||||
}
|
||||
}
|
|
@ -756,7 +756,7 @@ final class LocationService implements ILocationService
|
|||
if (isset($data['name'])) {
|
||||
$old_location = $summit->getLocationByName(trim($data['name']));
|
||||
|
||||
if (!is_null($old_location)) {
|
||||
if (!is_null($old_location) && $old_location->getId() != $room_id) {
|
||||
throw new ValidationException
|
||||
(
|
||||
trans
|
||||
|
@ -1057,7 +1057,7 @@ final class LocationService implements ILocationService
|
|||
);
|
||||
}
|
||||
|
||||
$banner = SummitLocationBannerFactory::populate($summit, $location, $data, $banner);
|
||||
$banner = SummitLocationBannerFactory::populate($summit, $location, $banner, $data);
|
||||
$location->validateBanner($banner);
|
||||
return $banner;
|
||||
});
|
||||
|
|
|
@ -546,6 +546,43 @@ class ApiEndpointsSeeder extends Seeder
|
|||
sprintf(SummitScopes::WriteLocationsData, $current_realm)
|
||||
],
|
||||
],
|
||||
// images
|
||||
[
|
||||
'name' => 'add-location-image',
|
||||
'route' => '/api/v1/summits/{id}/locations/{location_id}/images',
|
||||
'http_method' => 'POST',
|
||||
'scopes' => [
|
||||
sprintf(SummitScopes::WriteSummitData, $current_realm),
|
||||
sprintf(SummitScopes::WriteLocationsData, $current_realm)
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'update-location-image',
|
||||
'route' => '/api/v1/summits/{id}/locations/{location_id}/images/{image_id}',
|
||||
'http_method' => 'PUT',
|
||||
'scopes' => [
|
||||
sprintf(SummitScopes::WriteSummitData, $current_realm),
|
||||
sprintf(SummitScopes::WriteLocationsData, $current_realm)
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'get-location-image',
|
||||
'route' => '/api/v1/summits/{id}/locations/{location_id}/images/{image_id}',
|
||||
'http_method' => 'GET',
|
||||
'scopes' => [
|
||||
sprintf(SummitScopes::ReadSummitData, $current_realm),
|
||||
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'delete-location-image',
|
||||
'route' => '/api/v1/summits/{id}/locations/{location_id}/images/{image_id}',
|
||||
'http_method' => 'DELETE',
|
||||
'scopes' => [
|
||||
sprintf(SummitScopes::WriteSummitData, $current_realm),
|
||||
sprintf(SummitScopes::WriteLocationsData, $current_realm)
|
||||
],
|
||||
],
|
||||
// banners
|
||||
[
|
||||
'name' => 'get-location-banners',
|
||||
|
@ -651,6 +688,15 @@ class ApiEndpointsSeeder extends Seeder
|
|||
sprintf(SummitScopes::WriteLocationsData, $current_realm)
|
||||
],
|
||||
],
|
||||
// rsvp templates
|
||||
[
|
||||
'name' => 'get-rsvp-templates',
|
||||
'route' => '/api/v1/summits/{id}/rsvp-templates',
|
||||
'http_method' => 'GET',
|
||||
'scopes' => [
|
||||
sprintf(SummitScopes::ReadAllSummitData, $current_realm)
|
||||
],
|
||||
],
|
||||
// rooms
|
||||
[
|
||||
'name' => 'get-venue-room',
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* Copyright 2018 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
final class OAuth2SummitRSVPTemplateApiTest extends ProtectedApiTest
|
||||
{
|
||||
public function testGetSummitRSVPTemplates($summit_id = 23)
|
||||
{
|
||||
$params = [
|
||||
'id' => $summit_id,
|
||||
'page' => 1,
|
||||
'per_page' => 5,
|
||||
'order' => '-id'
|
||||
];
|
||||
|
||||
$headers =
|
||||
[
|
||||
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
||||
"CONTENT_TYPE" => "application/json"
|
||||
];
|
||||
|
||||
$response = $this->action
|
||||
(
|
||||
"GET",
|
||||
"OAuth2SummitRSVPTemplatesApiController@getAllBySummit",
|
||||
$params,
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
$headers
|
||||
);
|
||||
|
||||
$content = $response->getContent();
|
||||
$this->assertResponseStatus(200);
|
||||
|
||||
$rsvp_templates = json_decode($content);
|
||||
$this->assertTrue(!is_null($rsvp_templates));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue