Added get unpublished events endpoint
added new endpoint to get unpublished events pers summit Change-Id: I30522725f4c537b6dd7ee682aa60ff5eb7ebd000
This commit is contained in:
parent
615b3dbf7c
commit
9aa563b5f5
@ -821,7 +821,6 @@ final class OAuth2SummitEventsApiController extends OAuth2ProtectedController
|
|||||||
return [$summit, $event, $data];
|
return [$summit, $event, $data];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function addEventAttachment(LaravelRequest $request, $summit_id, $event_id){
|
public function addEventAttachment(LaravelRequest $request, $summit_id, $event_id){
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -859,4 +858,29 @@ final class OAuth2SummitEventsApiController extends OAuth2ProtectedController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUnpublishedEvents($summit_id){
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$strategy = new RetrieveAllUnPublishedSummitEventsStrategy($this->repository, $this->event_repository);
|
||||||
|
$response = $strategy->getEvents(['summit_id' => $summit_id]);
|
||||||
|
return $this->ok($response->toArray(Request::input('expand', '')));
|
||||||
|
}
|
||||||
|
catch (EntityNotFoundException $ex1)
|
||||||
|
{
|
||||||
|
Log::warning($ex1);
|
||||||
|
return $this->error404();
|
||||||
|
}
|
||||||
|
catch (ValidationException $ex2)
|
||||||
|
{
|
||||||
|
Log::warning($ex2);
|
||||||
|
return $this->error412($ex2->getMessages());
|
||||||
|
}
|
||||||
|
catch (Exception $ex)
|
||||||
|
{
|
||||||
|
Log::error($ex);
|
||||||
|
return $this->error500($ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
<?php namespace App\Http\Controllers;
|
||||||
|
/**
|
||||||
|
* Copyright 2017 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 utils\Filter;
|
||||||
|
use utils\FilterParser;
|
||||||
|
/**
|
||||||
|
* Class RetrieveAllUnPublishedSummitEventsStrategy
|
||||||
|
* @package App\Http\Controllers
|
||||||
|
*/
|
||||||
|
class RetrieveAllUnPublishedSummitEventsStrategy extends RetrieveAllSummitEventsBySummitStrategy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected function getValidFilters()
|
||||||
|
{
|
||||||
|
$valid_filters = parent::getValidFilters();
|
||||||
|
$valid_filters['published'] = ['=='];
|
||||||
|
return $valid_filters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return null|Filter
|
||||||
|
*/
|
||||||
|
protected function buildFilter()
|
||||||
|
{
|
||||||
|
$filter = parent::buildFilter();
|
||||||
|
$filter->addFilterCondition(FilterParser::buildFilter('published','==','0'));
|
||||||
|
return $filter;
|
||||||
|
}
|
||||||
|
}
|
@ -109,12 +109,18 @@ abstract class RetrieveSummitEventsStrategy
|
|||||||
{
|
{
|
||||||
return array
|
return array
|
||||||
(
|
(
|
||||||
'title' => array('=@', '=='),
|
'title' => ['=@', '=='],
|
||||||
'tags' => array('=@', '=='),
|
'abstract' => ['=@', '=='],
|
||||||
'start_date' => array('>', '<', '<=', '>=', '=='),
|
'social_summary' => ['=@', '=='],
|
||||||
'end_date' => array('>', '<', '<=', '>=', '=='),
|
'tags' => ['=@', '=='],
|
||||||
'summit_type_id' => array('=='),
|
'start_date' => ['>', '<', '<=', '>=', '=='],
|
||||||
'event_type_id' => array('=='),
|
'end_date' => ['>', '<', '<=', '>=', '=='],
|
||||||
|
'summit_type_id' => ['=='],
|
||||||
|
'event_type_id' => ['=='],
|
||||||
|
'track_id' => ['=='],
|
||||||
|
'speaker' => ['=@', '=='],
|
||||||
|
'speaker_email' => ['=@', '=='],
|
||||||
|
'selection_status' => ['=='],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
53
app/Http/Utils/Filters/DoctrineCaseFilterMapping.php
Normal file
53
app/Http/Utils/Filters/DoctrineCaseFilterMapping.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php namespace utils;
|
||||||
|
/**
|
||||||
|
* Copyright 2017 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 DoctrineCaseFilterMapping
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $condition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DoctrineCaseFilterMapping constructor.
|
||||||
|
* @param string $value
|
||||||
|
* @param string $condition
|
||||||
|
*/
|
||||||
|
public function __construct($value, $condition)
|
||||||
|
{
|
||||||
|
$this->value = $value;
|
||||||
|
$this->condition = $condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCondition()
|
||||||
|
{
|
||||||
|
return $this->condition;
|
||||||
|
}
|
||||||
|
}
|
63
app/Http/Utils/Filters/DoctrineFilterMapping.php
Normal file
63
app/Http/Utils/Filters/DoctrineFilterMapping.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php namespace utils;
|
||||||
|
/**
|
||||||
|
* Copyright 2017 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\Query\Expr\Join;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DoctrineFilterMapping
|
||||||
|
* @package utils
|
||||||
|
*/
|
||||||
|
class DoctrineFilterMapping extends FilterMapping
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DoctrineFilterMapping constructor.
|
||||||
|
* @param string $condition
|
||||||
|
*/
|
||||||
|
public function __construct($condition)
|
||||||
|
{
|
||||||
|
parent::__construct("", $condition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FilterElement $filter
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function toRawSQL(FilterElement $filter)
|
||||||
|
{
|
||||||
|
throw new \Exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param QueryBuilder $query
|
||||||
|
* @param FilterElement $filter
|
||||||
|
* @return QueryBuilder
|
||||||
|
*/
|
||||||
|
public function apply(QueryBuilder $query, FilterElement $filter){
|
||||||
|
$where = str_replace(":value", $filter->getValue(), $this->where);
|
||||||
|
$where = str_replace(":operator", $filter->getOperator(), $where);
|
||||||
|
return $query->andWhere($where);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param QueryBuilder $query
|
||||||
|
* @param FilterElement $filter
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function applyOr(QueryBuilder $query, FilterElement $filter){
|
||||||
|
$where = str_replace(":value", $filter->getValue(), $this->where);
|
||||||
|
$where = str_replace(":operator", $filter->getOperator(), $where);
|
||||||
|
return $where;
|
||||||
|
}
|
||||||
|
}
|
64
app/Http/Utils/Filters/DoctrineSwitchFilterMapping.php
Normal file
64
app/Http/Utils/Filters/DoctrineSwitchFilterMapping.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?php namespace utils;
|
||||||
|
/**
|
||||||
|
* Copyright 2017 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\Query\Expr\Join;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DoctrineSwitchFilterMapping
|
||||||
|
* @package utils
|
||||||
|
*/
|
||||||
|
class DoctrineSwitchFilterMapping extends FilterMapping
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var DoctrineCaseFilterMapping[]
|
||||||
|
*/
|
||||||
|
private $case_statements;
|
||||||
|
|
||||||
|
public function __construct($case_statements = [])
|
||||||
|
{
|
||||||
|
parent::__construct("", "");
|
||||||
|
$this->case_statements = $case_statements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param FilterElement $filter
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function toRawSQL(FilterElement $filter)
|
||||||
|
{
|
||||||
|
throw new \Exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param QueryBuilder $query
|
||||||
|
* @param FilterElement $filter
|
||||||
|
* @return QueryBuilder
|
||||||
|
*/
|
||||||
|
public function apply(QueryBuilder $query, FilterElement $filter){
|
||||||
|
if(!isset($this->case_statements[$filter->getValue()])) return $query;
|
||||||
|
$case_statement = $this->case_statements[$filter->getValue()];
|
||||||
|
return $query->andWhere($case_statement->getCondition());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param QueryBuilder $query
|
||||||
|
* @param FilterElement $filter
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function applyOr(QueryBuilder $query, FilterElement $filter){
|
||||||
|
if(!isset($this->case_statements[$filter->getValue()])) return $query;
|
||||||
|
$case_statement = $this->case_statements[$filter->getValue()];
|
||||||
|
return $case_statement->getCondition();
|
||||||
|
}
|
||||||
|
}
|
@ -74,6 +74,14 @@ final class Filter
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $field
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasFilter($field){
|
||||||
|
return count($this->getFilter($field)) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $field
|
* @param string $field
|
||||||
* @return null|FilterElement[]
|
* @return null|FilterElement[]
|
||||||
@ -166,6 +174,14 @@ final class Filter
|
|||||||
$query = $mapping->apply($query, $filter);
|
$query = $mapping->apply($query, $filter);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($mapping instanceof DoctrineSwitchFilterMapping) {
|
||||||
|
$query = $mapping->apply($query, $filter);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($mapping instanceof DoctrineFilterMapping) {
|
||||||
|
$query = $mapping->apply($query, $filter);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if(is_array($mapping)){
|
else if(is_array($mapping)){
|
||||||
$condition = '';
|
$condition = '';
|
||||||
foreach ($mapping as $mapping_or){
|
foreach ($mapping as $mapping_or){
|
||||||
@ -203,7 +219,19 @@ final class Filter
|
|||||||
$mapping = $mappings[$e->getField()];
|
$mapping = $mappings[$e->getField()];
|
||||||
if ($mapping instanceof DoctrineJoinFilterMapping) {
|
if ($mapping instanceof DoctrineJoinFilterMapping) {
|
||||||
$condition = $mapping->applyOr($query, $e);
|
$condition = $mapping->applyOr($query, $e);
|
||||||
if(!empty($condition)) $condition .= ' OR ';
|
if(!empty($sub_or_query)) $sub_or_query .= ' OR ';
|
||||||
|
$sub_or_query .= $condition;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($mapping instanceof DoctrineSwitchFilterMapping) {
|
||||||
|
$condition = $mapping->applyOr($query, $e);
|
||||||
|
if(!empty($sub_or_query)) $sub_or_query .= ' OR ';
|
||||||
|
$sub_or_query .= $condition;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($mapping instanceof DoctrineFilterMapping) {
|
||||||
|
$condition = $mapping->applyOr($query, $e);
|
||||||
|
if(!empty($sub_or_query)) $sub_or_query .= ' OR ';
|
||||||
$sub_or_query .= $condition;
|
$sub_or_query .= $condition;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,10 @@ Route::group([
|
|||||||
Route::group(array('prefix' => 'events'), function () {
|
Route::group(array('prefix' => 'events'), function () {
|
||||||
|
|
||||||
Route::get('', 'OAuth2SummitEventsApiController@getEvents');
|
Route::get('', 'OAuth2SummitEventsApiController@getEvents');
|
||||||
|
Route::group(array('prefix' => 'unpublished'), function () {
|
||||||
|
Route::get('', 'OAuth2SummitEventsApiController@getUnpublishedEvents');
|
||||||
|
//Route::get('{event_id}', 'OAuth2SummitEventsApiController@getUnpublisedEvent');
|
||||||
|
});
|
||||||
Route::get('/published', 'OAuth2SummitEventsApiController@getScheduledEvents');
|
Route::get('/published', 'OAuth2SummitEventsApiController@getScheduledEvents');
|
||||||
Route::post('', [ 'middleware' => 'auth.user:administrators', 'uses' => 'OAuth2SummitEventsApiController@addEvent']);
|
Route::post('', [ 'middleware' => 'auth.user:administrators', 'uses' => 'OAuth2SummitEventsApiController@addEvent']);
|
||||||
Route::group(array('prefix' => '{event_id}'), function () {
|
Route::group(array('prefix' => '{event_id}'), function () {
|
||||||
|
@ -25,6 +25,84 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||||||
class Presentation extends SummitEvent
|
class Presentation extends SummitEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the phase that a presentation has been created, but
|
||||||
|
* no information has been saved to it.
|
||||||
|
*/
|
||||||
|
const PHASE_NEW = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the phase where a presenation has been given a summary,
|
||||||
|
* but no speakers have been added
|
||||||
|
*/
|
||||||
|
const PHASE_SUMMARY = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* defines a phase where a presentation has a tags
|
||||||
|
*/
|
||||||
|
const PHASE_TAGS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* defines a phase where a presentation has a summary and speakers
|
||||||
|
*/
|
||||||
|
const PHASE_SPEAKERS = 3;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a phase where a presentation has been submitted successfully
|
||||||
|
*/
|
||||||
|
const PHASE_COMPLETE = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
const STATUS_RECEIVED = 'Received';
|
||||||
|
|
||||||
|
const ClassNamePresentation = 'Presentation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Level", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Status", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Progress", type="integer")
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $progress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="ProblemAddressed", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $problem_addressed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="AttendeesExpectedLearnt", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $attendees_expected_learnt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="ToRecord", type="boolean")
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $to_record;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="moderated_presentations")
|
||||||
|
* @ORM\JoinColumn(name="ModeratorID", referencedColumnName="ID")
|
||||||
|
* @var PresentationSpeaker
|
||||||
|
*/
|
||||||
|
private $moderator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="models\summit\PresentationMaterial", mappedBy="presentation", cascade={"persist"}, orphanRemoval=true)
|
* @ORM\OneToMany(targetEntity="models\summit\PresentationMaterial", mappedBy="presentation", cascade={"persist"}, orphanRemoval=true)
|
||||||
* @var PresentationMaterial[]
|
* @var PresentationMaterial[]
|
||||||
@ -38,10 +116,10 @@ class Presentation extends SummitEvent
|
|||||||
private $speakers;
|
private $speakers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(name="ToRecord", type="boolean")
|
* @ORM\OneToMany(targetEntity="models\summit\SummitSelectedPresentation", mappedBy="presentation", cascade={"persist"}, orphanRemoval=true)
|
||||||
* @var bool
|
* @var SummitSelectedPresentation[]
|
||||||
*/
|
*/
|
||||||
protected $to_record;
|
private $selected_presentations;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
@ -107,23 +185,6 @@ class Presentation extends SummitEvent
|
|||||||
$this->problem_addressed = $problem_addressed;
|
$this->problem_addressed = $problem_addressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="Level", type="string")
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $level;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="ProblemAddressed", type="string")
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $problem_addressed;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="AttendeesExpectedLearnt", type="string")
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $attendees_expected_learnt;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
@ -148,8 +209,6 @@ class Presentation extends SummitEvent
|
|||||||
return self::ClassNamePresentation;
|
return self::ClassNamePresentation;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClassNamePresentation = 'Presentation';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return PresentationSpeaker[]
|
* @return PresentationSpeaker[]
|
||||||
*/
|
*/
|
||||||
@ -292,13 +351,6 @@ class Presentation extends SummitEvent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity="PresentationSpeaker", inversedBy="moderated_presentations")
|
|
||||||
* @ORM\JoinColumn(name="ModeratorID", referencedColumnName="ID")
|
|
||||||
* @var PresentationSpeaker
|
|
||||||
*/
|
|
||||||
private $moderator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return PresentationSpeaker
|
* @return PresentationSpeaker
|
||||||
*/
|
*/
|
||||||
@ -319,4 +371,68 @@ class Presentation extends SummitEvent
|
|||||||
$this->moderator = null;
|
$this->moderator = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getStatus()
|
||||||
|
{
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $status
|
||||||
|
*/
|
||||||
|
public function setStatus($status)
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getProgress()
|
||||||
|
{
|
||||||
|
return $this->progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $progress
|
||||||
|
*/
|
||||||
|
public function setProgress($progress)
|
||||||
|
{
|
||||||
|
$this->progress = $progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PresentationMaterial[]
|
||||||
|
*/
|
||||||
|
public function getMaterials()
|
||||||
|
{
|
||||||
|
return $this->materials;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationMaterial[] $materials
|
||||||
|
*/
|
||||||
|
public function setMaterials($materials)
|
||||||
|
{
|
||||||
|
$this->materials = $materials;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SummitSelectedPresentation[]
|
||||||
|
*/
|
||||||
|
public function getSelectedPresentations()
|
||||||
|
{
|
||||||
|
return $this->selected_presentations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SummitSelectedPresentation[] $selected_presentations
|
||||||
|
*/
|
||||||
|
public function setSelectedPresentations($selected_presentations)
|
||||||
|
{
|
||||||
|
$this->selected_presentations = $selected_presentations;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,31 @@ class PresentationCategory extends SilverstripeBaseModel
|
|||||||
*/
|
*/
|
||||||
private $code;
|
private $code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="SessionCount", type="integer")
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $session_count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="AlternateCount", type="integer")
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $alternate_count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="LightningCount", type="integer")
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $lightning_count;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="LightningAlternateCount", type="integer")
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $lightning_alternate_count;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -129,4 +154,67 @@ class PresentationCategory extends SilverstripeBaseModel
|
|||||||
return $this->groups;
|
return $this->groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSessionCount()
|
||||||
|
{
|
||||||
|
return $this->session_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $session_count
|
||||||
|
*/
|
||||||
|
public function setSessionCount($session_count)
|
||||||
|
{
|
||||||
|
$this->session_count = $session_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getAlternateCount()
|
||||||
|
{
|
||||||
|
return $this->alternate_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $alternate_count
|
||||||
|
*/
|
||||||
|
public function setAlternateCount($alternate_count)
|
||||||
|
{
|
||||||
|
$this->alternate_count = $alternate_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getLightningCount()
|
||||||
|
{
|
||||||
|
return $this->lightning_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $lightning_count
|
||||||
|
*/
|
||||||
|
public function setLightningCount($lightning_count)
|
||||||
|
{
|
||||||
|
$this->lightning_count = $lightning_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getLightningAlternateCount()
|
||||||
|
{
|
||||||
|
return $this->lightning_alternate_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $lightning_alternate_count
|
||||||
|
*/
|
||||||
|
public function setLightningAlternateCount($lightning_alternate_count)
|
||||||
|
{
|
||||||
|
$this->lightning_alternate_count = $lightning_alternate_count;
|
||||||
|
}
|
||||||
}
|
}
|
@ -34,6 +34,73 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
*/
|
*/
|
||||||
private $first_name;
|
private $first_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="LastName", type="string")
|
||||||
|
*/
|
||||||
|
private $last_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Title", type="string")
|
||||||
|
*/
|
||||||
|
private $title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Bio", type="string")
|
||||||
|
*/
|
||||||
|
private $bio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="IRCHandle", type="string")
|
||||||
|
*/
|
||||||
|
private $irc_handle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="TwitterName", type="string")
|
||||||
|
*/
|
||||||
|
private $twitter_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="SpeakerRegistrationRequest")
|
||||||
|
* @ORM\JoinColumn(name="RegistrationRequestID", referencedColumnName="ID")
|
||||||
|
* @var SpeakerRegistrationRequest
|
||||||
|
*/
|
||||||
|
private $registration_request;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToMany(targetEntity="models\summit\Presentation", inversedBy="speakers")
|
||||||
|
* @ORM\JoinTable(name="Presentation_Speakers",
|
||||||
|
* joinColumns={
|
||||||
|
* @ORM\JoinColumn(name="PresentationSpeakerID", referencedColumnName="ID")
|
||||||
|
* },
|
||||||
|
* inverseJoinColumns={
|
||||||
|
* @ORM\JoinColumn(name="PresentationID", referencedColumnName="ID")
|
||||||
|
* }
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
private $presentations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity="Presentation", mappedBy="moderator", cascade={"persist"})
|
||||||
|
* @var Presentation[]
|
||||||
|
*/
|
||||||
|
private $moderated_presentations;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="models\main\File")
|
||||||
|
* @ORM\JoinColumn(name="PhotoID", referencedColumnName="ID")
|
||||||
|
* @var File
|
||||||
|
*/
|
||||||
|
private $photo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="models\main\Member")
|
||||||
|
* @ORM\JoinColumn(name="MemberID", referencedColumnName="ID")
|
||||||
|
* @var Member
|
||||||
|
*/
|
||||||
|
private $member;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
@ -130,50 +197,6 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
$this->twitter_name = $twitter_name;
|
$this->twitter_name = $twitter_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="LastName", type="string")
|
|
||||||
*/
|
|
||||||
private $last_name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="Title", type="string")
|
|
||||||
*/
|
|
||||||
private $title;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="Bio", type="string")
|
|
||||||
*/
|
|
||||||
private $bio;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="IRCHandle", type="string")
|
|
||||||
*/
|
|
||||||
private $irc_handle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="TwitterName", type="string")
|
|
||||||
*/
|
|
||||||
private $twitter_name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToMany(targetEntity="models\summit\Presentation", inversedBy="speakers")
|
|
||||||
* @ORM\JoinTable(name="Presentation_Speakers",
|
|
||||||
* joinColumns={
|
|
||||||
* @ORM\JoinColumn(name="PresentationSpeakerID", referencedColumnName="ID")
|
|
||||||
* },
|
|
||||||
* inverseJoinColumns={
|
|
||||||
* @ORM\JoinColumn(name="PresentationID", referencedColumnName="ID")
|
|
||||||
* }
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
private $presentations;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\OneToMany(targetEntity="Presentation", mappedBy="moderator", cascade={"persist"})
|
|
||||||
* @var Presentation[]
|
|
||||||
*/
|
|
||||||
private $moderated_presentations;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@ -278,14 +301,6 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
})->toArray();
|
})->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity="models\main\File")
|
|
||||||
* @ORM\JoinColumn(name="PhotoID", referencedColumnName="ID")
|
|
||||||
* @var File
|
|
||||||
*/
|
|
||||||
protected $photo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return File
|
* @return File
|
||||||
*/
|
*/
|
||||||
@ -294,13 +309,6 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
return $this->photo;
|
return $this->photo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\ManyToOne(targetEntity="models\main\Member")
|
|
||||||
* @ORM\JoinColumn(name="MemberID", referencedColumnName="ID")
|
|
||||||
* @var Member
|
|
||||||
*/
|
|
||||||
private $member;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Member
|
* @return Member
|
||||||
*/
|
*/
|
||||||
@ -328,4 +336,20 @@ class PresentationSpeaker extends SilverstripeBaseModel
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SpeakerRegistrationRequest
|
||||||
|
*/
|
||||||
|
public function getRegistrationRequest()
|
||||||
|
{
|
||||||
|
return $this->registration_request;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SpeakerRegistrationRequest $registration_request
|
||||||
|
*/
|
||||||
|
public function setRegistrationRequest($registration_request)
|
||||||
|
{
|
||||||
|
$this->registration_request = $registration_request;
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,140 @@
|
|||||||
|
<?php namespace models\summit;
|
||||||
|
/**
|
||||||
|
* Copyright 2017 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\main\Member;
|
||||||
|
use models\utils\SilverstripeBaseModel;
|
||||||
|
use Doctrine\ORM\Mapping AS ORM;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SpeakerRegistrationRequest
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(name="SpeakerRegistrationRequest")
|
||||||
|
* @package models\summit
|
||||||
|
*/
|
||||||
|
class SpeakerRegistrationRequest extends SilverstripeBaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Email", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="IsConfirmed", type="boolean")
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $is_confirmed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="ConfirmationDate", type="datetime")
|
||||||
|
* @var \DateTime
|
||||||
|
*/
|
||||||
|
private $confirmation_date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="PresentationSpeaker")
|
||||||
|
* @ORM\JoinColumn(name="SpeakerID", referencedColumnName="ID")
|
||||||
|
* @var PresentationSpeaker
|
||||||
|
*/
|
||||||
|
private $moderator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="models\main\Member")
|
||||||
|
* @ORM\JoinColumn(name="ProposerID", referencedColumnName="ID")
|
||||||
|
* @var Member
|
||||||
|
*/
|
||||||
|
private $proposer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getEmail()
|
||||||
|
{
|
||||||
|
return $this->email;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $email
|
||||||
|
*/
|
||||||
|
public function setEmail($email)
|
||||||
|
{
|
||||||
|
$this->email = $email;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function isConfirmed()
|
||||||
|
{
|
||||||
|
return $this->is_confirmed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $is_confirmed
|
||||||
|
*/
|
||||||
|
public function setIsConfirmed($is_confirmed)
|
||||||
|
{
|
||||||
|
$this->is_confirmed = $is_confirmed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getConfirmationDate()
|
||||||
|
{
|
||||||
|
return $this->confirmation_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $confirmation_date
|
||||||
|
*/
|
||||||
|
public function setConfirmationDate($confirmation_date)
|
||||||
|
{
|
||||||
|
$this->confirmation_date = $confirmation_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PresentationSpeaker
|
||||||
|
*/
|
||||||
|
public function getModerator()
|
||||||
|
{
|
||||||
|
return $this->moderator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationSpeaker $moderator
|
||||||
|
*/
|
||||||
|
public function setModerator($moderator)
|
||||||
|
{
|
||||||
|
$this->moderator = $moderator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Member
|
||||||
|
*/
|
||||||
|
public function getProposer()
|
||||||
|
{
|
||||||
|
return $this->proposer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Member $proposer
|
||||||
|
*/
|
||||||
|
public function setProposer($proposer)
|
||||||
|
{
|
||||||
|
$this->proposer = $proposer;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,144 @@
|
|||||||
|
<?php namespace models\summit;
|
||||||
|
/**
|
||||||
|
* Copyright 2017 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;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use models\main\Member;
|
||||||
|
/**
|
||||||
|
* Class SummitSelectedPresentation
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(name="SummitSelectedPresentation")
|
||||||
|
* @package models\summit
|
||||||
|
*/
|
||||||
|
class SummitSelectedPresentation extends SilverstripeBaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
const CollectionSelected = 'selected';
|
||||||
|
const CollectionMaybe = 'maybe';
|
||||||
|
const CollectionPass = 'pass';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Collection", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="`Order`", type="integer")
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $order;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="SummitSelectedPresentationList")
|
||||||
|
* @ORM\JoinColumn(name="SummitSelectedPresentationListID", referencedColumnName="ID")
|
||||||
|
* @var SummitSelectedPresentationList
|
||||||
|
*/
|
||||||
|
private $list;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="Presentation")
|
||||||
|
* @ORM\JoinColumn(name="PresentationID", referencedColumnName="ID")
|
||||||
|
* @var Presentation
|
||||||
|
*/
|
||||||
|
private $presentation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="models\main\Member", fetch="EXTRA_LAZY")
|
||||||
|
* @ORM\JoinColumn(name="MemberID", referencedColumnName="ID")
|
||||||
|
* @var Member
|
||||||
|
*/
|
||||||
|
private $member = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCollection()
|
||||||
|
{
|
||||||
|
return $this->collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $collection
|
||||||
|
*/
|
||||||
|
public function setCollection($collection)
|
||||||
|
{
|
||||||
|
$this->collection = $collection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getOrder()
|
||||||
|
{
|
||||||
|
return $this->order;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $order
|
||||||
|
*/
|
||||||
|
public function setOrder($order)
|
||||||
|
{
|
||||||
|
$this->order = $order;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SummitSelectedPresentationList
|
||||||
|
*/
|
||||||
|
public function getList()
|
||||||
|
{
|
||||||
|
return $this->list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SummitSelectedPresentationList $list
|
||||||
|
*/
|
||||||
|
public function setList($list)
|
||||||
|
{
|
||||||
|
$this->list = $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Presentation
|
||||||
|
*/
|
||||||
|
public function getPresentation()
|
||||||
|
{
|
||||||
|
return $this->presentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Presentation $presentation
|
||||||
|
*/
|
||||||
|
public function setPresentation($presentation)
|
||||||
|
{
|
||||||
|
$this->presentation = $presentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Member
|
||||||
|
*/
|
||||||
|
public function getMember()
|
||||||
|
{
|
||||||
|
return $this->member;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Member $member
|
||||||
|
*/
|
||||||
|
public function setMember($member)
|
||||||
|
{
|
||||||
|
$this->member = $member;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,193 @@
|
|||||||
|
<?php namespace models\summit;
|
||||||
|
/**
|
||||||
|
* Copyright 2017 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;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use models\main\Member;
|
||||||
|
/**
|
||||||
|
* Class SummitSelectedPresentationList
|
||||||
|
* @ORM\Entity
|
||||||
|
* @ORM\Table(name="SummitSelectedPresentationList")
|
||||||
|
* @package models\summit
|
||||||
|
*/
|
||||||
|
class SummitSelectedPresentationList extends SilverstripeBaseModel
|
||||||
|
{
|
||||||
|
const Individual = 'Individual';
|
||||||
|
const Group = 'Group';
|
||||||
|
const Session = 'Session';
|
||||||
|
const Lightning = 'Lightning';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Name", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="ListType", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $list_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="ListClass", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $list_class;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="Hash", type="string")
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $hash;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="PresentationCategory", fetch="EXTRA_LAZY")
|
||||||
|
* @ORM\JoinColumn(name="CategoryID", referencedColumnName="ID")
|
||||||
|
* @var PresentationCategory
|
||||||
|
*/
|
||||||
|
private $category = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToOne(targetEntity="models\main\Member", fetch="EXTRA_LAZY")
|
||||||
|
* @ORM\JoinColumn(name="MemberID", referencedColumnName="ID")
|
||||||
|
* @var Member
|
||||||
|
*/
|
||||||
|
private $member = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\OneToMany(targetEntity="SummitSelectedPresentation", mappedBy="list", cascade={"persist"}, orphanRemoval=true)
|
||||||
|
* @var SummitSelectedPresentation[]
|
||||||
|
*/
|
||||||
|
private $selected_presentations;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->selected_presentations = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
|
public function setName($name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getListType()
|
||||||
|
{
|
||||||
|
return $this->list_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $list_type
|
||||||
|
*/
|
||||||
|
public function setListType($list_type)
|
||||||
|
{
|
||||||
|
$this->list_type = $list_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getListClass()
|
||||||
|
{
|
||||||
|
return $this->list_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $list_class
|
||||||
|
*/
|
||||||
|
public function setListClass($list_class)
|
||||||
|
{
|
||||||
|
$this->list_class = $list_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getHash()
|
||||||
|
{
|
||||||
|
return $this->hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $hash
|
||||||
|
*/
|
||||||
|
public function setHash($hash)
|
||||||
|
{
|
||||||
|
$this->hash = $hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PresentationCategory
|
||||||
|
*/
|
||||||
|
public function getCategory()
|
||||||
|
{
|
||||||
|
return $this->category;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PresentationCategory $category
|
||||||
|
*/
|
||||||
|
public function setCategory($category)
|
||||||
|
{
|
||||||
|
$this->category = $category;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Member
|
||||||
|
*/
|
||||||
|
public function getMember()
|
||||||
|
{
|
||||||
|
return $this->member;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Member $member
|
||||||
|
*/
|
||||||
|
public function setMember($member)
|
||||||
|
{
|
||||||
|
$this->member = $member;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return SummitSelectedPresentation[]
|
||||||
|
*/
|
||||||
|
public function getSelectedPresentations()
|
||||||
|
{
|
||||||
|
return $this->selected_presentations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param SummitSelectedPresentation[] $selected_presentations
|
||||||
|
*/
|
||||||
|
public function setSelectedPresentations($selected_presentations)
|
||||||
|
{
|
||||||
|
$this->selected_presentations = $selected_presentations;
|
||||||
|
}
|
||||||
|
}
|
@ -17,7 +17,10 @@ use Doctrine\ORM\Tools\Pagination\Paginator;
|
|||||||
use models\summit\ISummitEventRepository;
|
use models\summit\ISummitEventRepository;
|
||||||
use models\summit\SummitEvent;
|
use models\summit\SummitEvent;
|
||||||
use App\Repositories\SilverStripeDoctrineRepository;
|
use App\Repositories\SilverStripeDoctrineRepository;
|
||||||
|
use utils\DoctrineCaseFilterMapping;
|
||||||
|
use utils\DoctrineFilterMapping;
|
||||||
use utils\DoctrineJoinFilterMapping;
|
use utils\DoctrineJoinFilterMapping;
|
||||||
|
use utils\DoctrineSwitchFilterMapping;
|
||||||
use utils\Filter;
|
use utils\Filter;
|
||||||
use utils\Order;
|
use utils\Order;
|
||||||
use utils\PagingInfo;
|
use utils\PagingInfo;
|
||||||
@ -66,11 +69,13 @@ final class DoctrineSummitEventRepository
|
|||||||
protected function getFilterMappings()
|
protected function getFilterMappings()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'title' => 'e.title:json_string',
|
'title' => 'e.title:json_string',
|
||||||
'published' => 'e.published',
|
'abstract' => 'e.abstract:json_string',
|
||||||
'start_date' => 'e.start_date:datetime_epoch',
|
'social_summary' => 'e.social_summary:json_string',
|
||||||
'end_date' => 'e.end_date:datetime_epoch',
|
'published' => 'e.published',
|
||||||
'tags' => new DoctrineJoinFilterMapping
|
'start_date' => 'e.start_date:datetime_epoch',
|
||||||
|
'end_date' => 'e.end_date:datetime_epoch',
|
||||||
|
'tags' => new DoctrineJoinFilterMapping
|
||||||
(
|
(
|
||||||
'e.tags',
|
'e.tags',
|
||||||
't',
|
't',
|
||||||
@ -100,11 +105,44 @@ final class DoctrineSummitEventRepository
|
|||||||
'c',
|
'c',
|
||||||
"c.id :operator :value"
|
"c.id :operator :value"
|
||||||
),
|
),
|
||||||
'speaker' => new DoctrineJoinFilterMapping
|
'speaker' => new DoctrineFilterMapping
|
||||||
(
|
(
|
||||||
'e.speakers',
|
"( concat(sp.first_name, ' ', sp.last_name) :operator ':value' ".
|
||||||
'sp',
|
"OR concat(spm.first_name, ' ', spm.last_name) :operator ':value' ".
|
||||||
"concat(sp.first_name, ' ', sp.last_name) :operator ':value'"
|
"OR concat(spmm.first_name, ' ', spmm.last_name) :operator ':value' ".
|
||||||
|
"OR sp.first_name :operator ':value' ".
|
||||||
|
"OR sp.last_name :operator ':value' ".
|
||||||
|
"OR spm.first_name :operator ':value' ".
|
||||||
|
"OR spm.last_name :operator ':value' ".
|
||||||
|
"OR spmm.first_name :operator ':value' ".
|
||||||
|
"OR spmm.last_name :operator ':value' )"
|
||||||
|
),
|
||||||
|
'speaker_email' => new DoctrineFilterMapping
|
||||||
|
(
|
||||||
|
"(sprr.email :operator ':value' OR spmm.email :operator ':value')"
|
||||||
|
),
|
||||||
|
'selection_status' => new DoctrineSwitchFilterMapping([
|
||||||
|
'selected' => new DoctrineCaseFilterMapping(
|
||||||
|
'selected',
|
||||||
|
"ssp.order is not null and sspl.list_type = 'Group' and sspl.category = e.category"
|
||||||
|
),
|
||||||
|
'accepted' => new DoctrineCaseFilterMapping(
|
||||||
|
'accepted',
|
||||||
|
"ssp.`order` is not null and ssp.order <= e.category.session_count and sspl.list_type = 'Group' and sspl.list_class = 'Session' and sspl.category = e.category"
|
||||||
|
),
|
||||||
|
'alternate' => new DoctrineCaseFilterMapping(
|
||||||
|
'alternate',
|
||||||
|
"ssp.`order` is not null and ssp.`order` > e.category.session_count and sspl.list_type = 'Group' and sspl.list_class = 'Session' and sspl.category = e.category"
|
||||||
|
),
|
||||||
|
'lightning-accepted' => new DoctrineCaseFilterMapping(
|
||||||
|
'lightning-accepted',
|
||||||
|
"ssp.`order` is not null and ssp.`order` <= e.category.lightning_count and sspl.list_type = 'Group' and sspl.list_class = 'Lightning' and sspl.category = e.category"
|
||||||
|
),
|
||||||
|
'lightning-alternate' => new DoctrineCaseFilterMapping(
|
||||||
|
'lightning-alternate',
|
||||||
|
"ssp.`order` is not null and ssp.`order` > e.category.lightning_count and sspl.list_type = 'Group' and sspl.list_class = 'Lightning' and sspl.category = e.category"
|
||||||
|
),
|
||||||
|
]
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -131,8 +169,10 @@ final class DoctrineSummitEventRepository
|
|||||||
*/
|
*/
|
||||||
public function getAllByPage(PagingInfo $paging_info, Filter $filter = null, Order $order = null)
|
public function getAllByPage(PagingInfo $paging_info, Filter $filter = null, Order $order = null)
|
||||||
{
|
{
|
||||||
$class = count($filter->getFilter('speaker')) > 0?
|
$class = $filter->hasFilter('speaker')
|
||||||
\models\summit\Presentation::class :
|
|| $filter->hasFilter('selection_status')
|
||||||
|
|| $filter->hasFilter('speaker_email')?
|
||||||
|
\models\summit\Presentation::class:
|
||||||
\models\summit\SummitEvent::class;
|
\models\summit\SummitEvent::class;
|
||||||
|
|
||||||
$query = $this->getEntityManager()->createQueryBuilder()
|
$query = $this->getEntityManager()->createQueryBuilder()
|
||||||
@ -140,7 +180,6 @@ final class DoctrineSummitEventRepository
|
|||||||
->from($class, "e");
|
->from($class, "e");
|
||||||
|
|
||||||
if(!is_null($filter)){
|
if(!is_null($filter)){
|
||||||
|
|
||||||
$filter->apply2Query($query, $this->getFilterMappings());
|
$filter->apply2Query($query, $this->getFilterMappings());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,17 +191,26 @@ final class DoctrineSummitEventRepository
|
|||||||
$query = $query->addOrderBy("e.end_date", 'ASC');
|
$query = $query->addOrderBy("e.end_date", 'ASC');
|
||||||
}
|
}
|
||||||
|
|
||||||
$query= $query
|
if($class == \models\summit\Presentation::class) {
|
||||||
|
$query = $query->innerJoin("e.speakers", "sp", Join::WITH);
|
||||||
|
$query = $query->leftJoin('e.selected_presentations', "ssp", Join::LEFT_JOIN);
|
||||||
|
$query = $query->leftJoin('ssp.list', "sspl", Join::LEFT_JOIN);
|
||||||
|
$query = $query->leftJoin('e.moderator', "spm", Join::LEFT_JOIN);
|
||||||
|
$query = $query->leftJoin('sp.member', "spmm", Join::LEFT_JOIN);
|
||||||
|
$query = $query->leftJoin('sp.registration_request', "sprr", Join::LEFT_JOIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = $query
|
||||||
->andWhere("not e INSTANCE OF ('" . implode("','", self::$forbidded_classes) . "')")
|
->andWhere("not e INSTANCE OF ('" . implode("','", self::$forbidded_classes) . "')")
|
||||||
->setFirstResult($paging_info->getOffset())
|
->setFirstResult($paging_info->getOffset())
|
||||||
->setMaxResults($paging_info->getPerPage());
|
->setMaxResults($paging_info->getPerPage());
|
||||||
|
|
||||||
$paginator = new Paginator($query, $fetchJoinCollection = true);
|
$paginator = new Paginator($query, $fetchJoinCollection = true);
|
||||||
$total = $paginator->count();
|
$total = $paginator->count();
|
||||||
$data = array();
|
$data = [];
|
||||||
|
|
||||||
foreach($paginator as $entity)
|
foreach($paginator as $entity)
|
||||||
array_push($data, $entity);
|
$data[]= $entity;
|
||||||
|
|
||||||
return new PagingResponse
|
return new PagingResponse
|
||||||
(
|
(
|
||||||
|
@ -170,6 +170,12 @@ class ApiEndpointsSeeder extends Seeder
|
|||||||
'http_method' => 'GET',
|
'http_method' => 'GET',
|
||||||
'scopes' => [sprintf('%s/summits/read', $current_realm)],
|
'scopes' => [sprintf('%s/summits/read', $current_realm)],
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'get-unpublished-events',
|
||||||
|
'route' => '/api/v1/summits/{id}/events/unpublished',
|
||||||
|
'http_method' => 'GET',
|
||||||
|
'scopes' => [sprintf('%s/summits/read', $current_realm)],
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'name' => 'get-all-events',
|
'name' => 'get-all-events',
|
||||||
'route' => '/api/v1/summits/events',
|
'route' => '/api/v1/summits/events',
|
||||||
|
@ -2389,4 +2389,38 @@ final class OAuth2SummitApiTest extends ProtectedApiTest
|
|||||||
$content = $response->getContent();
|
$content = $response->getContent();
|
||||||
$this->assertResponseStatus(204);
|
$this->assertResponseStatus(204);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetUnpublishedEventBySummit()
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
|
||||||
|
'id' => 23,
|
||||||
|
//'filter' => ['speaker=@Jimmy', 'speaker=@Chimmy'],
|
||||||
|
'filter' => ['speaker=@Jimmy,speaker=@Chimmy'],
|
||||||
|
'expand' => 'speakers',
|
||||||
|
];
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
|
||||||
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
||||||
|
"CONTENT_TYPE" => "application/json"
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->action
|
||||||
|
(
|
||||||
|
"GET",
|
||||||
|
"OAuth2SummitEventsApiController@getUnpublishedEvents",
|
||||||
|
$params,
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
$headers
|
||||||
|
);
|
||||||
|
|
||||||
|
$content = $response->getContent();
|
||||||
|
$this->assertResponseStatus(200);
|
||||||
|
|
||||||
|
$events = json_decode($content);
|
||||||
|
$this->assertTrue(!is_null($events));
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user